akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n, t, a;
  cin >> n >> t >> a;
  int ans;
  double diff = (double)1e+9;
  rep(i,n) {
    int h = in();
    double avg = (double)t - h*0.006;
    if (diff + EPS > abs(avg - a)) {
      diff = min(diff, abs(avg - a));
      ans = i + 1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  int n,m;
  cin >> n >> m;
  int ans = (n*(n-1)/2) + (m*(m-1)/2);
  cout << ans << endl;

return 0;
}
///....


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

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


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

    ll N,K;
    cin >> N >> K;
    if(N <= K){
        cout << 0 << endl;
        return 0;
    }

    vector<int> a(N);
    rep(i,N) cin >> a[i];
    sort(a.begin(),a.end());

    ll ans = 0;
    rep(i,N-K) ans += a[i];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1656
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		char[] a = str.toCharArray();
		if (a[2] == a[3] && a[4] == a[5]) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 21716
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::cmp::Ordering;

#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}
impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

fn main() {
    input! {
        vals: [u64; 3],
    }
    let mut vals = vals;
    vals.sort_by_key(|&x| Rev(x));
    let mut ans = 0;
    let mut now = vals[0];
    for val in vals {
        ans = ans + (now - val);
        now = val;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
using namespace std;


int main() {
	
	int size;

	cin >> size;

	bool S[13];
	bool H[13];
	bool C[13];
	bool D[13];

	for (int i = 0; i < 13; i++) {
		S[i] = false;
		H[i] = false;
		C[i] = false;
		D[i] = false;
	}

	char mark;
	int num;

	for (int i = 0; i < size; i++) {
		cin >> mark >> num;

		if (mark == 'S') {
			S[num - 1] = true;
		}
		else if (mark == 'H') {
			H[num - 1] = true;
		}
		else if (mark == 'C') {
			C[num - 1] = true;
		}
		else {
			D[num - 1] = true;
		}
	}

	for (int i = 0; i < 13; i++) {
		if (!S[i])printf("S %d\n", i + 1);
	}
	for (int i = 0; i < 13; i++) {
		if (!H[i])printf("H %d\n", i + 1);
	}
	for (int i = 0; i < 13; i++) {
		if (!C[i])printf("C %d\n", i + 1);
	}
	for (int i = 0; i < 13; i++) {
		if (!D[i])printf("D %d\n", i + 1);
	}



	//system("pause");
	return 0;
}


Measured memory_bytes: 3192
eval'A,B,*C=#'+`tr ' ' ,`
z=x=0
C.map{x^=_1}
999.times{45.downto(0){|i|x[i]!=A[i]^B[i]&&(z+=t=[A[0,i]+1,2**i-B[0,i]].min
A-=t
B+=t)}}
p A>0?z:-1

Measured memory_bytes: 14864
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n;
    long long K;
    cin >> n;
    cin >> K;

    vector<long long> A(n);
    long long mx = 0;
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
        mx = max(mx, A[i]);
    }


    auto ok = [&](long long x) {
        long long res = 0;

        for (auto L : A) {
            long long y = (L + x - 1) / x;
            --y;
            res += y;
        }

        return res <= K;
    };

    long long lo = 1, hi = mx;

    while (lo < hi) {
        auto mi = (lo + hi) / 2;
        if (ok(mi)) {
            hi = mi;
        } else {
            lo = mi + 1;
        }
    }


    cout << lo << '\n';

    return 0;
}

Measured memory_bytes: 4656
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N, T = map(int, input().split())
    end = 0
    ans = 0
    for t in list(map(int, input().split())):
        ans += (t + T) - max(t, end)
        end = t + T
    print(ans)


if __name__ == '__main__':
    main()


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;

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

    int N; cin >> N;
    string S[2]; cin >> S[0] >> S[1];
    ll ans = 1;
    int x = 0;
    int pre = -1;
    while (x < N) {
        if (S[0][x] == S[1][x]) {
            if (pre < 0) ans = 3;
            else if (pre == 0) ans *= 2;
            x++; pre = 0;
        } else {
            if (pre < 0) ans = 6;
            else if (pre == 0) ans *= 2;
            else ans *= 3;
            x += 2; pre = 1;
        }
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	int n; cin >> n;
	vector<int>a(n); for (auto&& x : a)cin >> x;
	long long ans = 0; int right = 0, sum = 0;
	for (int left = 0; left < n; left++) {
		while (right < n && (sum ^ a[right]) == sum + a[right]) {
			sum += a[right++];
		}
		ans += right - left;
		if (left == right)right++;
		else sum -= a[left];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
  n <- getInt
  (t:ts) <- replicateM n getInt

  let d = foldr lcm t ts

  print d

Measured memory_bytes: 636
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;


long long int N, M, K, H, W, L, R, V, E;

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

	vector<int>ans;
	cin >> N >> M >> K >> E >> L >> R;
	while (N) {
		vector<int>ice(N);
		vector<vector<int>>edge(N, vector<int>(N,MOD));
		ice[L] = 1;
		ice[R] = 1;
		for (int i = 0; i < K; i++) {
			int a;
			cin >> a;
			ice[a] = 1;
		}
		for (int i = 0; i < E; i++) {
			int a, b, c;
			cin >> a >> b >> c;
			edge[a][b] = min(edge[a][b],c);
			edge[b][a] = min(edge[b][a],c);
		}
		vector<vector<int>>dis(N, vector<int>(M + 1, MOD));
		dis[L][M] = 0;
		set<pair<int, pair<int, int>>>s;
		s.insert({ dis[L][M],{L,M} });
		while (!s.empty()) {
			auto c = *s.begin();
			s.erase(s.begin());
			int cc = c.first;
			int cn = c.second.first;
			int ct = c.second.second;
			for (int i = 0; i < N; i++) {
				if (ct < edge[cn][i]) {
					continue;
				}
				if (dis[i][ct - edge[cn][i]] > cc + edge[cn][i]) {
					dis[i][ct - edge[cn][i]] = cc + edge[cn][i];
					s.insert({ dis[i][ct - edge[cn][i]],{i,ct - edge[cn][i]} });
				}
			}
			if (ice[cn]) {
				if (ct != M) {
					if (dis[cn][ct + 1] > dis[cn][ct] + 1) {
						dis[cn][ct + 1] = dis[cn][ct] + 1;
						s.insert({ dis[cn][ct + 1],{cn,ct + 1} });
					}
				}
			}
		}
		int ret = MOD;
		for (auto i : dis[R]) {
			ret = min(ret, i);
		}
		ans.push_back(ret);
		cin >> N >> M >> K >> E >> L >> R;
	}
	for (auto i : ans) {
		if (i == MOD)cout << "Help!\n";
		else cout << i << endl;
	}
	return 0;
}



Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
bool dp[1000001];
bool a[1000001];
int main() {
    long long n, x;
    fill(a, a + 1000001, true);
    a[0] = false;
    a[1] = false;
    for (int i = 0; i <= 1000000; i++) {
        if (a[i]) {
            int j = 2;
            while (i*j <= 1000000) {
                a[i*j] = false;
                j++;
            }
        }
    }
    while (cin >> n >> x&&n != 0 && x != 0) {
        fill(dp, dp + x + 1, false);
        int y;
        dp[0] = true;
        for (int i = 0; i < n; i++) {
            cin >> y;
            for (int i = y; i <= x; i++) {
                if (dp[i - y]) {
                    dp[i] = true;
                }
            }
        }
        for (int i = x; i >= 2; i--) {
            if (a[i]&&dp[i]) {
                cout << i << endl;
                goto finish_v;
            }
        }
        cout << "NA" << endl;
    finish_v:;
    }
}

Measured memory_bytes: 4952
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n,k,q;
  cin >> n >> k >> q;
  vector<int> a(q);
  rep(i,q) cin >> a.at(i);
  vector<int> p(n,k-q);
  rep(i,q){
    p.at(a.at(i)-1)++;
  }
  rep(i,n){
    if(p.at(i)>0){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
const int N=100000+5;
int sum[N];
int main(){
	for(int i=1;i<=N-1;i++)
	   sum[i]=sum[i-1]+i;
	int x;
	cin>>x;
	int pos;
	pos=lower_bound(sum+1,sum+N,x)-sum;
	cout<<pos;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
typedef long long ll;
int main()
{
    ll n; cin >> n;
    ll a[n];
    for(int i=0; i<n; i++) cin >> a[i];
 
    int current = 0;
    ll ans = 0;
    for(int i=1; i<n; i++){
        if(a[i] >= a[current]) current = i;
        else ans += a[current] - a[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5184
n = gets.to_i
ans = []
if n >= 2
  (1..8).each do |i|
    if n == 2
      ans << 2
    elsif 2**i > n
      ans << 2**(i-1)
    end
  end
  puts ans.min
elsif n == 1
  puts 1
else
  puts 0
end

Measured memory_bytes: 3836
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
vector<int> G[1000];
int in[1000];

int32_t main()
{
	#ifdef ONLINE_JUDGE
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	#endif
	
	int n,m;
	cin>>n>>m;
	int u,v;
	for(int i=1;i<=m;i++)
	{
		cin>>u>>v;
		u--;v--;
		in[v]++;
		G[u].push_back(v);
	}
	queue<int> q;
	for(int i=0;i<n;i++)
	{
		if(in[i]==0)q.push(i);
	}
	int sz=0;
	while(!q.empty())
	{
		sz++;
		u=q.front();q.pop();
		for(int v:G[u])
		{
			if(--in[v]==0)q.push(v);
		}
	}
	if(sz==n)cout<<-1;
	else cout<<0;
	
	
}

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

int main() {
    string p, s_tmp, s;
    int i, sum, count[27];

    getline(cin, s_tmp);
    s = s_tmp + s_tmp;

    getline(cin, p);

    if (s.find(p) != string::npos) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;        
    }

    return 0;
}



Measured memory_bytes: 3220
import java.util.*;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		if(Math.min(b,d)-Math.max(a,c)>0){
			System.out.println(Math.min(b,d)-Math.max(a,c));
		}else{
			System.out.println(0);
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define EFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i, n) FOR(i,0,n)
#define INF 1e12
const int MOD = 1000000007;
typedef pair<ll,ll> P;

// BFS O(N^2)の解法
int main(void){
    int N,X,Y;
    cin >> N >> X >> Y;
    X--; Y--;   //0-indexed
    Graph dist(N,vector<int>(N,-1));
    FOR(i,0,N){
        queue<int> que;
        que.push(i);
        dist[i][i] = 0;
        while(!que.empty()){
            int v = que.front();
            vector<int> vis;
            que.pop();
            if(v > 0)   vis.push_back(v-1);
            if(v < N-1) vis.push_back(v+1);
            if(v == X)  vis.push_back(Y);
            if(v == Y)  vis.push_back(X);
            for(auto vs:vis){
                if(dist[i][vs] != -1) continue;
                dist[i][vs] = dist[i][v] + 1;
                que.push(vs);
            }
        }
    }
    vector<int> ans(N+10, 0);
    REP(i,N){
        FOR(j,i+1,N){
            ans[dist[i][j]]++;
        }
    }
    FOR(i,1,N) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 18892
N = int(input())
XY = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    for _ in range(A):
        x, y = map(int, input().split())
        XY[i].append((x-1,y))
ans = 0
for bit in range(1<<N):
    cnt = bin(bit).count('1')
    ok = True
    for i in range(N):
        if bit&(1<<i):
            for x,y in XY[i]:
                if y == 1:
                    if not bit&(1<<x):
                        ok = False
                        break
                else:
                    if bit&(1<<x):
                        ok = False
                        break
            if not ok:
                break
    if ok:
        ans = max(ans, cnt)
print(ans)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main() {
    int H, W;
	cin >> H >> W;
    char s[H][W];
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
            cin >> s[i][j];
        }
	}

    int cnt = 0;
	for(int i = 1; i < H-1; i++) {
		for(int j = 1; j < W-1; j++){
			if(s[i][j] == '#' && s[i][j - 1] != '#' && s[i - 1][j] != '#' && s[i][j + 1] != '#' && s[i + 1][j] != '#'){
                cnt++;
                break;
            }
		}
        if(cnt != 0){
            break;
        }
	}
	if(cnt == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


	return 0;
}

Measured memory_bytes: 256
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define repr(i,l,r) for(int i=(r)-1,i##_left=(l);i>=i##_left;--i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail) { cin >> head; in(move(tail)...); }
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define TIN(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
#define VIND(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem,--_elem
#define OUT(x) cout << x;
#define OUTL(x) cout << x << endl;
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
template<class T>
string join(vector<T>& v, string delim="") { ostringstream os; rep(i,v.size())i?os<<delim<<v[i]:os<<v[0]; return os.str(); }
#pragma endregion RegionDefs

template<class T>
vector<T> compress(vector<T>& v) {
    vector<T> v2 = v;
    sort(v2.begin(), v2.end());
    v2.erase(unique(v2.begin(), v2.end()), v2.end());
    rep(i, v.size())
        v[i] = lower_bound(v2.begin(), v2.end(), v[i]) - v2.begin();
    return v2;
}

void solve()
{
    IN(n, m);
    V<ll> p(m), y(m);
    rep(i, m) cin >> p[i] >> y[i], --p[i];
    V<V<ll>> v(n);
    rep(i, m) v[p[i]].push_back(y[i]);
    rep(i, n) sort(all(v[i]));
    rep(i, m) {
        string q = to_string(p[i] + 1);
        string c = to_string(lower_bound(all(v[p[i]]), y[i]) - v[p[i]].begin() + 1);
        rep(j, 6-q.size()) cout << "0";
        cout << q;
        rep(j, 6-c.size()) cout << "0";
        cout << c << endl;
    }
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

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

int main() {
    int H, W;
    char s[51][51];
    bool ans = true;
    cin >> H >> W;
    for (int i = 0; i < H; i++)
        for (int j = 0; j < W; j++)
            cin >> s[i][j];
    for (int i = 0; i < H; i++)
        for (int j = 0; j < W; j++)
            if (s[i][j] == '#')
                if (s[i-1][j] != '#' && s[i+1][j] != '#' && s[i][j-1] != '#' && s[i][j+1] != '#')
                    ans = false;
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, X);
    ll x = 100;
    REP(i, 1e8)
    {
        x += x / 100;
        if (x >= X)
        {
            OUT(i + 1);
            return 0;
        }
    }
}

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

using namespace std;

int main()
{
        string a, b, c;
        cin >> a >> b >> c;
        if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
                cout << "YES" << endl;
        } else {
                cout << "NO" << endl;
        }

        return 0;
}

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

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ll long long
#define pb(a) push_back(a)
#define print(x) cout<<x<<'\n';

const int MOD = 998244353;
const ll MAX_VAL = 1000000;

ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}


ll inv[1000010];//逆元
vector<ll>divisors[1000010];//約数の集合
ll sum1[1000010];//sum1[d]=dの倍数の和
ll sum2[1000010];//sum2[d]=dの倍数の2乗の和
ll A[200020];
ll f[1000010];
ll g[1000010];
//逆元の前計算
void inverse_init() {
	inv[1] = 1;
	for (int i = 2; i <= MAX_VAL; i++) {
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
	}
}
//約数列挙
void divisors_init() {
	for (int d = 1; d <= MAX_VAL; d++) {
		for (int x = d; x <= MAX_VAL; x += d) {
			divisors[x].pb(d);
			//divs[x].insert(d);
		}
	}
}
//g(d)の計算
void calc_g() {
	for (int d = 1; d <= MAX_VAL; d++) {
		ll tmp = 0;
		tmp = add(tmp, mult(sum1[d], sum1[d]));
		tmp = sub(tmp, sum2[d]);
		tmp = mult(tmp, inv[2]);
		g[d] = tmp;
	}
}

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

	divisors_init();//約数列挙
	inverse_init();//逆元の前計算
	int N; cin >> N;
	REP(i, N) {
		cin >> A[i];
		for (auto x : divisors[A[i]]) {
			sum1[x] = add(sum1[x], A[i]);
			sum2[x] = add(sum2[x], mult(A[i], A[i]));
		}
	}
	calc_g();//g(d)の計算
	ll ans = 0;
	for (int d = MAX_VAL; d >= 1; d--) {
		ll tmp = g[d];
		for (int k = 2; k*d <= MAX_VAL; k++) {
			tmp = sub(tmp, f[k*d]);
		}
		f[d] = tmp;
		ans = add(ans, mult(f[d],inv[d]));
	}
	print(ans);
}


Measured memory_bytes: 221440
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		
		
		Scanner sc =new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		
		if(a<=8&&b<=8)System.out.println("Yay!");
		else System.out.println(":(");
	
	
	
	}
	
}





Measured memory_bytes: 21972
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]
#define GI(name) int (name);scanf("%d",&(name))
#define GI2(name1,name2) int (name1),(name2);scanf("%d %d",&(name1),&(name2))
#define GI3(name1,name2,name3) int (name1),(name2),(name3);scanf("%d %d %d",&(name1),&(name2),&(name3))
#define GVI(name,size) vector<int> (name)(size);FOR(i,(size))scanf("%d",&(name)[i])

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

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

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug_print(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug_print(Head head,Tail... tail){
    cerr<<to_string(head)<<" ";
    debug_print(tail...);
}

template<class... T>
void debug(T... args){
    cerr<<"["<<__LINE__<<"]: ";
    debug_print(args...);
}

void print(){
    cout<<endl;
}

template<class Head,class... Tail>
void print(Head head,Tail... tail){
    cout<<to_string(head);
    print(tail...);
}

int main(){
    GI2(N,K);
    map<int,int> list;
    FOR(i,N){
        GI(A);
        list[A-1]++;
    }
    vector<int> vec;
    int c=0;
    for(P p:list){
        vec.push_back(p.second);
        c++;
    }
    sort(ALL(vec));
    int ans=0;
    FOR(i,c-K){
        ans+=vec[i];
    }
    print(ans);
    return 0;
}


Measured memory_bytes: 10748
N = gets.to_i
MOD = 10 ** 9 + 7

A = 0
G = 1
C = 2
T = 3

dp = Array.new(N + 1) { Array.new(4) { Array.new(4) { Array.new(4, 0) } } }

dp[0][T][T][T] = 1
N.times do |n|
  4.times do |c3|
    4.times do |c2|
      4.times do |c1|
        next if dp[n][c1][c2][c3] == 0

        4.times do |c|
          next if c2 == A && c1 == G && c == C
          next if c2 == A && c1 == C && c == G
          next if c2 == G && c1 == A && c == C
          next if c3 == A && c1 == G && c == C
          next if c3 == A && c2 == G && c == C

          dp[n + 1][c][c1][c2] += dp[n][c1][c2][c3]
          dp[n + 1][c][c1][c2] %= MOD
        end
      end
    end
  end
end

ans = 0
4.times do |c3|
  4.times do |c2|
    4.times do |c1|
      ans += dp[N][c1][c2][c3]
      ans %= MOD
    end
  end
end

puts ans

Measured memory_bytes: 1916
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
using ld = long double;
 
// ------------------------------------------------------------------------------------------------

ll n, x, y;

int main() {
    fast_io; cout_precision;
    cin >> n >> x >> y;
    for (ll i = 1, a, b, q; i < n; i++) {
        cin >> a >> b;
        q = max(ceil(ld(x) / a), ceil(ld(y) / b));
        x = q * a, y = q * b;
    }
    cout << x + y << endl;
}

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

int counting(int n, int x){
	int count = 0;
	for(int i = 1; i <= n - 2; i++){
		int sum = i;
		if (sum > x){
			break;
		}
		for(int j = i + 1; j <= n - 1; j++){
			sum = i + j;
			if(sum > x){
				break;		
			}
			for(int k = j + 1; k <= n; k++){
				sum = i + j + k;
				if(sum > x){
					break;
				}
				if(sum == x){
					count++;
					break;
				}
			}
		}
	}
	return count;
}

int main(int argc, char *argv[]){
	int n, x;
	while(1){
		cin >> n >> x;
		if(n == 0 && x == 0)break;
		cout << counting(n,x) << endl;
	}
	return 0;
}

Measured memory_bytes: 3076
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define INF 1145141919810364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int h, w;
char a[110][110];
int cnt[110][110];

signed main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++)for (int j = 0; j < w; j++)cin >> a[i][j];
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (i == 0 && j == 0) {
				if (a[i][j] == '#')cnt[i][j] = 1;
			}
			else if (i == 0) {
				if (a[i][j - 1] == a[i][j])cnt[i][j] = cnt[i][j - 1];
				else cnt[i][j] = cnt[i][j - 1] + 1;
			}
			else if (j == 0) {
				if (a[i - 1][j] == a[i][j])cnt[i][j] = cnt[i - 1][j];
				else cnt[i][j] = cnt[i - 1][j] + 1;
			}
			else {
				int x = 0, y = 0;
				if (a[i - 1][j] == a[i][j])x = cnt[i - 1][j];
				else x = cnt[i - 1][j] + 1;
				if (a[i][j - 1] == a[i][j])y = cnt[i][j - 1];
				else y = cnt[i][j - 1] + 1;
				cnt[i][j] = min(x, y);
			}
		}
	}
	cout << (cnt[h - 1][w - 1] + 1) / 2 << endl;
}


Measured memory_bytes: 384
void main()
{
    long x = rdElem;

    long result = ceil(0.5 * (-1 + sqrt(1.0 + 8.0 * x))).to!long;

    result.writeln;
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

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

int		main(void)
{
	int		a;
	cin >> a;
	if (a == 5 || a == 7 || a == 3)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}

Measured memory_bytes: 256
import sys
num, sum_yen = map(int, input().split())

'''
10x + 5y + z = yen
x + y + z = num

として、以下を満たす整数の組が、求める答えになる

9x + 4y = yen - num

'''

# 桁を千円に直す
sum_yen = int(sum_yen / 1000)

for x_i in range(0, num + 1):
    for y_i in range(0, num + 1 - x_i):
        if 9 * x_i + 4 * y_i == (sum_yen - num):
            print('{} {} {}'.format(x_i, y_i, num - x_i - y_i))
            sys.exit()

# 組み合わせが見つからなかった場合
print('-1 -1 -1')

Measured memory_bytes: 3188
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
    // Your cod#include <stdio.h>
int main(void){
    // Your code here!
    int N,B[105],sum=0;
    scanf("%d",&N);
    for(int i=1;i <= N-1;i++){
        scanf("%d",&B[i]);
    }
    sum=B[1]+B[N-1];
    for(int i = 1;i <= N-2;i++){
        sum+=min(B[i],B[i+1]);
    }
   printf("%d",sum);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a,const void *b){
  if(*(int*)a > *(int*)b) return 1;
  return -1;
}

int main(void){
  int n;
  scanf("%d", &n);

  int d[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &d[i]);
  }

  qsort(d, n, sizeof(int), compare_int);

  printf("%d\n", d[n/2]-d[n/2-1]);

  return 0;
}

Measured memory_bytes: 892
import Data.List
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Data.Maybe

f [] _ _ = []
f (b:bs) [] n = 0 : (f bs [] n)
f (b:bs) (c:cs) n
  | b < c = n : (f bs (c:cs) n)
  | b >= c = (f (b:bs) cs (n-1))

g [] _ _ = []
g (a:as) [] [] = 0 : (g as [] [])
g (a:as) (b:bs) (b':bs')
  | a < b = b' : (g as (b:bs) (b':bs'))
  | a >= b = (g (a:as) bs bs')

main = do
  n <- readLn :: IO Int
  a <- BS.getLine >>= return . sort . (map (fst . fromJust . BS.readInt)) . BS.words :: IO [Int]
  b <- BS.getLine >>= return . sort . (map (fst . fromJust . BS.readInt)) . BS.words :: IO [Int]
  c <- BS.getLine >>= return . sort . (map (fst . fromJust . BS.readInt)) . BS.words :: IO [Int]

  let b' = (reverse . tail . (scanl (+) 0) .  reverse) $ f b c (length c)

  print $ sum $ g a b b'


Measured memory_bytes: 59772
#include <bits/stdc++.h>
using namespace std;
#define pb push_back

int ncr(int n,int r){ int res=1; if(r>n-r)r=n-r; for(int i=0;i<r;i++) {  res*=n-i;  res/=i+1; } return res; }

int gcd(int a,int b){
    if(b==0) return a;
    else return gcd(b,a%b);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    int sum=0;
    vector<int> v;
    while(t--){
        int n;
        cin>>n;
        int arr[n];
        for(int i=0;i<n;i++){
            cin>>arr[i];
        }
        sort(arr,arr+n);
        int sum=0;
        for(int i=0;i<n-1;i++){
            sum+=arr[i];
        }
        if(sum>arr[n-1])cout<<"Yes";
        else cout<<"No";
    }
}
    

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007
    N = int(input())
    p = list(map(float, input().split()))
    #dp[j]:裏がj枚でる確率
    dp = [1] + [0]*(N//2)
    for i in range(N):
        for j in range(i+1, -1, -1):
            if j==0:
                dp[j] = dp[j]*p[i]
            elif j<=(N//2):
                dp[j] = dp[j-1]*(1-p[i]) + dp[j] * p[i]

    res = sum(dp)
    print('{:.9f}'.format(res))


if __name__ == '__main__':
    main()

Measured memory_bytes: 41708
#include <stdio.h>
#include <stdlib.h>

int main()
{
   int window,curtain;
   scanf("%d %d",&window,&curtain);
   if(curtain*2>window)
   {
       printf("0");
   }
   else
   {
       printf("%d",window-(curtain*2));
   }
   return 0;
}


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

using namespace std;

int main(void){
	int n,m;
	while(true){
		string s1, s2;
		cin >> s1;
		if(s1 == ".")break;
		cin >> s2;
		if(s1 == s2){
			cout << "IDENTICAL" << endl;
			continue;
		}
		int close = 0;
		bool quo = false;
		int i = 0, j = 0;
		while(true){
			if(i==s1.size() || j == s2.size()) break;
			if(s1[i]=='"' && s2[j]=='"'){
				quo = !quo;
				i++; j++; continue;
			}
			if(s1[i]==s2[j]){
					i++; j++; continue;
			}
			if(!quo){
				close = -1;
				break;
			}else{
				close++;
				while(s1[i++]!='"'); i--;
				while(s2[j++]!='"'); j--;
			}
		}
		if(!(i==s1.size() && j == s2.size())) close = -1;
		cout << (close == 1 ? "CLOSE" : "DIFFERENT") << endl;
		
	}

	return 0;
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int a[301],n,dp[301][301];
main(){
  while(cin>>n,n){
    int ans=0;
    r(i,n)cin>>a[i];
    memset(dp,0,sizeof(dp));
    for(int i=1;i<n;i+=2)
      for(int j=0;j<n-i;j++){
        dp[j][j+i]=dp[j+1][j+i-1];
        if(abs(a[j]-a[j+i])<2&&dp[j+1][j+i-1]==i-1)dp[j][j+i]=max(dp[j][j+i],i+1);
        else for(int k=1;k<i;k+=2)dp[j][j+i]=max(dp[j][j+i],dp[j][j+k]+dp[j+k+1][j+i]);
      }
    r(i,n)r(j,n)ans=max(ans,dp[i][j]);
    cout<<ans<<endl;
  }
}

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

int main(){
	string r, a;
	while( cin >> r >> a, r!="0"||a!="0" ){
		int hit=0, blow=0;
		for( int i=0; i<4; i++ ){
			for( int j=0; j<4; j++ ){
				if( r[i] == a[j] ){
					if( i==j )	hit++;
					else		blow++;
					a[j] = '*';
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

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

namespace kaijouB
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] AV = Console.ReadLine().Split(' ');
            string[] BW = Console.ReadLine().Split(' ');
            long T = long.Parse(Console.ReadLine());
            long A = long.Parse(AV[0]);
            long V = long.Parse(AV[1]);
            long B = long.Parse(BW[0]);
            long W = long.Parse(BW[1]);
            long kyori = Math.Abs(A - B);
            //Console.WriteLine(kyori);
            long sokudo = V - W;
            if (V > W)
            {
                
                long idou = sokudo * T;
                //Console.WriteLine(idou);
                if (idou >= kyori)
                {
                    Console.WriteLine("YES");
                }
                else
                {
                    Console.WriteLine("NO");
                }
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


Measured memory_bytes: 27496
import sys
input = sys.stdin.readline
 
N,M = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(M)]
 
root = list(range(N+1))
comp_size = [1] * (N+1)
 
def find_root(x):
  y = root[x]
  if x == y:
    return x
  z = find_root(y)
  root[x] = z
  return z
 
def merge(x,y):
  rx = find_root(x)
  ry = find_root(y)
  if rx == ry:
    return 0
  sx = comp_size[rx]
  sy = comp_size[ry]
  if sx > sy:
    root[ry] = rx
    comp_size[rx] += sy
  else:
    root[rx] = ry
    comp_size[ry] += sx
  return sx * sy
 
answer = []
x = N*(N-1)//2
for a,b in AB[::-1]:
  answer.append(x)
  x -= merge(a,b)
for a in answer[::-1]:
  print(a)

Measured memory_bytes: 28720
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
	int d, g;
	cin >> d >> g;
	vector<int> p(d), c(d);
	rep(i, d) cin >> p[i] >> c[i];

	vector<int> per;
	rep(i, d) per.push_back(i);

	int ans = 100000;
	do {
		int score = g;
		int num = 0;
		for (int i : per) {
			if (score - (i + 1) * 100 * p[i] > 0) {
				num += p[i];
				score -= (i + 1) * 100 * p[i];
				if (score - c[i] > 0) {
					score -= c[i];
				}
				else {
					break;
				}
			}
			else {
				while (score > 0) {
					score -= (i + 1) * 100;
					num++;
				}
			}
		}
		ans = min(ans, num);
	} while (next_permutation(per.begin(), per.end()));
	cout << ans << endl;
}

Measured memory_bytes: 256
/*
       Hi there <3 
──────▄▀▄─────▄▀▄
─────▄█░░▀▀▀▀▀░░█▄
─▄▄──█░░░░░░░░░░░█──▄▄
█▄▄█─█░░▀░░┬░░▀░░█─█▄▄█

*/
#include <bits/stdc++.h>
#define MOD 1000000007
#define re return
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define y0 y32479
#define y1 y95874
#define next next239
#define prev prev239
#define fill(x, y) memset(x, y, sizeof(x))
#define sqr(x) ((x) * (x))
#define sqrt(x) sqrt(abs(x))
#define unq(x) (x.resize(unique(all(x)) - x.begin()))
#define ba back()
#define popcount __builtin_popcountll
#define fastIO()                 \
    {                            \
        ios::sync_with_stdio(0); \
        cin.tie(0);              \
        cout.tie(0);             \
    }
#define in(x) \
    int x;    \
    cin >> x;
#define in1(x) \
    int x;     \
    cin >> x;  \
    x--;
#define inll(x) \
    ll x;       \
    cin >> x;
#define ins(x) \
    string x;  \
    cin >> x;

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef pair<double, double> pdd;
typedef long double LD;
typedef double D;

void Solve()
{
    int n,k;
    cin>>n>>k;
    vi v(n,0);

    rep(i,n)
        cin>>v[i];
    ll count=(n-2)/(k-1) + 1;
    cout<<count<<endl;
}

int main()
{
    fastIO();
    int t;
    t=1;
    while (t--)
    {
        Solve();
    }
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

int N,M,A[200002]={0},i,j,k;


int main()
{
cin>> N;

for(i=1;i<N;i++)
{
cin>>k;
A[k]++;

}

for(i=1;i<=N;i++)
{
cout<<A[i]<<endl;
}


}

Measured memory_bytes: 4300
package main

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

const mod = 998244353
const facNum = 300001
const INF = 2 << 60

func main() {
	sc := newScanner(os.Stdin)
	X, K := sc.i(), sc.i()
	d := min(X%K, K-(X%K))

	fmt.Println(d)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}

func abs(i int) int {
	if i < 0 {
		return -i
	}
	return i
}


Measured memory_bytes: 1772
#A時ちょうどで、
#コンテストがちょうどB時間後に始まる。

#コンテスト開始時間は24時間表記で何時ちょうどでしょうか？

a,b = map(int,input().split())

if a+b < 24:
    print(a+b)
else:
    print(a+b-24)


Measured memory_bytes: 2940