akhauriyash/Code-Regression huggingface dataset:
buildings = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())
for N in range(n):
    b,f,r,v = map(int, input().split())
    buildings[b-1][f-1][r-1] += v

x = 0
for i in range(4):
    if x != 0:
        print("#"*20)
    x += 1
    for j in range(3):
        for k in range(10):
                print(" " + str(buildings[i][j][k]), end="")
        print()



Measured memory_bytes: 5628
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#define int long long
using namespace std;
pair<int,int>a[114514];
signed main(){
    int n,m;
    cin>>n>>m;
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>a[i].first;
        cin>>a[i].second;
    }
    sort(a,a+n);
    for(int j=0;j<n;j++){
        if(m<=a[j].second){
            ans+=m*a[j].first;
            break;
        }
        else{
            ans+=a[j].first*a[j].second;
            m=m-a[j].second;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
int n, p, i, j, k, H, x[128], y[128], h[128];
int main() {  // 最坏情况，H=1，给出101*101-1个点全为h=0，但是n只有100，说明给定的h必然存在非零值（以下代码仅供娱乐）
    for (scanf("%d", &n), i = 0, p = 0; i < n; i++) scanf("%d%d%d", x + i, y + i, h + i), p = h[i] ? i : p;
    for (i = 0; i < 101; i++) for (j = 0; j < 101; j++) for (H = h[p] + std::abs(i - x[p]) + std::abs(j - y[p]), k = 0; (k < n && h[k] == std::max(0, H - std::abs(i - x[k]) - std::abs(j - y[k]))) || (k == n && (printf("%d %d %d\n", i, j, H), exit(0), 0)); k++);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,K;
    cin >> N >> K;
    vector<int> s(N);
    for(int i = 0; i < N; i++){
        cin >> s.at(i);
    }
    sort(s.begin(),s.end());
    int ans = 0;
    for(int i = 0; i < K;i++){
        ans += s.at(i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
<?php
fscanf(STDIN, '%d %d', $h, $w);

$s = [];
for ($i = 0; $i < $w + 2; $i++) {
    $s[0][$i] = 0;
}
for ($i = 1; $i < $h + 1; $i++) {
    $s[$i][0] = 0;
    $str = trim(fgets(STDIN));
    for ($j = 1; $j < $w + 1; $j++) {
        if ($str[$j - 1] === '.') {
            $s[$i][$j] = 0;
        } else {
            $s[$i][$j] = 1;
        }
    }
    $s[$i][$j] = 0;
}
for ($i = 0; $i < $w + 2; $i++) {
    $s[$h + 1][$i] = 0;
}

$result = true;
for ($i = 1; $i < $h; $i++) {
    for ($j = 1; $j < $w; $j++) {
        if ($s[$i][$j] === 1
            && $s[$i - 1][$j] === 0
            && $s[$i + 1][$j] === 0
            && $s[$i][$j - 1] === 0
            && $s[$i][$j + 1] === 0
        ) {
            $result = false;
        }
    }
}

if ($result) {
    echo 'Yes' . PHP_EOL;
} else {
    echo 'No' . PHP_EOL;
}

Measured memory_bytes: 4728
from itertools import product

N, A, B, C = map(int, input().split())
L = sorted(
  [ int(input()) for _ in range(N) ], 
  reverse = True
)

ALL = list(product(['A', 'B', 'C', 'N'], repeat = N))

ans = 10 ** 9 + 7
for node in ALL:
  if len(set([ no for no in node if no != 'N'])) == 3:
    a, b, c = 0, 0, 0
    cost = N - 3 - len([ no for no in node if no == 'N'])
    for i, n in enumerate(node):
      if n == 'A':
        a += L[i]
      elif n == 'B':
        b += L[i]
      elif n == 'C':
        c += L[i]
      else:
        continue
    ans = min(abs(a-A) + abs(b-B) + abs(c-C) + 10 * cost, ans)
    
print(ans)

Measured memory_bytes: 10996
//57
#include<iostream>
#include<vector>
#include<set>

using namespace std;

struct S{
  int t,v;
  bool operator<(S a)const{
    if(t!=a.t){
      return t<a.t;
    }else{
      return v<a.v;
    }
  }
};

int main(){
  for(int n;cin>>n,n;){
    int v=0;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	int b;
	cin>>b;
	v|=b<<i*n+j;
      }
    }
    set<S> que;
    S is={0,v};
    que.insert(is);
    set<int> s;
    for(;;){
      S c=*que.begin();
      if(c.v==0)break;
      que.erase(que.begin());
      if(!s.insert(c.v).second)continue;
      int j,k;
      for(j=0;j<n;j++){
	for(k=0;k<n;k++){
	  if(c.v>>j*n+k&1)goto next;
	}
      }
    next:
      for(int l=j;l<n;l++){
	for(int m=k;m<n;m++){
	  int nv=c.v;
	  for(int o=j;o<=l;o++){
	    for(int p=k;p<=m;p++){
	      nv^=1<<o*n+p;
	    }
	  }
	  if(s.count(nv))continue;
	  S ns={c.t+1,nv};
	  que.insert(ns);
	}
      }
    }
    for(int i=0;i<que.begin()->t;i++){
      cout<<"myon";
    }
    cout<<endl;
  }
  return 0;
}

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

int main(){
    int k,s;
    cin>>k>>s;
    int ans = 0;
    for(int i=0;i<=k;i++){
        for(int j=0;j<=k;j++){
            if(s-i-j<=k && s-i-j>=0) ans++;
        }
    }
    cout << ans << endl;
}


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

#define add push_back
#define inf 2147000000
#define pi 3.1415926535

#define rep(i,n) for(int i=0;i<n;i++)
#define out(a) cout<<a<<endl;

using namespace std;

using namespace std;

char str[1000010];
int n,m;

int saiki(int now,int dep){
	if(dep==n){
		return 1;
	}
	if(str[now]!='O' || str[now+1]!='I')return 0;
	return saiki(now+2,dep+1);
}

int main(void){
	
	while(1){
	scanf("%d",&n);
	if(n==0){
		break;
	}
	scanf("%d",&m);
	scanf("%s",str);
	
		int cont=0;
		int a=m-n*2;
		rep(i,a){
			if(str[i]=='I'){
				cont+=saiki(i+1,0);
			}
		}
		
		cout<<cont<<endl;
	}
}

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

#define MOD 1000000007

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

  ll ans = 1;
  ll koeru = 1000000000000000000;
  rep(i, n) {
    ll a;
    cin >> a;
    if (a == 0) {
      ans = 0;
      break;
    }
    if (ans < 0) {
      continue;
    }
    if (a > koeru) {
      ans = -1;
      continue;
    }
    ans *= a;
    koeru = 1000000000000000000 / ans;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3636
<?php
$result = array();
while(true){
    $array = explode(' ', trim(fgets(STDIN)));
    if($array[0] == 0 && $array[1] == 0){
        break;
    }elseif($array[0] > $array[1]){
        sort($array);
        $result[] = implode(' ', $array);
    }else{
        $result[] = implode(' ', $array);
    }
}
echo implode("\n", $result);
?>

Measured memory_bytes: 15628
#include<stdio.h>

int main()
{
	int m[10][10]={0},
		incX[3][14]={
			{0,-1,0,1,0,3},
			{-1,0,1,-1,0,1,-1,0,1,3},
			{0,-1,0,1,-2,-1,0,1,2,-1,0,1,0,3}},
		incY[3][14]={
			{-1,0,0,0,1,3},
			{-1,-1,-1,0,0,0,1,1,1,3},
			{-2,-1,-1,-1,0,0,0,0,0,1,1,1,2,3}},
			x,y,s,b=0,max=0;
	while(scanf("%d,%d,%d",&x,&y,&s)!=EOF)
	{
		for(int i=0;incX[s-1][i]!=3||incY[s-1][i]!=3;i++)
		{
			int X=x+incX[s-1][i],Y=y+incY[s-1][i];
			if(X>=0 && X<10 && Y>=0 && Y<10)
				m[Y][X]+=1;
		}
	}
	for(int i=0;i<10;i++)
		for(int j=0;j<10;j++)
		{
			if(m[i][j]==0)
				b++;
			else if(max<m[i][j])
				max=m[i][j];
		}
	printf("%d\n%d\n",b,max);
	return 0;
}

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

using namespace std;

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

  vector<vector<pair<int, int>>> data(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;
      data[i].push_back(make_pair(x-1, y));
    }
  }

  int ans = 0;
  for (int bit = 0; bit < (1<<n); bit++) {
    bool is_ok = true;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      // i番目の人は正直かどうか決め打ちしたとき矛盾しないか調べる
      if ((bit>>i) & 1) {
        for (int k = 0; k < data[i].size(); k++) {
          int xx = data[i][k].first;
          int yy = data[i][k].second;
          if (((bit>>xx) & 1) != yy) {
            is_ok = false;
          }
        }
        cnt++;
      }
    }
    if (is_ok) {
      ans = max(ans, cnt);
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
n, k, q = map(int,input().split())
ans_li = [int(input()) for i in range(q)]
point_li = [k] * n
for i in ans_li:
    point_li[(i - 1)] += 1
for j in point_li:
    if j - len(ans_li) > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 10452
#[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 ( 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 , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ 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" ) } ; }

fn main() {
    input! {
        _a: chars,
        s: chars,
        _c: chars
    }
    println!("A{}C", s[0]);
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  while(1) {
    int n;
    cin >> n;
    if(n == 0) break;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    int ans = -1000000000;
    //るいせきわ
    vector<int> R(n + 1);
    R[0] = 0;
    
    for(int i = 0; i < n; i++) {
      R[i + 1] = R[i] + a[i];
    }

    for(int l = 0; l < n; l++) {
      for(int r = l; r < n; r++) {
        int temp = R[r + 1] - R[l];
        ans = max(ans, temp);
      }
    }

    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3120
#include <cmath>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;


int main(){
    int H, W;
    int l = 0;
    int endF;
    int ans = 0;

    cin >> H >> W;

    H += 2;
    W += 2;

    char S[W * H];
    char copyS[W * H];

    for(int i = 0; i < W; i++){
        S[i] = '#';
    }
    for(int j = 1; j < H - 1; j++){
        S[W * j] = '#';
        for(int i = 1; i < W - 1; i++){
            cin >> S[W * j + i];
        }
        S[W * (j + 1) - 1] = '#';
    }
    for(int i = 0; i < W; i++){
        S[W * (H - 1) + i] = '#';
    }

    for(int i = 0; i < W * H; i++){
        for(int j = 0; j < W * H; j++){
            copyS[j] = S[j];
        }
        if(copyS[i] == '.'){
            copyS[i] = 'S';
            l = 0;
            endF = 0;
            while(endF != 1){
                endF = 1;
                for(int j = 0; j < W * H; j++){
                    if(copyS[j] == 'N'){
                        copyS[j] = 'S';
                    }
                }
                for(int j = 0; j < W * H; j++){
                    if(copyS[j] == 'S'){
                        if(copyS[j - W] == '.'){
                            copyS[j - W] = 'N';
                        }
                        if(copyS[j - 1] == '.'){
                            copyS[j - 1] = 'N';
                        }
                        if(copyS[j + 1] == '.'){
                            copyS[j + 1] = 'N';
                        }
                        if(copyS[j + W] == '.'){
                            copyS[j + W] = 'N';
                        }
                        copyS[j] = '#';
                        endF = 0;
                    }
                }
                if(endF != 1){
                    l++;
                }else{
                    l--;
                }
            }
            if(ans < l){
                ans = l;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	string date[111],dateoki[111];
	int date2[111][111];
	int ps;
	int h,w;
	while (1) {
		cin >> h >> w;
		if (h == 0 && w == 0) {
			goto a;
		}
		ps = 0;
		for (int i = 1; i <= 100; i++) {
			for (int m = 1; m <= 100; m++) {
				date2[i][m] = 0;
			}
		}
		for (int i = 1; i <= h; i++) {
			cin >> date[i];
		}
		for (int i = 1; i <= h; i++) {
			for (int m = 0; m <= w-1; m++) {
				if (i == 1) {
					if (m == 0) {
						ps=ps + 1;
						date2[1][1] = ps;
					}
					if (m != 0) {
						if (date[i][m] == date[i][m - 1]){
							date2[i][m] = date2[i][m - 1];
						}
						else {
							ps = ps + 1;
							date2[i][m] = ps;
						}
					}
				}
				if (i != 1) {
					if (m == 0) {
						if (date[i][m] == date[i - 1][m]) {
							date2[i][m] = date2[i - 1][m];
						}
						else {
							ps = ps + 1;
							date2[i][m] = ps;
						}
					}
					else {
						if (date[i][m] == date[i - 1][m]) {
							date2[i][m] = date2[i - 1][m];
						}
						else {
							ps = ps + 1;
							date2[i][m] = ps;
						}
						if (date[i][m] == date[i][m - 1]) {
							if (date2[i][m] != date2[i][m - 1]) {
								for (int s = 1; s <= h; s++) {
									for (int e = 0; e <= w-1; e++) {
										if (date2[s][e] == date2[i][m]) {
											date2[s][e] = date2[i][m - 1];
										}
									}
								}
							}
						}
					}
				}
			}
		}
		int ans;
		ans = 0;
		int box[111111], bo;
		bo = 0;
		for (int i = 1; i <= h; i++) {
			for (int m = 0; m <= w-1; m++) {
				for (int s = 1; s <= bo; s++) {
					if (date2[i][m] == box[s]) {
						goto b;
					}
				}
				bo = bo + 1;
				box[bo] = date2[i][m];
			b:;
			}
		}
		cout << bo << endl;
	}
a:;
}



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

using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    vector<int> v;
    for(int i=0;i<n;++i){
        int d;
        cin >> d;
        v.push_back(d);
    }
    int ans = 0;
    for(int i=0;i<n;++i){
        for(int j=i+1;j<n;++j){
            ans += v[i] * v[j];
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define mod 998244353
typedef long long ll;
int  mod_pow(int a,int b){
    if(b==0)return 1;
    if(b==1)return a;
    if(b%2==0){
        int k = mod_pow(a,b/2);
        return k*k%mod;
    }else{
        int k = mod_pow(a,b/2);
        k *= k;
        k%= mod;
        return k*a%mod;
    }
}
#define MAX_N 100005
int inv[MAX_N],fac[MAX_N],finv[MAX_N];
void make(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i=2;i<MAX_N;i++){
        inv[i] = mod -inv[mod%i]*(mod/i)%mod;
        fac[i] = fac[i-1]*i%mod;
        finv[i] = finv[i-1]*inv[i] %mod;
    }
}

inline int add(int x,int y){
    return (x+y)%mod;
}
inline int sub(int x,int y){
    return (x+mod-y)%mod;
}
inline int mul(int x,int y){
    return x*y%mod;
}

void extgcd(int a,int b,int &x,int &y){
    if(b!=0){
        extgcd(b,a%b,y,x);
        y -= (a/b)*x;
    }else{
        x = 1;
        y = 0;
    }
}

int mod_inverse(int a,int m){
    int x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;   
}

int solve(int deg,int num,vector<int>&val){
    if(num<=deg){
        return val[num];
    }
    int ue = 1;
    rep(i,deg+1){
        ue = mul(ue,sub(num%mod,i));
    }
    int ans = 0;
    rep(i,deg+1){
        int r1 = mul(ue,mul(mod_inverse(sub(num%mod,i),mod),val[i]));
        int r2 = mul(finv[deg-i],finv[i]);
        if((deg-i)%2){
            r2 = mod-r2;
        }
        ans = add(ans,mul(r1,r2));
    }
    return ans;
}

signed main(){
    make();
    ll n;
    ll ss;
    cin >> n >> ss;
    vector<ll> p(n+1),q(n+1);
    rep(s,2*n+2){
        ll sm = 0;
        rep(x,s){
            sm += mod_pow(s+1,n-2)*(s-x)%mod;
            sm %= mod;
        }
        //cerr << sm << endl;
        for(int x=1;x<=s;x+=2){
            sm += (s-x)*((mod_pow(s-x+1,n-2)+mod-(mod_pow(s-x,n-2)))%mod)%mod;
            
            sm %= mod;
        }
        for(int x=1;x<=s;x+=2){
            sm += mod_pow(s-x+1,n-2);
            sm %= mod;
        }
        //cerr << s << " " << sm << endl;
        if(s%2==0)p[s/2] = sm;
        else q[s/2] = sm;
        //cerr << s << endl;
    }
    if(ss%2==0)cout << solve(n,ss/2,p) << endl;
    else cout << solve(n,ss/2,q) << endl;
    
    return 0;
}


Measured memory_bytes: 5440
N = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

c = 0
for i in range(N):
   if b[i] - a[i] > 0:
      c += (b[i] - a[i])//2
   elif b[i] - a[i] < 0:
      c += b[i] - a[i]

if c >= 0:
   print("Yes")
else:
   print("No")


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

int main()
{
	int n,y,i,j,k;
	cin>>n>>y;
	
	for(i=0;i<=y/10000;i++){
		for(j=0;j<=y/5000;j++){
			k=n-i-j;
			if(k>=0&&i*10000+j*5000+k*1000==y){
				cout<<i<<" "<<j<<" "<<k<<endl;
				return 0;
			}
		}
	}
	cout<<"-1 -1 -1"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int a = cin.Int();
			int b = cin.Int();

			int ans = -1;
			for (int i = 1; i < 2000; i++) {
				if ((int)(i * 0.08) == a && (int)(i * 0.1) == b) {
					ans = i;
					break;
				}
			}

			Console.WriteLine(ans);
		}
	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private readonly Func<string> reader_;
		private string[] buf_;
		private int index_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 13140
#include <stdio.h>
long long n, m, i, j, k, a, b;
int main(){
	scanf("%d%d%d", &k, &a, &b);
	for(i=a; i<=b; i++){
		if(i%k == 0) break;
	}
	if(i <= b) printf("OK\n");
	else printf("NG\n");
	return 0;
}

Measured memory_bytes: 1660
d, g = gets.split.map(&:to_i)
ps = []
cs = []
d.times do
  p,c=gets.split.map(&:to_i)
  ps << p
  cs << c
end

ans = ps.inject(:+)
(1 << d).times do |bb|

  debug = []

  cx = 0
  score = 0
  rest = []
  d.times do |i|
    if (bb & (1 << i)) > 0
      cx += ps[i]
      score += cs[i] + 100 * ps[i] * (i + 1)
      debug << [i, :FULL, ps[i]]
    else
      rest << i
    end
  end

  rest.reverse!
  rest.each do |i|

    k = 0
    while score < g and k < ps[i] - 1
      score += (i + 1) * 100
      cx += 1
      k += 1
    end

    debug << [i, k]
  end

  if score >= g
    ans = [ans, cx].min
  end

end

p ans


Measured memory_bytes: 1916
S = list(input())

ans_s = ''
for i in range(len(S)):
    for k in range(len(S[i:])):
        cnt = 0
        for s in S[i:i+k+1]:
            if s in ['A', 'C', 'G', 'T']:
                cnt += 1
        if cnt == len(S[i:i+k+1]) and cnt >= len(ans_s):
            ans_s = S[i:i+k+1]

print(len(ans_s))
                


Measured memory_bytes: 8844
#include <bits/stdc++.h>
#define ll long long
#define re register
#define IL inline
using namespace std;
const int maxn=1e4+5;
const int maxd=100+5;
const int mod=1e9+7;
template<typename T> void fread(T &x){
	T f=1;x=0;
	char s=getchar();
	while(s<'0' || s>'9'){if(s=='-') f=-1;s=getchar();}
	while(s>='0' && s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();}
	x*=f;
}
string s;
int d,pos[maxn];
ll dp[maxn][maxd];
ll dfs(int st,int sta,bool lim){
	if(st==s.size()) return dp[st][sta]=(sta==0);
	if(!lim && dp[st][sta]!=-1) return dp[st][sta];
	int up=lim?pos[st]:9;
	ll ret=0;
	for(re int i=0;i<=up;i++){
		(ret+=dfs(st+1,(sta+i)%d,lim&&(i==pos[st])))%=mod;
	}
	if(!lim) dp[st][sta]=ret;
	return ret;
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	memset(dp,-1,sizeof dp);
	cin>>s>>d;
	for(re int i=0;i<s.size();i++) pos[i]=s[i]-'0';
	cout<<(dfs(0,0,1)-1+mod)%mod<<endl;
	return 0;
}


Measured memory_bytes: 12700
/* C++14(GCC5.4.1) */
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
static const ll MAX_N = 1000000;


// m>=nを想定している
ll gcd(ll m, ll n){
    if(n==0) return m;
    return gcd(n,m%n);
}


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

// 素因数分解
vector<pair<ll, int>> factoring(ll n){
    vector<pair<ll, int>> res;
    for (ll i = 2; i * i <= n; ++i) {
        int k = 0;
        while (n % i == 0){
            n /= i;
            k++;
        }
        if(k != 0) res.push_back({i, k});
    }
    if(n != 1) res.push_back({n, 1});
    return res;
}


int main(void){
    // 入力
    ll a,b;
    cin >> a >> b;

    // a,bのGCDを求める
    ll gcd_of_ab;
    if(a>=b) gcd_of_ab = gcd(a,b);
    else gcd_of_ab = gcd(b,a);

    // 求めたいのはGCD以下のGCDを割り切る素数の個数
    ll ans=1;
    auto m = factoring(gcd_of_ab);
    ans += m.size();

    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n, m; cin >> n >> m;
    vector<ll> a(n), b(n);
    REP(i, n) cin >> a[i] >> b[i];

    vector<ll> rank(n);
    iota(ALL_OF(rank), 0LL);
    sort(ALL_OF(rank), [&](ll i, ll j) -> bool {
        return a[i] < a[j];
    });

    ll j = 0, ans = 0;
    priority_queue<ll> q;
    RANGE(rem, 1, m) {
        while (j < n && a[rank[j]] <= rem) {
            q.push(b[rank[j]]);
            j++;
        }
        if (q.size()) {
            ans += q.top(); q.pop();
        }
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 3704
local DBG = false
local function dbgpr(...)
    if DBG then
        io.write("[dbg]")
        print(...)
    end
end

-- returns (b^n) % m
local function modpow(b, n, m)
    if n == 0 then
        return 1
    elseif n % 2 == 0 then
        return modpow(b * b % m, n//2, m) % m
    else
        return b * modpow(b, n - 1, m) % m
    end
end

---
local MOD = 998244353
local N = io.read("n")
local a = {}
local S = 0
for i=1,N do
    a[i] = io.read("n")
    S = S + a[i]
end

local function fill90000(t, v)
    for i=1,90000 do
        t[i] = v
    end
end

-- ∑A = S/2 and ∑B = S/2 and ∑C = 0
local function getY()
    if S % 2 == 1 then
        return 0
    end
    local cache = {}
    fill90000(cache, 0)
    cache[0] = 1
    local curmax = 0
    for i=1,N do
        local cur = a[i]
        curmax = curmax + cur
        for s=curmax,cur,-1 do
            cache[s] = (cache[s] + cache[s-cur]) % MOD
        end
    end
    return cache[S//2]
end

-- ∑A >= S/2
local function getX()
    local cache = {}
    fill90000(cache, 0)
    cache[0] = 1
    local curmax = 0
    for i=1,N do
        local cur = a[i]
        curmax = curmax + cur
        for s=curmax,cur,-1 do
            cache[s] = (2 * cache[s] + cache[s-cur]) % MOD
        end
        for s=cur-1,0,-1 do
            cache[s] = 2 * cache[s] % MOD
        end
    end
    local sum = 0
    for s = math.ceil(S/2), curmax, 1 do
        sum = sum + cache[s]
    end
    return sum
end

local X, Y = getX(), getY()
local Total = modpow(3, N, MOD)
--dbgpr(Total, X, Y)
local ans = (Total - (3 * X) + (3 * Y)) % MOD
print(ans)


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using vec_b = vector<bool>;
using vec_str = vector<string>;
using graph = mat;
using edge = pair<ll,ll>;
using wgraph = vector<vector<edge>>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back


int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    _PR(a+b+c>=22?"bust":"win");


    return 0;
}

/*



*/

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; i++) cin >> h[i];
    int ans = 0;
    for(int i = 1; i < n; i++)
    {
        bool ok = true;
        for(int j = 0; j < i; j++)
        {
            if(h[j] > h[i]) ok = false;
        }
        if(ok) ans++;
    }
    cout << ans + 1 << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}
//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
bool isPrime(int x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

int main(){
    string s;
    cin >> s;
    if(s[s.size()-1]=='3')  puts("bon");
    else if(s[s.size()-1]=='0'||s[s.size()-1]=='1'||s[s.size()-1]=='6'||s[s.size()-1]=='8')
        puts("pon");
    else{
        puts("hon");
    }

    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  int n,k;cin>>n>>k;int c=0,a;
  for(int i=0;i<n;i++){
    cin>>a;if(a>=k)c++;
  }
  cout<<c;
}

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

int main()
{
  int k;
  string s;
  cin >> k;
  cin >> s;
  
  if (s.size() <= k) cout << s << endl;
  else
  {
    for (int i = 0; i < k; i ++)
      cout << s.at(i);
    cout << "..." << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3632
p = []
def is_prime_trial_division(n):
    if n < 2:
        return False
    else:
        for i in range(2, n):
            if i * i > n:
                break
            elif n % i == 0:
                return False
        return True
for i in range(2,55555):
    if is_prime_trial_division(i):
        p.append(i)
N = int(input())
s = ""
a = []

for i in p:
    if i%5==1:
        a.append(i)
    if len(a)==N:
        break

for i in range(N):
    s += str(a[i])+" "
s = s[:-1]
print(s)

Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 998244353;
ll mod_pow(ll a, ll n) {
	if (n == 0) return 1;
	if (n % 2 == 0) {
		ll tmp = mod_pow(a, n / 2);
		return (tmp * tmp) % MOD;
	}
	return (a * mod_pow(a, n - 1)) % MOD;
}

vector<ll> fact;
vector<ll> inv_fact;

void comb_init(int n) {
	fact.resize(n + 1);
	inv_fact.resize(n + 1);
	fact[0] = inv_fact[0] = 1;
	for (int i = 1; i <= n; i++) {
		fact[i] = (fact[i - 1] * i) % MOD;
		inv_fact[i] = (inv_fact[i - 1] * mod_pow(i, MOD - 2)) % MOD;
	}
}

ll comb(int n, int k) {
	if (n < k) return 0;
	ll ret = fact[n];
	(ret *= inv_fact[k]) %= MOD;
	(ret *= inv_fact[n - k]) %= MOD;
	return ret;
}
ll dp[3001][6001];
ll dp2[3001][6001];
int main() {
	int N, X;
	cin >> N >> X;
	if (N == 1) {
		cout << 2 << endl;
		return 0;
	}
	if (X == 1) {
		cout << mod_pow(2, N) << endl;
		return 0;
	}
	if (X == 2) {
		cout << N + 1 << endl;
		return 0;
	}
	comb_init(N);
	dp[0][0] = 1;
	dp2[0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= 2 * i; j++) {
			(dp[i + 1][j] += dp[i][j]) %= MOD;
			(dp[i + 1][j + 1] += dp[i][j]) %= MOD;
			(dp[i + 1][j + 2] += dp[i][j]) %= MOD;
			(dp2[i + 1][j + 1] += dp2[i][j]) %= MOD;
			(dp2[i + 1][j + 2] += dp2[i][j]) %= MOD;
		}
	}
	ll ans = 0;
	for (int i = 0; i <= N - 2; i++) {
		ll sum = 0;
		for (int j = 0; j < i; j++) {
			if (j * 2 + 1 > X - 3) break;
			if (i + 2 + j <= N) (sum += comb(N, i + 2 + j)) %= MOD;
			(ans += dp2[i - j - 1][X - 3 - (j * 2 + 1)] * sum%MOD) %= MOD;
		}
		if (i * 2 == X - 3) {
			for (int j = 0; j <= N - 2 - i; j++) (ans += comb(N, i + 2 + j)) %= MOD;
		}
	}
	for (int i = 0; i < X; i++) (ans += dp[N][i]) %= MOD;
	cout << ans << endl;
 }

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

#define ll long long
#define ld long double

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define repA(i,A)   for(auto i:A)

#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)	A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V> 
#define Vpll vector<pll>

#define endl "\n"

const ll logN = 20;
const ll N = 100005;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll dx[4] = {1,0,-1,0};
const ll dy[4] = {0,1,0,-1};

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n;
    cin>>n;
    ll A[n];
    bool f=0;
    rep(i,0,n)	cin>>A[i];
    ll last=0;
    rep(i,0,n){
    	last = max(last, A[i]-1);
    	if(A[i]<last)	f=1;
    }
    if(!f)	cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    int h,w;cin>>h>>w;
    int n;cin>>n;
    queue<pair<int,int>> que;
    rep(i,n){
        int a;cin>>a;
        que.push({a,i+1});
    }
    que.push({100,1000});
    int t[h][w];
    int a=que.front().first,now=que.front().second;que.pop();
    
    rep(i,h){
        if(i%2==0){
            for(int j=0;j<w;j++){
                t[i][j]=now;a--;
                if(a==0){
                    a=que.front().first,now=que.front().second;que.pop();
                }
            }
        }else{
            for(int j=w-1;j>=0;j--){
                t[i][j]=now;a--;
                if(a==0){
                    a=que.front().first,now=que.front().second;que.pop();
                }
            }
        }
    }
    rep(i,h){
        rep(j,w)cout<<t[i][j]<<" ";
        cout<<endl;
    }
}

Measured memory_bytes: 384
#include<stdio.h>
int main (){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a<b){
	printf("a < b\n");
		} else if(a>b){
			printf("a > b\n");
	} else {
	printf("a == b\n");
}
            return 0;
}

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

// マクロ
// forループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x)begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
// 出力
#define PRINT(x) cout<<(x)<<endl
#define PRINTA(x,n) REP(i,n)PRINT(x[i])
// 定数
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
// 略記
#define PB push_back
#define MP make_pair

int N, M, H[100009], A[100009], B[100009];

vector<int> G[100009];

int main() {
    cin >> N >> M;
    FOR(i, 1, N) cin >> H[i];
    REP(i, M) {
        cin >> A[i] >> B[i];
        G[A[i]].PB(B[i]);
        G[B[i]].PB(A[i]);
    }

    int ans = 0;
    FOR(i, 1, N) {
        int is_good = 1;
        REP(j, G[i].size()) {
            if (H[i] <= H[G[i][j]]) is_good = 0;
        }
        if (is_good) ans++;
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 9896
import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val (h, w, d) = readIntegerList()
    val pMap = mutableMapOf<Int, Pair<Int, Int>>()
    for (i in 1..h) {
        val aList = readIntegerList()
        for (j in 1..w) {
            pMap[aList[j - 1]] = Pair(i, j)
        }
    }

    // Dごとに累積和をとる
    val sum = LongArray(h * w + d + 1)
    for (i in 1..(h * w - d)) {
        sum[i + d] =
            sum[i] + Math.abs(pMap[i + d]!!.first - pMap[i]!!.first) + Math.abs(pMap[i + d]!!.second - pMap[i]!!.second)
    }

    val q = readInteger()
    repeat(q) {
        val (l, r) = readIntegerList()
        out.println(sum[r] - sum[l])
    }
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 78312
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>

using namespace std;

int main() {
	int i, j, k;
	int a, b;
	vector<int>en(16, 0);

	cin >> a >> b;

	for (i = 0; i < 16; i++) {
		if (i == 15) {
			if (a > 0) {
				if (en[0] != 11) {
					a--;
					break;
				}
			}
			if (b > 0) {
				if (en[0] != 22) {
					b--;
					break;
				}
			}
		}
		if (i>=1 && en[i-1]!=11 && a > 0) {
			en[i] = 11;
			a--;
			i++;
		}

		if (i == 0 &&  a > 0) {
			en[i] = 11;
			a--;
			i++;
		}
		
		if (en[i-1]!=22 && b > 0) {
			en[i] = 22;
			b--;
		}
	}


	if (a == 0 && b == 0) {
		cout << "Yay!" << endl;
	}
	else {
		cout << ":(" << endl;
	}




	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {

        double[] abhm =  Array.ConvertAll(System.Console.ReadLine().Split(' '),double.Parse);
        double kakudo = 0.0d;
        double kotae = 0.0d;
        kakudo = (1.0d / 12.0d * abhm[2] * 360.0d + 1.0d / 60.0d * abhm[3] * 30.0d) - 1.0d / 60.0d * abhm[3] * 360.0d;
        kotae = Math.Sqrt(Math.Pow(abhm[0], 2.0d) + Math.Pow(abhm[1], 2.0d) - 2.0d * abhm[0] * abhm[1] * Math.Cos(Math.PI * kakudo / 180.0d));
  
 
        System.Console.WriteLine(kotae.ToString());


    }
}

Measured memory_bytes: 27916
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int INF=1e9;
const ll MOD=1e9+7;
template<typename A,size_t N,typename T>
void Fill(A (&array)[N],const T &val)
{
    std::fill( (T*)array,(T*)(array+N),val );
}
string start;
int Q;
char charlist[600005];
bool rev=false;
int query;
int F,L,R;
char C;
int main(void)
{
    cin >> start >> Q;
    for(int i=0;i<500005;i++) charlist[i]='?';
    for(int i=200001;i<200001+int(start.size());i++)
    {
        charlist[i]=start[i-200001];
    }
    L=200000;
    R=200001+start.size();
    for(int i=0;i<Q;i++)
    {
        cin >> query;
        if(query==1) 
        {
            if(rev) rev=false;
            else rev=true;
        }
        else
        {
            cin >> F >> C;
            if(F==1)
            {
                if(rev) {charlist[R]=C;R++;}
                else {charlist[L]=C;L--;}
            }
            else
            {
                if(rev) {charlist[L]=C;L--;}
                else {charlist[R]=C;R++;}
            }
        }     
    }
    if(!rev)
    {

        for(int i=L+1;i<R;i++)
        {
            cout << charlist[i];
            if(i==R-1) cout << endl;
        }
    }
    else
    {
        for(int i=R-1;i>L;i--)
        {
            cout << charlist[i];
            if(i==L+1) cout << endl;
        }
    }


}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

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

	int c[3][3];
	rep (i, 0, 3)
		rep (j, 0, 3)
		cin >> c[i][j];

	bool judge = true;
	rep (i, 0, 3) {
		rep (j, 0, 3) {
			int k_i = (i + 1 == 3) ? 0 : i + 1;
			int k_j = (j + 1 == 3) ? 0 : j + 1;
			if (c[i][j] != (c[k_i][j] + c[i][k_j] - c[k_i][k_j])) {
				judge = false;
				i = j = 3;
				break;
			}
		}
	}

	cout << ((judge) ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
def watch(ss):
    s = ss
    m = s // 60
    s = s % 60
    h = m // 60
    m = m % 60
    return (h,m,s)

ss = int(input())
(h,m,s) = watch(ss)
print(str(h)+':'+str(m)+':'+str(s))



Measured memory_bytes: 5600
import java.util.Scanner;

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

		for (int i = (X - K + 1); i < (X + K); i++) {
			System.out.print(i + " ");
		}
	}
}


Measured memory_bytes: 21972
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();
			int N = Integer.parseInt(str);
			HashSet<String> hs = new HashSet<String> ();
			for(int i = 0;i < N ;i++) {
				str = br.readLine();
				if(hs.contains(str)) {
					hs.remove(str);
				}else {
					hs.add(str);
				}

			}
			System.out.println(hs.size());
//			long max  = 1000000007;
		}catch (Exception e) {
			System.exit(0);
		}
	}

}


Measured memory_bytes: 32444
#include <cstdio>

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

    int M[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            M[i][j] = 0;
        }
    }

    for (int i = 0; i < n; i++) {
        int u, degree;
        scanf("%d %d", &u, &degree);
        u--;    // convert to 0 index
        for (int j = 0; j < degree; j++) {
            int v;
            scanf("%d", &v);
            v--;    // convert to 0 index
            M[u][v] = 1;
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (j) { printf(" "); }
            printf("%d", M[i][j]);
        }
        printf("\n");
    }
}


Measured memory_bytes: 2696
c=[[[?0*6]]*2]
5.times{|i|c<<[?0+gets[0,4]+?0,i<4?(?0+gets):?0*6]}
x=2
y=d=1
r=?R
[(t,u,d=[[0,0,1,-1,0,3],[1,1,0,0,-1,0],[0,0,0,1,0,1],[1,0,0,0,1,2]].rotate(d).find{|i,j,k|c[y-j][i][x-k]==?1}[3,3]),x+=t,y+=u,r+="URDL"[d]]while x+y>2
puts r

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

#define IOS std::cin.tie(0);std::ios_base::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>;

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())
#define END cout<<"\n"

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define SRepS(i,n,m)    for(int i=(int)(n);i*i<=(int)(m);i++)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?" ":"\n"); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 1e6+1;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//

signed main(){
    LCIN(A,B,N);
    ll ans=0;
    if(B>N)ans=floor(A*N/B)-A*floor(N/B);
    else ans=floor(A*(B-1)/B)-A*floor((B-1)/B);
    COUT(ans);

    return 0;
}

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

int main() {
  int K;
  cin >> K;
  
  string S;
  cin >> S;
  
  if(S.size() <= K){
    cout << S << endl;
  }
  
  else{
    cout << S.erase(K) << "..." << endl;
  }
}
 
    

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



Measured memory_bytes: 2100
import std.stdio, std.conv, std.string, std.algorithm, std.math, std.array, std.container;

bool check(bool[3][3] t) {
  for(int i=0; i<3; i++) {
    if(t[i][0]&&t[i][1]&&t[i][2]) {
      return true;
    }
    if(t[0][i]&&t[1][i]&&t[2][i]) {
      return true;
    }
  }
  return t[0][0]&&t[1][1]&&t[2][2] || t[0][2]&&t[1][1]&&t[2][0];
}

void main() {
  int[][] a = [];
  for(int i=0; i<3; i++) a ~= readln.chomp.split.to!(int[]);
  int n = readln.chomp.to!int;
  bool[3][3] t;
  for(int k=0; k<n; k++) {
    int b = readln.chomp.to!int;
    for(int i=0; i<3; i++) {
      for(int j=0; j<3; j++) {
        if(a[i][j] == b) t[i][j] = true;
      }
    }
  }
  if(t.check) writeln("Yes");
  else writeln("No");
}



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


int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N, M; cin >> N >> M;
  vector<queue<int>> A(N);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      int x; cin >> x; x--;
      A.at(i).push(x);
    }
  }
  int ans = N+1;
  vector<bool> done(M);
  for (int z = 0; z < M; z++) {
    vector<int> cnt(M);
    int nmax = 0;
    int narg = -1;
    for (int i = 0; i < N; i++) {
      int j = A.at(i).front();
      int num = ++cnt.at(j);
      if (num > nmax) {
	nmax = num;
	narg = j;
      }
    }
    ans = min(ans, nmax);
    done.at(narg) = true;
    for (int i = 0; i < N; i++) {
      while(!A.at(i).empty() && done.at(A.at(i).front())) A.at(i).pop();
    }
  }
  cout << ans << endl;

  return 0;
}



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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int num = 0;
    int left = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == '(') num++;
        else{
            if(num == 0) left++;
            else num--;
        }
    }
    for(int i = 0; i < left; i++) cout << '(';
    cout << s;
    for(int i = 0; i < num; i++) cout << ')';
    cout << endl;
}

Measured memory_bytes: 256