akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<numeric>
#include<list>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//最大公約数
template<class T> T gcd(T a, T b)
{
	while (true)
	{
		T r;
		if (a%b == 0) return b;
		else
		{
			r = a % b;
			a = b;
			b = r;
		}
	}
}
//最小公倍数
template<class T> T lcm(T a, T b)
{
	return a / gcd(a, b)*b;
}
//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//int型0~9を文字0~9に変換
char int_to_char(int c) {
	if (c == 0) return '0';
	if (c == 1) return '1';
	if (c == 2) return '2';
	if (c == 3) return '3';
	if (c == 4) return '4';
	if (c == 5) return '5';
	if (c == 6) return '6';
	if (c == 7) return '7';
	if (c == 8) return '8';
	if (c == 9) return '9';
	else return'x';
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn = 1, Kr = 1, Knr = 1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}
//int型10進数をord桁のstring型2進数に変換する
string binary(int x, int ord)
{
	int y;
	string ans = "";
	for (int i = 0; i < ord; i++)
	{
		y = x / (int)pow(2, ord - 1 - i);
		y %= 2;
		if (y == 0) ans += "0";
		else ans += "1";
	}

	return ans;
}
//ord桁のstring型2進数をint型10進数に変換する
int rep_binary(string x, int ord)
{
	int res = 0;
	for (int i = 0; i < ord; i++)
	{
		if (x[i] == '1') res += (int)pow(2, ord - 1 - i);
	}
	return res;
}
//xとyのビットごとの排他的論理和
template<class T> T XOR(T x, T y)
{
	T n = 0;
	while (max(x, y) > pow(2, n)) n++;
	T ans=0;
	for (int i = 0; i <= n; i++)
	{
		T x1 = (x % (T)pow(2, i + 1)) / (T)pow(2, i);
		T y1 = (y % (T)pow(2, i + 1)) / (T)pow(2, i);
		if (x1 != y1) ans += (T)pow(2, i);
	}
	return ans;
}

/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/

char S[10];
long long l;

long long dfs(long long i, long long sum, long long now)
{
	if (i == l) {
		return sum + now;
	}

	return dfs(i + 1, sum + now, (long long)char_to_int(S[i])) + dfs(i + 1, sum, now * 10 + (long long)char_to_int(S[i]));
}

int main()
{
	cin >> S;
	l = strlen(S);

	
	cout << dfs(1, 0, (long long)char_to_int(S[0])) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

int main() {
	
int x ;    
cin >> x ;
string ans =  (x==7 || x==5 || x==3) ? "YES" : "NO" ; 
 cout << ans << endl ;
  	return 0;
}


Measured memory_bytes: 256
from collections import deque

def BFS(s):
    tree=[[] for i in range(n)]
    for i in list:
      tree[i[0]-1].append(i[1]-1)
      tree[i[1]-1].append(i[0]-1)

    dist=[-1 for i in range(n)]
    dist[s-1]=0

    que=deque()
    que.append(s-1)
    while que:
        x=que.popleft()
        for p in tree[x]:
            if dist[p]==-1:
                que.append(p)
                dist[p]=dist[x]+1
    return dist

n,u,v=map(int,input().split())
list=[list(map(int,input().split())) for i in range(n-1)]

u_dist=BFS(u)
v_dist=BFS(v)

l=0
for u_d,v_d in zip(u_dist,v_dist):
 if u_d<v_d:
  l=max(l,v_d)

print(l-1)

Measured memory_bytes: 49104
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

const ll mod = 1e9 + 7;
const ll IMF = 1LL<<29;
const double PI = 3.14159265358979323846;


// ***************************CODE**********************//



ll H,W,D,Q,a,b,val,x[100009],y[100009],s[100009];

int main(){
        _upgrade;
        cin >> H >> W >> D;
        for(int i = 0; i < H; i++){
                for(int j = 0; j < W; j++){
                        cin >> val; 
                        val--;
                        x[val] = i;
                        y[val] = j;
                }
        }

        for(int i = 0; i < H*W; i++){
                if(i >= D) s[i] = s[i-D] + abs(x[i] - x[i-D]) + abs(y[i] - y[i-D]);
        }

        cin >> Q;
        while(Q--){
                cin >> a >> b;
                a--;
                b--;
                cout << s[b] - s[a] << endl;
        }

        return 0;
}



Measured memory_bytes: 3200
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

void solve()
{
	int n;
	cin >> n;
	priority_queue<int, vector<int>, greater<int> > que;
	for (int i = 0; i < n; ++i)
	{
		int a;
		scanf("%d", &a);
		que.push(a);
	}
	int count = 10;
	vector<int> vec;
	while (!que.empty())
	{
		if (count == 0)
		{
			break;
		}
		vec.push_back(que.top());
		que.pop();
		--count;
	}
	vector<int> concatVec;
	for (int i = 0; i < vec.size() ; ++i)
	{
		for (int j = i + 1; j < vec.size(); ++j)
		{
			int temp1 = vec[i];
			int temp2 = vec[j];
			while (temp1)
			{
				temp1 /= 10;
				temp2 *= 10;
			}
			concatVec.push_back(temp2 + vec[i]);
			temp1 = vec[i];
			temp2 = vec[j];
			while (temp2)
			{
				temp2 /= 10;
				temp1 *= 10;
			}
			concatVec.push_back(temp1 + vec[j]);
		}
	}
	sort(concatVec.begin(), concatVec.end());
	cout << concatVec[2] << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1328
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    vector<long long> x(N), y(N), h(N);
    int t;
    REP(i, N){
        cin >> x[i] >> y[i] >> h[i];

        /*
        ピラミッドの高さHは1以上の整数
        座標(X, Y)の高度は場合によって0になりうるが，
        最低一つのデータセットでH > abs(X - Cx) + abs(Y - Cy)を満たす
        h[i] > 0となるものならどれでもいいので出現位置を記録しておく
        */
        if(h[i] > 0){
            t = i;
        }
    }

    // CxとCyは0以上100以下
    REP(cx, 101){
        REP(cy, 101){
            /*
            h[t]は0より大きいので，
            h[t] = H - abs(X - Cx) - abs(Y - Cy)
            となる
            */
            long long H = h[t] + abs(x[t] - cx) + abs(y[t] - cy);
            bool f = true;

            //すべてのデータセットに対し条件式が矛盾しないか確認
            REP(i, N){
                long long tmp;
                tmp = max(H - abs(x[i] - cx) - abs(y[i] - cy), 0LL);
                if(h[i] != tmp){
                    f = false;
                    break;
                }
            }
            if(f){
                cout << cx << " " << cy << " " << H << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n,k;
    cin >> n >> k;
    long long int a,b;
    long long int ans=0;
    for(int i=0;i<k;i++){
        if(i==0)ans+=(n/k)*(n/k)*(n/k);
        else{
            if(n%k>=i)a=n/k+1;
            else a=n/k;
            if(n%k>=k-i)b=n/k+1;
            else b=n/k;
            if((2*k-2*i)%k==0)ans+=a*b*b;
    }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;

	int n, m;
	n = max(A, C);
	m = min(B, D);

	if (n >= m) cout << 0 << endl;
	else cout << m - n << endl;
}

Measured memory_bytes: 3600
object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.map(_.split(' ').map(_.toInt))
  val K = ls(0)(0)
  val a = ls(1)
  val A = a :+ (K + a(0))
  val max = (1 until A.size).foldLeft(0){ (a,i) =>
    val diff = A(i) - A(i-1)
    Math.max(a, diff)
  }
  val ret = K - max
  println(ret)
}


Measured memory_bytes: 52724
function main(input) {
  const args = input.split('/').map(n => parseInt(n, 10));
  const Y = args[0],
        M = args[1],
        D = args[2];
  
  if (Y > 2019 || Y >= 2019 && M > 4) {
    console.log('TBD');
  } else {
    console.log('Heisei');
  }
  
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29340
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int a,b,t;
    cin >> a >> b >> t;
    int ans=0;
    for(int i=1;i<=t;++i){
        if(i%a==0) ans += b;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n=0;
    double x;
    char u[3];
    int i,j;
    double sum=0;

    scanf("%d",&n);

    for(i=0;i<n;i++){

        scanf("%lf",&x);
        scanf("%s",&u);

        if(u[0]=='B'){

            sum+=(x*380000.0);

        } else {

            sum+=x;

        }
    }
    
    printf("%lf",sum);

}

Measured memory_bytes: 128
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const char dir[] = {'!', 'U', 'R', 'D', 'L'};

const int N = 1005;

int n;
ll x[N], y[N];
bool check[2];

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	//cin.tie(NULL);
	//cout.tie(NULL);
	//ios_base::sync_with_stdio(false);

	//cout << setprecision(10) << fixed;
	
	cin >> n;

	for (int i = 1; i <= n; i++) {
		cin >> x[i] >> y[i];
		check[(abs(x[i]) + abs(y[i])) & 1] = 1;
	}

	if (check[0] & check[1]) {
		cout << -1;
		return 0;
	}

	vector < int > arms;

	if (check[0]) {
		arms.pb(1);
		for (int i = 1; i <= n; i++)
			x[i]--;
	}

	for (int i = 0; i < 31; i++)
		arms.pb(1 << i);

	cout << sz(arms) << "\n";
	for (auto i : arms)
		cout << i << " ";
	cout << "\n";

	for (int i = 1; i <= n; i++) {
		string ans;
		for (int j = 30; j >= 0; j--) {
			bool found = 0;
			for (int k = 1; k <= 4; k++) {
				ll tox = x[i] - dx[k] * (1ll << j);
				ll toy = y[i] - dy[k] * (1ll << j);
				if (abs(tox) + abs(toy) <= (1ll << j) - 1) {
					found = 1;
					x[i] = tox;
					y[i] = toy;
					ans += dir[k];
					break;
				}
			}            
			assert(found);
		}
		if (check[0])
			ans += "R";
		rev(all(ans));
		cout << ans << "\n";
	}
	
	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	int n,p; cin>>n; string str; cin>>str;
	string ptr="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
	for(int i=0;i<str.length();++i){
        for(int j=0;j<26;++j){
            if(ptr[j]==str[i]){p=j; break;}
        }
        str[i]=ptr[p+n];
	}
	cout<<str;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    rep(i, n) ans += a[i];
    ans -= n;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int h, w, n; scanf("%d%d%d", &h, &w, &n);
	std::vector<int> a(n), b(n);
	std::vector<std::pair<int, int>> latte;
	for(int i = 0; i < n; i++) {
		scanf("%d%d", &a[i], &b[i]);
		latte.push_back({b[i], a[i]});
	}
	sort(begin(latte), end(latte));
	
	int c = 0;
	std::vector<int> vec(n, 1 << 30);
	for(int i = 0; i < n; i++) {
		int A = latte[i].second, B = latte[i].first;
		if(A - B != c) continue;
		vec[c++] = B;
	}
	int ans = h;
	for(int i = 0; i < n; i++) {
		int k = upper_bound(begin(vec), end(vec), b[i]) - begin(vec);
		if(a[i] - b[i] < k) continue;
		ans = std::min(ans, a[i] - 1);
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 4980
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){

    int m,n,p,count = 0;
    int a[100000];
    LL f[100000];
    FOR(i,0,100000){
        a[i] = 1;
    }

    f[0] = 1;
    f[1] = 1;

    cin >> n >> m;
    FOR(i,0,m){
        cin >> p;
        a[p] = 0;
    }

    FORQ(i,2,n){
        f[i] = f[i-2] * (LL)a[i-2] + f[i-1] * (LL)a[i-1];
        f[i] %= mod;
    }

    cout << f[n];

    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;

int main()
{
  int N;
  int D1[100], D2[100];
  int count = 0;
  
  cin >> N;
  
  for(int i = 0; i< N; i++)
  {
    cin>> D1[i];
    cin>> D2[i];
    
    if(D1[i] == D2[i])
    {
      count++;
      if(count >=3)
      {
        cout << "Yes" << endl;
        break;
      }
    }
    else
    {
      count = 0;
    }
    
    if(i == N-1)
    {
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 3632
import java.io.BufferedInputStream;
import java.util.Arrays;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        int a=sc.nextInt();
        int m[]=new int[a];
        int min=a;
        int count=0;
        for(int i=0;i<a;i++) {
            m[i] = sc.nextInt();
            if(m[i]<min)
                min=m[i];
            if(m[i]<=min)
                count++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 87532
#include <stdio.h>
#include <string.h>

int main()
{
  char s[105];
  int n,i,R,L;

  scanf("%s",s);
  n = strlen(s);
  L = (n-1)/2;
  R = (n+3)/2;

  for(i=0; i<L/2; i++)
  {
    if(s[i] != s[L-1-i])
    {printf("No"); return 0;}
  }

  for(i=0; i<L; i++)
  {
     if(s[i] != s[R-1+i])
     {printf("No"); return 0;}
  }
  printf("Yes");
  return 0;
}


Measured memory_bytes: 1708
using System;

class main {
  static void Main(){
    string input;
    int[] lines = new int[3];
    input = Console.ReadLine();//読み飛ばす
    while((input = Console.ReadLine()) != null) {
      if(isTriangle( lines, input ))
        Console.WriteLine("YES");
      else
        Console.WriteLine("NO");
    }
  }
  private static bool isTriangle(int[] lines, string input){
    string[] strlines = input.Split(new char[] {' '});
    for(int i = 0; i < 3; i++)
      lines[i] = Convert.ToInt32(strlines[i]);
    Array.Sort(lines);
    //Console.WriteLine("{0} {1} {2}", lines[0], lines[1], lines[2]);
    return 
      lines[0]*lines[0] + lines[1]*lines[1] == lines[2] * lines[2];
  }
}


Measured memory_bytes: 13896
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define X first
#define Y second
using namespace std;

struct UnionFindTree{
	UnionFindTree():pos(pair<int, int>(-1, -1)), root(NULL), next(NULL){}
	pair<int, int> pos;
	UnionFindTree *root;
	UnionFindTree *next; //この問題で入れる意味は多分ない
};

void dfs(int x, int y, int &count, vector<vector<UnionFindTree> > &pos){
	int tmp = count;
	if(pos[pos[y][x].pos.Y][pos[y][x].pos.X].root==NULL){
		if(pos[y][x].root==NULL) pos[pos[y][x].pos.Y][pos[y][x].pos.X].root = &pos[y][x];
		else pos[pos[y][x].pos.Y][pos[y][x].pos.X].root = pos[y][x].root;
		dfs(pos[y][x].pos.X, pos[y][x].pos.Y, count, pos);
	}
	else if(pos[y][x].root == pos[pos[y][x].pos.Y][pos[y][x].pos.X].root){
		count++;
	}
	if(tmp == count) pos[y][x].root = NULL;
	return;
}

int main(){
	int n = 0;
	while(cin >> n && n != 0){
		vector<vector<UnionFindTree> > pos(n, vector<UnionFindTree>(n, UnionFindTree()));
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				cin >> pos[i][j].pos.X >> pos[i][j].pos.Y;
			}
		}
		int count = 0;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				if(pos[i][j].root != NULL) continue;
				dfs(j, i, count, pos);
			}
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1332
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    char c; cin>>c;

    cout << ++c << endl;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
   int d,t,s,count=0;;
   cin>>d>>t>>s;
   if(d>0 && t>0 && s>0){
   while(d>0){
       d=d-s;
       count++;
   }
   if(count<=t){
       cout<<"Yes"<<endl;
   }
   else{
       cout<<"No"<<endl;
 }
   }
 
   return 0;
}

Measured memory_bytes: 3640
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
#define MAX_X 100000001
//#define MAX_X 100001

class Solve {
public:
    int N = 0;
    vector<Int> X, Y;


    void solve() {
        int n;
        cin >> n;
        for (int i = 0; i < n; ++i) {
            Int x, y;
            cin >> x >> y;
            if (x != 0 || y != 0) {
                X.push_back(x);
                Y.push_back(y);
                N++;
            }
        }


        double ans = 0.0;

        vector<int> idxes(N);
        for (int i = 0; i < N; ++i) {
            idxes[i] = i;
        }

        sort(all(idxes), [&](int a, int b) {
            double A = atan2(Y[a], X[a]);
            double B = atan2(Y[b], X[b]);

            return A < B;
        });

//        for (int l = 0; l <= N; ++l) {
//            for (int r = 0; r <= N; ++r) {
//                Int x1 = 0;
//                Int y1 = 0;
//                Int x2 = 0;
//                Int y2 = 0;
//
//                for (int i = 0; i < N; ++i) {
//                    if (i >= l && i < r) {
//                        x1 += X[idxes[i]];
//                        y1 += Y[idxes[i]];
//                    } else {
//                        x2 += X[idxes[i]];
//                        y2 += Y[idxes[i]];
//                    }
//                }
//
//                Int tmp = max(x1 * x1 + y1 * y1, x2 * x2 + y2 * y2);
//                chmax(ans, sqrt(tmp));
//            }
//        }

        rep(_, 0, N) {
            Int x = 0;
            Int y = 0;

            for (int i = 0; i < N; ++i) {
                x += X[idxes[i]];
                y += Y[idxes[i]];

                chmax(ans, sqrt(x * x + y * y));
            }

            idxes.push_back(idxes[0]);
            idxes.erase(idxes.begin());
        }

        cout << ans << endl;

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 256
n = int(input())
p = [int(s) for s in input().split() if s]
print(len([p[q+1] for q in range(n-2) if (p[q] < p[q+1] and p[q+1] < p[q+2]) or (p[q] > p[q+1] and p[q+1] > p[q+2])]))

Measured memory_bytes: 3060
#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    int N; cin >> N;
    int A[N]; rep(i, N) cin >> A[i];
    int ans = mod;
    for(int i = 1; i <= 100; i++){
        int acc = 0;
        rep(j, N){
            acc += (i-A[j])*(i-A[j]);
        }
        //cout << acc << endl;
        ans = min(ans, acc);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*In the name of Allah*/
#include<stdio.h>
#include<math.h>
#include<limits.h>
#include<assert.h>
#include<stdbool.h>
#include<stddef.h>
#include<stdint.h>
#include<string.h>
#include<unistd.h>
#include<stdlib.h>
#include<ctype.h>
#include<time.h>
typedef long long ll;
typedef long double ld;

#define s(a) scanf("%d",&a)
#define p(a) printf("%d",a)
#define nl printf("\n")
#define space printf(" ")
#define pi acos(-1)

#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define FOR0(i,n) for(ll i=0;i<n;i++)

int main()
{ 
char c[8];
    scanf("%s",c);
    int t=strlen(c);
    if( c[2]==c[3] && c[4]==c[5])
    printf("Yes");
    else 
    printf("No");
    nl; 
  



return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
using ll=long long;

ll func(ll X){
  int n=X%4;
  if(n==0) return X;
  else if(n==1) return 1;
  else if(n==2) return X+1;
  else return 0;
}

int main(void){
  ll A,B;
  cin>>A>>B;
  ll X=func(A-1) ^ func(B);
  cout << X << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0;i < (n);i++)

int main(void){
    int a;
    cin >> a;
    int sum = a+(a*a)+(a*a*a);
    cout << sum;
    
    
    
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  ll eight = 1, ten = 1;
  ll nine = 1;
  for (int i = 0; i < N; ++i) {
    eight = eight * 8ll % mod;
    nine = nine* 9ll % mod;
    ten = ten * 10ll % mod;
  }
  ll ans = (ten - nine - nine + eight + mod) % mod;
  if (ans < 0) ans += mod;
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3592
#include<iostream>
#include<vector>
#include<string>
using namespace std;
vector<int> vec(0);
int SFT(int top,long long num,int next,int a,int b,int c){
  num=num*10+next;
  if(next==3) a=1;
  if(next==5) b=1;
  if(next==7) c=1;
  if(num<=top){
    if(a+b+c==3) vec.push_back(num);
    SFT(top,num,3,a,b,c);
    SFT(top,num,5,a,b,c);
    SFT(top,num,7,a,b,c);
    return 0;
  }
  else return 0;
}
int main(){
  int n;
  cin >> n;
  int d = SFT(n,0,0,0,0,0);
 
  cout << vec.size() << "\n";
  return 0;
}


Measured memory_bytes: 512
program main
  implicit none

  integer s,a,b,c,d

  read(*,*)s
  a = s/1000
  b = s/100 - a*10
  c = s/10 - a*100 - b*10
  d = s - a*1000 - b*100 - c*10
  
  if ((a == b) .or. (b == c)) then
    write(*,*)"Bad"
    stop
  else if (c == d) then
    write(*,*)"Bad"
    stop
  end if
  write(*,*)"Good"
end program main

Measured memory_bytes: 768
import sys

INF = 1000000007

stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()
def ni(): return int(stdin.readline())

n = ni()
x = 1

for i in range(2, n+1):
    x = x*i

c = 0
ans = 1
y = 2
while(x != 1):
    if(x%y == 0):
        x = x//y
        c = c+1
    else:
        ans = ans*(c+1)
        c = 0
        if(y == 2): y = 3
        else: y = y+2

print(ans*(c+1)%INF)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, w;
	cin >> h >> w;
	vector<vector<char>> a(h, vector<char>(w));
	rep(i, h)rep(j, w) cin >> a[i][j];
	vector<int> resh(h);
	rep(i, h) {
		int b = 0;
		rep(j, w) {
			if (a[i][j] == '#') b++;
		}
		if(b == 0)resh[i] = 1;
	}
	vector<int> resw(w);
	rep(i, w) {
		int b = 0;
		rep(j, h) {
			if (a[j][i] == '#') b++;
		}
		if (b == 0)resw[i] = 1;
	}
	rep(i, h) {
		if (resh[i] == 1) continue;
		rep(j, w) {
			if (resw[j] == 1)continue;
			cout << a[i][j];
		}
		cout << endl;
	}
 	return 0;
}

Measured memory_bytes: 256
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

res = 0
tmp1 = 0
for i in range(n):
    tmp1 += a1[i]
    tmp2 = 0
    for j in range(i, n):
        tmp2 += a2[j]
    res = max(res, tmp1+tmp2)

print(res)


Measured memory_bytes: 9124
#!/usr/bin/env python3
import sys


def solve(X: int):

    k = (X //500)*1000

    p = (X%500)//5*5
    print(k+p)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repp(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

typedef long long ll;
ll mod=1e9+7;

ll extgcd(ll a,ll b,ll& x,ll& y){
	ll d=a;
	if(b!= 0){
		d=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}else{
		x=1; y=0;
	}
	return d;
}
ll mod_inverse(ll a,ll m){
	ll x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}
ll fact[200010];			
void _fact(int n){
	fact[0]=1;
	for(ll i=1;i<=n;i++) fact[i]=(fact[i-1]*i)%mod;
}
//n!=a*p^eとしたときのa mod pを求める
ll mod_fact(ll n,ll p,ll &e){
	e=0;
	if(n==0) return 1;
	ll res=mod_fact(n/p,p,e);
	e+=n/p;
	if(n/p%2!=0) return res*(p-fact[n%p])%p;
	return res*fact[n%p]%p;
}
ll mod_comb(ll n,ll k,ll p){
	if(n<0 || k<0 || n<k) return 0;
	ll e1,e2,e3;
	ll a1=mod_fact(n,p,e1),a2=mod_fact(k,p,e2),a3=mod_fact(n-k,p,e3);
	if(e1>e2+e3) return 0;
	return a1*mod_inverse(a2*a3%p,p)%p;
}

signed main(){
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    int ans = 0;
    _fact(200010);
    rep(i, 0, h - a){
        ans += mod_comb(b - 1 + i, b - 1, mod) * mod_comb(w - b - 1 + h - 1 - i, w - b - 1, mod);
        // cout << ans << endl;
        ans %= mod;
    }
    cout << ans % mod << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main(){
    int n; cin >> n;

    int nature[10][10];
    rep(i,10) rep(j,10) nature[i][j] = 0;

    rep(i,n){
        int l, r = (i+1) %10;
        int dig = 0;
        int num = i+1;
        while(num){
            num /=10;
            dig++;
        }
        l = (i+1) / pow(10,dig-1);

        nature[l][r]++;
    }

    ll ans = 0;

    rep(i,10){
        rep(j,10){
            ans += nature[i][j] * nature[j][i];
        }
    }

    dunk(ans);
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 500000

int tmp[N], cnt;

void MergeSort(int data[], int left, int right){
  int mid, i, j, k;
  if(left >= right) return;
  mid = (left + right) / 2;
  MergeSort(data, left, mid);
  MergeSort(data, mid+1, right);
  for(i=left;i<=mid;i++) tmp[i] = data[i];
  for(i=mid+1,j=right;i<=right;i++,j--) tmp[i] = data[j];
  i = left;
  j = right;
  for(k=left;k<=right;k++,cnt++){
    if(tmp[i] <= tmp[j]) data[k] = tmp[i++];
    else data[k] = tmp[j--];
  }
}

main(){
  int n, data[N], i;
  scanf("%d", &n);
  for(i=0;i<n;i++) scanf("%d", &data[i]);
  MergeSort(data, 0, n-1);
  for(i=0;i<n-1;i++) printf("%d ", data[i]);
  printf("%d\n%d\n", data[n-1], cnt);
  return 0;
}

Measured memory_bytes: 4316
N=int(input())
t=[0]*N
r=set(range(N))
for _ in t:
 x,y,z=list(map(int,input().split()))
 t[x]=[y,z]+[0]*5
 r-={y,z}
def f(i,p,s,d):
 if i<0:return-1
 l,r=t[i][:2]
 t[i][2:]=[p,s,(l!=-1)+(r!=-1),d,max(f(l,i,r,d+1),f(r,i,l,d+1))+1]
 return t[i][-1]
f(r.pop(),-1,-1,0)
for i in range(N):
 print('node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}'.format(i,*t[i][2:],'root'if not t[i][5]else'internal node'if t[i][4]else'leaf'))


Measured memory_bytes: 5612
n,k=map(int,input().split())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
  
ans=Base_10_to_n(n,k)
print(len(ans))

Measured memory_bytes: 3060
S=input()
while S!="":
    if S[-1]=="m":
        if S[-5]=="d" and S[-4]=="r" and S[-3]=="e" and S[-2]=="a":
            S=S[:-5]
            continue
    elif S[-1]=="e":
        if S[-5]=="e" and S[-4]=="r" and S[-3]=="a" and S[-2]=="s":
            S=S[:-5]
            continue
    elif S[-2]=="e" and S[-1]=="r":
        if S[-3]=="m":
            if S[-7]=="d" and S[-6]=="r" and S[-5]=="e" and S[-4]=="a":
                S=S[:-7]
                continue
        elif S[-3]=="s":
            if S[-6]=="e" and S[-5]=="r" and S[-4]=="a":
                S=S[:-6]
                continue
    print("NO")
    break
else:
    print("YES")

Measured memory_bytes: 3188
#include<bits/stdc++.h>
typedef long long int lli;
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int b,c;
   vector <int> a;
   string s;
   cin>>s;
   int n=s.size();
   for(int i=0;i<n;i++){
       b=int(s[i]);
      
       //b=98,1=49,0=48
       if(b==49) a.push_back(1);
       if(b==48) a.push_back(0);
       if(b==66 && (a.size())!=0){
           a.erase(a.end() - 1);
           
       }
    
   }
      for(int i=0;i<a.size();i++) cout<<a[i];
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main(){
  int D, N;
  cin >> D >> N;
  
  if(D==0){
    if(N!=100) cout << N << endl;
    else cout << 101 << endl;
  }
  else if(D==1){
    if(N!=100) cout << 100*N << endl;
    else cout << 10100 << endl;
  } 
  else{
    if(N!=100) cout << 10000*N << endl;
    else cout << 1010000 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  __MAKE_TIME__  Problem: __PROBLEM__ / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

struct UnionFind {
	vector<int> data;
	UnionFind(int n) { data.assign(n, -1); }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
	int size(int x) { return -data[root(x)]; }
};

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	LL N; cin >> N;
	using tp = tuple<LL, LL, LL>;
	vector<tp>xy(N);
	FOR(i, 0, N) {
		LL x, y; cin >> x >> y;
		xy[i] = tp(x, y, i);
	}
	vector<tp>edge;
	SORT(xy); {
		FOR(i, 0, N - 1) {
			LL a, ai, b, bi;
			tie(a, ignore, ai) = xy[i];
			tie(b, ignore, bi) = xy[i + 1];
			edge.push_back(tp(b - a, ai, bi));
		}
	}


	sort(ALL(xy), [](const tp& a, const tp &b) {return get<1>(a) < get<1>(b); });
	{
		FOR(i, 0, N - 1) {
			LL a, ai, b, bi;
			tie(ignore, a, ai) = xy[i];
			tie(ignore, b, bi) = xy[i + 1];
			edge.push_back(tp(b - a, ai, bi));
		}
	}
	UnionFind uf(N);
	SORT(edge);
	LL ans = 0;
	for (auto it : edge) {
		LL c, a, b;
		tie(c, a, b) = it;
		if (!uf.same(a, b)) {
			ans += c;
			uf.unionSet(a, b);
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 10736
// fahadmd16(IIEST Shibpur)
#include<bits/stdc++.h>
using namespace std;

#define ll                                      long long
#define pb                                      push_back
#define pf                                      push_front
#define eb                                      emplace_back
#define mp                                      make_pair
#define ff                                      first
#define ss                                      second
#define db                                      double
#define pll                                     pair<ll, ll>
#define ALL(a)                                  (a).begin(),(a).end()
#define endl                                    "\n"

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forn1(i, n) for (int i = 1; i < int(n); i++)
#define ford(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define ford1(i, n) for (int i = int(n) - 1; i >= 1; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define forabd(i, a, b) for(int i = int(a); i >= int(b); i--)

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)


#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cerr.tie(0)

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define tracen( x , n ){ cerr<<(#x)<<": ";for(int i=0;i<int(n);i++)cerr<<(#x)<<"["<<i<<"]:"<< x[i] << "    "; cerr<<endl;}
#define tracenm( x , n , m ){ cerr<<(#x)<<endl;for(int i=0;i<int(n);i++){ cerr<<"Row #"<<i<<": "; for(int j=0;j<int(m);j++) cerr<<x[i][j]<<"     "; cerr << endl;}}
#define trace(v){ cerr<<#v<<": ";for(auto it=v.begin();it!=v.end();it++)cerr<<*it<<" ";cerr<<endl;}


const ll sz = 1e5 + 2;
const ll mod = 1e9 + 7;
const db PI = acos(-1);
const db eps = 1e-10;



typedef vector<ll> VL;
typedef vector<pll > VLL;
typedef vector<vector<ll> > VVL;
typedef vector<vector<vector<ll> > > VVVL;



ll power(ll n, ll k, ll m) {
	ll ans = 1;
	while (k) {
		if (k & 1)ans = (ans * n) % m;
		k /= 2;
		n = (n * n) % m;
	}
	return ans;
}

void solver() {
	ll a,b;cin>>a>>b;
	cout<<a*b<<endl;

}


int main() {
	IOS;
	ll T = 1; //cin >> T;
	forn1(i, T + 1) {
		clock_t z = clock();
		solver();
		debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
	}
	return 0;
}


Measured memory_bytes: 3792
a = gets.split.map(&:to_i)

for i in (1..a[2]) do
  wait = i % 2
  eat = (i + 1) % 2
  a[eat] = a[eat] - 1 if a[eat] % 2 != 0
  a[wait] = a[wait] + a[eat] / 2
  a[eat] = a[eat] / 2
end

puts "#{a[0]} #{a[1]}"

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector <vector<int>> vec;
vector <int> dp;
vector <int> vis;

void dfs(int i){
    //cout<<i<<endl;
    if(vec[i].size()==0){dp[i]=0;}
    //vis[i]=1;
    for(auto v:vec[i]){
        if(dp[v]==-1)dfs(v);
        dp[i]=max(dp[v]+1,dp[i]);
    }
    //vis[i]=2;
}

int main() {
    int n,m;
    cin>>n>>m;
    vec.assign(n,vector <int>(0));
    dp.assign(n,-1);
    //vis.assign(n,0);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--;b--;
        vec[a].pb(b);
    }
    int mx=-1;
    for(int i=0;i<n;i++){
    if(dp[i]==-1)dfs(i);
    mx=max(mx,dp[i]);}
    cout<<mx<<endl;
    
    
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int N, Y;
    cin >> N >> Y;
    Y /= 1000;
    rep(z, 1e6) {
        if(Y - 10*z < 0 || N - z < 0) continue;
        int k = Y - N - 9*z;
        if(k < 0) continue;
        if(k%4 == 0) {
            int y = k / 4;
            int x = N - z - y;
            if(x >= 0 && y >= 0 && z >= 0) {
                cout << z << " " << y << " " << x << endl;
                assert(x + y + z == N && x + 5*y + 10 * z == Y);
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int isPrime(int x){
  int i;
  if(x<2) return 0;
  else if(x==2) return 1;
  if(x%2==0) return 0;
  for(i=3;i*i<=x;i+=2){
    if(x%i==0) return 0;
  }
  return 1;
}

int main(){
  int n,x,i;
  int cnt = 0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&x);
    if(isPrime(x)) cnt++;
  }
  printf("%d\n",cnt);
  return 0;
}


Measured memory_bytes: 2140
def distinct_or_not():
    # 入力
    N = int(input())
    A = list(map(int, input().split()))
    # Aを集合型に変換
    A_set = set(A)
    # AとA_setを比較
    if len(A) == len(A_set):
        return 'YES'
    else:
        return 'NO'

result = distinct_or_not()
print(result)

Measured memory_bytes: 31224
#include<bits/stdc++.h>

using namespace std;

#define int long long

main() {
#ifdef HOME
    //freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if (4 * a * b < (c - a - b) * (c - a - b) && c - a - b >= 0) cout << "Yes";
    else cout << "No";
    return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;
ll mpow(ll a, ll b) { ll r = 1; a %= mod; while (b) { r = r * ((b % 2) ? a : 1) % mod, a = a * a % mod, b >>= 1; }return r; }



int main() {
	int n; cin >> n;
	vector<int> a(n);
	rep(i, 0, n) cin >> a[i];
	sort(a.begin(), a.end());
	ll ans = 0;
	vector<P> move;
	if (a[0] < 0 && a[n - 1]>0) {
		rep(i,1,n-1) {
			if (a[i] > 0)move.push_back({ 0,i });
			else move.push_back({ n - 1,i });
		}
		move.push_back({ n - 1,0 });
		rep(i, 0, n) ans += abs(a[i]);
	}
	else if (a[0] >= 0){
		rep(i, 1, n - 1) {
			move.push_back({ 0,i });
		}
		move.push_back({ n - 1,0 });
		rep(i, 0, n)ans += abs(a[i]);
		ans -= a[0] * 2;
	}
	else {
		rep(i, 0, n - 1) {
			move.push_back({ n - 1,i });
		}
		rep(i, 0, n)ans += abs(a[i]);
		ans += a[n-1] * 2;
	}
	printf("%lld\n", ans);
	for (P q : move) {
		int x = q.first, y = q.second;
		printf("%d %d\n", a[x], a[y]);
		a[x] -= a[y];
	}
	return 0;
}


Measured memory_bytes: 3952
//06, 10, 2018, 09:01:24 Rafaelcs cpp
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n;

    scanf("%d", &n);

    if(n == 1){
        printf("Hello World\n");
    }else{
        int a, b;

        scanf("%d %d", &a, &b);

        printf("%d\n", a + b);
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>   
#include<algorithm>
using namespace std;

int main(){
  int w[10], k[10];
  for(int i = 0;i < 10;i++)scanf("%d",w + i);
  for(int i = 0;i < 10;i++)scanf("%d",k + i);
  sort(w,w + 10);
  sort(k,k + 10);
  printf("%d %d\n",w[9] + w[8] + w[7], k[9] + k[8] + k[7]);
  return 0;
}

Measured memory_bytes: 1040
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
q = int(input())

cnt = Counter(a)

s = sum(a)

for i in range(q):
	b, c = map(int, input().split())
	s = s - b*cnt[b]
	s = s + c*cnt[b]
	cnt[c] += cnt[b]
	cnt[b] = 0
	print(s)

Measured memory_bytes: 24220
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#define INF 0x3f3f3f3f
#define mod 1000000009
#define e  2.718281828459045
#define eps 1.0e18
#define PI acos(-1)
#define lowbit(x) (x&(-x))
#define memset(x,y) memset(x,y,sizeof(x))
#define lson i << 1,l,m
#define rson i << 1 | 1,m + 1,r
#define ll long long
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	cout<<(n+1)/2 <<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20
#define INF 1e12+20

typedef long long ll;
using namespace std;

int n;
int ans = 0;
int num[101] = {0};
int main() {
    scanf("%d",&n);
    vector<int>d(n);
    rep(i,0,n) cin >> d[i];

    rep(i,0,n) num[d[i]]++;
    rep(i,1,101){
        if(num[i] != 0){
            ans++;
        }
    }
    pout(ans);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

typedef struct{
  char mark;
  int value;
}card;

void BobbleSort(card  *,int);
void SelectionSort(card*,int);
int check(card *,card *,int);

int main (){
  int N,i;

  scanf("%d",&N);

  card a1[N],a2[N],a[N];

  for(i=0;i<N;++i){
    scanf(" %c%d",&a1[i].mark,&a1[i].value);
    a2[i]=a1[i];
    a[i]=a1[i];
  }
  
  BobbleSort(a1,N);
  for(i=0;i<N-1;++i)printf("%c%d ",a1[i].mark,a1[i].value);
  printf("%c%d\n",a1[N-1].mark,a1[N-1].value);
  
  if(check(a1,a,N)==1)printf("Stable\n");
  else printf("Not stable\n");

  

  SelectionSort(a2,N);
  for(i=0;i<N-1;++i)printf("%c%d ",a2[i].mark,a2[i].value);
  printf("%c%d\n",a2[N-1].mark,a2[N-1].value);
  
  if(check(a2,a,N)==1)printf("Stable\n");
  else printf("Not stable\n");

  
  return 0;
}

void BobbleSort(card *a,int N){
  int i,j;
  card tmp;
  for(i=0;i<N;i++){
    for(j=N-1;j>i;j--){
      if(a[j].value < a[j-1].value){
	tmp = a[j];
	a[j] = a[j-1];
	a[j-1] = tmp;
      }
    }
  }
}

void SelectionSort(card *a,int N){
  int i,minj,j;
  card tmp;

  for(i=0;i<N;++i){
    minj=i;
    for(j=i;j<N;j++){
      if(a[j].value < a[minj].value){
	minj = j;
      }
    }
    tmp = a[i];
    a[i] = a[minj];
    a[minj] = tmp;
  }
}

int check(card *in,card *out,int N){
  int i,j,a,b;

  for(i=0;i<N;++i){
    for(j=i+1;j<N;j++){
      for(a=0;a<N;a++){
	for(b=a+1;b<N;b++){
	  if((in[i].value==in[j].value)&&
	     (in[i].value==out[b].value&&in[i].mark==out[b].mark)&&
	     (in[j].value==out[a].value&&in[j].mark==out[a].mark)){
	    return 0;
	  }
       }
      }
    }
  }

  return 1; 
}



Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <cmath>
// #include <algorithm>
// #include <string>
// #include <map>
// #include <set>

// #define MOD 1000000007

using namespace std;
typedef unsigned long long ull;
// typedef long long ll;

// void p() {
//     cout << "\n";
// }
// template<class Head, class... Body>
// void p(Head head, Body... body) {
//     cout << head << ",";
//     p(body...);
// }

int f(ull n) {
    int ret = 0;
    while (n > 0) {
        ret += 1;
        n /= 10;
    }
    return ret;
}

int main(int argc, char const *argv[]) {
    ull N;
    cin >> N;

    ull A, B;
    for (A = 1; A * A <= N; ++A) {
        if (N % A != 0) continue;
        B = N / A;
    }

    cout << f(B) << endl;

    return 0;
}


Measured memory_bytes: 256