akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

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

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

const ll L = 1e5+5;

vector <ll> adj[L];
ll dis[L][2];

void dfs(ll src, ll par, ll f)
{
    for(auto i: adj[src])
    {
        if(i != par)
        {
            dis[i][f] = dis[src][f] + 1;
            dfs(i, src, f);
        }
    }
}

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

    ll N, u, v;
    cin >> N >> u >> v;

    for(ll i=0; i<N-1; i++)
    {
        ll a, b;
        cin >> a >> b;

        adj[a].pb(b);
        adj[b].pb(a);
    }

    dis[u][0] = 0;
    dfs(u, -1, 0);

    dis[v][1] = 0;
    dfs(v, -1, 1);

    ll ans = 0;

    for(ll i=1; i<=N; i++)
    {
        if(dis[i][0] < dis[i][1])
        {
            ans = max(ans, dis[i][1]-1);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 12544
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<string>
#include<set>
//int mod(int a,int b,int d);

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

int main() {
  int k;
  cin >> k;
  int a;
  set<int> b;
  int n7 = 7;
  int c=1;
  int ss = 0;
  while(n7<k){
    n7 = n7*10+7;
    c++;
  }
  a = n7%k;
  //cout<<c<<" "<<n7<<" "<<a<<endl;
  while(true){
    if(a==0){
      cout<<c<<endl;
      break;
    }
    b.insert(a);
    if(ss==b.size()){
      cout<<"-1"<<endl;
      break;
    }
    ss = b.size();
    a = (a*10+7)%k;
    c++;
    //cout<<c<<" "<<a<<endl;
  }
    

}

Measured memory_bytes: 50388
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


int main() {
    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    if (a >= k) cout << k << endl;
    else if (a+b>=k) cout << a << endl;
    else if (a+b+c>=k) cout << 2*a+b-k << endl;
}


Measured memory_bytes: 3636
#include <cstdio>

int main(void){
	int h, w;
    while(true){
        scanf("%d %d", &h, &w);
        if (h == 0 && w == 0) break;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }

}



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

int main()
{
	int i, n, flag=1;
	cin >> n;
	int a[n+1];
	a[0]=0;
	for(i=1; i<=n; i+=1)
		cin >> a[i];
	for(i=n; i>1; i-=1)
	{
		if(a[i]>=a[i-1])
			continue;
		else if(a[i]==a[i-1]-1)
			a[i-1]-=1;
		else
		{
			flag=0;
			break;
		}
	}
	if(flag==0)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}

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

using namespace std;



void solver() {
	int N; cin >> N;
	string s;

	int wa = 0, re = 0, ac = 0, tle = 0; 

	while(N--) {
		cin >> s;
		if (s == "WA")
			++wa;
		else if (s == "RE")
			++re;
		else if (s == "AC")
			++ac;
		else ++tle;
	}

	cout << "AC x " << ac << '\n';
	cout << "WA x " << wa << '\n';
	cout << "TLE x " << tle << '\n';
	cout << "RE x " << re << '\n';

}

int main() {

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

	int t;
	//cin >> t;
	t = 1;

	while(t--)
		solver();

	return 0;
}


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

using namespace std;

int f[300000 + 1] = {};

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

    f[0] = 0;
    for (int i = 1; i <= n; ++i) {
        f[i] = f[i - 1];
        if (s[i - 1] == 'E') f[i]++;
    }

    int ans = 300000 + 1;
    for (int m = 1; m <= n; ++m) {
        ans = min(ans, f[n] - f[m] + m - 1 - f[m - 1]);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1796
#include <iostream>
#include <stack>

using namespace std;

int main()
{
    int num;
    stack<int> rail;

    while (cin >> num) {
        if (num > 0) {
            rail.push(num);
        }
        else {
            cout << rail.top() << "\n";
            rail.pop();
        }
    }

    return 0;
}

Measured memory_bytes: 1200
import sys
A=[]
for a in range(3):
    l=[int(i) for i in input().split()]
    A.extend(l)
f=[0]*9
for i in range(int(input())):
    b=int(input())
    if b in A:
        f[A.index(b)]=1
#print(f)   
p=[[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]
for i in p:
    if all(f[x]==1 for x in i):
        print("Yes")
        sys.exit()
print("No")    



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define itn int

using namespace std;
typedef long long ll;


int main() {
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  if(a[0]==a[1]&&a[0]==a[2]){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 10000

int leftkey(int i) {
  return 2*i;
}
int rightkey(int i) {
  return 2*i+1;
}
int parentkey(int i) {
  return i/2;
}


int main() {
  int h;
  int A[MAX+1], i, n;
  scanf("%d", &h);
  for(i=1;i<=h;i++) {
    scanf("%d", &A[i]);
  }

  for(i=1;i<=h;i++) {
    printf("node %d: key = %d, ", i, A[i]);
    if(parentkey(i) > 0) {
      printf("parent key = %d, ", A[parentkey(i)]);
    }
    if (leftkey(i) <= h) {
      printf("left key = %d, ", A[leftkey(i)]);
    }
    if (rightkey(i) <= h) {
      printf("right key = %d, ", A[rightkey(i)]);
    }
    printf("\n");
  }

}

Measured memory_bytes: 1816
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

#include "bits/stdc++.h"
using namespace std;

int main() {
	int N;
	int cnt[100001] = {};
	cin >> N;
	vector<int> a(N);

	REP(i, N) {
		cin >> a[i];
		if (a[i] >= 1) {
			cnt[a[i] - 1]++;
		}
		cnt[a[i]]++;
		if (a[i] <= 99999) {
			cnt[a[i] + 1]++;
		}
	}

	int max_cnt = 0;
	REP(i, 100001) {
		max_cnt = max(max_cnt, cnt[i]);
	}

	cout << max_cnt << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int A,B,M;
    cin >> A >> B >> M;
    vector<int> a(A),b(B),c(M),x(M),y(M);
    int minA = 100010;
    int minB = 100010;
    rep(i,A){
        cin >> a[i];
        if(a[i]<minA) minA = a[i];
    } 
    rep(i,B){
        cin >> b[i];
        if(b[i]<minB) minB = b[i];
    }
    ll ans = minA + minB;
    rep(i,M){
      cin >> x[i] >> y[i] >> c[i];
      if(ans > a[x[i]-1]+b[y[i]-1]-c[i]){
          ans = a[x[i]-1]+b[y[i]-1]-c[i];
      }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2176
n,m=map(int,input().split())

x=[True]*n
cnt=[0]*n
y=0
z=0

for i in range(m):
    p,s=input().split()
    if s=="AC":
        x[int(p)-1]=False
    elif x[int(p)-1]:
        cnt[int(p)-1]+=1


for i in range(n):
    if x[i]==False:
        z+=cnt[i]
        y+=1

print(y,z)

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

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

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  ll X,K,D; cin >> X >> K >> D;
  X = abs(X);

  // 0に近づく
  ll num = X / D;

  ll ans;

  if(K <= num){
    ans = X - D * K;
  } else {
    K -= num;
    X -= D * num;
    if(K%2==0){
      ans = X;
    } else {
      ans = abs(X - D);
    }
  }
  cout << ans << endl;

}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	int ans1=0;
	int ans2=0;
	cin >>n;
	int bef;
	map<int,int>dis;
	//for(int i=0;i<10;i++){
	//	dis[i]=0;
	//}
	rep(i,n){
		cin>>bef;
		if(bef >=3200){
			dis[8]++;
		}else{
		dis[bef/400]++;
	}
	}
	ans1=dis.size();
	ans2=ans1;
	if(dis[8]!=0){
		ans1--;
		if(ans1==0){
			ans1=1;
		}
		ans2+=dis[8]-1;
	}
	cout<<ans1<<" "<<ans2<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
int a,b;
int main()
{
	cin>>a>>b;
	for(int i=b-a+1;i<=b+a-1;i++){
		cout<<i<<' ';
	}
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define dl double
#define mp make_pair
#define pb push_back
#define F first
#define S second
using namespace std;

//***********************************************************************

// hash struct for unordered_map
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

int MAXNUM = 5e3+5;
vector <int>vis(MAXNUM);
vector<int> pr;
void sieve() {
	pr.push_back(2);
	for(ll i=3;i<MAXNUM;i+=2) if(!vis[i]) {
		pr.push_back(i);
		for(ll j=i*i;j<MAXNUM;j+=2*i) vis[j]=true;
	}
}
//************************************************************************

void solve()
{
	ll n,m,k;
	cin >> n >> m >> k;
	set<pair<ll,ll>> st;
	vector<ll> cnt1(n+1);
	vector<ll> cnt2(m+1);
	for(int i=0;i<k;i++)
	{
		ll x,y;
		cin >> x >> y;
		st.insert(mp(x,y));
		cnt1[x]++;
		cnt2[y]++;
	}
	vector<ll> v1,v2;
	ll mx1=0;
	for(int i=1;i<=n;i++)
	mx1=max(mx1,cnt1[i]);

	ll mx2=0;
	for(int i=1;i<=m;i++)
	mx2=max(mx2,cnt2[i]);

	for(int i=1;i<=n;i++)
	{
		if(cnt1[i]==mx1)
		{
			v1.pb(i);
		}
	}
	for(int i=1;i<=m;i++)
	{
		if(cnt2[i]==mx2)
		{
			v2.pb(i);
		}
	}

	//cout << "c0" << endl;
	for(int i=0;i<v1.size();i++)
	{
		for(int j=0;j<v2.size();j++)
		{
			ll x=v1[i];
			ll y=v2[j];
			if(st.find(mp(x,y))==st.end())
			{
				cout << mx1+mx2 << endl;
				return;
			}
		}
		
		//cout << "c0" << endl;
	}

	cout << mx1+mx2-1 << endl;
}

int main()
{ 
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	ll t;
	//cin >> t;
	t=1;
	while(t--)
	{
		solve();
	}

	return 0;
}

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

class Class1
{
    static void Main(string[] args)
    {
        var D = int.Parse(Console.ReadLine());
        var c = Console.ReadLine().Split(' ').Select(_ => int.Parse(_)).ToArray();
        int[][] ds = new int[D][];

        for (int i = 0; i < D; i++)
        {
            ds[i] = Console.ReadLine().Split(' ').Select(_ => int.Parse(_)).ToArray();
        }

        int[] ts = new int[D];
        for (int i = 0; i < D; i++)
        {
            ts[i] = int.Parse(Console.ReadLine());
        }

        int[] c_history = new int[26];
        int sum = 0;
        int minus = 0;
        for (int i = 0; i < D; i++)
        {
            int v = ds[i][ts[i] - 1];
            for (int j = 0; j < 26; j++)
            {
                if (j == ts[i] - 1)
                {
                    if (i > 0)
                    {
//                        Console.WriteLine($"plus_prev: {i}, {c[j]}");
//                        Console.WriteLine($"c_history[j]: {c_history[j]}");
                        minus -= c[j] * (i - c_history[j]);
                        continue;
                    }

//                    Console.WriteLine($"skip: {i}, {c[j]}");
                    continue;
                }

                minus += c[j];
            }

//            Console.WriteLine("minus: " + minus);
//            Console.WriteLine("v: " + v);

            sum += v - minus;
            c_history[ts[i] - 1] = i + 1;


            Console.WriteLine(sum);
        }
    }
}

Measured memory_bytes: 28512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define inf 1e15
#define key 1e9

int main(){
    int h,w,n;
    cin >> h >> w >> n;
    int dekai = max(h,w);
    cout << ceil((double)n/dekai) << "\n";
}

Measured memory_bytes: 256
n=int(input())
ans=1
mod=10**9+7
A=[0,0]
AB=[]
for i in range(n):
  a=int(input())
  AB.append((a,0))
for i in range(n):
  b=int(input())
  AB.append((b,1))
AB.sort(key=lambda x:x[0])
for i in range(2*n):
  a,b=AB[i]
  if b==0:
    if A[1]>0:
      ans=(ans*A[1])%mod
      A[1]-=1
    else:
      A[0]+=1
  else:
    if A[0]>0:
      ans=(ans*A[0])%mod
      A[0]-=1
    else:
      A[1]+=1
print(ans)

Measured memory_bytes: 78556
#include<bits/stdc++.h>
#define ll long long

using namespace std;
int a[200001];
int main()
{
   int n;
   cin>>n;

   for (int i=1;i<n;i++){
      int b;
      cin>>b;
      a[b]++;
   }
   for (int i=1;i<=n;i++){

    cout<<a[i];
    if(i!=n) cout<<endl;
   }
}


Measured memory_bytes: 4348
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[100009];
int k=0,n,b[10],flag1=1;
void solve()
{
    ll ans=0;
    for(int i=0; i<=9; i++)
        ans=ans*10+b[i];
    if(ans)
        a[k++]=ans;
    if(ans>=3234566667)
        flag1=0;
}
void dfs(int x,bool flag,int val)
{
    if(x==10)
    {
        solve();
        return ;
    }
    if(flag)
    {
        for(int i=0; i<=9; i++)
        {
            b[x]=i,dfs(x+1,flag&&(!i),i);
            if(!flag1)
                return ;
        }
    }
    else
    {
        if(!val)
        {
            b[x]=0;
            dfs(x+1,0,0);
            if(!flag1)
                return ;
            b[x]=1;
            dfs(x+1,0,1);
            if(!flag1)
                return ;
        }
        else if(val==9)
        {
            b[x]=8;
            dfs(x+1,0,8);
            if(!flag1)
                return ;
            b[x]=9;
            dfs(x+1,0,9);
            if(!flag1)
                return ;
        }
        else
        {
            for(int i=val-1; i<=val+1; i++)
            {
                b[x]=i,dfs(x+1,0,i);
                if(!flag1)
                    return ;
            }
        }
    }
}
int main()
{
    cin>>n;
    dfs(0,true,0);
    cout<<a[n-1];
    return 0;
}


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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

x = I()
y = x % 11
ans = (x // 11) * 2
if y == 0:
    pass
elif y <= 6:
    ans += 1
else:
    ans += 2
print(ans) 

Measured memory_bytes: 38256
n=int(input())
w=list(map(int,input().split()))

ans=1000000

l=sum(w[:1])
r=sum(w[1:])

for i in range(n-1):
  l+=w[i+1]
  r-=w[i+1]
  ans=min(ans,abs(l-r))
print(ans)



Measured memory_bytes: 3060
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;


class Program
{
    public static long Read()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] Reads()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }


    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);

        var x = new long[5];
        long answer = 0;
        long min = 10;
        for (int i = 0; i < 5; i++)
        {
            x[i] = Read();
            if (x[i] % 10 != 0)
            {
                answer += (x[i] / 10 + 1) * 10;
                if (min > x[i] % 10)
                    min = x[i]%10;
            }
            else
                answer += x[i];
        }
       

        answer = answer - (10 - min);
        Console.WriteLine(answer);







        Console.Out.Flush();
    }
}

Measured memory_bytes: 13140
#include <stdio.h>

int main(void){
     
	int n,i;
	char str[100];
	for( ;fgets(str,sizeof(str),stdin)!=NULL; ){
		sscanf(str,"%d",&n); i=1;
		while(n>1){
		if(n%2==1)
			printf("%d ",i);
			i*=2; n/=2;
		}
		printf("%d\n",i);
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
    int n;cin>>n;
    vector<ll> L(100);
    L[0]=2;L[1]=1;
    repi(i,2,100)L[i]=L[i-1]+L[i-2];
    cout<<L[n]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <array>
#include <deque>
#include <bitset>
typedef long long ll;
using namespace std;
#define trace(x) cerr << #x << " is " << x << endl;
 
int main() {
    int r;
    cin >> r;
    cout << r * r <<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    private struct Pair { public int x, y; public Pair(int xx, int yy) { x = xx; y = yy; } }
    private static int[] dx = { 1, 0, -1, 0 };
    private static int[] dy = { 0, -1, 0, 1 };
    public static void Main()
    {
        int A = NextInt();
        int B = NextInt();
        int T = NextInt();
        int[] c = new int[30];
        c[0] = 0;
        for (int i = 1; i < 30; i++)
            if (i % A == 0) { c[i] += B; }

        for (int i = 0; i < 29; i++)
            c[i + 1] += c[i];
        Console.WriteLine(c[T]);

    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 13268
import math
import bisect
x = int(input())
def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]
N = primes(1000004)
z = bisect.bisect_left(N, x)
print(N[z])

Measured memory_bytes: 43300
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

//ll dx[4] = {1, 0, -1, 0};
//ll dy[4] = {0, 1, 0, -1};

vector<ll> g[11451];

int main() {
	IOS();
	ll n;
	cin >> n;
	vector<P> e(n - 1), unko(n);
	vector<ll> c(n), ans(n);
	for (int i = 0; i < n - 1; i++) {
		ll a, b;
		cin >> a >> b;
		a--;
		b--;
		g[a].push_back(b);
		g[b].push_back(a);
		e[i] = (P(a, b));
	}
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	sort(c.begin(), c.end(), greater<ll>());
	ll s;
	for (int i = 0; i < n; i++) {
		if (g[i].size() == 1) s = i;
	}
	queue<ll> que;
	vector<ll> used(n, false);
	que.push(s);
	ll now = 0;
	while (!que.empty()) {
		ll i = que.front();
		que.pop();
		ans[i]  = c[now++];
		used[i] = true;
		for (int j = 0; j < g[i].size(); j++) {
			if (!used[g[i][j]]) que.push(g[i][j]);
		}
	}

	ll sum = 0;
	for (int i = 0; i < n - 1; i++) {
		ll a, b;
		tie(a, b) = e[i];
		sum += min(ans[a], ans[b]);
	}
	dump(sum);
	for (int i = 0; i < n; i++) {
		if (i) cout << " ";
		cout << ans[i];
	}
	cout << endl;
	return 0;
}

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

using namespace std;

int cumj[1010][1010];
int cumo[1010][1010];
int cumi[1010][1010];

int main(void) {
  int m, n, k;
  cin >> m >> n >> k;

  vector<string> s(m);
  for (int i = 0; i < m; i++) {
    cin >> s[i];
    for (int j = 0; j < n; j++) {
      cumj[i + 1][j + 1] = s[i][j] == 'J';
      cumo[i + 1][j + 1] = s[i][j] == 'O';
      cumi[i + 1][j + 1] = s[i][j] == 'I';
    }
  }

  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      cumj[i][j] += cumj[i - 1][j] + cumj[i][j - 1] - cumj[i - 1][j - 1];
      cumo[i][j] += cumo[i - 1][j] + cumo[i][j - 1] - cumo[i - 1][j - 1];
      cumi[i][j] += cumi[i - 1][j] + cumi[i][j - 1] - cumi[i - 1][j - 1];
    }
  }

  for (int i = 0; i < k; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << cumj[c][d] - cumj[a - 1][d] - cumj[c][b - 1] + cumj[a - 1][b - 1] << " ";
    cout << cumo[c][d] - cumo[a - 1][d] - cumo[c][b - 1] + cumo[a - 1][b - 1] << " ";
    cout << cumi[c][d] - cumi[a - 1][d] - cumi[c][b - 1] + cumi[a - 1][b - 1] << endl;
  }

  return 0;
}


Measured memory_bytes: 15576
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef array <ll, 2> pii;
typedef vector <int> vi;

typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int u[1000];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	int x, n;
	cin >> x >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		u[a] = 1;
	}
	int mn = 0;
	for (int i = 0; i < 1000; i++) {
		if (!u[i]) {
			if (abs(i - x) < abs(mn - x)) {
				mn = i;
			}
		}
	}
	cout << mn;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    string s;
    cin>>s;
    int sum=0,maxv=0;
    for(int i=0;i<=s.size()-1;i++)
    {
    	if(s[i]=='R')
    		sum++;
		else
		{
			if(sum>maxv)
    			maxv=sum;
    		sum=0;
		}
	}
	if(sum>maxv)
   		maxv=sum;
	cout<<maxv<<endl;
	return 0;
}


Measured memory_bytes: 3628
candidates_len = int(input())
candidates = [int(i) for i in input().split()]

required = {}
M = int(input())
problems = [int(i) for i in input().split()]

for i in problems:
    try:
        required[i] += 1
    except:
        required[i] = 1

for i in candidates:
    try:
        if required[i] - 1 <= 0:
            del required[i]
        else:
            required[i] -= 1
    except:
        pass
if len(list(required)) == 0:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 41816
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main(){

    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];

    pair<int, int> max1, max2; // value, index
    if(A[0] < A[1]){
        max1 = make_pair(A[1], 1);
        max2 = make_pair(A[0], 0);
    }else{
        max1 = make_pair(A[0], 0);
        max2 = make_pair(A[1], 1);
    }

    for(int i = 2; i < N; i++){
        if(max1.first <= A[i]){
            max2 = max1;
            max1 = make_pair(A[i], i);
        }else if(max2.first <= A[i]){
            max2 = make_pair(A[i], i);
        }
    }


    for(int i = 0; i < N; i++){
        if(i == max1.second) cout << max2.first << endl;
        else cout << max1.first << endl;
    }

    return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;

/*int Array(vector<int> x[],int n){
    for(int i=0;i<n;i++){
        int sam;
        cin >>sam;
        x.push_back(sam);
    }
    return *x;
}*/

int main(){
    int n;
    cin >> n;
    vector<int> a;
    
    for(int i=0;i<n;i++){
        int sam;
        cin >> sam;
        a.push_back(sam);
    }

    string ans="YES";

    sort(a.begin(),a.end());
    for(int i=0;i<n;i++){
        if(a[i]==a[i+1]){
            ans="NO";
            break;
        }
    }
    cout << ans << endl;
}

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

const int N = 3e5 + 9, mod = 1e9 + 7;

template <const int32_t MOD>
struct modint {
    int32_t value;
    modint() = default;
    modint(int32_t value_) : value(value_) {}
    inline modint<MOD> operator + (modint<MOD> other) const { int32_t c = this->value + other.value; return modint<MOD>(c >= MOD ? c - MOD : c); }
    inline modint<MOD> operator - (modint<MOD> other) const { int32_t c = this->value - other.value; return modint<MOD>(c <    0 ? c + MOD : c); }
    inline modint<MOD> operator * (modint<MOD> other) const { int32_t c = (int64_t)this->value * other.value % MOD; return modint<MOD>(c < 0 ? c + MOD : c); }
    inline modint<MOD> & operator += (modint<MOD> other) { this->value += other.value; if (this->value >= MOD) this->value -= MOD; return *this; }
    inline modint<MOD> & operator -= (modint<MOD> other) { this->value -= other.value; if (this->value <    0) this->value += MOD; return *this; }
    inline modint<MOD> & operator *= (modint<MOD> other) { this->value = (int64_t)this->value * other.value % MOD; if (this->value < 0) this->value += MOD; return *this; }
    inline modint<MOD> operator - () const { return modint<MOD>(this->value ? MOD - this->value : 0); }
    modint<MOD> pow(uint64_t k) const { modint<MOD> x = *this, y = 1; for (; k; k >>= 1) { if (k & 1) y *= x; x *= x; } return y; }
    modint<MOD> inv() const { return pow(MOD - 2); }  // MOD must be a prime
    inline modint<MOD> operator /  (modint<MOD> other) const { return *this *  other.inv(); }
    inline modint<MOD> operator /= (modint<MOD> other)       { return *this *= other.inv(); }
    inline bool operator == (modint<MOD> other) const { return value == other.value; }
    inline bool operator != (modint<MOD> other) const { return value != other.value; }
    inline bool operator < (modint<MOD> other) const { return value < other.value; }
    inline bool operator > (modint<MOD> other) const { return value > other.value; }
};
template <int32_t MOD> modint<MOD> operator * (int64_t value, modint<MOD> n) { return modint<MOD>(value) * n; }
template <int32_t MOD> modint<MOD> operator * (int32_t value, modint<MOD> n) { return modint<MOD>(value % MOD) * n; }
template <int32_t MOD> istream & operator >> (istream & in, modint<MOD> &n) { return in >> n.value; }
template <int32_t MOD> ostream & operator << (ostream & out, modint<MOD> n) { return out << n.value; }

using mint = modint<mod>;

mint ans[N];
int32_t main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k; cin >> n >> k;
	vector<int> d;
	for (int i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			d.push_back(i);
			if (i != n / i) d.push_back(n / i);
		}
	}
	sort(d.begin(), d.end());
	for (int i = 0; i < d.size(); i++) {
		ans[i] = mint(k).pow((d[i] + 1) >> 1);
		for (int j = 0; j < i; j++) if (d[i] % d[j] == 0) ans[i] -= ans[j];
	}
	mint res = 0;
	for (int i = 0; i < d.size(); i++) {
		if (d[i] & 1) res += ans[i] * d[i];
		else res += ans[i] * d[i] / 2;
	}
	cout << res << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int x[100100];
int y[100100];
vector<long long int> vi;
int p[100100];
int ranks[100100];
int root(int x)
{
    if(p[x] == x)
        return x;
    else
        return p[x] = root(p[x]);
}
int main()
{
    int n,i,j,k,curr,temp,m;
    scanf("%d %d",&n,&m);
    long long int rose = 1LL*n*(n-1)/2, gain;
    for(i=1;i<=n;i++)
    {
        p[i] = i;
        ranks[i] = 1;
    }
    for(i=1;i<=m;i++)
    {
        scanf("%d %d",&x[i],&y[i]);
    }
    vi.push_back(rose);
    for(i=m;i>0;i--)
    {
        int rootx,rooty;
        rootx = root(x[i]);
        rooty = root(y[i]);
        if(rootx == rooty)
        {
            vi.push_back(rose);
            continue;
        }
        gain = ranks[rootx] * ranks[rooty];
        if(ranks[rootx] > ranks[rooty])
        {
            p[rooty] = rootx;
            ranks[rootx]+=ranks[rooty];
        }
        else
        {
            p[rootx] = rooty;
            ranks[rooty]+=ranks[rootx];
        }
        rose -= gain;
        vi.push_back(rose);
    }
    reverse(vi.begin(),vi.end());
    for(i=1;i<vi.size();i++)
    {
        printf("%lld\n",vi[i]);
    }
    return 0;
}


Measured memory_bytes: 3828
def main():
    n = int(input())
    a = list(map(int, input().split()))
    cnt_odd = 0
    cnt_4 = 0
    cnt_2 = 0

    for x in a:
        if x % 2 == 1:
            cnt_odd += 1
        elif x % 4 == 0:
            cnt_4 += 1
        elif x % 2 == 0:
            cnt_2 += 1

    if cnt_odd == 0:
        print('Yes')
    elif cnt_2 > 0:
        if cnt_4 >= cnt_odd:
            print('Yes')
        else:
            print('No')
    else:
        if cnt_4 >= cnt_odd - 1:
            print('Yes')
        else:
            print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 85284
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n, k = MI()
    A = LI()
    for i in range(k, n):
        if A[i-k] < A[i]:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 92212
import sys
import numpy as np

# N 人数
n = int(input())

# 名前
num = np.zeros(5)
for ii in range(n):
    nm = input()
    if nm[0] == "M":
        num[0] += 1
    if nm[0] == "A":
        num[1] += 1
    if nm[0] == "R":
        num[2] += 1
    if nm[0] == "C":
        num[3] += 1
    if nm[0] == "H":
        num[4] += 1
comb = 0
for i in range(5):
    for j in range(i+1, 5):
        for k in range(j+1, 5):
            cb = num[i] * num[j] * num[k]
            comb += cb
print(int(comb))

Measured memory_bytes: 17952
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#define pb push_back()
int m,n,sum,x;
int main()
{
	scanf("%d%d",&m,&n);
	for (int i=1;i<=n;i++) scanf("%d",&x),sum+=x;
	printf("%d\n",m>=sum?m-sum:-1);
return 0;
}

Measured memory_bytes: 3816
#include<stdio.h>
int main()
{
    int A,B,C;
    scanf("%d%d%d",&A,&B,&C);

    if(A==B)
        printf("%d",C);
    if(A==C)
        printf("%d",B);
    if(B==C)
        printf("%d",A);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>
#include <array>
using namespace std;
typedef long long ll;

int main(int argc,char const* argv[])
{
  ll n;
  ll i,j,ans=0;
  cin >> n;
  for(i=1;i<=sqrt(n);i++)
    {
      j=n/i;
      if(i*j==n)
	{
	  string s=to_string(j);
	  ans=s.size();
	}
    }
  cout << ans << endl;
  return 0;
}


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

int main() {
  string S; cin >> S;
  int N = S.size(), mod = 1000000007;

  long long dp[100010][4] = {};
  for(int i = N; i >= 0; --i) {
    for(int j = 3; j >= 0; --j) {
      if(i == N) {
        if(j == 3) dp[i][j] = 1LL;
        else dp[i][j] = 0LL;
      } else {
        dp[i][j] = dp[i+1][j] * (S[i] == '?' ? 3LL : 1LL);
        if(j < 3 && (S[i] == '?' || S[i] == "ABC"[j])) {
          dp[i][j] += dp[i+1][j+1];
        }
        dp[i][j] %= mod;
      }
    }
  }
  cout << dp[0][0] << endl;

  return 0;
}

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

using namespace std;

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

  vector<int> A(m);
  int res = 0;

  for(int i = 0; i < m; i++) cin >> A[i], res += A[i];

  int ans = n - res;

  if(ans >= 0){
    cout << ans << endl;
  }
  else{
    cout << -1 << endl;
  }
 
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(void){
   vector<int> x = {1, 1, 1, 2, 1, 2,
   1, 5, 2, 2, 1, 5, 1, 2, 1,
   14, 1, 5, 1, 5, 2, 2, 1, 15,
   2, 2, 5, 4, 1, 4, 1, 51};
   
   int K;
   cin >> K;
   
   cout << x.at(K-1) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <numeric>

using namespace std;

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

    vector<int> a(n);
    vector<double> b(n);//bはaの逆数
    for(int i=0; i<n; i++){
        cin >> a[i];
        b[i] = 1.0/a[i];
    }
    double ans = accumulate(b.begin(), b.end(),0.0000000);
    ans = 1.0000000/ ans;

    cout << ans << endl;
    return 0;
}

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

int n,m;
vi a;

int main(){
	cin>>m>>n;
	a=vi(n);
	for(auto &i:a) cin>>i;
	int mx=m-a[n-1]+a[0];
	for(int i=0;i<n-1;i++) mx=max(mx,a[i+1]-a[i]);
	cout<<m-mx<<endl;
}

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

bool is_prime(int N) {
  for (int i = 2; i * i <= N; i++) {
    if (N % i == 0) {
      return false;
    }
  }
  return N != 1;
}

int main() {

    int n;
    cin >> n;

    int answer = 0;

    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (is_prime(a)) {
            answer++;
        }
    }

    cout << answer << endl;

    return 0;

}


Measured memory_bytes: 3096
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return read.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtype!real;

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

void solve(){
	int n = rint;
	long[] hs = rlong(n);
	
	int best = 0;
	int now = 0;
	long oldh = hs[0] - 1;
	foreach(h; hs){
		if(oldh >= h){
			now += 1;
			best = max(best, now);
		}
		else{
			now = 0;
		}
		oldh = h;
	}
	
	best.writeln;
}


Measured memory_bytes: 4412
from collections import Counter
N=int(input())

S=[0]*N
for i in range(N):
    S[i]=input()

A=Counter(S)

print("AC x {}".format(A["AC"]))
print("WA x {}".format(A["WA"]))
print("TLE x {}".format(A["TLE"]))
print("RE x {}".format(A["RE"]))

Measured memory_bytes: 16472
#include "bits/stdc++.h"
using namespace std;



int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for(auto i = 0; i < n; ++ i){
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	cout << accumulate(a.begin(), a.begin() + k, 0);
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

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


int main() {
    string S;
    cin >> S;

    rep(i, S.length()){
        cout << 'x';
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

    	Scanner sc = new Scanner(System.in).useDelimiter(System.getProperty("line.separator"));

    	int	side_01,
    	    side_02,
    	    diagonal,
    	    Rectangle = 0,
    	    Lozenge   = 0;

    	String[] s;
    	while(sc.hasNext()){
    		s = sc.next().split(",");
    		side_01  = Integer.parseInt(s[0]);
    		side_02  = Integer.parseInt(s[1]);
    		diagonal = Integer.parseInt(s[2]);

    		if(Math.pow(side_01, 2) + Math.pow(side_02, 2) == Math.pow(diagonal, 2)){
    			Rectangle++;
    		} else if (side_01 == side_02){
    			Lozenge++;
    		}
    	}
		System.out.println(Rectangle);
		System.out.println(Lozenge);
	}
}

Measured memory_bytes: 17144
D,G = map(int,input().split())
X = [list(map(int,input().split())) for _ in range(D)]
ans = 0

for i in range(1 << D):
	point = 0
	count = 0
	for j in range(D):
		if (i>>j)&1:
			point += 100*(j+1)*X[j][0]+X[j][1]
			count += X[j][0]
	if 	G > point:
		for k in range(D)[::-1]:
			if (i>>k)&1==0:
				if (G-point) <= 100*(k+1)*(X[k][0]-1):
					count += -((-(G-point)) // (100*(k+1)))
					break
				else:
					count = 10**5
					break
	if ans == 0 or count < ans:
		ans = count

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string>
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main(void){
    string str,ans="";
    cin >> str;
    string temp;
    for(int i=0; i<19; i++){
        temp=str[i];
        if(temp==",")ans=ans+' ';
        else ans=ans+temp;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
int a, b, c, k;
  cin >> a >> b >> c >> k;
  int d = max({a, b, c});
  int e =d;
 for(int i= 0;i<k;++i){
   d *=2;
 }
  
  cout <<d+a+b+c-e  << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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

void YN(bool ans){
    if(ans)cout<<"Yes"<<endl;
    else cout <<"No"<<endl;
    return;
}

int main(){
    ll N;
    cin>>N;
    ll a[4] = {0,0,0,0};
    rep(i,0,N){
        string S;
        cin>>S;
        if(S == "AC")a[0]++;
        else if(S == "WA")a[1]++;
        else if(S == "TLE")a[2]++;
        else if(S == "RE")a[3]++;
    }
    cout<<"AC x "<<a[0]<<endl;
    cout<<"WA x "<<a[1]<<endl;
    cout<<"TLE x "<<a[2]<<endl;
    cout<<"RE x "<<a[3]<<endl;
    return 0;
}

Measured memory_bytes: 3628
n,k = map(int,input().split())
a = list(map(int,input().split()))
now = 0
scale = 2**32
while scale:
  cnt = 0
  tmp = now + scale
  for x in a:
    cnt += (x-1) // tmp
  if cnt > k:
    now = tmp
  #print(tmp,cnt)
  scale //= 2
print(now+1)

Measured memory_bytes: 93936
#include <stdio.h>
#include <string.h>
int main(void){
char text[50];
 char t[64]; 
int len;
int flag=0;
int i;
scanf("%s",text);
len =strlen(text);
strcpy(t,text);
for(i=0;i<len;i++){
int j=0;
while(text[j]!='\0' && t[i]!='\0'){
    if(text[j]==t[i]&&(i!=j)){
      flag=1;
      break;
}
j++;
}
}
if(flag==1)
    printf("no");
  else
    printf("yes");

return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll n,l;
    cin >> n >> l;
    ll ab;
    ll h=100000;
    for(int i=1;i<=n;i++){
        ab=abs(l+i-1);
        h=min(ab,h);
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
        if(abs(l+i-1)!=h)ans+=l+i-1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a,b = map(int,input().split())
ps = list(map(int,input().split()))
minn = []
middle = []
max = []
for p in ps:
    if p<=a:
        minn.append(p)
    elif a<p and p<=b:
        middle.append(p)
    else:
        max.append(p)
print(min(len(minn),len(middle),len(max)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

int main(){
  int n,m,q;
  cin>>n>>m>>q;
  vector<string> vec(n);
  rep(i,n) cin>>vec[i];

  vector<vector<int>> acc(n+1, vector<int>(m+1,0));
  rep(i,n){
    rep(j,m){
      acc[i+1][j+1] = acc[i+1][j];
      if(vec[i][j]=='1') acc[i+1][j+1] +=1;
    }
  }
  rep(j,m) rep(i,n) acc[i+1][j+1] += acc[i][j+1];

  vector<vector<int>> x(n+1,vector<int>(m+1,0)), y(n+1,vector<int>(m+1,0));
  rep(i,n){
    repl(j,1,m){
      x[i+1][j+1] = x[i+1][j];
      if(vec[i][j]=='1' && vec[i][j-1]=='1') x[i+1][j+1]++;
    }
  }
  rep(j,m) rep(i,n) x[i+1][j+1] += x[i][j+1];

  rep(j,m){
    repl(i,1,n){
      y[i+1][j+1] = y[i][j+1];
      if(vec[i][j]=='1' && vec[i-1][j]=='1') y[i+1][j+1]++;
    }
  }
  rep(i,n) rep(j,m) y[i+1][j+1] += y[i+1][j];

  rep(_,q){
    int a,b,c,d;
    cin>>a>>b>>c>>d;

    auto f = [](vector<vector<int>> &arr, int p, int q, int r, int s){
      return arr[r][s] - arr[r][q] - arr[p][s] + arr[p][q];
    };

    int ans = f(acc,a-1,b-1,c,d) - f(x,a-1,b,c,d) - f(y,a,b-1,c,d);

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 54272
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)

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

vector<int> squ;

const int MAX = (1<<15)+1;
int ans[MAX];

void calc(int depth, int sum, int s)
{
	if (!(sum < MAX)) return;

	ans[sum]++;
	if (!(depth < 4)) return;

	REP(j, s, squ.size())
		calc(depth+1, sum+squ[j], j);
}

int main(void)
{
	int n;

	for (int i = 1; i*i < MAX; i++)
		squ.push_back(i*i);

	memset(ans, 0, sizeof(ans));
	calc(0, 0, 0);

	while (cin >> n, n) {
		cout << ans[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 1348