akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

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

    vector<set<int>> children(N);
    vector<int> parent(N);
    parent[0] = -1;

    for (int i = 1; i < N; ++i) {
        int p;
        cin >> p;
        --p;
        parent[i] = p;
        children[p].insert(i);
    }

    vector<int> X(N);
    for (int i = 0; i < N; ++i)
        cin >> X[i];

    vector<int> order;
    deque<int> q;
    q.push_back(0);
    while (!q.empty()) {
        int i = q.front();
        q.pop_front();
        order.push_back(i);
        for (int j : children[i]) {
            q.push_back(j);
        }
    }

    reverse(order.begin(), order.end());

    vector<pair<int, int>> score(N);

    for (int i : order) {
        //cerr << "Looking at " << i << endl;

        set<int>& ch = children[i];

        int offset = 0;
        int lsum = 0;
        int rsum = 0;
        for (int j : ch) {
            offset += score[j].first;
            lsum += score[j].second;
            rsum += score[j].first + score[j].second;
        }

        //cerr << "Raw offset = " << offset << ", lsum = " << lsum << endl;

        lsum -= offset;

        vector<bool> dp(lsum + 1);
        dp[0] = true;
        for (int j : ch) {
            vector<bool> ndp(lsum + 1);
            int x, y;
            tie(x, y) = score[j];
            int z = y - x;

            for (int k = 0; k <= lsum; ++k) {
                if (dp[k]) {
                    ndp[k] = ndp[k + z] = 1;
                }
            }
            dp.swap(ndp);
        }

        int best = -1;
        for (int k = 0; k <= lsum; ++k) {
            if (dp[k]) {
                if (k + offset <= X[i])
                    best = k + offset;
            }
        }

        if (best == -1) {
            cout << "IMPOSSIBLE\n";
            return 0;
        }

        int rest = rsum - best;
        best = X[i];

        if (rest < best)
            score[i] = make_pair(rest, best);
        else
            score[i] = make_pair(best, rest);

        //cerr << "score = " << score[i].first << ", " << score[i].second << endl;
    }

    cout << "POSSIBLE\n";

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
  #include <string>
  #include <vector>
  #include <algorithm>
  #include <utility>
  using namespace std;
  typedef long long ll;
  #define rep(i,n) for (int i=0;i < (int)(n);i++)
  
  
  int main(){
    vector<int> v(6,0);
    rep(i,5){
      int tmp;
      cin >> tmp;
      v[tmp] = 1;
    }
    for (int i = 1; i <= 5;i++){
      if (v[i] == 0) {
        cout << i << endl;
        return 0;
      }
    }
      

    
    return 0;
  }


Measured memory_bytes: 3620
import java.util.Scanner;

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

		str = sc.nextLine();
		s = "";
		count = 0;
		for (int i = 0; i < str.length(); i++) {
			if (str.charAt(i) == ' ' || str.charAt(i) == ',' || str.charAt(i) == '.') {
				if (3 <= count && count <= 6) {
					System.out.print(s);
					for (int j = count; 0 < j; j--) {
						System.out.print(str.charAt(i - j));
					}
					s = " ";
				}
				count = 0;
			} else {
				count++;
			}
		}
		System.out.println();
	}
}

Measured memory_bytes: 12000
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;

int n;
int ans = 0;

int dfs(ll x, bool flag3, bool flag5, bool flag7)
{
    if(x > n){
        return ans;
    }
    if(flag3 && flag5 && flag7) ans++;

    dfs(10 * x + 3,true,flag5,flag7);
    dfs(10 * x + 5,flag3,true,flag7);
    dfs(10 * x + 7,flag3,flag5,true);
    
}

int main()
{
    cin >> n;
    cout << dfs(0,0,0,0);
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    h,w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    b = [list(map(int, input().split())) for _ in range(h)]
    c = [[0]*w for _ in range(h)]
    for i in range(h):
        for j in range(w):
            c[i][j] = abs(a[i][j] -b[i][j])

    mid = 3200
    dp = [[0]*w for _ in range(h)]
    dp[0][0] = (1<<(mid+c[0][0])) | (1<<(mid-c[0][0]))
    for x in range(h):
        for y in range(w):
            for dx, dy in [[0, 1], [1, 0]]:
                nx = x + dx
                ny = y + dy
                if 0<=nx<h and 0<=ny<w:
                    dp[nx][ny] = dp[nx][ny] | (dp[x][y]<<c[nx][ny])
                    dp[nx][ny] = dp[nx][ny] | (dp[x][y]>>c[nx][ny])
    
    for i in range(mid+1):
        if (dp[-1][-1]>>i) & 1:
            res = mid - i

    print(res)

if __name__ == '__main__':
    main()

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


int main(){
  int N,K;
  cin >> N >> K;
  cout << (N-1 + K-2)/(K-1) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cstdio>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>()>
#define pb push_back
#define vec vector<int>
#define vecvec vector<vector<int>>
#define vecll vector<ll>
#define vecvecll vector<vector<ll>>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
#define mp make_pair
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}
struct UnionFind{
    vec par,size;
    UnionFind(int n):par(n),size(n){
        rep(i,n){
            par[i]=i;
            size[i]=1;
        }
    }
    int root(int x){
        if(par[x]==x)return x;
        return root(par[x]);
    }
    void unite(int x, int y){
        int rx=root(x);
        int ry=root(y);
        if(rx==ry)return;
        if(size[rx]<size[ry]){
            par[rx]=ry;
            size[ry]+=size[rx];
        }else{
            par[ry]=rx;
            size[rx]+=size[ry];
        }
    }
    bool same(int x, int y){
        return root(x)==root(y);
    }
    int getSize(int x){
        return size[root(x)];
    }
};
int main(){
    int n=in(),m=in();
    UnionFind tree(n);
    rep(i,m){
        int x=in()-1,y=in()-1,z=in();
        tree.unite(x,y);
    }
    vector<bool> bl(n,false);
    rep(i,n){
        int r=tree.root(i);
        bl[r]=true;
    }
    int cnt=0;
    rep(i,n){
        if(bl[i])cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 1024
n = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))

t_cumsum = [t[0]]
for i in range(1, n):
    t_cumsum.append(t[i]+t_cumsum[i-1])

v_max = [0]    
idx = 0
for i in range(1, 2*sum(t)+1):
    time = i/2
    if time < t_cumsum[idx]:
        v_max.append(v[idx])
    elif time == t_cumsum[-1]:
        v_max.append(0)
    else:
        v_max.append(min(v[idx], v[idx+1]))
        idx += 1
# print(len(v_max), v_max)
    
vs = [0]*len(v_max)
for i in range(1, len(v_max)):
    vs[i] = min(vs[i-1]+0.5, v_max[i])
for i in range(len(v_max)-2, -1, -1):
    vs[i] = min(vs[i], vs[i+1]+0.5, v_max[i])
# print(vs)

ans = 0
for v0, v1 in zip(vs[:-1], vs[1:]):
    ans += (v0+v1)/2*0.5
print(ans)


Measured memory_bytes: 4400
import sys
N,T = map(int,input().split())
c = []
t = []
for i in range(N):
  ch = 0
  th = 0
  ch,th = map(int,input().split())
  if th > T:
    continue
  c.append(ch)
  t.append(th)
if len(t) == 0:
  print('TLE')
  sys.exit()
c.sort()
print(c[0])

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String strArray[] = br.readLine().split(" ");
	int A, B, C;
	A = Integer.parseInt(strArray[0]);
	B = Integer.parseInt(strArray[1]);
	C = Integer.parseInt(strArray[2]);
	if(B + C > A)
	    System.out.println(C - (A - B));
	else
	    System.out.println(0);

    }
}


Measured memory_bytes: 22100
n,k = map(int,input().split())
answer = 0
if k >= n:
  gap = k-n
  if gap > n:
    answer = n
  else:
    answer = gap
else:
  sho = n // k
  if n % k == 0:
    dec = sho - 1
  else:
    dec = sho
  n = n - k*dec
  if k >= n:
    gap = k-n
    if gap > n:
      answer = n
    else:
      answer = gap
print(answer)

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

int main(void){
   ll n;
   cin >> n;
   ll cnt = 0;
   ll sum = 0;
   ll ans = 0;
   
   if(n == 2){cout << 1 << endl; return 0;}
   
   for(ll i = 1; i < n; ++i){
       if(i*i >= n){sum = i-1; break;}
   }
   for(ll a = 1; a <= sum; ++a){
       for(ll b = a+1; b < n; ++b){
           if(a*b < n){cnt++;}
       }
       cnt *= 2;
       ans += cnt;
       cnt = 0;
   }
   
   cout << ans+sum << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main(){
    int N;
    cin >> N;
    vector<int> a(N+1);
    vector<int> ans(N+1);
    int cnt = 0;
    for(int i=1;i<=N;i++){
        cin >> a[i];
    }
    for(int i=N;i>=1;i--){
        int tmp = 0;
        for(int j=i;j<=N;j+=i){
            tmp+=ans[j];
            tmp%=2;
        }
        if(a[i]!=tmp){
            ans[i]=1;
            cnt++;
        }
    }
    cout << cnt << endl;
    int cnt2 = 0;
    for(int i=1;i<=N;i++){
        if(ans[i]){
            cout << i;
            cnt2++;
            if(cnt2!=cnt){
                cout << " ";
            }else{
                cout << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 2432
/*
    Written by Nitrogens
    Desire for getting accepted!!
*/
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <stack>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 1e2+5;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e = exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl

ll w[maxn], v[maxn];
ll dp[105][100005];

int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);

    int n, W;
    scanf("%d%d", &n, &W);

    for(int i = 1; i <= n; i++) scanf("%lld%lld", &w[i], &v[i]);

    memset(dp, 0, sizeof(dp));
    ll answer = 0;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= W; j++)
        {
            if(j >= w[i])
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
            else
                dp[i][j] = dp[i - 1][j];
            answer = max(answer, dp[i][j]);
        }
    }
    printf("%lld\n", answer);

    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


Measured memory_bytes: 82432
import java.lang.Math;
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        double pi = Math.PI;
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        double area =   pi * r * r;
        double circum = 2 * pi * r;
        System.out.printf("%f %f",area, circum);
        if (sc != null) {
            sc.close();
        }
    }
}


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

int main() {
    int K, S;
    cin >> K >> S;
    int res=0;
    for (int x=0; x<=S; x++) {
        for (int y=0; y<=S-x; y++) {
            int z = S-x-y;
            if (x<=K && y<=K && z<=K) res++;
        }
    }
    cout << res << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <queue>
#include <vector>
#include <utility>
using namespace std;
const int N=1e2+10;
const long long int INF=1e16+10;
const int MAX_V=800;
struct edge
{
    long long int to,cap;
	int rev;//终点、容量、反向边
};
vector<edge>G[MAX_V];//图的邻接表表示
int level[MAX_V];//顶点到源点的距离标号
int iter[MAX_V];//当前弧，在其之前的边都已经没有用了
void add_edge(int from,int to,long long int cap)//向图中增加一条从from到to的容量为cap的边
{
    G[from].push_back((edge){to,cap,(int)G[to].size()});
     G[to].push_back((edge){from,0,(int)G[from].size()-1});
}
void bfs(int s)//通过BFS计算从源点出发的距离标号
{
    memset(level,-1,sizeof(level));
    queue<int>que;
    level[s]=0;
    que.push(s);
    while(!que.empty())
    {
        int v=que.front();
        que.pop();
        for(int i=0; i<G[v].size(); ++i)
        {
            edge &e=G[v][i];
            if(e.cap>0&&level[e.to]<0)
            {
                level[e.to]=level[v]+1;
                que.push(e.to);
            }
        }
    }
}
long long int dfs(int v,int t,long long int f)//DFS寻找增广路
{
    if(v==t) return f;
    for(int &i=iter[v]; i<G[v].size(); ++i)
    {
        edge &e=G[v][i];
        if(e.cap>0&&level[v]<level[e.to])
        {
            long long int d=dfs(e.to,t,min(f,e.cap));
            if(d>0)
            {
                e.cap-=d;
                G[e.to][e.rev].cap+=d;
                return d;
            }
        }
    }
    return 0;
}
long long int Dinic(int s,int t)//求解s到t的最大流
{
    long long int maxflow=0;
    while(1)
    {
        bfs(s);
        if(level[t]<0) return maxflow;
        memset(iter,0,sizeof(iter));
        int f;
        while((f=dfs(s,t,INF))>0)
            maxflow+=f;
    }
}
int main(){
	int n,s=N-1,t=N-2;
	long long int temp,tot=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&temp);
		if(temp>0)add_edge(i,t,temp);
		else add_edge(s,i,-temp);
		for(int j=i<<1;j<=n;j+=i)add_edge(i,j,INF);
		if(temp>0)tot+=temp;
	}
	printf("%lld\n",tot-Dinic(s,t));
}



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

int main(){
	int month[]={31,29,31,30,31,30,31,31,30,31,30,31};
	int sum[13];
	char *week[]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
	int m,d;
	sum[0]=0;
	for(int i=1;i<=12;i++)sum[i] = sum[i-1]+month[i-1];
	while(cin>>m>>d,m||d)cout<<week[(sum[m-1]+d-1)%7]<<endl;
	return 0;
}

Measured memory_bytes: 1156
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

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

N, K = MAP()

limit = sum(range(1, N-1))

if K > limit:  # むり
	print(-1)
else:  # いける
	edge = list(combinations(range(1, N+1),2))
	if K == 0:
		print(N*(N-1)//2)
		for u, v in edge:
			print(u, v)
	else:	
		rem = []
		count = 0
		for i in edge:
			if i[1] != N:
				rem.append(i)
				count += 1
				if count == K:
					break
		for i in rem:
			edge.remove(i)

		print(N*(N-1)//2 - K)
		for u, v in edge:
			print(u, v)


Measured memory_bytes: 6028
#include <bits/stdc++.h>
using namespace std;
int n, mod, ans, f[6000];

int main() {
	cin >> n >> mod;
	f[n] = 1;
	for (int i = 2; i <= n; ++i) {
		int w = min(i - 1, n + 2 - i);
		for (int j = n; j >= w; --j)
			(f[j - w] += f[j]) %= mod;
	}
	for (int i = 1; i <= n; ++i)
		(ans += 1ll * f[i] * i % mod) %= mod;
	printf("%d", ans);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int A, B;
    cin >> A >> B;
    cout << 6 - (A + B);
    return 0;
}

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

#define pb push_back
#define mp make_pair

typedef long long ll;

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

ll gcd(ll a, ll b)
{
  if(a < b) return gcd(b, a);

  if(b == 0) return a;
  
  return gcd(b, a%b);
}

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

  ll ans = 1;
  for(int i = 0; i < n; i++){
    ll t;
    cin >> t;

    ans = ans / gcd(ans, t) * t;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
//左子友兄弟表現の実装
vint pt(100005,-1); vint lft(100005,-1); vint rit(100005,-1);
//存在しないことを示す特別な値＝－１
int getdep(int u){ //節点の深さを求める。O(nh)
    int d=0;
    while(pt[u]!=-1){ //親が居なくなるまで。
        u=pt[u];
        d++;
    }
    return (d);
}
vint d(100005);
void setdep(int u,int p){ //節点深さを求める（再帰）O(n)
    d[u]=p;
    if(rit[u]!=-1){
        setdep(rit[u],p);
    }
    if(lft[u]!=-1){
        setdep(lft[u],p+1);
    }
}
void printchildren(int u){ //子のリストの表示
    int c=lft[u]; //左の子から開始
    while(c!=-1){ //右の子がいる間
        cout<<c<<',';
        c=rit[c];
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,id,k;
    cin>>n;
    int c,l;
    rep(i,n){
        cin>>id>>k;
        rep(j,k){
            cin>>c;
            if(j==0){
                lft[id]=c;
            }
            else{
                rit[l]=c;
            }
            l=c;
            pt[c]=id;
        }
    }
    int r;
    rep(i,n){
        if(pt[i]==-1){
            r=i;
        }
    }
    setdep(r,0);
    rep(i,n){
        cout<<"node "<<i<<':';
        cout<<" parent = "<<pt[i]<<',';
        cout<<" depth = "<<d[i]<<',';
        if(pt[i]==-1){
            cout<<" root,";
        }
        else if(lft[i]==-1){
            cout<<" leaf,";
        }
        else{
            cout<<" internal node,";
        }
        cout<<" [";
        for(int j=0,c=lft[i];c!=-1;j++,c=rit[c]){
            if(j){
                cout<<", ";
            }
            cout<<c;
        }
        cout<<"]"<<'\n';
    }
    return(0);
}


Measured memory_bytes: 7468
# encoding:utf-8
def main():
	n, h = list(map(int, input().split()))
	katanas = [list(map(int, input().split())) for _ in range(n)]

	max_a = max([x[0] for x in katanas])
	nageru = [x[1] for x in katanas if x[1] >= max_a]
	nageru.sort(reverse = True)

	cnt, h = nageru_attacks(h, nageru)
	if h > 0:
		print(int((h-0.5) // max_a + cnt + 1))
	else:
		print(cnt)

def nageru_attacks(h, nageru):
	for i in range(len(nageru)):
		h -= nageru[i]
		if h <= 0:
			return [i + 1, 0]

	return[i + 1, h]


if __name__ == '__main__':
	main()

Measured memory_bytes: 28388
x = gets.split.map(&:to_f)
A, B = x[0..1].sort
C, D = x[2..3].sort
E, F = x[4..5]

W = {}
0.step(F, 100 * A) do |a|
  0.step(F, 100 * B) do |b|
  	w = a + b 
  	break if w > F 
  	W[w] = 1
  end
end

S = {}
0.step(F, C) do |c| 
	0.step(F, D) do |d|
		s = c + d 
		break if s > F 
		S[s] = 1
	end
end
SUG = S.keys.sort

water = A * 100
sugar = 0
conc = 0
W.keys.sort.drop(1).each do |w|
	SUG.each do |s|
		weight = w + s 
	    c = 100 * s / w 
		break if weight > F || c > E
		if c > conc
			water = w 
			sugar = s 
			conc = c 
		end
	end
end

puts [water + sugar, sugar].map(&:to_i).join(' ')

Measured memory_bytes: 2044
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
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;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    string in; cin >> in;
    sort(_all(in));

    if(in == "abc"){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 384
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
c = list(str(input()))

cs = [0 for i in range(N)]
for i,color in enumerate(c):
    if color == "R":
        cs[i] = 1

ans = min(sum(cs), N - sum(cs))
tmp = sum(cs)


count = 0
for i in range(tmp):
    if cs[i]:
        count += 1

ans = min(ans, tmp - count)
print(ans)




"""
out 
WR



ok
RRRRRWWWWW 入れ替える
RRRRRR 全てRにする
WWWWWW 全てWにする


1100

1110111000

tmp = 6


"""

Measured memory_bytes: 13916
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=6e5+10;
typedef long long ll;
int n,d,a;
ll now,sum,ans,tr[N],x[N],to[N],cnt;
struct node
{
	int pos,v,r;
}e[N];
bool operator<(node a,node b)
{
	return a.pos<b.pos;
}
int main()
{
	scanf("%d%d%d",&n,&d,&a);
	for(int i=1;i<=n;++i)
	{
		scanf("%d%d",&e[i].pos,&e[i].v);
		x[++cnt]=e[i].pos;
		x[++cnt]=e[i].r=e[i].pos+2*d+1;
	}
	sort(x+1,x+cnt+1);
	cnt=unique(x+1,x+cnt+1)-(x+1);
	for(int i=1;i<=n;++i)
	{
		e[i].pos=lower_bound(x+1,x+cnt+1,e[i].pos)-x;
		e[i].r=lower_bound(x+1,x+cnt+1,e[i].r)-x;
		to[e[i].pos]=e[i].r;
		tr[e[i].pos]+=e[i].v;
		tr[e[i].pos+1]-=e[i].v;
	}
	for(int i=1;i<=cnt;++i)
	{
		now+=tr[i]; 
		if(now<=0)continue;
		sum=(now+a-1)/a;
		ans+=sum;
		now-=sum*a;
		tr[to[i]]+=sum*a;
	}
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 18688
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    else:
        counter = 0
        for a in range(1,(x // 3)):
            for c in range ((x//3)+1,n+1):
                b = x - a - c
                if a < b < c:
                    counter += 1
        print(counter)

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

using namespace std;


int main() {
    int h,w; cin >> h >> w;
    vector<vector<char>> maze(h,vector<char>(w));
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> maze[i][j];
        }
    }

    vector<int> dy(4); dy = {1,0,-1,0};
    vector<int> dx(4); dx = {0,1,0,-1};
    int ans = 0;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(maze[i][j] == '#') continue;

            vector<vector<int>> visited(h,vector<int>(w,-1));
            visited[i][j] = 0;
            queue<pair<int,int>> q;
            q.push(make_pair(i,j));

            while(!q.empty()){
                int y = q.front().first;
                int x = q.front().second;
                q.pop();
                for(int k=0; k<4; k++){
                    int ny = y + dy[k];
                    int nx = x + dx[k];
                    if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
                    if(maze[ny][nx] == '#' || visited[ny][nx] >=0) continue;

                    visited[ny][nx] = visited[y][x] + 1;
                    q.push(make_pair(ny,nx));
                    ans = max(ans,visited[ny][nx]);
                }
            }

        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

#define int long long

const int N = 2e5 + 7;
const int MOD = 1e9 + 7;

int add(int a, int b) {
	return (a + b) % MOD;
}

int mul(int a, int b) {
	return (a * b) % MOD;
}

int sub(int a, int b) {
	return (a - b + MOD) % MOD;
}

int binpow(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1) res = mul(res, a);
		a = mul(a, a);
		b >>= 1;
	}
	return res;
}

int divv(int a, int b) {
	return mul(a, binpow(b, MOD - 2));
}

int f[N];

void init() {
	f[0] = 1;
	for (int i = 1; i < N; i++) {
		f[i] = mul(i, f[i - 1]);
	}
}

int C(int n, int k) {
	return divv(f[n], mul(f[k], f[n - k]));
}

int sp(int n, int k) {
	//divide k over n
	return C(n + k - 1, k);
}

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

	// cout << sp(2, 1) << endl;

	int n, k;
	cin >> n >> k;
	k = min(k, n - 1);
	int ans = 0;
	for (int m = 0; m <= k; m++) {
		int p = C(n, m);
		int to = sp(n - m, m);
		ans = add(ans, mul(p, to));
	}
	cout << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define sz 200002
#define pb push_back
#define ff first
#define ln '\n'
#define ss second
#define ll long long
#define VEC vector<ll int>v
#define TEST() int test;cin>>test; while(test--)
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

//ll int LCM(ll int a,ll int b) { ll int gcd=__gcd(a,b);ll int lcm=a*b/gcd;return lcm;}
//ll int bigmod(ll int b, ll int p, ll int m){if(p==0)return 1;if(p%2!=0) return b%m*fun(b,p-1,m)%m;if(p%2==0){ ll int res=fun(b,p/2,m);return (res%m*res%m)%m;}}
//void seive() { prime[np++]=2;for(i=3; i<=sz; i+=2){if(mark[i]==0){ prime[np++]=i;for(j=i*i; j<=sz; j+=i) mark[j]=1; } }}



int main()
{
ll int n,m,ara[4][4];

for(int i=1;i<=3;i++)
{
  for(int j=1;j<=3;j++)
  {
    cin>>ara[i][j];

  }
}
cin>>n;
while(n--)
{
  cin>>m;
  for(int i=1;i<=3;i++)
  {
    for(int j=1;j<=3;j++)
    {
      if(ara[i][j]==m)ara[i][j]=-1;
    }
  }
}
int ok=0;
for(int i=1;i<=3;i++)
{
  int s=0;
  for(int j=1;j<=3;j++)
  {
    if(ara[i][j]==-1)s++;
  }
  if(s==3)ok=1;
  s=0;
  for(int j=1;j<=3;j++)
  {
    if(ara[j][i]==-1)s++;
  }
  if(s==3)ok=1;

}
if(ara[1][1]==-1&&ara[2][2]==-1&&ara[3][3]==-1||ara[1][3]==-1&&ara[2][2]==-1&&ara[3][1]==-1)ok=1;
if(ok)cout<<"Yes"<<endl;
else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 5;
const ll mo = 998244353;
const int M = 100+50;
struct yen{
	ll a,b;
};
bool cmp(yen a,yen b){
	return a.a<b.a;
}
unsigned long long ans=0;
int main(){
	int n,m;
	cin>>n>>m;
	yen p[n+5];
	for(int i=0;i<n;i++)
		cin>>p[i].a>>p[i].b;
	sort(p,p+n,cmp);
	for(int i=0;i<n;i++){
		if(p[i].b<=m){
			ans+=p[i].a*p[i].b;
			m-=p[i].b;
		}
		else{
			ans+=p[i].a*m;
			break;
		}
	}
	cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <deque>
#include <iostream>
#include <vector>

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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

int H, A;

int main() {
    int ans = 0;
    cin >> H >> A;
    while (H > 0) {
        H -= A;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import itertools
import sys
input = sys.stdin.readline

n, m, r = [ int(v) for v in input().split() ]
town_list = [ int(v)-1 for v in input().split() ]

road_matrix = [ [ 10**9 for j in range(n) ] for i in range(n) ]


for i in range(m):
	s, e, d = [ int(v) - 1 for v in input().split() ]
	road_matrix[s][e] = d + 1
	road_matrix[e][s] = d + 1


for k in range(n):
	 for i in range(n):
		 for j in range(n):
			 road_matrix[i][j]  = min(road_matrix[i][k] + road_matrix[k][j], road_matrix[i][j])


mindist = 10**9
for i in itertools.permutations(town_list,r):
	dist = 0
	for j in range(r-1):
		dist += road_matrix[i[j]][i[j+1]]

	mindist = min(mindist,dist)
print(mindist)

Measured memory_bytes: 43100
#include <bits/stdc++.h>
#define MOD 1000000007
#define MX INT_MAX
using namespace std;
#define int long long

int32_t main()
{
    int n, x, s = 0, l, i;
    cin >> n >> x;

    for (i = 1; i <= n; ++i)
    {
        cin >> l;
        s += l;
        if (s > x)
            break;
    }
    if (s <= x)
        cout << n + 1 << endl;
    else
    {
        cout << i << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#include<string>
#include<set>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;
#define Mohamed_Gad fast()
#define ll long long
#define ull unsigned long long
#define all(v) v.begin(),v.end()
#define endl "\n"
#define sz(x) size(x)
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
void Open()
{
#ifndef ONLINE_JUDGE
    freopen("Input.txt", "r", stdin);
    //freopen("Output.txt", "w", stdout);
#endif

}
//long long frq[100009],prf[100009];

int main() {
    fast();
    multiset<string>s;string a;
    int n,l;
    cin>>n>>l;
    for(int i=0;i<n;i++){
        cin>>a;
        s.insert(a);
    }
    for(auto i:s)
        cout<<i;
    cout<<endl;


}


Measured memory_bytes: 256
import sys
from collections import deque

n = int(sys.stdin.readline().strip())
edges = [[] for _ in range(n)]
for _ in range(n):
    tmp = list(map(int, sys.stdin.readline().strip().split(" ")))
    for node in tmp[2:]:
        edges[tmp[0] - 1].append(node-1)
# print(edges)

distance = [0] * n
q = deque()
q.append((0, 0))
visited = set()
while q:
    node, d = q.popleft()
    # print(node, d)
    if node in visited:
        continue
    distance[node] = d
    visited.add(node)
    for next in edges[node]:
        # print("next", next)
        q.append((next, d + 1))

for i, d in enumerate(distance):
    if i == 0:
        print(1, 0)
    else:
        print(i + 1, d if d > 0 else -1)


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

typedef long long ll;

int n;
int c[100];
ll res;

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &c[i]);
        for (int j = 0; j < i; j++)
            res += ll(c[i]) * c[j];
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; cin >> n;
    VI a(n); VIin(a);
    int ans = a[n-1];
    rep(i,n-1){
        if(a[i] == 1) ans = 1;
        else ans = gcd(ans,a[i]);
    }
    ANS;

    return 0;
}

Measured memory_bytes: 1024
import java.util.*;

class Main{
        public static void main(String[] args){
                        Scanner sc = new Scanner(System.in);
                        int n = sc.nextInt();
                        for(int i = 0 ; i < n ; i++){
                                        int t = sc.nextInt();
                                        int up = 0;
                                        int down = 0;
                                        int height = sc.nextInt();
                                        for(int j = 0 ; j < t-1 ; j++){
                                                int nextheight = sc.nextInt();
                                                int difference = nextheight-height;
                                                up = (difference > up) ? difference:up;
                                                down = (difference < down) ? difference:down;
                                                height = nextheight;
                                        }   
                                        System.out.println(up + " " + (-down));
                        }   
                        sc.close();
        }   

}

Measured memory_bytes: 12000
#include <iostream>
#include <stdio.h>
#include <sstream>
using namespace std;
void draw(int map[10][10]);
void drop(int x,int y,int z);
void drop_rotate(int,int,int,int);
bool isValidPoint(int,int);
void count(int map[10][10]);
int map[10][10];
int white, conc;
int dx,dy;

int main(){

  //  const int k=9;
  int x,y,s;
  string tmp;

  //zñÌú»
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      map[i][j]=0;
    }
  }

  while(cin >> tmp){ //J}æØèðooÉ
  //  cout << map[2][3];
    tmp.replace(tmp.find(","),1," ");
    tmp.replace(tmp.find(","),1," ");
    istringstream ss(tmp);
    ss >> x >> y >> s;
    drop(x,y,s);
    //draw(map);
  }
  count(map);
}

//2³mapÌ`Ê
void draw(int map[10][10]){
    for(int i=0;i<10;i++){
      for(int j=0;j<10;j++){
      printf("%4d",map[i][j]);
      }
      cout << endl;
    }
    cout << endl;
}

//¦ðÔ·Ö
void count(int map[10][10]){
  white = 0; conc = 0;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      if(map[i][j]==0){
	white++;
      }
      if(map[i][j] > conc){
	conc = map[i][j];
      }
    }
  }
  cout << white << endl << conc << endl;
}
 
//CNº
void drop(int x,int y,int s){
  //  int dx; int dy;
  /* while(s>0){
    //dx,dyð¢ë¢ë®©·B
    
    if(isValidPoint((x+dx),(y+dy))){
      map[x+dx][y+dy]++;
    }
    s--;
    }*/
  if(isValidPoint(x,y)){
    map[x][y]++;
  }
  if(s==3){
    drop_rotate(x,y,2,0);
    drop_rotate(x,y,1,1);
    drop_rotate(x,y,1,0);
  }else if(s==2){
    drop_rotate(x,y,1,1); 
    drop_rotate(x,y,1,0);
  }else{
    drop_rotate(x,y,1,0);
  }
}

void drop_rotate(int x, int y,int dx, int dy){
  int temp;
  for(int i = 0; i < 4; i++){
    temp = dx;
    dx = dy;
    dy = -temp;
    if(isValidPoint((x+dx),(y+dy))){
      map[x+dx][y+dy]++;
    }
  }
}

bool isValidPoint(int x,int y){
  if(x < 0 || x > 9 || y < 0 || y > 9){
    return false;
  }else{
    return true;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vecll;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
template<typename T> T mod_pow(T x, T n, const T &p) { T ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= p; (x *= x) %= p; n >>= 1; } return ret; }
template<typename T> T mod_inv(T x, const T &p) { return mod_pow(x, p-2, p); }
const ll DVSR = 1e9+7;


int main(int argc, char const *argv[])
{
  ll N, A;
  cin >> N >> A;
  N %= 500;
  cout << (N <= A ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAX 1005
int n;
bool t[MAX];
int u[MAX];

void init(){
  for(int i=0;i<MAX;i++){
    t[i]=false;
    u[i]=0;
  }
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    init();
    int now=0,prev;
    for(int i=0;i<n;i++){
      prev=now;
      string str;
      char ch;
      int a,b,id;
      cin>>str>>a>>ch>>b>>ch>>id;
      now=a*60+b;
      
      //cout<<a<<' '<<b<<' '<<ch<<' '<<id<<endl;
      if(t[0])
	for(int j=0;j<MAX;j++)
	  if(t[j])u[j]+=(now-prev);
      
      t[id]^=true;
    }
    int ans=0;
    for(int i=1;i<n;i++){
      ans=max(ans,u[i]);
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1204
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;

int main(){
    int n,k,q,a;
    cin>>n>>k>>q;
    vector<int> point(n);
    rep(i,q){
        cin>>a;
        point[a-1]++;
    }
    rep(i,n){
        if(k-q+point[i]>0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>

int main()
{
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(0 > x - r || x + r > W || y + r > H || 0 > y - r){
            printf("No\n");
    }else{
        printf("Yes\n");
    }
    return 0;
}

Measured memory_bytes: 584
import Data.Array

main = do
  li <- getLine
  let [n,m,q] = map read $ words li
  co <- getContents
  let abcds = map (t4 . map read . words) $ lines co
  let ans = compute n m q abcds
  print ans

t4 [a,b,c,d] = (a,b,c,d)

{-
N,Mが大したことないから列挙する？
-}

compute :: Int -> Int -> Int -> [(Int,Int,Int,Int)] -> Int
compute n m q abcds = maximum (map (value n abcds) $ gen m n 1)

gen m 0 _ = [ [] ]
gen m n a = [ i:is | i <- [a..m], is <- gen m (pred n) i ]

value n abcds as = sum [ d | (a,b,c,d) <- abcds, arr ! b - arr ! a == c ]
  where
    arr = listArray (1,n) as

Measured memory_bytes: 6800
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

string s;
int main() {
    cin >> s;
    int slen = s.length();
    string suba = s.substr(0, slen/2);
    string subb = s.substr(slen/2+1, slen/2);
    int subalen = suba.length();
    int subblen = subb.length();

    bool flg = true;
    for(int i = 0; i < slen; ++i) {
        if(s.at(i) != s.at(slen-1-i)) flg = false;
    }
    for(int i = 0; i < subalen; ++i) {
        if(suba.at(i) != suba.at(subalen-1-i)) flg = false;
    }
    for(int i = 0; i < subblen; ++i) {
        if(subb.at(i) != subb.at(subblen-1-i)) flg = false;
    }

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

Measured memory_bytes: 256
N = int(input())

X = list(map(int, input().split()))

L = min(X)
R = max(X)

ans = 1000000

for i in range(L, R+1):
    tmp = 0
    for j in X:
        tmp += (j - i)**2
    ans = min(ans, tmp)

print(ans)
    

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

int main(){
    string s;
    cin >> s;
    string ans = "";
    for(int i=0; i<s.size(); i++){
        string tmp = "";
        for(int j=i; j<s.size(); j++){
            string t = (string() + s[j]);
            if(t == "A" || t == "C" || t == "G" || t == "T") tmp += t;
            else break;
        }
        if(ans.size() < tmp.size()) ans = tmp;
    }
    cout << ans.size() << endl;
    return 0;
}

Measured memory_bytes: 256
L,R = map(int,input().split(' '))

if R-L >= 2019:
	print(0)
	exit()

L = L % 2019
R = R % 2019
if R <= L:
	R += 2019

ans = 2018
for i in range(L,R):
	for j in range(i+1,R+1):# i==j?
		ans = min(ans,(i*j) % 2019)

print(ans)




Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long int lli;
typedef pair<int, int> pii;
typedef pair<lli, lli> pll;
const lli inf = 1e18;

void dfs(int v, vector<vector<pii> > &adj, vector<int> &ans){
	for(pii next: adj[v]){
		int nv = next.first;
		int dist = next.second;
		if(ans[nv] != -1) continue;
		if(dist == 0){
			ans[nv] = ans[v];
		}else{
			ans[nv] = 1-ans[v];
		}
		dfs(nv, adj, ans);
	}
}

int main(){
	int n;
	cin >> n;
	vector<vector<pii> > adj(n);
	for(int i=0; i<n-1; i++){
		int u,v,w;
		cin >> u >> v >> w;
		u--; v--;
		w %= 2;
		adj[u].emplace_back(v, w);
		adj[v].emplace_back(u, w);
	}
	vector<int> ans(n,-1);
	ans[0] = 0;
	dfs(0, adj, ans);
	for(int i: ans){
		cout << i << endl;
	}
    return 0;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string n;
  cin >> n;
  cout << "ABC" << n << endl;

  return 0;
}


Measured memory_bytes: 256
// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

const int N = 2e5+50;

int n, k, c;

char s[N], s2[N];
vector<int> go(char s[], int n, int k, int c) {
    vector<int> a;
    for (int i=0; i<n; ++i) {
        if (s[i] == 'x')
            continue;
        a.push_back(i);
        // dbg(i, i+c);
        i += c;
    }
    a.resize(k);
    if (sz(a) >= k)
        return a;
    else
        return vector<int>();
}

int p[N], q[N];

int main(int argc, char const *argv[]) {
    // code
    scanf("%d%d%d", &n, &k, &c);
    scanf("%s", s+1);
    for (int i=1; i<=n; ++i) {
        p[i] = p[i-1];
        if (s[i] == 'x')
            continue;
        p[i]++;
        for (int j=i+1; j<=i+c && j<=n; ++j)
            p[j] = p[i];
        i = i+c;
    }
    for (int i=n; i>=1; --i) {
        q[i] = q[i+1];
        if (s[i] == 'x')
            continue;
        q[i]++;
        for (int j=i-1; j>=i-c && j>=1; --j)
            q[j] = q[i];
        i = i-c;
    }

    for (int i=1; i<=n; ++i) {
        if (s[i] == 'o' && p[i-1] + q[i+1] == k-1)
            printf("%d\n", i);
    }
    return 0;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

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

  int A, B;
  std::cin >> A >> B;

  int res = -1;

  if(A <= 9 && B <= 9){
      res = A * B;
  }

  std::cout << res << std::endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  static void output(int[] a){
    int i;
    for(i = 0; i < a.length - 1; i++)
      System.out.print(a[i] + " ");
    System.out.println(a[i]);
  }

  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int a[] = new int[n];
    for(int i = 0; i < n; i++)
      a[i] = stdIn.nextInt();

    for(int i = 0; i < n; i++){
      int w = a[i];
      int j = i;
      while(j > 0 && a[j - 1] > w){
        a[j] = a[j - 1];
        j--;
      }
      a[j] = w;
      output(a);
    }

  }
}

Measured memory_bytes: 32536