akhauriyash/Code-Regression huggingface dataset:
mycode = r'''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。

ctypedef long long LL
from libc.stdio cimport scanf
from libcpp.vector cimport vector as vec

ctypedef vec[vec[LL]] Graph
cdef LL i,j,k,_

cdef LL N,M
scanf('%lld %lld',&N,&M)

cdef Graph graph=Graph(N)

cdef LL a,b

# この問題をあえてグラフの構造を持つことで解く
for _ in range(M):
    scanf('%lld %lld',&a, &b)
    graph[a-1].push_back(b-1)
    graph[b-1].push_back(a-1)

cdef vec[LL] ans, adj
for adj in graph:
    ans.push_back(adj.size())

print(*ans, sep='\n')

'''

import sys
import os
if sys.argv[-1] == 'ONLINE_JUDGE':  # コンパイル時
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode


Measured memory_bytes: 10188
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  int N;
  cin>>N;
  string S;
  cin>>S;

  ll sum=0;
  ll r=0,g=0,b=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      if(S[j]==S[i]) continue;
      if(S[i]!='R'&&S[j]!='R') sum+=r;
      else if(S[i]!='B'&&S[j]!='B') sum+=b;
      else if(S[i]!='G'&&S[j]!='G') sum+=g;
    }
    if(S[i]=='R') r++;
    else if(S[i]=='G') g++;
    else b++;
  }

  ll nans=0;
  for(int i=0;i<N;i++){
    for(int j=1;j<=N;j++){
      int l=i-j;
      int r=i+j;
      if(l<0||r>=N) break;
      if(S[i]!=S[l]&&S[i]!=S[r]&&S[l]!=S[r]) nans++;
    }
  }

  ll ans=sum-nans;
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  string B[n];
  for(int i=0;i<n;i++) cin >> B[i];
  int m;
  cin >> m;
  string C[m];
  for(int i=0;i<m;i++)cin >> C[i];
  int A=0;
  for(int i=0;i<n;i++){
    int sum=0;
    for(int k=i;k<n;k++){if(B[i]==B[k]) sum++;}
    for(int l=0;l<m;l++){if(B[i]==C[l]) sum--;} 
    A=max(A,sum);
  }
   cout << A <<endl;
  }
  

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int n,x,t;
	cin>>n>>x>>t;
	int val = n/x;
	if(n%x) ++val;
	cout<<val*t<<'\n';
	return 0;
}

Measured memory_bytes: 3636
import math

a, b, x = map(int,input().split())
h = x / (a*a)
if h >= (b/2):
    k = 2*h - b
    print(str(math.degrees(math.atan((b-k)/a))))
else:
    a_prime = (2*x)/(a*b)
    print(str(math.degrees(math.atan(b/a_prime))))


Measured memory_bytes: 3060
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            Map<Character, Character> characterMap = new HashMap<>();
            characterMap.put('A', 'T');
            characterMap.put('T', 'A');
            characterMap.put('G', 'C');
            characterMap.put('C', 'G');

            out.println(characterMap.get(in.next().charAt(0)));
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
            this.bufPointer = 0;
            this.bufLength = 0;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    }
}



Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
int main()
{
  
  int n;
  cin>>n;
  int arr[n+1];
  for(int i=1;i<=n;i++)
    cin>>arr[i];
  int minm[n+1];
  minm[2]=abs(arr[2]-arr[1]);
  minm[1]=0;
  for(int j=3;j<=n;j++)
  {
     minm[j]=min(minm[j-2]+abs(arr[j-2]-arr[j]),minm[j-1]+abs(arr[j-1]-arr[j]));
    
  }
  cout<<minm[n]<<endl;
  return 0;
}

Measured memory_bytes: 1024
use std::io;

fn check(input_2:i32) -> bool{
let a = input_2 % 2;
if a==0 {
  return true;
}
else{
 return false;
}

}

fn main(){
let mut input = String::new();
io::stdin().read_line(&mut input).expect("something goes wrong");
let input = input.trim().parse().expect("something goes wrong");
let b = check(input);
if b==true {
println!(0.5);
}
if b==false{
let use_input:f32 = input as f32;
let answer:f32 = ((use_input+1.0)/2.0)/use_input;
println!("{}",answer);
}
}

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

class Main {

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        
        int n = sc.nextInt();
        long ans = 0;
        
        for(long i=1; i<n; i++){
            ans += i;
        }
        
        System.out.println(ans);

    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;
    
        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }
    
        int nextInt() {
            return Integer.parseInt(next());
        }
    
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define dbg(x) cout<<#x<<" = "<<x<<endl
#define ll long long
//不要再爆long long了！！！！！！！！不要再爆long long了！！！！！！！ 

int main()
{
	string s;
	cin>>s;
	if(s[s.size()-1]=='s')s+="es";
	else s+="s";
	cout<<s<<endl;
	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
    int n;
    cin >> n;
    map<string, int> mp;
    rep(i, n){
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }

    ll ans = 0;
    for(auto& p : mp)
        ans += (ll)p.second*(p.second-1)/2;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


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

    ll ans2 = 0;
    if(n==1){cout << 0 << endl; return 0;}
    if(n==2){cout << 0 << endl; return 0;}
    vector<ll> divisor;
    for(int i = 1; i < (int)(sqrt(n))+2; i++){
        if(n%i == 0){divisor.push_back(i);}
    }

    for(int i = 0; i < divisor.size(); i++){
        if((n-divisor[i])%divisor[i] == 0){
            ll c = (n-divisor[i])/divisor[i];
            if(n/c == n%c){ans2 += c;}
        }

    }
    cout << ans2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for (int i = (a); i <= (b); ++i)
#define REPD(i,a,b) for (int i = (a); i >= (b); --i)
#define FORI(i,n) REP(i,1,n)
#define FOR(i,n) REP(i,0,int(n)-1)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define SZ(x) int((x).size())
#define DBG(v) cerr << #v << " = " << (v) << endl;
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define fi first
#define se second

int main() {
	int x;
	scanf("%d", &x);
	int n=1, m=1;
	while (m<x) {
		n++;
		m+=n;
	}
	printf("%d\n", n);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(void)
{
int  n, s, i, sum10=0, min=100,mf=0, sumn=0,j=0,jt=0;
scanf("%d",&n);

for(i=0;i<n; i++){
scanf("%d",&s);

if(s%10==0){
sum10+=s;
}else{
sumn+=s;
if(min > s){
mf=1;
min = s;
}
}

}//scan end

if(sumn==0)sum10=0;
if(min==100)min=0;
if(sumn%10==0){
sumn-=min;
}

printf("%d\n",sum10+sumn);
return 0;
}

Measured memory_bytes: 128
w, h, x, y, r = gets.split.map(&:to_i)
x1 = r
x2 = w - r
y1 = r
y2 = h - r
if x1 <= x && x <= x2 then
	if y1 <= y && y <= y2 then
		puts "Yes"
	else
		puts "No"
	end
else
	puts "No"
end

Measured memory_bytes: 8704
#include <vector>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <utility>
#include <stack>
#include <numeric>
#include <random>
#include <algorithm>
#include <queue>
#include <functional>
#include <iterator>
#include <list>
#include <unordered_map>
#include <deque>
using namespace std;

#define rep(i, b, e) for(i = b; i < e; ++i)
#define repr(i, b, e) for (i = b; i >= e; --i)
#define ull unsigned long long int
#define ll long long int
#define pint pair<int, int>

#define M_DEBUG 1
#define PI 3.141592653589793

#define E '\n'

#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << "\n";}
#define INF (1e18)

const ll MAX = 1000000000;
const ll MOD = 1e9 + 7;

ull a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;

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

ll aabs(ll a) {
    if (a < 0) return -a;
    return a;
}

//fast power
ll calc(ll a, ll b) {
    if (b == 0) return 1;
    else if (b % 2 == 0) {
        ll d = calc(a, b / 2);
        return (d * d) % MOD;
    }
    else return (a * calc(a, b - 1)) % MOD;
}

//fast combination
ll comb(ll n, ll a) {
    ll b = 1, c = 1;
    for (ll i = 1; i <= a; ++i) {
        b = b * i % MOD;
        c = c * (n - i + 1) % MOD;
    }

    return c * calc(b, MOD - 2) % MOD;
}

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    vector<ll> aa(n);
    vector<ll> bb(n);
    vector<ll> cc(n);
    vector<vector<ll> > dp(n + 1, vector<ll>(3, 0));
    rep(i, 0, n) cin >> aa[i] >> bb[i] >> cc[i];

    rep (i, 0, n) {
        chmax(dp[i + 1][1], dp[i][0] + bb[i]);
        chmax(dp[i + 1][2], dp[i][0] + cc[i]);
        chmax(dp[i + 1][0], dp[i][1] + aa[i]);
        chmax(dp[i + 1][2], dp[i][1] + cc[i]);
        chmax(dp[i + 1][0], dp[i][2] + aa[i]);
        chmax(dp[i + 1][1], dp[i][2] + bb[i]);
    }



    ll res = 0;
    rep(i, 0, 3) chmax(res, dp[n][i]);

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
const int maxn = 5e5 + 50;
typedef pair<int, int> P;

int arr[maxn];
int a, b, c, d, e, f, g;
void solve();
int main()
{
	int t = 1;
//	cin >> t;
	for(int i=0; i<t; i++)
	{
		solve();
	}
	return 0;
}

// type below

void solve()
{
	cin >> a >> b >> c;
	int cnt[a + 50] = {0};
	for(int i=1; i<=a; i++)
	{
		for(int j = i + 1; j <= a; j++)
		{
			int tmp = min(j - i, abs(b - i) + 1 + abs(c - j));
			cnt[tmp] ++;
		}
	}
	for(int i=1; i<a; i++)
		cout << cnt[i] << '\n';
	return;		 
}

Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String ns = sc.next();
    String[] s = ns.split("");
    int count = 0;
    for (int i = 0; i < s.length; i++) {
      if (Integer.parseInt(s[i]) == 1) {
        count++;
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 35588
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int64_t p=1000000007;
  int64_t n;
  cin >> n;
  int64_t k[62];
  k[0]=1;
  rep(i,61){
    k[i+1]=k[i]*2%p;
  }
  int64_t o[n];
  rep(i,n){
    cin >> o[i];
  }
  int64_t ans=0;
  rep(i,61){
    int64_t cnt=0;
    int64_t y=1;
    rep(m,i){
      y*=2;
    }
    bitset<61> z(y);
    rep(j,n){
      bitset<61> x(o[j]);
      bitset<61> s;
      s=x&z;
      if(s.any()){
        cnt++;
      }
        
    }
    ans+=((cnt*(n-cnt))%p)*k[i]%p;
  }
  cout << ans%p << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define INF 1000000
#define watch(x) cout << setw(10) << "[" << (#x) << ":] " << (x) 
#define FORE(i,v,n) for(int i=v;i<n;i++)
#define FORI(i,v,n) for(int i=v;i<=n;i++)
       
using namespace std;

int const MOD = 1000000007;

int test_case(){
    int h;
    cin >>h;
    int sum=0;
    int r = h%500;
    sum = h/500;
    sum = sum*1000;
    sum += (r/5)*5;
    cout << sum;

    return 0;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int test=1;
	//cin >> test;
	for(int i=0;i<test;i++){
		//cout << "Case " << i << endl;
		test_case();
	}
	return 0;
}



Measured memory_bytes: 256
//-- Araz Jabrayilov --
//-- araz17---zuna#1041 --

#include <bits/stdc++.h>

#define ll long long
#define endl '\n'
#define F first
#define S second

using namespace std;

int a[100005];
int cnt[100005];

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

    int n = 0; int ans = 0;

    cin >> n;

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

    for(int i = 0; i <= 100000; i++){
        int sum = cnt[i-1] + cnt[i] + cnt[i+1];
        ans = max(sum , ans);
    }

    cout << ans << endl;


    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a.at(i);
    ll ans = 0;
    ll sum = 0;
    rep(i, n){
        sum += a.at(i);
        sum %= 1000000007;
    } 
    for(int i = 0; i < n; i++){
        sum -= a.at(i);
        if(sum < 0) sum += 1000000007;
        ans += (ll)a.at(i)*sum;
        ans %= 1000000007;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1e18 : 1e9;
const int MOD = 1000000007;
const long double EPS = 1e-8;

int main() {
	int n, r;
	while(cin >> n >> r, n) {
		vector <int> yama;
		rep (i, n) yama.push_back(n - i);
		rep (i, r) {
			int p, c;
			cin >> p >> c;
			rep (j, c) {
				int tmp = yama[p + c - 2];
				yama.erase(yama.begin() + p + c - 2);
				yama.insert(yama.begin(), tmp);
			}
		}
		cout << yama.front() << endl;
	}
	return 0;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ff first 
#define ss second  
typedef pair<int,int> pp;
bool com(pp x,pp y){
    return x.ff<y.ff;
} 
const int N=1e5+9;
int n;
int a[N],b[N],c[N];
vector<vector<ll>> dp(N,vector<ll> (4,0));
ll f(int m,int x){
    if(m>n) return 0;
    if(x!=-1&&dp[m][x]!=0){
        //cout<<m<<" "<<x<<endl;
        return dp[m][x];   
    }
    if(x==0){
        return dp[m][x]=max(b[m]+f(m+1,1),c[m]+f(m+1,2));
    }
    if(x==1) return dp[m][x]=max(a[m]+f(m+1,0),c[m]+f(m+1,2));
    else if(x==2) return dp[m][x]=max(a[m]+f(m+1,0),b[m]+f(m+1,1));
    return max(a[m]+f(m+1,0),max(b[m]+f(m+1,1),c[m]+f(m+1,2)));
}
void solve(){
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i]>>b[i]>>c[i];
    ll ans=f(0,-1);
    cout<<ans;
}
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--) 
	    solve();
	return 0; 
	
}


Measured memory_bytes: 19216
N,M,K = map(int, input().split())

NG_flag = True

for i in range(0,N+1):
    for j in range(0,M+1):
        if i*M + j*N - 2*i*j == K:
            NG_flag = False
            print("Yes")
            break
    
    if NG_flag == False:
        break
else:
    print("No")

Measured memory_bytes: 9184
N=int(input())
s=[]
for i in range(N):
    S=input()
    s.append(S)

sm=0

for i in range(N):
    count=0
    tmp=-1
    for j in range(len(s[i])):
        if s[i][j]=="A":
            tmp=1
        elif s[i][j]=="B":
            if tmp==1:
                count+=1
            tmp=-1
        else:
            tmp=-1
    sm+=count
chk=[0 for _ in range(N)]
for i in range(N):
    if s[i][0]=="B" and s[i][-1]=="A":
        chk[i]=3
    elif s[i][-1]=="A":
        chk[i]=2
    elif s[i][0]=="B":
        chk[i]=1
x=0
y=0
z=0
#print(sm)
ans=sm
for i in range(N):
    if chk[i]==3:
        z+=1
    if chk[i]==2:
        x+=1
    if chk[i]==1:
        y+=1
if z>0:
    a=z-1
    ans+=a
    if x>0:
        ans+=1
        x-=1
    if y>0:
        ans+=1
        y-=1
ans+=min(x,y)
print(ans)

Measured memory_bytes: 47064
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};



int main(){
    LL k,q;cin >> k >> q;
    vector<LL> d(k);
    for (int i = 0; i < k; i++) {
        cin >> d[i];
    }
    while(q--){
        LL n,x,m;cin >> n >> x >> m;
        auto dd = d;
        LL S = 0;
        LL ans = n - 1;
        for (int i = 0; i < k; i++) {
            dd[i] %= m;
            if(dd[i] == 0) dd[i] = m;
            S += dd[i];
        }
        LL sum = x % m + (n - 1) / k * S;
        for (int i = 0; i < (n - 1 + k) % k; i++) {
            sum += dd[i];
        }
        ans -= sum / m;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int A, B, K;
    vector<int> v;
    
    cin >> A >> B >> K;
    for(int i = 1; i <= min(A, B); i++)
        if(A % i == 0 && B % i == 0)
            v.push_back(i);
            
    cout << v[v.size()-K] << endl;
    
    return 0;
}


Measured memory_bytes: 256
s=input()
t=input()

if len(s)<len(t):
    print("UNRESTORABLE")
    exit()

sub=[]
for i in range(len(s)-len(t)+1):
    t_in_s = False
    part_s = s[i:i+len(t)]
    for g in range(len(t)):
        if part_s[g]==t[g] or part_s[g]=="?":
            t_in_s=True
            continue
        else:
            t_in_s=False
            break
    if t_in_s is True:
        sub.append(s[:i]+t+s[i+len(t):])

if sub==[]:
    print("UNRESTORABLE")
    exit()

for l in range(len(sub)):
    sub[l]=sub[l].replace("?","a")

sub.sort()
print(sub[0])

Measured memory_bytes: 3064
#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 A, B, K;
    cin >> K >> A >> B;

    if(B%K <= B-A) cout << "OK" << endl;
    else cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3612
#include<stdio.h>
#define N 2000001
int A[N],B[N],n;

void CountingSort(int k){
  int C[k+1],i,j;
  for (i=0; i<k; i++){
    C[i]=0;
  }

  for (j=1;j<=n;j++){
    C[A[j]]++;
  }

  for (i=1;i<k;i++){
    C[i] += C[i-1];
  }

  for (j=n; j>=1; j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
}


int main(){
  int i,key=0;
  scanf("%d",&n);
  for (i=1;i<=n;i++){
    scanf("%d",&A[i]);
    if (key<A[i]){
      key=A[i];
    }
  }
  CountingSort(key+1);

  for (i=1;i<=n;i++){
    if (i!=1){
      printf(" ");
    }
    printf("%d",B[i]);
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 16264
#include <iostream>

using namespace std;
typedef long long ll;

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

    ll n2 = n;
    ll sn = 0;
    while(n2 > 0){
        sn += n2 % 10;
        n2 /= 10;
    }

    if(n % sn == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 888
// author : ksumit

// jo darr gya vo gya

#include<unordered_map>
#include<bits/stdc++.h>
typedef long long ll;

bool isPrime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0) return 0;
	}
	return 1;
}

using namespace std;

void solve() {
	double n, x, t;
	cin >> n >> x >> t;
	ll ans =  ceil(n / x) * t;
	cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	// i// nt tt;
// // 	cin >> tt;
// // 	while (tt--)
		solve();
}

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


int main()
{
  long long n,x,y;
  cin>>n>>x>>y;
  x--;
  y--;
  vector<long long> cnt(n, 0);
  for(int i=0; i<n-1; i++)
  {
      for(int j = i+1; j<n; j++)
      {
          long long k;
          long long a = abs(x-i) + 1 + abs(y-j);
          long long b = abs(y-i) + 1 + abs(x-j);
          long long mini = abs(j-i);
          k = min(mini, min(a,b));
          cnt[k]++;
      }
  }
  for(int i=1; i<n; i++)
     cout<<cnt[i]<<"\n";
    return 0;


     }




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

Measured memory_bytes: 572
n = input()
if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
  print("hon")
elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6"  or n[-1] == "8":
  print("pon")
else:
  print("bon")

Measured memory_bytes: 9120
import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		Scanner scan = new Scanner(System.in);
		String answer = "";
		String temp = "";
		
		while(true){
			temp = scan.next();
			if(temp.equals("-")){
				break;
			}
			char[] targetChar = temp.toCharArray();
			int targetLength = temp.length();
			int shuffleTimes = scan.nextInt();
			int shuffleBegin = 0;

			for(int i =0; i<shuffleTimes; i++){
				shuffleBegin = scan.nextInt();
				answer = "";

				for(int j=0; j<(targetLength - shuffleBegin) ; j++){
					answer = answer + targetChar[j + shuffleBegin];
				}
				for(int j=0; j<shuffleBegin; j++){
					answer = answer + targetChar[j];
				}
				targetChar = answer.toCharArray();
			}
			System.out.println(answer);
		}
	}
}

Measured memory_bytes: 45880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
   ll n, d;
   cin >> n >> d;
   ll count = 0;
   while(n--){
      ll a,b;
      cin >> a >>b;
      long double x = pow(a, 2);
      long double y = pow(b, 2);
      long double temp;
      temp = x+y;
      //cout << x << endl;
      //cout << y << endl;

      //cout << temp << endl;
      long double j;
   
      j = sqrt(temp);
      //cout << j << endl;
      //long double h = round(j);
      
      if(temp<=d*d){
         count++;
         //cout << count << endl;


      }
      

   }
   cout << count<< endl;

   
      
      
}

Measured memory_bytes: 3652
n=int(input())
p=list(map(int,input().split()))
count=0
for i in range(n-2):
  A=[]
  for j in range(3):
    A.append(p[i+j])
  sort_A=sorted(A)
  if sort_A[1]==A[1]:
    count+=1
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<long long> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	long long sum = accumulate(a.begin(), a.end(), 0ll);
	sum -= a.back();
	for(int i = n - 2; i >= 0; i--){
		if(2 * sum >= a[i + 1]){
			sum -= a[i];
		} else {
			cout << n - i - 1 << endl;
			return 0;
		}
	}
	cout << n << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;

map<int,int> prime_factor(int n){
  map<int,int> mp;
  for(int i=2;i*i<=n;i+=2){
    while(n%i==0){
      mp[i]++;
      n/=i;
    }
    if(i==2) i--;
  }
  if(n!=1) mp[n]=1;
  return mp;
}



signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int ans=0;
  repi(i,1,n){
    map<int,int> mp;
    mp=prime_factor(i);
    int num=1;
    for(auto itr=mp.begin();itr!=mp.end();itr++){
      num*= itr->S+1;
    }
    ans+=num;
    //cout<<ans<<endl;
  }
  cout<<ans<<endl;

  return 0;
}


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

int main() {
    int N, M;
    cin >> N;
    vector<string> vn(N);
    for (auto& i : vn) cin >> i;
    cin >> M;

    bool flag = false;
    while (M--) {
        string s;
        cin >> s;
        if (find(vn.begin(), vn.end(), s) != vn.end()) {
            if (flag) cout << "Closed by " << s << endl;
            else cout << "Opened by " << s << endl;

            flag = !flag;
        } else {
            cout << "Unknown " << s << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 3212
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n, t, s;
	cin >> n >> t>> s;
	vector<int> a(n);
	vector<int> b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	vector<vector<int> > dp(t+1, vector<int>(n+1, 0));
	int si = 1;
	for (int i = 0; i <= t; i++) {
		int jou = s;
		if (i <= s) {
			jou = 0;
		}
		for (int j = 0; j < n; j++) {
			if (i - b[j] >= jou) {
				dp[i][j + 1] = max(dp[i - b[j]][j]+a[j], dp[i][j]);
			}
			else {
				dp[i][j + 1] = dp[i][j];
			}
			if (i >= 1) {
				dp[i][j + 1] = max(dp[i][j + 1], dp[i - 1][j + 1]);
			}
		}
	}
	int ans =0;
	for (int i = 0; i <= n; i++) {
		ans = max(dp[t][i], ans);
	}
	cout << ans << endl;
	cin >> n;
	return 0;
}



Measured memory_bytes: 38276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    int N; cin >> N;
    ll K; cin >> K;
    vector<vector<int>> to(60, vector<int>(N + 1));
    for (int j = 1; j <= N; j++) {
        cin >> to[0][j];
    }

    for (int i = 1; i < 60; i++) {
        for (int j = 1; j <= N; j++) {
            to[i][j] = to[i - 1][to[i - 1][j]];
        }
    }

    int v = 1;
    for (int i = 59; i >= 0; i--) {
        ll l = 1LL << i;
        if (l <= K) {
            v = to[i][v];
            K -= l;
        }
    }

    cout << v << endl;
    return 0;
}

Measured memory_bytes: 51012
#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>;
#define chmax(x,y) x = max(x,y)
 
const ll INF = 1e18;
 
ll dp[200005][4];
 
int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int k = 1+n%2;
  rep(i,n+1)rep(j,k+1) dp[i][j] = -INF;
  dp[0][0] = 0;
  rep(i,n) {
    rep(j,k+1) {
      chmax(dp[i+1][j+1], dp[i][j]);
      ll now = dp[i][j];
      if ((i+j)%2 == 0) now += a[i];
      chmax(dp[i+1][j], now);
    }
  }
  ll ans = dp[n][k];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 10372
import java.util.Scanner;

class Main {
	static int d;
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a,b,result;
		String op;
		roup:{
			while(true){
				a = scanner.nextInt();
				op =scanner.next();
				b = scanner.nextInt();

				switch(op){
				case "+":
					result = a+b;
					break;
				case "-":
					result = a-b;
					break;
				case "*":
					result = a*b;
					break;
				case "/":
					result = a/b;
					break;
				default:
					break roup;
				}
				System.out.println(result);
			}
		}

	}
}


Measured memory_bytes: 26232
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll N, P;
    cin >> N >> P;
    vector<ll> A(N);
    bool flag =false;
    rep(i, N) {
        cin >> A[i];
        if (A[i] % 2 == 1) {
            flag = true;
        }
    }
    if (flag) print((ll)pow(2, N-1));
    else {
        if (P == 0) {
            print((ll)pow(2, N));
        } else {
            print(0);
        }
    }



    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Node> al[] = new ArrayList[n];
        for (int i = 0; i < n; i++) {
            al[i] = new ArrayList<>();
        }
        for (int i = 0; i < n - 1; i++) {
            int u = sc.nextInt() - 1;
            int v = sc.nextInt() - 1;
            int w = sc.nextInt();
            al[u].add(new Node(v, w));
            al[v].add(new Node(u, w));
        }
        int dis[] = new int[n];
        ArrayDeque<Integer> stack = new ArrayDeque<>();
        stack.push(0);
        boolean[] visited = new boolean[n];
        visited[0] = true;
        dis[0] = 0;
        while (!stack.isEmpty()) {
            int pos = stack.pollFirst();
            for (Node node : al[pos]) {
                if (!visited[node.next]) {
                    dis[node.next] = dis[pos] + node.cost;
                    stack.push(node.next);
                    visited[node.next] = true;
                }
            }
        }
        for (int i = 0; i < n; i++) {
            if (dis[i] % 2 == 0) {
                System.out.println(0);
            } else {
                System.out.println(1);
            }
        }
        sc.close();
    }
}

class Node {
    int next;
    int cost;

    Node(int n, int c) {
        this.cost = c;
        this.next = n;
    }
}


Measured memory_bytes: 109288
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define rup(x, y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll LINF = 4e18;

int a, b, c, d;
map<ll, ll> mp;
map<int, int> cost;

ll calc(ll s, ll g, int p) {
    ll k = abs(g * p - s);
    boost::multiprecision::cpp_int a = 1, b = 1;
    a *= k; a*= cost[1]; a += cost[p];
    b *= abs(s - g); b *= cost[1];
    return (ll)min(a, b);
}

ll f(ll n) {
    if (mp.find(n) != mp.end())
        return mp[n];
    if (n == 1)
        return mp[1] = cost[1];
    
    vector<int> v = {2, 3, 5};
    ll ret = LINF;
    for (auto p : v) {
        ll l = n / p, r = rup(n, p);
        if (l == 0)
            ret = min(ret, calc(n, r, p) + f(r));
        else
            ret = min(ret, min(calc(n, l, p) + f(l), calc(n, r, p) + f(r)));
    }
    mp[n] = ret;
    return ret;
}

int main() {
    int t;
    cin >> t;
    vector<ll> ans(t);
    for (int i = 0; i < t; i++) {
        ll n;
        cin >> n >> a >> b >> c >> d;
        
        cost.clear();
        cost[1] = d;
        cost[2] = a;
        cost[3] = b;
        cost[5] = c;
        mp.clear();
        f(n);
        ans[i] = mp[n];
    }
    
    for (int i = 0; i < t; i++)
        cout << ans[i] << endl;
    
    return 0;
}


Measured memory_bytes: 4344
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

signed main(void){
    int n; cin>>n;
    vector <int> a(n);
    rep(i,n) cin>>a[i];
    vector <int> cum(n+1);
    cum[0] = 0;
    rep(i,n){
        cum[i+1] = cum[i]+a[i];
    }
    int ans = INF;
    rep(i,n+1){
        // cum[n]-cum[i], cum[i]
        if(i == 0 || i == n) continue;
        ans = min(ans, abs((cum[n]-cum[i]) - cum[i]));
        //cout<<(cum[n]-cum[i])<<' '<< cum[i]<<endl;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3328
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define EPS 1e-9
 
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::queue;
using std::priority_queue;
using std::stack;
using std::map;
using std::pair;
using std::string;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

struct Cake{
    int index,area,d,w;

    Cake(int index0, int area0, int d0, int w0){
        index = index0;
        area = area0;
        d = d0;
        w = w0;
    }
};

// 大きいものからpriority_queueで取れる
bool operator< (const Cake &cake1, const Cake &cake2){
    if(cake1.index != cake2.index)
        return cake1.index > cake2.index;
    else
        return cake1.area > cake2.area; 
};

int main(){
    int n,w,d,p,s;
    scanf("%d %d %d", &n, &w, &d);

    while(n + d + w != 0){
        priority_queue<Cake> que, tmp;
        que.push(Cake(0, d*w, d, w));

        rep(n){
            scanf("%d %d", &p, &s);

            repp(j, p-1){
                Cake c = que.top();
                // printf("Cake(%d %d %d %d)\n", c.index, c.area, c.w, c.d);
                tmp.push(c);
                que.pop();
            }
            Cake c = que.top(); que.pop();
            // printf("Cake(%d %d %d %d)\n", c.index, c.area, c.w, c.d);

            // 2つのピースに分けて，queに2つともぶっっこむ
            s %= (c.w + c.d);
            if(s < c.w){
                if(s != 0)   que.push(Cake(i+1, c.d*s, c.d, s));
                if(s != c.w) que.push(Cake(i+1, c.d*(c.w-s), c.d, c.w-s));
            }else{
                s -= c.w;
                if(s != 0)   que.push(Cake(i+1, s*c.w, s, c.w));
                if(s != c.d) que.push(Cake(i+1, (c.d-s)*c.w, (c.d-s), c.w));
            }

            while(!tmp.empty()){
                que.push(tmp.top());
                tmp.pop();
            }
        }
        
        vector<int> ans;
        while(!que.empty()){
            Cake c = que.top(); que.pop();
            ans.push_back(c.area);
        }
        sort(all(ans));
        rep((int)ans.size()-1) printf("%d ", ans[i]);
        printf("%d\n", ans.back());

        scanf("%d %d %d", &n, &w, &d);
    }
    return 0;
}



Measured memory_bytes: 3140
/*
sonu_verma1
*/
#include <bits/stdc++.h>
// For policy based data structure
/*#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> */
using namespace std;
/*using namespace __gnu_pbds; 
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set;*/
 
#define MD 1000000007
#define X first
#define Y second
#define pb push_back
#define debug(val, ch) cout <<val <<ch
#define FOR(i, st, en, ch) for(register int i = (st); i <= (en) ; i += (ch))
#define RFOR(i, st, en, ch) for(register int i = (st); i >= (en) ; i -= (ch))
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
 
typedef long long int ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<int, bool> pib;
typedef pair<bool, int> pbi;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
/*********************************************************************/
void test(int r)
{
    int n,k;
    cin>>n>>k;
    vector<int>h(n);
    int i,j;
    for(i=0;i<n;i++)
        cin>>h[i];
    vector<int>dp(n,INT_MAX);
    dp[0]=0;
    for(i=1;i<n;i++)
    {
        for(j=1;j<=k&&(i-j)>=0;j++)
        {
            dp[i]=min(dp[i],abs(h[i]-h[i-j])+dp[i-j]);
        }
    }
    cout<<dp[n-1]<<endl;
    

}
/***********************************************************************/
int main()
{
    fast();
    int t=1,r;
    // cin>>t;
    for(r=1;r<=t;r++)
        test(r);
    return 0;
}

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

using namespace std;

int main(){
  int N; cin>>N;
  vector<int> v(N);
  for(int i=0;i<N;i++) cin>>v[i];
  sort(v.begin(),v.end());
  int l=v[N-1];
  int sum=0;
  for(int i=0;i<N-1;i++){
    sum+=v[i];
  }
  if(l<sum)cout<<"Yes";
  else cout<<"No";
  cout<<endl;

  return 0;
}


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

string f[8];
int dx[12] = {0,0,0,-1,-2,-3,0,0,0,1,2,3};
int dy[12] = {-1,-2,-3,0,0,0,1,2,3,0,0,0};

void bomb(int x, int y){
	for(int i=0 ; i < 12 ; i++ ){
		int mx = x + dx[i];
		int my = y + dy[i];
		if( mx < 0 || my < 0 || mx >= 8 || my >= 8 ) continue;
		if( f[my][mx] == '1' ){
			f[my][mx] = '0';
			bomb( mx , my );
		}
	}
}

int main(){
	int n;
	cin >> n;
	for(int t=1 ; t <= n ; t++ ){
		int x,y;

		for(int i=0 ; i < 8 ; i++ ){
			cin >> f[i];
		}
		cin >> x >> y;
		x--;
		y--;
		f[y][x] = '0';
		bomb( x , y );
		cout << "Data " << t << ":" << endl;
		for(int i=0 ; i < 8 ; i++ ){
			cout << f[i] << endl;
		}
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll,ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(),v.end())
#define ull unsigned long long
#define tell(a) cout<<a<<" "
#define el cout<<endl
#define rev(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 1000000007
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){   if (y & 1)res = (res*x) % p;y = y>>1;
x = (x*x) % p;}return res;}



int main()
{
	IOS;
	int n;
	string s;
	cin>>n>>s;
	int i=0,ans=0;
	while(i<s.size())
	{
		int k=i;
		while(i<s.size()&&s[i]==s[k])
		i++;
		ans++;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 512
#include <iostream>
#include <cstring>

using namespace std;

int retnum[11][10000];
bool isused[10];

void filling(int size, int depth, int sum){
     int tmp;
    
     //cout << "begin = " << begin << " depth = " << depth << " sum = " << sum << endl;
     if(size == depth-1){
	   retnum[size][sum]++;
	   return;
	 }
	 //cout << "retnum[" << depth << "][" << sum+begin*depth << "] = " << retnum[depth][sum+begin*depth] << endl;
     for(int i=0;i<=9;i++){
          if(!isused[i]){
               isused[i] = true;
               filling(size,depth+1,sum+i*depth);
               isused[i] = false;
          }
     }
}

int main(void){
    
     memset(retnum, 0, sizeof(retnum));
     memset(isused, false, sizeof(isused));

     for(int i=1;i<=10;i++){
          filling(i,1,0);
		  int tmp;
		  //cin >> tmp;
     }
    
     int n,m;
     while(cin >> n >> m){
          cout << retnum[n][m] << endl;
     }
}

Measured memory_bytes: 1180
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    int b,r,f,v;
    int count[5][4][11]={};
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>b>>f>>r>>v;
        count[b][f][r]+=v;
        }
    for(int i=1;i<5;i++){
        for(int j=1;j<4;j++){
            for(int k=1;k<11;k++){
                cout<<" "<<count[i][j][k];
            }
            cout<<endl;
        }
        
        if(i<4){
            cout<<"####################"<<endl;
        }
        
    }
    
}



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

int n, a[303000];

void chk(int l,int r){
    if (l==r){
        puts("No"); exit(0);
    }
    int mx[2]={0,0};
    for (int i=l;i<=r;i+=2){
        int &t=mx[a[i]>i];
        if (a[i]<l||a[i]>r||a[i]<t){
            puts("No"); exit(0);
        }
        t=a[i];
    }
}

int main(){
    cin>>n;
    int l=0, las=-2;
    for (int i=1;i<=n;++i){
        cin>>a[i];
        if (a[i]==i) continue;
        if (las==i-2){
            las=i;
        }else{
            if (l) chk(l,las);
            l=las=i;
        }
    }
    if (l) chk(l,las);
    puts("Yes");
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

struct edge{
  int t;
  int d;
  int c;
};

int main(){
  while(1){
    int n,m;
    cin >> n >> m;
    if(n==0) return 0;
    int s,g;
    cin >> s >> g;
    s--,g--;
    vector<vector<edge>> e(n);
    int x,y,d,c;
    for(int i=0;i<m;i++){
      cin >> x >> y >> d >> c;
      x--,y--;
      e[x].push_back({y,d,c});
      e[y].push_back({x,d,c});
    }
    vector<vector<vector<LD>>> dp(n,vector<vector<LD>>(n,vector<LD>(31,INF)));
    priority_queue<pair<LD,pair<int,pair<int,int>>>> dijk;
    for(auto ed:e[s]){
      dijk.push({-ed.d,{ed.t,{s,1}}});
    }
    pair<LD,pair<int,pair<int,int>>> now;
    while(!dijk.empty()){
      now=dijk.top();
      dijk.pop();
      LD ti=-now.first;
      int ns=now.second.first;
      int ps=now.second.second.first;
      int sp=now.second.second.second;
      if(dp[ns][ps][sp]==INF){
        dp[ns][ps][sp]=ti;
        for(auto ed:e[ns]){
          if(ed.t==ps) continue;
          if(sp+1<=ed.c){
            if(dp[ed.t][ns][sp+1]==INF){
              dijk.push({-ti-(LD)ed.d/(sp+1),{ed.t,{ns,sp+1}}});
            }
          }
          if(sp<=ed.c){
            if(dp[ed.t][ns][sp]==INF){
              dijk.push({-ti-(LD)ed.d/sp,{ed.t,{ns,sp}}});
            }
          }
          if(sp>1&&sp-1<=ed.c){
            if(dp[ed.t][ns][sp-1]==INF){
              dijk.push({-ti-(LD)ed.d/(sp-1),{ed.t,{ns,sp-1}}});
            }
          }
        }
      }
    }
    LD ans=INF;
    for(int i=0;i<n;i++){
      for(int j=1;j<=30;j++){
        ans=min(ans,dp[g][i][1]);
      }
    }
    if(ans==INF) cout << "unreachable" << endl;
    else cout << fixed << setprecision(10) << ans << endl;
  }
  return 0;
}



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

typedef long long ll;
using namespace std;

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

  int counter = X/100;
  int mo = X%100;

  int now = 0;

  for(int i = 5; i > 0; i--){
    now += mo/i;
    mo = mo%i;
  }
  if(counter >= now) cout<<1;
  else cout<<0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。(int64_t)
int main(){
    int N;
    cin >> N;
    int all = 1;
    int count = 1;
    int A[N];
    for(int i = 0; i < N; i++){
       cin >> A[i];
       all *= 3;
       if(A[i] % 2 == 0){
           count*=2;
       }
    }
   cout << all - count << endl; 
}

Measured memory_bytes: 256
def calc_k_constP(P):
    tmp_total_w = 0
    tmp_k = 1
    for w in w_s:
        tmp_total_w += w
        if tmp_total_w > P:
            tmp_k += 1
            tmp_total_w = w

    return tmp_k

n, k = map(int, input().split(' '))
w_s = [int(input()) for i in range(n)]

max_w = max(w_s)

left, right = max_w, 10000 * n
while left < right:
    mid = (right + left) // 2
    tmp_k = calc_k_constP(mid)
    if tmp_k <= k:
        right = mid
    else:
        left = mid + 1

print(left)


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

#define rep(i, n) for(int i = 0; i < (n); i++)
using LL = long long;
using ULL = unsigned long long;


void solve() {
	int x, y; cin >> x >> y;
	int p = 0;
	if (x == 1) p += 300000;
	if (x == 2) p += 200000;
	if (x == 3) p += 100000;
	if (y == 1) p += 300000;
	if (y == 2) p += 200000;
	if (y == 3) p += 100000;
	if (x == 1 && y == 1) p += 400000;

	cout << p << endl;
}

int main() {

	solve();

	return 0;
}


Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<map>
#include<string>
#include<numeric>
#include<set>
using namespace std;

int main(){
    long a, b;
    cin >> a >> b;

    if((a+b)%2 == 0) cout << (a+b)/2 << endl;
    else cout << "IMPOSSIBLE" << endl;

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    S=set(input())
    a=ord('a')
    for i in range(26):
        if not chr(a+i) in S:
            print(chr(a+i))
            exit()
    print('None')

if __name__ == '__main__':
    main()


Measured memory_bytes: 45296