akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//String t= sc.next();
		String buff= "";
		//double n = sc.nextInt()/1000.0;
		int m = sc.nextInt();
		//int k = sc.nextInt();
		String s=sc.next();
		long count=0,flag=0;
		long count1=0,count2=0;
		int count3=0;
		int[] array = new int[3];
		/*array[0]=n-m;
		array[1]=n*m;
		array[2]=n+m;*/
		Arrays.sort(array);
		if(m%2!=0) {
			System.out.println("No");
			System.exit(0);
		}

		for(int i=0;i<s.length()/2;i++) {
			if((char)s.charAt(i)!=(char)s.charAt(i+s.length()/2)) {
				count++;
				//System.out.println((char)s.charAt(i)+" "+(char)s.charAt(i+s.length()/2));
			}
		}

		if(count==0) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}

		//System.out.println(buff);
	}
}




Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<int(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define show(x) cout<< #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}	

const ll mod=998244353;
const int INF=INT_MAX/2;
const int N_MAX=100010;
const double PI=3.14159265359;

int main(){
	int n;
	ll len=0;
	cin>>n;
	vector<ll> a=vector<ll>(n,0);
	REP(i,n){
		cin>>a[i];
		len+=a[i];
	}
	ll sum=0;
	int idx=0;
	ll ans=0;
	while(sum<len/2){
		sum+=a[idx];
		idx++;
	}
	if(len%2==0){
		if(sum==len/2){
			ans=0;
		}else{
			ans=sum-(len-sum);
		}
	}else{
		ans=sum-(len-sum);
	}
	sum-=a[idx-1];
	ans=min(ans, (len-sum)-sum);
	cout<<ans<<endl;
}

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

#define 	mod 			1000000007
#define 	ll  			long long int
#define 	rep(i, a, b) 	for(ll i = a ; i < b ; i++)
#define     repn(i, a, b)   for(ll i = a ; i > b ; i--)
#define 	mod1 			1000003
#define     mod2            998244353
#define     inf             2e18
#define 	hi   			"hello"
#define 	nl 				"\n"
#define 	ws 				" "
#define     ff 				first
#define 	ss 				second
#define 	pb 				push_back
#define 	MP				make_pair
#define 	B 				begin()
#define     RB              rbegin()
#define 	E 				end()
#define     UB              upper_bound
#define     LB              lower_bound
#define     present(k, m)   (m.find(k)!=m.end())?1:0
#define 	all(v) 			v.begin(), v.end()
#define 	reset(a, val) 	memset(a, val, sizeof(a))
#define     pll             pair<ll, ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vvll            vector<vll>
#define     vpll            vector<pll>
#define 	vs 				vector<string>
#define     vc              vector<char>
#define     sqr(a)          ((a)*(a))
#define 	print1(a) 		for(auto i : a)cout<<i<<" ";cout<<"\n"
#define 	print2(a) 		for(auto i : a)cout<<i;cout<<"\n"
#define 	print3(a) 		for(auto i : a)cout<<i<<nl;
#define 	boost 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

// ostringstream str1;
// str1 << n;
// string tmp = str1.str();
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }

bool compare(const pair<string, int>&a, const pair<string, int>&b){ return a.second<b.second; }

double logn(double n, double r) { return (n > r - 1) ? 1 + logn(n / r, r) : 0; }

// vll pwx(32);
// void cal(ll x){ pwx[0] = 1; rep(i, 1, 32)pwx[i] =  x*pwx[i-1]; }

/* ################################################################ */

#define space 100005

void dfs(ll u, vvll &adj, vll &vis) {
    vis[u] = 1;
    for(auto v : adj[u]) {
        if(!vis[v])
            dfs(v, adj, vis);
    }
}

void solve() {
    ll n, m;
    cin >> n >> m;

    vvll adj(n+1);

    ll u, v;

    rep(i, 0, m) {
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }

    ll ans = 0;
    vll vis(n+1, 0);

    rep(i, 1, n+1) {
        if(!vis[i]){
            dfs(i, adj, vis);
            ans++;
        }
    }

    cout << ans-1 << nl;
}

int main(){
    // boost;
    // cal(2);
    int t = 1, k = 1;
    // cin>>t;
    while(t--){
        // cout<<"Case #"<<k<<": ";
        solve();
        k++;
    }
}

Measured memory_bytes: 11180
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n,m;
    cin>>n>>m;
    priority_queue<ll> pq;
    rep(i,n){
        int x;
        cin>>x;
        pq.push(x);
    }
    rep(i,m){
        int x = pq.top();pq.pop();
        pq.push(x/2);
    }
    ll ans = 0;
    rep(i,n){
        ans+=pq.top();
        pq.pop();
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

u32 N;

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

    scanf("%u", &N);

    printf("%d\n", 180 * (N - 2));

    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }

signed main() {
SS(int,a);
ll ac=0,wa=0,tle=0,re=0;
rep(i,a){
    SS(string,s);
    if(s=="AC")ac++;
    if(s=="WA")wa++;
    if(s=="TLE")tle++;
    if(s=="RE")re++;
}
cout<<"AC x "<<ac<<endl;
cout<<"WA x "<<wa<<endl;
cout<<"TLE x "<<tle<<endl;
cout<<"RE x "<<re<<endl;
}

Measured memory_bytes: 3656
N = int(input())
A = list(map(int, input().split()))
A.sort()
a = A[0]
b = A[-1]
xy = []
for i in range(1, N-1):
    if A[i] > 0:
        xy.append((a, A[i]))
        a -= A[i]
    else:
        xy.append((b, A[i]))
        b -= A[i]
xy.append((b, a))
print(b-a)
for x, y in xy:
    print(x, y)

Measured memory_bytes: 61372
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a < b){
            System.out.println("a < b");
        } else if(a > b){
            System.out.println("a > b");
        } else {
            System.out.println("a == b");
        }
    }
}


Measured memory_bytes: 26344
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);
		int A, B;

		A = scan.nextInt();
		B = scan.nextInt();

		int pulus, minus, kakezan;

		pulus = A + B;
		minus = A - B;
		kakezan = A * B;

		int ans;

		if (pulus >= minus) {
			ans = pulus;
		} else {
			ans = minus;
		}

		if (kakezan > ans) {
			ans = kakezan;
		}

		System.out.println(ans);

	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。ｓ
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param a 基数
	 * @param n 乗数
	 * @param primeNumMod 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myModPow(long a, long n, long primeNumMod) {

		long ans = 1;

		//乗数が0の場合→1
		if (n == 0)
			return 1;

		if (primeNumMod == 0) {
			//modを使わないとき

			while (n > 0) {

				if (n % 2 == 0) {
					//累乗が偶数の時

					a *= a;
					n = n / 2;
				} else {
					//累乗が奇数の時
					ans *= a;
					n--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			while (n > 0) {

				if (n % 2 == 0) {
					//累乗が偶数の時

					a *= myMod(a, primeNumMod);
					n = n / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(a, primeNumMod);
					n--;

				}
			}

			return myMod(ans, primeNumMod);

		}

	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
using namespace std;
#define MOD 1000000007

int H,W;
vector<string> maze;
vector<vector<int>>dp;

int main()
{
  ios::sync_with_stdio(false);
  cin>>H>>W;
  maze=vector<string>(H+2);
  maze[0]='#'*(W+2);maze[H+1]='#'*(W+2);
  for(int i=1;i<H+1;i++)
  {
    string a;
    cin>>a;
    maze[i]='#'+a+'#';
  }
  dp=vector<vector<int>>(H+2,vector<int>(W+2,0));
  dp[1][0]=1;
  for(int i=1;i<H+1;i++)
  {
    for(int j=1;j<W+1;j++)
    {
      if(maze[i][j]=='.')
      {
        dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
      }
      //cout<<dp[i][j];
    }
    //cout<<endl;
  }
  cout<<dp[H][W]<<endl;

  return 0;

}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<double> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  sort(v.begin(),v.end());
  for(int i=0;i<n-1;i++){
    double x=(v[i]+v[i+1])/2;
    v[i+1]=x;
  }
  cout<<fixed<<setprecision(10)<<v[n-1]<<endl;
  return 0;
}

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

using namespace std;
 
 
int main() {

    int n;
    cin>>n;
    vector<int>A;
    vector<int>B;
    vector<int>C;

    int j = 0;
    for (int i = 0; i < n; i++) {
        cin>>j;
        A.push_back(j-1);
    }

    for (int i = 0; i < n; i++) {
        cin>>j;
        B.push_back(j);
    }

    for (int i = 0; i < n-1; i++) {
        cin>>j;
        C.push_back(j);
    }

    //use
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        if(A[i] == (A[i-1]+1) && (i > 0)){
            sum += B[A[i]]+ C[A[i]-1];
        }else{
            sum += B[A[i]];
        }
    }

    cout<<sum;

    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int GameBoard[200][3]={{0}};
    int PlayerPoint[200]={0};
    int N;
    int i,j,k;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        for(j=0;j<3;j++){
            scanf("%d",&GameBoard[i][j]);
        }
    }

    for(i=0;i<3;i++){
        for(j=0;j<N;j++){
            for(k=0;k<N;k++){
                if(j!=k){
                    if(GameBoard[j][i]==GameBoard[k][i])break;
                }
            }
            if(k==N)PlayerPoint[j]=PlayerPoint[j]+GameBoard[j][i];
        }
    }
    for(i=0;i<N;i++){
        printf("%d\n",PlayerPoint[i]);
    }


    return 0;
}

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

int nijou(int k) {
  int a = 0;
  for (int i = 0; i <= k; i++) {
    if (k == i*i) {
      a++;
    }
  }
  if (a == 1) {
    return 1;
  }
  else {
    return 0;
  }
}



  

int main() {
  int N,D;
  cin >> N >> D;
  int X[11][11];
  for (int i = 0; i < N; i ++) {
    for (int j = 0; j < D; j++) {
      cin >> X[i][j];
    }
  }
  
  int d[100];
  
  
  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i < j) {
        int d = 0;
        for (int k = 0; k < D; k++) {
          d += (X[i][k] - X[j][k])*(X[i][k] - X[j][k]);
        }
        //cout << d << endl;
        ans += nijou(d);

      }
    }
  }
  cout << ans << endl;
}


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

//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

//#define int long long
#define ll long long

ll INF = (1LL << 60);
int mod = 998244353;
using P = pair<ll, ll>;

signed main() {
	int a, b; cin >> a >> b;
	b *= 2;
	cout << max(0, a - b) << endl;
	return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define endl        '\n'
#define pi          2*acos(0.0)
#define pb(a)       push_back(a)
#define db          double
#define ld          long double
#define ll          long long
#define ull         unsigned long long
#define mod         1000000007
#define inf         1000000000000000001
#define sqr(x)      (x) * (x)
#define gcd(a, b)   __gcd(a, b)
#define lcm(a, b)   ((a/gcd(a,b)) * b)
#define debug(x) 	cerr << #x << " = " << (x) <<endl
#define all(x)      (x).begin(), (x).end()
#define unsyncIO    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)


using namespace std;

int main()
{
  	unsyncIO;
    //freopen("/home/taalpatar_shepai/Documents/my_codes/out.txt", "w", stdout);
    int n, cnt = 0;
    cin>>n;
    for (int i = 1; i <= n; i++) {
        cnt += i;
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=5*1e5+2;
struct FenwickTree {
    vector<int> bit;  // binary indexed tree
    int n;
 
    void init(int n) {
        this->n = n;
        bit.assign(n, 0);
    }
    int sum(int r) {
        int ret = 0;
        for (; r >= 0; r = (r & (r + 1)) - 1)
            ret += bit[r];
        return ret;
    }
    void add(int idx, int delta) {
        for (; idx < n; idx = idx | (idx + 1))
            bit[idx] += delta;
    }
    int sum(int l, int r) {
        return sum(r) - sum(l - 1);
    }
    void init(vector<int> a) {
        init(a.size());
        for (size_t i = 0; i < a.size(); i++)
            add(i, a[i]);
    }
}fw;
int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      // #ifndef ONLINE_JUDGE
      // freopen("input.txt", "r", stdin);
      // // freopen("output.txt","w",stdout);
      // #endif
      int n,q;
      cin>>n>>q;
      int a[n];
      for(int i=0;i<n;i++) cin>>a[i];
      vector<pii> v[n+1];
      int ans[q+1];
      for(int i=0;i<q;i++)
      {
        int a,b;
        cin>>a>>b;
        a--; b--;
        v[a].pb({b,i});
      }
      map<int,int> ma;
      int next[n+1];
      for(int i=n-1;i>=0;i--)
      {
        if(ma.count(a[i])==0)
        {
          next[i]=n;
        }
        else{
          next[i]=ma[a[i]];
        }
        // cout<<next[i]<<" ";
        ma[a[i]]=i;
      }
      // for(int i=0;i<n;i++)
      // {
      //   cout<<next[i]<<" ";
      // }
      // return 0;
      fw.init(n+2);
      for(int i=0;i<n;i++)
      {
        if(ma[a[i]]==i)
        {
          fw.add(i,1);
        }
      }
      for(int i=0;i<n;i++)
      {
        for(auto x:v[i])
        {
          ans[x.se]=fw.sum(i,x.fi);
        }
        fw.add(i,-1);
        fw.add(next[i],1);
      }
      for(int i=0;i<q;i++) cout<<ans[i]<<"\n";
}
// I never lose. I either win or I learn

Measured memory_bytes: 75552
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <cmath>
#include <cassert>
using namespace std;
typedef long long ll;
map<ll,vector<pair<ll,ll>>> mp;
ll adj(ll x, ll y){
	if(x>0){
		ll z = x%y;
		return x + (y - x%y)%y;
	}else{
		return x + (-x)%y;
	}
}
int main(){
	int i;
	ll n,x,d;
	cin >> n >> x >> d;
	if(d==0){
		if(x==0) cout << 1 << endl;
		else cout << n + 1 << endl;
		return 0;
	}
	if(d<0){
		x *= -1;
		d *= -1;
	}
	ll summax = 0,summin = 0;
	for(i=1;i<=n;i++){
		summax += n - i;
		summin += (i - 1);
		ll y = abs(i*x)%d;
		ll l = i*x + summin*d,r = i*x + summax*d;
		ll z = abs(i*x)/d;
		mp[(i*x + (z + 1)*d)%d].push_back({adj(l,d)/d,adj(r,d)/d + 1});
	}
	mp[0].push_back({0,1});
	ll ans = 0;
	for(auto x:mp){
		vector<pair<ll,ll>> v = x.second,w;
		sort(v.begin(),v.end());
		for(i=0;i<v.size();i++){
			if(w.size()==0){
				w.push_back(v[i]);
			}else{
				pair<ll,ll> p = w.back();
				if(p.second>=v[i].second) continue;
				if(p.second>=v[i].first){
					w.back().second = v[i].second;
				}else{
					w.push_back(v[i]);
				}
			}
		}
		for(i=0;i<w.size();i++){
			ans += w[i].second - w[i].first;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 22144
// Hovalhagh
// Ya Aziz & Hakim
// AliReza Kaboli

#include <bits/stdc++.h>

using namespace std;

bool a[4];

int main() {
	int q, w;
	cin >> q >> w;
	a[q] = 1;
	a[w] = 1;
	for (int i = 1; i <= 3; ++i)
		if (!a[i]) {
			cout << i << '\n';
			break;
		}
}


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

int main() {
    int f, s;
    char c1, c2;

    cin >> c1 >> c2;
    f = (c1 - '0') * 10 + c2 - '0';
    cin >> c1 >> c2;
    s = (c1 - '0') * 10 + c2 - '0';

    bool ym = false;
    bool my = false;
    if (1 <= s && s <= 12) {
        ym = true;
    }
    if (1 <= f && f <= 12) {
        my = true;
    }

    if (ym && my) {
        cout << "AMBIGUOUS";
    } else if (ym) {
        cout << "YYMM";
    } else if (my) {
        cout << "MMYY";
    } else {
        cout << "NA";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,t;
  cin>>N;
  map<int,int> m;
  bool k=false;
  for(int i=0;i<N;i++){
    cin>>t;
    if(m.count(t)){
      k=true;
      break;
    }
    else{
      m[t]=1;
    }
  }
  if(k){
    cout<<"NO"<<endl;
  }
  else{
    cout<<"YES"<<endl;
  }
}


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

int main(){
    int a, b, c;
    cin>>a>>b>>c;
    
    if(a > b) swap(a, b);
    if(b > c) swap(b, c);
    if(a > b) swap(a, b);
    
    cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;
}


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

using namespace std;

void solve() {
    string s;
    cin >> s;
    string ans = "";
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] == '0')
        {
            ans += '0';
        }
        else if (s[i] == '1')
        {
            ans += '1';
        }
        else
        {
            if (ans.length() > 0)
            {
                ans.erase(ans.length()-1);
            }
        }
    }
    cout << ans << endl;
    
}

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

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();

		final int max_node = 100005;

		int[] dist = new int[max_node]; 
		ArrayList<Integer>[] edges = new ArrayList[max_node];
		int[] in_degree = new int[max_node];
		boolean[] visited = new boolean[max_node];

		for (int i = 0; i < max_node; i++) { 
			edges[i] = new ArrayList<Integer>(); 
		}

	//	System.out.println("Enter "+m+" edges");
		for(int i = 0; i < m ; ++i){
			int x = in.nextInt();
			int y = in.nextInt();
			in_degree[y]++;

			edges[x].add(y);
		}

		Main graph = new Main();

		for(int i =1; i<=n; i++){
			if(visited[i] == false && in_degree[i] == 0){
				graph.dfs(i,edges, visited, in_degree, dist);
			}
		}

		int answer = 0;
		for(int i = 1; i < max_node; ++i){
			if(dist[i] > answer){
				answer = dist[i];
			}
		}
		
		System.out.println(answer);


	}

	private void dfs(int node,ArrayList<Integer>[] edges, boolean[] visited, int[] in_degree, int[] dist){
		if(visited[node] == true){
			return;
		}
		visited[node] = true;
		for(int edge : edges[node]){
			in_degree[edge]--;
			dist[edge] = Math.max(dist[edge], dist[node]+1);
			if(in_degree[edge] == 0 ){
				dfs(edge, edges, visited, in_degree, dist);
			}
		}
	}

}


Measured memory_bytes: 114284
#include <bits/stdc++.h>
using namespace std;
using LL  = long long;
using VI  = vector<LL>;
using VVI = vector<VI>;
using VB  = vector<bool>;
using VS  = vector<string>;
using PII = pair<LL, LL>;
using VP  = vector<PII>;
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first < y.first;});
#define FRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first > y.first;});
#define SSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second < y.second;});
#define SRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second > y.second;});
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define dump(x)      cerr << #x << " = " << (x) << endl;

void sortVecPair(vector<auto>& X, VI& idx, auto comparator) {
    VI idx2(SZ(idx));
    iota(ALL(idx2), 0);
    stable_sort(ALL(idx2), comparator);
    FSORT(X);
    REP(i, SZ(idx)) idx2[i] = idx[idx2[i]];
    REP(i, SZ(idx)) idx[i] = idx2[i];
}

int main() {
    LL N;
    cin >> N;
    vector<pair<string, LL>> X(N);
    REP(i, N) {
        string s;
        LL x;
        cin >> s >> x;
        X[i] = make_pair(s, x);
    }

    VI idx(SZ(X));
    iota(ALL(idx), 0);
    sortVecPair(X, idx, [&] (auto& i, auto& j) {return X[i].second > X[j].second;});
    SRSORT(X);

    sortVecPair(X, idx, [&] (auto& i, auto& j) {return X[i].first < X[j].first;});
    FSORT(X);

    REP(i, N) {
        cout << idx[i] + 1 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <string.h>
#include <iomanip>
using namespace std;
#define int long long
#define ull unsigned long long
#define F first
#define S second
#define nl "\n"
#define ld long double
#define div 1000000007
#define pi 3.14159265358979323846

void solve()
{
    int a,b,c,d;cin>>a>>b>>c>>d;
    int i=0;
    while(a>0 && c>0)
    {
        if(i%2==0)
        {
            c-=b;i++;
        }
        else
        {
            a-=d;i++;
        }
    }
    if(a<=0)
        cout<<"No"<<nl;
    else
        cout<<"Yes"<<nl;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3608
import Data.List
main=getContents>>=mapM_ print.(\(x:_:xs)->map (h x) xs).map(map read.words).lines
  where h [a,b,c,d,e,f] x
          |i x s=a+0
          |i x t=b
          |i x u=c
          |i x(r u)=d
          |i x(r t)=e
          |i x(r s)=f
          where  i=isInfixOf
                 r=reverse
                 s=[b,c,e,d,b]
                 t=[a,d,f,c,a]
                 u=[a,b,f,e,a]

Measured memory_bytes: 4056
#include <stdio.h>

int n, N[20];

int Check(int j, int m)
{
  if(m == 0) return 1;
  if(j >= n) return 0;

  if(Check(j + 1, m) || Check(j + 1, m - N[j])) return 1;
  return 0;
}

int main()
{
  int i;
  int q, m;

  scanf("%d", &n);
  for(i = 0; i < n; i++)
    {
      scanf("%d", &N[i]);
    }
  scanf("%d", &q);

  for(i = 0; i < q; i++)
    {
      scanf("%d", &m);

      if(Check(0, m)) printf("yes\n");
      else printf("no\n");
    }

  return 0;
}

Measured memory_bytes: 580
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		while(true) {
			int N=sc.nextInt();
			int M=sc.nextInt();
			if(N*M==0) {
				System.exit(0);
			}
			else {
				int[] event=new int[N];
				for(int i=0; i<N; i++) {
					event[i]=sc.nextInt();
				}
				int[] saikoro=new int[M];
				for(int i=0; i<M; i++) {
					saikoro[i]=sc.nextInt();
				}
				int koma=0;
				for(int i=0; i<M; i++) {
					if(koma+saikoro[i]<N-1) {
						if(koma+saikoro[i]+event[koma+saikoro[i]]>=N-1) {
							pl(i+1);
							break;
						}
						else {
							koma=koma+saikoro[i]+event[koma+saikoro[i]];
						}
					}
					else {
						pl(i+1);
						break;
					}
				}
			}
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static void quick_sort(int[][] d, int left, int right) {
		if (left>=right) {
			return;
		}
		int p = d[(left+right)/2][0];
		int l = left, r = right;
		int tmp,tmp1,tmp2;
		while(l<=r) {
			while(d[l][0] < p) { l++; }
			while(d[r][0] > p) { r--; }
			if (l<=r) {
				tmp = d[l][0]; d[l][0] = d[r][0]; d[r][0] = tmp;
				tmp1=d[l][1]; tmp2=d[r][1]; d[l][1]=tmp2; d[r][1]=tmp1;
				l++; r--;
			}
		}
		quick_sort(d, left, r);
		quick_sort(d, l, right);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
}


Measured memory_bytes: 26180
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
//void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 998244353;
const ll maxn = 1000005;
const ll mm = 1e+18;
void solve()
{
    int n;
    cin>>n;
    set<string>s;
    rep0(i,n){
        string ss;
        cin>>ss;
        s.in(ss);
    }
    cout<<(int)(s.si);
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
	//freopen("sp.txt","r",stdin);
    //srand(time(0));
    //cin>>t;
    for(int _i=1;_i<=t;_i++){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}

Measured memory_bytes: 19248
#include <bits/stdc++.h>
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define debug(var) std::cout << #var << " : " << var;

int main(){

	int a,b,c; std::cin >> a >> b >> c;

	if(a == b + c || b == a + c || c == a + b)std::cout << "Yes";
	else std::cout << "No";

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
using namespace std;
static const int max_num = 1001;
static const int max_hp = 10010;
static const int max_b = 200000000;
vector<pair<int, int>> magic(max_num);
vector<int> dp(2*max_hp, max_b);

int main(){
    int H, N, a, b;
    scanf("%d %d", &H, &N);
    // printf("max b = %d", max_b);
    int max_magic = 0;
    for(int i=0;i<N;i++){
        scanf("%d %d", &a, &b);
        magic[i] = make_pair(a,b);
        max_magic = max(max_magic, a);
    }
    dp[0] = 0;

    for(int j=1;j<=H+max_magic;j++){
            // printf("dp[%d]=%d\n", j, dp[j]);
        for(int i=0;i<N;i++){
            if(j>=magic[i].first){
                dp[j] = min(dp[j], dp[j-magic[i].first]+magic[i].second);
            }
        }
    }



    int ans = max_b;
    for(int j=H;j<=H+max_magic;j++){
        ans = min(dp[j], ans);
    }

    printf("%d\n", ans);
    return 0;

}


Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long A = sc.nextInt();
        long B = sc.nextInt();
        long C = sc.nextInt();
        long D = sc.nextInt();

        boolean flag = false;
        for (int i=0;i<N;i++) {
            long max = A-C*i+D*(N-1-i);
            long min = A-D*i+C*(N-1-i);
            if (min<=B && B<=max) flag=true;
        }

        if (flag) System.out.println("YES");
        else System.out.println("NO");
    }
}

Measured memory_bytes: 23508
#include <iostream>
#include <vector>

using namespace std;

#define debug(x) cout << #x << "==" << x << endl;

const int mod = 1e+9 + 7;

typedef long long ll;


ll add(ll a, ll b) {
  return (a + b) % mod;
}

ll sub(ll a, ll b) {
  return (a - b) % mod;
}

ll mul(ll a, ll b) {
  return (a * b) % mod;
}


int main() {
  ios::sync_with_stdio(false);

  int n, m;
  cin >> n >> m;

  vector<ll> x(n), y(m);
  for(int i = 0; i < n; i++) { cin >> x[i]; }
  for(int i = 0; i < m; i++) { cin >> y[i]; }

  ll x_sum = 0;
  for(int k = 0; k < n; k++) {
    // ll t1 = mul(k, x[k]);
    // ll t2 = mul(n-k-1, x[k]);
    // ll t3 = sub( t1, t2 );
    // x_sum = add(x_sum, t3);
    x_sum += k * x[k] - (n-k-1) * x[k];
    x_sum %= mod;
  }

  ll y_sum = 0;
  for(int k = 0; k < m; k++) {
    // ll t1 = mul(k, y[k]);
    // ll t2 = mul(m-k-1, y[k]);
    // ll t3 = sub( t1, t2 );
    // y_sum = add(y_sum, t3);
    y_sum += k * y[k] - (m-k-1) * y[k];
    y_sum %= mod;
  }
  cout << mul(x_sum, y_sum) << "\n";


  // ll sum_x = 0, sum_y = 0;
  // for(int i=0;i<n;i++) {
  //   sum_x += i * x[i] - (n-i-1) * x[i];
  //   sum_x %= mod;
  // }
  // for(int i=0;i<m;i++) {
  //   sum_y += i * y[i] - (m-i-1) * y[i];
  //   sum_y %= mod;
  // }
  // cout << sum_x * sum_y % mod << endl;

  return 0;
}


Measured memory_bytes: 1792
<?php
$string = trim(fgets(STDIN));
$firstHalf = ltrim(substr($string, 0, 2), '0');
$secondHalf = ltrim(substr($string, 2), '0');
 
if (0 < $firstHalf && $firstHalf <= 12 && 0 < $secondHalf && $secondHalf <= 12) {
	echo 'AMBIGUOUS', PHP_EOL;
} elseif (0 < $firstHalf && $firstHalf <= 12 && 0 <= $secondHalf && $secondHalf <= 99) {
    echo 'MMYY', PHP_EOL;
} elseif (0 <= $firstHalf && $firstHalf <= 99 && 0 < $secondHalf && $secondHalf <= 12) {
	echo 'YYMM', PHP_EOL;
} else {
	echo 'NA', PHP_EOL;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

#define PB push_back;
#define F first;
#define S second;
#define REP(i,a,b) for (int i=a;i<b;i++)
#define all(x) x.begin(), x.end()
#define all_(x) x.rbegin(), x.rend()
#define mp make_pair



int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int ta = c/b + (c%b!=0);
  int ai = a/d + (a%d!=0);
  if (ta<=ai) cout<<"Yes";
  else cout<<"No";
  cout<<'\n';
  return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
	int n;
	cin >> n;
	vector<int>p(n);
	rep(i, n) {
		cin >> p[i];
	}
	vector<int>a = p;
	sort(a.begin(), a.end());
	int res = 0;
	rep(i, n) {
		if (a[i] != p[i])res++;
	}
	if (res <= 2)puts("YES");
	else puts("NO");
	return 0;
}

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

int main(){
  int n,k; cin >>n >>k;
  vector<int> a(n);
  vector<int> cnt(200005);
  rep(i,n) {
    cin >>a[i];
    cnt[a[i]]++;
  }
  sort(cnt.begin(), cnt.end());
  reverse(cnt.begin(), cnt.end());
  if(cnt[k]==0){
    cout << 0 << endl;
    return 0;
  }
  int ans = 0;
  for(int i = k;;i++){
    ans += cnt[i];
    if(cnt[i]==0){
      cout << ans << endl;
      return 0;
    }
  }
  return 0; 
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD


ll N;
char S[101010];
ll i, j, k,ans;



int main(){
    scanf("%lld%s", &N,&S);
    ans++;
    fornum(i,1,N){
        if(S[i-1]!=S[i]){
            ans++;
        }
    }
    printf("%lld",ans);
    
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define mod 1000000007
#define INF 10000000
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef pair<int, int > P;
typedef vector<P> vP;
vi A;
vi B;
vi Asize;
vi Bsize;
int  Apar(int a) {
	int x = a;
	int y = a;
	while (A[x] != x) {
		x = A[x];
	}
	while (A[y] != y) {
		int z = A[y];
		A[y] = x;
		y = z;
	}
	return x;
}
bool Afind(int a, int b) {
	return Apar(a) == Apar(b);
}
void Aunite(int a,int  b) {
	A[Apar(a)] = Apar(b);
	Asize[Apar(b)] = Asize[Apar(b)] + Asize[Apar(a)];
	return;
}
int  Bpar(int a) {
	int x = a;
	int y = a;
	while (B[x] != x) {
		x = B[x];
	}
	while (B[y] != y) {
		int z = B[y];
		B[y] = x;
		y = z;
	}
	return x;
}
bool Bfind(int a, int b) {
	return Bpar(a) == Bpar(b);
}
void Bunite(int a,int  b) {
	B[Bpar(a)] = Bpar(b);
	Bsize[Bpar(b)] = Bsize[Bpar(b)] + Bsize[Bpar(a)];
	return;
}
int main() {
	int n, k, l;
	cin >> n >> k >> l;
	A.resize(n, 0);
	Asize.resize(n, 1);
	for (int i = 0; i < n; i++) {
		A[i] = i;
	}
	B.resize(n, 0);
	Bsize.resize(n, 1);
	for (int i = 0; i < n; i++) {
		B[i] = i;
	}
	for (int i = 0; i < k; i++) {
		int a, b;
		cin >> a >> b; a--; b--;
		Aunite(a, b);
	}
	for (int i = 0; i < l; i++) {
		int a, b;
		cin >> a >> b; a--; b--;
		Bunite(a, b);
	}
	map<P, int > M;
	for (int i = 0; i < n; i++) {
		if (Apar(i) == i&&Bpar(i) == i) {
			M[P(Apar(i), Bpar(i))] = 0;
		}
	}
	for (int i = 0; i < n; i++) {
		M[P(Apar(i), Bpar(i))] += 1;
	}
	for (int i = 0; i < n; i++) {
		cout << M[P(Apar(i), Bpar(i))]<<" ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 15104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
char str[10000];
int n;
int a[10][2];
int judge(int n)
{
    int res=1;
    for(int i=1;i<=n;i++)
        res*=i;
    return res;
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
       cin>>a[i][0]>>a[i][1];
    double res=0;
    int sum=0;

    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++)
        {
           // cout<<(a[i][0]-a[j][0])*(a[i][0]-a[j][0])+(a[i][1]-a[j][1])*(a[i][1]-a[j][1])<<endl;
            res+=sqrt((a[i][0]-a[j][0])*(a[i][0]-a[j][0])+(a[i][1]-a[j][1])*(a[i][1]-a[j][1]))*judge(n-1)*2;
        }
    }
    printf("%.10f",res/judge(n));
    return 0;
}


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

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int ara[3];
	for (int i = 0; i < 3; ++i)
	{
		cin>>ara[i];
	}
	sort(ara, ara+3, greater<int>());
	if(ara[0] == ara[1] && ara[0] != ara[2])
		cout<<"Yes"<<endl;
	else if(ara[1] == ara[2] && ara[2] != ara[0])
		cout<<"Yes"<<endl;
	else if(ara[0] == ara[2] && ara[0] != ara[1])
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;

	return 0;
}

Measured memory_bytes: 3616
import java.util.*;
public class Main
{
    public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(); int m = sc.nextInt();
        boolean [] ok = new boolean[n+1]; ok[1] = true;
        int [] ct = new int[n+1];
        Arrays.fill(ct, 1);
        for (int i = 0; i < m; i++) {
            int from = sc.nextInt(); int to = sc.nextInt();
            ct[from]--; ct[to]++;
            if (ok[from]) ok[to] = true;
            if (ct[from] == 0) ok[from] = false;
        }
        int ans = 0;
        for (int i = 1; i <= n; i++) if (ok[i]) ans++;
        System.out.println(ans);
    }


}

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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve()
{
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> to(N);
  vector<int> co(N);
  for (int i = 0; i < N - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    to[u].push_back(v);
  }
  for (int i = 0; i < Q; i++) {
    int p, x;
    cin >> p >> x;
    p--;
    co[p] += x;
  }
  dump(to);
  dump(co);
  vector<ll> ans(N);
  vector<int> used(N);
  function<void(int, int)> dfs = [&](int v, int c) {
    if (used[v])
      return;
    used[v] = 1;
    ans[v] = c;
    for (auto& u : to[v]) {
      dfs(u, c + co[u]);
    }
  };
  dfs(0, co[0]);
  dump(ans);
  for (int i = 0; i < N; i++) {
    cout << ans[i] << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 28928
#include<bits/stdc++.h>
#define ll long long int
#define pi pair<int,int>
#define eps 0.000000001
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define ln(x) ((int)x.length())
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define dbg(x) cout<<#x<<" "<<x<<endl
#define clr(x,v) memset(x, v, sizeof(x))
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const ll mod = 998244353;
const double PI = acos(-1.0);
const int MAXN = 1e6 + 5;

ll fact[MAXN];

void init()
{
    fact[0] = 1;
    for(int i = 1; i < MAXN; i++)
    {
        fact[i] = ((fact[i - 1] % mod) * (i % mod)) % mod;
    }
}

ll fpow(ll x, ll y)
{
    ll res = 1;
    while(y > 0)
    {
        if(y & 1)
            res = (res % mod * x % mod) % mod;
        x = (x % mod * x % mod) % mod;
        y = y / 2;
    }
    return res % mod;
}

ll inv(ll a)
{
    return fpow(a, mod - 2);
}

ll comb(int n, int r)
{
    if(r > n)
        return 0LL;
    return ((fact[n] % mod * inv(fact[n - r]) % mod) % mod * inv(fact[r]) % mod) % mod;
}

void cp()
{
    ll n, m, k;
    cin >> n >> m >> k;
    ll ans = 0;
    /*
    	from n-1 pairs, pick any i, and consider them one single blank for colouring
    	you will now have n-i blanks
    	for these blanks you have colouring of the form
    	m, m-1, m-1, m-1, m-1, ...... m-1

    	ans = Σ C(n-1, i) * m * (m-1)^(n-i-1) for all 0<=i<=k
    */
    for(int i = 0; i <= k; i++)
    {
        int blank = n - i;
        ans = (ans % mod + ((comb(n - 1, i) * m) % mod * fpow(m - 1, blank - 1) % mod) % mod ) % mod;
    }
    cout << ans;
}

int main()
{
    FASTIO;
    int t;
    t = 1;
    init();
    // cin >> t;
    while(t--)
    {
        cp();
    }
    return 0;
}

Measured memory_bytes: 11472
# usr/bin/python
# coding: utf-8
################################################################################
# Is it a Right Triangle?
# Write a program which judges wheather given length of three side form a right triangle.
# Print "YES" if the given sides (integers) form a right triangle, "NO" if not so.
#
# Input
# Input consists of several data sets. In the first line, the number of data set,
# N is given. Then, N lines follow, each line corresponds to a data set.
# A data set consists of three integers separated by a single space.
#
# Constraints
# 1 ??? length of the side ??? 1,000
# N ??? 1,000
# Output
# For each data set, print "YES" or "NO".
#
# Sample Input
# 3
# 4 3 5
# 4 3 6
# 8 8 8
# Output for the Sample Input
# YES
# NO
# NO
#
################################################################################

if __name__ == "__main__":
    num = int(input())
    inputline = [""]*num
    for i in range(0,num):
        inputline[i] = input()
    for line in inputline:
        a = int(line.split(" ")[0])
        b = int(line.split(" ")[1])
        c = int(line.split(" ")[2])
        if (a*a+b*b == c*c or b*b+c*c == a*a or c*c+a*a == b*b):
            print("YES")
        else:
            print("NO")

Measured memory_bytes: 5720
// Igorjan94, template version from 13 October 2017. C++17 version, modified 18 march 2020 (writeln<tuple>, whole->all) {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <iomanip>
#include <math.h>

using namespace std;

#define FOR(i, m, n) for (int i = m; i <  (int) (n); ++i)
#define ROF(i, m, n) for (int i = m; i >= (int) (n); --i)
#define forn(i, n)   for (int i = 0; i < (int) (n); ++i)
#define  fori1(n)    for (int i = 1; i < (int) (n); ++i)
#define  forj1(n)    for (int j = 1; j < (int) (n); ++j)
#define   fori(n)    for (int i = 0; i < (int) (n); ++i)
#define   forj(n)    for (int j = 0; j < (int) (n); ++j)
#define     SZ(a)    int(size(a))

typedef  pair<int, int>   pii;
typedef   vector<int>     vi;
typedef    long long      ll;

#define pb push_back
#define all(a) begin(a), end(a)
#define ints(a...) int a; readln(a)

[[maybe_unused]] const int MOD = 1000000007;
[[maybe_unused]] const int INTMAX = numeric_limits<int>::max();

#define ttt12i template<class T1, class T2> inline
#define  ttti  template<class T> inline

void writeln(){cout<<"\n";}ttti void print(T&& a);ttti void priws(T&& a);ttti void read(T& a);
template<class... Args> inline void readln(Args&... args){(read(args),...);}
template<class H, class...T> inline void writeln(H&& h,T&&...t){priws(h);(print(t),...);writeln();}

//Igorjan
//}}}

void run()
{
    ints(n);
    cout << fixed << setprecision(10);
    writeln(2 * M_PI * n);
}

//{{{
int main()
{
    ios_base::sync_with_stdio(false);
    run();
    cerr << fixed << setprecision(0) << "Execution time = " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

#define a _a
#define n _n
ttt12i ostream&operator<<(ostream&os,pair<T1,T2>const&a);
template<typename T,typename D=decltype(*begin(declval<T>())),typename enable_if<!is_same<T,basic_string<char>>::value>::type* =nullptr>
ostream&operator<<(ostream&os,T const&a){auto it=begin(a);if(it!=end(a))os<<*it++;while(it!=end(a))os<<"\n "[is_fundamental<typename T::value_type>::value]<<*it++;return os;}
ttt12i ostream&operator<<(ostream&os,pair<T1,T2>const&a){return os<<a.first<<" "<<a.second;}
ttt12i istream&operator>>(istream&is,pair<T1,T2>&a){return is>>a.first>>a.second;}
ttti   istream&operator>>(istream&is,vector<T>&a){fori(a.size())is>>a[i];return is;}
ttti void print(T&&a){cout<<" "<<a;}
ttti void priws(T&&a){cout<<a;}
ttti void read(T&a){cin>>a;} //}}}


Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
int n, a[101];

void print() {
  cout << a[0];
  for (int i = 1; i < n; i++) {
    cout << " " << a[i];
  }
  cout << "\n";
}

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  print();
  for (int i = 1; i < n; i++) {
    int v = a[i];
    int j = i - 1;
    while (j >= 0 && a[j] > v) {
      a[j + 1] = a[j];
      j--;
    }
    a[j + 1] = v;
    print();
  }
}


Measured memory_bytes: 3084
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll width, height, w, h;
    cin >> height >> width >> h >> w;
    if (width % w == 0 && height % h == 0) cout << "No\n";
    else {
        cout << "Yes\n";
        vvll ans(height, vll(width, 0));
        if (width % w != 0) {
            for (ll i = 0; i < height; i++) {
                for (ll j = 0; j < width; j += w) {
                    ans[i][j] = 999999999;
                }
            }
            for (ll i = 0; i < height; i++) {
                for (ll j = w - 1; j < width; j += w) {
                    ans[i][j] = -1000000000;
                }
            }
        } else {
            for (ll i = 0; i < width; i++) {
                for (ll j = 0; j < height; j += h) {
                    ans[j][i] = 999999999;
                }
            }
            for (ll i = 0; i < width; i++) {
                for (ll j = h - 1; j < height; j += h) {
                    ans[j][i] = -1000000000;
                }
            }
        }

        REP(i, height) {
            REP(j, width) {
                cout << ans[i][j] << (j == width - 1?'\n':' ');
            }
        }
    }
    return 0;
}


Measured memory_bytes: 4864