akhauriyash/Code-Regression huggingface dataset:
class Queue():
    def __init__(self):
        self.size = 0
        self.Max = 100000
        self.queue = [None]

    def isEmpty(self):
        return self.size == 0

    def isFull(self):
        return self.size >= self.Max

    def enqueue(self, x):
        if self.isFull():
            print("Queue overflow!")
        else:
            self.queue.append(x)
            self.size += 1

    def dequeue(self):
        if self.isEmpty():
            print("Queue underflow!")
        else:
            self.size -= 1
            return self.queue.pop(1)

p_queue = Queue()
e_time = 0

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

for i in range(n):
    process = input().split()
    process[1] = int(process[1])
    p_queue.enqueue(process)

while not p_queue.isEmpty():
    process = p_queue.dequeue()
    if process[1] <= q:
        e_time += process[1]
        print(process[0], e_time)
    else:
        e_time += q
        process[1] -= q
        p_queue.enqueue(process)

Measured memory_bytes: 19708
using System;
using System.Linq;

class D
{
	static void Main()
	{
		Func<long[]> read = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
		var h = read();
		var a = read();
		long n = h[0], k = h[1];

		var p2 = new long[40];
		p2[0] = 1;
		for (int i = 1; i < p2.Length; i++) p2[i] = p2[i - 1] * 2;

		var cs = Enumerable.Range(0, 40).Select(i => a.LongCount(x => (x & p2[i]) != 0)).ToArray();
		for (int i = 39; i >= 0; i--)
		{
			if (p2[i] > k || cs[i] >= (n + 1) / 2) continue;
			k -= p2[i];
			cs[i] = n - cs[i];
		}
		Console.WriteLine(cs.Select((c, i) => c * p2[i]).Sum());
	}
}


Measured memory_bytes: 31324
#include <iostream>
using namespace std;
int main(void){
  //yheeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
 int r, g, b;
 cin >> r >> g >> b;
 int a=100*r + 10*g + b;
 if (a % 4==0)
 cout << "YES" << endl;
 else 
 cout << "NO"  << endl;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
#define fast_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll a[N],dp[N],f[N];
bool vis[N],vis1[N];
vector<ll>v[N];
pair<ll,ll>p[N],p1[N];
set<int>s;
map<string,ll>mp;
queue<ll>q;
main()
{
    fast_IO

    int n,m,x,y;
    cin>>n>>m;
    for(int i=0; i<m; i++)
        cin>>x>>y,f[y]++,v[x].push_back(y);

    for(int i=1; i<=n; i++)
    {
        if(f[i]==0)
        q.push(i);
    }
    ll mx=0;
    while(!q.empty())
    {
        int p=q.front();

        for(int i=0; i<v[p].size(); i++)
        {
            int ch=v[p][i];
            dp[ch]=max(dp[ch],dp[p]+1);
            mx=max(mx,dp[ch]);

            if(f[ch]-1==0)
                q.push(ch);

            f[ch]--;
        }
        q.pop();
    }


    cout<<mx;

}










Measured memory_bytes: 13028
#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a,inc=(b-a)/abs(b-a); i!=b ; i+=inc)
#define scan(arr,n) for(int i=0;i<n;i++) cin>>arr[i]
#define deb(x) cout<<#x<<"->"<<x<<endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define print(arr,a,b) for(int i=a;i!=b;i++){cout<<arr[i]<<" ";}cout<<endl;
using ll=long long int;
int arr_min(int arr[],int a,int b){ int min=arr[0]; for(int i=a;i!=b;i++){if(min>arr[i]) min=arr[i];}return min;}
int arr_max(int arr[],int a,int b){ int max=arr[0]; for(int i=a;i!=b;i++){if(max<arr[i]) max=arr[i];}return max;}

signed 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 t=1;
    // cin>>t;
    while(t-->0){
    	ll x;
    	cin>>x;
    	for(int i=-1000;i<=1000;i++)
    	{
    		for(int j=-1000;j<=1000;j++)
    		{
    			// cout<<ll(pow(i,5))<<endl;
    			if(ll(pow(i,5))-ll(pow(j,5))==x)
    			{
    				cout<<i<<" "<<j;
    				return 0;
    			}
    		}
    	}
    	
    	
    }
    return 0;
}

Measured memory_bytes: 4116
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
	map<string,ll>m;
	string s;
	ll n,ans=0;
	cin>>n;
	while(n--)
	{
		cin>>s;
		sort(s.begin(),s.end());
		m[s]++;
	}
	for(auto it=m.begin();it!=m.end();it++)
		ans+=it->second*(it->second-1)/2;
	cout<<ans<<endl;
}

Measured memory_bytes: 11136
#include <stdio.h>

int main (){
    int a[5][5];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            scanf("%d", &a[i][j]);
        }
    }
    int b[5][5] = {};
    int banyak;
    scanf("%d", &banyak);
    int input;
    for(int i = 0; i <= banyak; i++){
        scanf("%d", &input);
        for(int i = 0; i< 3; i++){
            for(int j = 0; j < 3; j++){
                if(input == a[i][j]){
                    b[i][j]++;
                    if((b[0][0] > 0 && b[0][1] > 0 && b[0][2] > 0) || (b[1][0] > 0 && b[1][1] > 0 && b[1][2] > 0) || (b[2][0] > 0 && b[2][1] > 0 && b[2][2] > 0) || (b[0][0] > 0 && b[1][0] > 0 && b[2][0] > 0) || (b[0][1] > 0 && b[1][1] > 0 && b[2][1] > 0) || (b[0][2] > 0 && b[1][2] > 0 && b[2][2] > 0) || (b[0][2] > 0 && b[1][1] > 0 && b[2][0] > 0) || (b[0][0] > 0 && b[1][1] > 0 && b[2][2] > 0)){
                        printf("Yes");
                        return 0;
                    } 
                }
            }
        }
    }
    printf("No");    


    return 0;
}

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


int main(){
	vector<int> nos(3);
	for(int i=0;i<nos.size();i++) cin>>nos[i];
	sort(nos.begin(),nos.end());
	int moves = nos[2] - nos[1];
	nos[0] += moves;
	int left = nos[2] - nos[0];
	moves += (left+1)>>1;
	if(left&1) moves += 1;
	cout<<moves<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

class Union_Find_Tree{
	public:
	vi p,r,s;
	Union_Find_Tree(int n){
		p=r=vi(n);
		s=vi(n,1);
		for(int i=0;i<n;i++) p[i]=i;
	}
	int Par(int x){
		if(p[x]==x) return x;
		return p[x]=Par(p[x]);
	}
	int Size(int x){return s[Par(x)];}
	bool Unite(int x,int y){
		x=Par(x);
		y=Par(y);
		if(x==y) return 0;
		if(r[x]<r[y]){
			p[x]=y;
			s[y]+=s[x];
		}
		else{
			p[y]=x;
			s[x]+=s[y];
			if(r[x]==r[y]) r[x]++;
		}
		return 1;
	}
	bool Same(int x,int y){return Par(x)==Par(y);}
};

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	vp a(m);
	for(int i=0;i<m;i++){
		cin>>a[i].first>>a[i].second;
	}
	while(1){
		bool B=1;
		for(int i=0;i<m&&B;i++) for(int j=i+1;j<m&&B;j++) {
			int l=a[i].first,r=a[i].second,L=a[j].first,R=a[j].second;
			if(max(l,L)<min(r,R)){
				a.erase(a.begin()+j);
				a.erase(a.begin()+i);
				a.push_back({min(l,L),max(r,R)});
				m--;
				B=0;
			}
		}
		if(B) break;
	}
	int res=n+1;
	for(int i=0;i<m;i++){
		res+=2*(a[i].second-a[i].first);
	}
	cout<<res<<endl;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int mp[305][305];
int main(){
   int m,n;
   scanf("%d%d",&m,&n);
   for(int i=0;i<=9;i++)
    for(int j=0;j<=9;j++)
    scanf("%d",&mp[i][j]);
   for(int k=0;k<=9;k++)
    for(int i=0;i<=9;i++)
    for(int j=0;j<=9;j++)
    mp[i][j]=min(mp[i][j],mp[i][k]+mp[k][j]);
   int ans=0;
   for(int i=1;i<=m;i++)
   for(int j=1;j<=n;j++){
    int x;
    scanf("%d",&x);
    if(x==-1)
        continue;
    else ans+=mp[x][1];
   }
   cout<<ans<<endl;
}




Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 28;
	static int modP = 1000000007;


	static int maxN = 100;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			Set<Long> set = new HashSet<>();
			int N = in.nextInt(), M = in.nextInt();

			int[][] d = new int[maxN][maxN];
			E[] e = new E[M];
			for (int i = 0; i < maxN; i++) {
				for (int j = 0; j < maxN; j++) {
					if (i == j) {
						d[i][j] = 0;
					} else {
						d[i][j] = INF;
					}
				}
			}

			for (int i = 0; i < M; i++) {
				int a = in.nextInt()-1, b = in.nextInt()-1, c = in.nextInt();
				d[a][b] = c;
				d[b][a] = c;
				e[i] = new E(a, b, c);

				set.add((long)a << 32 | b);
			}

			for (int k = 0; k < N; k++) {
				for (int i = 0; i < N; i++) {
					for (int j = 0; j < N; j++) {
						d[i][j] = Math.min(d[i][j], d[i][k] + d[k][j]);
					}
				}
			}

			for (int i = 0; i < M; i++) {
				int f = e[i].f;
				int t = e[i].t;
				int c = e[i].c;

				for (int k = 0; k < N; k++) {
					if (d[f][k] == c + d[t][k]) {
						set.remove((long)f<<32 | t);
						break;
					}
				}
			}

			out.println(set.size());


		}
	}
	static class E {
		int f, t, c;
		E (int f, int t, int c) {
			this.f = f;
			this.t = t;
			this.c = c;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 22564
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define inf (int)1e9+7
#define eb emplace_back

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N, Y; cin >> N >> Y;
    rep(y, N + 1) rep(z, N + 1) {
        if (y + z > N) continue;
        int x = N - y - z;
        if (x < 0 || x > N) continue;
        if (-5000 * y - 9000 * z == Y - 10000 * N) {
            cout << x << " " << y << " " << z << endl;
            return 0;
        }
    }
    cout << "-1 -1 -1" << endl;
}


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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
      for (int i=1; i<=A; i++) {
          if (A%i==0 && B%i==0 && C%i!=0) {
              cout << "NO" << endl;break;
          }
          if (i==A) cout << "YES" << endl;
      }
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int n = Integer.parseInt(sc.nextLine());

			Map<Integer, String> map = new HashMap<Integer, String>();
			int next = 1;
			int count = 0;
			for (int i = 1; i <= n; i++) {
				String s = sc.nextLine();
				if (i == next) {
					if (next == 2) {
						System.out.println(count);
						return;
					}
					next = Integer.parseInt(s);
					count++;
					while (next <= i) {
						if (next == 2) {
							System.out.println(count);
							return;
						}
						if (!map.containsKey(next)) {
							// すでに押したことがあるボタンに戻ってしまった場合は到達不可
							System.out.println(-1);
							return;
						}
						next = Integer.parseInt(map.remove(next));
						count++;
					}
				} else {
					map.put(i, s);
				}
			}
		} finally {
			sc.close();
		}
	}
}

Measured memory_bytes: 108896
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define PI 3.1415926535897932384626433832795
int MOD=1e9+7;
int powmod(int a,int l, int md){int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> ii; typedef vector<ii> vii;
#define pb push_back
int __set(int b, int i) {return b|(1<<i);} //set ith bit
int __unset(int b, int i) {return b&!(1<<i);}
int __check(int b, int i) {return b&(1<<i);} //returns 0 if ith bit is 0
int mul(int a, int b) {return ((a%MOD)*(b%MOD))%MOD;}
int add(int a, int b) {return (a+b)%MOD;}
int sub(int a, int b) {return (((a-b)%MOD)+MOD)%MOD;}
int __div(int a, int b) {return mul(a, powmod(b, MOD-2, MOD));} //if MOD is prime;
const int inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

int32_t main(void)
{
	IOS;
	int n, W; 
	cin>>n>>W;
	vi v(n); vi w(n);
	for(int i = 0; i < n; i++)
		cin>>w[i]>>v[i];
	int LIM = 100010;
	int dp[n][LIM];
	memset(dp, W+1, sizeof(dp));
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < LIM; j++)
			dp[i][j]=inf;
	}
	dp[0][v[0]]=w[0];
	// for(int i = 0; i < n; i++)
	dp[0][0]=0;
	for(int i = 1; i < n; i++) {
		for(int j = 0; j < LIM; j++) {
			int mn1=W+1, mn2=W+1;
			if(j-v[i] >= 0)
				mn1=dp[i-1][j-v[i]]+w[i];
			mn2=dp[i-1][j];
			dp[i][j]=min(min(mn1, dp[i][j]), mn2);
		}
	}
	// for(int i = 0; i < n; i++) {
	// 	for(int j = 0; j < 29; j++) {
	// 		if(dp[i][j]>W)
	// 			cout<<-1<<" ";
	// 		else cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }
	int mx=0;
	// cout<<dp[n-1][17]<<endl;
	for(int i = 0; i < LIM; i++) {
		if(dp[n-1][i] <= W)
			mx=i;
	}
	cout<<mx<<endl;
	time();	
	return 0;
}

Measured memory_bytes: 78464
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {
    int N;
    int[] A, leftToRight, rightToLeft;

    private int gcd(int x,int y) {
        return y == 0 ? x : gcd(y, x%y);
    }

    private void solve() {
        N = nextInt();

        A = new int[N];
        for(int i = 0;i < N;i++) {
            A[i] = nextInt();
        }

        leftToRight = new int[N + 1];
        rightToLeft = new int[N + 1];

        for(int i = 1;i <= N;i++) {
            leftToRight[i] = gcd(leftToRight[i - 1], A[i - 1]);
        }

        for(int i = N - 1;i >= 0;i--) {
            rightToLeft[i] = gcd(rightToLeft[i + 1], A[i]);
        }

        int ans = 0;
        for(int i = 0;i < N;i++) {
            ans = Math.max(ans, gcd(leftToRight[i], rightToLeft[i + 1]));
        }

        out.println(ans);
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 38156
#include<cstdio>
#include<algorithm>
using namespace std;
#define ll long long
int main()
{
    ll a,b,c,d;
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
    ll ans=max(max(a*c,a*d),max(b*c,b*d));
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1736
import java.util.*;

public class Main{
    void run(){
        Scanner sc = new Scanner(System.in);
        int[] dp = new int[35];
        dp[0]=1;
        for(int i = 0; i < 30; i++){
            dp[i+1] += dp[i];
            dp[i+2] += dp[i];
            dp[i+3] += dp[i];
        }
        //System.out.println(Arrays.toString(dp));
        while(true){
            int n = sc.nextInt();
            if(n == 0){
                break;
            }
            System.out.println(dp[n]/10/365 + 1);
        }            

    }

    public static void main(String[] args){
        new Main().run();
    }
}

Measured memory_bytes: 17176
#include <bits/stdc++.h>  //2fat2code a.k.a grandmixer420
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define fr first
#define sc second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define int long long
using namespace std;

double x,t;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cout<<fixed<<setprecision(10);
    cin >> x >> t;
    cout<<x/t;

}


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

def dp(n):
    inf=float('inf')
    C=[inf]*(n+1)
    C[0]=0
    C[1]=abs(H[1]-H[0])
    for i in range(2,n):
        C[i]=min(C[i-1]+abs(H[i]-H[i-1]),C[i-2]+abs(H[i]-H[i-2]))
    return C[n-1]

print(dp(n))

Measured memory_bytes: 13776
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int num = Integer.parseInt(a+b);
        
        for(int x=1; x<=1000; x++) {
            if(x*x==num) {
                System.out.println("Yes");
                return ;
            }
        }
        System.out.println("No");
    }
}


Measured memory_bytes: 21844
N, K = map(int, input().split())
A = list(map(int, input().split()))

def isOK(x):
    cnt = 0
    for a in A:
        cnt += (a + x - 1) // x - 1
    return cnt <= K

left, right = 0, 10 ** 10
while right - left > 1:
    mid = (left + right) // 2
    if isOK(mid):
        right = mid
    else:
        left = mid
print(right)


Measured memory_bytes: 30696
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

LL A, B, C;

int main(void) {
    cin >> A >> B >> C;
    set<tuple<LL, LL, LL>> se;
    LL cnt = 0;
    while (true) {
        if (A % 2 || B % 2 || C % 2) {
            break;
        }
        ++cnt;
        VL v{A, B, C};
        SORT(v);
        auto t = make_tuple(v[0], v[1], v[2]);
        if (se.count(t)) {
            cout << -1 << endl;
            return 0;
        }
        se.insert(t);
        A = v[1] / 2 + v[2] / 2;
        B = v[0] / 2 + v[2] / 2;
        C = v[0] / 2 + v[1] / 2;
        //cerr << A << " " << B << " " << C << endl;
    }
    cout << cnt << endl;
}


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++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

using point = complex<double>;

point gaisetu_tyusin(point a, point b, point c) {
  a -= c;
  b -= c;
  return a * b * (conj(a) - conj(b)) / (conj(a) * b - a * conj(b)) + c;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int N; cin >> N;
  vector<point> P(N);
  rep(i, N) {
    int x, y; cin >> x >> y;
    P[i] = point(x, y);
  }
  auto f = [&](point p) {
    double res = 0;
    rep(i, N) {
      res = max(res, abs(P[i] - p));
    }
    return res;
  };
  double ans = 1e100;
  rep(i, N) rep(j, i) {
    ans = min(ans, f((P[i] + P[j]) / 2.0));
    rep(k, j) {
      ans = min(ans, f(gaisetu_tyusin(P[i], P[j], P[k])));
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

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

        int temp = n;
        while (n != 0){
            n/=10;
            nod++;
        }

        long sum = 0;
        for (int i = 0; i < nod; i++) {
            if(i%2!=0){
                sum += Math.pow(10,i-1)*9;
            }
        }

        if(nod%2 != 0){
            sum+= temp - Math.pow(10,nod-1) + 1;
        }

        System.out.println(sum);
    }
}


Measured memory_bytes: 20820
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  int x,y,z;
  cin>>x>>y>>z;
  x-=z;
  cout<<x/(y+z);
}

// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 3
#define N2 9

struct Puzzle {
	int f[N2];
	int space;
	string path;

	bool operator<(const Puzzle& p) const {
		for (int i = 0; i < N2; i++) {
			if (f[i] == p.f[i]) continue;
			return f[i] > p.f[i];
		}
		return false;
	}
};
static const int dx[4] = { -1,0,1,0 };
static const int dy[4] = { 0,-1,0,1 };
static char dir[4] = { 'u','l','d','r' };
bool isTarget(Puzzle p) {
	for (int i = 0; i < N2; i++) {
		if (p.f[i] != (i + 1)) return false;
	}
	return true;
}
string bfs(Puzzle s) {
	queue<Puzzle> Q;
	map<Puzzle, bool> V;
	Puzzle u, v;
	s.path = "";
	Q.push(s);
	V[s] = true;

	while (!Q.empty()) {
		u = Q.front();
		Q.pop();
		if (isTarget(u)) return u.path;
		int sx = u.space / N;
		int sy = u.space % N;
		for (int r = 0; r < 4; r++) {
			int tx = sx + dx[r];
			int ty = sy + dy[r];
			if (tx < 0 || ty < 0 || tx >= N || ty >= N) continue;
			v = u;
			swap(v.f[u.space], v.f[tx * N + ty]);
			v.space = tx * N + ty;
			if (!V[v]) {
				V[v] = true;
				v.path += dir[r];
				Q.push(v);
			}
		}
	}
	return "unsolvable";
}
int main() {
	Puzzle in;

	for (int i = 0; i < N2; i++) {
		cin >> in.f[i];
		if (in.f[i] == 0) {
			in.f[i] = N2;
			in.space = i;
		}
	}
	string ans = bfs(in);
	cout << ans.size() << endl;
	return 0;
}


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

int main() {
  int num1, num2;
  char c;
  cin >> num1 >> c >> num2;
  if(num1<1 || num1 >1000000000 ||
     num2<1 || num2 >1000000000 ||
     (c!='+' && c!='-')){
    return 0;
  }
  int result;
  switch(c){
    case '+':
      result = num1 + num2;
      break;
    case '-':
      result = num1 - num2;
      break;
  }
  cout << result << endl;
  return 0; 
}


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

typedef long long ll;

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

  int a[5];
  for (int i = 0; i < 5; i++) cin >> a[i];
  int k; cin >> k;
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 5; j++) {
      if (abs(a[i] - a[j]) > k) {
        cout << ":(\n";
        return 0;
      }
    }
  }
  cout << "Yay!\n";
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 2010
#define MO 1000000007
#define LL long long
int n,m,k,M,N,K;
LL dp[MAXN*2][MAXN],ans;
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<=m;i++)
		dp[0][i]=1;
	M=m%(k-1);
	N=(n-1)%(k-1);
	K=(n+m-1)/(k-1);
	for(int i=1,ed=k-1;i<=K;ed+=k-1,i++)
	{
		for(int j=0;j<=m&&j<=ed;j++)
		{
			if(j-k+1<=0)
				dp[i][j]=dp[i-1][j];
			else dp[i][j]=dp[i-1][j]-dp[i-1][j-k];
			if(j%(k-1)==M&&j&&ed-j<n&&(ed-j)%(k-1)==N)
			{
				if(j-k+1<=0)
					ans+=dp[i-1][j-1];
				else ans+=dp[i-1][j-1]-dp[i-1][j-k];
				ans=(ans%MO+MO)%MO;
			}
			if(j!=0)
				dp[i][j]+=dp[i][j-1];
			dp[i][j]=(dp[i][j]%MO+MO)%MO;
		}
		for(int j=ed+1;j<=m;j++)
			dp[i][j]=dp[i][j-1];
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 62976
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long 
int n,m;
int love[400][400];
bool u[400];
int main()
{
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>love[i][j];
			love[i][j]--;
		}
	}
	int ans=1e9;
	for(int i=0;i<m;i++){
		int a[305];
		for(int j=0;j<m;j++){
			a[j]=0;
		}
		for(int j=0;j<n;j++){
			int x=-1;
			for(int k=0;k<m;k++){
				if(!u[love[j][k]]){
					x=love[j][k];
					break;
				}
			}
			a[x]++;
		}
		pair<int,int> l(-1,-1);
		for(int i=0;i<m;i++){
			l=max(l,make_pair(a[i],i));
		}
		ans=min(ans,l.first);
		u[l.second]=1;
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define all(v)    begin(v), end(v)
#define in        []{lint n; cin>>n; return n;}()

//	約数列挙 O(√N)
#define DT divisor_table
template <typename T>
vector<T> divisor_table( const T a ) {
	vector<T> ans;
	for( T i=1; i*i <= a; i++ ) {
		if( a%i == 0 ) {
			ans.push_back(i);
			if( i*i != a ) {
				ans.push_back( a/i );
			}
		}
	}
	return ans;
}

int dig(lint n)
{
    if (n < 10)          return 1;
    if (n < 100)         return 2;
    if (n < 1000)        return 3;
    if (n < 10000)       return 4;
    if (n < 100000)      return 5;
    if (n < 1000000)     return 6;
    if (n < 10000000)    return 7;
    if (n < 100000000)   return 8;
    if (n < 1000000000)  return 9;
    if (n < 10000000000) return 10;
    return 11;
}

int main() { cin.tie(0); ios::sync_with_stdio(false);
    lint N = in;

    int ans = INT_MAX;
    for( lint A : DT(N) ) {
        lint B = N / A;
        ans = min( ans, max(dig(A), dig(B)) );
    }

    cout << ans << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>

using namespace std;

int main() {
	int m, nmin, nmax; 
	while (cin >> m >> nmin >> nmax && (m || nmin || nmax)) {
		vector<int> p(m);
		for (int i = 0; i < m; ++i) cin >> p[i];
		pair<int, int> ans = { 0,0 };
		for (int i = nmin; i <= nmax; ++i) {
			if (p[i - 1] - p[i] >= ans.first) ans = make_pair(p[i - 1] - p[i], i);
		}
		cout << ans.second << endl;
	}

	return 0;
}


Measured memory_bytes: 3088
while true
  a , op , b = gets.split.map(&:to_s)
  a=a.to_i
  b=b.to_i
  case op
    when "?"
      break
    when "+"
      print a + b,"\n"
    when "-"
      print a - b,"\n"
    when "*"
      print a * b,"\n"
    when "/"
      print a / b,"\n"
    else
      break
    end
end

Measured memory_bytes: 8628
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>

using namespace std;

typedef long long ll;

int main()
{
  int n;
  cin >> n;
  string a, b, c;
  cin >> a >> b >> c;
  int result = 0;
  for (int i = 0; i < n; ++i) {
    set<char> s;
    s.insert(a[i]);
    s.insert(b[i]);
    s.insert(c[i]);
    result += s.size() - 1;
  }
  cout << result << endl;
  return 0;
}


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

using namespace std;

const long long INF=1e18l;
ifstream f("1.in");
ofstream g("1.out");

const int MOD=1e9+7;
int n, m;
char x;
int a[Nmax][Nmax];

int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
        {
            cin >> x;
            if(x == '#') a[i][j]=-1;
        }

    a[1][1]=1;

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
        {
            if(a[i][j] == -1) continue;
            if(a[i-1][j] != -1) a[i][j]=(a[i][j]+a[i-1][j])%MOD;
            if(a[i][j-1] != -1) a[i][j]=(a[i][j]+a[i][j-1])%MOD;
        }

    /*for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
            cout << a[i][j] << " ";
        cout << '\n';
    }*/

    cout << a[n][m]%MOD;

    return 0;
}


Measured memory_bytes: 4224
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int r = scan.nextInt();
    int D = scan.nextInt();
    int x = scan.nextInt();
    for (int i = 0; i < 10; i++) {
      int s = r * x - D;
      System.out.println(r * x - D);
      x = s;
    }
  }
}


Measured memory_bytes: 23252
mod=1000000007
fact=[None for i in range(1000000)]
fact[0]=1
for i in range(1,1000000):
  fact[i]=fact[i-1]*i
  fact[i]%=mod

def inv(x):
  n = mod-2
  ans = 1
  while n!=0:
    if n&1:
      ans = ans*x % mod
    x = x*x % mod
    n //= 2
  return ans
 
def comb(n,r):
  return (fact[n]*inv(fact[r])*inv(fact[n-r]))%mod

a,b=map(int,input().split())
j=None
for i in range(1000000):
  j=b-i*2
  if j<0:
    break
  if i+j*2==a:
    print(comb(i+j, i))
    break
if j<0:
  print(0)

Measured memory_bytes: 114236
use std::io::{self, BufRead};

fn main() {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();
    let a_b = lines.next().unwrap().unwrap();
    let mut a_b = a_b.split_whitespace();
    let a = a_b.next().unwrap().parse::<i32>().unwrap();
    let b = a_b.next().unwrap().parse::<i32>().unwrap();

    let ans = std::cmp::max(a - 2 * b, 0);
    println!("{}", ans);
}


Measured memory_bytes: 4352
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N = sc.nextInt()

    val E = Array.fill(N)(new scala.collection.mutable.ArrayBuffer[(Int, Byte)]())
    val ru, rv, rw = sc.nextInt()
    E(ru-1).append((rv-1, (rw % 2).toByte))
    E(rv-1).append((ru-1, (rw % 2).toByte))
    (0 until N - 2) foreach { _ =>
      val u, v, w = sc.nextInt()
      E(u-1).append((v-1, (w % 2).toByte))
      E(v-1).append((u-1, (w % 2).toByte))
    }

    val visited = new Array[Boolean](N)
    val color = new Array[Byte](N)
    color(ru) = 0
    visited(ru) = true

    val queue = new scala.collection.mutable.Queue[Int]()
    queue.enqueue(ru)
    while (queue.nonEmpty) {
      val u = queue.dequeue()
      E(u) foreach { case (v, w) =>
        if (!visited(v)) {
          visited(v) = true
          if (w == 0) {
            color(v) = color(u)
            queue.enqueue(v)
          } else {
            color(v) = (1 - color(u)).toByte
            queue.enqueue(v)
          }
        }
      }
    }

    color.foreach(println)
  }

}


Measured memory_bytes: 122560
#include <stdio.h>

int main(void) {
	// your code goes here
	int n, m;
	scanf("%d %d\n",&n,&m);
	
	if((n-m > 1) || (n - m) < -1) printf("0\n");
	else{
		long long temp = 1;
		
		// n >= m
		if(n < m){
			int temp = m;
			m = n;
			n = temp;
		}
		
		int cnt = m;
		while(cnt>1) {
			temp *= cnt--;
			temp %= 1000000007;
		}
		
		temp *= temp;
		temp %= 1000000007;
		
		if(n>m){
			temp *= n;
			temp %= 1000000007;
		}

		
		if(n == m) printf("%d\n",(temp*2)%1000000007);
		else printf("%d\n",temp%1000000007);
	}
	
	return 0;
}

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

int main() {
	// your code goes here
	long long int N, M, i;
	cin >> N;
	cin >> M;
	int A, sum = 0;
	for(i=0; i<M; i++){
		cin >> A;
		sum += A;
	}
	if(sum <= N)
		cout << (N-sum);
	else
		cout << -1;
	
	return 0;
}

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

int main() {
  string s;
  cin>>s;
  int n=s.size();
  int cnt=0;
  for(int i=0;i<n/2;i++){
    if(s[i]!=s[n-1-i])cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  for (ll i = 1; i <= 5; i++) {
    ll x; cin >> x;
    if (x == 0) {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}



Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)
/*int main(){//A
    int N;cin>>N;
    if(N%2==0) cout<<(double)N/2/N<<endl;
    else cout<<(double)(N/2+1)/N<<endl;
    return 0;
}*/

/*int main(){//B
    int N,K;cin>>N>>K;
    vector<int> h(N);
    int c=0;
    rep(i,0,N) {
        cin>>h[i];
        if(h[i]>=K) c++;
    }
    cout<<c<<endl;
    return 0;
}*/

int main(){
    int N;cin>>N;
    vector<pair<int,int>> p(N);
    rep(i,0,N){
        cin>>p[i].first;
        p[i].second=i;
    }
    sort(p.begin(),p.end());
    rep(i,0,N) cout<<p[i].second+1<<" ";
    cout<<endl;
    return 0;
}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, m;

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

    cout << "100 100" << '\n';
    int bcnt = m-1, wcnt = n-1;
    REP(i, 50) {
        if (i%2 == 0 || wcnt == 0) {
            string s(100, '#');
            cout << s << '\n';
            continue;
        }
        REP(j, 100) {
            if (j == 0 || j == 99) {
                cout << '#';
                continue;
            }
            if ((i+j)%2 == 0 && wcnt > 0) {
                cout << '.';
                wcnt--;
            } else {
                cout << '#';
            }
        }
        cout << '\n';
    }
    REP(i, 50) {
        if (i%2 == 0 || bcnt == 0) {
            string s(100, '.');
            cout << s << '\n';
            continue;
        }
        REP(j, 100) {
            if (j == 0 || j == 99) {
                cout << '.';
                continue;
            }
            if ((i+j)%2 == 0 && bcnt > 0) {
                cout << '#';
                bcnt--;
            } else {
                cout << '.';
            }
        }
        cout << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
x = int(input())
max_num = 0
for elm1 in range(1,int(x ** 0.5) + 1):
    for elm2 in range(1,int(x ** 0.5) + 1):
        tmp_num = elm1 ** elm2
        if tmp_num <= x and tmp_num >= max_num:
            max_num = tmp_num
        else:
            continue
print(max_num)

Measured memory_bytes: 2940
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <queue>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;
//typedef long long int;

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n;
  cin >> n;
  if (n % 2 == 0) cout << n / 2 << ' ' << n << ' ' << n << endl;
  else {
    for (int a = max(1, n / 4); a <= 3500; ++a) {
      for (int b = a; b <= 3500; ++b) {
        int d = __gcd(a, b);
        int a1 = a / d, b1 = b / d;
        a1 /= __gcd(n, a1);
        b1 /= __gcd(n, b1);
        int q = a1 * b1;
        for (int c = q; c <= 3500; c += q) {
          if (n * (ll)(a * b + b * c + a * c) == 4LL * a * b * c) {
            cout << a << ' ' << b << ' ' << c << endl;
            return 0;
          }
        }
      }
    }
    assert(0);
  }
  return 0;
}

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

int main() {
  long n,ans;
  bool aa=true;
  cin >> n;
  ans=n;
  vector<long> a(n);
  map<long,long> aaa;
  vector<long> b;

  for(long i=0;i<n;i++) cin >> a[i];
  
  for(long i=0;i<n;i++) aaa[a[i]]++;

  for(auto itr=aaa.begin();itr!=aaa.end();itr++) {
    if((*itr).second>=3) ans-=(*itr).second,aaa[(*itr).first]=((*itr).second+1)%2+1,ans+=aaa[(*itr).first];
    if((*itr).second==2) {
      aa=!aa;
      if(aa) {
        ans-=2;
      }
    }
  }

  if(!aa) {
    ans-=2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 10296
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int count = 0;
    for (int i = 1; i <= K; i++) {
      for (int j = i; j <= K; j++) {
        if (i % 2 == 0 && j % 2 == 1) {
          count++;
        }
        if (i % 2 == 1 && j % 2 == 0) {
          count++;
        }
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 21716
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>

using namespace std;

int main()
{
    int64_t N, K;
    std::cin >> N >> K;

    struct E {
        int a;
        int b;
    };

    std::vector<E> e;
    for (int64_t i = 0; i < N; ++i) {
        E t;
        std::cin >> t.a >> t.b;
        e.push_back(t);
    }

    std::sort(std::begin(e), std::end(e),
              [](const auto& l, const auto& r) {
                  return l.a < r.a;
              });

    for (int64_t i = 0; i < N; ++i) {
        K -= e[i].b;
        if (K <= 0) {
            std::cout << e[i].a << std::endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 1528
#![allow(unused_imports)]

//input
use proconio::input;
use proconio::marker::{Bytes, Chars};
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;
//use std::collections::VecDeque;
//use std::collections::BinaryHeap;

//use std::cmp::*;

fn main() {
    input! {
        n: u64,
    }

    match n % 10 {
        2 | 4 | 5 | 7 | 9 => println!("hon"),
        0 | 1 | 6 | 8 => println!("pon"),
        3 => println!("bon"),
        _ => (),
    }
}


Measured memory_bytes: 2140
#include<stdio.h>
char txt[100001];
int   dp[100001];
int main() {
	int N,Q;
	scanf("%d %d",&N,&Q);
	scanf("%s",txt);
	for(int i=1; i<N; i++) {
        if( txt[i]=='C' && txt[i-1]=='A' ) dp[i]++;
        dp[i] += dp[i-1];
	}
	while(Q--) {
        int l,r;
        scanf("%d %d",&r,&l);
        printf("%d\n",dp[l-1]-dp[r-1]);
	}
}


Measured memory_bytes: 1280
package main

import (
	"fmt"
)

func main() {
	var N, x int
	fmt.Scanf("%d %d\n", &N, &x)
	ar := make([]int, N+1)
	ar[0] = 0
	count := 0
	for i := 1; i <= N; i++ {
		var a int
		fmt.Scan(&a)
		if x >= a+ar[i-1] {
          	ar[i] = a
			continue
		}
		sub := a + ar[i-1] - x
		ar[i] = a - sub
		count += sub
	}
	fmt.Println(count)
}


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

std::string n;

int main() {
    int sum = 0;
    std::cin >> n;
    long long nl = std::stol(n);
    for (int i = 0; i < n.size(); i++) {
        int p = (int)(n[i])-48;
        sum += p;
    }
    if (nl % sum == 0) {
        std::cout << "Yes" << std::endl;
        return 0;
    }
    std::cout << "No" << std::endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner dataScanner = new Scanner(System.in);
    int data = Integer.parseInt(dataScanner.nextLine());
    int count = 0;
    if (data % 2 == 1) count ++;
    if (data / 100 == 1) count ++;
    if ((data % 100) / 10 == 1) count ++;
    System.out.println(count);
  }
}


Measured memory_bytes: 21844
#include <iostream>
#include <cstring>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
	int H,W;
	scanf("%d%d",&H,&W);
	int c[10][10];
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++)scanf("%d",&c[i][j]);
	}

	for(int k=0;k<10;k++){
		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				if(c[i][j]>c[i][k]+c[k][j])c[i][j]=c[i][k]+c[k][j];
			}
		}
	}
	int ans=0;
	for(int i=0;i<H*W;i++){
		int tmp;
		scanf("%d",&tmp);
		if(tmp!=-1)ans+=c[tmp][1];
	}
	printf("%d\n",ans);
	return 0;
}


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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll A,B;
    string S;
    cin >> A>>B;

    if(A*B%2==0){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}


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

int main() {
  int N;
  cin >> N;
  int ans = 1;
  vector<int>vec(N);
  for(int i=0; i < N; i++){
    cin >> vec[i];
  }
  for(int i = 1; i<N; i++){
    bool boo = true;
    for(int j = 0;j<i; j++){
      if(vec[i] < vec[j]){
        boo =  false;
      }
    }
   if(boo){ 
     ans++;
   }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3596