akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const ll MAX = 10000;
static const ll INFTY = 1e12;
static const ll MOD = 1e9+7;

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



int main() {

  int a, b;
  cin >> a >> b;
  double med = (a + b) / 2.0;
  cout << int(med+0.9) << endl;
 


}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 3560
def resolve():
    '''
    code here
    '''
    N, M = [int(item) for item in input().split()]
    students = [[int(item) for item in input().split()] for _ in range(N)]
    cps = [[int(item) for item in input().split()] for _ in range(M)]

    for i in range(N):
        min_dist = 10**9
        min_dist_index = 0
        for j in range(M):
            x_dist = abs(students[i][0] - cps[j][0])
            y_dist = abs(students[i][1] - cps[j][1])
            man_dist = x_dist + y_dist

            if min_dist > man_dist:
                min_dist = man_dist
                min_dist_index = j

        print(min_dist_index+1)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf 1000000005
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define mod 1000000007
#define sz(a) ((ll)(a).size())

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcount(s);}
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define eps 1e-9
typedef pair<int, int> II;
typedef pair<ll, ll> LL;
template<class T> T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;}
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define PI (2 * acos((ld)0))
#define linf (1ll << 60)
#define y1 y32432
#define y0 y435346

#define maxn 505

int n;
int a[maxn][maxn], c[maxn], b[maxn], d[maxn];
string s;

void solve(){
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    For(i, 1, n){
    	cin >> s;
    	For(j, 1, n){
    		if(s[j - 1] == '#') a[i][j] = 1;
    		else a[i][j] = 0;
    	}
    }
    For(i, 1, n){
    	int num = 0;
    	For(j, 1, n) num += a[j][i];
    	if(num == n) b[i] = 1;
    }
    For(i, 1, n){
    	int num = 0;
    	For(j, 1, n) num += a[i][j];
    	if(num == n) c[i] = 1;
    	d[i] = num;
    }

    int res = inf;
    For(i, 1, n) For(j, 1, n) if(a[i][j]){
    	int ret = 0;
    	For(k, 1, n){
    		if(a[j][k]){
    			ret += 1 - b[k];
    		} else{
    			ret += 2 - c[i];
    		}
    	}
    	res = min(res, ret);
//    	cout << i << " " << j << " " << ret << endl;
    }
    For(i, 1, n) if(!a[i][i] && d[i] > 0){
    	int ret = 1;
    	For(k, 1, n){
    		if(a[i][k]){
    			ret += 1 - b[k];
    		} else{
    			ret += 2 - c[i];
    		}
    	}
    	res = min(res, ret);
    }

    if(res < inf) cout << res << endl;
    else cout << -1 << endl;

}

int main()
{
	solve();
    return 0;
}


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

int main(){
	int N,A,B;
	string S;
	cin>>N>>A>>B>>S;
	int kakutei=0;
	int kaigai=1;
	rep(i,N){
		if(S.at(i)=='a'){
			if(kakutei<A+B){
				cout<<"Yes"<<endl;
				kakutei++;
			}else{
				cout<<"No"<<endl;
			}
		}else if(S.at(i)=='b'){
			if(kakutei<A+B&&kaigai<=B){
				cout<<"Yes"<<endl;
				kakutei++;
				kaigai++;
			}else{
				cout<<"No"<<endl;
			}
		}else{
			cout<<"No"<<endl;
		}
	}
return 0;}

/*compile
g++ code.cpp
./a.out
run*/

Measured memory_bytes: 896
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val a = Array.fill(n)(sc.nextInt())
  val sorted = a.sorted
  val max = sorted.apply(n-1)
  val ans2 = if (max%2!=0) {
    val mid1 = a.filter(x=>x!=max).map(i => (i, Math.abs(i - (max+1) / 2))).sortWith((x, y) => x._2 < y._2).apply(0)
    val mid2 = a.filter(x=>x!=max).map(i => (i, Math.abs(i - (max-1) / 2))).sortWith((x, y) => x._2 < y._2).apply(0)
    if (mid1._2>mid2._2){
      mid1._1
    }else{
      mid2._1
    }
  } else{
    val mid = a.filter(x=>x!=max).map(i => (i, Math.abs(i - max / 2))).sortWith((x, y) => x._2 < y._2).apply(0)
    mid._1
  }
  printf("%d %d",max,ans2)
  println()
}

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

int main()
{
    int a,b,c,d,x=0,y=0;
    cin>>a>>b>>c>>d;
    while(1){
        if(c>0){
            c-=b;
        }
        if(c<=0){
            x=1;
            break;
        }
        if(a>0){
            a-=d;
        }
        if(a<=0){
            y=1;
            break;
        }
    }
    if(x==1)
        cout<<"Yes";
    else if(y==1)
        cout<<"No";
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <bitset>
using namespace std;
typedef pair<int, int> P;
int N;
vector<P> G[20];

bool judge(int bit) {
    for (int i = 0; i < N; i++) {
        if (!(bit & (1 << i))) continue;

        for (P xy: G[i]) {
            int x = xy.first;
            int y = xy.second;
            if (((bit >> x) & 1) ^ y) return false;
        }
    }
    return true;
}

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        int A; cin >> A;
        for (int j = 0; j < A; j++) {
            int x, y; cin >> x >> y;
            G[i].push_back({x-1, y});
        }
    }

    int ans = 0;
    for (int bit = 0; bit < (1 << N); bit++) {
        int tmp = bitset<20>(bit).count();
        if (tmp <= ans) continue;
        if (judge(bit)) ans = max(ans, tmp);
    }
    cout << ans << endl;
}

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

int N, M, Q; 
vector<int> a(50), b(50), c(50), d(50);
vector<int> A(10, 1);

int ans = 0;

void dfs(int x){
    if(x == N){
        int now = 0;
        rep(i,Q){
            if(A[b[i]] - A[a[i]] == c[i]) now += d[i];
        }
        ans = max(ans,now);
        return;
    }

    int k = A[x-1];

    for(int i=k; i<=M; i++){
        A[x] = i;
        dfs(x+1);
    }
}

int main(){
    cin >> N >> M >> Q;
    
    rep(i,Q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--; b[i]--;
    }


    dfs(1);

    cout << ans << endl;
}


Measured memory_bytes: 3640
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>

#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

///////////////////////////////////////////////////
// -------------------- I/O -------------------- //
///////////////////////////////////////////////////
// https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords
template<typename T> void outputVec(const std::vector<T>& vec, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	for (auto it = vec.begin(); it != vec.end() - 1; ++it) { std::cout << *it << " "; }
	std::cout << *(vec.end() - 1) << "\n";
}
template<typename T> void outputVal(const T& res, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	std::cout << res << "\n";
}
template<typename T> T inputVal() { T a; std::cin >> a; return a; }
template<typename T> std::vector<T> inputVec(int N) {
	std::vector<T> vec(N);
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
	return vec;
}
template<typename T> void inputVec(std::vector<T>& vec) {
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
}

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
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; }

///////////////////////////////////////////////////
// ------------------- main -------------------- //
///////////////////////////////////////////////////
void Main() {
	const int N = inputVal<int>();
	const int M = inputVal<int>();

	vector<int> a(N + 1, 0);
	for (int i = 0; i < M; ++i) {
		int nb; cin >> nb;
		a[nb] = 1;
	}

	vector<int> dp(N + 1, 0);
	dp[0] = 1;
	if (a[1] == 0) dp[1] = 1;

	for (int i = 2; i <= N; ++i) {
		if (a[i] == 1) continue;
		if (a[i - 1] == 0) dp[i] = (dp[i] + dp[i - 1]) % MOD;
		if (a[i - 2] == 0) dp[i] = (dp[i] + dp[i - 2]) % MOD;
	}

	cout << (dp[N] % MOD) << endl;

}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout << std::fixed << std::setprecision(15);
	Main();

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main()
{
    long long n, m, sum=0, ans=0;
    cin >> n >> m;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin >> arr[i];
        sum +=arr[i];
    }
    long long pr =m*4;
    for(int i=0;i<n;i++)
    {
        if(arr[i]*pr >=sum)
        ans++;
    }
    if(ans>=m)
    cout << "Yes";
    else 
    cout << "No";
    return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
    cout << "Possible" << endl;
  }
  else {
    cout << "Impossible" << endl;
  }
}


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

int	main() {
	int N;
	cin >>N;
	long A;
	cin >>A;
	if (0!=A) {
		cout <<-1 <<endl;
		return 0;
	}
	long S=0;
	for (int i=1; i<N; i++) {
		long A0=A;
		cin >>A;
		long D=A-A0;
		if (1<D) {
			cout <<-1 <<endl;
			return 0;
		} else if(1==D)
			S++;
		else
			S +=A;
	}
	cout <<S <<endl;
	return 0;
}


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

#define N 8

int col[N], row[N];
int dpos[N*2-1], dneg[N*2-1];
int reservedQ[N];

void printBoard(){
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			if(j==row[i]){ cout << "Q"; }
			else{ cout << "."; }
		} 
		cout<<endl;
	}
}

void putQueen(int i){
	if(i == N){ printBoard(); return; }

	if(reservedQ[i] == 1){ putQueen(i+1); return;}
	
	for(int j=0; j<N; j++){
		if(col[j]==1 || dpos[i+j]==1 || dneg[i-j+N-1]==1){ continue; }
		
		row[i] = j;
		col[j] = dpos[i+j] = dneg[i-j+N-1] = 1;
		
		putQueen(i+1);
		
		col[j] = dpos[i+j] = dneg[i-j+N-1] = 0;
	}
}

int main(){
	int k, r, c;
	 
	cin >> k;
	for(int i=0; i<k; i++){
		cin >> r >> c;
		row[r] = c;
		col[c] = dpos[r+c] = dneg[r-c+N-1] = 1;
		reservedQ[r] = 1;
	}
	
	putQueen(0);
	
	return 0;
}


Measured memory_bytes: 3100
import java.util.Scanner;
import java.lang.Math;

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

		int n = sc.nextInt();

		for(int i = 0; i <= 1_000_000_000; i++) {
			int square = i * i;
			if(square > n) {
				System.out.println((i - 1) * (i - 1));
				break;
			}
		}

	}
}



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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    char c;
    cin >> c;
    cout << (char) (c + 1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,m;
int a[1000];
int cnt[1000][10];
int main(void){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		cnt[i][0]=1;
	}
	for(int i=0;i<m;i++){
		scanf("%d",&a[i]);
		cnt[a[i]][0]=0;
	}
	int sum=0,s=1,to=0;
	while(s<n){
		for(int j=0;j<n/s;j+=2){
			if(cnt[j][to]+cnt[j+1][to]==2){
				sum++;
				cnt[j/2][to+1]++;
			}else if(cnt[j][to]+cnt[j+1][to]==1){
				cnt[j/2][to+1]++;
			}
		}
		s*=2;
		to++;
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 3228
A, B = list(map(int, input().split()))
import math


def prime_numbers(n):
    """n以下の素数列挙"""
    eratosthenes = [True] * (n + 1)
    eratosthenes[1] = False
    prime_list = []
    for i in range(2, n + 1):

        if eratosthenes[i]:
            k = 2
            while True:
                if i * k < n + 1:
                    eratosthenes[i * k] = False
                    k += 1
                else:
                    break
            prime_list.append(i)
    return prime_list


def prime_factorization(n: int):
    factors = []
    tmp_n = n
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        count_divide = 0
        while True:
            tmp_n = n
            s, r = divmod(tmp_n, i)
            if r == 0:
                count_divide += 1
                n = s
            else:
                break
        if count_divide >= 1:
            factors.append([i, count_divide])
    if tmp_n > 1:
        factors.append([tmp_n, 1])
    return factors


a_b_max = max(A, B)
a_b_min = min(A, B)
max_factors = prime_factorization(a_b_max)
min_factors = prime_factorization(a_b_min)
j = 0
ans = 1
for p, i in max_factors:
    while True:
        if j == len(min_factors):
            break
        if min_factors[j][0] == p:
            ans += 1
            j += 1
        elif min_factors[j][0] < p:
            j += 1
        else:
            break

print(ans)
# ans = 1
# for p in prime_list:
#     a_s, a_r = divmod(A, p)
#     b_s, b_r = divmod(B, p)
#     if A % p == 0 and B % p == 0:
#         ans += 1


Measured memory_bytes: 38768
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
const ll mod = 1e9+7;
const ll mod1 = 998244353;
#define rep(i,a,b) for(ll i=a;i<b;i++)

void swap(ll &a , ll &b){
    ll t = a;
    a = b;
    b = t;
}

ll min(ll a, ll b){
    if(a<b)return a;
    return b;
}

ll max(ll a, ll b){
    if(a>b)return a;
    return b;
}

 ll pow(ll a, ll b) {
    a %= mod1;
    ll ans = 1;
    while (b > 0) {
        if (b & 1)
            ans = ans * a % mod1;
        a = a * a % mod1;
        b /= 2;
    }
    return ans;
}

int main(){

   ios_base :: sync_with_stdio(0);
   cin.tie(0);
   string s;
   cin>>s;
   if(s[5] == s[4] && s[3] == s[2]){
    cout<<"Yes";
   }
   else
    cout<<"No";

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <limits>
#include <math.h>
#include <cmath>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vvi = vector<vector<int>> ;
using vll = vector<long long>;
using vvll = vector<vector<long long >>;
#define PI 3.141592653
#define rep(i, n) for(ll i = 0; i < n; i++)



int main(){
  ll x, y;
  cin >> x >> y;

  bool f = true;
  if(y - 2*x < 0){f = false;}
  if((y - 2*x) % 2 == 1){f = false;}
  if(4*x - y < 0){f = false;}
  if((4*x - y) % 2 == 1){f = false;}

  if(f){cout << "Yes" << endl;}
  else{cout << "No" << endl;}  
}


Measured memory_bytes: 3540
using static System.Math;
using System.Linq;
using System.Collections.Generic;
using System;

public class P
{
    public int p { get; set; }
    public int c { get; set; }
}

public class Hello
{
    public static int h, w;
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        h = int.Parse(line[0]);
        w = int.Parse(line[1]);
        var m = int.Parse(line[2]);
        var rs = new P[h];
        for (int i = 0; i < h; i++) rs[i] = new P { p = i };
        var cs = new P[w];
        for (int i = 0; i < w; i++) cs[i] = new P { p = i };
        var hs = new HashSet<long>();
        var rmax = 0; var cmax = 0;
        for (int i = 0; i < m; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var x = int.Parse(line[0]) - 1;
            var y = int.Parse(line[1]) - 1;
            rs[x].c++;
            rmax = Max(rmax, rs[x].c);
            cs[y].c++;
            cmax = Max(cmax, cs[y].c);
            hs.Add(x * 1000000 + y);
        }
        getAns(rs, cs, hs, rmax, cmax);
    }
    static void getAns(P[] rs, P[] cs, HashSet<long> hs, int rmax, int cmax)
    {
        var cs2 = cs.Where(z => z.c == cmax).ToArray();
        foreach (var x in rs.Where(x => x.c == rmax))
        {
            foreach (var y in cs2)
            {
                var t = x.p * 1000000 + y.p;
                if (!hs.Contains(t)) { Console.WriteLine(rmax + cmax); return; }
            }
        }
        Console.WriteLine(rmax + cmax - 1);
    }
}


Measured memory_bytes: 83244
#include <iostream>
#include <vector>
#include <set>
using namespace std;
struct union_find{
    vector<int> root; 
    union_find(int n){
        root.push_back(0);
        for(int i = 1;i<=n;i++){
            root.push_back(i);
        }
    }
    int rootfind(int a){
        if (root[a] == a) return a;
        root[a] = rootfind(root[a]);
        return rootfind(root[a]);
    }
    void unite(int a,int b){
        if (rootfind(a) == rootfind(b)) return;
        root[rootfind(a)] = rootfind(b);
    }
};
int main(){
    int n,m;
    cin >> n >> m;
    union_find hoge(n);
    int x,y,z;
    for(int i = 0;i<m;i++){
        cin >> x >> y >> z;
        hoge.unite(x,y);
    }
    set<int> ans;
    for(int i = 0;i<n;i++){
        ans.insert(hoge.rootfind(i+1));
    }
    cout << ans.size() << endl;
}


Measured memory_bytes: 5368
package main

import (
	"fmt"
)

func main() {
	var n, k int
	var s string
	fmt.Scan(&n, &s, &k)

	targetChar := ([]rune(s))[k-1]
	result := ""
	for _, c := range s {
		if targetChar == c {
			result += string(c)
		} else {
			result += "*"
		}
	}

	fmt.Print(result);
}

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

#define int long long

using namespace std;



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

        int n;
        cin>>n;

        int ans=(n*(n+1))/2;
        cout<<ans<<endl;

        return 0;

}

Measured memory_bytes: 256
def solve():
    h = read()
    result = think(h)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(h):
    dp = [0 for x in range(len(h))]
    for i in range(len(h) - 2, -1, -1):
        if h[i] >= h[i + 1]:
            dp[i] = dp[i + 1] + 1
        else:
            dp[i] = 0
    return max(dp)


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

Measured memory_bytes: 69084
package main

import (
	"fmt"
)

func main() {
	var card [3][3]int
	var card_b [3][3]bool
	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			fmt.Scan(&card[i][j])
		}
	}
	var n int
	fmt.Scan(&n)
	b := make([]int, n)
	for j := 0; j < n; j++ {
		fmt.Scan(&b[j])
	}

	for _, num := range b {
		for i := 0; i < 3; i++ {
			for j := 0; j < 3; j++ {
				if card[i][j] == num {
					card_b[i][j] = true
				}
			}
		}
	}

	fmt.Println(check(card_b))
}

func check(c [3][3]bool) string {
	for i := 0; i < 3; i++ {
		if c[i][0] && c[i][1] && c[i][2] || c[0][i] && c[1][i] && c[2][i] {
			return "Yes"
		}
	}
	if c[0][0] && c[1][1] && c[2][2] || c[0][2] && c[1][1] && c[2][0] {
		return "Yes"
	}
	return "No"
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;} 
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vll B(N);
        rep(i, 0, N-1) cin >> B[i];
        vll A(N);
        rep(i, 1, N) A[i] = B[i-1];
        A[0] = A[1];

        rep(i, 0, N-1) {
                if (A[i] > A[i+1]) {
                        A[i] = A[i+1];
                }
        }
        cout << accumulate(all(A), 0LL) << endl;
}

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

int main() {
  string S;
  cin >> S;
  
  int ans = 0;
  for(int i=0; i<4; i++){
    if(S[i] == '+')
      ans++;
    else if(S[i] == '-')
      ans--;
  }
  
  printf("%d\n", ans);
  
  return 0;
}

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

int main(){
    string s,t;
    cin >> s >> t;
    bool flag=true;
    rep(i,s.size()){
        if(s.at(i)!=t.at(i)) flag = false;
    }
    if(flag) cout<< "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
using namespace std;
signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(auto& ai:a)cin>>ai;
  
  int allxor = 0;
  for(auto& ai:a)allxor ^= ai;
  
  for(auto& ai:a)cout<< (allxor^ai) <<endl;
}


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

#define rep(i,n)  for(int i = 0; i < (int)(n); i++)
#define sz(x)     ((int)(x).size())
#define all(x)    (x).begin(),(x).end()

using ll = long long;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int n; std::cin >> n;
  std::vector<ll> A(n); rep(i,n) std::cin >> A[i];

  ll S = A[0] + A[1];
  ll X = 0;
  for(int i=2; i<n; i++) X ^= A[i];
 
  // Find a 
  // s.t.   0 < a <= A[0] && a + b == s && a ^ b == x
  //std::cout << "a+b = " << S << std::endl;
  //std::cout << "a^b = " << X << std::endl;
  constexpr int K = 60;
  ll dp[K+1][3][2];
  rep(i,K+1) rep(j,3) rep(m,2) dp[i][j][m] = -1;
  dp[K][0][1] = 0;

  for(int i=K; i>=1; i--) {
    int s = (S>>(i-1))%2;
    int x = (X>>(i-1))%2;

    rep(a,2) rep(b,2) {
      if ( (a^b) != x ) continue;
      rep(j,3) rep(m,2) {
        if ( dp[i][j][m] == -1 ) continue;
        int k = 2*j + s - (a+b);
        if ( k < 0 ) continue;
        if ( k >= 2 ) k = 2;
        int f = (A[0]>>(i-1))%2;
        if ( m ) {
          if ( a == f ) dp[i-1][k][m] = std::max(dp[i-1][k][m], dp[i][j][m]*2+a);
          else if ( a < f ) dp[i-1][k][!m] = std::max(dp[i-1][k][!m], dp[i][j][m]*2+a);
        }
        else dp[i-1][k][m] = std::max(dp[i-1][k][m], dp[i][j][m]*2+a);
      }
    }
  }
  
  ll v = std::max(dp[0][0][0], dp[0][0][1]);
  if ( v == -1 || v == 0 ) std::cout << -1 << std::endl;
  else std::cout << A[0] - v << std::endl;
  return 0;
}



Measured memory_bytes: 3644
import math

line = input().split(" ")
N = int(line[0])
D = int(line[1])

count = 0

for i in range(N):
    base = input().split(" ")
    base_x = int(base[0])
    base_y = int(base[1])
    
    d_base_x = base_x * base_x
    d_base_y = base_y * base_y

    if math.sqrt(d_base_x + d_base_y) > D:
        pass
    else:
        count += 1

print(count)


Measured memory_bytes: 9200
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean[][] g = new boolean[N+1][N+1];
        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= N; j++) {
                if (i != j) {
                    g[i][j] = true;
                }
            }
        }
        for (int i = 1; i <= N/2; i++) {
            int a = i;
            int b = N%2 == 0 ? N+1-i : N-i;
            g[a][b] = false;
            g[b][a] = false;
        }
        int count = 0;
        StringBuilder ans = new StringBuilder();
        for (int i = 1; i <= N; i++) {
            for (int j = i+1; j <= N; j++) {
                if (g[i][j]) {
                    count++;
                    ans.append(i+" "+j+"\n");
                }
            }
        }
        System.out.println(count);
        System.out.print(ans);
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include<vector>
int main() {
  int W, H, N;

  std::cin >> W >> H >> N;
  int x, y, a;
  int minx  = 0, miny = 0, maxx = W, maxy = H;

  for(int i = 0;i < N;i++) {
    std::cin >> x >> y >> a;
    if (a == 1) {
      if (minx < x)
        minx = x;
    }
    if (a ==2) {
      if (maxx > x)
        maxx = x;
    }
    if (a ==3) {
      if (miny < y)
        miny = y;
    }
    if (a ==4) {
      if (maxy > y)
        maxy = y;
    }
  }
  if (minx > maxx || miny > maxy)
    std::cout << 0 << std::endl;
  else
  	std::cout << (maxx - minx) * (maxy - miny) << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb emplace_back
#define fi first
#define se second
#define int long long
using namespace std;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int l) { uniform_int_distribution<int> uid(0, l - 1); return uid(rang); }
std::vector<int> adj[100004];
int dp[100005];
std::vector<int> pdp[100004];
std::vector<int> sdp[100004];
int M;
void dfs(int u, int p) {
	dp[u] = 1;
	pdp[u].pb(1);
	for (int v : adj[u]) 
		if (v != p) {
			dfs(v, u);
			dp[u] = (dp[u] * (dp[v] + 1)) % M;
			pdp[u].pb(dp[u]);
		}
	sdp[u].pb(1);
	reverse(adj[u].begin(), adj[u].end());
	for (int v : adj[u]) 
		if (v != p)
			sdp[u].pb(sdp[u].back() * (dp[v] + 1) % M); 
}

void dfs2(int u, int p, int val) {
	dp[u] = (dp[u] * (val + 1));
	reverse(adj[u].begin(), adj[u].end());
	int in = 0;
	int sin = (int)sdp[u].size() - 2;
	for (int v : adj[u]) 
		if (v != p)
			dfs2(v, u, (pdp[u][in++] * sdp[u][sin--] % M) * (val + 1) % M);
}

int32_t main() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.precision(10); srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	int n; cin >> n;
	cin >> M;
	for (int i = 0; i < n - 1; ++i) 
	{
		int u; cin >> u; u--;
		int v; cin >> v; v--;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	dfs(0, 0);
	dfs2(0, 0, 0);
	for (int i = 0; i < n; ++i) cout << dp[i] % M << "\n";
}

Measured memory_bytes: 26752
K = int(input())
now = 0
if K < 10:
    result = K
else:
    tmp_list = []
    for i in range(1, 10):
        tmp_list.append(i)
    now = 9
    while now != K:
        next_list = []
        for i in range(len(tmp_list)):
            fig = tmp_list[i] % 10
            if fig != 0:
                next_list.append(tmp_list[i] * 10 + fig - 1)
                now += 1
                if now == K:
                    break
            next_list.append(tmp_list[i] * 10 + fig)
            now += 1
            if now == K:
                break

            if fig != 9:
                next_list.append(tmp_list[i] * 10 + fig + 1)
                now += 1
                if now == K:
                    break
        tmp_list = next_list

if K > 10:
    result = tmp_list[-1]

print(result)

Measured memory_bytes: 6256
n = gets.to_i
s = gets.chomp.chars

w = Array.new(n,0)
b = Array.new(n,0)
ans=Array.new
(1...n).each do |i|
	b[i]= if (s[i-1]=='#')
			  b[i-1]+1
		  else
			  b[i-1]
		  end
end
(0...n-1).reverse_each do |i|
	w[i] = if (s[i+1]=='.')
			   w[i+1]+1
		   else
			   w[i+1]
		   end
end
(0...n).each do |i|
	ans.push(b[i]+w[i])
end

puts ans.min

Measured memory_bytes: 23164
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

int main()
{
    ll N, M, K;
    cin >> N >> M >> K;

    vector<ll> A(N+1, 0);
    vector<ll> B(M+1, 0);
    rep(i, 0, N)
    {
        int a;
        cin >> a;
        A[i+1] = a + A[i];
    }
    rep(i, 0, M)
    {
        int b;
        cin >> b;
        B[i+1] = b + B[i];
    }

    int max_book = 0;
    rep(num_a, 0, N+1)
    {
        if (A[num_a]>K) break;

        ll rest = K - A[num_a];

        auto itr = upper_bound(B.begin(), B.end(), rest);
        int num_b = itr - B.begin() - 1;

        // printf("num_a: %d, num_b: %d, total: %lld\n", num_a, num_b, B[num_b]);
        // printf("rest: %d\n", rest);

        max_book = max(max_book, num_a+num_b);
    }
    cout << max_book << endl;
    return 0;
}

Measured memory_bytes: 6420
// skyrim belongs to the nords
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back 
#define sz(a) ((int)(a).size())
#define rep(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define dec(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end() 
#define LOGN 18
#define EPS 1e-8
#define fcin ios_base::sync_with_stdio(false)
using namespace std;
typedef long long ll;
typedef double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;

int d[200005], N, M;
vector<int> adj[200005];
vector<int> v;
bool pos = false; 
void dfs(int curr, int k) {
	if (pos) return;
	if (k == 0) {
		if (curr == N) pos = true;
		return;
	}
	// v.push_back(curr);
	for (auto &x: adj[curr]) {
		dfs(x, k - 1);
		if (pos) return;
	}
	// v.pop_back(); 
}
int main(){
	fcin;
	cin.tie(0);
 
	cin >> N >> M;
	int a, b;
	for (int i = 0; i < M; i++) {
		cin >> a >> b;
		adj[a].pb(b);
		adj[b].pb(a);
	} 
	dfs(1, 2);
	if (!pos) cout << "IMPOSSIBLE\n";
	else cout << "POSSIBLE\n";
}


Measured memory_bytes: 12016
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        public static List<double[]> lis = new List<double[]>();
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            double[] p1 = new double[] { 0, 0 };
            double[] p2 = new double[] { 100, 0 };
            lis.Add(p1);
            kochCurve(p1, p2, n);
            lis.Add(p2);
            foreach (var x in lis) Console.WriteLine(String.Format("{0:0.00000000}", x[0]) + " " + String.Format("{0:0.00000000}", x[1]));
        }
        public static void kochCurve(double[] p1, double[] p2, int n)
        {
            if (n == 0) return;
            double rd = Math.PI * 60.0 / 180.0;
            
            var s = new double[] { (2.0 * p1[0] + 1.0 * p2[0]) / 3.0,
                (2.0 * p1[1] + 1.0 * p2[1]) / 3.0 };
            var t = new double[] { (1.0 * p1[0] + 2.0 * p2[0]) / 3.0,
                (1.0 * p1[1] + 2.0 * p2[1]) / 3.0};
            var u = new double[]{(t[0] - s[0]) * Math.Cos(rd) - (t[1] - s[1]) * Math.Sin(rd) + s[0],
                (t[0] - s[0]) * Math.Sin(rd) + (t[1] - s[1]) * Math.Cos(rd) + s[1]};

            n--;
            kochCurve(p1, s, n);
            lis.Add(s);
            kochCurve(s, u, n);
            lis.Add(u);
            kochCurve(u, t, n);
            lis.Add(t);
            kochCurve(t, p2, n);
        }
    }
}



Measured memory_bytes: 20356
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define Rep(i, a, b) for(ll i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<ll>
using namespace std;
using ll = long long;

int main(){
    ll h,w;
    cin>>h>>w;
    vector<string> a(h);
    rep(i,0,h) cin>>a[i];
    rep(i,0,w+2) cout<<"#";
    cout<<"\n";
    rep(i,0,h) cout<<"#"<<a[i]<<"#"<<"\n";
    rep(i,0,w+2) cout<<"#";
    cout<<"\n";
}


Measured memory_bytes: 384
// Created by Nandu Vinodan
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN
#define TC 0 

using namespace std;
using ll = long long;

void testcase() {
    int h, w, k;
    cin >> h >> w >> k;

    vector<string> mat(h);
    rep (i, 0, h-1) cin >> mat[i];
    int res = 0;
    int tot = h + w;
    for (int mask=0; mask < (1<<tot); mask++) {

        vector<bool> r(h), c(w);
        for (int i=0; i<tot; i++) {
            if ((mask >> i) & 1) {
                if (i < h) r[i] = true;
                else c[i-h] = true;
            }
        }

        int ct = 0;
        for (int i=0; i<h; i++) {
            for (int j=0; j<w; j++) {
                if (r[i] || c[j]) continue;
                if (mat[i][j] == '#')
                    ct++; 
            }
        }
        //cout << "Ct: " << ct << endl;
        if (ct == k) res++;
    }
    cout << res;
}


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    if (TC)
        cin>>t;
    while(t--) {
        testcase();
    }
    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int k,a,b,i,f=0;
  cin>>k;
  cin>>a>>b;
    for( i=a;i<=b;i++)
    {
        if(i%k==0)
        {
            f=1;
            break;
        }
    }
    if(f==1)
        cout<<"OK";
    else
        cout<<"NG";
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
 
const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

int main(){
    string s;
    cin >> s;

    ll ans = 0;
    ll mod = 2019;
    vector<ll> amari(2019, 0);

    rep(i, (ll)s.size()){
        int digit = s[i] - '0';

        vector<ll> amari_cp = amari;

        //dogitの分ずらす
        rep(j, 2019){
            amari[(j*10+digit)%mod] = amari_cp[j];
        }

        //この結果あまりが0であるものをタス
        ans += amari[0];
        amari[digit]++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3708
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ld pie=3.1415926535;
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    string s; cin>>s;
    rep(i,(s.size()+1)/2){
        cout<<s[i*2];
    }
    cout<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define mp make_pair
#define pb push_back
#define EB emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i,N){
        cin >> a[i];
    }


    int q=0;

    vector<int> v(8,0);
    rep(i,N){
        if(a[i]<400){
            v[0]++;
        }else if(a[i]<800){
            v[1]++;
        }else if(a[i]<1200){
            v[2]++;
        }else if(a[i]<1600){
            v[3]++;
        }else if(a[i]<2000){
            v[4]++;
        }else if(a[i]<2400){
            v[5]++;
        }else if(a[i]<2800){
            v[6]++;
        }else if(a[i]<3200){
            v[7]++;
        }else{
            q++;
        }
    }

    int x = *min_element(all(v));
    int y = *max_element(all(v));

    int c = 0;
    rep(i,8) if(v[i]>0) c++;

    cout << max(1,c) << " " << c + q << endl;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.next()
    val b = sc.next()
    println(problem169c(a, b))
}

fun problem169c(a: String, b: String): Long {
    return a.toLong() * (b.replace(".", "").toLong()) / 100
}

Measured memory_bytes: 41844
import bisect
n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
for i in x:
    if i <= y[len(y) // 2 - 1]:
        print(y[len(y) // 2])
    else:
        print(y[len(y) // 2 - 1])


Measured memory_bytes: 25224
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main()
{
          long long int a[100000],b,i;
          for(i=1;i<=5;i++)
          {
                    cin>>a[i];
          }
          for(i=1;i<=5;i++)
          {
                    if(a[i]==0)
                              cout<<i<<endl;
          }

return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<string>

#define rep(i,j) for(int i=0;i<j;++i)
#define fs first
#define sc second
#define pb push_back
using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;

int main(){
	string tmp;
	vi s(1), t(1);
	cin >> tmp;
	int cnt = 0;
	rep(i,tmp.length()){
		if(tmp[i] == 'A') s.pb(++cnt);
		else {
			cnt += 2;
			s.pb(cnt);
		}
	}
	cnt = 0;
	cin >> tmp;
	rep(i, tmp.length()){
		if(tmp[i] == 'A') t.pb(++cnt);
		else {
			cnt += 2;
			t.pb(cnt);
		}
	}

	int q;
	cin >> q;
	while(q--){
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		//printf("%d, %d, %d, %d\n", s[b], s[a-1], t[d], t[c-1]);
		if((s[b] - s[a-1]) % 3 == (t[d] - t[c-1]) % 3) cout << "YES" << endl;
		else cout << "NO" << endl;

	}
	return 0;
}

Measured memory_bytes: 1720
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(void){

  ll n;
  cin>>n;
  
  set<pair<ll,ll>> b;
  vector<ll> ans(0);
  rep(i,n){
    ll _b;
    cin>>_b;
    b.insert(make_pair(i,_b));
  }
  rep(i,n){
    ll index=1;
    pair<ll,ll> cand=make_pair(1000,1000);
    for(auto x:b){

      if( index == x.second ){
        cand=make_pair(x.first,x.second);
      }
      index++;
    }
    if(cand.second == 1000){
        cout << -1 << endl;
        return 0;
      }
      else{
        //cout << cand.first << "," << cand.second << endl;
        ans.pb(cand.second);
        b.erase(cand);
    }
    
  }

  rep_r(i,ans.size()){
    cout << ans[i] << endl;
  }
  

  return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define loop(i,a,b) for(i=a;i<b;i++)
#define rloop(i,a,b) for(i=a;i>=b;i--)
#define vi vector<int>
#define vs vector<string>
typedef pair<string,int> card;
#define mark first
#define kazu second
const int inf=1e9+1;
const ll INF=1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846

class Tree{
	int node;
	int degree;
	int parent;
	int depth;
	string type;
	vi children;
public:
	Tree(){}
	int get_node() const{return node;}
	void set_node(int a){node=a;}
	int get_degree() const{return degree;}
	void set_degree(int a){degree=a;}
	int get_parent() const{return parent;}
	void set_parent(int a){parent=a;}
	int get_depth() const{return depth;}
	void set_depth(int a){depth=a;}
	string get_type() const{return type;}
	void set_type(string s){type=s;}
	int get_children(int i) const{return children[i];}
	void set_children(int a){children.push_back(a);}
};

void depth(vector<Tree> &tree,int i);

int main(){
	int n,i,j;
	cin>>n;
	vector<Tree> tree(n);
	loop(i,0,n){
		tree[i].set_node(i);
		tree[i].set_parent(-1);
		tree[i].set_depth(-1);
	}
	int id,k,c;
	loop(i,0,n){
		cin>>id>>k;
		tree[id].set_degree(k);
		loop(j,0,k){
			cin>>c;
			tree[id].set_children(c);
			tree[c].set_parent(id);
		}
	}
	loop(i,0,n){
		if(tree[i].get_parent()==-1){
			tree[i].set_depth(0);
			tree[i].set_type("root");
			break;
		}
	}
	depth(tree,i);
	loop(i,0,n){
		cout<<"node "<<tree[i].get_node()<<": parent = "<<tree[i].get_parent();
		cout<<", depth = "<<tree[i].get_depth()<<", "<<tree[i].get_type()<<", [";
		loop(j,0,tree[i].get_degree()-1){
			cout<<tree[i].get_children(j)<<", ";
		}
		if(tree[i].get_degree()!=0){
			cout<<tree[i].get_children(tree[i].get_degree()-1);
		}
		cout<<"]"<<endl;
	}
}
void depth(vector<Tree> &tree,int i){
	int j;
	loop(j,0,tree[i].get_degree()){
		tree[tree[i].get_children(j)].set_depth(tree[i].get_depth()+1);
		}
	if(tree[i].get_degree()==0){
		if(tree[i].get_type()!="root"){
			tree[i].set_type("leaf");
		}
	}else{
		if(tree[i].get_type()!="root"){
			tree[i].set_type("internal node");
		}
		loop(j,0,tree[i].get_degree()){
			depth(tree,tree[i].get_children(j));
		}
	}
}
	

Measured memory_bytes: 12916
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

bool prime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}
bool comp(pi a,pi b)
{
    if(a.fi==b.fi)return a.se<b.se;
    return a.fi>b.fi;
}

struct commp
{
    bool operator()(pi a,pi b)const{
        if(a.fi==b.fi)return a.se<b.se;
        return a.fi<b.fi;
    }
};
ll mulmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a*b)%mod;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll k; cin>>k;
string s; cin>>s;
if(s.size()<=k)cout<<s<<endl;
else cout<<s.substr(0,k)<<"...\n";
return 0;
}


Measured memory_bytes: 3604
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s,d,f,g,h,i,j;
	scanf("%d %d",&a,&s);
	if(a>=0) printf("1\n");
	if(a<0){
		a*=-1;
		if(a==s)
			printf("0\n");
		else if(a>s) printf("-1\n");
	}
	return 0;
}

Measured memory_bytes: 2676