akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<"------\n"<<#a<<" = "<<a<<endl<<"------"<<endl
#define debug2(a,b) cout<<"--------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<endl<<"--------------"<<endl
#define debug3(a,b,c) cout<<"----------------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<" ; "<<#c<<" = "<<c<<endl<<"----------------------"<<endl
#define sz(a) (ll)(a.size())
#define debug4(a) cout<<"chu "<<a<<endl
#define endl "\n"

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll n;
  cin>>n;
  vector<ll> a(n+1),b(n+1),c(n+1);
  forn(i,1,n+1){
    cin>>a[i]>>b[i]>>c[i];
  }
  vector<vector<ll>> dp(n+1,vector<ll>(3,0));
  forn(i,1,n+1){
    dp[i][0] = a[i] + max(dp[i-1][1],dp[i-1][2]);

    dp[i][1] = b[i] + max(dp[i-1][0],dp[i-1][2]);

    dp[i][2] = c[i] + max(dp[i-1][0],dp[i-1][1]);
  }
  ll ans = max({dp[n][0],dp[n][1],dp[n][2]});
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 11080
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N, M;
  cin >> N >> M;
  if(N >= M){
    cout << 0 << endl;
  } else {
    vector<int> X(M);
  	for (int i = 0; i < M; i++){
    	cin >> X.at(i);
  	}
  	sort(X.begin(), X.end());
  	vector<int> dif(M-1);
  	for (int i = 0; i < M-1; i++){
    	dif.at(i) = X.at(i+1) - X.at(i);
  	}
  	sort(dif.begin(), dif.end());
    int ans = 0;
    for (int i = 0; i < M - N; i++){
      ans += dif.at(i);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    ll n, x, m;
    cin >> n >> x >> m;
    pair<ll, ll> dp[m + 1][41];
    fill(dp[0], dp[m + 1], pair<ll, ll>(0, 0));
    for (ll i = 0; i <= m; i++) {
        dp[i][0].first = (i * i) % m;
        dp[i][0].second = (i * i) % m;
    }
    for (ll i = 0; i < 40; i++) {
        for (ll j = 0; j <= m; j++) {
            dp[j][i + 1].first = dp[dp[j][i].first][i].first;
            dp[j][i + 1].second =
                dp[j][i].second + dp[dp[j][i].first][i].second;
        }
    }
    ll cur = x, ans = x;
    for (ll i = 39; i >= 0; i--) {
        if (n >= (1LL << i)) {
            ans += dp[cur][i].second;
            cur = dp[cur][i].first;
            n -= (1LL << i);
        }
    }
    cout << ans - cur << endl;
    return 0;
}

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

int main(void) {
  string s;
  cin >> s;
  int n = atoi(s.c_str());
  int ans = 0;
  rep(i, s.size()) { ans += s[i] - '0'; }
  cout << (n % ans == 0 ? "Yes" : "No") << '\n';
  return 0;
}

Measured memory_bytes: 3612
def findNum(array, target):
    n = len(array)
    l = -1
    r = n  # bigger than target
    while l + 1 < r:
        m = (l + r) // 2
        if array[m] == target:
            return True
        elif array[m] < target:
            l = m
        else:
            r = m

    if r < n and array[r] == target:
        return True
    else:
        return False


n = int(input())
array = list(map(int, input().split()))

q = int(input())
m = list(map(int, input().split()))

count = 0
for i in range(q):
    if findNum(array, m[i]):
        count += 1

print(count)



Measured memory_bytes: 16712
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int D;
int c[26];
int s[365][26];
int selected[365];
int scores[26];

int calculateScore(int t){
    int retVal = 0;
    int last = -1;
    for(int i=0;i<D;i++){
        if(selected[i] == t){
            last = i;
            retVal += s[i][t];
        }else{
            retVal -= c[t] * (i-last);
        }
    }
    return retVal;
}


int main() {
    clock_t start = clock();
    cin >> D;
    for(int i=0;i<26;i++){
        cin >> c[i];
    }
    for(int i=0;i<D;i++)for(int j=0;j<26;j++){
        cin >> s[i][j];
    }

    int last[26];
    memset(last,-1,sizeof(last));
    for(int i=0;i<D;i++){
        int maxNum =-(1e7);
        int maxArg = 0;
        for(int j=0;j<26;j++){
            if(s[i][j] -c[j]*(i-last[j]) > maxNum){
                maxNum = s[i][j] -c[j]*(i-last[j]);
                maxArg = j;
            }
        }
        // cerr <<"i=" <<i <<"maxArg=" << maxArg << "\n";
        selected[i] = maxArg;
        last[maxArg] = i;
    }
    for(int i=0;i<26;i++){
        scores[i] = calculateScore(i);
    }
    int itr = 1;
    while(clock()-start<(CLOCKS_PER_SEC*2- 100000)){
        // cerr <<"itr =" << itr <<"\n";
        itr++;
        int t = rand()%D;
        int oldq = selected[t];
        int maxdiff=0;
        int maxArg = oldq;
        int oldQScoreDiff = 0;
        for(int q=0;q<26;q++){
            if(q==oldq){
                continue;
            }
            int oldscore =scores[q];
            selected[t] = q;
            if(oldQScoreDiff==0){
                oldQScoreDiff =  calculateScore(oldq)- scores[oldq];   
            }
            scores[q] = calculateScore(q);
            if(maxdiff < scores[q]-oldscore + oldQScoreDiff){
                maxdiff = scores[q]-oldscore + oldQScoreDiff;
                maxArg = q;
            }
            scores[q] = oldscore;
            selected[t] = oldq;
        }
        // cerr<<"maxArg = " << maxArg <<"maxDiff=" << maxdiff << "\n";
        selected[t] = maxArg;
        scores[oldq] += oldQScoreDiff;
        scores[maxArg] += (maxdiff-oldQScoreDiff);
        // cerr <<"oldScore=" << oldscore <<"newScore=" << newScore << "\n";
       
    }
    for(int i=0;i<D;i++){
        cout << selected[i]+1 <<"\n";
    }
    return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

public class Main{
	public static void main(String[] args)
	{
		Scanner scan =new Scanner(System.in);
		int N=scan.nextInt();
		int K=scan.nextInt();
		int X=scan.nextInt();
		int Y=scan.nextInt();
		int total;

		if(N<=K){
			total=N*X;
		}else{
			total=K*X+(N-K)*Y;
		}
		System.out.println(total);
	}
}

Measured memory_bytes: 21844
n = int(input())
a = [0] + list(map(int, input().split())) + [0]
dist = 0
for i in range(len(a) - 1):
    dist += abs(a[i] - a[i + 1])

for i in range(len(a) - 2):
    d1, d2 = a[i+1] - a[i], a[i+2] - a[i]
    if abs(d1) + abs(d2) == abs(d1 - d2):
        print(dist - 2 * abs(d1))
    elif 0 < d2 < d1:
        print(dist - 2 * abs(d1 - d2))
    elif d1 < d2 < 0:
        print(dist - 2 * abs(d1 - d2))
    else:
        print(dist)


Measured memory_bytes: 14048
input_line = int(input())
out_selection = input().split()
out_bubble = out_selection[:]

# bubblesort                                                                                  
for i in range(input_line):
    for j in range(input_line-1, i, -1):
        if out_bubble[j][1] < out_bubble[j-1][1]:
            out_bubble[j], out_bubble[j-1] = out_bubble[j-1],out_bubble[j]
print(*out_bubble)
print("Stable")

# selectionsort                                                                               
for i in range(input_line):
    minj = i
    for j in range(i, input_line):
        if out_selection[j][1] < out_selection[minj][1]:
            minj = j
    out_selection[i], out_selection[minj] = out_selection[minj], out_selection[i]

print(*out_selection)
print("Stable" if out_bubble == out_selection else "Not stable")


Measured memory_bytes: 5604
#include<iostream>
#include<cstdio>
#include<map>
#include<sstream>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;
const int maxn = 1e5+7;
int a[maxn],b[maxn];
const int mod = 1e9+7;
long long kpow(long long x,long long n)
{
    long long res=1;
    while(n>0)
    {
        if(n & 1)//如果n的末位是1，即判断是否是奇数
            res=(res*x)%mod;
        x=(x*x)%mod;
        n >>= 1;
    }
    return res%mod;
}
int main()
{
    int n;
    cin >> n;
    bool p = true;
    long long ans;
    for(int i = 0; i < n; i ++)
    {
        scanf("%d",&a[i]);
        b[a[i]]++;
    }
    if(n%2==0)
    for(int i = 1; i < n; i +=2)
    {
        if(b[i]!=2)
        {
            p = false;
            break;
        }
    }
    else
    {
        if(b[0]!= 1)
        {
            p = false;
        }
        for(int i = 2; i < n; i +=2)
        {
            if(b[i]!=2)
            {
                p = false;
                break;
            }
        }
    }
    if(p)
    {
        ans = kpow(2,n/2);
        cout << ans << endl;
    }
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

int main()
{
    string S;
    cin >> S;
    for(int i = 0, i_len = S.size() - 8; i < i_len; ++i) cout << S[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define eps 1e-10
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

multiset <ll> s1;
multiset <ll,greater<ll> >s2;
ll ans,sum1,sum2,nmid;

int main()
{
	int n=read();
	
	for(int i=1;i<=n;i++)
	{
		int opt=read();
		if(i==1) {ll x=read(),y=read(); ans+=y; nmid=x; continue;}
		if(opt==1)
		{
			ll x=read(),y=read(); ans+=y;
			if(x<nmid) s2.insert(x),sum2+=x; else s1.insert(x),sum1+=x;
			if(s2.size()>s1.size())
			{
				s1.insert(nmid); sum1+=nmid; nmid=*s2.begin();
				sum2-=*s2.begin(); s2.erase(s2.begin());
			}
			else if(s1.size()>s2.size()+1)
			{
				s2.insert(nmid); sum2+=nmid; nmid=*s1.begin();
				sum1-=*s1.begin(); s1.erase(s1.begin());
			}
			//cout<<s1.size()<<" "<<s2.size()<<" "<<nmid<<endl;
		}
		else
		{
			ll t1=sum1-nmid*s1.size(),t2=nmid*s2.size()-sum2;
			printf("%lld %lld\n",nmid,t1+t2+ans);
		}
	}
	return 0;
}

Measured memory_bytes: 9600
S=input()

ans="Yes"

odd=["R","U","D"]
even=["L","U","D"]

for i in range(len(S)):
    if i%2==0 and S[i] in odd:
        continue
    elif i%2!=0 and S[i] in even:
        continue
    else:
        ans="No"
        break

print(ans)

Measured memory_bytes: 3060
using System;
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());

        if(N == 1)
        {
            Console.WriteLine("Hello World");
        }
        else if(N == 2)
        {
            int A = int.Parse(Console.ReadLine());
            int B = int.Parse(Console.ReadLine());
            Console.WriteLine(A + B);
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <map>
#include <deque>
#define MAX_N 100
#define MAX_T 200
#define INF 1000000000000
typedef long long ll;
using namespace std;

int main(){
  ll k;
  ll a[100000];
  ll min,max;
  bool flg=true;
  cin>>k;
  for(ll i=0;i<k;i++){
    cin>>a[i];
  }
  min=2;max=2;
  for(ll i=k-1;i>=0;i--){
    ll res;
    min=min+a[i]-(min-1)%a[i]-1;
    if(min>max){
      flg=false;
      break;
    }
    max=max-(max%a[i])+a[i]-1;
  }
  if(!flg)cout<<-1<<endl;
  else{
    cout<<min<<" "<<max<<endl;
  }

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
 
#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))
 
using namespace std;

int pos[100010];
vector<int> L, R, D;

vector<int> groupNum;
vector<int> groupMem[100010];

void merge(int a, int b, int diff) {
	int gna = groupNum[a];
	int gnb = groupNum[b];

	if (groupMem[gna] < groupMem[gnb]) {
		swap(a, b);
		swap(gna, gnb);
		diff *= -1;
	}

	int atarget = pos[b] - diff;
	int trueDiff = atarget - pos[a];

	for (int num : groupMem[gna]) {
		groupNum[num] = gnb;
		pos[num] += trueDiff;
	}

	groupMem[gnb].insert(groupMem[gnb].end(), all(groupMem[gna]));
	groupMem[gna].clear();
}

signed main() {
	int N, M;
	cin >> N >> M;

	groupNum.resize(N);
	rep(i, N) {
		groupNum[i] = i;
		groupMem[i].push_back(i);
	}

	L.resize(M);
	R.resize(M);
	D.resize(M);

	rep(i, M) {
		cin >> L[i] >> R[i] >> D[i];
		L[i]--; R[i]--;

		if (groupNum[L[i]] == groupNum[R[i]]) {
			if (pos[R[i]] - pos[L[i]] != D[i]) {
				cout << "No" << endl;
				return 0;
			}
		} else {
			merge(L[i], R[i], D[i]);
		}
		//rep(i, N) {
		//	cerr << i << ":";
		//	for (int num : groupMem[i]) cerr << num << " ";
		//	cerr << endl;
		//}
		//rep(i, N) {
		//	cerr << "pos[" << i << "] = " << pos[i] << endl;
		//}
		//rep(i, N) {
		//	cerr << "groupNum[" << i << "] = " << groupNum[i] << endl;
		//}
		//cerr << "---" << endl;
	}

	// validation
	rep(i, M) {
		if (groupNum[L[i]] != groupNum[R[i]]) continue;
		if (pos[R[i]] - pos[L[i]] != D[i]) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 18804
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
// using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //////////////////////////////////////
  ll a, b;
  cin >> a >> b;
  if (a % 2 == 0) {
    if ((b - a + 1) % 2 == 0) {
      if ((b - a + 1) / 2 % 2 == 0) {
        cout << 0 << endl;
      } else {
        cout << 1 << endl;
      }
    } else {
      if ((b - a) / 2 % 2 == 0) {
        cout << (0 ^ b) << endl;
      } else {
        cout << (1 ^ b) << endl;
      }
    }
  } else {
    a++;
    if ((b - a + 1) % 2 == 0) {
      if ((b - a + 1) / 2 % 2 == 0) {
        ll ans = 0 ^ (a - 1);
        cout << ans << endl;
      } else {
        ll ans = 1 ^ (a - 1);
        cout << ans << endl;
      }
    } else {
      if ((b - a) / 2 % 2 == 0) {
        cout << (0 ^ b ^ (a - 1)) << endl;
      } else {
        cout << (1 ^ b ^ (a - 1)) << endl;
      }
    }
  }
  return 0;
}


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

ok = True
threshold = hs[0] - 1
for i in range(1, n):
    if hs[i] < threshold:
        ok = False
        break
    threshold = max(threshold, hs[i] - 1)
if ok:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 63856
#include <iostream>

void printRectangle(int H, int W) {
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			std::cout << "#";
		}
		std::cout << "\n";
	}
	std::cout << "\n";
}

int main()
{
	int H, W;
	std::cin >> H >> W;

	while (H != 0 || W != 0) {
		printRectangle(H, W);
		std::cin >> H >> W;
	}

    return 0;
}





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

using namespace std;

int n, b[10000005],a[10000005], cnt[10000005];

int main () {
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		cnt[a[i]]++;
		b[i] = a[i];
	}
	sort(b, b + n);
	reverse(b, b + n);
	for(int i = 0; i < n; i++) {
		if(a[i] != b[0]) {
			cout << b[0] << "\n";
		}
		else if(a[i] == b[0] && cnt[a[i]] > 1) {
			cout << a[i] << "\n";
		}
		else {
			cout << b[1] << "\n";
		}
	}
	return 0;
}

Measured memory_bytes: 6400
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.map f

[<EntryPoint>]
let main _ =
    let N = read int
    let [|S;T|] = reads string |> Array.map Seq.toArray
    for s, t in Array.zip S T do
        printf "%c%c" s t
    printfn ""
    0

Measured memory_bytes: 14172
#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 all(x) (x).begin(), (x).end()
#define F first
#define S second
typedef vector<long long> V;
typedef vector<V> VV;
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<<28;
void solve(int a){cout<<( a?"Yes":"No")<<endl;}
int main(){
	int n,q,h,s,d;
	ll ans=0;
	cin >>q>>h>>s>>d>>n;
	q*=4;
	h*=2;
	int down=min(q,min(h,s));
	if(down*2 >d){
		ans=(long long)d*(n/2);
		n%=2;
	}
	ans+=(long long)n*down;
		
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] d = new int[K];
        for(int i = 0;i < K;i++){
            d[i] = sc.nextInt();
        }
        boolean can = true;
        while(can){
            can = false;
            for(int i = 0;i < K;i++){
                if(String.valueOf(N).contains(String.valueOf(d[i]))){
                    can = true;
                    N++;
                    break;
                }
            }
        }
        System.out.println(N);
    }
}


Measured memory_bytes: 38464
N, K = map(int, input().split())
A = [int(x) for x in input().split()]

K = min(K, 41)

# imos
for _ in range(K):
    B = [0 for _ in range(N)]
    for i in range(N):
        l = max(0, i-A[i])
        r = min(N-1, i+A[i])
        B[l] += 1
        if r+1 < N:
            B[r+1] -= 1
    for i in range(1, N):
        B[i] += B[i-1]
    A = B

for i in range(N):
    A[i] = str(A[i])
print(' '.join(A))

Measured memory_bytes: 173456
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a, b;
    cin >> a >> b ;
    //*/

    /*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    //*/
    
    /*
    if( a < 3200 ){
        cout << "red" << endl;
    } else {
        cout << str << endl;
    }
    //*/
    
    cout << max(max(a + b, a - b), a * b) << endl;

    return 0; 
}


Measured memory_bytes: 3596
import sys
 
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
 
 
def main():
    def divide_choco(bit):
        divrow_num = bin(bit).count("1") + 1  # 割った回数+1
        choco_current = [[0] * w for _ in range(divrow_num)]
 
        row_divided_cur = 0
 
        for col, piece in enumerate(choco[0]):
            choco_current[0][col] = piece
 
        for row in range(h - 1):
            if bit >> row & 1:
                row_divided_cur += 1
            for col, piece in enumerate(choco[row + 1]):
                choco_current[row_divided_cur][col] += piece
 
        return choco_current, divrow_num
 
    h, w, k = list(map(int, readline().split()))
    choco = []
 
    for i in range(h):
        choco_in = input()
        choco_add = [int(c) for c in choco_in]
        choco.append(choco_add)
 
    ans = INF
 
    for bit in range(1 << (h - 1)):
        choco_current, divrow_num = divide_choco(bit)
        choco_cursum = [0] * divrow_num
        is_exceed = False  # 超えてる場合True
 
        ans_temp = bin(bit).count("1")
        if divrow_num > 1:
            for col in range(w):
                choco_currow = [choco_current[dr][col] for dr in range(divrow_num)]
                for drow, pieces in enumerate(choco_currow):
                    if pieces > k:
                        ans_temp += INF
                    elif choco_cursum[drow] + pieces > k:
                        is_exceed = True
 
                if is_exceed:
                    choco_cursum = [cc for cc in choco_currow]
                    ans_temp += 1
                    is_exceed = False
                else:
                    choco_cursum = [cc + cs for cc, cs in zip(choco_currow, choco_cursum)]
        else:
            choco_cursum = 0
            for pieces in choco_current[0]:
                if pieces > k:
                    ans_temp += INF
                elif choco_cursum + pieces > k:
                    choco_cursum = pieces
                    ans_temp += 1
                else:
                    choco_cursum = choco_cursum + pieces
 
        ans = min(ans, ans_temp)
 
    print(ans)
 
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 55132
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main() {
	ll i,j,k,l,m,n,t;
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	t=1;
	while(t--)
	{
		cin>>n;
		ll a[n][3];
		for(i=0;i<n;i++)
		{
      cin >> a[i][0] >> a[i][1] >> a[i][2];
    }

    vector<ll> ans(3, 0);
    for (i = 0; i < n; i++){
      vector<ll> newAns(3, 0);
      for (j = 0; j < 3; j++){
        for (k = 0; k < 3; k++){
          if(j!=k){
            newAns[k] = max(newAns[k], ans[j] + a[i][k]);
          }
        }
      }
      ans = newAns;
    }
    cout << max(ans[0], max(ans[1], ans[2])) << endl;
  }
  return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
#define M 100000
int main(){
  int n, i;
  int A[M+1];
  scanf("%d", &n);
  for ( i = 1; i <= n; i++ ){
    scanf("%d", &A[i]);
  }

  for ( i = 1; i <= n; i++ ) {
    printf("node %d: key = %d, ", i, A[i]);
    if ( i / 2 >= 1 )printf("parent key = %d, ", A[i/2]);
    if ( i*2 <= n ) printf("left key = %d, ", A[i*2]);
    if ( i*2+1 <= n ) printf("right key = %d, ", A[i*2+1]);
    printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 2056
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <istream>

using namespace std;

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

int main(){
	int R,G,B,N;

	cin >> R >> G >> B >> N;

	ll ans = 0;

	for(int i=0;i<=N;i++){
		for(int j=0;j<=N;j++){
			if(N-i*R-j*G < 0) continue;
			if ((N-i*R-j*G) % B == 0){
				ans++;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

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

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


int main()
{
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> c(H);
    REP(i, H) cin >> c[i];

    int ans = 0;
    for(int i = 0; i < (1<<H); ++i){
        for(int j = 0; j < (1<<W); ++j){
            int num = 0;
            REP(k, H){
                REP(l, W){
                    if(c[k][l] == '#' and !(i&(1<<k)) and (j&(1<<l))) ++num;
                }
            }
            if(num == K) ++ans;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3628
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
typedef pair<int,int> pii;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define inf 1000000000

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}


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

    int ans = 1000000000008;

    for(int i = 1;i*i<=n;i++){
        if (n%i==0)
        {
            int temp1 = i;
            int temp2 = n/i;

            int t = temp1 + temp2 -2;

            ans = min(ans, t);
        }
    }

    cout << ans << endl;

} 

signed main() 
{   
    IOS;
    int t = 1;
    //cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int n, i, ret=1, max=0;
    scanf("%d", &n);
    for (i=1; i<=n; i++) {
        int tmp = i;
        int cnt = 0;;
        while (tmp % 2 == 0) {
            cnt++;
            tmp = tmp / 2;
        }
        if (cnt > max) {
            ret = i;
            max = cnt;
        }
    }
    printf("%d\n", ret);
    return 0;
}


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

using namespace std;

const int MAXN = 1e5 + 10;
const int MOD = 1e9 + 7;

vector<int> adj[MAXN];
map<int, vector<int>> f;

long long dp[MAXN][2];

int d[MAXN];

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

    if (n == 1)
        return cout << 2, 0;

    for (int i = 0; i < n-1; i++) {
        int x, y;
        cin >> x >> y;

        x--, y--;

        adj[x].push_back(y);
        adj[y].push_back(x);
    }

    memset(d , 63 , sizeof d);
	queue<int> q;

	d[0] = 0;
	q.push(0);

	while(!q.empty()) {
		int v = q.front();
		q.pop();

		for(auto u : adj[v])
			if(d[u] > d[v] + 1) {
				d[u] = d[v] + 1;
				q.push(u);
			}
	}

	int lastF = -1;
	for (int i = 0; i < n; i++) {
        f[d[i]].push_back(i);
        if (d[i] > lastF)
            lastF = d[i];
	}

    memset(dp, -1, sizeof dp);

    for (int i = 1; i < n; i++)
        if (adj[i].size() == 1)
            dp[i][0] = 1, dp[i][1] = 1;

    for (int i = lastF; i >= 0; i--) {
        for (auto u : f[i]) {
            if (dp[u][0] == -1) {
                bool isDone = false;
                for (auto v : adj[u]) {
                    if (dp[v][0] != -1) {
                        if (!isDone)
                            dp[u][1] = 1, isDone = true;

                        dp[u][1] *= dp[v][0];
                        dp[u][1] = dp[u][1] % MOD;
                    }
                }

                isDone = false;
                for (auto v : adj[u]) {
                    if (dp[v][1] != -1) {
                        if (!isDone)
                            dp[u][0] = 1, isDone = true;
                        dp[u][0] *= ((dp[v][0] + dp[v][1]) % MOD);
                        dp[u][0] = dp[u][0] % MOD;
                    }
                }

            }
        }
    }

    cout << (dp[0][0] + dp[0][1]) % MOD;
    return 0;
}

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

using namespace std;
const int MAXN = 200005;
const int MOD = 1000000007;

ll arr[MAXN];
int n; 

ll fun(){
	ll sum = arr[1];
	ll ans = 0;
	ll t = (arr[1] > 0);
	for(int i=2;i<=n;i++){
		sum += arr[i];
		if(t == 1){
			if(sum >= 0) ans += sum + 1 , sum = -1;
		}
		else{
			if(sum <= 0) ans += -sum + 1 , sum = 1;
		}
		t = 1 - t;
	}
	return ans;

}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	for(int i=1;i<=n;i++) cin >> arr[i];
	if(arr[1] == 0){
		arr[1] = 1;
		ll ans = fun() + 1;
		arr[1] = -1;
		ans = min(ans , fun() + 1);
		cout << ans << '\n';
	}
	else{
		ll ans = fun();
		ll temp;
		if(arr[1] > 0)  temp = arr[1] + 1 , arr[1] = -1;
		else temp = -arr[1] + 1 , arr[1] = 1;
		ans = min(ans,  fun() + temp);
		cout << ans << '\n';
	}
	return 0;
}


Measured memory_bytes: 1024
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	a, b := nextInt(), nextInt()
	ans := -1
	for i := 1; i <= 10000; i++ {
		f := float64(i)
		if int(math.Floor(f*0.08)) == a && int(math.Floor(f*0.1)) == b {
			ans = i
			break
		}
	}
	puts(ans)
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


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

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
#define DRT() int t; si(t); while(t--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//# define M_PI           3.14159265358979323846264338327950288
// DSU
void IO(){
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
}

int main(){
	IO();
	LL n;
	cin>>n;
	VL arr(5);
	rep(i,0,5){
		cin>>arr[i];
	}
	sort(ALL(arr));
	LL ans = (n+ arr[0] - 1)/arr[0];
	ans += 4;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3628
def getPrimelist(num):
    if num == 1:
        return([])
    primelist = []
    limit = int(num ** 0.5)
    templist = [i for i in range(2, num + 1)]
    while True:
        p = templist[0]
        if limit < p:
            return primelist + templist
        primelist.append(p)
        templist = [i for i in templist if i % p != 0]

def getfactorsdict(num, power = {}):
    primelist = getPrimelist(int(num ** 0.5))
    for prime in primelist:
        while num % prime == 0:
            if prime in power.keys():
                power[prime] += 1
            else:
                power[prime] = 1
            num //= prime
    if num > 1:
        if num in power.keys():
            power[num] += 1
        else:
            power[num] = 1
    return(power)

N = int(input())
fd = {}
for i in range(1, N + 1):
    fd = getfactorsdict(i, fd)

c75 = 0; c25 = 0; c15 = 0; c5 = 0; c3 = 0
for v in fd.values():
    if v >= 74:
        c75 += 1
    if v >= 24:
        c25 += 1
    if v >= 14:
        c15 += 1
    if v >= 4:
        c5 += 1
    if v >= 2:
        c3 += 1

ans = c75 #75
ans += c25 * (c3 - 1) #25 * 3
ans += c15 * (c5 - 1) #15 * 5
ans += (c5 * (c5 - 1)) // 2 * (c3 - 2) #5 * 5 * 3
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1e9 + 7;
const int N = 2e5 + 10;
int n;
struct Edge {
	int to, nxt;
}e[N << 1];
int tot, head[N];
ll siz[N],son[N], sum = 1;
ll ans[N];
ll qpow(ll x, ll k) {
	ll res = 1;
	while (k) {
		if (k & 1) res = res * x % mod;
		k >>= 1;
		x = x * x % mod;
	}
	return res;
}
void add(int x, int y) {
	e[++tot] = Edge{ y,head[x] };
	head[x] = tot;
}
void predfs(int x, int fa) {
	siz[x] = son[x] = 1;
	for (int i = head[x]; i; i = e[i].nxt) {
		int to = e[i].to;
		if (to == fa)
			continue;
		predfs(to, x);
		son[x] += son[to];
		siz[x] = siz[x] * siz[to] % mod;
	}
	siz[x] = siz[x] * son[x] % mod;
}
void dfs(int x,int fa,ll pre) {
	ll t = pre;
	for (int i = head[x]; i; i = e[i].nxt) {
		int to = e[i].to;
		if (to == fa)
			continue;
		t = t * siz[to] % mod;
	}
	ans[x] = sum * qpow(t, mod - 2) % mod;
	for (int i = head[x]; i; i = e[i].nxt) {
		int to = e[i].to;
		if (to == fa)
			continue;
		pre = pre * siz[to] % mod;
	}
	for (int i = head[x]; i; i = e[i].nxt) {
		int to = e[i].to;
		if (to == fa)
			continue;
		dfs(to, x, pre * qpow(siz[to], mod - 2) % mod * (n - son[to]) % mod);
	}
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i < n; i++)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		add(x, y), add(y, x);
		sum = sum * i % mod;
	}
	predfs(1, 0);
	dfs(1, 0, 1);
	for (int i = 1; i <= n; i++)
		printf("%lld\n", ans[i]);
}

Measured memory_bytes: 10880
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<limits.h>
#include<string>
#include<math.h>
#include<map>
#include<unordered_map>

using namespace std;

int main() 
{ 
	int h,w;
	cin>>h>>w;
	char grid[h][w];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>grid[i][j];
		}
	}
	long long int dp[h][w];
	int flag=0;
	for(int i=0;i<h;i++){
		if(flag==0){
			if(grid[i][0]=='#'){
				flag=1;
				dp[i][0]=0;
			}else
				dp[i][0]=1;
		}else{
			dp[i][0]=0;
		}
	}
	flag=0;
	for(int i=0;i<w;i++){
		if(flag==0){
			if(grid[0][i]=='#'){
				flag=1;
				dp[0][i]=0;
			}else
				dp[0][i]=1;
		}else{
			dp[0][i]=0;
		}
	}
	for(int i=1;i<h;i++){
		for(int j=1;j<w;j++){
			if(grid[i][j]=='.'){
				dp[i][j] = (dp[i-1][j]+dp[i][j-1])%1000000007;	
			}else{
				dp[i][j]=0;
			}
			
		}
	}
	cout<<dp[h-1][w-1];
} 

Measured memory_bytes: 9088
while(<>){
	chomp;
	$n = $_ if($. == 1);
	$s = $_ if($. == 2);
}

$r = "No";
if($n % 2 == 0){
	$r = "Yes" if(substr($s, 0, $n / 2) eq substr($s, $n / 2, $n));
}
print "$r\n";


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define var long long int
#define make_pair mp
#define second  s
#define first f
using namespace std;
var n,a[1000005];
var dp[1000005];

var min_frog(var i){
	if(i == (n-1))	return 0;
	if(i >= n)	return INT_MAX;
	
	if(dp[i] != -1){
		return dp[i];
	}
	
	var left = abs(a[i]-a[i+1]) + min_frog(i+1);
	var right = INT_MAX;
	
	if(i+2<n){
		right = abs(a[i]-a[i+2]) + min_frog(i+2);
	} 
	
	return dp[i] = min(left,right);
}

signed main() {
	memset(dp,-1,sizeof(dp));
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	cout << min_frog(0) << endl;
	return 0;
}

Measured memory_bytes: 16900
def back_oturigation(fee, coin_values, coin_nums):
    """
    1. ????????????????????????????????£??????????????????
    2. 1????????????????????????????????????????????????????????????
       ???????????§?????????????????????-> ?°????????????????????¶???????????????????
    3. 2????????????????????°?????????????????????????????????????????????
    """
    # 1.
    oturi = coin_values[0] * coin_nums[0] \
            + coin_values[1] * coin_nums[1] \
            + coin_values[2] * coin_nums[2] \
            + coin_values[3] * coin_nums[3] \
            - fee
    use_coins = [0] * len(coin_values)
    no_use_coins = [0] * len(coin_values)

    # 2.
    for i in range(len(coin_values) - 1, -1, -1):
        no_use_coins[i] = int(oturi / coin_values[i])
        oturi = oturi - (coin_values[i] * no_use_coins[i])

    # 3.
    for i in range(0, len(use_coins), 1):
        use_coins[i] = coin_nums[i] - no_use_coins[i]
        if use_coins[i] > 0:
            print(str(coin_values[i]) + ' ' + str(use_coins[i]))

if __name__ == "__main__":
    first = True
    while (True):
        total_fee = int(input(''))
        if total_fee == 0:
            break
        if first:
            first = False
        else:
            print('')
        coins = input('')
        coins = coins.split(' ')  # 10, 50, 100, 500????????§????????????
        coins = [int(coin) for coin in coins]
        coin_values = [10, 50, 100, 500]
        back_oturigation(total_fee, coin_values, coins)

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

using namespace std;

class Problem{
private:
    int n;
    vector <vector <int>> g;
    vector <int> x;
    bool ispos= true;
    int dp[1005][5005];

    // max sum from elements a not greater than sum
    int mxsum(int sum, vector <int> &a){
        if(a.empty()){
            return 0;
        }
        int siz=a.size();
        for(int i=0;i<a.size();i++){
            for(int j=0;j<=sum;j++){
                dp[i][j]=0;
            }
        }
        dp[0][0]=1;
        dp[0][a[0]]=1;
        for(int i=1;i<a.size();i++){
            for(int j=0;j<=sum;j++){
                dp[i][j]=dp[i][j]|dp[i-1][j];
                if(j>=a[i]){
                    dp[i][j] = dp[i][j]|dp[i-1][j-a[i]];
                }
            }
        }
        int ans;
        for(int i=sum;i>=0;i--){
            if(dp[a.size()-1][i]){
                ans = i;
                break;
            }
        }
        return ans;
    }

    pair <int,int> dfs(int u, int par){
        vector <pair <int,int>> ch;
        vector <int> a;
        int val=0,ans=0;
        for(int v:g[u]){
            if(v==par){
                continue;
            }
            ch.push_back(dfs(v,u));
            a.push_back(ch.back().second-ch.back().first);
            val+=ch.back().first;
            ans+=ch.back().second;
        }
        if(val>x[u]){
            ispos=false;
            return {};
        }
        int ret = ans-mxsum(x[u]-val,a);
        return {min(ret,x[u]),max(ret,x[u])};
    }
public:
    Problem(){
        cin >> n;
        g.resize(n);
        x.resize(n);
        for(int i=1,par;i<n;i++){
            cin >> par;
            par--;
            g[i].push_back(par);
            g[par].push_back(i);
        }
        for(int i=0;i<n;i++){
            cin >> x[i];
        }
    }

    void solve(){
        dfs(0,-1);
        if(ispos){
            cout << "POSSIBLE" << endl;
        }
        else{
            cout << "IMPOSSIBLE" << endl;
        }
        return;
    }

};

int main(){
    Problem* pb = new Problem;
    pb->solve();
    return 0;
}

Measured memory_bytes: 18944
/* ****mittal21**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define ld          long double
#define pb          push_back
#define endl        '\n'
#define pii         pair<long long int,long long int>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll )x.size()
#define hell        1000000007
#define jell        998244353
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define DEC(N)  cout << std::fixed; cout << setprecision(N);
using namespace std;
#define N  200005
vi a(N),seg(4*N);
ll hei[N],cost[N];
void build(ll cur,ll st,ll end)
{
  if(st==end)
  {
    seg[cur]=a[st];
    return;
  }
  ll mid=(st+end)>>1;
  build(2*cur,st,mid);
  build(2*cur+1,mid+1,end);
  seg[cur]=max(seg[2*cur],seg[2*cur+1]);  /*  1-change here  */
}
ll query(ll cur,ll st,ll end,ll l,ll r)
{
  if(l<=st&&r>=end)
  return seg[cur];
  if(r<st||l>end)
  return 0;                           /*  2-change here  */
  ll mid=(st+end)>>1;
  ll ans1=query(2*cur,st,mid,l,r);
  ll ans2=query(2*cur+1,mid+1,end,l,r);
  return (max(ans1,ans2));                 /*  3-change here  */
}
void update(ll cur,ll st,ll end,ll pos,ll upd)
{
  if(st==end)
  {
    a[pos]+=upd;          /*  4-change here  */
    seg[cur]+=upd;          /*  5-change here  */
    return;
  }
  ll mid=(st+end)>>1;
  if(st<=pos&&pos<=mid)
    update(2*cur,st,mid,pos,upd);
  else
    update(2*cur+1,mid+1,end,pos,upd);
  seg[cur]=max(seg[2*cur],seg[2*cur+1]);  /*  6-change here  */
}
void solve()
{
   ll n;
   cin>>n;
   for(int i=1;i<=n;i++)
    cin>>hei[i];
   for(int i=1;i<=n;i++)
   {
      cin>>cost[i];
   }
   build(1,1,n);
   for(int i=1;i<=n;i++)
   {
       ll op=query(1,1,n,1,hei[i]-1);
        ll oi=max(op+cost[i],a[hei[i]]);
       update(1,1,n,hei[i],oi);
   }
   cout<<query(1,1,n,1,n);
   return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll testcase=1;
    //cin>>testcase;
    while(testcase--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 14288
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { char x, y;
  cin >> x >> y;
  if(x==y){
    puts("=");
  }else if(x<y){
    puts("<");
  }else{
    puts(">");
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
	int a,b,d,r;
	double a1,b1,f;

	scanf("%d %d",&a,&b);

	a1 = a;
	b1 = b;
	d = a / b;
	r = a % b;
	f = a1 / b1;

	printf("%d %d %.8f\n",d,r,f);

	return 0;
}

Measured memory_bytes: 1068
#include <stdio.h>

char s[9][9];

void maketable( int x, int y )
{
        int i;

        if( x < 0 || x > 7 || y < 0 || y > 7 ) return;

        if ( s[y][x] == '1' ) {
                s[y][x] = '0';
                for ( i = 1 ; i < 4 ; i++ ) {
                        maketable( x+i, y );
                        maketable( x-i, y );
                        maketable( x, y+i );
                        maketable( x, y-i );
                }
        }
        return;
}

void printtable( )
{
        int i;
        for ( i = 0 ; i < 8 ; i++ ) {
                printf( "%s", s[i] );
                printf( "\n" );
        }
}

int main()
{
        int n, i = 0, x, y;
        int j, k;

        scanf( "%d", &n );
        while ( i < n ) {
                i++;
                for ( j = 0 ; j < 8 ; j++ ) {
                        scanf( "%s", s[j] );
                }
                scanf( "%d", &x );
                scanf( "%d", &y );
                //printtable();
                //printf( "( %d, %d)\n", x, y );
                maketable( x-1, y-1 );

                printf( "Data %d:\n", i );
                for ( j = 0 ; j < 8 ; j++ ) {
                        printf( "%s", s[j] );
                        printf( "\n" );
                }
        }
        return 0;
}



Measured memory_bytes: 1872
#include <bits/stdc++.h>
#define INF 99999999
using namespace std;
int main(){
	int N,M,a,b,v;
  cin >> N >> M;
  vector<vector<int>> vec(N);
  vector<int> light(N,INF);
  light.at(0) = 0;
  queue<int> q;
  for(int i = 0;i < M;i++){
	cin >> a >> b;
    vec.at(a - 1).push_back(b - 1);
    vec.at(b - 1).push_back(a - 1);
  }
	q.push(0);
  while(!q.empty()){
    v = q.front();
    q.pop();
    for(int c : vec[v]){
      if(light.at(c) != INF) continue;
   	
     light.at(c) = v;
      q.push(c);
    }
  }
  cout << "Yes" << endl;
  for(int i = 1;i < N;i++){
    cout << light[i] + 1 << endl;
  }
return 0;
}

Measured memory_bytes: 10332
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define li long
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pii pair<int,int>
#define pli pair<li,li>
#define pll pair<ll,ll>
#define pb push_back
#define fori(i,k,n) for(int i = k;i<n; i++)
#define rfori(i,k,n) for(int i = k; i>=n; i--)
#define tc int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
} 
class dsu{
    public:
    unordered_map<int,int> p,sz;
    void make_set(int x)
    {
        p[x] = x;
        sz[x]+=1;
    }
    int find(int x)
    {
        if(x == p[x])return x;
        return p[x] = find(p[x]);
    }
    void merge(int a,int b)
    {
        a = find(a);
        b = find(b);
        if(a == b)return;
        if(sz[a]<sz[b])swap(a,b);
        p[b] = a;
        sz[a]+=sz[b];
        sz.erase(b);
    }
};
template<class T>
T power(T a,T b){
    T res = (T)1;
    while(b>0){
        if(b&1)res = (res*a);
        b>>=1;
        a*=a;
    }
    return res;
}


int kmp(string s){
    vector<int> lps(s.size(),0);
    for(int i = 1; i<lps.size(); ++i){
        int prev_index = lps[i-1];
        while(prev_index>0&&s[i]!=s[prev_index]){
            prev_index = lps[prev_index-1];
        }
        lps[i] = prev_index+(s[i] == s[prev_index]?1:0);
    }
    return lps[lps.size()-1];
}

int main()
{
    fastio();
    int x,y,z;
    cin>>x>>y>>z;
    cout<<z<<' '<<x<<' '<<y;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val d = HashMap<String, Long>()

    for (i in 0 until n) {
        val s = readLine()!!.toCharArray().sorted().joinToString("")
        d[s] = (d[s] ?: 0) + 1
    }
    println(d.values.map { it * (it-1) / 2 }.sum())
}

Measured memory_bytes: 79424
#include<stdio.h>
int main(){
	int a,b,H,W;
	
	while(1){
		scanf("%d%d",&H,&W);
		if(H==0&&W==0){
			break;
		}
		
		for(a=0;a<H;a++){
				for(b=0;b<W;b++){
					if(a==H-1||b==W-1||a==0||b==0){
							printf("#");
						}else{
						printf(".");
					}
		}
		printf("\n");
		}
		printf("\n");
	}
	return 0;
}

				

Measured memory_bytes: 572
import bisect

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

li = [[] for _ in range(n+1)]
num = []

for _ in range(m):
    p,y = map(int,input().split())
    li[p].append(y)
    num.append((p,y))

for i in range(n+1):
    li[i].sort()

for i,j in num:
    print(str(i).zfill(6)+str(bisect.bisect_left(li[i],j)+1).zfill(6))

Measured memory_bytes: 90052
def f(e):
 a=sorted([list(map(int,input().split()))for _ in[0]*int(e)],key=lambda x:x[0])
 b=sorted([list(map(int,input().split()))for _ in[0]*int(input())],key=lambda x:x[0])
 for s,t in b:
  u,v=a[0]
  x,y=s-u,t-v
  for u,v in a:
   if[u+x,v+y]not in b:break
  else:return print(x,y)
for e in iter(input,'0'):f(e)


Measured memory_bytes: 5772
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    atcoder::fenwick_tree<ll> fw(n);
    for (size_t i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        fw.add(i,a);
    }
    for (size_t i = 0; i < q; i++)
    {
        int t,a,b;
        cin>>t>>a>>b;
        if(t)
        {
            cout<<fw.sum(a,b)<<"\n";
        }
        else
        {
            fw.add(a,b);
        }
        
    }
    
    
    
    return 0;
}

Measured memory_bytes: 8228
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  ll x;
  R x;
  x/=200;
  pr(10-x);
}

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


Measured memory_bytes: 3608