akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
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; }

int main() {
    string str; cin >> str;
    ll A = stoi(str) / 1000;
    ll B = stoi(str) / 100 % 10;
    ll C = stoi(str) / 10 % 10;
    ll D = stoi(str) % 10;
    vector<char> op1 = { '+', '-', '+', '-', '-', '+', '+', '-' };
    vector<char> op2 = { '+', '-', '-', '+', '-', '+', '-', '+' };
    vector<char> op3 = { '+', '-', '+', '-', '+', '-', '-', '+' };

    rep(i, 8) {
        if (op1[i] == '+') {
            if (op2[i] == '+') {
                if (op3[i] == '+') {
                    if (A + B + C + D == 7) {
                        cout << A << '+' << B << '+' << C << '+' << D << '=' << '7' << endl;
                        return 0;
                    }
                } else {
                    if (A + B + C - D == 7) {
                        cout << A << '+' << B << '+' << C << '-' << D << '=' << '7' << endl;
                        return 0;
                    }
                }
            } else {
                if (op3[i] == '+') {
                    if (A + B - C + D == 7) {
                        cout << A << '+' << B << '-' << C << '+' << D << '=' << '7' << endl;
                        return 0;
                    }
                } else {
                    if (A + B - C - D == 7) {
                        cout << A << '+' << B << '-' << C << '-' << D << '=' << '7' << endl;
                        return 0;
                    }
                }
            }
        } else  {
            if (op2[i] == '+') {
                if (op3[i] == '+') {
                    if (A - B + C + D == 7) {
                        cout << A << '-' << B << '+' << C << '+' << D << '=' << '7' << endl;
                        return 0;
                    }
                } else {
                    if (A - B + C - D == 7) {
                        cout << A << '-' << B << '+' << C << '-' << D << '=' << '7' << endl;
                        return 0;
                    }
                }
            } else {
                if (op3[i] == '+') {
                    if (A - B - C + D == 7) {
                        cout << A << '-' << B << '-' << C << '+' << D << '=' << '7' << endl;
                        return 0;
                    }
                } else {
                    if (A - B - C - D == 7) {
                        cout << A << '-' << B << '-' << C << '-' << D << '=' << '7' << endl;
                        return 0;
                    }
                }
            }
        }
    }
}

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

int main()
{
    string s;
    cin >> s;
    auto ans = 0;
    for(unsigned int  i = 0; i < s.size(); ++i){
        auto cnt = 0;
        auto flg = 0;
        if(s[i] == 'A' || s[i] == 'G' || s[i] == 'T' || s[i] == 'C' ){
            flg = 1;
            cnt ++;
        }
        while(flg){
            if(s[i + cnt] == 'A' || s[i + cnt] == 'G' || s[i + cnt] == 'T' || s[i + cnt] == 'C' ){
                flg = 1;
                cnt ++;
            }
            else{
                flg = 0;
            }
            if(i + cnt == s.size()){
                flg = 0;
            }
        }
        ans = max(ans, cnt);
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int y = in.nextInt();
        int z = in.nextInt();
        in.close();
        System.out.println(z + " " + x + " " + y);
    }
}

Measured memory_bytes: 22612
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

s = read()
a = int(s[0] + s[1])
b = int(s[2] + s[3])

if a >= 13 and b >= 13:
    print("NA")
elif 0 < a <= 12 and  0 < b <= 12:
    print("AMBIGUOUS")
elif 0 < a <= 12:
    print("MMYY")
elif 0 < b <= 12:
    print("YYMM")
else:
    print("NA")




Measured memory_bytes: 6224
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    string s;
    cin >> s;
    ll N = s.size();
    set<char> se;
    rep(i, N) {
        se.insert(s[i]);
    }
    string fin = "zyxwvutsrqponmlkjihgfedcba";
    set<char> ss;
    if(N == 26) {
        if (s == fin) {
            print(-1);
        } else {
            string tmp = s;
            while(true) {
                ss.insert(tmp.back());
                tmp.pop_back();
                for(char c : ss) {
                    if (s < tmp + string(1,c)) {
                        print(tmp + string(1,c));
                        return 0;
                    }
                }
            }
        }
    } else {
        rep(i, 26) {
            char c = i+'a';
            if (se.find(c) == se.end()) {
                s += string(1, c);
                print(s);
                return 0;
            }
        }
    }
    return 0;
}

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

int main() {
  int N;
  string S,ans;
  cin >> N >> S;
  if(S.size() > N){
    for(int i = 0; i < N; i++){
      char c = S[i];
      ans += c;
    }
    ans += "...";
  }
  else{
    ans = S;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
import fractions

ans=1
n=int(input())
a=list(map(int,input().split()))
l=[0]
r=[0]
for i in range(n-1):
    l.append(fractions.gcd(l[i],a[i]))
    r.append(fractions.gcd(r[i],a[-(i+1)]))
for i in range(n):
    c=fractions.gcd(l[i],r[-(i+1)])
    if ans<c:
        ans=c
print(ans)

Measured memory_bytes: 16148
// https://atcoder.jp/contests/abc078/tasks/arc085_b

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 2000;
const int Z_MAX = 1e9;
const int W_MAX = 1e9;
const int A_I_MAX = 1e9;

int N, Z, W;
int a[N_MAX];
int memo[2][N_MAX];

int f2(int sen, int i);

int f(int sen, int i) {
  if (memo[sen][i] < 0) {
    memo[sen][i] = f2(sen, i);
  }
  return memo[sen][i];
}

int f2(int sen, int i) {
  int v = (i > 0 ? a[i - 1] : W);
  int sc = abs(v - a[N - 1]);
  FOR(j, i, N - 2) {
    if (sen) {
      sc = max(sc, f(0, j + 1));
    } else {
      sc = min(sc, f(1, j + 1));
    }
  }
  return sc;
}

void solve() {
  fill(memo[0], memo[2], -1);
  printf("%d\n", f(1, 0));
}

void input() {
  scanf("%d%d%d", &N, &Z, &W);
  REP(i, N) scanf("%d", a + i);
}

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


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

int a, b;
int main()
{
    cin >> a >> b;
    if (a - 2 * b <= 0)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << a - 2 * b << endl;
    }
    
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    long[] cnt = new long[n];
    long ans = 1;
    long mod = 1000000007;
    for(int i=0;i<n;i++)a[i]=sc.nextInt();
    long cnt0 = 0;
    for(int i=0;i<n;i++){
      if(a[i]==0)cnt0++;
      cnt[a[i]]++;
      if(cnt[a[i]]>=4){
        System.out.println(0);
        return;
      }
      if(a[i]==0)ans*=(4-cnt0);
      else{
        ans*=cnt[a[i]-1];
        ans=ans%mod;
        cnt[a[i]-1]--;
      }
    }
    System.out.println(ans);
  }
}

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

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

using ll = long long int;
const ll MOD = 1e9 + 7;

int main() {
  std::string S, T;
  std::cin >> S >> T;
  int ans = 0;
  for(int i = 0; i < S.size(); ++i) {
    if(S[i] != T[i]) ++ans;
  }
  std::cout << ans << '\n';
}


Measured memory_bytes: 3916
#include <iostream>
#include <vector>
#include <string>
using namespace std;
using PII = pair<int,int>;

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

  bool possible = true;
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      if (s[i][j] == '.')
        continue;
      bool neighbor = false;
      for (auto p : {PII(-1,0), PII(1,0), PII(0, -1), PII(0, 1)}) {
        int r = i + p.first;
        int c = j + p.second;
        if (r < 0 || c < 0 || r >= H || c >= W)
          continue;
        if (s[r][c] == '#')
          neighbor = true;
      }
      if (!neighbor)
        possible = false;
    }
  }

  if (possible)
    cout << "Yes\n";
  else
    cout << "No\n";

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include <math.h>
#include<stdio.h>
#include <climits>
#include<algorithm>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int i, ans = 0, n,j, x,max;
	int kari = 0;
	vector<int> a;

	cin >> n;
	for (i = 0; i < n;i++) {
		cin >> x;
		a.push_back(x);
	}
	max = *max_element(a.begin(), a.end());
	for (i = 0; i < n; i++) {
		if (a[i] == max) {
			for (j = 0; j < n; j++) {
				if (i != j and kari < a[j]) {
					kari = a[j];
					if (kari == max)break;
				}
			}
			cout << kari << "\n";
			kari = 0;
		}
		else cout << max << "\n";
	}
}


Measured memory_bytes: 2548
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String S = input.readLine();


        int APosition = 0;
        for (int i = 0; i < S.length(); i++) {
            if (isA(S.charAt(i))) {
                APosition = i;
                break;
            }
        }

        int ZPosition = S.length() - 1;
        for (int i = S.length() - 1; i >= 0; i--) {

            if (isZ(S.charAt(i))) {
                ZPosition = i;
                break;
            }
        }

        System.out.println(ZPosition-APosition+1);
    }

    private static boolean isA(char c) {
        return c == 'A';
    }

    private static boolean isZ(char c) {
        return c == 'Z';
    }
}

Measured memory_bytes: 25044
from __future__ import annotations

from dataclasses import dataclass


@dataclass
class Monster:
    HP: int
    AT: int

    def dead(self):
        return self.HP <= 0

    def attack(self, other_monster: Monster):
        other_monster.HP -= self.AT


def actual(A, B, C, D):
    takahasi = Monster(A, B)
    aoki = Monster(C, D)

    while True:
        takahasi.attack(aoki)

        if takahasi.dead():
            return 'No'

        aoki.attack(takahasi)

        if aoki.dead():
            return 'Yes'

A, B, C, D = map(int, input().split())

print(actual(A, B, C, D))

Measured memory_bytes: 10704
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#define N 100005
#define F first
#define S second
using namespace std;

int n, m, s;
pair<int, int> a[N];
set<int> v;
int main()
{
	int i;
	set<int>::iterator it;
	cin >> n >> m;
	for (i = 0; i < n; i++) {
		scanf("%d %d", &a[i].S, &a[i].F);
	}
	sort(a, a + n);
	for (i = 0; i < n; i++) v.insert(i);
	for (i = n - 1; i >= 0; i--) {
		it = v.upper_bound(m - a[i].S);
		if (it == v.begin()) continue;
		it--;
		s += a[i].F;
		v.erase(*it);
	}
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 7808
import java.util.Scanner;
import java.util.ArrayList;
import java.util.HashMap;
import java.lang.Integer;
import java.lang.StringBuilder;
import java.lang.Math;

public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    long a = in.nextLong();
    long b = in.nextLong();
    long x = in.nextLong();

    long cnt = 0;

    long adiv = a/x;
    long bdiv = b/x;
    cnt = bdiv - adiv;
    if (a % x == 0) {
      cnt++;
    }

    //for (int i = a; i <= b; i++) {
    //  if (i % x == 0) {
    //    cnt++;
    //  }
    //}

    System.out.println(cnt);
  }
}

Measured memory_bytes: 9808
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007;
signed main() {
  int n,m;
  cin>>n>>m;
  int a[m],c[m]={},b,t;
  for(int i=0;i<m;i++){
    cin>>a[i]>>b;
    for(int j=0;j<b;j++){
      cin>>t;
      c[i]+=(1<<(t-1));
    }
  }
  int dp[m+1][1<<n];
  for(int i=0;i<(1<<n);i++)dp[0][i]=MOD;
  dp[0][0]=0;
  for(int i=1;i<=m;i++){
    for(int j=0;j<(1<<n);j++){
      dp[i][j]=dp[i-1][j];
    }
    for(int j=0;j<(1<<n);j++){
      dp[i][j|c[i-1]]=min(dp[i-1][j]+a[i-1],dp[i][j|c[i-1]]);
    }
  }
  if(dp[m][(1<<n)-1]==MOD)cout<<-1;
  else cout<<dp[m][(1<<n)-1];


  return 0;
}


Measured memory_bytes: 32256
// abc131_b
// #include <bits/stdc++.h>
#include <vector>
#include <iostream>
using namespace std;
int main(void){
  int N, X;
  cin >> N >> X;
  vector<int> L;
  int n;
  for(int i = 0; i < N; i++){
    cin >> n;
    L.push_back(n);
  }
  int count = 0;
  int D = 0;
  if(X >= D){
    count++;
  }
  vector<int>::iterator it = L.begin();
  vector<int>::iterator endIt = L.end();
  while(it != endIt){
    D += *it;
    it++;
    if(X >= D){
      count++;
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
fn main() {
    let mut i = 0;
    for x in input() {
        i += 1;
        println!("Case {}: {}", i, x);
    }
}

fn input() -> Vec<i32> {
    (1..)
        .map(|_| {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            s.trim().parse::<i32>().unwrap()
        }).take_while(|q| *q != 0).collect()
}



Measured memory_bytes: 5048
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int n,k,a[110];
bool dp[100010]={};

int main(){
  cin>>n>>k;
  fr(i,n) cin>>a[i];
  dp[a[0]]=1;
  for(int i=a[0];i++<k;){
    fr(j,n){
      if(a[j]>i) break;
      if(!dp[i-a[j]]){dp[i]=1;break;}
    }
  }
  cout<<(dp[k]?"First":"Second")<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); ++i)
 
typedef pair<int, int> P;

int H, W, N;
char m[1001][1001];
int d[1001][1001];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void dfs(int i, int j) {
    char c = m[i][j];
    m[i][j] = '.';
    if(j+1<W && m[i][j+1]==c) dfs(i, j+1);
    if(j>0 && m[i][j-1]==c) dfs(i, j-1);
    if(i+1<H && m[i+1][j]==c) dfs(i+1, j);
    if(i>0 && m[i-1][j]==c) dfs(i-1, j);
}
int main() {
    cin >> H >> W >> N;
    int x, y;
    rep(i, H) {
        rep(j, W) {
            cin >> m[i][j];
            if(m[i][j]=='S') {
                x = j;
                y = i;
            }
        }
    }

    int HP = 1;
    int time = 0;
    int dist = 0;
    while(HP <= N) {
        rep(i, H) {
            rep(j, W) {
                d[i][j] = -1;
            }
        }
        d[y][x] = dist;
        queue<P> q;
        q.push(P(x, y));
        while(q.size()>0) {
            P p = q.front(); q.pop();
            int cx = p.first;
            int cy = p.second;
            if(m[cy][cx]=='0'+HP) {
                x = cx;
                y = cy;
                dist = d[y][x];
                HP++;
                break;
            } 
            rep(i, 4) {
                int nx = cx+dx[i];
                int ny = cy+dy[i];
                if(0<=nx && nx<W && 0<=ny && ny<H &&
                        d[ny][nx] == -1 && m[ny][nx]!='X') {
                    q.push(P(nx, ny));
                    d[ny][nx] = d[cy][cx] + 1;
                }
            }
        }
    }
    cout << dist << endl;
    return 0;
}

Measured memory_bytes: 6108
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long X, Y;
    cin >> X >> Y;
    if(abs(X-Y) >= 2)
        cout << "Alice" << endl;
    else
        cout << "Brown" << endl;


    return 0;
}

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

using namespace std;

int main() {
	int m, n;
	while (cin >> m >> n) {
		if (m == 0 && n == 0) {
			break;
		}
		vector<int> player(m+1, 1);
		player[0] = 0;
		string b;
		int counter = 1;
		for (int i = 1; i <= n; i++) {
			cin >> b;
			int counter2 = 0;
			for (int j = 1; j <= m; j++) {
				if (player[j] == 1) {
					counter2++;
				}
			}
			if (counter2 == 1) {
				continue;
			}
			while (player[counter] != 1) {
				counter ++;
				if (counter > m) {
					counter = 1;
				}
			}
			if (i % 3 == 0 && i % 5 == 0) {
				if (b == "FizzBuzz") {
				} else {
					player[counter] = 0;
				}
			} else if (i % 3 == 0) {
				if (b == "Fizz") {
				} else {
					player[counter] = 0;
				}
			} else if (i % 5 == 0) {
				if (b == "Buzz") {
				} else {
					player[counter] = 0;
				}
			} else {
				bool hantei = true;
				int kazu = 0;
				for (int j = 0; j < b.size(); j++) {
					kazu *= 10;
					if (0 <= b[j]-'0' && b[j]-'0' <= 9) {
						kazu += b[j]-'0';
					} else {
						hantei = false;
						break;
					}
				}
				if (hantei) {
					if (i == kazu) {
					} else {
						player[counter] = 0;
					}
				} else {
					player[counter] = 0;
				}
			}
			counter++;
			if (counter > m) {
				counter = 1;
			}
		}
		int k;
		for (k = 1; k <= m; k++) {
			if (player[k] == 1) {
				cout << k;
				break;
			}
		}
		for (int j = k+1; j <= m; j++) {
			if (player[j] == 1) {
				cout << ' ' << j;
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long a,b,i=0;
    cin>>a>>b;
    while(1){
        i++;
        if(i*a%b==0){
            break;
        }
    }
    cout<< i*a <<endl;
}


Measured memory_bytes: 256
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

n = int(input())
h = list(myinput())

M = 0
count = 0
for i in range(n):
    if h[i]>=M:
        count += 1
        M = h[i]
    else:
        pass

print(count)

Measured memory_bytes: 38488
if __name__ == "__main__":
    W, H, x, y, r = input().split()
    W, H, x, y, r = int(W), int(H), int(x), int(y), int(r)
     
    if (x - r) < 0 or W < (x + r) or (y - r) < 0 or H < (y + r):
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 7708
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
int main(){
    int N,cnt=0;
    cin >> N;
    vector<char> bag(N);
    for(int i=0;i<N;i++){
        cin >> bag[i];
        if(bag[i]=='Y'){
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;

}

Measured memory_bytes: 256
#include<stdio.h>
#define INF 100000
#define NIL -1
#define MAX 101
#define WHITE 0
#define BLACK 1

int main(){
  int i,j,u,v,n;
  int mincost,sum=0;
  int a[MAX][MAX],d[MAX],pi[MAX],color[MAX];
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&a[i][j]);
      if(a[i][j]==-1) a[i][j] =INF;
    }
  }

  for(u=0;u<n;u++){
    d[u] = INF;
    pi[u] = NIL;
    color[u] = WHITE;
  }
  d[0] = 0;

  while(1){

    mincost = INF;
    for(i=0;i<n;i++){
      if(color[i]!=BLACK && d[i]<mincost){
	mincost = d[i];
	u = i;
      }
    }
    
    if(mincost==INF)break;

    color[u] = BLACK;
    
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && a[u][v]< d[v]){
	pi[v] = u;
	d[v] = a[u][v];
      }
    }
    
  }
  for(i=0;i<n;i++){
    sum += d[i];
  }
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 640
s = gets.strip.to_i

x = s / 100
y = s % 100

if 1 <= x && x <= 12
    if 1 <= y && y <= 12
        puts "AMBIGUOUS"
    else
        puts "MMYY"
    end
else
    if 1 <= y && y <= 12
        puts "YYMM"
    else
        puts "NA"
    end
end

Measured memory_bytes: 1788
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int n,m,w[105],v[105];
long long dp[105][N];
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>w[i]>>v[i];
	for(int i=1;i<=n;i++)
		for(int j=0;j<=m;j++)
		{
			if(w[i]>j)
				dp[i][j]=dp[i-1][j];
			else
				dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
		}
	cout<<dp[n][m];
	return 0;
}

Measured memory_bytes: 79360
#include<bits/stdc++.h>
int i,j,k,l,x,y,n,m;
std::string a[50],b[50];
main(){
  for(std::cin>>n>>m;i<n;)std::cin>>a[i++];
  for(;j<m;)std::cin>>b[j++];
  for(;k<=n-m;++k)for(l=0;l<=n-m;++l){
      i=0;
      for(x=0;x<m;++x)for(y=0;y<m;)i|=a[k+x][l+y]-b[x][y++];
      j&=i;
    }
  puts(j?"No":"Yes");
}


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

int main() {
  int H, N;
  cin >> H >> N;
  
  int x = 0;
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    
    x += A;
  }
  
  if (x >= H) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  ll n, q;
  cin >> n >> q;
  ll ans = (n - 2) * (n - 2);
  int last_down = n - 2, last_right = n - 2;
  vector<int> can_down(n - 2, -1), can_right(n - 2, -1);
  for (int i = 0; i < q; i++) {
    ll flag, x;
    cin >> flag >> x;
    x -= 2;
    if (flag == 1) {
      if (can_down[x] == -1) {
        ans -= last_right;
        while (last_down > x) {
          last_down--;
          can_down[last_down] = last_right;
        }
      } else {
        ans -= can_down[x];
      }
    } else {
      if (can_right[x] == -1) {
        ans -= last_down;
        while (last_right > x) {
          last_right--;
          can_right[last_right] = last_down;
        }
      } else {
        ans -= can_right[x];
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4788
K, N = map(int,input().split())
A = list(map(int, input().split()))

l = [0] * N
hoge = 0

for n in range(N):
  l[n] = A[n]-hoge
  hoge = hoge + l[n]
  
l = l + [K-A[N-1]]

if A[0]!=0 :
  l[N] = l[N]+l[0]
  l[0] = 0

print(sum(l)-max(l))

Measured memory_bytes: 26444
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>

using namespace std;

//using
using VI = vector<int>;
using VVI = vector<VI>;
using VS = vector<string>;
using PII = pair<int, int>;
using LL = long long;

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  for(int i=0;i<(n);i++)

//constant
const int INF = 1 << 29;
const double EPS = 1e-10;
const double PI = acos(-1.0);

//debug
#define dump(x)  cout << #x << " = " << (x) << endl;

int main() {
  long long int N, x, ans=0;
  cin >> N >> x;
  vector<long long int> a(N);
  REP(i, N) cin >> a[i];
  REP(i, N-1) {
    if (a[i]+a[i+1] > x) {
      long long int diff = a[i]+a[i+1] - x;
      if (diff > a[i+1]) {
        a[i+1] = 0;
      } else {
        a[i+1] -= diff;
      }
      ans += diff;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <unordered_map>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;
 
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define y1 abcde
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
#define BUG cout << "acdsfas" << endl
 
const int mod = 1e9 + 7;
const int inf = 2e9;
const int N = 55;
int n, ans;
ll k;

typedef vector <vector <int> > matrix;

inline void add(int &a, int b) {
    a += b;
    if(a >= mod)
        a -= mod;
}

inline matrix multiply(matrix a, matrix b) {
    matrix res;
    res.resize(a.size(), vector <int> (b[0].size(), 0));
    for(int k = 0; k < b.size(); ++k)
        for(int i = 0; i < a.size(); ++i)
            for(int j = 0; j < b[0].size(); ++j)
                add(res[i][j], ((ll)a[i][k] * b[k][j]) % mod);
    return res;
}

matrix binpow(matrix a, ll k) {
    matrix res = a;
    res.resize(a.size(), vector <int> (a[0].size(), 0));
    while(k) {
        if(k & 1)
            res = multiply(res, a);
        k >>= 1;
        a = multiply(a, a);
    }
    return res;
}

main() {
    cin >> n >> k;
    matrix a;
    a.resize(n, vector <int> (n, 0));
    for(int i = 0; i < n; ++i)
        for(int j = 0; j < n; ++j)
            cin >> a[i][j];
    a = binpow(a, k - 1);
    for(int i = 0; i < n; ++i)
        for(int j = 0; j < n; ++j)
            add(ans, a[i][j]);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
int main(){
	string s;
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
} 

Measured memory_bytes: 256
from collections import defaultdict, deque
from functools import reduce
from operator import mul
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
import math
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

X = inpl()
if X[0] == 0:
    print(1)
elif X[1] == 0:
    print(2)
elif X[2] == 0:
    print(3)
elif X[3] == 0:
    print(4)
elif X[4] == 0:
    print(5)

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using dijkstra = priority_queue<T, vector<T>, greater<T>>;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define fbo find_by_order  // k th index
#define ook order_of_key   // strictly smaller than k
#define PI acos(-1.0)
#define inf 0x3f3f3f3f
#define max_ull 18446744073709551615
#define max_ll 9223372036854775807
#define lead_zero(x) __builtin_clzll(x)
#define trail_zero(x) __builtin_ctzll(x)
#define total_1s(x) __builtin_popcountll(x)
#define first_1(x) __builtin_ffsll(x)
#define log2_(x) __builtin_clz(1) - __builtin_clz(x)
#define isLeap(x) ((x % 400 == 0) || (x % 100 ? x % 4 == 0 : false))
#define QUERY           \
    int test;           \
    scanf("%d", &test); \
    for (int _T = 1; _T <= test; _T++)
#define FAST ios_base::sync_with_stdio(0), cin.tie(0)
#define all(v) v.begin(), v.end()
#define reunique(v) v.resize(std::unique(all(v)) - v.begin())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define ff first
#define ss second
#define MERGE(v1, v2, v) merge(all(v1), all(v2), back_inserter(v))
#define MP make_pair
#define EB emplace_back
#define read freopen("input.txt", "r", stdin)
#define write freopen("output.txt", "w", stdout)
#define in_range(v, r, l) upper_bound(all(v), r) - lower_bound(all(v), l)
#define LCM(a, b) (a / __gcd(a, b)) * b;

ll rdn(int y, int m, int d) {
    /* Rata Die day one is 0001-01-01 */
    if (m < 3)
        y--, m += 12;
    return 365 * y + y / 4 - y / 100 + y / 400 + (153 * m - 457) / 5 + d - 306;
}
/* Direction arrays */
/*int dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1};                             */  // 4Direction
/*int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1};         */  // 8Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1};     */  // KnightDirection
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1};                */  // HexagonalDirection
/* int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; */

int main() {
    double n;
    cin >> n;
    cout << fixed << setprecision(10);
    double a = (n / 3.0);
    cout << a * a * a << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x, a, b; cin >> x >> a >> b;
    if(abs(x-a) < abs(x-b)) cout << "A";
    else cout << "B";
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*
import java.math.*

fun main(args: Array<String>) {

    var (W,H,x,y) = readLine()!!.split(" ").map { it.toLong() }
//    var N = readLine()!!.toInt()
//    val D = readLine()!!.split(" ").map { it.toLong() }
//    val A = readLine()!!.split(" ").map { it.toInt() }.toIntArray()

    print(W*H/2.0)
    print(" ")
    println(if (W %2==0L && H%2 ==0L && x == W/2 && y == H/2) 1 else 0)

//    println("%.9f".format(ans))
}


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

students = [list(map(int, input().split())) for _ in range(N)]
checkpts = [list(map(int, input().split())) for _ in range(M)]

for a, b in students:
    tmp = [abs(a-x) + abs(b-y) for x, y in checkpts]
    print(tmp.index(min(tmp))+1)


Measured memory_bytes: 3060
uses crt;
var a,b,c:array[1..100000] of longint;
    i,n:longint;
function max(a,b:longint):longint;
begin
    if a>b then exit(a) else exit(b);
end;
begin
    clrscr;
    readln(n);
    for i := 1 to n do readln(a[i],b[i],c[i]);
    for i:=2 to n do 
      begin
          a[i]:=max(a[i-1],max(b[i-1],c[i-1])+a[i]);
          b[i]:=max(b[i-1],max(a[i-1],c[i-1])+b[i]);
          c[i]:=max(c[i-1],max(a[i-1],b[i-1])+c[i]);
      end;
      writeln(max(a[n],max(c[n],b[n])));
      readln;
end.


Measured memory_bytes: 1408
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
 		while(true){
			try{
				int ame = in.nextInt();
				if(ame >= 39 && ame % 39 == 0){
					System.out.println("3C39");
				}else{
					int num = ame % 39;
					if(num < 10){
						System.out.println("3C0" + num);
					}else{
						System.out.println("3C" + num);
					}
				}
			}catch(Exception e){
				System.exit(0);
			}
		}
	}
}

Measured memory_bytes: 17192
#include<bits/stdc++.h>
using namespace std;
static const int N = 100;

int main(){
    int M[N][N];
    int n, u, k, v;

    cin >> 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 ){
        cin >> u >> k;
        u--;
        for( int j = 0; j < k; ++j ){
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

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

    return 0;
}




Measured memory_bytes: 3084
#include <iostream>
using namespace std;
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;

int L[MAX / 2 + 2], R[MAX / 2 + 2];

llong merge(int A[], int n, int left, int mid, int right)
{
    int i, j, k;
    llong cnt = 0;
    int n1 = mid - left;
    int n2 = right - mid;
    for (i = 0; i < n1; i++)
        L[i] = A[left + i];
    for (i = 0; i < n2; i++)
        R[i] = A[mid + i];
    L[n1] = R[n2] = SENTINEL;

    i = j = 0;
    for (k = left; k < right; k++)
    {
        if (L[i] <= R[j])
        {
            A[k] = L[i++];
        }
        else
        {
            A[k] = R[j++];
            cnt += n1 - i;
        }
    }

    return cnt;
}

llong mergeSort(int A[], int n, int left, int right)
{
    int mid;
    llong v1, v2, v3;
    if (left + 1 < right)
    {
        mid = (left + right) / 2;
        v1 = mergeSort(A, n, left, mid);
        v2 = mergeSort(A, n, mid , right);
        v3 = merge(A, n, left, mid, right);
        return v1 + v2 + v3;
    }
    return 0;
}
int main()
{
    int A[MAX], n, i;

    cin >> n;
    for (i = 0; i < n; i++)
    {
        cin >> A[i];
    }

    llong ans = mergeSort(A, n, 0, n);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4656
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct UnionFind {
    vector<int> par, size;
    UnionFind(int x) {
        par.resize(x);
        size.resize(x, 1);
        for(int i = 0; i < x; i++) {
            par[i] = i;
        }
    }
    int find(int x) {
        if (par[x] == x) {
            return x;
        }
        return par[x] = find(par[x]);
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    int consize(int x) {
        return size[find(x)];
    }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y)
            return;
        if (size[x] < size[y]) {
            par[x] = y;
            size[y] += size[x];
        } else {
            par[y] = x;
            size[x] += size[y];
        }
    }
};
signed main() {
    int N,M;
    cin >> N >> M;
    vector<int>A(M);
    vector<int>B(M);
    for(int i = 0; i < M; i++) {
        cin >> A[i] >> B[i];
        A[i]--;B[i]--;
    }
    UnionFind uf(N);
    int ans = N*(N-1)/2;
    vector<int>ans2(M);
    for(int i = M-1; i >= 0; i--) {
        ans2[i] = ans;
        if(!uf.same(A[i],B[i])) {
            ans-=uf.consize(A[i])*uf.consize(B[i]);
        }
        uf.unite(A[i],B[i]);
    }
    for(int i = 0; i < M; i++) {
        cout << ans2[i] << endl;
    }
}

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

const int inf = 1000000000;

int main() {
	int n, m;
	while (cin >> n >> m, n) {
		int c[16], x[20000];
		for (int i = 0; i < m; i++) {
			cin >> c[i];
		}
		for (int i = 0; i < n; i++) {
			cin >> x[i];
		}
		vector<vector<int>> dp(n + 1, vector<int>(256, inf));
		dp[0][128] = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 256; j++) {
				if (dp[i][j] != inf) {
					for (int k = 0; k < m; k++) {
						int j2 = max(0, min(255, j + c[k]));
						dp[i + 1][j2] = min(dp[i + 1][j2], dp[i][j] + (x[i] - j2) * (x[i] - j2));
					}
				}
			}
		}
		int r = inf;
		for (int i = 0; i < 256; i++) {
			r = min(r, dp[n][i]);
		}
		cout << r << endl;
	}
	return 0;
}

Measured memory_bytes: 23780
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

int main() {
	int N, M; cin >> N >> M;
	vector<int> digit(N, 0);
	vector<bool> decided(N, false);
	while (M--) {
		int s, c; cin >> s >> c;
		if (decided[s - 1] && digit[s - 1] != c) {
			cout << -1 << endl;
			goto FIN;
		}
		decided[s - 1] = true;
		digit[s - 1] = c;
	}
	if (N > 1 && digit[0] == 0 && decided[0]) {
		cout << -1 << endl;
		goto FIN;
	}
	if (N > 1 && digit[0] == 0)
		digit[0] = 1;
	for (auto d : digit) cout << d;
	cout << endl;
FIN:;
	return 0;
}

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 998244353;


VI g[100005];
VB b(100005, false);

deque<int> q;

void dfs1(int a) {
	for (int i : g[a]) {
		if (b[i])continue;
		b[i] = true;
		q.push_back(i);
		dfs1(i);
		break;
	}
}

void dfs2(int a) {
	for (int i : g[a]) {
		if (b[i])continue;
		b[i] = true;
		q.push_front(i);
		dfs2(i);
		break;
	}
}

void bfs() {
	q.push_back(0);
	b[0] = true;
	dfs1(0);
	dfs2(0);
}

int main() {

	int n, m;
	cin >> n >> m;

	REP(i, m) {
		int c, d;
		cin >> c >> d;
		c--, d--;
		g[c].push_back(d);
		g[d].push_back(c);
	}

	q.push_back(0);
	b[0] = true;
	dfs1(0);
	dfs2(0);

	cout << q.size() << endl;

	for (int i : q) {
		cout << i + 1 << ' ';
	}



}

Measured memory_bytes: 9600
#include<stdio.h>

int main(){
    int x,y,d,r;
    double fx,fy;
    double f;
    scanf("%d",&x);
    scanf("%d",&y);
    d = x/y;
    r = x%y;
    fx = x;
    fy = y;
    f = fx/fy;
    printf("%d"" ""%d"" ""%lf\n",d,r,f);
    return 0;
}

Measured memory_bytes: 636
package main
 
import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)
 
var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)
 
func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }
 
func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}
 
func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }
 
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
 
//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)
 
	r := scanFloat64()
	fmt.Fprintln(wr, 2*r*math.Pi)
}


Measured memory_bytes: 1760
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using i64 = long long;

auto sieve(long long n) {
    using i64 = long long;
    std::vector<i64> ps, lp(n + 1);
    for (int i = 2; i <= n; i++) {
        if (!lp[i]) {
            lp[i] = i;
            ps.push_back(i);
        }
        for (unsigned j = 0; j < ps.size() && ps[j] <= lp[i] && i * ps[j] <= n; j++) {
            lp[i * ps[j]] = ps[j];
        }
    }
    return lp;
}

int main() {
    int n;
    std::cin >> n;
    const auto lp = sieve(1010101);

    int g = 0;
    std::vector<int> v, ps(1010101);
    for (int i = 0; i < n; i++) {
        int a;
        std::cin >> a;
        g = std::gcd(g, a);
        while (a > 1) {
            const int p = lp[a];
            ps[p]++;
            while (a % p == 0) a /= p;
        }
    }

    const bool pc = std::all_of(ps.begin(), ps.end(), [](const int e) { return e < 2; });
    std::cout << (pc ? "pairwise coprime" : g == 1 ? "setwise coprime" : "not coprime") << std::endl;

    return 0;
}


Measured memory_bytes: 15096
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

struct edge{
    int id,to;
    edge(int to,int id) : to(to),id(id){}
};

int n,m;
vector<vector<edge>> g;
vector<int> ids;
bool dfs(int pre,int now,int gl){
    if(now==gl){
        return true;
    }
    for(auto x:g[now])if(x.to!=pre){
        if(dfs(now,x.to,gl)){
            ids.push_back(x.id);
            return true;
        }
    }
    return false;
}

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

    cin>>n;
    g.resize(n);
    rep(i,n-1){
        int a,b;cin>>a>>b;a--,b--;
        g[a].push_back(edge(b,i));
        g[b].push_back(edge(a,i));
    }
    cin>>m;
    vector<ll> es(m);
    rep(i,m){
        int u,v;cin>>u>>v;u--,v--;
        ids.clear();
        dfs(-1,u,v);

        ll b=0;
        for(auto x:ids){
            b|=(1ll<<x);
        }
        es[i]=b;
    }

    ll ans=0;
    rep(bit,(1<<m)){
        ll mask=0;
        rep(i,m){
            if((bit>>i)&1) mask|=es[i];
        }
        ll tmp=(1ll<<(n-1-__builtin_popcountll(mask)));
        ans+=__builtin_parity(bit)?-tmp:tmp;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
n, h = list(map(int, input().split()))
a = [0 for i in range(n)]
b = [0 for i in range(n)]
for i in range(n):
    a[i], b[i] = list(map(int, input().split()))
f = max(a)
b.sort()
for i in range(n):
    if b[i] <= f:
        b[i] = 0
    else:
        break

total = 0
count = 0
b.reverse()
for i in range(n):
    if b[i] == 0:
        break
    total += b[i]
    count += 1
    if total >= h:
        print(count)
        exit()
if (h - total) % f == 0:
    count += (h - total) // f
else:
    count += (h - total) // f
    count += 1
print(count)


Measured memory_bytes: 11372