akhauriyash/Code-Regression huggingface dataset:
import Control.Monad

main :: IO ()
main = do
  n <- readLn
  if n == 0
    then return ()
    else do
      ls <- replicateM n getLine
      let ls' = map (map (read :: String -> Int)) (map words ls)
          ts = map makeTuple ls'
          top = takeTop ts
          sec = takeTop (filter (/= top) ts)
          wor = takeWorst ts
          buu = takeWorst (filter (/= wor) ts)
      putStrLn $ show (fst top)
      putStrLn $ show (fst sec)
      putStrLn $ show (fst buu)
      main

makeTuple :: [Int] -> (Int,Int)
makeTuple [id,m1,s1,m2,s2,m3,s3,m4,s4] = (id,m1*60+s1+m2*60+s2+m3*60+s3+m4*60+s4)

takeTop :: [(Int,Int)] -> (Int,Int)
takeTop ts = foldl1 f ts
  where f (i1,t1) (i2,t2)
          |t1 > t2 = (i2,t2)
          |otherwise = (i1,t1)

takeWorst :: [(Int,Int)] -> (Int,Int)
takeWorst ts = foldl1 f ts
  where f (i1,t1) (i2,t2)
          |t1 < t2 = (i2,t2)
          |otherwise = (i1,t1)

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

int main(){
    int R, C, K;
    cin >> R >> C >> K;
    map<pair<int, int>, ll> item;
    for (int i = 0; i < K; i++) {
        int x, y, v;
        cin >> x >> y >> v;
        x--;
        y--;
        item[{x, y}] = v;
    }
    vector<vector<ll>> from(C, vector<ll>(4, 0)), to(C, vector<ll>(4, 0));
    for (int i = 0; i < R; i++) {
        for (int j = 0; j < C; j++) {
            for (int k = 0; k <= 3; k++) to[j][k] = 0;
            for (int k = 0; k <= 3; k++) to[j][0] = max(to[j][0], from[j][k]);
            if (j >= 1) {
                for (int k = 0; k <= 3; k++) to[j][k] = max(to[j][k], to[j-1][k]);
            }
            if (item.find({i, j}) != item.end()) {
                for (int k = 3; k >= 1; k--) to[j][k] = max(to[j][k], to[j][k-1]+item[{i, j}]);
            }
        }
        swap(from, to);
    }
    ll ans = 0;
    for (int i = 0; i <= 3; i++) ans = max(ans, from[C-1][i]);
    cout << ans << endl;
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  if(N%10 == 7){
    cout << "Yes" << endl;
  }
  else if (((N%100)-(N%10)) / 10 == 7){
    cout << "Yes" << endl;
  }
  else if ((N-(N%100)) / 100 == 7){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
           }

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

#define FAST ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define show(x) cout<<(x)<<endl
#define REP(i,a,n) for (int i=a;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define UM unordered_map
#define PB push_back
#define V vector
#define EPS 1e-9
typedef unsigned long ul;
typedef long long ll;
typedef string str;
/*FIN*/

V<int> b(200002, 0),a(200002,0);
int n,k;

int main() {
	FAST;
	cin>>n>>k;
	REP(i,0,n) cin>>a[i];
	REP(i,0,min(k,41)) {
		REP(j,0,n) {
			int l = max(0,j-a[j]);
			int r = min(n-1,j+a[j]);
			b[l]++;
			if(r+1 <= n) b[r+1]--;
		}
		REP(j,1,n) b[j]+=b[j-1];
		for(int j=0;j<n;b[j++]=0) a[j] = min(n,b[j]);
	}
	REP(i,0,n) cout<<a[i]<<" ";
	show("");
	return 0;
}

Measured memory_bytes: 4660
#include<stdio.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
#define S(type,x) fscanf(stdin,"%"#type,&x)
int main() {
	int n, i, j, m;
	double dp[1001] = {};
	dp[0] = 1;
	S(d, n), S(d, m);
	for (i = 0; i < n; i++) {
		j = 1;
		while (i + j <= n&&j <= m)dp[i + j] += dp[i] / (n - i), j++;
	}
	P(.10lf, dp[n]);
	return 0;
}

Measured memory_bytes: 652
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

struct Prime {
  int max_check;
  int max_prime;
  int prime_number;
  vector<int> primes;
  map<int, int> prime_id;
  Prime() {};
  Prime(int m) {
    initialize(m);
  };
  void initialize(int m) {
    sieve(m);
    prime_number = (int)primes.size();
    max_check = m;
  }

  void sieve(int m) {
    max_prime = 2;
    deque<bool> is_prime(m+1, true);
    is_prime[0] = is_prime[1] = false;
    int i;
    for (i = 2; i <= m; ++i) {
      if (!is_prime[i]) {
        continue;
      }
      if (i * i > m) {
        break;
      }
      for (int j = i*2; j <= m; j += i) {
        is_prime[j] = false;
      }
      prime_id[i] = (int)primes.size();
      primes.push_back(i);
      max_prime = i;
    }
    for (int j = i; j <= m; ++j) {
      if (!is_prime[j]) {
        continue;
      }
      prime_id[j] = (int)primes.size();
      primes.push_back(j);
      max_prime = j;
    }
  }

  map<int, int> prime_factor(ll x) {
    map<int, int> ret;
    if ((ll)max_check * (ll)max_check < x) {
      return ret;
    }
    for (int i = 0; i < prime_number; ++i) {
      if (x == 1) {
        break;
      }
      while (x % primes[i] == 0) {
        x /= primes[i];
        ret[primes[i]] += 1;
      }
    }
    if (x != 1) {
      ret[x] += 1;
    }
    return ret;
  }
};

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

  auto pr = Prime(55555);
  for (int p : pr.primes) {
    if (p % 5 == 2) {
      printf("%d ", p);
      n -= 1;
    }
    if (n == 0) {
      printf("\n");
      return 0;
    }
  }

  vi cnt(5, 0);
  for (int p : pr.primes) {
    cnt[p % 5] += 1;
  }
  debug(cnt);
  
  return 0;
}


Measured memory_bytes: 640
import numpy as np
from itertools import product

h, w, k = map(int, input().split())
c = np.empty((h, w), dtype='U1')
for i in range(h):
    c[i] = list(input())

res = 0
for arr in product(range(2), repeat=h+w):
    a = arr[:h]
    b = arr[h:]
    d = np.copy(c)
    for i in range(h):
        if not a[i]:
            continue
        d[i] = ['R'] * w
    for i in range(w):
        if not b[i]:
            continue
        d[:, i] = ['R'] * h
    if np.count_nonzero(d == '#') == k:
        res += 1
print(res)


Measured memory_bytes: 27180
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iostream>

using namespace std;

int main(void) {
	int n;char nc[9];
    cin>>n;
    sprintf(nc, "%d", n);
    int sum=0, i;
    for (i=0;i<strlen(nc);i++){
        sum+=nc[i]-'0';
    }
    cout<<(n%sum==0?"Yes":"No")<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static int binarySearch(int start, int n, int[] S, int q) {
        int mid = (start + n) / 2;
        if(mid == start || mid == n)return -1;
        if (S[n] < q || S[start] > q)
        return -1;
        if (S[start] == q){
            return 1;
        }
        if(S[mid] == q ){
            return 1;
        }
        if(S[n] == q) {
            return 1;
        }
        if (S[mid] < q) {
            return binarySearch(mid, n, S, q);
        } else {
            return binarySearch(start, mid, S, q);
        }
    }
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n, q;
        int S[];
        int T[];
        n = scan.nextInt();
        S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = scan.nextInt();
        }
        q = scan.nextInt();
        T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = scan.nextInt();
        }
        scan.close();
        for (int i = 0; i < q; i++) {
            for (int j = i+1; j < q; j++) {
                if(T[i] == T[j])T[j]=-1;
            }
        }

        int ans = 0;

        for (int i = 0; i < q; i++) { 
            if (binarySearch(0, n-1, S, T[i]) == 1)ans++;
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 68160
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()

x = "x"
print(x*len(S))

Measured memory_bytes: 5728
// AtCode.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>

using namespace std;

typedef vector<vector<int>> Graph;
Graph graph;

bool check(vector<int>& candidate) {
	for (unsigned int i = 0; i < candidate.size()-1; i++) {
		// i番目の数字がi+1番目の数字へのリンクを有しているか否か
		if(!binary_search(graph[candidate[i]].begin(), graph[candidate[i]].end(), candidate[i + 1])) return false;
	}
	return true;
}


int main() {

	int N, M;
	cin >> N >> M;

	graph.resize(N);

	for (int i = 0; i < M; i++) {
		int tmpa, tmpb;
		cin >> tmpa >> tmpb;
		graph[tmpa-1].push_back(tmpb-1);
		graph[tmpb-1].push_back(tmpa-1);
	}

	//0~N-1まで数字を並べた配列を作る
	vector<int> candidate;
	for (int i = 0; i < N; i++) {
		candidate.push_back(i);
		sort(graph[i].begin(), graph[i].end());
	}

	int count = 0;
	do {
		if( check(candidate) ) count++; // 指定の順番で最後まで到達できるかチェック
	} while (next_permutation(candidate.begin()+1,candidate.end())); // start is fixed

	cout << count << endl;
	return 0;

}


Measured memory_bytes: 256
import itertools
n,m = map(int,input().split())
def light(bit,value,tf):
    count = 0
    bit_v = []
    for i in range(len(bit)):
        if bit[i]:
            bit_v.append(i+1)
    for i in range(len(tf)):
        if tf[i] in bit_v:
            count += 1
    if count%2 == value:
        return True
    else:
        return False
k = [0 for _ in range(m)]
s = [0 for _ in range(m)]
for i in range(m):
    s[i] = map(int,input().split())
for i in range(m):
    s[i] = list(s[i])
    s[i] = s[i][1:]
p = list(map(int,input().split()))
bit = list(map(lambda x:list(x),itertools.product([0,1],repeat=n)))
ans = 0
for i in range(len(bit)):
    c = 0
    for j in range(m):
        if light(bit[i],p[j],s[j]):
            c += 1
    if c == m:
        ans += 1
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

//map
int main()
{

    int a,b;
    while(true)
    {
        cin >> a >> b;
        if(a+b == 0)break;
        cout << min(a,b) << " " << max(a,b) << endl;
    }
    return 0;
}


Measured memory_bytes: 3016
from heapq import heapify, heappop, heappush

N = int(input())
a = list(map(int, input().split()))

s = [0] * (2*N+1)
q1 = []
q2 = []
heapify(q1)
heapify(q2)

for i in range(N):
    s[i+1] = s[i] + a[i]
    heappush(q1, a[i])

for i in range(N, 2*N):
    mi = q1[0]
    if a[i] > mi:
        s[i+1] = s[i] - mi + a[i]
        heappop(q1)
        heappush(q1, a[i])
    else:
        s[i+1] = s[i]

t = [0] * (2*N+1)

for i in range(N):
    t[i+1] = t[i] + a[3*N-1-i]
    heappush(q2, -a[3*N-1-i])

for i in range(N, 2*N):
    ma = -q2[0]
    if a[3*N-1-i] < ma:
        t[i+1] = t[i] - ma + a[3*N-1-i]
        heappop(q2)
        heappush(q2, -a[3*N-1-i])
    else:
        t[i+1] = t[i]

res = -10 ** 15
for i in range(N, N*2+1):
    res = max(res, s[i] - t[N*3-i])

print(res)


Measured memory_bytes: 121872
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
s=s0()
d=Counter(s)
p0(list(d.values())==[2,2])

Measured memory_bytes: 3316
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#define maxn 600000
using namespace std;
int w,n;
long long x[maxn],sum[maxn];
int Left[maxn],Right[maxn];
int ok[maxn];
inline bool check(int mid){
       int cnt = 0;
       ok[cnt++] = 0;
       Right[1] = 0;
      // cout<<"mid="<<mid<<endl;
       for(int i = 2;i<=n;++i){
               Right[i] = max(0, Right[i-1]);
        //       cout<<i<<" "<<Right[i]<<" "<<sum[i]-sum[Right[i]]<<" "<<(long long)w<<endl;
               while((Right[i]<i)&&(sum[i]-sum[Right[i]]+(long long)(i-Right[i]-1)*mid>=(long long)w)){ ++Right[i];}
               --Right[i];
               if(Left[i]<=Right[i]){
                    int pos = lower_bound(ok,ok+cnt,Left[i])-ok;
                    if((pos<cnt)&&ok[pos]<=Right[i]){
                         ok[cnt++] = i;
                    }
               }
       }
   //    for(int i = 1;i<=n;++i)
     //          cout<<Right[i]<<" ";
       //cout<<endl;
       if(sum[n]-sum[ok[cnt-1]]+n-ok[cnt-1]-1<=w)return true;
       return false;
}
int main()
{
    while((cin>>w>>n)&&(w||n)){
        for(int i = 1;i<=n;++i)
                cin>>x[i];
        sum[0] = 0LL;
        for(int i = 1;i<=n;++i)
                sum[i] = sum[i-1]+x[i];
        Left[1] = 0;
        for(int i = 2;i<=n;++i){
                Left[i] = Left[i-1];
                while((Left[i]<i)&&(sum[i]-sum[Left[i]]+(long long)(i-Left[i]-1)>(long long)w))++Left[i];
        }
    //    for(int i = 1;i<=n;++i)
      //          cout<<Left[i]<<" ";
      //  cout<<endl;
        int l = 1,r = w;
        while(l<r){
             int mid = (l+r)/2;
             if(check(mid))r = mid;
             else l = mid+1;
           //  break;
        }
        cout<<r<<endl;
    }
    return 0;
}

Measured memory_bytes: 9560
use strict;
use warnings;

my ($n, $m);
{
  my $in = <STDIN>;
  ($n, $m) = split(" ", $in);
}
my @p;
for (my $i=0; $i<$m; $i++)
{
  my @in = split " ", <STDIN>;
  push @p, $in[1] . $in[0];
}
my %h;
$h{$_}++ for grep {/^AC/} @p;
my %k;
my $d = 0;
for my $key (keys %h) {
  $key =~ s/AC/WA/;
  $k{$key} = 1;
  $d++;
}
my $c = 0;
for (my $i=0; $i<$m; $i++) {
  my $s = $p[$i];
  if ($s =~ /^WA/) {
    if ($k{$s}) {
      $c++;
    }
  } else {
    $s =~ s/AC/WA/;
    $k{$s} = 0;
  }
}
print "$d $c\n";

Measured memory_bytes: 42880
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    tx -= sx;
    ty -= sy;
    
    REP(i,ty){
        cout << "U";
    }
    REP(i,tx){
        cout << "R";
    }
    REP(i,ty){
        cout << "D";
    }
    REP(i,tx){
        cout << "L";
    }

    cout << "L";
    REP(i,ty+1){
        cout << "U";
    }
    REP(i,tx+1){
        cout << "R";
    }
    cout << "D";

    cout << "R";
    REP(i,ty+1){
        cout << "D";
    }
    REP(i,tx+1){
        cout << "L";
    }
    cout << "U";

    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
struct matrix
{
	int a[3][3];
}ma({{{1,0,0},{1,1,0},{1,2,1}}}),mb({{{1,0,1},{1,1,1},{1,2,2}}}),ans({{{1,0,0},{0,1,0},{0,0,1}}});
matrix operator *(matrix a,matrix b)
{
	matrix c;
	memset(c.a,0,sizeof(c.a));
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++)
		{
			for(int k=0;k<3;k++)
			{
				c.a[i][k]=(c.a[i][k]+1ll*a.a[i][j]*b.a[j][k])%mod;
			}
		}
	}
	return c;
}
matrix pw(matrix a,int t)
{
	matrix s=a;
	t--;
	while(t)
	{
		if(t&1) s=s*a;
		a=a*a;
		t>>=1;
	}
	return s;
}
int main()
{
	int n,m,lst=0;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int x;cin>>x;
		if(x>lst+1) ans=ans*pw(mb,x-lst-1);
		ans=ans*ma;
		lst=x;
	}
	ans=ans*pw(mb,n-lst);
	cout<<ans.a[2][0]<<endl;
	return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{
	const string ansstr = "CODEFESTIVAL2016";
	string s;
	cin >> s;
	int ans = 0;
	fx(s.size()) {
		if (s[x]!=ansstr[x]) {
			ans++;
		}
	}
	ce(ans)

    return 0;
}



Measured memory_bytes: 256
//By Zank100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define din(t) long long t;cin>>t;
#define in(t) cin>>t;
#define full(t) t.begin(),t.end()
ll mul(ll a, ll b)
{
    return(((a%mod)*(b%mod))%mod);
}
ll modexp(ll b, ll e){
	ll res = 1;
	for(; e; b = b * b % mod, e >>= 1) if(e & 1) res = res * b % mod;
	return res;
}
ll modinv(ll a){
    ll x=mod-2;
	return modexp(a,x);
}
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	din(n);
	ll a[n+1]={0};
	for(ll i=1;i<=n;i++){
        for(ll j=1;j<=n;j++){
            for(ll k=1;k<=n;k++){
                //cout<<i<<j<<k<<endl;
                ll lol=(i+j+k)*(i+j+k);
                ll lolol=i*j + k*i + j*k;
                if(lol-lolol>n)break;
                a[lol-lolol]++;
            }
        }
        //cout<<"over"<<endl;
	}
	for(ll i=1;i<=n;i++)cout<<a[i]<<endl;
	return 0;
}


Measured memory_bytes: 3608
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    
    val b = sc.next()(0)
    val r = b match {
      case 'A' => 'T'
      case 'T' => 'A'
      case 'C' => 'G'
      case 'G' => 'C'
    }
    println(r)
  }

}


Measured memory_bytes: 27340
n = int(input())
b_list = [int(b) for b in input().split()]

a = []

a.append(b_list[0])

for b, b_next in zip(b_list[:-1], b_list[1:]):
    a.append(min(b, b_next))

a.append(b_list[-1])

print(sum(a))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,ans;
int main() {
           cin>>a>>b;
           k=1;
           while(k<=a) {
                      k*=b;
                      ans++;
           }
           cout<<ans;
}

Measured memory_bytes: 256
X,N,*p = map(int, open(0).read().split())
ps = set(p)
if X not in ps:
    print(X)
else:
    for i in range(1,101):
        if X - i not in ps:
            print(X-i)
            break
        if X + i not in ps:
            print(X+i)
            break

Measured memory_bytes: 9192
#include<bits/stdc++.h>
using namespace std;
#define rp(i,j) for(long long i=0;i<j;i++)
#define rep(i,j,k) for(long long i=j;i<k;i++)
#define mod 1000000007
typedef long long ll;
int main(){
    int n;cin>>n;
    int dp[50];
    rp(i,50){
        if(i==0||i==1)dp[i]=1;
        else dp[i]=dp[i-1]+dp[i-2];
    }
    cout<<dp[n]<<endl;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N;
    cin >> N;
    vector<int> V(N);
    rep(i, N) cin >> V[i];

    priority_queue<double , vector<double >, greater<>> queue;
    rep(i, N) {
        queue.push(V[i]);
    }

    while (queue.size() != 1) {
        double f = queue.top();
        queue.pop();
        double s = queue.top();
        queue.pop();
        queue.push((f + s) / 2);
    }
    cout << queue.top() << '\n';
}

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


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		double dicePossibility = (1.0 / n);
      	int k = sc.nextInt();
      	double res = 0.0;
      	
      	for (int i = 1; i <= n; i++) {
      		// i是骰子的點數 iはサイコロの出目です
      		int score = i;
      		int pow = 0;
      		double coinPossibility = 1.0;
      		if (i < k) {
          		while (score < k) {
          			score *= 2;
          			pow += 1;
          		}
          		// System.out.println(pow);
          		coinPossibility = Math.pow(0.5, pow * 1.0);
      		}
      		res += dicePossibility * coinPossibility;
      	}
      	System.out.println(res);
	}
	
    static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 21332
package main

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

func main() {
	sc = initScanner(os.Stdin)
	n, a, b := scanInt(sc), scanInt(sc), scanInt(sc)
	fmt.Println(resolve(n, a, b))
}

func resolve(n, a, b int) int {
	var tmp, sum int
	for i := 1; i <= n; i++ {
		tmp = 0
		is := strings.Split(strconv.Itoa(i), "")
		for _, v:= range is {
			vi, _ := strconv.Atoi(v)
			tmp += vi
		}
		if a <= tmp && tmp <= b {
			sum += i
		}
	}

	return sum
}

// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}

func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStringSlice(sc *bufio.Scanner, n int) []string {
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ss[i] = sc.Text()
	}

	return ss
}


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

int main(){
    int a;

    while(cin>>a,a!=-1){
        int v=1150;
        if(a>10)v+=min(a-10,10)*125;
        if(a>20)v+=min(a-20,10)*140;
        if(a>30)v+=(a-30)*160;

        cout<<4280-v<<endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include"bits/stdc++.h"
using namespace std;

struct card {
	char mrc;
	int num;
	int stable;
};

int Partition(vector<card>& A, int p, int r)
{
	int i = p - 1;
	int x = A.at(r).num;

	for (int j = p; j < r; j++)
	{
		if (A.at(j).num <= x)
		{
			i++;
			swap(A.at(i), A.at(j));
		}
	}
	swap(A.at(i + 1), A.at(r));

	return i + 1;
}

void QuickSort(vector<card>& A, int p, int r)
{
	if (p >= r) return;

	int	q = Partition(A, p, r);
	QuickSort(A, p, q - 1);
	QuickSort(A, q + 1, r);

	return;
}

void checkStable(vector<card>& A)
{
	bool flag = true;
	for (int i = 0; i < A.size() - 1; i++)
	{
		if (A.at(i).num != A.at(i + 1).num) continue;
		if (A.at(i).stable >= A.at(i + 1).stable) flag = false;
	}

	if (flag) cout << "Stable" << endl;
	else cout << "Not stable" << endl;
}

void print(vector<card>& A)
{
	for (int i = 0; i < A.size(); i++) cout << A.at(i).mrc << " " << A.at(i).num << endl;
}

int main(void)
{

	int N;
	cin >> N;
	vector<card> A(N);
	for (int i = 0; i < N; i++)
	{
		cin >> A.at(i).mrc >> A.at(i).num;
		A.at(i).stable = i;
	}

	QuickSort(A, 0, N - 1);

	checkStable(A);
	print(A);


	return 0;
}


Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll s;
  cin>>s;
  ll dp[2007];
  rep(i,3){
    dp[i]=0;
  }
  dp[0]=1;
  for(ll i=3;i<2007;i++){
    dp[i]=(dp[i-1]+dp[i-3])%MOD;;
  }
  print(dp[s]);
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main(){
    gearup;
    string s;cin>>s;
    if(s[2] == s[3] && s[4] == s[5])out("Yes");
    else out("No");
}

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

int main() {
  int k, n;
  cin >> k >> n;
  
  vector<int> a;
  a.reserve(200000);
  rep(i, n) {
    cin >> a[i];
  }
  
  int length = 0;
  rep(i, n-1) {
    length = max(length, a[i + 1] - a[i]); 
  }
  length = max(length, (a[0] + k) - a[n - 1]);
  
  cout << k - length << endl;
  
  
  return 0;
}


Measured memory_bytes: 1152
if __name__ == '__main__':
    N = int(input())
    arr = [int(x) for x in input().split()]
    freq = {}
    for elem in arr:
        if elem not in freq:
            freq[elem] = 0
        freq[elem] += 1
    total = 0
    for elem, f in freq.items():
        total += (f * (f - 1)) / 2
    for elem in arr:
        print(int(total - freq[elem] + 1))


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    ll A, B, C;
    cin >> A >> B >> C;

    cout << B + min(A+B+1, C) << endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::{self, Write};

struct Monster {
    health: i32,
    strength: i32,
}

impl Monster {
    fn new(health: i32, strength: i32) -> Monster {
        Monster { health, strength }
    }

    fn is_dead(&self) -> bool {
        !self.health.is_positive()
    }

    fn deal_damage(&self, other: &mut Self) {
        other.health -= self.strength;
    }
}

fn main() {
    let mut stdout = io::stdout();
    let stdin = io::stdin();

    let (mut takahashi, mut aoki) = {
        let mut input = String::new();
        stdin.read_line(&mut input).expect("failed to read line");
        let input: Vec<i32> = input
            .split_whitespace()
            .map(|s| s.parse::<i32>().expect("failed to parse"))
            .collect();
        let t = Monster::new(input[0], input[1]);
        let a = Monster::new(input[2], input[3]);
        (t, a)
    };

    let mut turn = true;
    while !takahashi.is_dead() && !aoki.is_dead() {
        if turn {
            takahashi.deal_damage(&mut aoki);
            turn = false;
        } else {
            aoki.deal_damage(&mut takahashi);
            turn = true;
        }
    }

    if aoki.is_dead() {
        println!("Yes");
    } else {
        println!("No");
    }
    stdout.flush().unwrap();
}


Measured memory_bytes: 2100
import java.util.Scanner;

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

		for(int i = 1; i <= N; i++) {
			power = i * power % ((int)Math.pow(10,9) +7);
		}
		System.out.println(power);
	}
}


Measured memory_bytes: 21204
#include<stdio.h>
int main(){
	char c[100];
	int h,w;
	int i,j;

	scanf("%d %d",&h,&w);
	for(i=0;i<h;i++){
		scanf("%s",c);
		for(j=1;j<=2;j++){
			printf("%s\n",c);
		}
	}

	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void){
  int a,b;
  scanf("%d%d",&a,&b);
  if(a==b)puts("Draw");
  else if(a==1) puts("Alice");
  else if(b==1) puts("Bob");
  else puts(a>b?"Alice":"Bob");
  return 0;
}

Measured memory_bytes: 128
#[allow(unused_imports)]
use std::cmp::Ordering::{Equal, Greater, Less};
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;

// right-triangle.rs --- Right Triangle
// author: Seong Yong-ju <sei40kr@gmail.com>

// tanakah's input macro
// cf https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        ab: u32,
        bc: u32,
        ca: u32,
    };

    let ans = ab * bc / 2;
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    string s;
    cin >> s;
    int n  = s.size();
    ll a   = 0;
    ll ret = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'A')
            a++;
        else if (s.substr(i, 2) == "BC") {
            ret += a;
            i++;
        } else {
            a = 0;
        }
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

void solve() {
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  printf("%d %d %d %d\n", x2 + (y1-y2), y2 - (x1-x2), x1 + (y1-y2), y1- (x1-x2));
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  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 all(x) (x).begin(),(x).end()

int main() {
  int n; cin >> n;
  vector<LL> a(n + 1), b(n);
  rep(i, n + 1) cin >> a[i];
  rep(i, n) cin >> b[i];

  LL ans = 0;
  for (int i = 0; i < n; i ++) {
    ans += min(b[i], a[i] + a[i + 1]);
    b[i] = max(b[i] - a[i], (LL)0);
    a[i + 1] =  max((LL)0, a[i + 1] - b[i]);
  }

  cout << ans << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
			int n, cnt;
			Scanner sc = new Scanner(System.in);
			n = sc.nextInt();
			for(cnt = 3; cnt < n; cnt++){
				if(cnt % 3 == 0 || String.valueOf(cnt).contains("3"))
					System.out.print(" " + cnt);
			}
			
			if(n % 3 == 0)
				System.out.println(" " + n);
			else
				System.out.print("\n");
	}
}

Measured memory_bytes: 28680
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;

int main()
{
	int h, w, d, Q, x[90001], y[90001], a, m[90001], l, r;
	scanf("%d %d %d", &h, &w, &d);
	for(int i=1; i<=h; i++){
		for(int j=1; j<=w; j++){
			scanf("%d", &a);
			x[a]=i;
			y[a]=j;
		}
	}
	for(int i=1; i<=d; i++){
		m[i]=0;
		int k=i;
		while(k<=h*w-d){
			k=k+d;
			m[k]=m[k-d]+abs(x[k]-x[k-d])+abs(y[k]-y[k-d]);
		}
	}
	scanf("%d", &Q);
	for(int i=0; i<Q; i++){
		scanf("%d %d", &l, &r);
		printf("%d\n", m[r]-m[l]);
	}
	return 0;
}

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

int main(){
    ll n;
    cin>>n;
    vector<P> ba(n);
    rep(i,n){
        ll a,b;
        cin>>a>>b;
        ba[i].first=b;
        ba[i].second=a;
    }
    sort(ba.begin(),ba.end());
    ll sum=0;
    string ans="Yes";
    rep(i,n){
        sum+=ba[i].second;
        if(ba[i].first<sum){
            ans="No";
            break;
        }
    }
    cout<<ans;


    return 0;
}

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

int main(){
	int ans=0;
	
	int x,a;
	cin >> x >> a;
	
	if(x>=a) ans = 10;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
    bool flag = true;
    int c[3][3];
    rep(i, 3) rep(j, 3) cin >> c[i][j]; 

    rep(i, 2){
        rep(j, 2){
            if (c[i][j+1] - c[i][j] != c[i+1][j+1] - c[i+1][j]) flag =false;
        }
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main()
{
	int A, B, C;
	cin >> A >> B >> C;
	int can = A - B;
	cout << max(0, C - can) << endl;
	return 0;
}


Measured memory_bytes: 384
bool DBG = false;
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
using ld = long double;
//using i128 = __int128_t;
//using bint = boost::multiprecision::cpp_int;
//using d1024 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1024>>;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()
#define fs first
#define sd second
#define couts(x) cout << (x) << (" ")
#define coutn(x) cout << (x) << ("\n")
#define endl "\n"
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define dcouts(x) if(DBG) couts(x)
#define dcoutn(x) if(DBG) coutn(x);
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T1, typename T2> std::istream &operator>>(std::istream &is, std::pair<T1,T2> &p){is >> p.first >> p.second; return is; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::deque<T> &vec){ os << "deque["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> std::ostream &operator<<(std::ostream &os, const std::pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }

template<class T> using V = vector<T>;
template<class T> using V2 = V<V<T>>;
template<class T> using V3 = V<V2<T>>;



void solve(){
  int n, m; cin >> n >> m;
  V<int> a(m); cin >> a;
  FOR(i,0,m) n -= a[i];
  couts(max(-1,n));
}



void solvec(){
  //
}

void solved(){
  //
}


int main(void){
  std::cout << std::fixed << std::setprecision(20);
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}

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

using namespace std;

int main()
{
    int n,k,ans=0;
    cin>>n>>k;
    int arr[n+1]={0};
    for(int i=0;i<k;i++)
    {
        int d;
        cin>>d;
        for(int j=0;j<d;j++)
        {
            int temp;
            cin>>temp;
            arr[temp]++;
        }
    }
    for(int i=1;i<=n;i++)
    {
        //cout<<arr[i]<<" ";
        if(arr[i]==0)
        {
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define all(c) begin(c),end(c)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
 
 
 
 
int main() {
  int p[3];
  rep(i,3)cin>>p[i];
  sort(p,p+3);
    if(p[0]==5&&p[1]==5&&p[2]==7){
      cout<<"YES";
    }else{
      cout<<"NO";
    }
  

}




Measured memory_bytes: 256
def LI(): return list(map(int,input().split()))
A,B,C,X,Y = LI()
ans = float('INF')
for i in range(max(X,Y)+1):
    price = A*max(X-i,0)+B*max(Y-i,0)+C*2*i
    ans = min(ans,price)
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
#define printd(x) printf("%.12f\n", ans);
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
#define YES() cout << "YES" << endl;
#define NO() cout << "NO" << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

int main(void) {
    int n;
    cin >> n;
    ll x[n], y[n], h[n];
    rep (i, n) cin >> x[i] >> y[i] >> h[i];

    rep (i, 101) rep (j, 101) {
        ll high = -1;
        bool ok = true;
        int start = 0;
        rep (k, n) {
            if (h[k] > 0) {
                if (high == -1) {
                    high = h[k] + abs(i - x[k]) + abs(j - y[k]);
                }
                else {
                    if (high != h[k] + abs(i - x[k]) + abs(j - y[k])) {
                        ok = false;
                    }
                }
            }
        }
        rep (k, n) {
            if (h[k] == 0) {
                if (abs(i - x[k]) + abs(j - y[k]) < high) {
                    ok = false;
                }
            }
        }
        if (ok) {
            cout << i << " " << j << " " << high << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<algorithm>
#define ll long long
#define lowbit(x) x&-x
using namespace std;
int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
int min(int a,int b){return a<b?a:b;}
int max(int a,int b){return a<b?b:a;}
int ab(int x){return x>0?x:-x;}
//int MO(int x){return x>=MOD?x-MOD:x;}
//void insert(int u,int v){tot++;e[tot].v=v;e[tot].from=first[u];first[u]=tot;}
/*------------------------------------------------------------*/
const int inf=0x3f3f3f3f;

int n,a,b;

int main(){
    scanf("%d%d%d",&n,&a,&b);
    if(!(ab(a-b)&1))printf("Alice");else printf("Borys");
    
    
    return 0;
}

Measured memory_bytes: 256