akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define pb push_back
#define ff first
#define ss second
#define sz size()
#define mp make_pair
#define p(x) cout<< x << " ";
#define pe(x) cout<< x << endl ;
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define el endl
#define MOD 1000000007 
#define int long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROR(i,a,b) for(int i=a;i>=b;i--)
const int N = 4e5 + 5;


int32_t main() 
{ 
    FAST;
    int n,l;
    cin>>n>>l;
    int sum=0;
    for(int i=l;i<l+n;i++)
    sum+=i;
    //cout<<sum<<" ";
    int diff=1e5,ans;
    for(int i=l;i<l+n;i++)
    {
        if(abs(sum-(sum-i))<diff)
        {
            ans=sum-i;
            diff=abs(sum-sum+i);
        }
        
    }
    cout<<ans;
}

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

int main() {
string s;
cin >>s;
int  che =-1;
int big=0;
for(int i=0;i<s.size();i++){
    char z =toupper(s.at(i));
    if(s.at(i)==z)big++;
}
for(int i=2;i<s.size()-1;i++){
    if(s.at(i)=='C')che++;
}
if(s.at(0)=='A'&&che==0&&big==2){
    cout <<"AC"<<endl;
}
else{
    cout <<"WA"<<endl;
}
}

Measured memory_bytes: 256
"use strict";
function Main(input) {
    const INF = Number.MAX_SAFE_INTEGER;
    let lines = input.split("\n");
    let nums = lines.shift().split(/\s/).map((v) => v - 0);
    let N = nums[0];
    let A = nums[1];
    let B = nums[2];
    let C = nums[3];
    let Tn = []
    for (let n = 1; n <= N; n++) {
        Tn.push(lines.shift().split("\n")[0] - 0);
    }
    Tn.sort((a, b) => b - a);
    const min = (a, b, c, d) => {
        d = d || INF;
        return Math.min(a, Math.min(b, Math.min(c, d)));
    }
    const dfs = (cur, a, b, c) => {
        if (cur == N) return (min(a, b, c) > 0) ? Math.abs(a - A) + Math.abs(b - B) + Math.abs(c - C) - 30 : INF;
        const ret0 = dfs(cur + 1, a, b, c)
        const ret1 = dfs(cur + 1, a + Tn[cur], b, c) + 10
        const ret2 = dfs(cur + 1, a, b + Tn[cur], c) + 10
        const ret3 = dfs(cur + 1, a, b, c + Tn[cur]) + 10
        return min(ret0, ret1, ret2, ret3)
    }
    console.log(dfs(0, 0, 0, 0));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int d[20005];
int h,n;
int a[10005],b[10005];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> h >> n;
	for(int i = 1;i <= h+10000;i++) d[i] = 1e9;
	for(int i = 1;i <= n;i++) cin >> a[i] >> b[i];
	for(int i = 0;i <= h;i++) {
		for(int j = 1;j <= n;j++) {
			d[i+a[j]] = min(d[i+a[j]],d[i]+b[j]);
		}
	}
	int ans = 1e9;
	for(int i = h;i <= h+10000;i++) ans = min(ans,d[i]);
	cout << ans;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":" "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
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 <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    string s,t;
    cin>>s>>t;
    sort(ALL(s));
    sort(RALL(t));
    if(s<t) {
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }
    return 0;
}


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

typedef long long lli;
typedef pair<lli,lli> pll;
typedef vector<lli> vcL;
typedef vector<pll> vPL;


void solve() {
	string s;
	cin >> s;
	
	if ( s[0] != 'A' ) cout << "WA\n";
	else {
		string t;
		for (auto x : s) {
			if ( x >= 'A' and x <= 'Z' ) {
				t += x;
			}
		}
		
		if ( t.size() != 2 or t[1] != 'C' ) cout << "WA\n";
		else if ( s[1] == 'C' or s[ s.size()-1 ] == 'C' ) cout << "WA\n";
		else cout << "AC\n";
	}
}

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



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

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE "file"

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    string ans = "";
    for(int i = 0; i < x2 - x1; i++)
        ans += "R";
    for(int i = 0; i < y2 - y1; i++)
        ans += "U";
    for(int i = 0; i < x2 - x1; i++)
        ans += "L";
    for(int i = 0; i < y2 - y1; i++)
        ans += "D";
    ans += "L";
    for(int i = 0; i < y2 - y1 + 1; i++)
        ans += "U";
    for(int i = 0; i < x2 - x1 + 1; i++)
        ans += "R";
    ans += "DR";
    for(int i = 0; i < y2 - y1 + 1; i++)
        ans += "D";
    for(int i = 0; i < x2 - x1 + 1; i++)
        ans += "L";
    ans += "U";
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
M,D= list(map(int,input().split()))
ans=0
if D < 10:
   print(0)
   exit()
for i in range(1,M+1):
   for j in range(10,D+1):
      s=str(j)
      if i == int(s[0])*int(s[1]) and int(s[0])>=2 and int(s[1])>=2:
         ans+=1
print(ans)

Measured memory_bytes: 3060
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N, M; cin >> N >> M;
    vector<int> A(N), B(M), cnt(N*M+1);
    for(int i=0; i<N; i++) {
        cin >> A[i];
        cnt[ A[i] ]++;
    }
    for(int i=0; i<M; i++) {
        cin >> B[i];
        cnt[ B[i] ] += 2000;
    }

    sort(A.rbegin(), A.rend());
    sort(B.rbegin(), B.rend());

    int rdx = 0, cdx = 0, ans = 1;
    for(int k=N*M; k>=1; k--) {
        while(rdx < N and A[rdx] >= k) rdx++;
        while(cdx < M and B[cdx] >= k) cdx++;
        int cntA = cnt[k] % 2000, cntB = cnt[k] / 2000;
        // fprintf(stderr, "# k = %lld, rdx = %lld, cdx = %lld\n", k, rdx, cdx);
        // fprintf(stderr, "# cntA = %lld, cntB = %lld\n", cntA, cntB);
        
        if(cntA == 1 and cntB == 1) {
            continue;
        }
        if(cntA > 1 or cntB > 1) {
            // fprintf(stderr, "k = %lld, cntA = %lld, cntB = %lld\n", k, cntA, cntB);
            ans = 0;
        }
        if(cntA == 1) (ans *= cdx) %= MOD;
        else if(cntB == 1) (ans *= rdx) %= MOD;
        else {
            // fprintf(stderr, "k = %lld, rdx = %lld, cdx = %lld\n", k, rdx, cdx);
            // fprintf(stderr, "add = %lld\n", rdx * cdx - (N*M - k));
            (ans *= (rdx * cdx - (N*M - k))) %= MOD;
        }
        // fprintf(stderr, "# k = %lld, ans = %lld\n", k, ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <fstream>
#include <iomanip>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>
#include <queue>

#include <algorithm>
#include <numeric>
#include <random>
#include <chrono>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

using namespace std;

#define forn(i, n) for (ll i = 0; i < static_cast<ll>(n); ++i)
#define sz(a) static_cast<int>((a).size())
#define pb emplace_back
#define endl '\n'
#define f first
#define s second

#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) { cerr << _s << " = " << _h << "\n"; }

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;

    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;

    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7ll;
const ll LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

int n;
int a[MAXN];

bool read() {
    if (!(cin >> n))
        return false;

    forn (i, n) {
        cin >> a[i];
    }

    return true;
}

void solve() {
    map<int, int> A, B;
    A[0] = 0;
    B[0] = 0;

    forn (i, n) {
        if (i & 1)
            ++A[a[i]];
        else
            ++B[a[i]];
    }

    vector< pair<int, int> > va, vb;

    for (auto i : A)
        va.push_back(i);

    for (auto i : B)
        vb.push_back(i);

    sort(va.begin(), va.end(), [](pair<int, int> a, pair<int, int> b) {
        return a.second < b.second;
    });
    sort(vb.begin(), vb.end(), [](pair<int, int> a, pair<int, int> b) {
        return a.second < b.second;
    });

    int ans = n;

    for (int i = sz(va) - 1; i >= 0 && i >= sz(va) - 5; --i) {
        for (int j = sz(vb) - 1; j >= 0 && j >= sz(vb) - 5; --j)
            if (va[i].first != vb[j].first)
                ans = min(ans, n - (va[i].second + vb[j].second));
    }

    cout << ans << endl;
}

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

#ifdef LOCAL
    //freopen("/Users/leemonage/CLionProjects/proj/file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}


Measured memory_bytes: 6524
#include<bits/stdc++.h>
using namespace std;
int main(){
string S;
  int64_t K;
  cin>>S>>K;
  int64_t sum=1;
  int64_t ans=0;
  int64_t N=S.size();
  bool x=true;
  for(int i=1;i<N;i++)
    if(S.at(i)!=S.at(0)){x=false; break;}
  if(x)cout<<(N*K)/2<<endl;
  else{
  S+='?';
  for(int i=1;i<=N;i++){
    if(S.at(i)==S.at(i-1))
      sum++;
    else{
    ans+=sum/2; sum=1;
    }
  }ans*=K;
  if(S.at(0)==S.at(N-1)){
  int a,b; a=1; b=1;
    for(int i=1;i<N;i++){
    if(S.at(i)==S.at(i-1))
      a++;
      else
        break;
    }for(int i=N-1;1<=i;i--){
    if(S.at(i)==S.at(i-1))
      b++;
      else
        break;
    } if(a%2==1 && b%2==1)
      ans+=(K-1);
  
  }cout<<ans<<endl;
  }
   return 0;
}


Measured memory_bytes: 256
def main():
  n = int(input())
  #s = input()
  #s = input().split()
  #a,b = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  lis = []
  
  if n == 25:
    print("Christmas")
  elif n == 24:
    print("Christmas Eve")
  elif n == 23:
    print("Christmas Eve Eve")
  else:
    print("Christmas Eve Eve Eve")
if __name__ == '__main__':
  main()

Measured memory_bytes: 2940
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>
#include <cstring>		//strlen

using namespace std;



bool solve(){

//	なぜかわからないがstirngだと数字が大きいとSegmentation fault
/*
	string str1,str2;
	cin>> str1>> str2;
	int n1 = str1.size();
	int n2 = str2.size();
*/	
	char str1[10000],str2[10000];
	scanf("%s %s",str1,str2);
	int n1 = strlen(str1);
	int n2 = strlen(str2);
	
	int n  = max(n1,n2);

/*	string str="";
*/
	char str[10000];
	int c = 0;
	int i=0;
	while(i<n){
		int a = c;
		if(i<n1){
			a += (str1[n1-i-1]-'0');
		}
		if(i<n2){
			a += (str2[n2-i-1]-'0');
		}
		c = a/10; 
		a = a%10;
		
		str[i] = a + '0';
		i++;
	}
	if(c){
		str[i] = c + '0';
		i++;
	}
	
	if(i>=81){
		cout<< "overflow"<<endl;
		return true;
	}
	
	for(int j=i-1;j>=0;j--){
		cout<< str[j];
	}
	cout<<endl;
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(5);
	int n;
	cin>> n;
	for(int i=0;i<n;i++){
		solve();
	}
	return 0;
}

 

Measured memory_bytes: 1188
#include<stdio.h>
int main(){
  int N,a[100],num;
  int i,j,k;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
  }
  for(k=0;k<N;k++){
    printf("%d",a[k]);
    
    if(k<N-1)printf(" ");
  }
  printf("\n");

  for(i=1;i<N;i++){
    num=a[i];
    j=i-1;
    
    while(j>=0 && a[j]>num){
      a[j+1]=a[j];
      j--;
      a[j+1]=num;
    }
    for(k=0;k<N;k++){
      printf("%d",a[k]);
      
      if(k<N-1)printf(" ");
    }
    printf("\n");
  }
return 0;
}


Measured memory_bytes: 2752
from itertools import groupby

N=int(input())
H=list(map(int,input().split()))
New=[]
_max=0
for _ in range(N-1):
    if H[_]>=H[_+1]:
        New.append(1)
    else:
        New.append(0)
for k,h in groupby(New):
    _sum=sum(list(h))
    if k==1 and _sum>_max:
        _max=_sum
print(_max)

Measured memory_bytes: 14528
import java.util.*;

public class Main{
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n = Integer.parseInt(sc.next());
	int m = Integer.parseInt(sc.next());
	int[] c = new int[10000];
	for (int i = 0; i < m; i++) {
		c[i]  = Integer.parseInt(sc.next());
	}
	int dp[] = new int[n+1];
	for(int i  = 0; i< n+1;i++) dp[i] = i;
	for (int i = 0; i < m+2; i++) {
		for (int j = c[i]; j < n+1; j++) {
			dp[j] = Math.min(dp[j],dp[j-c[i]]+1);
		}
	}
	System.out.println(dp[n]);
	}
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

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


int main() {
  int n;
  cin >> n;
  string a, b, c;
  cin >> a >> b >> c;
  int ans = 0;
  rep (i, n) {
    if (a[i] == b[i] && b[i] == c[i]) {
      continue;
    }
    else if (a[i] == b[i] || b[i] == c[i] || c[i] == a[i]) {
      ans += 1;
    }
    else {
      ans += 2;
    }
  }
  cout << ans << endl;
}


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

if s[k - 1] == 'A':
    s[k - 1] = 'a'
elif s[k - 1] == 'B':
    s[k - 1] = 'b'
else:
    s[k - 1] = 'c'

for i in s:
    print(i, end = '')

Measured memory_bytes: 3064
# -*- coding:utf-8 -*-
import math
N = int(input())
a = list(map(int,input().split()))
#alpha, beta = (sum(a), sum(list(map(lambda n:n**2, a))))
#beta -= int(alpha**2/N)
alpha = sum([(tmp - round(sum(a)/N))**2 for tmp in a]) 
print(alpha)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int count = 0;
            int mc = 0;
            for (int i = 0; i < n; i++)
            {
                var a = s.Substring(0, i);
                var b = s.Substring(i);
                var aa = a.Distinct().ToArray();
                var bb = b.Distinct().ToArray();
                count = 0;
                for (int j = 0; j < aa.Length; j++)
                {
                    for (int k = 0; k < bb.Length; k++)
                    {
                        if (aa[j] == bb[k]) count++;
                    }
                }
                mc = Math.Max(mc, count);
            }
            Console.WriteLine(mc);

        }

    }
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int dis[220000];
bool flag[220000];

int main()
{
	int N, Q;
	cin >> N >> Q;
	vector<vector<int>> A(N+1);

	fx(N-1) {
		int a, b;
		cin >> a >> b;
		A.at(a).push_back(b);
		A.at(b).push_back(a);
	}

	fy(Q) {
		int p, x;
		cin >> p >> x;
		dis[p] += x;
	}

	queue<int> where;
	where.push(1);
	while (where.size()>0)
	{
		int x = where.front();
		where.pop();
		if (flag[x]) { continue; }
		flag[x] = true;
		fy(A.at(x).size()) {
			if (!flag[A.at(x).at(y)]) {
				dis[A.at(x).at(y)] += dis[x];
				where.push(A.at(x).at(y));
			}
		}
	}
	fx(N) {
		cout << dis[x + 1] << ' ';
	}
	cout << endl;	
    return 0;
}



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

#define pout(n)  printf ("%d\n", n)
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

typedef long long ll;
using namespace std;
 
int main (){
  int n,m;
  cin >> n >> m;
  int a[n],b[n],c[m],d[m];

  rep(i,0,n){
    cin >> a[i] >> b[i];
  }
  rep(i,0,m){
    cin >> c[i] >> d[i];
  }
  rep(i,0,n){
    int min_info = abs(a[i]-c[0])+abs(b[i]-d[0]);
    int check = 1;
    rep(j,1,m){
      int now_info = abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(min_info > now_info){
        min_info = now_info;
        check = j+1;      
      }
    }
    pout(check);
  }
  return 0;
}

Measured memory_bytes: 256
#ifndef DEBUG
#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i <= i##_len; ++i)
#define rep3(i, l, r) for (int i = l, i##_len = (r); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = l, i##_len = (r); i <= i##_len; ++i)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 62;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

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

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

    Int N, W;
    cin >> N >> W;
    vector<Int> w(N), v(N);
    for (Int i = 0; i < N; i++) {
        cin >> w[i] >> v[i];
    }

    vector dp(N + 5, vector<Int>(W + 5, 0));
    rep(i, N) {
        REP(j, W) {
            if (0 <= j - w[i]) {
                chmax(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
            }

            chmax(dp[i + 1][j], dp[i][j]);
        }
    }

    cout << dp[N][W] << endl;

    return 0;
}

Measured memory_bytes: 86292
#include <algorithm>
#include <iostream>
#include <vector>
#include <numeric>
#include <string>
#include <stdio.h>
using namespace std;
int main(){
  int K;
  cin >> K;
  vector<int> vec{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};
  
  cout << vec.at(K-1);
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (k,n) = readLine()!!.split(" ").map { it.toInt() }
    val a = readLine()!!.split(" ").map { it.toInt() }
    var max = a[0] + (k-a[n-1])
    for (i in 0 until n-1) {
        if (a[i+1] - a[i] > max) max = a[i+1] - a[i]
    }
    println(k-max)
}


Measured memory_bytes: 82928
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath>  
#include<memory.h> 
#include<sstream>
#include<time.h>
#include<iomanip>
using namespace std;
const unsigned long long BIGEST=1000000000000000000+1000000000000000000;
const long long BIGER=1000000000000000000;
const int BIG=1000000000;
const long long MOD=19961993;
const long long LMOD=1000000007;
//const long long LMOD=1000000007;
#define Fi first
#define Se second
#define P2 pair
#define Pii pair<int,int>
#define Pll pair<long long,long long>
#define Cb make_pair
#define ll long long
#define Ull unsigned long long
#define Sf scanf
#define Pf printf
#define Pb push_back
#define Psh push
#define Stc stack
#define Vct vector
#define Ret return
#define Re0 return 0
#define Sz size
#define Is insert
#define Que queue
#define Emp empty
#define Fro front
#define Rv reverse
#define Er erase
#define Bg begin
#define Srt sort
#define Pq priority_queue
#define Ins insert
#define Ite iterator
#define Cou count
#define Cot continue
#define Beg begin
vector<Pii>v[100001];
int col[100001];
int f[100001];
int ypa(int k,int p=0)
{
	//cout<<k<<endl;
	int g=0;
	for(int i=0;i<v[k].Sz();i++)
	{
		if(v[k][i].Fi==p)continue;
		if(f[k]==++g)++g;
		f[v[k][i].Fi]=g;
		col[v[k][i].Se]=g;
		ypa(v[k][i].Fi,k);
	}
	return 0;
}
int main()
{
	int n;
	Sf("%d",&n);
	int x,y;
	for(int i=1;i<n;i++)
	{
		Sf("%d%d",&x,&y);
		v[x].Pb(Cb(y,i));
		v[y].Pb(Cb(x,i));
	}
	int mx=0;
	for(int i=1;i<=n;i++)
	{
		mx=max(mx,(int)(v[i].Sz()));
	}
	ypa(1);
	Pf("%d\n",mx);
	for(int i=1;i<n;i++)
	{
		Pf("%d\n",col[i]);
	}
	return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>

using namespace std;

int ret;

int gcd(int n, int m){
	if(n < m) swap(n,m);
	if(m == 0) return n;
	ret++;
	return gcd(m,n%m);
}

int main(void){
	int n,m;
	while(cin >> n >> m){
		if((n|m) == 0) break;
		ret = 0;
		cout << gcd(n,m) << " ";
		cout << ret << endl; 
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

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

	int a, b;
	cin >> a >> b;

	if(0 < a || b < 0 && abs(b - a) % 2 == 1) {
		cout << "Positive" << endl;
	}
	else if(b < 0 && abs(b - a) % 2 == 0) {
		cout << "Negative" << endl;
	}
	else {
		cout << "Zero" << endl;
	}
}

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

def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))

    # dig: マッチ本数 -> 使える数字
    nm = [999, 2, 5, 5, 4, 5, 6, 3, 7, 6]
    dig = [None for i in range(8)]
    for x in sorted(a):
        dig[nm[x]] = x

    # dp[j]: j本のマッチを使って作れる最大の数 tuple(桁数d, prevj, lastdig)
    dp = [None for j in range(n + 1)]
    dp[0] = (0, None, None)
    for j in range(1, n + 1):  # もらう
        for use in [2, 3, 4, 5, 6, 7]:
            jp = j - use
            if jp < 0:
                continue
            if dig[use] is None:
                continue
            if dp[jp] is None:
                continue
            d = dp[jp][0] + 1
            tup = (d, jp, dig[use])
            if (dp[j] is None) or (dp[j][0] < d) or (dp[j][0] == d and dp[j][2] < dig[use]):
                dp[j] = tup

    res = []
    j = n
    while True:
        d, jp, i = dp[j]
        if jp is None:
            break
        res.append(str(i))
        j = jp
    assert len(res) == dp[n][0]

    print("".join(res))

if __name__ == "__main__":
    main()


Measured memory_bytes: 4724
import sys
def input():
    return sys.stdin.readline()[:-1]
N,M=map(int,input().split())
sys.setrecursionlimit(200000)
b=[tuple(map(lambda x: int(x)-1, input().split())) for i in range(M)]
class uf:
    def __init__(self,n):
        self.n=n
        self.l=[-1]*n
    def ro(self,n):         #root
        if self.l[n]<0:
            return n
        r=self.ro(self.l[n])
        self.l[n]=r
        return r
    def me(self,a,b):       #merge
        ra=self.ro(a)
        rb=self.ro(b)
        if self.l[ra]>self.l[rb]:
            ra,rb=rb,ra
        if ra!=rb:
            self.l[ra]+=self.l[rb]
            self.l[rb]=ra
    def size(self,n):
        return -self.l[self.ro(n)]
    def sa(self,a,b):       #same
        return self.ro(a)==self.ro(b)
    def rl(self):           #roots list
        return [i for i,v in enumerate(self.l) if v<0]
    
    def len(self):          #len(roots)
        return len(self.rl())
    def ul(self):
        d={n:i for i,n in enumerate(self.rl())}
        m=[[]for i in range(self.len())]
        for i in range(self.n):
            m[d[self.ro(i)]].append(i)
        return m
    def __str__(self):
        return f"{self.ul()}"
l=[0]*M
s=uf(N)
h=N*(N-1)//2
for i in range(M-1,-1,-1):
    l[i]=h
    if s.ro(b[i][0])!=s.ro(b[i][1]):
        h-=s.size(b[i][0])*s.size(b[i][1])
        s.me(b[i][0],b[i][1])
print(*l,sep="\n")

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

int main(){
    int h,n; cin >> h >> n;
    int AttackSum = 0;
    bool IsPossible = false;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        AttackSum += x;

        if(AttackSum >= h){
            IsPossible = true;
            break;
        } 
    }
    if(IsPossible==true){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
N=number=int(input())
X_list=list(map(int, input().split()))
min_pow=0
if N==1:
    print("0")
else:
    X_min=min(X_list)
    X_max=max(X_list)
    for i in range(X_min,X_max):
        sum_pow=0
        for j in range(N):
            sum_pow+=(X_list[j]-i)**2
        if i==X_min:
            min_pow=sum_pow
        if min_pow>sum_pow:
            min_pow=sum_pow
    print(min_pow)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int myadd(int r, int s, int p, char c) {
	if (c == 'r') return p;
	if (c == 's') return r;
	if (c == 'p') return s;
}

int main() {
	int n,k;
	int r,s,p;
	string t;
	cin >> n >> k >> r >> s >> p >> t;
	int sum = 0;

	rep(i,k) {
		string str;
		int a = i;
		while (a < n) {
			char ch = t[a];
			str.pb(ch);
			a += k;
		}

		bool flag = false;
		//cout << str << endl;

		rep(j, str.length()) {
			if (j == 0) {
				sum += myadd(r, s, p, str[j]);
				flag = true;
			}
			else {
				if (str[j] != str[j-1]) {
					sum += myadd(r, s, p, str[j]);
					flag = true;
				}
				else {
					if(flag == true) {
						flag = false;
						//cout << "skip" << j << endl;
						continue;
					}
					else {
						sum += myadd(r, s, p, str[j]);
						flag = true;
					}
				}
			}
		}
	}

	cout << sum << endl;

  return 0;
}


Measured memory_bytes: 512
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=Integer.parseInt(sc.next());
        int[] t=new int[N+1];
        int[] x=new int[N+1];
        int[] y=new int[N+1];
        boolean flag=true;
        for(int i=1;i<= N;i++){
            t[i]=Integer.parseInt(sc.next());
            x[i]=Integer.parseInt(sc.next());
            y[i]=Integer.parseInt(sc.next());
            int dt=t[i]-t[i-1];
            int dist=Math.abs(x[i]-x[i-1])+Math.abs(y[i]-y[i-1]);
            if (dt<dist || ((dist-dt)%2!=0)){
                flag=false;
                break;
            }
        }
        System.out.println(flag ? "Yes" : "No");
    }
}

Measured memory_bytes: 62736
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main() {
  int N, temp;
  int i;
  float result;
  scanf ("%d", &N);
  
  temp = N/2;
  result = 1.0 * (N-temp)/N;
  
  
  printf("%f", result);
  return 0;
}




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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if ((A + B) > (C + D)) {
    cout << "Left" << endl;
  } else if ((A + B) < (C + D)) {
    cout << "Right" << endl;
  } else {
    cout << "Balanced" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
	
int asdf(int h,int w,int i,int j){
	int l, d;
	l = h * h + w * w;
	d = i * i + j * j;
	if(l > d){
		
		return 1;
	} else if(l == d && h > i){
		return 1;
	} 
	return 0;
}

int main(){
	int h, w, l, d;

	while (1){
		int th = 150, tw = 150;
		cin>>h>>w;
		if(h == 0 && w == 0) break;
		
		for(int i = 1; i < 150; i++){
			for(int j = i + 1;j <= 150;j++){
				if(h == i && w == j){
				} else if(asdf(i, j, h, w) == 1){
					if(asdf(th, tw, i, j) == 1){
						th = i;
						tw = j;
					}
				
				}
			}
		}
		
		cout<<th<<" "<<tw<<endl;
		
		
	}
	
	
	return 0;
}



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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  if (v.size() == 0) {
    os << "(empty)";
    return os;
  }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

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

vector<int>f(int n){
  vector<int>r;
  for(;n;n/=10)r.push_back(n%10);
  sort(all(r));
  return r;
}

int g(vector<int>r){
  int n=0;
  for(int x:r)n=n*10+x;
  return n;
}

int main() {

  loop {
    int n; cin >> n;
    if (!n) break;
    int a=0;
    while (n>4) {
      a += n / 5;
      n /= 5;
    }
    cout << a << endl;
  }

  return 0;
}

Measured memory_bytes: 1164
/**
 *   author: Shubham Srivastava
 *   created: 02 December 2019  18:47:33
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll n;cin>>n;
    double ans = 0;
    double val = 380000.0;
    while(n--){
        double x;cin>>x;
        string s;cin>>s;
        if(s == "JPY")
            ans += x;
        else{
            double p = val*x;
            ans += p;
        }
    }
    cout<<fixed<<setprecision(6)<<ans;
return 0;
}

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

typedef long long ll;

bool desc(const pair<long, int>&i, const pair<long, int>&j)
{
    return i.first > j.first;
}




int main(){
    string s;
    cin >> s;
    int count0 = 0;
    int count1 = 0;
    /*
    string m1 = "01";
    string m2 = "10";
    int total = 0;
    while(1){
        size_t x = s.find(m1);
        if(x == string::npos)
            x = s.find(m2);
        if(x != string::npos){
            s.erase(x, 2);
            total += 2;
        }
        if(x == string::npos)
            break;
    }
    cout << total << endl;
    */
    for(int i = 0; i < s.length(); i++){
        if(s[i] == '1')
            count1++;
        if(s[i] == '0')
            count0++;
    }
    cout << 2 * min(count0, count1) << endl;
}


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


typedef long long ll; // -9,223,372,036,854,775,808 から 9,223,372,036,854,775,807

template <class T> using vec = std::vector<T>;
template <class T> using vec2 = vec<vec<T>>;
template <class T> using vec3 = vec<vec<vec<T>>>;

#define DEBUG


long long divUp(long long A, long long B){
    if(A%B == 0){
        return A/B;
    }else{
        return A/B + 1;
    }
}

void solve(long long N, long long A, long long B, long long C, long long D, long long E){
    ll m = min(A, min(B, min(C, min(D, min(E, E)))));
    ll len = divUp(N, m) + 4;
    cout << len << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    long long E;
    scanf("%lld",&E);
    solve(N, A, B, C, D, E);
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int n;
  cin >> n;
  vector<pair<f80, f80>> xy(n);
  rep(i, n) {
    int x, y;
    cin >> x >> y;
    xy[i] = make_pair(x, y);
  }
  vector<int> ord(n);
  iota(all(ord), 0);
  f80 ans = 0;
  do {
    f80 acc = 0;
    rep(i, n - 1) {
      acc += sqrt(pow(xy[ord[i + 1]].first - xy[ord[i]].first, 2) +
                  pow(xy[ord[i + 1]].second - xy[ord[i]].second, 2));
    }
    ans += acc;
  } while (next_permutation(all(ord)));
  reps(i, n) ans /= i;
  cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a;
  cin>>a;
  vector<int> b(12);
  int c=1;
  rep(i,11){
     int d=pow(26,i);
    if(i==0){
    b[i]=((a-1)%26)+97;
    }
    else{
      
    if(c<=a){
 
  b[i]=((a-c)%(d*26))/d+97;
    }
       
    }
    c+=d*26;
  }
  reverse(all(b));
  rep(i,12){
  if(b[i]!=0){
    char e=b[i];
    cout<<e;
  }
  }
 
}


Measured memory_bytes: 4188
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		while(sc.hasNext()){
			int n=sc.nextInt();
			int  num[][]=new int[n][3];
			for(int i=0; i<n; i++){
				for(int j=0; j<3; j++){
					num[i][j]=sc.nextInt();
				}
			}
			int score[]=new int[n];
			for(int i=0;i<n;i++){
				score[i]=0;
			}
			for(int j=0; j<3; j++){
				for(int i=0; i<n; i++){
					boolean flag=false;
					for(int k=i+1; k<n; k++){
						if(num[i][j]==num[k][j]){
							num[k][j]=0;
							flag=true;
						}
					}
					if(flag){
						num[i][j]=0;
					}
				}
			}
			for(int i=0;i<n;i++){
				for(int j=0;j<3;j++){
					score[i]+=num[i][j];
				}
			}
			for(int i=0;i<n;i++){
				System.out.println(score[i]);
			}
		}
	}

}

Measured memory_bytes: 22104
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF (1LL<<57)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	int h,a;
	cin>>h>>a;
	cout<<(h+a-1)/a<<"\n";
	return;	
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

// #ifndef ONLINE_JUDGE
// 	time_t time_t1, time_t2;
// 	time_t1 = clock();
// #endif

	while(T--)
	solve(T);

// #ifndef ONLINE_JUDGE
// 	time_t2 = clock();
// 	SETF();
// 	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
// 	UNSETF();
// #endif

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;



int main(){
    string s;
    cin >> s;
    int num=0;
    rep(i, s.size()){
        if(s[i]=='+') num++;
        else num--;
    }
    out(num);
}

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

int main () {
    string s; cin >> s;
    int ans = 0;
    if (s[0] == 'o') ans++;
    if (s[1] == 'o') ans++;
    if (s[2] == 'o') ans++;
    cout << ans * 100 + 700 << endl;
    return 0;
}

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

//WA
//偶数番同士，奇数番同士は自由に入れ替えられる．

int main(void){
	ll N,A[100010],ans=0;
	map<ll,ll> inv;
	scanf("%lld",&N);
	rep(i,N){
		scanf("%lld",&A[i]);
		inv[A[i]]=i;
	}
	sort(A,A+N);
	rep(i,N){
		if(inv[A[i]]%2!=i%2)ans++;
	}
	printf("%lld\n",ans/2);
	return 0;
}

Measured memory_bytes: 7296
/* AUTHOR :  SHIVANK JAIN */

#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false)
#define itt cin.tie(0)
#define now cout.tie(0)

using namespace std;

#define ll long long
#define li long int

#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define reprev(i,n,a) for(int i=n;i>=a;i--)
#define endl "\n"

#define vi vector<int>
#define vll vector<ll>
#define vpi vector< pair<int , int> >
#define mapi map<int , int>
#define mapll map<ll ,ll >
#define seti set<int> 

#define fr first
#define se second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mp make_pair
#define sort(v) sort(v.begin() , v.end())

#define BIG 1000000007
int gcd(int a, int b) 
{ // builtin function __gcd(a,b)
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
int main(){

     fast;itt;now;
 
//    #ifndef ONLINE_JUDGE
//    // for getting input from input.txt
//    freopen("input.txt", "r", stdin);
//    // for writing output to output.txt
//     freopen("output.txt", "w", stdout);
//    #endif
    
     ll x;   cin>>x;
     
       ll a , b;
       
       for(int i = -120 ; i <= 120 ; i++){
       	a = pow(i,5);
       	   for(int j = -120 ; j <= 120 ; j++){
       	   	b = pow(j,5);
       	     if(a - b == x){
       	     	cout<<i<<' '<<j<<endl;
                  return 0;
			  }	   
		   }
	   }
	   
}

Measured memory_bytes: 3980