akhauriyash/Code-Regression huggingface dataset:
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    lint h, w;
    lint ans = INF;
    lint s_1, s_2, s_3, s_max, s_min;
    cin >> h >> w;
    for (lint i=1; i<w; ++i){
        s_1 = h * i;
        if(h % 2 == 0){
            s_2 = (h / 2) * (w - i);
            s_3 = s_2;
        }
        else {
            s_2 = (h / 2 + 1) * (w - i);
            s_3 = (h / 2) * (w - i);
        }
        s_max = max(s_1, max(s_2, s_3));
        s_min = min(s_1, min(s_2, s_3));
        // debugpair(s_max, s_min);
        ans = min(ans, abs(s_max - s_min));
    }
    swap(w, h);
    for (lint i=1; i<w; ++i){
        s_1 = h * i;
        if(h % 2 == 0){
            s_2 = (h / 2) * (w - i);
            s_3 = s_2;
        }
        else {
            s_2 = (h / 2 + 1) * (w - i);
            s_3 = (h / 2) * (w - i);
        }
        s_max = max(s_1, max(s_2, s_3));
        s_min = min(s_1, min(s_2, s_3));
        // debugpair(s_max, s_min);
        ans = min(ans, abs(s_max - s_min));
    }
    swap(w, h);
    if(h % 3 == 0 || w % 3 == 0){
        ans = 0;
    }
    else {
        if(h >= 4){
            s_1 = (h / 3) * w;
            s_2 = (h / 3 + 1) * w;
            ans = min(ans, abs(s_2 - s_1));
        }
        if(w >= 4){
            s_1 = (w / 3) * h;
            s_2 = (w / 3 + 1) * h;
            ans = min(ans, abs(s_1 - s_2));
        }
    }
    cout << ans << "\n";
    return 0;
}

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

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef map<int,int> mii;

const int MOD = 1e9+7;
const int maxN = 2e5+1;
int arr[maxN];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,k;
	cin >> n >> k;
	for (int i = 0;i < n;++i) {
		cin >> arr[i+1];
		arr[i+1] += arr[i];
	}
	int ans = 0;
	for (int i = k;i <= n;++i) {
		ans = max(ans,arr[i]-arr[i-k]);
	}
	double x = (double)(ans+k)/2.0;
	cout << ps(x,9) << '\n';
	return 0;
}



Measured memory_bytes: 4472
#!/usr/bin/env python3
#ABC129 B

n = int(input())
w = list(map(int,input().split()))

min = 10000000
for i in range(n):
    s1 = sum(w[0:i])
    s2 = sum(w[i:n])
    if abs(s1 - s2) < min :
        min = abs(s1 - s2)

print(min)

Measured memory_bytes: 3060
n, m, x = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(n)]

ans = 1001001001
for s in range(2 ** n):
    C = [0] * m
    cost = 0
    for i in range(n):
        if (s >> i) & 1:
            cost += A[i][0]
            for j in range(m):
                C[j] += A[i][j+1]
        ok = True
        for c in C:
            if c < x:
                ok = False
                break
        if ok:
            ans = min(ans, cost)
 
if ans == 1001001001:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 9160
#include <iostream>
#include <map>
#include <cstdio>
using namespace std;

string conv(map<char,char> &table,string a){
	for(int i=0;i<a.length();i++){
		if(a[i] != ' ')a[i] = table[a[i]];
	}
	return a;
}

int main(){
	int n;
	string s;
	scanf("%d\n",&n);
	while(n--){
		getline(cin,s);
		for(int a=0;a<26;a++){
			for(int b=0;b<26;b++){
				/*  */
				map<char,char> table;
				for(int i=0;i<26;i++){
					 table['a'+i] = 'a' + (a * i + b) % 26;
				}
				if(table.size()==26){
					string ret = conv(table,s);
					if(~ret.find("this")||~ret.find("that"))cout << ret << endl;
				}
			}
		}
	}
}

Measured memory_bytes: 952
//In The Name Of Godd
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef pair<ll, ll> ii;
typedef pair<int, ii> iii;
typedef pair<double, double> dd;
typedef pair<dd, double> ddd;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<dd> vdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vii> vvii;

#define forn(i, n) for (ll i = 0; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define inf 100000000000
#define eps 1e-9
const int maxn = 3010;
double dp[maxn][maxn];

int main() {
  ios::sync_with_stdio(false);
  int n; cin >> n;
  dp[0][0] = 1;
  forn(i, n + 1) if(i) {
    double cur; cin >> cur;
    forn(j, i) {
      dp[i][j + 1] += dp[i - 1][j] * cur;
      dp[i][j] += dp[i - 1][j] * (1 - cur);
    }
  }
  double ans = 0;
  for(int i = (n + 1) / 2; i <= n; i++) ans += dp[n][i];
  cout << fixed << setprecision(12) << ans << endl;

}


Measured memory_bytes: 69120
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



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

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

typedef long long ll;

using namespace std;

int dist[10][10];
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h,w;
  cin>>h>>w;
  rep(i,10)rep(j,10)cin>>dist[i][j];
  rep(k,10)rep(i,10)rep(j,10)chmin(dist[i][j],dist[i][k]+dist[k][j]);
  vector<int>cnt(10);
  rep(i,h)rep(j,w){int c;cin>>c;if(c!=-1)cnt[c]++;}
  ll res=0;
  rep(i,10)res+=dist[i][1]*cnt[i];
  cout<<res<<endl;

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main()
{
  int N,M;
  cin >> N >> M;
  vector<int> v(N);
  for(int i=0; i<N; i++){
    cin >> v[i];
  }
  int count = 0;
  set<int> s;
  for(int i=N-1; i>=0; i--){
    if(s.insert(v[i]).second){
      cout << v[i] << endl;
      if(++count >= M) break;
    }
  }
  return 0;
}

Measured memory_bytes: 3908
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().solver();
	}

	@SuppressWarnings("unchecked")
	void solver() {
		Scanner sc = new Scanner(System.in);
		int V = sc.nextInt();
		int E = sc.nextInt();
		ArrayList<Integer>[] g = new ArrayList[V];
		for (int i = 0; i < g.length; i++)
			g[i] = new ArrayList<>();
		for (int i = 0; i < E; i++) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			g[a].add(b);
			g[b].add(a);
		}
		Integer[] color = new Integer[V];
		Arrays.fill(color, -1);
		int base = 0;
		Map<Integer, Integer> map = new HashMap<>();
		for (int i = 0; i < V; i++) {
			if (color[i] == -1) {
				color[i] = 0;
				counter[0] = 1;
				counter[1] = 0;
				if (!dfs(g, color, i)) {
					System.out.println(-1);
					return;
				} else {
					base += Math.min(counter[0], counter[1]);
					if (counter[0] != counter[1]) {
						int value = Math.abs(counter[0] - counter[1]);
						map.put(Math.abs(value), map.containsKey(value) ? map.get(value) + 1 : 1);
					}
				}
			}
		}
		boolean[] dp = new boolean[V / 2 - base + 1];
		dp[0] = true;
		Iterator<Entry<Integer, Integer>> it = map.entrySet().iterator();
		int x = 0;
		while (it.hasNext()) {
			Entry<Integer, Integer> entry = it.next();
			int value = entry.getKey();
			int c = entry.getValue();
			for (int i = dp.length - 1; i >= 0; i--) {
				if (dp[i]) {
					for (int j = 1; j <= c && i + j * value < dp.length; j++) {
						dp[i + j * value] = true;
						x = Math.max(x, i + j * value);
					}
				}
			}
		}
		System.out.println((long) (base + x) * (long) (V - x - base) - E);
	}

	int[] counter = new int[2];

	boolean dfs(ArrayList<Integer>[] g, Integer[] color, int cur) {
		for (int v : g[cur]) {
			if (color[v] == -1) {
				color[v] = 1 ^ color[cur];
				counter[color[v]]++;
				if (!dfs(g, color, v)) {
					return false;
				}
			} else {
				if (color[cur] != (1 ^ color[v]))
					return false;
			}
		}
		return true;
	}
}

Measured memory_bytes: 114612
#include <stdio.h>

#define N 8
#define FREE 0
#define NOT_FREE 1

void putQueen(int);
void printBoard(void);

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

int main(){
  int i, j, k, r, c;

  for(i = 0; i < N; i++) for(j = 0; j < N; j++) flag[i][j] = 0;

  for(i = 0; i < N; i++) col[i] = FREE;

  for(i = 0; i < 2*N; i++) dpos[i] = dneg[i] = FREE;

  scanf("%d", &k);

  for(i = 0; i < k; i++){
    scanf("%d%d", &r, &c);
    flag[r][c] = 1;
  }

  putQueen(0);
  
  return 0;
}

void putQueen(int i){
  int j;

  if(i == N){
    printBoard();
    return;
  }

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

void printBoard(void){
  int i, j;

  for(i = 0; i < N; i++)
    for(j = 0; j < N; j++)
      if(flag[i][j] == 1 && row[i] != j) return;

  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(row[i] == j) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

Measured memory_bytes: 572
#include <iostream>
#include <algorithm>

int arr[100005];

int main()
{
	int n, k;
	std::cin >> n >> k;
	for (int i = 0; i < n; ++i)
		std::cin >> arr[i];
	std::sort(arr, arr + n);
	int min = 0x7FFFFFFF;
	for (int i = 0; i < n - k + 1; ++i)
	{
		int temp = arr[i + k - 1] - arr[i];
		if (temp < min)
			min = temp;
	}
	std::cout << min << '\n';
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <tuple>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sys/time.h>

using namespace std;

void solve(long long N, vector<long long> A, vector<long long> B){
  long long suma = accumulate(A.begin(), A.end(), 0LL);
  long long sumb = accumulate(B.begin(), B.end(), 0LL);
  if (suma < sumb) {
    std::cout << -1 << std::endl;
    return;
  }
  vector<long long> diff(N, 0);
  for (int i = 0; i < N; i++) {
    diff[i] = A[i] - B[i];
  }

  sort(diff.begin(), diff.end());
  long long minus_amount = 0LL;
  long long ret = 0LL;
  for (int i = 0; i < N; i++) {
    if (diff[i] < 0) {
      minus_amount += diff[i];
      ret++;
    } else {
      break;
    }
  }
  for (int i = N-1; i >= 0; i--) {
    if (minus_amount >= 0) {
      std::cout << ret << std::endl;
      return;
    }
    minus_amount += diff[i];
    ret++;
  }
}

int main(){
  long long N;
  scanf("%lld",&N);
  vector<long long> B(N);
  vector<long long> A(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&A[i]);
  }
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&B[i]);
  }
  solve(N, A, B);
  return 0;
}


Measured memory_bytes: 4096
n = int(input())
l =[input() for _ in range(n)]
a=0
b=0
c=0
d=0
for i in l:
    if i == "AC":
        a += 1
    if i == "WA":
        b += 1
    if i == "TLE":
        c += 1
    if i == "RE":
        d += 1

print("AC x "+str(a))
print("WA x "+str(b))
print("TLE x "+str(c))
print("RE x "+str(d))

Measured memory_bytes: 82756
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn dfs(graph: &[Vec<(usize, usize)>], colors: &mut [Option<usize>], root: usize, mut dist: usize) {
    if dist % 2 == 0 {
        colors[root] = Some(0);
        dist = 0;
    } else {
        colors[root] = Some(1);
    }

    for &(v, w) in graph[root].iter() {
        if colors[v].is_none() {
            dfs(graph, colors, v, dist + w)
        }
    }
}

fn main() {
    let n = scan!(usize);
    let mut graph = vec![vec![]; n + 1];

    for _ in 0..n - 1 {
        let (u, v, w) = scan!(usize, usize, usize);;
        graph[u].push((v, w));
        graph[v].push((u, w));
    }
    let mut colors = vec![None; n + 1];

    dfs(&graph, &mut colors, 1, 0);
    for &v in colors.iter().skip(1) {
        println!("{}", v.unwrap());
    }
}


Measured memory_bytes: 17788
N = int(input())
A = list(map(int,input().split()))
SA = sorted(A,reverse=True)
ALI =0
BOB=0
for i in range(0,N,2):
    ALI += int(SA[i])
for n in range(1,N,2):
    BOB += int(SA[n])
ans = ALI - BOB
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define MOD 1000000007
#define ALL(a) (a).begin(),(a).end()
#define pb(x) push_back(x)
#define ms(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10) 
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;

int main()
{
	int n;
	while (cin >> n, n)
	{
		int cost[15][15];
		REP(i, 15)REP(j, 15) cost[i][j] = (i == j ? 0 : INF);
		int a, b, c;
		int city = 0;
		REP(i, n)
		{
			cin >> a >> b >> c;
			cost[a][b] = cost[b][a] = c;
			city = max({ city, a, b });
		}
		city++;
		REP(k, city)REP(i, city)REP(j, city) cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
		int sum[15] = {};
		REP(i, city)
		{
			REP(j, city) sum[i] += cost[i][j];
		}
		int ans; int anssum = INF;
		REP(i, city)
		{
			if (anssum > sum[i])
			{
				ans = i;
				anssum = sum[i];
			}
		}
		cout << ans << " " << anssum << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <stdio.h>

int main(void) {
	int A,B;
	scanf("%d",&A);
	scanf("%d",&B);
	if(A<=5)
       printf("%d",0);
	else if(A>=6&&A<=12)
	   printf("%d",B/2);
	else
	   printf("%d",B);
	 

	  
	// your code goes here
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
string day[7] = {"SUN","MON","TUE","WED","THU","FRI","SAT" };
int main(){
	string S;
  	cin >> S;
  	for(int i=0;i<7;i++){
  		if(S==day[i]){
  			cout << 7-i <<endl;
  			return 0;
  		}
  	}
    
  	return 0;
}



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

int main(){
  
  int N,K,Q;
  cin >>N>>K>>Q;
  
  vector<int> cor(N);
  
  for(int i=0;i<Q;i++){
    int x;
    cin >>x;
    cor[x-1] ++;
  }
  
  for(int i=0;i<N;i++){
    if((Q - cor[i]) >= K){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
  }
}

Measured memory_bytes: 1024
// -*- coding:utf-8-unix -*-

use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        d: usize,
        t: usize,
        s: usize,
    }
    if s*t >= d {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

#define NMAX 10000
#define QMAX 500

int main(void){
  int i,j,n,S[NMAX],q,T[QMAX],C=0;

  scanf("%d", &n);
  if(n>NMAX) exit(1);
  for(i=0;i<n;i++)scanf("%d", &S[i]);

  scanf("%d", &q);
  if(q>QMAX) exit(1);
  for(i=0;i<q;i++)scanf("%d", &T[i]);

  for(i=0;i<q;i++){
    for(j=0;j<n;j++){
      if(S[j]==T[i]){
        C++;
        break;
      }
    }
  }

  printf("%d\n",C);
  return 0;
}

Measured memory_bytes: 636
#include<iostream>
#define MAX 1000000
using namespace std;
int is_prime[MAX+10];
void prime_make(int n){
	for(int i=0;i<=n;i++)
	is_prime[i]=true;
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i*i<=n;i++){
		if(is_prime[i]){
			for(int j=i*2;j<=n;j+=i)
			is_prime[j]=false;
		}
	}
}
int main(){
	prime_make(MAX);
	int n;
	while(cin>>n){
		int ans=0;
		for(int i=1;i<=n;i++)
		if(is_prime[i]&&is_prime[n-i+1])
		ans++;
		
		cout<<ans<<endl;
		
	}return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

    int n;cin >> n;
    int now = 0;
    REP(i, n){
        int a;cin >> a;
        now ^= a;
    }

    if(now == 0){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def assign_color():
    _id = 1
    for m in range(vertices_num):
        if vertices_status_list[m] == -1:
            graph_dfs(m, _id)
            _id += 1
    return None


def graph_dfs(vertex, color):
    vertices_stack = list()
    vertices_stack.append(vertex)
    vertices_status_list[vertex] = color
    while vertices_stack:
        current_vertex = vertices_stack[-1]
        vertices_stack.pop()
        for v in adj_list[current_vertex]:
            if vertices_status_list[v] == -1:
                vertices_status_list[v] = color
                vertices_stack.append(v)
    return None


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices_num, relation_num = map(int, _input[0].split())

    relation_info = _input[1:relation_num + 1]

    question_num = int(_input[relation_num + 1])
    question_list = _input[relation_num + 2:]

    adj_list = [[] for _ in range(vertices_num)]
    vertices_status_list = [-1] * vertices_num

    for relation in relation_info:
        key, value = map(int, relation.split())
        adj_list[key].append(value)
        adj_list[value].append(key)

    assign_color()

    # print(adj_list)
    for question in question_list:
        start, target = map(int, question.split())
        if vertices_status_list[start] == vertices_status_list[target]:
            print("yes")
        else:
            print("no")

Measured memory_bytes: 35788
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    int a=in.nextInt();
    int b=in.nextInt();
    int max=Math.max(a+b,a*b);
    max=Math.max(max,a-b);
    System.out.println(max);
  }
}

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


signed main(){

    int W, H, x, y, r;

    std::cin >> W;
    std::cin >> H;
    std::cin >> x;
    std::cin >> y;
    std::cin >> r;

    if (x + r <= W & y + r <= H & x >= 0 & y >= 0){
        std::cout << "Yes" << std::endl;
    }
    else{
        std::cout << "No" << std::endl;
    }

    return 0;
}


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

using namespace std;

int main(){
    
    int a, b, c, ans=0;
    cin >> a >> b >> c;
    
    for(int i=a;i<=b;i++){
        
        if(c%i==0)ans+=1;
        
    }
    
    cout << ans << endl;
    
}


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

bool compare(string a,string b)
{
    int n=a.size();
    for(int i=0; i<n; i++)
        if(a[i]!=b[i]) return a[i]<b[i];
    return a[n-1]<=b[n-1];
}

int main()
{
    int n,l;
    cin>>n>>l;
    string s[n];
    for(int i=0; i<n; i++)
        cin>>s[i];
    sort(s,s+n);
    for(int i=0; i<n; i++)
        cout<<s[i];
    cout<<endl;
    return 0;
}



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

const int INF = 0x3f3f3f3f;

vector< vector<int> > g;
vector<int> topoSort;
vector<int> was;

void dfs(int u) {
  was[u] = 1;
  for (auto& v : g[u]) {
    if (!was[v]) {
      dfs(v);
    }
  }
  topoSort.push_back(u);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  g.resize(n + 1);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
  }
  was.assign(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    dfs(i);
  }
  reverse(topoSort.begin(), topoSort.end());
  vector<int> dp(n + 1, -INF);
  for (auto& u : topoSort) {
    if (dp[u] < 0) {
      dp[u] = 0;
    }
    for (auto& v : g[u]) {
      dp[v] = max(dp[v], dp[u] + 1);
    }
  }
  cout << *max_element(dp.begin(), dp.end()) << '\n';
  return 0;
}

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

using namespace std;

int countStr(string s, const string target) {
    int count = 0;
    string::size_type pos = s.find(target);
    while(pos != string::npos) {
        count++;
        pos = s.find(target, pos + target.length());
    }
    return count;
}

int main() {
    int N, Q;
    string S;
    int l, r;

    cin >> N >> Q;
    cin >> S;

    vector<int> CumSum(N);
    CumSum[0] = 0;

    for(int i = 1; i < N; i++) {
        if(S[i-1] == 'A' && S[i] == 'C') CumSum[i] = CumSum[i-1] + 1;
        else CumSum[i] = CumSum[i-1];
        //CumSum[i] = countStr(S.substr(i), "AC");
    }

    for(int i = 0; i < Q; i++) {
        cin >> l >> r;
        cout << CumSum[r-1] - CumSum[l-1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1408
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
sum_a = sum(a)
sunuke = 0
ans = [0]*(n-1)
for i in range(n-1):
    sunuke += a[i]
    ans[i] = abs(sum_a-(2*sunuke))
print(min(ans))

Measured memory_bytes: 23800
import java.util.*;

public class Main {
	
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		int n=Integer.parseInt(scan.next());
		int[] h =new int[n];
		for (int i=0;i<n;++i) {
			h[i]=Integer.parseInt(scan.next());
		}
		
		
		boolean ans=true;
		for(int i=0;i<n-1;++i) {
			if (h[i]<h[i+1]) {
				h[i+1]=h[1+i]-1;
			}else if (h[i]>h[i+1]) {
				ans=false;
		}
		

		}
		
		
		System.out.print(ans?"Yes":"No");

		
}
}
//end

Measured memory_bytes: 47724
#include<stdio.h>

int main(){
  int i, m, t;
  int x, y;
  scanf("%d %d", &x, &y);
  if(x < y){
    t = x;
    x = y;
    y = t;
  }
  m = y;
  while(1){
    i = x % m;
    if(i == 0) break;
    x = m;
    m = i;
  }
  printf("%d\n", m);
}



Measured memory_bytes: 2128
#include <cstdio>

int main() {
    int n;
    scanf("%d", &n);
    int l[9] = {111, 222, 333, 444, 555, 666, 777, 888, 999};
    for (int i = 0; i < 9; i++) {
        if (n <= l[i]) {
            printf("%d\n", l[i]);
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    h,n=map(int,input().split())
    lis=np.array([list(map(int,input().split())) for _ in range(n)])
    a_max=np.max(lis[:,0])
    dp=np.zeros(h+a_max+1,int)
    for i in range(a_max+1,a_max+h+1):
        dp[i]=np.min(dp[i-lis[:,0]]+lis[:,1])
    print(dp[a_max+h])

if __name__=='__main__':
    main()

Measured memory_bytes: 27448
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int a = 4;
    int b = 7;
    String ans = "No";
    for(int i = 0; i <= n; i++){
      for(int j = 0; j <= n-i; j++){
        if(n-(a*i+b*j) == 0){
          ans = "Yes";
          break;
        }
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21716
#include <utility> // pair make_pair
using std::swap; // c++11
using std::pair;
using std::make_pair;
#include <tuple> // tuple(c++11) make_tuple(c++11)
using std::tuple; // get<address>(variable)
using std::make_tuple;
#include <string> // string stoi(c++11) stoll(c++11) to_string(c++11)
using std::string;
using std::stoi;
using std::stoll;
using std::to_string;
#include <queue> // queue priority_queue
using std::queue;
using std::priority_queue;
#include <stack> // stack
using std::stack;
#include <vector> // vector
using std::vector;
#include <map> // map
using std::map;
#include <set> // set
using std::set; // insert erase find count
#include <algorithm> // min max
using std::sort;
using std::lower_bound; // iterator,  >=
using std::upper_bound; // iterator,  >
using std::min;
using std::max;
using std::min_element; // iterator
using std::max_element; // iterator
#include <complex> // complex
using std::complex; // real imag
#include <iostream> // cin cout
using std::cin;
using std::cout;
using std::endl;
#include <iomanip> // setprecision fixed(manipulator)
using std::setprecision;
using std::fixed;
#include <cmath>
#include <cstdio>

#define lli long long int
#define INF (int)1e09
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define EFOR(i, m, n) for (int i = m; i <= n; i++)
#define RFOR(i, m, n) for (int i = m; i > n; i--)
#define REFOR(i, m, n) for (int i = m; i >= n; i--)
#define VSORT(v) sort((v).begin(), (v).end()) // sort vector
typedef pair<int, int> PI;
typedef tuple<int, int, int> TI;
template <typename T> using Vec = vector<T>; // c++11

int main(void) {
    string s;
    string t;
    cin >> s >> t;
    int count_s[26];
    int count_t[26];
    FOR (i, 0, 26) {
        count_s[i] = 0;
        count_t[i] = 0;
    }

    FOR (i, 0, (int)s.length()) {
        count_s[(int)(s[i] - 'a')]++;
    }
    FOR (i, 0, (int)t.length()) {
        count_t[(int)(t[i] - 'a')]++;
    }

    string ns = "";
    string nt = "";
    FOR (i, 0, 26) {
        while (count_s[i] != 0) {
            ns += (i + 'a');
            count_s[i]--;
            if (count_s[i] == 0) {
                break;
            }
        }
        while (count_t[25 - i] != 0) {
            nt += (25 - i + 'a');
            count_t[25 - i]--;
            if (count_t[25 - i] == 0) {
                break;
            }
        }
    }
    if (ns < nt) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

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

    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if (d2 == 1) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 892
N = int(input())
List_A = list(map(int, input().split()))
List_B = list(map(int, input().split()))
res = 0
for i in range(N):
  if List_A[i] >= List_B[i]:
    res += List_B[i]
  else:
    res += List_A[i]
    if List_A[i+1] >= List_B[i]-List_A[i]:
      res += List_B[i]-List_A[i]
      List_A[i+1] = List_A[i+1] - List_B[i] +List_A[i]
    else:
      res += List_A[i+1]
      List_A[i+1] = 0
print(res)

Measured memory_bytes: 24152
#include<bits/stdc++.h>                                                                          
using namespace std;
typedef long long ll;
int main()
{
  ll a,b,x;
  cin >> a >> b >> x;
  int count=0;
  if(a==0){
    cout << b/x+1 << endl;
    return 0;
  }
  cout << b/x-(a-1)/x << endl;
}


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

class Main{
    public static void main(String[] args){
        solve();
    }

    public static void solve(){
        Scanner sc = new Scanner(System.in);
 		String s = sc.next();
 		boolean flag = true;
 		for(int i=0;i<s.length()-1;i++){
 			if(s.charAt(i)==s.charAt(i+1)){
 				flag = false;
 			}
 		}       
 		if(flag){
 			System.out.println("Good");
 		}
 		else{
 			System.out.println("Bad");
 		}
    }
}

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

int main(){
  int arr[3];
  cin >> arr[0] >> arr[1] >> arr[2];
  sort(arr, arr + 3);
  cout << arr[0] << " " <<arr[1] << " " << arr[2] << endl;

  return 0;
}


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

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

  int n;
  cin >> n;

  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;

    mp[s]++;
  }

  cout << "AC x " << mp["AC"] << '\n';
  cout << "WA x " << mp["WA"] << '\n';
  cout << "TLE x " << mp["TLE"] << '\n';
  cout << "RE x " << mp["RE"] << '\n';
}


Measured memory_bytes: 3664
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int H, N;
	cin >> H >> N;

	vector<int> A(N, 0);
	vector<int> B(N, 0);
	for (int ii = 0; ii < N; ++ii){
		cin >> A[ii] >> B[ii];
	}

	const int INF = 100100100;

	vector <int> minMagic(H + 1, 0);
	for (int hp = 1; hp <= H; ++hp){
		int minTmp = INF;
		for (int jj = 0; jj < N; ++jj){
			int damage = A[jj];
			int magic = B[jj];

			int remHP = hp - damage;
			int tmpMagic = magic;
			if (remHP > 0){
				tmpMagic += minMagic[remHP];
			}
			if (minTmp > tmpMagic){
				minTmp = tmpMagic;
			}
		}
		minMagic[hp] = minTmp;
	}

	cout << minMagic[H] << endl;

	return 0;
}


Measured memory_bytes: 256
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    A,B=pin()
    cnt=0
    for i in range(A,B+1):
        temp=str(i)
        if temp==temp[::-1]:cnt+=1
    print(cnt)
#%%submit!    
resolve()



Measured memory_bytes: 40428
import java.util.*;
  
class  Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n;
        String a;
        int b = 0;
        int[][]kard = new int[4][13];//????????? S,H,C,D??¨?¨? 13 1??????????????????????
        String []mark = {"S","H","C","D"};
        n = sc.nextInt();
        for(int i=0; i<n; i++){ 
            a = sc.next();
            b = sc.nextInt();
            for(int d=0; d<4; d++){
                if(mark[d].equals(a))
                kard[d][b-1]++;
            }
        }
        for(int c=0; c<4; c++){
            for(int d=0; d<13; d++){
                if( kard[c][d]==0) 
                System.out.println(mark[c]+" "+(d+1)); 
            }
        }
    }
}

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

signed main() {
  int n; cin >>n;
  vector<int> a(n);
  rep(i,n) cin >>a[i];
  int ans = 0;
  rep(i,n) {
    if((i+1)%2==1 && a[i]%2==1) ++ans;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;

if(-1000<=a&&b<=1000){
  if(a>b)
  cout<<"a > b"<<endl;
  else if(a==b)
  cout<<"a == b"<<endl;
  else
  cout<<"a < b"<<endl;
}
else{}

  return 0;
}

Measured memory_bytes: 3084
#include <stdio.h>

int fun(int a,int b);

int main()
{
	long long int n,sum = 0;
	int a,b,c;
	
	scanf("%lld",&n);
	
	for(a = 1;a <= n;a++)
	{
		for(b = 1;b <= n;b++)
		{
			for(c = 1;c <= n;c++)
				sum += fun(a,fun(b,c));
		}
	}
	
	printf("%lld\n",sum);
	
	return 0;
}

int fun(int x,int y)
{
	int r;
	
	if(x < y)
	{
		r = x;
		x = y;
		y = r;
	}
	r = x % y;
	
	while(r != 0)
	{
		x = y;
		y = r;
		r = x % y;
	}
	
	return y;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

ll f(ll b, ll n) {
    if (n<b) return n;
    return f(b, n/b)+n%b;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n, s;
    cin >> n >> s;
    ll ans = 0;
    if (n==s) {
        cout << n+1 << endl;
        return 0;
    }
    if (n<s) {
        pr(-1);
        return 0;
    }

    for (ll b=2; b*b<=n; b++) {
        if (f(b, n)==s) {
            pr(b);
            return 0;
        }
    }
    ll maxp = 1;
    for (ll p=1; p*p<=n; p++) {
        maxp = p;
    }
    for (ll p=maxp; p>=1; p--) {
        if ((n-s)%p!=0) continue;
        ll b = (n-s)/p+1;
        if (f(b, n)==s) {
            pr(b);
            return 0;
        }
    }
    
    ans = -1;
    pr(ans);
    return 0;
}


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

int main()
{
	int m = 100000;
	int n;
	cin >> n;

	for(int i=0; i<n; i++)
	{
		m += m / 20;
		if(m % 1000 != 0) m = (m / 1000 + 1) * 1000;	
	}
	printf("%d\n", m);
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;
 
#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end
 
typedef long long ll;
 
// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};
 
// const int C = 1e6+10;
const ll infty = (ll)1e18*4 + 10;
 
int N, K;
ll x[100];
ll y[100];
 
set<ll> Sx, Sy;
 
int ok(int k, ll X0, ll X1, ll Y0, ll Y1) {
  if (X0 <= x[k] && x[k] <= X1 && Y0 <= y[k] && y[k] <= Y1) {
    return 1;
  }
  return 0;
}
 
int cnt(ll X0, ll X1, ll Y0, ll Y1) {
  int ans = 0;
  for (auto i = 0; i < N; ++i) {
    ans += ok(i, X0, X1, Y0, Y1);
  }
  return ans;
}
 
ll area(ll X0, ll X1, ll Y0, ll Y1) {
  if (cnt(X0, X1, Y0, Y1) >= K) {
    return (Y1 - Y0) * (X1 - X0);
  }
  return infty;
}
 
int main () {
  cin >> N >> K;
  for (auto i = 0; i < N; ++i) {
    cin >> x[i] >> y[i];
    Sx.insert(x[i]);
    Sy.insert(y[i]);
  }
  ll ans = infty;
  for (auto itx0 = Sx.begin(); itx0 != Sx.end(); ++itx0) {
    for (auto itx1 = itx0; itx1 != Sx.end(); ++itx1) {
      for (auto ity0 = Sy.begin(); ity0 != Sy.end(); ++ity0) {
        for (auto ity1 = ity0; ity1 != Sy.end(); ++ity1) {
          ans = min(ans, area(*itx0, *itx1, *ity0, *ity1));
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import Data.List
-- import qualified Data.Vector.Unboxed as VU
-- import qualified Data.Vector.Unboxed.Mutable as VUM
-- import Control.Monad
-- import Control.Monad.ST
import Debug.Trace

solve :: Int -> [(Int,Int,Int)] -> Int
solve bigN abcs = maximum [xa, xb, xc]
  where
    (xa, xb, xc) = foldl' op (0,0,0) abcs
      where
      op (pa, pb, pc) (a, b, c) = (a + max pb pc, b + max pc pa, c + max pa pb)

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> Int
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_bigN]:remLines1 = remLines0
      bigN = readBInt bs_bigN
      abcs = map (\[x1,x2,x3] -> (readBInt x1,readBInt x2,readBInt x3)) remLines1
  in solve bigN abcs

outAnswer :: Int -> IO ()
outAnswer = putStrLn . show

main :: IO ()
main = outAnswer . tmain =<< B.getContents


Measured memory_bytes: 41212
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

public class Program
{
    public static void Main(string[] args)
    {
        new Magatro().Solve();
    }
}

class Magatro
{
    private int N, T;
    private int[] t;

    private void Scan()
    {
        var line = Console.ReadLine().Split(' ');
        N = int.Parse(line[0]);
        T = int.Parse(line[1]);
        t = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    }

    public void Solve()
    {
        Scan();
        long ans = 0;
        for (int i = 0; i < N-1; i++)
        {
            ans += Math.Min(t[i + 1], t[i] + T) - t[i];
        }
        ans += T;
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 26592
N = int(input())
import sys

for h in range(1,3501):
    for n in range(1,3501):
        if 4*h*n - N*n - N*h > 0:
            if (N*h*n / (4*h*n - N*n - N*h)) == (N*h*n // (4*h*n - N*n - N*h)):
                print(h,n,N*h*n // (4*h*n - N*n - N*h))
                sys.exit()

Measured memory_bytes: 40668
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    vector<int> v(n+1), u(n);
    for (auto &&i : v) scanf("%d", &i);
    for (auto &&j : u) scanf("%d", &j);
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        if(v[i]) {
            ans += min(v[i], u[i]);
            u[i] -= min(v[i], u[i]);
        }
        ans += min(v[i+1], u[i]);
        v[i+1] -= min(v[i+1], u[i]);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
	int a, b, c, x, ans = 0;
	cin>> a>> b>> c>> x;
	x /= 50;
	for(int i = 0; i <= a; ++i)
	for(int j = 0; j <= b; ++j)
	for(int k = 0; k <= c; ++k)
		if(k+2*j+10*i == x) ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define lint long long
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#define debug(...)\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;

template < template < typename ... > class Container, typename Value >
auto make_z_array(Container< Value > const & s) -> std::vector< int > {
  if (s.empty()) return {};
  auto n = (int)s.size();
  std::vector< int > ret(n);
  ret.at(0) = n;
  auto i = 1, j = 0;
  while (i < n) {
    while (i + j < n && s.at(j) == s.at(i + j))
      { j++; }
    ret.at(i) = j;
    if (j == 0)
      { i++; }
    else {
      auto k = 1;
      while (i + k < n && k + ret.at(k) < j) {
        ret.at(i + k) = ret.at(k);
        k++;
      }
      i += k, j -= k;
    }
  }
  return ret;
}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  std::string s; std::cin >> s;
  auto ret = 0;
  rep(i, 0, n) {
    auto a = make_z_array(std::string(s.begin() + i, s.end()));
    rep(j, 0, n - i)
      { cmx(ret, std::min(j, a.at(j))); }
  }
  std::cout << ret << std::endl;
  return 0;
}


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

int main() {
    int N; cin >> N;
    vector<int> A(N);
    rep(i, 0, N) cin >> A[i];
    using P = pair<int64, int64>;
    vector<vector<P>> memo(N, vector<P>(N, P(-1, -1)));
    function<P(int, int)> dp = [&](int l, int r) {
        if(memo[l][r] != P(-1, -1)) return memo[l][r];
        if(l == r) return memo[l][r] = P(A[l], 0);
        int64 ns = 0, ncost = 1e18;
        rep(i, l, r) {
            P ldp = dp(l, i);
            P rdp = dp(i + 1, r);
            int64 s = ldp.first + rdp.first;
            int64 cost = ldp.second + rdp.second;
            if(ncost > s + cost) {
                ns = s;
                ncost = s + cost;
            }
        }
        return memo[l][r] = P(ns, ncost);
    };
    cout << dp(0, N - 1).second << endl;
    return 0;
}


Measured memory_bytes: 2816
def judge(h, w):
    for i in range(b_h):
        for j in range(b_w):
            b_element = B[i][j]
            a_element = A[i+h][w+j]
            if a_element != b_element:
                return False
    return True

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

a_h, a_w = N, len(A[0])
b_h, b_w = M, len(B[0])
max_h, max_w = a_h - b_h, a_w - b_w
ans = "No"
# 二重ループで左上のスタート地点を全探索する
for i in range(a_h):
    for j in range(a_w):
        if j > max_w or i > max_h:
            continue
        if judge(i, j):
            ans = "Yes"

print(ans)



Measured memory_bytes: 40812
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int n;
  string s, t;
  cin >> n >> s >> t;
  
  string ans = "";
  for (int i = 0; i < n; i++) {
    ans += s[i];
    ans += t[i];
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);

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

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

signed main(){

    int m = 1000000007;
    int n; cin >> n;
    vec a(n + 1); readvec(a);

    vec num(n, 0);
    int w;
    REP(i, n + 1){
        num[a[i]]++;
        if(num[a[i]] == 2){
            w = a[i];
            break;
        }
    }

    int l, r;
    REP(i, n + 1){
        if(a[i] == w){
            l = i;
            break;
        }
    }
    IREP(i, n + 1){
        if(a[i] == w){
            r = i;
            break;
        }
    }
    int d = r - l + 1;

    vec fact(n + 2, 1);
    FOR(i, 1, n + 2){
        fact[i] = (i * fact[i - 1]) % m;
    }

    FOR(k, 1, n + 2){
        int ans = (fact[n + 1] * mod_inverse(fact[k], m)) % m;
        ans = (ans *  mod_inverse(fact[n + 1 - k], m)) % m;
        if(n + 1 - d >= k - 1){
            int tmp = (fact[n + 1 - d] * mod_inverse(fact[k - 1], m)) % m;
            tmp = tmp * mod_inverse(fact[n - d - k + 2], m) % m;
            ans = (ans + (m - tmp)) % m;
        }
        cout << ans << endl;
    }


    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define PB push_back
#define MP make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

const int MOD = 1e9+7;
const int INF = 1e9;
const int MAX_P = 10000000;

bool prime[MAX_P+1];

int main() {

  while (true) {
    int m, n;
    cin >> m >> n;
    if (m == 0) break;
    for (int i = 0; i <= MAX_P; i++) {
      prime[i] = false;
    }
    int pre_pri = m;
    for (int i = 0; i < n; i++) {
      for (int j = pre_pri; j <= MAX_P; j++) {
        if (!prime[j]) {
          pre_pri = j;
          break;
        }
      }
      for (int j = pre_pri; j <= MAX_P; j+=pre_pri) {
        prime[j] = true;
      }
    }
    for (int i = m; i <= MAX_P; i++) {
      if (!prime[i]) {
        cout << i << endl;
        break;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 12824
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var nd = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
            var n = nd[0];
            var d = nd[1];

            var cnt = 0;
            for (var i = 0; i < n; i++)
            {
                var xy = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
                var x = (double) xy[0];
                var y = (double) xy[1];
                if (Math.Sqrt(x * x + y * y) <= d) cnt++;
            }
            Console.WriteLine(cnt);
        }
    }
}

Measured memory_bytes: 41404