akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a*b > c*d){
        cout<< a*b <<endl;
    }
    else if(a*b < c*d){
        cout<< c*d <<endl;
    }
    else{
        cout<< a*b <<endl;
    }
}


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

int main() {
  int N;
  scanf("%d", &N);
  std::string S(N, ' '), T(N, ' ');
  scanf("%s", &S[0], S.size());
  scanf("%s", &T[0], T.size());
  std::string out = "";
  for (int i = 0; i < N; i++) {
    out += {S[i]};
    out += {T[i]};
  }
  printf("%s", out.c_str());
}


Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

using namespace std;
vector<string> vec;
vector<string> vec2;

struct Node {
    int y;
    int x;
    int depth;
};
queue<Node> que;
int H, W;
int sy, sx, gy, gx;
int y, x, depth;
vector<int> y_vec = {0, 0, -1, 1};
vector<int> x_vec = {-1, 1, 0, 0};

int bfs() {
    while (!que.empty()) {
        Node node = que.front(); que.pop();
        y = node.y;
        x = node.x;
        depth = node.depth;
        if (y == gy && x == gx) return depth;

        for (int i = 0; i < 4; ++i) {
            Node next = {y + y_vec[i], x + x_vec[i], depth + 1};

            if (0 <= next.y && next.y <= H-1 && 0 <= next.x && next.x <= W - 1 && vec[next.y][next.x] == '.') {
                que.push(next);
                vec[next.y][next.x] =  '#';
            }
        }
    }
    return 0;
}
 
int main() {
    cin >> H >> W;
    vec.resize(H);
    vec2.resize(H);
    for (int i = 0; i < H; ++i) {
        cin >> vec[i];
       vec2[i] = vec[i];
    }

    vector<pair<int, int> > sg;
    for (int h = 0; h < H; ++h) {
        for (int w = 0; w < W; ++w) {
            if (vec[h][w] == '.') {
                pair<int, int> p = make_pair(h, w);
                sg.push_back(p);
            }
        }
    }
    int res = -1;
    for (int i = 0; i < sg.size(); ++i) {
        sy = sg[i].first;
        sx = sg[i].second;
        for (int j = 1; j < sg.size(); ++j) {
            gy = sg[j].first;
            gx = sg[j].second;
            Node start = {sy, sx, 0};
            queue<Node> empty;
            swap(que, empty);
            que.push(start);    
      for (int i = 0; i < H; ++i) {
       vec[i] = vec2[i];
    }
            res = max(res, bfs());
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1LL << 30;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, n) for (ll i = a; i < n; i++)
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int a= 3*n/4;
    FOR(i,1,a+1){
        FOR(b,1,3501){
            if ((4 * i * b - n * (i + b))<=0) continue;
                if ((i * b * n) % (4 * i * b - n * (i + b)) == 0)
                {
                    cout << i << " " << b << " " << (i * b * n) / (4 * i * b - n * (i + b)) << endl;
                    return 0;
                }
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	int n, x, y;
	cin >> n >> x >> y;
	x--;
	y--;
	vector<vector<int>> d(n, vector<int>(n));
	vector<int> ans(n);
	for(int i=0;i<n;i++){
		ans.at(i) = 0;
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			d.at(i).at(j) = min({j-i,abs(x-i)+1+abs(y-j),abs(x-j)+1+abs(y-i)});
			ans.at(d.at(i).at(j)-1)++;
		}
	}
	for(int i=0;i<n-1;i++){
		cout << ans.at(i) << endl;
	}
	return 0;
}

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

int main(){
    string s;
    int f,b,t;
    cin>>s;
    t = stoi(s);
    
    f = t / 100;
    b = t % 100;
    if(((1 <= f) && (f <= 12)) && ((1 <= b) && (b <= 12))){
        cout<<"AMBIGUOUS"<<endl;
        return 0;
    }
    if((1 <= f) && (f <= 12)){
        cout<<"MMYY"<<endl;
        return 0;
    }
    if((1 <= b) && (b <= 12)){
        cout<<"YYMM"<<endl;
        return 0;
    }
    cout<<"NA"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

const int mod = 1000000007;

struct mint{
  ll x;
  mint(ll x = 0):x((x % mod + mod) % mod){};
  mint pow(ll y) const {
    mint res(1);
    mint a(x);
    while(y>0){
      if(y&1) res *= a;
      a *= a;
      y >>= 1;
    }
    return res;
  }
  mint inv() const{ return pow(mod-2); }
  mint& operator+= (const mint a) noexcept {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-= (const mint a) noexcept {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*= (const mint a) noexcept {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/= (const mint a) noexcept {
    return (*this) *= a.inv();
  }
  mint operator+ (const mint a) const noexcept {
    mint res(*this);
    return res += a;
  }
  mint operator- (const mint a) const noexcept {
    mint res(*this);
    return res -= a;
  }
  mint operator* (const mint a) const noexcept {
    mint res(*this);
    return res *= a;
  }
  mint operator/ (const mint a) const noexcept{
    mint res(*this);
    return res /= a;
  }
};

ostream& operator<<(ostream& stream, const mint& n){
  stream << n.x;
  return stream;
};

struct comb{
  vector<mint> fact, ifact;
  comb(int n): fact(n+1), ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k) const noexcept{
    if(k < 0 || n < k) return 0;
    return fact[n] * ifact[k] * ifact[n-k];
  }
};

int main(void){
  ll n, m;
  cin >> n >> m;
  if(n < m) swap(n, m);
  if(n-m > 1){
    cout << 0 << endl;
    return 0;
  }
  comb c(n+m);
  if(n == m){
    cout << c.fact[n]*c.fact[m]*2 << endl;
  }else{
    cout << c.fact[n]*c.fact[m] << endl;
  }
  return 0;
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();
    int code= 0,  n, m, c;

    cin>> n>> m>> c;

    int b[m], t, sum= 0;
    for(int i=0; i<m; i++)
        cin>> b[i];

    for(int i=0; i<n; i++)
    {
        sum =0;
        for(int i=0; i<m; i++)
        {
            cin>> t;
            sum+= (b[i]*t);
        }

        if( sum +c >0)
            code++;
    }

    cout << code ;
    nl;

    return 0;
}




Measured memory_bytes: 3524
import java.io.*;
import java.util.*;

class Main {

    // Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        long W;
        W = sc.nextLong();
        long[] w = new long[(int)(N)];
        long[] v = new long[(int)(N)];
        for(int i = 0 ; i < N ; i++){
                w[i] = sc.nextLong();
                v[i] = sc.nextLong();
        }
        solve(N, W, w, v);
    }

    static void solve(long N, long W, long[] w, long[] v){
        long V = 0;
        for (int i = 0; i < v.length; i++){
            V += v[i];
        }
        long[] dp = new long[(int)(V+1)];

        for (int i = 1; i <= V; i++){
            dp[i] = (long)10e11;
        }

        for (int i = 1; i <= w.length; i++){
            for (int j = (int)V; j >= v[i-1]; j--){
                dp[j] = Math.min(dp[j], dp[j-(int)v[i-1]] + w[i-1]);
            }
        }

        for (int i = (int)V; i >= 0; i--){
            // System.out.print(dp[i] + " ");  
            if (dp[i] <= W){
                System.out.print(i);
                return;
            }
        }
        System.out.print(0);
        return;


    }
}


Measured memory_bytes: 22100
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <array>
#include <cassert>
#include <utility>
#include <vector>


bool dfs(int a, int b, int c, int k){
    if(k == 0) return a < b and b < c;
    if(a < b and b < c) return true;
    return dfs(2 * a, b, c, k - 1) or dfs(a, 2 * b, c, k - 1) or dfs(a, b, 2 * c, k - 1);
}


int main(void){
    std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); 
    std::cout << std::fixed << std::setprecision(16);
    
    int a, b, c, k; std::cin >> a >> b >> c >> k;
    if(dfs(a, b, c, k)) std::cout << "Yes\n";
    else std::cout << "No\n";
    
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define MOD 1000000007
#define MAX 10005
#define int long long
#define T int t;cin>>t;while(t--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define debug(x) cout<<x = <<x<<n;
#define set_dp(dp) memset(dp,-1,sizeof(dp))
using namespace std;

signed main(){
	ios_base::sync_with_stdio(false);	
	cin.tie(0);
	cout.tie(0);
	
	int n;
	cin>>n; 	
	vector<int> d(n);
	f(i,0,n) cin>>d[i];
	sort(d.begin(), d.end());
	cout<<d[n/2]-d[n/2 - 1];
	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
long long n, m;
int mod = 1e9+7;
int main() {
    cin >> n >> m;
    long long rest = abs(n-m);
    if(rest > 1) {
        cout << 0 << endl;
    }else {
        long long ans = 1;
        for(int i = 1; i <= n; ++i) {
            ans *= i;
            ans %= mod;
        }
        for(int j = 1; j <= m; ++j) {
            ans *= j;
            ans %= mod;
        }
        if(rest == 1) {
            cout << ans%mod << endl;
        }else {
            cout << ans*2%mod << endl;
        }
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#define fi first
#define se second
#define pb(i) push_back(i)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define mes(a,b) memset(a,b,sizeof(a))
#define sbs(i,j) substr(i,j)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e6+10;
const int INF = 0x3f3f3f3f;
const int inf = - INF;
const int mod = 1e9+7;
const double pi = acos(-1.0);


int main(){
    std::ios::sync_with_stdio(false);
    string s;
    int a=-1,z=0;
    cin>>s;
    rep(i,0,s.size()-1){
        if(s[i]=='A'){
            if(a==-1) a=i;
        }
        if(s[i]=='Z')
            z=i;
    }
    cout<<z-a+1<<endl;
    return 0;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
//cervello|Phoenix
using namespace std;
#define ll long long int
#define eb emplace_back
#define mk make_pair
#define pr pair<int,int>
#define all(x) x.begin(),x.end()
#define mod 1000000007

int main(){
  ios_base::sync_with_stdio(false);
    // #ifndef ONLINE_JUDGE
    //   freopen("input.txt", "r", stdin);
    //   freopen("output.txt", "w", stdout);
    // #endif
  ll x,y; cin>>x>>y;
  bool flag=0;
  if(x%y)
    cout<<x<<"\n";
  else
    cout<<"-1\n";
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<math.h>

using namespace std;

int main() {
	long long n;
	cin >> n;
	long long *a=new long long[5];
	for (int i = 0; i < 5;i++)cin >> a[i];
	long long min = n;
	for (int i = 0; i < 5;i++) {
		if (min > a[i]) {
			min= a[i];
		}
	}
	long long k = (long long)ceill((long double)n/ (long double)min);

	if (min==n) {
		cout << "5" << endl;
	}
	else {
		cout << 5 + k - 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    long long n,m,k;
    cin>>n>>m>>k;
    n=abs(n);
    if(n/k<m){
        m=m-n/k;
        n=n%k;
        if(m%2==1)n=k-n;
    }
    else n=n-m*k;
    cout<<n<<"\n";
    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(void){
	int i,in;
	scanf("%d",&in);
	for(i=3;i<=in;i++){
		if(i%3==0){
			printf(" %d",i);
		}
		else if(i%10==3){
			printf(" %d",i);
		}
		else if((i/10)%10==3){
			printf(" %d",i);
		}
		else if((i/100)%10==3){
			printf(" %d",i);
		}
		else if((i/1000)%10==3){
			printf(" %d",i);
		}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2044
N,K = map(int,input().split())
if K == 0:
    ans = []
    for i in range(1,N):
        for j in range(i+1,N+1):
            ans.append((i,j))
    print(len(ans))
    for a,b in ans:
        print(a,b)
    exit()

mx = (N-1)*(N-2)//2
if K > mx:
    print(-1)
    exit()

ans = []
for i in range(1,N):
    ans.append((i,N))

rem = mx - K
for i in range(1,N-1):
    for j in range(i+1,N):
        if rem == 0:
            print(len(ans))
            for a,b in ans:
                print(a,b)
            exit()
        ans.append((i,j))
        rem -= 1

Measured memory_bytes: 3992
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    ll rem = n%(a+b);
    if (rem >= a) cout << a+(n/(a+b))*a;
    else cout << rem+(n/(a+b))*a;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-


def main():
    import sys
    input = sys.stdin.readline

    a, b, c = map(int, input().split())
    k = int(input())
    count = 0

    while True:
        if a >= b:
            b *= 2
            count += 1
        else:
            break

    while True:
        if b >= c:
            c *= 2
            count += 1
        else:
            break

    if count <= k:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


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

int main() {
    double A,x1,x2,y1,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    
    A = sqrt(pow(x2-x1,2)+pow(y2-y1,2));
    cout << fixed << A << endl;
}


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

int main()
{
       

   int n,k; cin>>n>>k;
   int r,p,s; cin>>r>>p>>s;
   string sf; cin>>sf;
   map<char,char>mp;
   mp['r']='p';
   mp['s']='r';
   mp['p']='s';
   map<char,int>coins;
   coins['r']=r; coins['s']=p; coins['p']=s;
  // rsrpr
  // pr
    string my="";
    int res=0;
   
    for(int i=0;i<(int)sf.length();i++)
    {
        if(i<k)
        {
            my+=mp[sf[i]];
            res+=coins[mp[sf[i]]];
        }
        else {
            if(my[i-k]!= mp[sf[i]])
            {
                my+=mp[sf[i]];
                res+=coins[mp[sf[i]]];
                
            }
            else
            {
                
                my+='?';
               /* if(sf[i]!=sf[i+k]){
                    my+=sf[i];
                }
                else
                {
                    my+=mp[mp[sf[i]]];
                }*/
            }
        }
            
     //  cout<<my; 
        
    }
  //  cout<<my;


cout<<res;





}


Measured memory_bytes: 640
import math

def cnt1(a, i):
    return (a//(2**i)) * 2**(i-1) + max(0, a%(2**i) - 2**(i-1))

A, B = [int(i) for i in input().split()]
if B == 0:
    ans = '0'
else:
    top = int(math.log2(B))+1


    ans = ''
    for i in range(1, top+1):
        cntB = cnt1(B+1, i)
        cntA = cnt1(A, i)
        ans += str((cntB-cntA)%2)

    ans = ans[::-1]
print(int(ans, 2))



Measured memory_bytes: 3064
//#pragma warning disable
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Numerics;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int F() => int.Parse(ReadLine());
	long FL() => long.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	long[] GL() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
	public const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Console.WriteLine(Solve());
		Out.Flush();
	}
	long Solve()
	{
		var N = F();
		var x = new long[N];
		var s = new int[N];
		var sum = new long[N];
		var sum2 = new long[N];
		for (int i = 0; i < N; i++)
		{
			var I = GL();
			x[i] = I[0];
			s[i] = (int)I[1];
			if (i == 0) sum[i] = s[i];
			else
			{
				sum[i] = sum[i - 1] + s[i];
				sum2[i] = sum2[i - 1] + s[i - 1];
			}
		}
		for (int i = 0; i < N; i++) sum[i] -= x[i];
		var max = new long[N];
		max[N - 1] = sum[N - 1];
		for (var i = N - 2; i >= 0; i--) max[i] = Max(max[i + 1], sum[i]);
		var ans = 0L;
		for (var i = 0; i < N; i++) ans = Max(ans, max[i] - sum2[i] + x[i]);
		return ans;
	}
}


Measured memory_bytes: 24192
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define __builtin_popcount __builtin_popcountll

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
    os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const map<S, T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const ll INF = 1ll<<60;
const double EPS = 1e-8;
const int MOD = 998244353;

int T, n, m;

void solve(int n, int m) {
    ll sum = 0;
    REP(i, 2 * n) sum += m + i;
    REP(i, n) sum -= m + 2*n + i;
    if (sum > 0) {
        cout << -1 << endl;
        return;
    }
    set<int> s;
    vi t;
    REP(i, 2 * n) s.insert(m + i);
    vector<tuple<int, int, int>> ans;
    REP(i, n) if (i%2 == (m + 3 * n) % 2) t.push_back(m + 2 * n + i);
    REP(i, n) if (i%2 != (m + 3 * n) % 2) t.push_back(m + 2 * n + i);
    RREP(i, n) {
        int z = t[i];
        int y = *s.rbegin();
        s.erase(y);
        auto it = s.upper_bound(z - y);
        if(it == s.begin()) {
            cout << -1 << endl;
            return;
        }
        --it;
        int x = *it;
        ans.emplace_back(x, y, z);
        s.erase(it);
    }
    for (auto it: ans) {
        int x, y, z; tie(x, y, z) = it;
        cout << x << " " << y << " " << z << endl;
    }
}

int main(int argc, char *argv[]){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    while(cin >> n >> m){
        solve(n, m);
    }
    return 0;
}


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

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

int main(void)
{
    string n;
    cin>>n;
    ll sum=0;
    rep(i,n.size()){
        sum+=n[i]-'0';
    }
    if(sum%9==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3748
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashSet<String> hs = new HashSet<String>();
        for(int i = 0; i < n; i++) {
            hs.add(sc.next());
        }
        System.out.println(hs.size());
    }
}

Measured memory_bytes: 77788
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];
    long long aSum = accumulate(a.begin(), a.end(), 0LL);

    long long left = 1;
    long long right = aSum;
    while(left < right){
        long long mid = (left + right + 1) / 2;

        bool ok = false;
        vector<int> index(3, 0);
        vector<long long> sum(3, 0);
        sum[2] = aSum;

        for(int i=0; i<n; ++i){
            for(int j=1; j<3; ++j){
                while(!(sum[j-1] > 0 && index[j] == index[0]) && sum[j-1] < mid){
                    sum[j-1] += a[index[j]];
                    sum[j] -= a[index[j]];
                    ++ index[j];
                    index[j] %= n;
                }
            }
            if(sum[2] >= mid)
                ok = true;

            sum[0] -= a[i];
            sum[2] += a[i];
            ++ index[0];
        }

        if(ok)
            left = mid;
        else
            right = mid - 1;
    }
    cout << left << endl;

    return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define sll         set<ll int>
#define msll        multiset<ll int>
#define io    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

ll n,m;
string s,t;
ll dp[3003][3003];
pair<ll,ll> aglistate[3003][3003];

ll go(ll i, ll j){
    if(i>=n || j>=m) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    
    ll tmp=-1e17;
    ll t1=go(i,j+1),t2=go(i+1,j);
    if(s[i]==t[j]){
        ll tt=1+go(i+1,j+1);
        if(tt>tmp){
            tmp=tt;
            aglistate[i][j]={i+1,j+1};
        }
        return dp[i][j]=tmp;
    }

    if(t1>tmp){
        tmp=t1;
        aglistate[i][j]={i,j+1};
    }
    if(t2>tmp){
        tmp=t2;
        aglistate[i][j]={i+1,j};
    }

    
    return dp[i][j]=tmp;
}

int main()
{
    io
    ll i,j;
    memset(dp,-1,sizeof dp);
    cin>>s>>t;
    n=s.length(); m=t.length();
    go(0,0);

    i=0;j=0;
    aglistate[n-1][m-1]={n,m};

    while(i<n and j<m){
        if(s[i]==t[j]) cout<<s[i];
        ll ti=aglistate[i][j].F;
        ll tj=aglistate[i][j].S;
        i=ti;j=tj;
    }

    return 0;
}

Measured memory_bytes: 212096
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int ans;
int A, B, C, K;

int main(void) {
    scanf("%d %d %d", &A, &B, &C);
    scanf("%d", &K);

    int x = max(A, max(B, C));

    ans = A + B + C - x;

    REP(i, 0, K) {
    	x *= 2;
    }
    
    printf("%d\n", ans + x);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int K;
vector<vi> sum;

inline int calc(int i, int j){
    int ni = i + K - 1;
    int nj = j + K - 1;
    return sum[ni][nj] - sum[i - 1][nj] - sum[ni][j - 1] + sum[i - 1][j - 1];
}

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

    int n; cin >> n >> K;
    int offset = 0;
    vector<vi> tbl(4 * K, vi(4 * K));
    rep(_, n){
        int x, y; char c; cin >> x >> y >> c;
        x %= (2 * K), y %= (2 * K);
        int d = (c == 'B' ? 1:-1);
        if(d == -1) offset++;

        rep(i, 2) rep(j, 2) tbl[y + (2 * K) * i][x + (2 * K) * j] += d;
    }

    sum = vector<vi>(4 * K + 1, vi(4 * K + 1));
    rep(i, 1, 4 * K + 1){
        rep(j, 1, 4 * K + 1){
            sum[i][j] = tbl[i - 1][j - 1]
                      + sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
        }
    }

    int res = 0;
    rep(i, 1, 2 * K + 1){
        rep(j, 1, 2 * K + 1){
            int cur = calc(i, j) + calc(i + K, j + K);
            chmax(res, offset + cur);
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 125568
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 100005
#define pb push_back
#define vit vector<int>::iterator
typedef pair<int,int> pii;
map<lint,lint>M;
vector<lint> V[MAX];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    lint n,d;
    cin>>n>>d;
    lint sum=0;
    for(lint i=0;i<n;i++){
        lint x,y;
        cin>>x>>y;
        if(x*x+y*y<=d*d)
            sum++;
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 6000
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <vector>

using namespace std;

int main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    while(true)
    {
        C -= B;
        if(C <= 0)
        {
            cout << "Yes" << endl;
            break;
        }
        A -= D;
        if (A <= 0)
        {
            cout << "No" << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3624
#include <iostream> 
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

#define ll long long
#define INF 1e9
#define MOD 1e9 + 7
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop(i, a, n) for(int i = a; i < n; i++)
#define all(in) in.begin(), in.end()

int main(){
    string S;
    cin >> S;
    set<char> c;
    rep(i, 4)c.insert(S[i]);
    string ans = "Yes";
    if(c.size()!= 2){
        ans = "No";
    }else{
        int count = 0;
        for(int i = 1; i < 4; i++){
            if(S[i] == S[0])count++;
        }
        if(count != 1) ans = "No";
    }
    cout << ans << endl;
    return 0;

}

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

using ll    = long long;
using ull   = unsigned long long;
using veci  = vector<int>;
using vecll = vector<ll>;
#define EPS (1e-7)
#define INF (1e9)
#define PI  (acos(-1))
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define REP(i,n) for(int i= 0;i<(int)(n);++i)
#define pb push_back

veci enum_div(int n){
	veci ret;
	ret.pb(1);
	for(int i=1;i*i<n;i++){
		if(n%i==0){
			ret.pb(i);
			if(i != n/i){ret.pb(n/i);}
		}
	}
	ret.pb(n);
	return ret;
}
int gcb(int a,int b){return ((b == 0)? a : gcb(b,a%b));}
int gcd(int a,int b){return (a*b) / gcb(a,b);}

int main(){
    char a,b;
    cin >> a >> b;
    if( (a=='H'&& b=='H') || (a=='D'&& b=='D') ){
        cout << "H" << endl;
    }else{
        cout << "D" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#https://atcoder.jp/contests/abc125/tasks/abc125_b
N = int(input())
X_List = list(map(int,input().split()))
Y_List = list(map(int,input().split()))
XY_List = [X_List[i]-Y_List[i] for i in range(N)]
print(sum(list(map(lambda x:x if x>= 0 else 0,XY_List))))

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

#define ll long long
int main(){

string s;

cin>>s;

string ans;

for(char c: s){
    if(c=='0')
    ans+='0';
    if(c=='1')
    ans+='1';
    if(c=='B'){
        if(!ans.empty())
        ans.pop_back();       
    }
    
}
cout<<ans;
  
}

Measured memory_bytes: 3036
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = Long.parseLong(sc.next());
        long y = Long.parseLong(sc.next());
        long a = x;
        long res = 0;
        sc.close();
        while(a <= y){
            res++;
            a*=2;
        }
        System.out.println(res);
    }

}

Measured memory_bytes: 21716
K=int(input())
S = input()
MOD = 10**9+7
val1 = len(S)+K
val2 = len(S)
# dp = [[0]*(val2+1) for _ in range(val1+1)]
# dp[0][0] = 1
# for i in range(val1):
#     for j in range(val2+1):
#         if j==val2-1:
#             dp[i + 1][j] = (dp[i + 1][j] + dp[i][j] * 26) % MOD
#         else:
#             dp[i+1][j] = (dp[i+1][j] + dp[i][j]*25)%MOD
#     for j in range(val2):
#         dp[i+1][j+1] = (dp[i+1][j+1]+dp[i][j])%MOD
# print(dp[val1][val2])
# print(dp)

N = val1
fact = [1]*2 + [0]*(N-1)
ifact = [1]*2 + [0]*(N-1)
inv = [0,1] + [0]*(N-1)
p=10**9+7

for i in range(2,N+1):
    fact[i] = (fact[i-1]*i)%p
    inv[i] = p - inv[p%i]*(p//i)%p
    ifact[i] = (ifact[i-1]*inv[i])%p
def op(n,k):
    if k<0 or k>n or n<0:
        return 0
    return (fact[n]*ifact[k]*ifact[n-k])%p

res = 0
for i in range(K+1):
    tmp = pow(26,K-i,MOD) * pow(25,i,MOD) * op(val2+i-1,i)
    res = (res + tmp)%MOD
print(res)

Measured memory_bytes: 169436
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string p, s;
  cin >> s;
  cin >> p;
  while(s.size() <= 100) s += s;
  if(s.find(p) != string::npos) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3176
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
constexpr ll INF = 1ll << 55;

template <typename T> inline constexpr bool chmin(T &a, T b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <typename T> inline constexpr bool chmax(T &a, T b) {
  if (b > a) {
    a = b;
    return true;
  }
  return false;
}

// multi-dimensional vector (require c++14)
template <typename T, typename U>
static inline vector<U> make_nd_vector(T &&n, U &&val) noexcept {
  static_assert(is_integral<T>::value,
                "[make_nd_vector] 1st argument must be an integer type");
  return vector<U>(forward<T>(n), forward<U>(val));
}
template <typename T, typename... Args>
static inline decltype(auto) make_nd_vector(T &&n, Args &&... args) noexcept {
  static_assert(is_integral<T>::value,
                "[make_nd_vector] 1st argument must be an integer type");
  return vector<decltype(make_nd_vector(forward<Args>(args)...))>(
      forward<T>(n), make_nd_vector(forward<Args>(args)...));
}
//
// Print from Iterator
template <typename ite>
void print_ite(ite start, ite end, char sp = ' ', char en = '\n') {
  for (auto i = start; i != end; i++)
    cout << *i << sp;
  cout << en;
}
//
inline void Yes(bool condition) { cout << (condition ? "Yes\n" : "No\n"); }

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


Measured memory_bytes: 3160
#include <stdio.h>
#define large 100000

int max(int a,int b){
    return a>b?a:b;
}

int main()
{
    int n;
    // int a[100000];
    // int b[100000];
    // int c[100000];
    int a[3][large];
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d %d",&a[0][i],&a[1][i],&a[2][i]);
    }

    int dp[3][large];
    dp[0][0]=a[0][0];
    dp[1][0]=a[1][0];
    dp[2][0]=a[2][0];

    for(int i=1;i<n;i++)
    {
        dp[0][i]=max(dp[1][i-1],dp[2][i-1])+a[0][i];
        dp[1][i]=max(dp[0][i-1],dp[2][i-1])+a[1][i];
        dp[2][i]=max(dp[1][i-1],dp[0][i-1])+a[2][i];
    }
    printf("%d\n",max(max(dp[0][n-1],dp[1][n-1]),dp[2][n-1]));
}

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

#define int ll
#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

////////////////////////////////////////////////////////////////////

const int N = 1e5 + 5;

int32_t main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n; cin >> n;
	if (n & 1) die(0);
	int m = n / 2, f = 0, t = 0;
	while (m) {
		f += m / 5;
		m /= 5;
	}
	m = n / 2;
	while (m) {
		t += m / 2;
		m /= 2;
	}
	t *= 2;
	cout << min(f, t) << endl;;

	return 0;
}


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

//諸機能
#pragma region MACRO 
#define putans(x)  std::cerr << "[ answer ]: " ; cout << (x) << endl
#define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(40) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,n,a) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,n,0)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define put ifs >>
#else //ジャッジシステムでいい感じにやる
#define put cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#ifdef _DEBUG
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#else
#define dbg(var0) {}
#define dbg2(var0, var1) {}
#define dbg3(var0, var1, var2) {}
#define dbgArray(a,n) {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
//#define int ll //オーバーフローでWAのときコメントアウトする(非推奨)
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(2*1e15)
#pragma endregion



int main() {
	string s;
	put s;
	int n = s.size();
	int sign[101];
	int tmp[101];
	rep(i, n) {
		sign[i] = s[i] - 'a';
		tmp[i] = sign[i];
	}
	int minturn = 200;
	char changer[101];
	rep(k, 27) {
		char filler = k;
		rep(i, n) {
			if (sign[i] != filler)break;
			if (i == n - 1) {
				putans(0);
				return 0;
			}
		}
		bool haveFiller = false;
		rep(i, n) tmp[i] = sign[i];
		rep(i, s.size()) if (sign[i] == filler)haveFiller = true;//clear check
		if (!haveFiller) {
			continue;
		}
		REP(i, 0, n) {
			rep(j, n-i) {
				if (tmp[j] == filler) {
					tmp[j] = filler;
				}
				else if (tmp[j + 1] == filler)tmp[j] = filler;
				else tmp[j] = tmp[j + 1];
			}
			bool allFiller = true;
			rep(j, n-i-1) {
				if (tmp[j] != filler) {
					allFiller = false;
					break;
				}
			}
			if (allFiller) {
				minturn = min(minturn,i+1);
				break;
			}
		}
	}
	putans(minturn);
	return 0;
}



Measured memory_bytes: 256
N = int(input())

A = []
B = []
for i in range(N):
    x, y = map(int, input().split())
    A.append(x)
    B.append(y)

C = []
for index, i in enumerate(range(N)):
    C.append([index, A[i] + B[i]])

C = sorted(C, key=lambda x:x[1], reverse=True)

ansA = 0
ansB = 0

for index, i in enumerate(C):
    if index%2 == 0:
        ansA += A[i[0]]
    else:
        ansB += B[i[0]]

print(ansA - ansB)

Measured memory_bytes: 29908
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

ll S(ll x){
  ll sum = 0;
  while(x > 0){
    sum += x%10;
    x /= 10;
  }
  return sum;
}

int main(){
  map<ll,int> memo;
  REP(i,5,18){
    rep(j,10000){
      ll x = j;
      rep(k,i-5){ x *= 10; x += 9; }
      memo[x] = 1;
    }
  }
  vector<ll> v;
  FOR(it,memo){
    if(it->first == 0) continue;
    v.push_back(it->first);
  }

  
  int K;
  cin >> K;

  K = min(K, (int)v.size());
  int i=0;
  while(K>0){
    ll n = v[i];
    bool flg = true;
    REP(j,i+1,v.size()){
      ll m = v[j];
      if(m * S(n) - n * S(m) < 0){
        flg = false;
        break;
      }
    }
    if(flg){
      cout << n << endl;
      K--;
    }
    i++;
  }
  
  return 0;
}



Measured memory_bytes: 8824
a = [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]
index = int(input()) -1
print(a[index])

Measured memory_bytes: 3060
def g;gets.split.map &:to_i;end
r=1..n=g[0]
w=[0]+r.map{[0]+[1e9]*n}
r.map{f,_,*t=g;t.map{|i|w[f][i]=1}}
r.each{|k|r.each{|i|r.each{|j|(a=(b=w[i])[k]+w[k][j])<b[j]&&b[j]=a}}}
g[0].times{s,d,v=g;puts v<(c=w[s][d]+1)?:NA:c}

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

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

    int N;
    cin >> N;

    vector<int> x(100010);

    for(int i = 0; i < N; i++) {
        int a;
        cin >> a;
        x[a]++;
        x[a + 1]++;
        x[a + 2]++;
    }

    int ans = *max_element(x.begin(), x.end());

    cout << ans << endl;
}

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

int acc[301][301];
int ans[300][300];

int pieces = 1;

int area(int x0, int y0, int x1, int y1) {
  return acc[y1][x1]+acc[y0][x0]-acc[y0][x1]-acc[y1][x0];
}

void rec(int x0, int y0, int x1, int y1) {
  int tot = area(x0,y0,x1,y1);
  if (tot == 1) {
    for (int i = y0; i < y1; i++)
      for (int j = x0; j < x1; j++)
	ans[i][j] = pieces;
    pieces++;
    return;
  }
  for (int i = x0+1; i < x1; i++) {
    int a = area(x0, y0, i, y1);
    if (a > 0 && a < tot) {
      rec(x0, y0, i, y1);
      rec(i, y0, x1, y1);
      return;
    }
  }
  for (int i = y0+1; i < y1; i++) {
    int a = area(x0, y0, x1, i);
    if (a > 0 && a < tot) {
      rec(x0, y0, x1, i);
      rec(x0, i, x1, y1);
      return;
    }
  }
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int h, w, k;
  cin >> h >> w >> k;
  for (int i = 0; i < h; i++) {
    string row;
    cin >> row;
    for (int j = 0; j < w; j++) {
      acc[i+1][j+1] = acc[i+1][j]+acc[i][j+1]-acc[i][j]+(row[j] == '#');
    }
  }
  rec(0,0,w,h);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++)
      cout << ans[i][j] << ' ';
    cout << endl;
  }
}


Measured memory_bytes: 1536
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
    var input = chunk.split("\n");
    var output = "";
    var nums = new Array();
    
    for (var i = 0; i < input.length; i ++){
        nums[i] = input[i].split(" ");
    }
    
    for(var i = 0; i < nums.length; i ++){
        if (!order(nums[i])){
            break;
        }
        console.log(nums[i][0] + " " + nums[i][1]);
    }
    
    function order(obj){
        if (obj[0] == 0 && obj[1] == 0){
            return false;
        }
        if(Number(obj[0]) > Number(obj[1])){
            var temp = obj[1];
            obj[1] = obj[0];
            obj[0] = temp;
        }
        return true;
    }
});

Measured memory_bytes: 10840
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ABC0613
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] inp = Console.ReadLine().Split();
            int n = int.Parse(inp[0]);int k= int.Parse(inp[1]);
            int[]array=Console.ReadLine().Split().Select(int.Parse).ToArray();

            List<string> ans = new List<string>();
            for (int i=k+1;i<=n;i++)
            {
                string str = "No";
                if (array[i-1] > array[i - k-1]) { str = "Yes"; }
                ans.Add(str);
            }

            foreach(string s in ans)
            {
                Console.WriteLine(s);
            }

        }
    }
}


Measured memory_bytes: 49756
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)
#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define vi vector<int>
#define vl vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>

int main(){
    string s;
    cin>>s;
    int n=s.size();
    int ans=0;
    int ans2=0;

    rep(i,n){
        if((i+1)%2==1 && s[i]!='0')ans++;
        else if((i+1)%2==0 && s[i]!='1')ans++;
    }
    rep(i,n){
        if((i)%2==1 && s[i]!='0')ans2++;
        else if((i)%2==0 && s[i]!='1')ans2++;
    }

    cout<<min(ans,ans2)<<endl;

}

Measured memory_bytes: 512
n = int(input())
h_list = list(map(int, input().split()))

i = 0
cnt = 0
record = 0
while i < n-1:
    if h_list[i] >= h_list[i+1]:
        cnt += 1
    else:
        cnt = 0

    if cnt > record:
        record = cnt
    i += 1

print(record)


Measured memory_bytes: 14224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100000 + 10;
ll a[N],s[N];
int ok[N];
int main(){
    ios::sync_with_stdio(0);
    int n,m,v,p; cin>>n>>m>>v>>p;
    for(int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++) s[i] = s[i-1] + a[i];
    for(int i=n;i>=1;i--){
        if(i!=n&&a[i]==a[i+1]) ok[i] = ok[i+1];
        else if(n-i+1<=p) ok[i] = 1;
        else if(m+a[i]<a[n-p+1]) ok[i] = 0;
        else{
            ll rem = 1ll * m * max(v - i - (p-1), 0);
            ll sum = 1ll * ((n-p+1)-(i+1)+1) * (m + a[i]) - (s[n-p+1]-s[i]);
//            for(int j=i+1;j<=n-p+1;j++){
//                sum += m+a[i]-a[j];
//            }
            if(rem<=sum) ok[i] = 1;
            else ok[i] = 0;
        }
    }
    int ans = 0;
    for(int i=1;i<=n;i++) ans += ok[i];
    cout<<ans<<endl;
}


Measured memory_bytes: 2304
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
        int sum=n;
        int ans=0;


        for(int i=0; i<n; i++){
            sum=sum/k;
            ans++;
            if(sum<k){
                break;
            }
        }
        if(sum!=0){
            ans++;
        }
        sc.close();
        System.out.println(ans);
    }
}

Measured memory_bytes: 23124
N = int(input())
P = [int(input()) for _ in range(N)]

pos = [0] * N
for i in range(N) :
    pos[P[i] - 1] = i
    
ret = 0
c = 1
for i in range(1, N) :
    if pos[i] > pos[i - 1] :
        c += 1
    else :
        ret = max(ret, c)
        c = 1
ret = max(ret, c)
        
print(N - ret)

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n, 0);
  for (int i = 1; i < n; i++) {
    int b;
    cin >> b;
    a[b-1]++;
  }

  rep(i,n) {
    cout << a[i] << endl;
  }

}


Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
int n, k, a[100005], dp[100005];
int main() {
    cin >> n >> k;
    for (int i=1; i<=n; i++) cin >> a[i];
    dp[2] = abs(a[2] - a[1]);
    for (int i=3; i<=n; i++) {
        dp[i] = INT_MAX;
        for (int j=i-1; j>=max(1, i-k); j--) {
            dp[i] = min(dp[i], dp[j] + abs(a[i] - a[j]));
        }
    }
    printf("%d\n", dp[n]);
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,a) for(i=a-1;i>=0;i--)
using namespace std;

int main(void){
    int i;
    string str;
    cin >> str;
    rep(i,str.length()) {
        cout << str[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1176