akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std; 
#define int long long int 

int sum[1001][1001] ; 
int dp[1001][1001] ;
#define inf 1000000000000000000

void sum1(int arr[], int n)
{
	for(int i=0 ; i< n ; i++)
	{
		for(int j=i ; j< n ;j++)
		{
			sum[i][j]= arr[j]+((j==i)?0 :sum[i][j-1]) ; 
		}
	}
	
}



int fn(int arr[] ,int i ,int j,   int n )
{
	if(i>=j)
	{
		return 0 ; 
	}

	if(dp[i][j] !=-1)
	{
		return dp[i][j] ; 
	}


	int ans= inf; 
	for(int k=i ; k< j ; k++)
	{
		int z= sum[i][j]+fn(arr, i, k, n)+fn(arr, k+1, j,n) ; 
		ans=min(ans, z) ; 
	}

	return dp[i][j]=  ans ; 


}



int32_t main()
{
	int n ; 
	cin>>n ; 
	int arr[n+1] ; 
	for(int i=0 ; i<n ; i++)
	{
		cin>>arr[i] ; 
	}

	sum1(arr, n) ; 

	// for(int i=0 ; i<n ; i++)
	// {
	// 	cout<<prefix[i]<<" "; 
	// }


	memset(dp, -1, sizeof(dp)) ; 

	cout<<fn(arr,0, n-1,n) ; 
}

Measured memory_bytes: 13688
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double INF = 100000000000;
int main(){
  int n;
  cin >> n;
  double r, t;
  cin >> r >> t;
  t = (180 - t) / 180 * PI;
  vector<int> x(n), y(n);
  for (int i = 0; i < n; i++){
    cin >> x[i] >> y[i];
  }
  vector<vector<double>> d(n, vector<double>(n, INF));
  for (int i = 0; i < n; i++){
    for (int j = 0; j < n; j++){
      if (i != j){
        d[i][j] = sqrt(pow(x[j] - x[i], 2) + pow(y[j] - y[i], 2));
      }
    }
  }
  vector<vector<vector<bool>>> ok(n, vector<vector<bool>>(n, vector<bool>(n, false)));
  for (int i = 0; i < n; i++){
    for (int j = 0; j < n; j++){
      for (int k = 0; k < n; k++){
        if (i != j && j != k && k != i){
          if (pow(d[i][k], 2) > pow(d[i][j], 2) + pow(d[j][k], 2) - 2 * d[i][j] * d[j][k] * cos(t)){
            ok[i][j][k] = true;
          }
        }
      }
    }
  }
  vector<vector<vector<double>>> dp(10000, vector<vector<double>>(n, vector<double>(n, INF)));
  for (int i = 1; i < n; i++){
    dp[1][0][i] = d[0][i];
  }
  for (int i = 2; i < 10000; i++){
    for (int j = 0; j < n; j++){
      for (int k = 0; k < n; k++){
        for (int l = 0; l < n; l++){
          if (ok[j][k][l]){
            dp[i][k][l] = min(dp[i][k][l], dp[i - 1][j][k] + d[k][l]);
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < 10000; i++){
    for (int j = 0; j < n; j++){
      for (int k = 0; k < n; k++){
        if (dp[i][j][k] <= r){
          ans = i;
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 42720
const main = (input: string) => {
  const inputs = input.split('\n');
  const [rakeMeter, count] = inputs.shift().split(' ').map(v => Number(v));
  // console.log(rakeMeter, count);

  const housePoints = inputs[0].split(' ').map(v=>Number(v));
  let ans = 0;
  for(let i = 0; i < count; i += 1) {
    const currentPoint = housePoints[i];
    const nextPoint = (i+1 < count) ? housePoints[i + 1] : housePoints[0] + rakeMeter;

    const shift = nextPoint - currentPoint;
    // console.log(shift);

    ans = Math.max(ans, shift);
  }

  console.log(rakeMeter - ans);
  // console.log('-------');
}

// *この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 34028
import  java.io.*;

class Main{
	public static void main(String args[]){
		try{
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		    String str=reader.readLine();
		    int x =Integer.parseInt(str);
		    System.out.println(x*x*x);
		}catch(IOException e){
			System.out.println(e);
		}
		
	}
}

Measured memory_bytes: 24228
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main 
{

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] strs = br.readLine().split(" ");
		Dice dice = new Dice();
		for(int i=0;i<strs.length;i++)
		{
			dice.setNum(i,Integer.parseInt(strs[i]));
		}
		String instruction = br.readLine();
		dice.rotation(instruction);
		dice.printTop();
		// TODO 自動生成されたメソッド・スタブ

	}
}

class Dice
{
	int[] num;
	
	public Dice()
	{
		num = new int[6];
	}
	
	public void setNum(int index,int Num)
	{
		num[index] = Num;
	}
	
	public void printTop()
	{
		System.out.println(num[0]);
	}
	
	public void rotateS()
	{
		int temp = num[0];
		num[0] = num[4];
		num[4] = num[5];
		num[5] = num[1];
		num[1] = temp;
	}
	
	public void rotateN()
	{
		int temp = num[4];
		num[4] = num[0];
		num[0] = num[1];
		num[1] = num[5];
		num[5] = temp;
	}
	
	public void rotateW()
	{
		int temp = num[0];
		num[0] = num[2];
		num[2] = num[5];
		num[5] = num[3];
		num[3] = temp;
	}
	
	public void rotateE()
	{
		int temp = num[0];
		num[0] = num[3];
		num[3] = num[5];
		num[5] = num[2];
		num[2] = temp;
	}
	
	public void rotation(String instruction)
	{
		for(int i=0;i<instruction.length();i++)
		{
			switch(instruction.charAt(i))
			{
			case 'S':
				rotateS();
				break;
			case 'N':
				rotateN();
				break;
			case 'W':
				rotateW();
				break;
			case 'E':
				rotateE();
				break;
				
				default :
					break;
			}
		}
	}
}

Measured memory_bytes: 17036
struct I_t{
	char w[31];
	int p;
}I[100];
n,w;
C(struct I_t*a,struct I_t*b){
	int r=strcmp(a->w,b->w);
	if(r==0)
		r=a->p-b->p;
	return r;
}
main(){
	for(n=0;~scanf("%s%d",I[n].w,&I[n].p);n++);
	qsort(I,n,sizeof(*I),C);
	for(w=0;I[w].w[0];w=n){
		puts(I[w].w);
		for(n=w;strcmp(I[w].w,I[n].w)==0;n++){
			if(w!=n)
				putchar(' ');
			printf("%d",I[n].p);
		}
		puts("");
	}
	exit(0);
}

Measured memory_bytes: 0
#!/usr/bin/env python3



# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    l = list(map(int, input().split()))
    l.sort()
    print((l[0]*l[1])//2)
    return 

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
using namespace std;
int N,M;
int A[1000],B[1000],D[1000];
int dp[1000][1001];
main()
{
	while(cin>>N>>M,N)
	{
		for(int i=0;i<N;i++)cin>>A[i];
		for(int i=0;i<N;i++)cin>>B[i];
		for(int i=0;i<N;i++)
		{
			D[i]=(B[i]-A[i]+M)%M;
		}
		dp[0][0]=D[0];
		for(int i=1;i<=N;i++)dp[0][i]=1e9;
		dp[0][1]=1e9;
		for(int i=1;i<N;i++)
		{
		    for(int j=0;j<=N;j++)dp[i][j]=1e9;
			for(int j=i;j>=0;j--)
			{
				if(D[i-1]>=D[i])
				{
					dp[i][j]=dp[i-1][j];
					if(j>0)
					{
						dp[i][j]=min(dp[i][j],dp[i-1][j-1]+M+D[i]-D[i-1]);
					}
				}
				else
				{
					dp[i][j]=min(dp[i-1][j+1],dp[i-1][j]+D[i]-D[i-1]);
				}
			}
		}
		int ans=1e9;
		for(int i=0;i<N;i++)ans=min(ans,dp[N-1][i]);
		cout<<ans<<endl;
	}
}



Measured memory_bytes: 7020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,i,j,a[200005];
ll k,L,R,M,t,C;
int main(){
    scanf("%d%lld",&n,&k);
    for(i=1;i<=n;++i)scanf("%d",a+i);
    sort(a+1,a+n+1);
    for(L=-1e18,R=1e18;L<R;){
        M=L+R;
        if(M<0)--M;
        M/=2;
        C=0;
        for(i=1;i<=n;++i){
            t=a[i];
            if(t==0){
                if(M>=0)C+=n-1;
            }
            else if(t>0){
                int l=0,r=n,m;
                while(l<r){
                    m=(l+r+1)/2;
                    if(t*a[m]<=M)l=m;
                    else r=m-1;
                }
                if(l>=i)--l;
                C+=l;
            }
            else {
                int l=1,r=n+1,m;
                while(l<r){
                    m=(l+r)/2;
                    if(t*a[m]<=M)r=m;
                    else l=m+1;
                }
                if(r<=i)++r;
                C+=n+1-r;
            }
        }
        C/=2;
        if(C>=k)R=M;
        else L=M+1;
    }
    printf("%lld",R);
}

Measured memory_bytes: 1024
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 600000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000 大きいとワ―シャルフロイドでオーバーフローを起こす
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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



int main(void) {

	int n;
	int now;

	cin >> n;
	vector<string> a(n), b(n);
	vector<int> num(n, 0);
	int p, q, r, s;
	FOR(i, 0, n - 1) {
		cin >> a[i] >> b[i];
	}

	FOR(i, 0, n - 1) {
		now = 1;
		FOR(j, 0, a[i].size() - 1) {
			if (a[i][j] >= '2'&&a[i][j] <= '9') {
				now = a[i][j] - '0';
			}
			else {
				if (a[i][j] == 'm') {
					num[i] += 1000 * now;
				}
				if (a[i][j] == 'c') {
					num[i] += 100 * now;
				}
				if (a[i][j] == 'x') {
					num[i] += 10 * now;
				}
				if (a[i][j] == 'i') {
					num[i] += now;
				}
				now = 1;
			}
		}
		now = 1;
		FOR(j, 0, b[i].size() - 1) {
			if (b[i][j] >= '2'&&b[i][j] <= '9') {
				now = b[i][j] - '0';
			}
			else {
				if (b[i][j] == 'm') {
					num[i] += 1000 * now;
				}
				if (b[i][j] == 'c') {
					num[i] += 100 * now;
				}
				if (b[i][j] == 'x') {
					num[i] += 10 * now;
				}
				if (b[i][j] == 'i') {
					num[i] += now;
				}
				now = 1;
			}
		}

		p = num[i] % 10;
		num[i] /= 10;
		q = num[i] % 10;
		num[i] /= 10;
		r = num[i] % 10;
		num[i] /= 10;
		s = num[i] % 10;

		if (s == 1) {
			cout << "m";
		}
		if (s >= 2) {
			cout << s << "m";
		}
		if (r == 1) {
			cout << "c";
		}
		if (r >= 2) {
			cout << r << "c";
		}
		if (q == 1) {
			cout << "x";
		}
		if (q >= 2) {
			cout << q << "x";
		}
		if (p == 1) {
			cout << "i";
		}
		if (p >= 2) {
			cout << p << "i";
		}
		cout << endl;



	}

	return 0;
}


Measured memory_bytes: 3280
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

int main(){
	int w,q;
	while(cin>>w>>q&&(w||q)){
		vector<int> v(w,-1);
		rep(i,q){
			char ch;
			cin>>ch;
			if(ch=='s'){
				int id,wd;
				cin>>id>>wd;
				bool oped=false;
				rep(j,v.size()+1-wd){
					bool f=true;
					for(int k=j;k<j+wd;k++){
						if(v[k]!=-1)f=false;
					}
					if(f){
						for(int k=j;k<j+wd;k++){
							v[k] = id;
						}
						cout<<j<<endl;
						oped = true;
						break;
					}
				}
				if(!oped)cout<<"impossible"<<endl;
			}else{
				int id;
				cin>>id;
				rep(i,v.size())if(v[i]==id)v[i] = -1;
			}
		}
		cout<<"END"<<endl;
	}
}

Measured memory_bytes: 3064
n, a, b = [int(x) for x in input().split()]

if a == 0 and b == 0:
    print("0")
elif a >= n:
    print(n)
else:
    x = n // (a + b)
    if x == 0:
        print(a)
    else:
        if (n - ((a + b) * x)) >= a:
            print(a * x + a)
        else:
            print(n - b * x)


Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
n = int(input())
x = [int(i) for i in input().split()]

ans = 2147483647
tmp = 0
for i in range(-1000, 1001): #iは集会を開く場所
    for j in range(n):
        tmp += pow(x[j] - i, 2)
    if ans > tmp:
        ans = tmp
    tmp = 0
print(ans)


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

int main(void){
    int N, Abuf;
    int curHeight = 0;
    long long res = 0LL;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> Abuf;
        if(curHeight < Abuf){
            curHeight = Abuf;
        }else{
            res += curHeight - Abuf;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<iostream>
 
using namespace std;
 
int a,b;
int main(){
  scanf("%d %d",&a,&b);
  if(a > b)
    puts("a > b");
  else if(a < b)
    puts("a < b");
  else{
    puts("a == b");
  }
  return 0;
}

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

int main() {
  int a,b;
  char op;
  cin >> a >> op >> b;
  if(op == '+') {
    cout << a + b << endl;
  }
  else if(op == '-') {
    cout << a - b << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<ctime>
#include<bitset>
//#include<unordered_map>
using namespace std;
#define ll long long
#define dd cout<<endl
const long long int inf = 1e18+7;
const int mod = 998244353;

inline ll max(ll a,ll b) { return a>b?a:b; }
inline ll min(ll a,ll b) { return a<b?a:b; }
inline ll abs1(ll a) { return a>0?a:-a; }

//const int maxn=
 
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 	
 	int k;
 	cin>>k;
 	while(k--)
 		cout<<"ACL";
 	
    return 0;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 1e9+7;

int main() {
    int N;
    cin >> N;
    int x, y, t;
    x = y = t = 0;
    bool p = true;
    REP(i, N) {
        int nx, ny, nt;
        cin >> nt >> nx >> ny;
        int dis = abs(nx - x) + abs(ny - y);
        p = p && (dis <= nt - t);
        p = p && ((nt - t - dis)%2 == 0);
        x = nx;
        y = ny;
        t = nt;
    }
    if(p) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2)%MOD;
  return x%MOD*POW(x,n-1)%MOD;
}

ll POW2(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW2(x*x,n/2);
  return x*POW2(x,n-1);
}

ll POW3(ll x,ll n,ll m){
  x%=m;
  if(n==0)return 1;
  if(n%2==0)return POW3(x*x,n/2,m)%m;
  return x*POW3(x,n-1,m)%m;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}

ll lcm(ll u, ll v) {
  return u*v/gcd(u,v);
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll KAI2(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI2(m-1);
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll COM2(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI2(m)/KAI2(n)/KAI2(m-n);
}

ll DEC(ll x,ll m,ll n)//xのm進数でのx^nの位の値
{
  return x%POW2(m,n+1)/POW2(m,n);
}

ll keta(ll x,ll n)//xのn進数での桁数
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)//x!のnで割り切れる回数
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)//xのnで割り切れる回数
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

ll SGS(ll x,ll y, ll m)//1+x+…+x^(y-1)をmで割った余り
{
  if(y==0)return 0;
  if(y%2==0){
    return (1+POW3(x,y/2,m))*SGS(x,y/2,m)%m;
  }
  return (1+x*SGS(x,y-1,m))%m;
}

ll SSGS(ll x,ll y,ll m)//Σ[k=1→y](1+x+…+x^(k-1))をmで割った余り
{
  if(y==0)return 0;
  if(y==1)return 1;
  if(y%2==0){
    return (SSGS(x,y/2,m)*(POW3(x,y/2,m)+1)%m+SGS(x,y/2,m)*y/2%m)%m;
  }
  return (SSGS(x,y-1,m)*x%m+y)%m;
}

int main()
{
  ll n,m,x[110000],y[110000],l[110000],k[110000],p,ans=0;
  cin >> n >> m;
  rep(i,n)cin >> x[i];
  rep(i,m)cin >> y[i];
  rep(i,n/2){
    l[i]=x[n-1-i]-x[i];
  }
  rep(i,m/2){
    k[i]=y[m-1-i]-y[i];
    k[i]=k[i]*(m-1-2*i%MOD)%MOD;
  }
  sort(l,l+n/2);
  sort(k,k+m/2);
  if(n%2==1)rep(i,n/2)p=(p+l[i]*(i+1)%MOD*2)%MOD;
  if(n%2==0)rep(i,n/2)p=(p+l[i]*(i*2+1)%MOD)%MOD;
  rep(i,m/2){
    ans=(ans+k[i]*p%MOD)%MOD;
  }
  printf("%lld",(ans+MOD)%MOD);
}

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

int main()
{
    int n, k, a;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
    }

    cout << ceil((1.0 * n - 1) / (k - 1)) << endl;
    return 0;
}

Measured memory_bytes: 384
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=998244353;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
//18:08~
int main(void){
	cout<<fixed<<setprecision(20);
	cin.tie(0);ios::sync_with_stdio(false);
	int i,n;cin>>n;
	vector<tuple<double,double,double>>eng(n+n+1);
	llint nx=0,ny=0,ans=0;
	for(i=0;i<n;i++){
		double x,y,arg;
		cin>>x>>y;
		arg=atan2(x,y);
		eng[i]=mt(arg,x,y);
		eng[i+n]=mt(arg+pai+pai,x,y);
	}
	eng[n+n]=mt(9999.0,0.0,0.0);
	SO(eng);
	int hi=0,mg=0;
	while(hi<n+n){
		if(get<0>(eng[hi])+pai<get<0>(eng[mg])){nx-=get<1>(eng[hi]);ny-=get<2>(eng[hi]);hi++;}
		else{nx+=get<1>(eng[mg]);ny+=get<2>(eng[mg]);mg++;}
		maxeq(ans,nx*nx+ny*ny);
	}
	cout<<sqrt(ans)<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Mplus(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


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

  double n;
  cin>>n;
  vector<double> a(n);
  double sa=0;
  rep(i,n){
    cin>>a[i];
    sa+=a[i];
  }
  sa/=n;

  int it=-1;
  double s=inf;
  //cout<<sa<<endl;
  rep(i,n){
    if(s>abs(a[i]-sa)){
      s=abs(a[i]-sa);
      it=i;
    }
  }

  cout<<it<<endl;


}

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

ll p(ll a,ll b){
    if(b==0) return 1;
    ll tmp=1;
    rep(i,b){
        tmp*=a;
    }
    return tmp;
}

int main(void)
{
    ll x; cin>>x;
    ll ans=-1;
    for(int i=1;i<=1000;i++){
        for(int j=2;j<=10;j++){
            if(p(i,j) <= x){
                ans=max(ans,p(i,j));
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3564
function Main(s) {
	const n = parseInt(s[0]);
	s[1] = s[1].split(" ").map(a => parseInt(a));
	const d = s[1][0];
	var x = s[1][1];
	var a = [];
	for(var i = 0; i < n; i++){
		x += Math.floor((d - 1) / parseInt(s[i+2])) + 1;
	}
	console.log(x);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").split("\n"));

Measured memory_bytes: 7372
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0))return 0;
  long long x = 1;
  while (b > 0) {
    if (b & 1)x = (mod!=-1)?(x * a) % mod:x*a;
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

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

ll gcd(ll a,ll b){
  if(a%b==0)return b;
  return gcd(b,a%b);
}

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

  ll n,a,b;
  std::cin>>n>>a>>b;

  std::cout<<std::min(n*a,b)<<"\n";

  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		int[] prime=new int[50001];
		boolean[] primeflag=new boolean[50001];
		Scanner sc=new Scanner(System.in);
		prime[0]=2;
		primeflag[2]=true;
		prime[1]=3;
		primeflag[3]=true;
		int ptr=2;
		for(int i=5;i<=50000;i++){
			boolean flag=true;
			for(int j=0;prime[j]<=Math.sqrt(i);j++){
				if(i%prime[j]==0){
					flag=false;
				}
			}
			if(flag){
				prime[ptr++]=i;
				primeflag[i]=true;
			}
		}
		while(true){
			int n=sc.nextInt();
			if(n==0){
				break;
			}
			int count=0;
			for(int i=0;prime[i]<=n/2;i++){
				if(primeflag[(n-prime[i])]){
					count++;
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 33092
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
int main() {
	long i, n[1001] = { 0 }, n2[1001] = { 0 }, nn;
	string s;
	stringstream ss;
	while (getline(cin, s)) {
		if (s == "")
			break;
		ss.str("");
		ss << s;
		ss >> nn;
		n[nn]++;
	}
	while (getline(cin, s)) {
		if (s == "")
			break;
		ss.str("");
		ss << s;
		ss >> nn;
		n2[nn]++;
	}
	for (i = 1; i <= 1000; i++)
		if (n[i] * n2[i] > 0)
			cout << i << " " << n[i] + n2[i] << endl;
	return 0;
}

Measured memory_bytes: 3012
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.TreeMap;
import java.util.*;

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

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

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

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

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

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

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

public class Main {
    static int[] w = new int[100010];
    static int[] v = new int[100010];
    static int[][] dp = new int[110][100010];
    static int k;

    static int chmin(int a, int b) {
        if (a > b) {
            a = b;
            return a;
        }
        return a;
    }

    static int chmax(int a, int b) {
        if (a < b) {
            a = b;
            return a;
        }
        return a;
    }

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int[] a = new int[3];
        for (int i = 0; i < 3; i++) {
            a[i] = fs.nextInt();
        }

        Arrays.sort(a);
        System.out.println(a[0] + a[1]);

    }

}


Measured memory_bytes: 80972
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
using namespace std;
int main(){
  lli a,b,t;
  cin>>a>>b>>t;
  ou(t/a*b);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define REP(i,s,n) for(int (i)=s; (i)<(int)(n);(i)++)
#define RIT(it,c) for(__typeof(c.begin()) it = c.begin();it!=c.end();it++)
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x).size()
#define MSET(m,v) memset(m,v,sizeof(m))
 
 
using namespace std;
 
 
typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<LL> vL;
typedef vector<bool> vb;
typedef pair<int,vi> iv;
typedef pair<LL,LL> pLL; 
typedef long double LD;
typedef unordered_set<int> ui;

int K,N;
vector<ii> cd;

bool comp(const ii &x, const ii &y){
	if(x.second == y.second) return x.first < y.first;
	return x.second < y.second;
}


int main(){
	std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>N>>K;
	for(int i=0;i<N;++i){
		int x,y;
		cin>>x>>y;
		cd.push_back(ii(x,y));
	}
	sort(cd.begin(), cd.end());
	LL ans = LL(2E9)*LL(2E9);
	for(int i=0;i<N;++i) if(!i || cd[i].first!=cd[i-1].first){
		LL l = cd[i].first;
		for(int j=i+K-1; j<N; ++j) if(j==N-1 || cd[j].first != cd[j+1].first){
			LL r = cd[j].first;
			vector<ii> tmp(cd.begin()+i, cd.begin()+j+1);
			sort(tmp.begin(), tmp.end(), comp);
			int n = (int)tmp.size();
			for(int k=0;k<n;++k) if(!k || tmp[k].second!=tmp[k-1].second){
				LL b = tmp[k].second;
				for(int t = k+K-1;t<n;++t) if(t==n-1 || tmp[t].second != tmp[t+1].second){
					LL u = tmp[t].second;
					ans = min(ans, (r-l)*(u-b) );
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>

int n,ti,cur,sum,ans;
int a[200005];

int main()
{
	scanf("%d %d",&n,&ti);
	for(int i = 1;i <= n; i++){
		scanf("%d",&a[i]);
	}
	for(int i = 1;i < n; i++){
		if(a[i + 1] - a[i] < ti) {
			cur = ti - (a[i + 1] - a[i]);
			sum += cur;
		}
	}
	ans = n * ti - sum;
	printf("%d\n",ans);
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main(){
	vector<char>s(3);
    cin>>s[0]>>s[1]>>s[2];
  	int ans=0;
  	for(int i=0;i<3;i++){
    	if(s[i]=='1'){
        	ans++;
        }
    }
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M = mapint()
boxes = [0]*N
balls = [1]*N
boxes[0] = 1
for _ in range(M):
    x, y = mapint()
    boxes[y-1] = 1 if boxes[x-1]==1 else boxes[y-1]
    balls[x-1] -= 1
    balls[y-1] += 1
    if balls[x-1]==0:
        boxes[x-1] = 0

print(sum(boxes))

Measured memory_bytes: 75540
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	
        Scanner in = new Scanner(System.in);
        long m = in.nextLong();
        long n = in.nextLong();
        System.out.print(lcm(m, n));
    }
    
    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
    
    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define PI (acos(-1))
#define ct cout<<
#define cn cin>>
#define spc <<" "<<
#define nl puts("")
#define _fl(x) puts("FLAG " #x);
#define  _(x)  cout<< #x <<" is "<< x <<endl;
#define fs first
#define sc second
#define pb push_back
#define all(v)  (v).begin(), (v).end()
#define _109 (1000000000)
#define _0(arr) memset(arr,0,sizeof ( arr ) )
#define _1(arr) memset(arr,-1,sizeof ( arr ) )
#define _ninp(n,arr) for(int i=0; i<n;i++)cin>>arr[i];
#define _nout(n,arr) for(int i=0; i<n;i++)cout<<arr[i]<<" \n"[i==n-1];
double _eps=1e-6;
long long gcd(long long a, long long b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

int main() {

   double n;

   cn n;
   
   double m=n/1.08;
   //ct m;

   ll mm=m;
   
   
   if(fabs(floor(mm*1.08)-n)<=1e-7)ct mm;
   else{
   mm++;
   if(fabs(floor(mm*1.08)-n)<=1e-7)ct mm;
   else ct ":(";
   }
   nl;
      






    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n;
int a[15];
int x[15][15];
int y[15][15];


int main(){
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
    for (int j = 0; j < a[i]; j++) {
      std::cin >> x[i][j]>>y[i][j];
    }
  }

  bool flag=true;
  int now=0;
  int ans=0;
  for (int bits = 1; bits < (1<<n); bits++) {
    // std::cout << bits<<" (";

    for (int j = 0; j < n; j++) {
      if(!(bits&(1<<j)))continue;
      now++;
      // std::cout << j<<",";
      for (int k = 0; k < a[j]; k++) {
        if(y[j][k]==1){
          if(!(bits&(1<<(x[j][k]-1))))
          {
            // std::cout << "fa:";
            flag=false;
          }
        }
        if(y[j][k]==0){
          if((bits&(1<<(x[j][k]-1))))
          {
            // std::cout << "fa2:";
            flag=false;
          }
        }

      }
    }
    // std::cout <<":now="<<now<<")" << '\n';
    if(flag==true && ans<now)ans=now;
     now=0;
     flag=true;
  }
  std::cout <<ans<< '\n';
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] inputs = reader.readLine().split(" ");
        int N = Integer.parseInt(inputs[0]);
        long T = Integer.parseInt(inputs[1]);
        inputs = reader.readLine().split(" ");
        long length = 0;
        long t;
        t = Long.parseLong(inputs[0]);
        long[] interval = new long[]{t, t + T};

        for (int i = 1; i < N; i++) {
            t = Long.parseLong(inputs[i]);

            if (interval[1] < t) {
                length += (interval[1] - interval[0]);
                interval[0] = t;
                interval[1] = t + T;
            } else if (interval[1] == t) {
                length += (interval[1] - interval[0]);
                interval[0] = t;
                interval[1] = t + T;
            } else {
                length += (t - interval[0]);
                interval[0] = t;
                interval[1] = t + T;
            }
        }

        System.out.println(length + (interval[1] - interval[0]));

    }

}

Measured memory_bytes: 47188
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
ll n,a,b,sum,Min=INF;
bool flag=true;
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&a,&b);
		sum+=b;
		if(a!=b)
			flag=false;
		if(b<a&&Min>b)
			Min=b;
	}
	if(flag)
		printf("0\n");
	else
		printf("%lld\n",sum-Min);
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int t = Integer.parseInt(bf.readLine());
 		String input = bf.readLine().trim();
 		int wcount = 0;
 		for(int i = 0;i<t;i++)
 			if (input.charAt(i) == 'W')
 				wcount++;
 		int ans = 0;
 		for(int j = t-wcount;j<t;j++)
 			if (input.charAt(j) == 'R')
 				ans++;
 		
 		
 		
 		
 		out.println(ans);
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Measured memory_bytes: 29552
#include <bits/stdc++.h>
using namespace std;
int v[100001],n,k;
int pd[100001];
main ()
{
    cin>>n>>k;
    for (int i = 1;i<=n;++i)
        cin>>v[i];
    pd[1]=0;
    for (int i = 2;i<=n;++i)
    {
        pd[i]=INT_MAX;
        for (int j = 1;j<=k;++j)
            if (i>j)
                pd[i]=min(pd[i],pd[i-j]+(int)abs(v[i-j]-v[i]));
    }
    cout<<pd[n];
    return 0;
}


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

#define ll long long
#define ar array

const int mxN=2e5+5,INF=999999999;
const int modr=1e9+7;
int  n,m,a[mxN];

/* 1. If you can't keep solution in mind, then visualize it on a paper.
 * 2. Try to identify the type of problem - DP, Greedy, Graph, Constructive, 
 * 	  Prefix/Suffix, Difference Array, BIT/Segment Tree, etc.
 * 3. Look at the problems from different perspectives - reverse the problem, 
 * 	  add instead of delete (maybe?)
 * 4. Divide difficult solutions into cases and/or sequences.
 * 5. Use math rules to solve Nested Summation.
 * 6. Optimisation problems are generally solved with DP, greedy, binary search or brute-force.
 * ------------------------------------------------------------------ 
 */


bool vis[mxN];
vector<int> adj[mxN];
int t;
void dfs(int s){
	vis[s]=true;t++;
	for(auto child : adj[s]){
		if(!vis[child]){
			dfs(child);
		}
	}
}

void solve() {
	cin >> n>>m;
	int x,y;
	for(int i=0;i<=n;i++){
		adj[i].clear();
		vis[i]=false;
	}
	for(int i=0;i<m;i++){
	    cin>>x>>y;
	    adj[x].push_back(y);
	    adj[y].push_back(x);
	}
	int maxm=-1;
	for(int i=0;i<=n;i++){
		if(!vis[i]){
		    t=0;
		    dfs(i);
		    maxm=max(maxm,t);
		}}
		    
	cout<<maxm;
}

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

	int t=1;

	for(int i=1; i<=t; ++i) {
	//	cout << "Case #" << i << ": ";
		solve();
	}
}



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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
typedef long long ll;

int main(){
  int r,d,x;
  cin >> r >> d >> x;
  rep(i,10){
    x = r*x-d;
    cout << x << endl;
  }
}


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

using namespace std;

typedef vector<int> vi;
const int M = 51;
vector<string> words;

int main() {

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


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <cstring>
#include <tuple>
#include <bitset>
#include <unordered_map>
using namespace std;
typedef long long ll;

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

int main() {
    ios::sync_with_stdio(false);
    int x, y;
    cin >> x >> y;
    cout << gcd(x, y) << endl;

    return 0;
}

Measured memory_bytes: 1188
#include <stdio.h>
 
int main(void) {
    int N,i,j,k,n,v;
    int ans[10050]={};
    scanf("%d" ,&N);
        for (i=1;i<=105; i++) {
            for (j=1;j<=105 ; j++) {
                for (k=1;k<=105 ; k++) {
                    v = i*i + j*j + k*k + i*j + j*k + k*i;
                    if (v<10050){
                        ans[v]++;
                    }
                }
            }
        }
    for (i=0; i<N; i++) {
        printf("%d\n" ,ans[i+1]);
    }
    return 0;
}

Measured memory_bytes: 1692
#include <stdio.h>

int main(void){

int i,n;

int number;

long long int sum=0;

int min=0;

int max=0;

scanf("%d",&n);

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

{

scanf("%d",&number);

if(i==0)

{

min = number;

max = number;

}

if(number<min) min = number;

if(number>max) max = number;

sum += number;

}

printf("%d %d %lld\n",min,max,sum);

return 0;

}

Measured memory_bytes: 600
N,M=map(int,input().split())
H=[0]+list(map(int,input().split()))
E=[[] for i in range(N+1)]
for i in range(M):
    x,y=map(int,input().split())
    E[x].append(y)
    E[y].append(x)

ANS=0
for i in range(1,N+1):
    h=H[i]
    for to in E[i]:
        if H[to]>=h:
            break
    else:
        ANS+=1
print(ANS)


Measured memory_bytes: 29476
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long double pi = acos(-1.0); 
typedef long long ll;

struct Node {int parent, left, right;};


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

	int n;
	cin >> n;
	cout << (1000 - n % 1000) % 1000 << endl;
}

Measured memory_bytes: 3684
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int x,y,z;
    int ans=0,cnt=0;

    scanf("%d%d%d",&x,&y,&z);
    if(x==5)
        ans++;
    if(x==7)
        cnt++;
    if(y==5)
        ans++;
    if(y==7)
        cnt++;
    if(z==5)
        ans++;
    if(z==7)
        cnt++;
    if(ans==2&&cnt==1)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <ctype.h>
#include <cstdlib>
#include <string.h>


using namespace std;


int main()
{
	int count = 0, taro = 0, hanako = 0;
	string str1, str2;

	cin >> count;


	for (int i = 0; i < count; i++)
	{
		cin >> str1 >> str2;

		if (str1 == str2)
		{
			taro++;
			hanako++;
		}
		else if(str1 > str2)
		{
			taro += 3;
		}
		else if (str1 < str2)
		{
			hanako += 3;
		}
	}

	cout << taro << " " << hanako << endl;

	
}

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

int main() {
    int a,p;
    cin>>a>>p;
    p+=3*a;
    cout<<p/2<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define foru(i, a, b) for(int i = a; i <= b; ++i)
using namespace std;
typedef unsigned long long ll;
const int N=2e5+5;
int n;
int a[N], l[N], r[N];
ll ans=0;
int main() {
//   freopen("input.txt","r",stdin);
   cin>>n;
   for(int i=0;i<n;++i)cin>>a[i];


   stack<int> q;
   for(int i=0;i<n;++i){
      while(!q.empty()&&a[q.top()]>=a[i])q.pop();
      if(q.empty())
         l[i]=0;
      else
         l[i]=q.top()+1;
      q.push(i);
   }
   while(!q.empty())q.pop();
   for(int i=n-1;i>=0;--i){
      while(!q.empty()&&a[q.top()]>a[i])q.pop();
      if(q.empty())
         r[i]=n-1;
      else
         r[i]=q.top()-1;
      q.push(i);
   }
   for(int i=0;i<n;++i){
      ans+=1ll*a[i]*(i-l[i]+1)*(r[i]-i+1);
//      cout<<l[i]<<' '<<r[i]<<' '<<ans<<endl;
   }
   cout<<ans;
   return 0;
}


Measured memory_bytes: 3456
import sys
import numpy as np
import itertools

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
A = np.array([0] + lr())
A_cum = A.cumsum()
beauties = []
for i, j in itertools.combinations(range(N+1), 2):
    beauties.append(A_cum[j] - A_cum[i])

beauties = np.array(beauties)
j = 0
def check(x):
    return np.sum(beauties&x == x) >= K

answer = 0
for i in range(40, -1, -1):
    if check(answer + (1 << i)):
        answer += 1 << i

print(answer)
# 00


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

#ifdef _LOCAL_DEBUG
#include "templates/debug.h"
#else
#define debug(...) 
#endif

void solve() {
    int n;
    cin >> n;
    cout << 10 - (n / 200) << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt = 1;
    while (tt--)
        solve();
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<char> S(3);
  for (int i = 0; i < 3; i++)
    cin >> S.at(i);
  if (S.at(0) == S.at(1) && S.at(1) == S.at(2)) {
  	cout << "No" << endl;
  }
  else {
  	cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int N = 2e5+5;
ll f[N][19],g[N][19];
int n;ll a[N],c[17];
int main(){
    ios::sync_with_stdio(false);
    memset(f,0x3f3f3f3f,sizeof(f));
    memset(g,0x3f3f3f3f,sizeof(g));
    cin>>n;c[0]=1;
    for(int i=1;i<=15;i++)
        c[i]=c[i-1]*4;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=0;i<=15;i++)
        f[1][i]=i;
    for(int i=2;i<=n;i++){
        for(int j=0;j<=15;j++){
            for(int k=15;k>=0;k--){
                if(a[i-1]*c[k]>=a[i]*c[j]) {
                    f[i][j] = min(f[i][j], f[i - 1][k] + j);
                }
            }
            if(f[i][j]==4557430888798830399LL) f[i][j]=f[i][j-1]+i;
        }
    }
    for(int i=0;i<=15;i++)
        g[n][i]=i;
    for(int i=n-1;i;i--){
        for(int j=0;j<=15;j++){
            for(int k=15;k>=0;k--){
                if(a[i+1]*c[k]>=a[i]*c[j]){
                    g[i][j]=min(g[i][j],g[i+1][k]+j);
                }
            }
            if(g[i][j]==4557430888798830399LL) g[i][j]=g[i][j-1]+(n-i+1);
        }
    }
    ll ans = INF;
    f[0][0]=g[0][0]=f[n+1][0]=g[n+1][0]=0;
    for(int i=0;i<=n;i++){
        ll n1=INF,n2=INF;
        for(int j=0;j<=15;j++){
            n1 = min(n1,f[i][j]);
            n2 = min(n2,g[i+1][j]);
        }
        ans = min(ans,n1*2+n2*2+i);
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 61184
import bisect as bis

N = int(input())
L = sorted(list(map(int, input().split())))

res = 0
for i, a in enumerate(L):
    for k, b in enumerate(L[i + 1:]):
        j = k + i + 1

        left = b - a
        right = a + b

        index_l = bis.bisect_right(L, left, j)
        index_r = bis.bisect_left(L, right, j)
        if index_l == N - 1:
            break

        res += index_r - index_l - 1
print(res)



Measured memory_bytes: 48784
c = []
3.times do |i|
    c[i] = $stdin.gets.chomp.split(' ').map(&:to_i)
end

2.times do |i|
    unless (0..2).map{|j| c[j][2] - c[j][i] }.uniq.length == 1
        print 'No'
        exit
    end
    unless (0..2).map{|j| c[2][j] - c[i][j] }.uniq.length == 1
        print 'No'
        exit
    end
end

print 'Yes'

Measured memory_bytes: 3836
#include <cstdio>

using namespace std;

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

int main()
{
	for (int i = 1; i <= 9; ++i) {
		for (int j = 1; j <= 9; ++j) {
			printf("%dx%d=%d\n", i, j, i * j);
		}
	}
}

Measured memory_bytes: 2696
from collections import *
from itertools import *

N = int(input())

A = map(int, input().split())
SA = SB = 0
ABI = sorted(((b:=max(N-i, i-1)*a, SA:=SA+a, SB:=SB+b) and (a, b, i) for i, a in enumerate(A, 1)), reverse=True)

prev = [0]
prev_max = 0
for k, (a, b, i) in enumerate(ABI):
  curr = [0]*(k+2)
  for l in range(k+1):
    r = k-l
    if prev[l] + SB - min(l,r)*SA < prev_max:
      continue
    curr[l] = max(curr[l], prev[l]+abs(N-i-r)*a)
    curr[l+1] = prev[l]+abs(i-l-1)*a
  SA -= a
  SB -= b
  prev = curr
  prev_max = max(prev)

print(prev_max)


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

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

	vector<int> a(n);
	rep(i,n) cin >> a[i];

	ll all = 1LL;
	rep(loop,n) all *= 3LL;

	ll odd = 1LL;
	rep(i,n) if(a[i]%2==0) odd *= 2LL;
	cout << all-odd << endl;

	return 0;
}

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

int main(){
  int n,k,d,a;
  cin >> n >> k;
  int ans[n]={0};
  for(int i=0;i<k;i++){
    cin >> d;
    for(int j=1;j<=d;j++){
      cin >> a;
      ans[a-1]++;
    }
  }
  int cnt=0;
  for(int i=0;i<n;i++){
    if(ans[i]==0){
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3568