akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <algorithm>
using namespace std;

#define INF 100000000;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
int main(){
    int N,M,X;
    int money[4100];
    int C[13];
    int A[13][13];
    int takahashi_understand[4100][13];
    
    cin >> N >> M >> X;
    int p = pow(2,N);
    //rep(i,4100) money[i] = 0;
    rep(j,p){
        rep(i,M) takahashi_understand[j][i] = 0;
    }
    rep(i,N){
        cin >> C[i];
        rep(j,M){
            cin >> A[i][j];
        }
    }

    for (int bit = 0; bit < (1<<N); ++bit) {
        money[bit] = 0;
        rep(i,N){
            if (bit & (1<<i)){
                money[bit] += C[i];
                rep(j,M){
                    takahashi_understand[bit][j] += A[i][j];
                }
            }
        }
        rep(i,M){
            if (takahashi_understand[bit][i] < X){
                //cout << "timp" << bit << endl;
                money[bit] = -1;
            }
        }
    }

    sort(money,money + p);
    rep(i,pow(2,N)){
        //cout << money[i] << endl;
        if(money[i] > 0){
            cout << money[i] << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 4256
#include <stdio.h>
int main()
{
  int n;
  scanf("%d",&n);
  int hundred=(n-n%100)/100;
  int one=n%10;
  if(hundred==one){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  
  return 0;
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n, a, b; cin >> n >> a >> b;
    vector<ll> x(n);
    for (int i = 0; i < n; i++) cin >> x[i];
    
    ll ans = 0;
    for (int i = 0; i < n - 1; i++) {
        ans += min<ll>((x[i + 1] - x[i]) * a, b);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
X = int(input())
lis = []
for i in range(-200, 201):
    lis.append(i**5)
flag = 0
for a, i in enumerate(lis):
    for b, j in enumerate(lis):
        if (i + j == X) or (j - i == X):
            flag = 1
            break
    if flag == 1:
        break
    
print((a-200)*(-1), (b-200)*(-1))

Measured memory_bytes: 9196
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.*;

public class Main{
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		long a = sc.nextLong();
		long b = sc.nextLong();
		long ao = a;
		long bo = b;
		TreeSet<Long> seta = new TreeSet<>();
		for (long i = 2; i * i <= ao; i++) {
			if (a % i == 0) {
				seta.add(i);
				while (a % i == 0) {
					a /= i;
				}
			}
		}
		seta.add(1L);
		seta.add(a);
		TreeSet<Long> setb = new TreeSet<>();
		for (long i = 2; i * i <= bo; i++) {
			if (b % i == 0) {
				setb.add(i);
				while (b % i == 0) {
					b /= i;
				}
			}
		}
		setb.add(1L);
		setb.add(b);
		seta.retainAll(setb);
		System.out.println(seta.size());
	}
}

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 || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 23892
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;

int main() {
    int X;
    cin >> X;
    vector<int> A;
    for (int i = 1; i <= X; i++) {
        for (int j = 2; j <= 20; j++) {
            ll num = pow(i, j);
            if (num > X)
                break;
            else
                A.push_back(num);
        }
    }

    ll ans = *max_element(all(A));
    cout << ans << endl;
}

Measured memory_bytes: 4028
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<vector>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
const int N=1e5+5;
template<class T>inline void read(T &res)
{
char c;T flag=1;
while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
int a,b,c;
int main(){
	cin>>a>>b>>c;
	if(a==b&&a!=c)puts("Yes");
	else if(a==c&&a!=b)puts("Yes");
	else if(b==c&&b!=a)puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll W, H, x, y;
    cin >> W >> H >> x >> y;

    double ans = (double)W * (double)H / (double)2;
    bool some = false;
    if (x * 2 == W && y * 2 == H) some = true;
    cout << setprecision(10) << ans << " " << some << "\n";

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define tp tuple<int,int,int>
#define mtp make_tuple
using namespace std;

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b,n;
    cin>>a>>b>>n;
    int x=min(n,b-1);
    cout<<(a*x)/b;
}


Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#define mod (1e9 + 7)
#define pb push_back
#define ll long long int
using namespace std;
typedef pair<int,int> pii;

int main(){

  int n;
  cin>>n;

  vector<double> v;
  double t;
  for(int i=0;i<n;i++){
    cin>>t;
    v.pb(t);
  }

  sort(v.begin(),v.end());

  t=v[0];
  for(int i=1;i<n;i++){
    t=(t+v[i])/2.0;
  }
  cout<<t<<endl;
  return 0;
}



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

d = 0

for i in range(n):
    c= b[i]-a[i]
    if c<0:
        d+=-c
    else:
        d-=c//2

print('Yes' if d<1 else 'No')


Measured memory_bytes: 40560
N , K = [int(i) for i in input().split()]
S = input()

S = 'R' + S + 'L'

a = 0

for i in range(N+1):
    if S[i] == 'R' and S[i+1] == 'L':
        a += 2

if S[1] == 'L':
    a -= 1

if S[-2] == 'R':
    a -= 1

ans = N - a + (2*K)

if ans > N-1:
    ans = N-1
    
print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
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<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

const int M=100001;
int n,a[M];
P b[M];

int main(){
	cin>>n;
	for(int i=0;i<M;i++) a[i]=n/2,b[i]={n/2,i};
	for(int i=0;i<n;i++){
		int A;
		cin>>A;
		if(i%2==0) a[A]--;
		else b[A].first--;
	}
	int res=n;
	sort(b,b+M);
	for(int i=0;i<M;i++) res=min(res,a[i]+(b[0].second==i?b[1].first:b[0].first));
	cout<<res<<endl;
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

//#define _USE_MATH_DEFINES
//#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>
#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 1000000007; // 10000000000000007ll;

const double eps = 1e-8;

const i64 MAXN = 2'000 + 3;

i64 T;
i64 k, n;
i64 x, y;
i64 a[MAXN];

i64 d[MAXN][MAXN];

i64 r[MAXN];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);


    cin >> n >> x >> y;

    for (i64 i = 1; i <= n; i++) {
        for (i64 j = i + 1; j <= n; j++) {
            //d[i][j] = j - i - (i <= x && j >= y ? y - x - 1 : 0);

            d[i][j] = min(j - i, abs(x - i) + abs(y - j) + 1);
        }
    }


    for (i64 i = 1; i <= n; i++) {
        for (i64 j = i + 1; j <= n; j++) {
            r[d[i][j]] += 1;
        }
    }

    stringstream ss;
    for (i64 i = 1; i <= n - 1; i++) {
        ss << r[i] << endl;
    }
    cout << ss.str();

    return 0;
}

Measured memory_bytes: 31232
#include<bits/stdc++.h>
#define ll long long 
#define rep(i,N) for(int i=0;i<N;i++)

using namespace std;

const int INF = 1001001001;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
  
    int n;
    cin >> n;
  
    //dp[i] : i円引き出すのに必要な最低操作回数
    vector<int> dp(n+1,INF);
    dp[0] = 0;
    rep(i,n+1){
      if(i==0) continue;
      dp[i] = min(dp[i],dp[i-1]+1);
      for(int j=6;i-j>=0;j=j*6){
        dp[i] = min(dp[i],dp[i-j]+1);
      }
      for(int j=9;i-j>=0;j=j*9){
        dp[i] = min(dp[i],dp[i-j]+1);
      }
    }
	cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    ll dp[t.size()+1][s.size()+1];
    for(ll i=0;i<=s.size();i++)
        dp[0][i]=0;
    for(ll i=0;i<=t.size();i++)
        dp[i][0]=0;
    for(ll i=1;i<=t.size();i++)
    {
        for(ll j=1;j<=s.size();j++)
        {
            if(t[i-1]==s[j-1])
            {
                dp[i][j]=dp[i-1][j-1]+1;
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    vector<char>ans;
    if(dp[t.size()][s.size()]==0)
    {
        cout<<"";
        return 0;
    }
    ll h=s.size(),v=t.size();
    while(h!=0  && v!=0)
    {
        if(s[h-1]==t[v-1])
        {
            ans.push_back(s[h-1]);
            h--;
            v--;
        }
        else if(dp[v][h-1]>dp[v-1][h])
        {
            h--;
        }
        else
        {
            v--;
        }
    }
    for(ll i=ans.size()-1;i>=0;i--)
        cout<<ans[i];
}

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

int main()
{
    vector<int> A(3);
    for (int i = 0; i < 3; i++)
    {
        cin >> A[i];
    }
    cout << *max_element(A.begin(), A.end()) - *min_element(A.begin(), A.end()) << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    if (a % 2 != 0 && b % 2 != 0)
    {
        cout << "Odd" << endl;
    }
    else
    {
        cout << "Even" << endl;
    }
}

Measured memory_bytes: 256
import bisect

n,m=map(int,input().split())
p=[]
y=[]
yd=[[] for _ in range(n+1)]
for i in range(m):
    pp,yy=map(int,input().split())
    p.append(pp)
    y.append(yy)
    yd[p[i]].append(y[i])
for i in range(n):
    yd[i+1].sort()
for i in range(m):
    x=p[i]*1000000+bisect.bisect_left(yd[p[i]],y[i])+1
    x=str(x)
    print("0"*(12-len(x))+x)


Measured memory_bytes: 74912
#include <iostream>
using namespace std;
int main(void){
    string S, T, U;
    int A, B;

    cin >> S >> T >> A >> B >> U;
    
    if (S == U) {
        A--;
    } else if (T == U) {
        B--;
    }
    
    cout << A << " " << B;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int n,h,w;
    cin>>n>>h>>w;
    cout<<(n-h+1)*(n-w+1);
}

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

#define int long long

using namespace std;

#define N 100005

vector < int >  a[N];
int out[N];
int ans[N];



int32_t main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);

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

        int t1, t2;


        for(int i=0;i<m;i++)
        {
                cin>>t1>>t2;
                a[t2].push_back(t1);
                out[t1]++;
        }

        stack < int > stk;

        for(int i=1;i<=n;i++)
        {
                if(out[i]==0)
                        stk.push(i);
        }

        while(!stk.empty())
        {
                int temp=stk.top();
                stk.pop();
                for(int i=0;i<a[temp].size();i++)
                {
                        ans[a[temp][i]]=max(ans[a[temp][i]],ans[temp]+1);
                        out[a[temp][i]]--;
                        if(out[a[temp][i]]==0)
                        {
                                stk.push(a[temp][i]);
                        }
                }
        }

        int foo=0;
        
        for(int i=1;i<=n;i++)
        {
                foo=max(foo,ans[i]);
        }
        
        cout<<foo<<endl;

        return 0;

}



Measured memory_bytes: 7296
#include<stdio.h>
#define N 250
 
typedef struct{
  int key;
  int parent;
  int left;
  int right;
}node;
 
 
 
node Tree[N];
int main(){
  int i,n=0;
   
  scanf("%d",&n);
   
  for(i=0;i<n;i++)Tree[i].parent=-1;
   
  for(i=0;i<n;i++){
    scanf("%d",&Tree[i].key);
  }
 
  for(i=0;i<n;i++){
     
    if(i!=0)Tree[i].parent=(i+1)/2-1;
     
    if(2*(i+1)-1<n)Tree[i].left=2*(i+1)-1;
    else Tree[i].left=-1;
     
     
    if(2*(i+1)<n)Tree[i].right=2*(i+1);
    else Tree[i].right=-1;
  }
   
  for(i=0;i<n;i++){
 
    printf("node %d: key = %d, ", i+1, Tree[i].key);
     
    if(Tree[i].parent!=-1) printf("parent key = %d, ",Tree[Tree[i].parent].key);
     
    if(Tree[i].left!=-1) printf("left key = %d, ",Tree[Tree[i].left].key);
     
    if(Tree[i].right!=-1) printf("right key = %d, ",Tree[Tree[i].right].key);
     
    printf("\n");
  }
   
  return 0;
}

Measured memory_bytes: 604
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

using namespace std;
typedef long long ll;

ll vs[10];

int main(void) {
  ll n;
  cin >> n;
  ll mini = 1e18;
  REP(i, 5) {
    cin >> vs[i];
    mini = min(mini, vs[i]);
  }
  ll res = (n + mini - 1) / mini - 1 + 5;
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int D;
  cin >>D;
  if(D==22)puts("Christmas Eve Eve Eve");
  else if(D==23)puts("Christmas Eve Eve");
  else if(D==24)puts("Christmas Eve");
  else if(D==25)puts("Christmas");
  return 0;
    
  
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cassert>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<vector>
#include<time.h>
#include<algorithm>
using namespace std;
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define rep(i,n) REP(i,1,n)
#define rep0(i,n) REP(i,0,n-1)
#define repG(i,x) for(ll i=pos[x];~i;i=e[i].next)
#define ll long long
#define db double
const ll N=3007;
const ll mod=1e9+7;
ll Pow(ll x,ll y){
	ll ans=1,now=x;
	while(y){
		if(y&1)ans=ans*now%mod;
		now=now*now%mod;
		y>>=1;
	}
	return ans;
}
ll f[N][N],a[N];
ll n,Q,i2;

int main(){
	scanf("%lld%lld",&n,&Q);
	rep(i,n)scanf("%lld",&a[i]);
	rep(i,n)rep(j,n)if(a[i]>a[j])f[i][j]=1;
	i2=Pow(2,mod-2);
	rep(i,Q){
		ll x,y; scanf("%lld%lld",&x,&y);
		rep(j,n){
			if(j==x||j==y)continue;
			f[j][x]=f[j][y]=(f[j][x]+f[j][y])*i2%mod;
			f[x][j]=f[y][j]=(f[x][j]+f[y][j])*i2%mod;
		}
		f[x][y]=f[y][x]=(f[x][y]+f[y][x])*i2%mod;
	}
	ll ans=0;
	rep(i,n)REP(j,i+1,n)ans=(ans+f[i][j])%mod;
	printf("%lld\n",ans*Pow(2,Q)%mod);
	return 0;
}


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

int main()
{
    int n, tmp = 0, len;
    cin>>n;
    len = n;
    vector<long long> arr;
    while(n)
    {
        cin>>tmp;
        arr.push_back(tmp);
        n --;
    }
    long long sum = 0, ans1 = 0, ans2 = 0;
    for(int i = 0, s = 1; i<len; i++, s *= -1){
        sum += arr[i];
        if((sum * s) <= 0)
        {
            ans1 += abs(sum - s);
            sum = s;
        }
    }
    sum = 0;
    
    for(int i = 0, s = -1; i<len; i++, s *= -1){
        sum += arr[i];
        if((sum * s) <= 0)
        {
            ans2 += abs(sum - s);
            sum = s;
        }
    }
    
    cout<<min(ans1, ans2)<<endl;
    return 0;
}

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

int main(){
    long long a, b, c, d, mx;
    cin >> a >> b >> c >> d;
    if(a > b)
        swap(a, b);
    if(c > d)
        swap(c, d);
    long long res[4];
    res[0] = a * c;
    mx = res[0];
    res[1] = a * d;
    mx = max(mx, res[1]);
    res[2] = b * c;
    mx = max(mx, res[2]);
    res[3] = b * d;
    mx = max(mx, res[3]);
    cout << mx << '\n';

    return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main(){
  int N;
  cin>>N;
  int cnt=0;
  vector<int> B(N-1);
  for(int i=0;i<N-1;i++) cin>>B[i];
  for(int i=1;i<N-1;i++) cnt+= min(B[i-1], B[i]);
  cnt+=B[0]+B[N-2];
  cout<<cnt;
    
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl
typedef pair<int,int> Pp;


signed main(){
    int H,W,K;
    int dp[104][10]={};
    int F[104];
    F[0]=1,F[1]=1;
    for(int i=2;i<=10;i++){
        F[i]=F[i-1]+F[i-2];
    }
    dp[0][0]=1;
    cin >> H >> W >> K;
    if(W==1){cout << 1 << endl;return 0;}
    if(W==2){
        int e=1;
        REP(i,H-1){
            e=(2*e)%MOD;
        }
        cout << e << Endl;return 0;
    }
    OREP(i,H){
        REP(j,W){
            dp[i][j]+=dp[i-1][j]*F[j]*F[W-j-1];
            if(j!=0)dp[i][j]+=dp[i-1][j-1]*F[j-1]*F[W-j-1];
            if(j!=W-1)dp[i][j]+=dp[i-1][j+1]*F[j]*F[W-j-2];
            dp[i][j]%=MOD;
        }
    }
    cout << dp[H][K-1] << endl;
    
    return 0;
}   


Measured memory_bytes: 384
import java.util.Scanner;

//Videotape
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int h = sc.nextInt();
			int m = sc.nextInt();
			int s = sc.nextInt();
			if(h==-1)break;
			int x = h*3600+m*60+s;
			int r = 7200 - x;
			int r3 = 7200*3-x*3;
			System.out.printf("%02d:%02d:%02d\n", r/3600, r%3600/60, r%60);
			System.out.printf("%02d:%02d:%02d\n", r3/3600, r3%3600/60, r3%60);
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
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); }
template<typename T> void SORT_(std::vector<T>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}

void DFS(int V,vector<vector<int> >&GRAPH,vector<int>&dist,int depth)
{
  dist[V] = depth;
  for (int i = 0; i < GRAPH[V].size(); i++)
  {
    if(dist[GRAPH[V][i]] == -1)
    {
      DFS(GRAPH[V][i],GRAPH,dist,depth+1);
    }
  }
  return;
}
void solve(void)
{
  int H,W,D;
  cin>>H>>W>>D;
  map<int,pair<int,int> > mp;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      int A;
      cin>>A;
      A--;
      mp[A] = pair<int,int>(i,j);
    }
  }
  vector<vector<pair<int,int> > > DATA(D);
  for (int i = 0; i < mp.size(); i++)
  {
    static auto itr = mp.begin();
    int A = itr->first;
    DATA[A%D].push_back(itr->second);
    itr++;
  }

  vector<vector<int> > dist(D);
  for (int i = 0; i < DATA.size(); i++)
  {
    dist[i].push_back(0);
    for (int j = 0; j < DATA[i].size()-1; j++)
    {
      pair<int,int> pos =DATA[i][j];
      pair<int,int> pos_n = DATA[i][j+1];
      dist[i].push_back(dist[i][j] + abs(pos.first - pos_n.first) + abs(pos.second - pos_n.second));
      
    }
    
  }
  // DEBUG(dist);
  int Q;
  cin>>Q;
  for (int i = 0; i < Q; i++)
  {
    int A,B;
    cin>>A>>B;
    A--;B--;
    int X = A/D;
    int Y = A%D;
    int D_1 = (B-A)/D;
    cout<<dist[Y][X+D_1] - dist[Y][X]<<endl;
  }
  
  
  


  
  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 15872
#include<iostream>
#include<vector>
#include<algorithm>

int main() {
	int N; 
	std::cin >> N;
	std::vector<int> L(N);
	for (int i = 0; i < N; i++) {
		std::cin >> L[i];
	}
	std::sort(L.begin(), L.end());

	int ans = 0;
	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) {
					if (L[i] == L[j] || L[j] == L[k]) {
						continue;
					}
					else if (L[i] + L[j] > L[k]) {
						ans++;
					}
				}
			}
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 3636
@K=($K=<>!~$"+$',map$K&($t=1<<$_)&&($K|$t-1)^$t,1..29);map{($A,$B)=split;$i=0;$x[$i]+=($A|$_)<=$_&&$B,$i++for@K}<>;printf sort{$b<=>$a}@x

Measured memory_bytes: 17920
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
//LLONG_MIN

int main(void){
	int N,M,x,y,z;
	vector<int> v[1010];
	vector<int> c[1010];
	scanf("%d%d",&N,&M);
	rep(i,M){
		scanf("%d%d%d",&x,&y,&z);
		v[x].push_back(y);
		c[x].push_back(z);
	}
	ll s1[1010],s2[1010],t;
	reg(i,1,N)s2[i]=-(1e14+10);
	s2[1]=0;
	reg(cnt,1,2*N){
		reg(i,1,N)s1[i]=s2[i];
		reg(i,1,N){
			rep(j,v[i].size()){
				if(s2[v[i][j]]<s1[i]+c[i][j])s2[v[i][j]]=s1[i]+c[i][j];
			}
		}
		if(cnt==N-1)t=s2[N];
	}
	if(s2[N]>t){
		printf("inf\n");
	}else{
		printf("%lld\n",s2[N]);	
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
  ll r;
  cin >> r;
  if(r < 1200) cout << "ABC" << endl;
  else if(r < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define vi vector <int>
#define vl vector <ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d",x)
#define plld(x) printf("%lld",x)
#define pds(x) printf("%d ",x)
#define pllds(x) printf("%lld ",x)
#define pdn(x) printf("%d\n",x)
#define plldn(x) printf("%lld\n",x)
#define INF 2e9
#define INFLL 4e18
using namespace std;
ll powmod(ll base,ll exponent,ll mod){ // with mod < 1e9
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
const int upperlimit = 1e6+1;
const int mod = 998244353;
int main() {
//	freopen(".in","r",stdin);freopen(".out","w",stdout);
	ll a;double b;
	cin >> a >> b;
	b*=100;ll gg=round(b);
	gg*=a;gg/=100;
	cout << gg;
	return 0;
}

Measured memory_bytes: 3744
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	n, m := getInt(), getInt()
	makeImage := func(n int) [][]rune {
		ret := make([][]rune, n)
		for i := range ret {
			ret[i] = make([]rune, n)
			rs := getRunes()
			for j, r := range rs {
				ret[i][j] = r
			}
		}
		return ret
	}
	as := makeImage(n)
	bs := makeImage(m)

	ans := "No"
	for ia := 0; ia <= n-m; ia++ {
		for ja := 0; ja <= n-m; ja++ {
			ok := true
			for ib := 0; ib < m; ib++ {
				for jb := 0; jb < m; jb++ {
					if as[ia+ib][ja+jb] != bs[ib][jb] {
						ok = false
					}
				}
			}

			if ok {
				ans = "Yes"
			}
		}
	}

	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func getRunes() []rune {
	return []rune(getString())
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> data(N);
  vector<int> cal(N);
  for(int i = 0;i < N;i++){
    cin >> data[i];
    cal[i] = data[i];
  }

  sort(cal.begin(),cal.end());

  for(int i = 0;i < N;i++){
    if(data[i] <= cal[N / 2 - 1])cout << cal[N / 2] << endl;
    else cout << cal[N / 2 - 1] << endl;
  }
}

Measured memory_bytes: 3712
n,m = gets.chomp.split(' ').map(&:to_i)
ans = Array.new(n){false}
m.times do
    s,c = gets.chomp.split(' ').map(&:to_i)
    if (ans[s-1] == false) || (ans[s-1] == c)
        ans[s-1] = c
    else
        puts -1
        exit
    end
end
if (ans.size == 1) && (ans[0] == 0||ans[0] == false)
    puts 0
elsif (ans[0] == 0)
    puts -1
else
    ans = ans.map{|a| 
                    if a == false
                        0
                    else
                        a
                    end
                }
    if ans[0] == 0
        ans[0] = 1
    end
    puts ans.join
end

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

bool sort_1(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }

int main() {
	int n, m; cin >> n >> m;
	vector<pair<int, int>> y(n);
	rep(i, n) cin >> y.at(i).first >> y.at(i).second;
	int ans = 0;
	sort(y.begin(), y.end(), sort_1);
	priority_queue<int> o;
	int j = 0;
	rep(i, m) {
		while (1) {
			if (j >= y.size()) {
				for(int k=i;k<m;k++) if (!(o.empty())) { ans+= o.top(); o.pop(); }
				cout << ans << endl; return 0;
			}
			if (!(y.at(j).first < i + 2)) break;
			else { o.push(y.at(j).second); j++; }
		}
		if (!(o.empty())) { ans+= o.top(); o.pop(); }
	}
	cout << ans << endl;
}

Measured memory_bytes: 1660
import math
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == i*500 + j*100 + k*50:
                ans+=1

print(ans)

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<math.h>

#define DIV 1000000007
using namespace std;
using ll = long long;

ll mypow(ll n, ll m) {
    ll res = 1;
    n %= DIV;
    while (m) {
        if (m % 2) {
            res *= n;
            res %= DIV;
        }
        m /= 2;
        n *= n;
        n %= DIV;
    }
    return res;
}


int main() {
    ll N;
    cin >> N;

    vector<ll> div(N + 1);
    for (int x = 2; x <= N; x++) {
        int temp = x;
        for (int i = 2; i<=sqrt(temp); i++) {       
            while (temp%i==0) {
                temp /= i;
                div[i]++;
            }
        }
        if (temp > 1) div[temp]++;
    }

    ll ans = 1;
    for (int i = 0; i <= N; i++) {
        ans *= (div[i] + (ll)1);
        ans %= DIV;
    }

    cout << ans << endl;
}    

Measured memory_bytes: 256
N = int(input())
p = list(map(int, input().split()))

p_sorted = sorted(p)
delta = [x - y for (x, y) in zip(p, p_sorted)]

if sum( x != 0 for x in delta) == 2 or sum( x != 0 for x in delta) == 0:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, m; cin >> n >> m;
    vector<vector<int>> pos(n, vector<int>(2));
    vector<vector<int>> cp(m, vector<int>(2));
    
    for(int i = 0; i < n; i++){
        cin >> pos.at(i).at(0) >> pos.at(i).at(1);
    }
    for(int i = 0; i < m; i++){
        cin >> cp.at(i).at(0) >> cp.at(i).at(1);
    }
    
    for(int i = 0; i < n; i++){
        int min_dist = abs(pos.at(i).at(0) - cp.at(0).at(0)) + abs(pos.at(i).at(1) - cp.at(0).at(1));
        int cp_num = 1;

        for(int j = 0; j < m; j++){
            int dist = abs(pos.at(i).at(0) - cp.at(j).at(0)) + abs(pos.at(i).at(1) - cp.at(j).at(1));
            if(dist < min_dist){
                min_dist = dist;
                cp_num = j + 1;
            }
        }
        cout << cp_num << endl;
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//const ll MOD = 1000000007;
const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    int n;
    cin >> n;
    vi a(n);
    vl num(n);
    rep (i, n) {
        cin >> a[i];
        a[i]--;
        num[a[i]]++;
    }

    vl num2(n);
    ll sum = 0;
    rep (i, n) {
        num2[i] = num[i] * (num[i] - 1) / 2;
        sum += num2[i];
    }

    rep (i, n) {
        ll ans = sum;
        ans -= num2[a[i]];
        ans += (num[a[i]] - 1) * (num[a[i]] - 2) / 2;
        cout << ans << '\n';        
    }
    
}

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

typedef long long LL;
typedef unsigned long long ULL;

const int PI = 3.141592653589793;
const int inf = 1000111222;
const int mod = 1000000007;
const int N = 200007;

int main(){

        ios_base::sync_with_stdio(0);
        cin.tie(0); cout.tie(0);

        LL n, d; cin >> n >> d;
        int cnt = 0;
        while (n--) {
            LL x, y; cin >> x >> y;
            x = x * x;
            y = y * y;
            LL temp = x + y;
            if (temp <= d * d) cnt++;
        }
        cout << cnt << endl;
        return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef long long int lli;
using namespace std;
// #define int long long int

signed main() {
    int A, B, C;
    cin >> A >> C >> B;
    if ((A < B && B < C) || (C < B && B < A)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>
#include <algorithm>

using namespace std;

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

    int coin_count=0;
    int rest =1000;

    rest -= money;
    int tmp =0;

    coin_count += rest /500;
    rest = rest % 500;

    coin_count += rest /100;
    rest = rest % 100;

    coin_count += rest /50;
    rest = rest % 50;

    coin_count += rest /10;
    rest = rest % 10;

    coin_count += rest /5;
    rest = rest % 5;

    coin_count += rest /1;
    cout << coin_count << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
def main():
    N = int(input())
    S = list(input())
    ans = 0
    for i in range(1, N):
        tmpleft = S[:i]
        tmpright = S[i:]
        mrg = set(tmpleft)&set(tmpright)
        ans = max(ans, len(mrg))
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int x;
    
    cin >> x;
    
    for(int i=1; i<=1000; i++){
        
        if(i*100<=x&&x<=i*105){
            
            cout << "1" << endl;
            return 0;
            
        }
        
    }
    
    cout << "0" << endl;

    return 0;
    
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
   int a,b,c,d;cin>>a>>b>>c>>d;
   if(a+b==c+d)cout<<"Balanced";
   if(a+b<c+d)cout<<"Right";
   if(a+b>c+d)cout<<"Left";
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
char s[1000005];int n;
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	if (s[1]==s[n]){
		if (n&1) printf("Second\n");
		else printf("First\n");
	}
	else {
		if (n&1) printf("First\n");
		else printf("Second\n");
	}
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
const int maxn=100010;
int cnt[maxn];
int main()
{
	int n,m;
	while(scanf("%d%d",&n,&m)!=EOF)
	{
		memset(cnt,0,sizeof(cnt));
		for(int i=0;i<m;i++)
		{
			int a,b;
			scanf("%d%d",&a,&b);
			cnt[a]++;
			cnt[b]++;
		}
		bool flag=1;
		for(int i=1;i<=n;i++)
		{
			if(cnt[i]&1)
			{
				flag=0;
				break;
			}
		}
		if(flag)
			printf("YES\n");
		else 
			printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vii;
typedef vector<ll> vll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}
bool isPrime(int x) {
  if (x < 2)
    return false;
  else if (x == 2)
    return true;
  else if (x % 2 == 0)
    return false;

  double sq = sqrt(x);
  for (int i = 3; i <= sq; i += 2) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}

int q;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> q;
    vii p;
    rep(i, 0, 100001) {
      if (isPrime(i) && isPrime((i+1) / 2)) {
        p.pb(i);
      }
    }
    rep(i, 0, q) {
      int l, r;
      cin >> l >> r;
      cout << distance(lower_bound(ALL(p), l), upper_bound(ALL(p), r)) << endl;
    }
    return 0;
}




Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,k;
  cin>>n>>k;
  int w[n];
  for(int i=0;i<n;i++) cin>>w[i];
  int sum=0;
  for(int i=0;i<n;i++) sum+=w[i];
  int l=0,r=sum;
  while(l+1<r){
    int m=(l+r)/2;
    int t=0,tmp=0;
    bool f=0;
    for(int i=0;i<n;i++){
      f|=w[i]>m;
      if(tmp+w[i]>m){
	tmp=w[i];
	t++;
      }else tmp+=w[i];
    }
    if(tmp) t++;
    if(!f&&t<=k) r=m;
    else l=m;
  }
  cout<<r<<endl;
  return 0;
}

Measured memory_bytes: 3852
#include<bits/stdc++.h>
#define pb push_back
#define debug(x) cerr << #x << " = " << x << "\n";
#define debug_v(x) cerr << #x << " ="; for(auto i : x){cerr << " [" << i << "]";} cerr << "\n";
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vii = vector<pii>;
const double PI = acos(-1);
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 1e18 + 100;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cout << fixed << setprecision(20);
	int n;
	cin >> n;
	vector<pair<pair<string, int>, int>> a(n);
	for (int i = 0; i < n; i++){
		cin >> a[i].first.first;
		int t;
		cin >> t;
		a[i].first.second = -t;
		a[i].second  = i;
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < n; i++){
		cout << a[i].second + 1 << "\n";
	}
	
	return 0;
}
 


Measured memory_bytes: 256
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    D, T, S = il()
    print('Yes' if D <= T * S else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 68528
function Main(input) {
  var input = input.split('\n');
  input.pop();
  var data = input[0].split(' ');
  data = data.map((n) => parseInt(n, 10));
  var t = data[1];
  input.shift();
  var arr = [];
  for(var i = 0, len = input.length; i <len; i++) {
    var num = input[i].split(' ');
    num = num.map((n) => parseInt(n, 10));
    if(num[1] <= t) {
      arr.push(num[0]);
    }
  }
  arr.sort(function(a, b) {
    if(a < b) return -1;
    if(a > b) return 1;
    return 0;
  });
  if(arr.length >= 1) {
    console.log(arr[0]);
  } else {
    console.log('TLE');
  }
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
  


Measured memory_bytes: 11468
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)

constexpr int DNE = -1;

struct Node {
    int parent;
    int left;
    int right;
    Node() : parent(DNE), left(DNE), right(DNE) {}
};

vector<Node> read_problem()
{
    int n;
    scanf("%d\n", &n);

    vector<Node> nodes(n);
    REP(i, n) {
        int id;
        int left;
        int right;
        scanf("%d %d %d\n", &id, &left, &right);

        nodes[id].left  = left;
        nodes[id].right = right;
        nodes[left].parent  = id;
        nodes[right].parent = id;
    }

    return nodes;
}

void preorder(const vector<Node>& nodes, int id)
{
    const Node& node = nodes[id];

    printf(" %d", id);
    if(node.left != DNE)
        preorder(nodes, node.left);
    if(node.right != DNE)
        preorder(nodes, node.right);
}

void inorder(const vector<Node>& nodes, int id)
{
    const Node& node = nodes[id];

    if(node.left != DNE)
        inorder(nodes, node.left);
    printf(" %d", id);
    if(node.right != DNE)
        inorder(nodes, node.right);
}

void postorder(const vector<Node>& nodes, int id)
{
    const Node& node = nodes[id];

    if(node.left != DNE)
        postorder(nodes, node.left);
    if(node.right != DNE)
        postorder(nodes, node.right);
    printf(" %d", id);
}

int main()
{
    vector<Node> nodes = read_problem();
    int root = distance(nodes.begin(),
                        find_if(nodes.begin(), nodes.end(),
                                [](const Node& node) { return node.parent == DNE; }));
    //printf("%d\n", root);

    puts("Preorder");
    preorder(nodes, root);
    puts("");

    puts("Inorder");
    inorder(nodes, root);
    puts("");

    puts("Postorder");
    postorder(nodes, root);
    puts("");

    return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using vi=vector<int>;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll cnt=0;
    string s="zabcdefghijklmnopqrstuvwxy";
    string ans;
    while(n>0){
        ans+=s[n%26];
        if(n%26==0){
            n=(n/26)-1;
        }else n/=26;
    }
    reverse(ans.begin(),ans.end());
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3576