akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)                                                             \
  sort(x.begin(), x.end());                                                    \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y)                                                           \
  cerr << "(" << #x << ", " << #y << ") = "                                    \
       << "(" << x << ", " << y << ")" << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

// ----------------------------------------------

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

  int n = 5;
  vector<int> v(n);
  rep(i, n) { cin >> v[i]; }

  rep(i, n) {
    if (v[i] == 0) { cout << i + 1 << endl; }
  }
  return 0;
}

Measured memory_bytes: 3600
from collections import deque
h, w = map(int, input().split())
s = [input() for i in range(h)]

INF = float('inf')
dir = [[0, 1], [0, -1], [1, 0], [-1, 0]]
white = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == ".":
            white += 1

def bfs(si, sj):
    dist = [[INF for i in range(w)] for j in range(h)]
    q = deque([((si, sj), 1)])
    dist[si][sj] = 1

    while q:
        (ni, nj), d = q.popleft()
        for x, y in dir:
            xi = ni + x
            yj = nj + y
            di = d + 1
            if xi < 0 or yj < 0 or xi > h-1 or yj > w-1:
                continue
            if dist[xi][yj] > di and s[xi][yj] == ".":
                dist[xi][yj] = di
                q.append(((xi, yj), di))
    if dist[h-1][w-1] == INF:
        return -1
    else:
        return white - dist[h-1][w-1]

print(bfs(0, 0))

Measured memory_bytes: 3444
package main

import (
	"fmt"
	"sort"
	"strconv"
	"strings"
)

var permutations [][]int = make([][]int, 0, 10)

func main() {
	var maxDepth int
	var p, q []int
	fmt.Scan(&maxDepth)
	p = make([]int, maxDepth)
	q = make([]int, maxDepth)
	for i := 0; i < maxDepth; i++ {
		var x int
		fmt.Scan(&x)
		p[i] = x - 1
	}
	for i := 0; i < maxDepth; i++ {
		var x int
		fmt.Scan(&x)
		q[i] = x - 1
	}

	for i := 0; i < maxDepth; i++ {
		call(i, 0, initialize(maxDepth))
	}
	//なんかアレだけど一応順列は出た
	sorted := make([][]int, len(permutations))
	copy(sorted, permutations)
	/*sort.Slice was introdued Go v1.8 according to godoc*/
	// sort.Slice(sorted, func(i, j int) bool {
	// 	for x := 0; x < len(permutations[i]); x++ {
	// 		if sorted[i][x] != sorted[j][x] {
	// 			return sorted[i][x] < sorted[j][x]
	// 		}
	// 	}
	// 	return false
	// })
	perms := Perms(sorted)
	sort.Sort(perms)

	index := make(map[string]int)
	for i, v := range perms {
		index[toS(v)] = i
	}
	answer := absInt(index[toS(p)] - index[toS(q)])
	fmt.Println(answer)
}

type Perms [][]int

func (p Perms) Len() int {
	return len(p)
}
func (p Perms) Less(i, j int) bool {
	for x := 0; x < len((p)[i]); x++ {
		if (p)[i][x] != (p)[j][x] {
			return (p)[i][x] < (p)[j][x]
		}
	}
	return false
}

func (p Perms) Swap(i, j int) {
	(p)[i], (p)[j] = (p)[j], (p)[i]
}

func absInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func initialize(length int) (result []int) {
	result = make([]int, length)
	for i := 0; i < length; i++ {
		result[i] = -1
	}
	return
}

//DFSみたいなので順列を求めようとしています
func call(v int, depth int, path []int) {
	copiedPath := make([]int, len(path))
	maxDepth := len(path)
	copy(copiedPath, path)
	copiedPath[v] = depth
	// fmt.Println(copiedPath)
	if depth == maxDepth-1 {
		permutations = append(permutations, copiedPath)
	}
	for i, w := range copiedPath {
		if w != -1 {
			continue
		} else {
			call(i, depth+1, copiedPath)
		}
	}
}

func toS(perm []int) string {
	chars := make([]string, len(perm))
	for i, v := range perm {
		chars[i] = strconv.Itoa(v)
	}
	// fmt.Println(chars)
	return strings.Join(chars, "")
}


Measured memory_bytes: 13056
import itertools

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
l = [i for i in range(1,n+1)]
ans_l = []
for i in itertools.permutations(l,n):
    ans_l.append(list(i))

ans = (ans_l.index(a)+1) - (ans_l.index(b)+1)
print(abs(ans))


Measured memory_bytes: 10228
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(vs) vs.begin(), vs.end()
#define make_pair mp
using ll = long long;
using ii = pair<int, int>;
#define MAXN 100010

vector<string> aux;
vector<string> nbs;
vector<string> numbers = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};

int diff(string s1, string s2){
	return s1[0]-s2[0];
}
void solve(){
	for(auto s:numbers) aux.push_back(s);
	while(len(nbs)<MAXN){
		vector<string> res;
		int n = len(aux);
		for(auto s:numbers){
			int l = -1, r = n-1;
			while(r-l>1){
				int k = l + (r-l)/2;
				int d = diff(s, aux[k]);
				if(d>1) l=k;
				else r = k;
			}
			int j = r;
			while(j<n and abs(diff(s, aux[j]))<=1){
				res.push_back(s+aux[j]), ++j;
			}
		}
		for(auto s:aux){ 
			if(s[0] == '0') continue;
			nbs.push_back(s);
		}
		aux.clear();
		for(auto s:res) aux.push_back(s);
	}
	int m;
	cin >> m;
	cout << nbs[m-1] << endl;
}

int32_t main(){
	ios::sync_with_stdio(0);
	solve();
}

Measured memory_bytes: 52676
/*
Author : Xinyuan
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef long long int  ll;
const int INF = 1e9 + 7;
const int mod = 1e9 + 7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int nxt() {int x;scanf("%d", &x);return x;}


int main(){
    int i,j, k;
    cin >> i >> j;
    multiset<int> myset;
    for (int x = 0; x < i; x++) {
         cin >> k;
         myset.insert(k);
    }
    auto it1 = myset.begin();
    int total = 0;
    for (int y = 0; y < j; y++) {
        total += *it1;
        it1++;
    }
    cout << total;
}


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

typedef long long LL;
typedef long double LD;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s;
    cin >> s;
    if(s == "ABC")cout << "ARC" << endl;
    else cout << "ABC" << endl;
}

Measured memory_bytes: 3568
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <queue>
#include <bitset>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = (a); i < (n); i++)
#define MP make_pair
#define all(s) (s).begin(), (s).end()
#define rev(s) (s).rbegin(), (s).rend()
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> P;

void test(){freopen("test.txt", "r", stdin);}

struct edge{
	int to;
	int dist;
	int cost;
	edge(int t, int d, int c){to = t, dist = d, cost = c;}
};

struct state{
	int pos;
	int dist;
	int cost;
	state(int p, int d, int c){pos = p, dist = d, cost = c;}
	bool operator<(const state &r)const{
		if( dist == r.dist) return cost > r.cost;
		return dist > r.dist;
	}
};

int main(){
	//test();
	int n, m;
	while( cin >> n >> m, n|m){
		vector<vector<edge> > G(n);
		rep(i, m){
			int u, v, d, c;
			cin >> u >> v >> d >> c;
			u--, v--;
			G[u].push_back(edge(v, d, c));
			G[v].push_back(edge(u, d, c));
		}

		priority_queue<state> q;
		q.push(state(0, 0, 0));

		vector<int> bestdist(n, 2<<29);
		int totalcost = 0;
		int visit = 0;

		while(!q.empty()){
			state s = q.top();
			q.pop();

			if(bestdist[s.pos] <= s.dist) continue;
			bestdist[s.pos] = s.dist;
			//cout << "pos=" << s.pos << ", cost=" << s.cost << ", dist=" << s.dist << endl;
			totalcost += s.cost;
			visit++;
			if(visit == n) break;

			int i = s.pos;
			rep(j, G[i].size()){
				state next = s;
				next.pos = G[i][j].to;
				next.dist += G[i][j].dist;
				next.cost = G[i][j].cost;
				q.push(next);
			}
		}
		cout << totalcost << endl;
	}

	return 0;
}

Measured memory_bytes: 2704
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos
import decimal

MOD = 10 ** 9 + 7
INF = 10 ** 18

A, B = input().split()

A, B = decimal.Decimal(A), decimal.Decimal(B)

print(int(A * B))

Measured memory_bytes: 10056
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, k, sum=0;
  cin >> n >> k;
  
  for(int i=0; i<n; i++){
	int x;
    cin >> x;
    if(x > k-x) sum += (k-x)*2;
    else sum += x*2;
  }

  cout << sum << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
  Q[tail] = x;
  tail = (tail + 1) % LEN;

}

P dequeue( ){
  P x = Q[head];
  head = (head +1) % LEN;
  return x;

}
int min(int a, int b){return a < b ? a : b;}

int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1; tail = n + 1;
  while(head != tail){
    u = dequeue();
    c = min(q,u.t);
    u.t -= c;
    elaps += c;
    if(u.t > 0) enqueue(u);
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }
  
  return 0;
}



Measured memory_bytes: 11848
#

import sys
input=sys.stdin.readline

def main():
    X,Y=map(int,input().split())
    y=0
    for i in range(X+1):
        if (Y-2*i)%4==0 and (Y-2*i)//4==X-i:
            y=1
            break
    if y==1:
        print("Yes")
    else:
        print("No")
    
    
    
if __name__=="__main__":
    main()


Measured memory_bytes: 9176
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<time.h>
#include<assert.h>
#include<iostream>
using namespace std;
typedef long long LL;
typedef pair<int,int>pi;
const int mod=924844033,g=5,Maxn=200020;
int powmod(int x,int y,int mod){
	int ret=1;
	while(y){
		if(y&1)ret=1LL*ret*x%mod;
		y>>=1;
		x=1LL*x*x%mod;
	}
	return ret;
}
vector<int>G[Maxn];
int n;
int fac[Maxn],rev[Maxn];
int sz[Maxn];
int ans[Maxn];
int gp[100],rgp[100];
int a[1<<20],b[1<<20];
int C(int x,int y){
	if(x<y||y<0)return 0;
	return 1LL*fac[x]*rev[y]%mod*rev[x-y]%mod;
}

void precal(){
    for(int cur=1,tmp=mod-1;~tmp&1;cur++){
        tmp>>=1;
        gp[cur]=powmod(g,tmp,mod);
        rgp[cur]=powmod(gp[cur],mod-2,mod);
    }
}

int getrev(int x){
    return powmod(x,mod-2,mod);
}
void fft(int *a,int n,int ty=0){
    for(int i=0,j=1,k;j<n-1;j++){
        for(k=n>>1;i&k;k>>=1)i^=k;i^=k;
        if(i<j)swap(a[i],a[j]);
    }
    for(int k=2,cur=1;k<=n;k<<=1,cur++){
        int wn=ty?rgp[cur]:gp[cur];
        for(int i=0;i+k<=n;i+=k){
            for(int j=0,w=1;j<k>>1;j++,w=1ll*w*wn%mod){
                int u=a[i+j],v=1ll*a[i+j+(k>>1)]*w%mod;
                a[i+j]=(u+v)%mod;
                a[i+j+(k>>1)]=(u-v+mod)%mod;
            }
        }
    }
    if(ty){
        int rn=getrev(n);
        for(int i=0;i<n;i++)a[i]=1ll*a[i]*rn%mod;
    }
}
void mul(int *a,int *b,int n){
    fft(a,n);
    fft(b,n);
    for(int i=0;i<n;i++)a[i]=1ll*a[i]*b[i]%mod;
    fft(a,n,1);
}
void dfs(int u,int p){
	sz[u]=1;
	for(int i=0;i<G[u].size();i++){
		int v=G[u][i];if(v==p)continue;
		dfs(v,u);
		sz[u]+=sz[v];
	}
}
int main(){
	precal();
	fac[0]=fac[1]=rev[0]=rev[1]=1;
	for(int i=2;i<Maxn;i++)fac[i]=1LL*fac[i-1]*i%mod;
	for(int i=2;i<Maxn;i++)rev[i]=1LL*(mod-mod/i)*rev[mod%i]%mod;
	for(int i=2;i<Maxn;i++)rev[i]=1LL*rev[i-1]*rev[i]%mod;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int u,v;scanf("%d%d",&u,&v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	dfs(1,0);
	int N=1;
	while(N<=n)N<<=1;
	N<<=1;
	for(int i=1;i<=n;i++)a[sz[i]]++,a[n-sz[i]]++;
	for(int i=1;i<=n;i++)a[i]=1LL*a[i]*fac[i]%mod;
	for(int i=0;i<=n;i++){
		b[n-i]=rev[i];
	}
	mul(a,b,N);
	for(int i=n;i<=n+n;i++)ans[i-n]=(1LL*n*C(n,i-n)%mod-1LL*rev[i-n]*a[i]%mod+mod)%mod;
	for(int i=1;i<=n;i++)ans[i]=(ans[i]+C(sz[1],i))%mod;
	for(int i=1;i<=n;i++)printf("%d\n",ans[i]);
	return 0;
}


Measured memory_bytes: 33536
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 1LL<<60
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) (a)<=(i) && (i)<(b)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;

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

  int n,k;
  cin >> n >> k;

  vector<int> w(n),v(n);
  REP(i,n) cin >> w[i] >> v[i];
  
  vector<int> dp[n+1];
  REP(i,n+1) dp[i].assign(k+1,0);
  
  REP(i,n){
    REP(j,k+1){
      dp[i+1][j] = dp[i][j];
      if(j-w[i] >= 0) dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]]+v[i]);
    }
    //REP(j,k+1) cout << dp[i+1][j] << " ";
    //cout << endl;
  }

  cout << dp[n][k] << endl;

  return 0;
}

Measured memory_bytes: 79488
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<pair<ll, ll>> vpll;
typedef pair<ll, ll> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define yes(a) printf(a ? "yes\n" : "no\n")
#define Yes(a) printf(a ? "Yes\n" : "No\n")
#define YES(a) printf(a ? "YES\n" : "NO\n") 
const long double PI = acos(-1);
const long long INF = (1 << 30);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

ll h, w;
string s[51];
ll dist[51][51];

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

  char c;
  cin >> c;
  cout << (char)(c+1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k,d,a,cnt;
bool vis[105];
int main(){
	cin >> n >> k;
	for(int i = 1;i <= k;i++){
		cin >> d;
		for(int j = 1;j <= d;j++){
			cin >> a;
			vis[a] = true;
		}
	}
	for(int i = 1;i <= n;i++)
		cnt += !vis[i];
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
int main()
{
  double a,b,h,m;
  cin>>a>>b>>h>>m;
  double dif=abs(((h*5)+((double)5/60)*m)-m);
  double ang=dif*6;
  ang=(ang*pi)/180;
  double ans=sqrt((a*a)+(b*b)-(2*a*b*cos(ang)));
  cout<<fixed<<setprecision(10);
  cout<<ans<<endl;
  return 0;
                  }

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

using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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 L, R;
  cin >> L >> R;
  vector< int > ok;
  for(int i = L; i <= R; i++) {
    ok.emplace_back(i % 2019);
    if(ok.size() > 5050) break;
  }
  int64 ret = infll;
  for(int i = 0; i < ok.size(); i++) {
    for(int j = 0; j < i; j++) {
      chmin(ret, ok[i] * ok[j] % 2019);
    }
  }
  cout << ret << endl;
}



Measured memory_bytes: 256
a=["KIH","B","R",""]
ans=[]
aaa=[]
for i in range(16):
    b=""
    for j,k in enumerate(a):
        if ((i >> j) & 1):
            b+="A"
        b+=k
    ans.append(b)
print("YES" if input() in ans else "NO") 

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cstring>

using namespace std;

int c[9][9];
int data[9][9];


void check_1(){
  int appear[10];
  for(int i = 0; i < 9; i++){
    fill(appear,appear+10,0);
    for(int j = 0; j < 9; j++)
      appear[data[i][j]]++;
    for(int k = 0; k < 9; k++)
      if(appear[data[i][k]] > 1) c[i][k] = 1; 
  }
}

void check_2(){
  int appear[10];
  for(int i = 0; i < 9; i++){
    fill(appear,appear+10,0);
    for(int j = 0; j < 9; j++)
      appear[data[j][i]]++;
    for(int k = 0; k < 9; k++)
      if(appear[data[k][i]] > 1) c[k][i] = 1; 
  }
}

void check_3(){
  int appear[10];
  
  for(int STx = 0; STx < 9; STx+=3)
    for(int STy = 0; STy < 9; STy+=3){
      fill(appear,appear+10,0);
      for(int i = STx; i < STx+3; i++)
	for(int j = STy; j < STy+3; j++)
	  appear[data[i][j]]++;

      for(int i = STx; i < STx+3; i++)
	for(int j = STy; j < STy+3; j++)
	  if(appear[data[i][j]] > 1) c[i][j] = 1;
    }    
}

void print(){
  for(int i = 0; i < 9; i++){
    for(int j = 0; j < 9; j++){
      if(c[i][j]) cout << "*";
      else cout << " ";
      cout << data[i][j];
    }
    cout << endl;
  }
}

int main(){

  int num;
  cin >> num;
  for(int rev = 0; rev < num; rev++){
    if(rev) cout << endl;
    memset(c,0,sizeof(c));
    for(int i = 0; i < 9; i++)
      for(int j = 0; j < 9; j++)
	cin >> data[i][j];
    
    check_1();
    check_2();
    check_3();
    print();
  }
  return 0; 
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin >> h >> w;
  string str[h+2];
  for(int i=0;i<=w+1;i++)str[0]+="#";
  for(int i=1;i<=h;i++)cin >> str[i];
  for(int i=0;i<=w+1;i++)str[h+1]+="#";
  for(int i=1;i<=h;i++)str[i]="#"+str[i]+"#";
  for(int i=0;i<=h+1;i++)cout << str[i]<< endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int n;
  cin >> n;
  int m = 0;
  map<int, int> mp;
  vector<int> tmp(n);
  rep (i, n) {
    cin >> tmp[i];
    auto itr = mp.find(tmp[i]);
    if (itr != mp.end()) {
      mp[tmp[i]]++;
    } else {
      mp[tmp[i]] = 1;
    }
    m = max(m, tmp[i]);
  }
  int second;
  if (mp[m] > 1) second = m;
  else {
    auto itr = mp.find(m);
    itr--;
    second = itr->first;
  }


  rep (i, n) {
    if (tmp[i] == m) P(second);
    else P(m);
  }



  return 0;
}

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

public class Main {

	static int[] S ;
	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();

		if(W.replaceAll("A", "").length() == 3||W.replaceAll("A", "").length()==0){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}


}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define ff { ios_base::sync_with_stdio(false);cin.tie(NULL);}
using namespace std;
 
typedef long long int ll;
 ll  p=1e9+7; 
 
 int  main() {
        ff;
       
       
       ll a,b,c,d;
       cin>>a>>b>>c>>d;
       
       while(1){
           if((c-b)<=0){
               cout<<"Yes"<<endl;
               break;
           }else{
               c=c-b;
           }
           if((a-d)<=0){
               cout<<"No"<<endl;
               break;
           }else{
               a=a-d;
           }
           
           
       }
       
      
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<map>
#include<set>
#include<queue>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define repr(i, n) for(int i = (n-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    int H, W; cin >> H >> W;
    vector<char> a[105];
    vector<bool> hor, ver;
    
    rep(i, H){
        string s; cin >> s;
        bool flag = true;
        rep(j, W){
            if(s[j] == '#') flag = false;
            a[j].push_back(s[j]);
        }
        hor.push_back(flag);
    }

    rep(j, W){
        bool flag = true;
        rep(i, H){
            if(a[j][i] == '#') flag = false;
        }
        ver.push_back(flag);
    }

    rep(i, H){
        rep(j, W){
            if(!hor[i] && !ver[j]){
                cout << a[j][i];
            }
        }
        if(!hor[i]) cout << endl;
    }
}

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

int main()
{
    int a,b;
    cin>>a>>b;
    if(a>=13)
         cout<<b<<endl;
    else if (a>=6&&a<=12){
        cout<<b/2<<endl;
    }
    else if (a<=5){
        cout<<0<<endl;
    }
    return 0;
}


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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define N 111111

const int INF = 1 << 30 ;
typedef long long ll ;
typedef pair < int , int > pii ;

int a[105] ;

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

  for(int i = 0 ;i<n ;i++){
    scanf("%d", &a[i]) ;
  }

  cout << *max_element(a, a+n) - *min_element(a,a+n) << endl ;
	
  return 0 ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

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

    int n;
    cin >> n;
    vector<int> d(n);
    rep(i, n) cin >> d[i];

    sort(d.begin(), d.end());

    cout << d[n/2] - d[n/2-1] << endl;

    return 0;
}

Measured memory_bytes: 640
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define MAX_DWORD				(0xFFFFFFFF)
#define	MAX_SDWORD				((SDWORD)0x7FFFFFFF)
#define	MIN_SDWORD				((SDWORD)0x80000000)
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define	MIN_QWORD				((QWORD)0x0000000000000000)
#define	MAX_SQWORD				((SQWORD)0x7FFFFFFFFFFFFFFF)
#define	MIN_SQWORD				((SQWORD)0x8000000000000000)
#define M_PI					3.14159265358979323846

typedef long					SDWORD;
typedef long long				SQWORD;
typedef unsigned long			DWORD;
typedef unsigned long long int	QWORD;
typedef long long ll;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
#define N_MAX	(200 * 1000)
#define K_MAX	(10)
#define M_MAX	(10)
#define Q_MAX	(10)
#define H_MAX	(1000)
#define W_MAX	(1000)

int main()
{
	int A, B, C;
	cin >> A >> B >> C;

	cout << min(B/A, C);

	return 0;
}


Measured memory_bytes: 256
object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val a = Array.fill(n+1)(sc.nextLong())
  val b = Array.fill(n)(sc.nextLong()) :+ 0L
  val ans = a.zip(b).foldLeft(0L, 0L)((acc, mh) => {
    val rem = mh._1 - mh._2 - acc._2
    if (rem > 0L) {
      (acc._1 + (mh._1 - rem), 0)
    } else {
      val rem2 = if (mh._1 - acc._2 > 0L) mh._1 - acc._2 else 0L
      (acc._1 + mh._1, mh._2 - rem2)
    }
  })
  println(ans._1)
}


Measured memory_bytes: 68484
import collections
from collections import defaultdict
def bfs(graph, root):
    count=0
    queue=collections.deque([root])
    visited.add(root)
    while queue:
        vertex=queue.popleft()
        ok=True
        for neighbour in graph[vertex]:
            if h[neighbour-1]>=h[vertex-1]:
                ok=False
            if neighbour not in visited:
                visited.add(neighbour)
                queue.append(neighbour)
            
        if ok==True:
            count+=1
            #print(count,vertex)
    return(count)
n,m=map(int,input().split())
h=[int(i) for i in input().split()]
graph=defaultdict(list)
seta=set()
for i in range(m):
    a,b=map(int,input().split())
    seta.add(a)
    seta.add(b)
    graph[a].append(b)
    graph[b].append(a)

visited=set()
ans=0
for i in range(1,n+1):
    #print(visited,i)
    if i not in visited:
        ans+=bfs(graph,i)
        #print(ans)
print(ans)
    





Measured memory_bytes: 46804
n = int(input())
input_x = sorted([int(i) for i in input().split()])

ans = 10**10
for i in range(input_x[0],input_x[-1]+1):
    cost_x = sum([(x-i)**2 for x in input_x])
    if cost_x < ans:
        ans = cost_x
print(ans)





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

void RUISEKIWA(int x, int NE, vector<vector<int> > &tree, vector<int> &counter) { //累積和を計算する再帰関数
    for (auto &y : tree.at(x)) { //頂点の子をすべて巡回
        if  (y == NE) continue; //双方向に記録されているので、逆走しないようにする
        counter.at(y) += counter.at(x); //根の値を子に足す
        RUISEKIWA(y, x, tree, counter); //子の頂点に対して同じ処理をする
    }
}

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    vector<vector<int> > tree(n); //それぞれの頂点の子のリスト
    vector<int> counter(n, 0); //それぞれの頂点のカウンタ
    rep(i,n-1) {
        int c, d;
        scanf("%d %d", &c, &d);
        c--; d--; //入力の1オリジンを0オリジンにする
        tree.at(c).push_back(d);
        tree.at(d).push_back(c); //A_i < B_i とは限らないので双方向に記録しておく
    }
    rep(i,q) {
        int c, v;
        scanf("%d %d", &c, &v);
        c--; //1オリジンを0オリジンに
        counter.at(c) += v; //根だけに記録
    }
    RUISEKIWA(0, -1, tree, counter); //再帰関数RUISEKIWAで各頂点のカウンターの値を計算する
    rep(i,n-1) printf("%d ", counter.at(i)); //出力
    printf("%d\n", counter.at(n-1)); //出力
}

Measured memory_bytes: 32896
def main():
    n=int(input())
    a=[]
    x=[]
    for i in range(n):
        a.append(int(input()))
        x.append([list(map(int,input().split())) for _ in [0]*a[-1]])
    cnt=0
    for i in range(2**n):
        flag=0
        c=("0"*n+bin(i)[2:])[-n:]
        for i in range(n):
            if c[i]=="0":
                continue
            for j,k in x[i]:
                if (k==1 and c[j-1]=="0") or (k==0 and c[j-1]=="1"):
                    flag=1
                    break
        if flag==1:
            continue
        cnt=max(cnt,c.count("1"))
    print(cnt)
main()

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

const long long MX = 1e18;

int main () {
    int N;
    long long ans = 1;
    cin >> N;
    bool ng = false;
    vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    for (int i = 0; i < N; i++) {
        if (A.at(i) == 0) {
            cout << 0 << endl;
            return 0;
        }

//10^18 <= ans * x <= 10^18 + ans
//a * ans つまり a <= ans  これは MX / ans < A.at(i) と同意（必要十分条件）
        if (ng || (MX + 1) / ans < A.at(i) || ans * A.at(i) > MX) {
            ng = true;
        }
        ans *= A.at(i);
    }
    if (ng) {
        cout << -1 << endl;
    }
    else {
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 4060
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;

ll arr [100005];
int main() {
  int n; ll c, k;
  cin >> n >> c >> k;

  for (int i=1; i <= n; i++){
    cin >> arr[i];
  }
  
  sort (arr+1,arr+n+1);

  ll ans = 1;
  ll track = 0;
  ll org = 0;
  for (int i=1; i <= n; i++){
    ll a = arr[i];
    ll b = arr[i-1];
    
    if (track == 0){
      track++;
      org = a;
    }
    else{
      if (track+1 <= c && a-org <= k){
        track++;
      }
      else{
        ans++;
        track = 1;
        org = a;
      }

    }

  }   

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

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

#define ll long long int
#define vr vector
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define loop(i,n) for(i=0;i<n;i++)
#define inp !cin.eof()
#define sec itr->second
#define fir itr->first

ll power(ll x,ll y,ll p)
{
    ll res = 1;     // Initialize result

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x)%p;

        // y must be even now
        y = y>>1; // y = y/2
        x = ((x%p)*(x%p))%p;  // Change x to x^2
    }
    return res%p;
}


int main()
{
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     // iterating a loop until input is providing====!cin.eof()
     //ll t; cin>>t;

     //scanf("%lld",&t);
     //while(t--)
        {

         ll n,m,q,i,x,y,p=1,z,j,k,flag=1,cnt=0,mi=mod,c=0,sum=0,ma=0,ans=0;
         // vr<ll> v,v1,v2;
            unordered_set<ll> sx,sy;

            cin>>n>>k;
            loop(i,n)
            {
                cin>>x>>y;
                double l=sqrt(x*x+y*y);
                //cout<<l<<" ";
                if(l<=k)
                {
                  cnt++;
                }
            }
              cout<<cnt;
              cout<<endl;
          }


    return 0;

}



Measured memory_bytes: 3668
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
#include<math.h>
//#include "Ants.h"
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef pair < int, int> P;
/****Union-Ford-Tree***/
int par[int(0x7ffffff)];//Parent
int Rank[int(0x7ffffff)];//Deep_of_the_Tree

//int a[100] = { 4,2,3,1,5 }, m[100] ={3,2,2};
//int n = 0;
//const ll mod = 1000000007;


//n要素で初期化
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		Rank[i] = 0;
	}
}
//木の根探し
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}
//xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;

	if (Rank[x] < Rank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}
/************************************************************************************/
int dx[4] = { 1,0/*,-1,0*/ }, dy[4] = { 0,1/*,0,-1*/ };
/**************/
int H, W;
ll dp[1000][1000];
char maze[1000][1000];
int main()
{
	cin >> H >> W;
	for (int i = 0; i < H; i++)for (int j = 0; j < W; j++) {
		
		cin >> maze[i][j];
	}
	//for (int i = 0; i < H; i++)for (int j = 0; j < W; j++)cout << i << " " << j << " " << maze[i][j] << endl;
	dp[0][0] = 1;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (i == H - 1 && j == W - 1)cout << dp[i][j];
			if (maze[i][j] == '#') continue;
			else {
				for (int k = 0; k < 2; k++) {
					int zx = j + dx[k], zy = i + dy[k];
					if (zx >= W || zy >= H)continue;
					if (maze[zy][zx] == '#')continue;
					else {
						dp[zy][zx] += dp[i][j];
						//cout << dp[zy][zx] <<" "<<zy<<" "<<zx<<" "<<maze[zy][zx]<< endl;
						dp[zy][zx] %= (int(1e9) + 7);
					}
				}
			}
		}
	}
	
}

Measured memory_bytes: 10496
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
using namespace std;

int main() {
    int n;
    cin >> n;
    int mn = INT_MAX, mx = -INT_MAX;
    long long sum = 0;
    int t;
    for (int i=0; i<n; ++i) {
        cin >> t;
        mn = min(mn, t);
        mx = max(mx, t);
        sum += t;
    }
    cout << mn << " " << mx << " " << sum << endl;
    return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
	std::string str1, str2;
	cin>>str1>>str2;
	if (str1[0]==str2[2] && str1[1]==str2[1] && str1[2]==str2[0]){
		cout<<"YES";
	}else{
		cout<<"NO";
	}
}

Measured memory_bytes: 256
a = input().split()
city = int(a[0])
road = int(a[1])

x = []
for i in range(road):
    b = input().split()
    x.append(int(b[0]))
    x.append(int(b[1]))

for i in range(city):
    count = 0
    for j in x:
        if i+1 == j:
            count += 1
    print(count)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<vector>
#include<cstring>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
int n,m,p[maxn];
ll c[maxn];
bool vis[maxn];
int Find(int x){return p[x]==x?x:p[x]=Find(p[x]);}
int main(){
//    freopen("e:\\in.txt","r",stdin);
    cin>>n>>m;
    ll ans = -m;
    int a,b;
    for(int i = 1; i <= n; i++)p[i] = i;
    for(int i = 0; i < m; i++){
        cin>>a>>b;
        p[Find(a)] = Find(b);
    }
    memset(c,0,sizeof(c));
    memset(vis,0,sizeof(vis));
    for(int i = 1; i <= n; i++)c[Find(i)]++;
    for(int i = 1; i <= n; i++){
        int f = Find(i);
        if(vis[f])continue;
        vis[f] = true;
        ans += c[f] * (c[f] - 1) / 2;
    }
//    cout<<ans<<endl;
    memset(vis,0,sizeof(vis));
    ll s1 = max(c[Find(1)],c[Find(2)]);
    ll s2 = min(c[Find(1)],c[Find(2)]);
    vis[Find(1)] = vis[Find(2)] = true;
    for(int i = 1; i <= n; i++){
        int f = Find(i);
        if(vis[f])continue;
        vis[f] = true;
        ans += s1 * c[f];
        s1 += c[f];
//        cout<<i<<' '<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3072
N = int(input())
B = list(map(int, input().split()))

A = [0 for i in range(N)]
A[0] = B[0]; A[N-1] = B[N-2]
for i in range(1, N-1):
    A[i] = min(B[i-1], B[i])
    
print(sum(A))

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

using namespace std;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int x, y;
	cin >> x >> y;
	
	if (y % 2 != 0) {
		cout << "No" << "\n";
		return 0;
	}
	
	int a;
	a = (4 * x - y) / 2;
	
	
	if (a <= x && a >= 0) {
		cout << "Yes" << "\n";
		return 0;
	}
	
	cout << "No" << "\n";
	
	return 0;
}


Measured memory_bytes: 3604
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string.h>
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%I64d",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)
#define INF                         (int)1e9
#define EPS                         1e-9
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define MOD                         1000000007
typedef long long ll;
/*For you see , each day i love you
 more.Today more than yesterday
  less than tomorrow.*/
using namespace std;

int main()
{
	int k,a,b;
	scanf("%d %d %d",&k,&a,&b);
	for(int i = a;i<=b;i++)
	{
		if(i%k == 0)
		{
			printf("OK\n");
			return 0;
		}
	}
	printf("NG\n");
	return 0;
}

Measured memory_bytes: 3764
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct Node {
  int k;
  struct Node *r,*l,*p;
};
typedef struct Node* node;
node root;
node NIL;

void insert(int);
void inorder(node);
void preorder(node);

int main(){
  int n,i,x;
  char com[20];
  scanf("%d",&n);
  root = NIL;
  
  for(i=0;i<n;i++){
    scanf("%s",com);
    if(com[0]=='i'){
      scanf("%d",&x);
      insert(x);
    }
    else if(com[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}
void insert(int k){
  node y=NIL;//xの親
  node x=root;
  node z;
  
  z=(node)malloc(sizeof(struct Node));

  z->k = k;
  z->l = NIL;
  z->r = NIL;
 
  while(x != NIL){
   y=x;//親を設定
    if( z->k < x->k )
      x = x->l;//左の子へ
    else x = x->r;//右の子へ
  }
  z->p = y;
  
  if(y==NIL)
    root = z;
  else {
    if( z->k < y->k ){
      y->l = z;
    }
    else
      y->r = z;
  }
}
void inorder(node u){
  if(u==NIL)return;
  inorder(u->l);
  printf(" %d",u->k);
  inorder(u->r);
}
void preorder(node u){
  if(u==NIL)return;
  printf(" %d",u->k);
  preorder(u->l);
  preorder(u->r);
}



Measured memory_bytes: 25176
#include <stdio.h>

int main() {
    int n, a, deuRuim = 0;
    //printf("%d\n", a);
    
    scanf("%d", &n);
    
    int i = 0;
    
    while(i < n) {
        scanf("%d", &a);
        
        if (a % 2 == 0) {
            if (a % 3 != 0 && a % 5 != 0) {
                deuRuim = 1;
            }
        }
        
        ++i;  //i = i + 1;  | i++;
    }
    
    if (deuRuim) {
        printf("DENIED\n");
    } else {
        printf("APPROVED\n");
    }
    
    return 0;
}









Measured memory_bytes: 128
#include <cstdio>

int main()
{
	int n, k;
	scanf("%d%d", &n, &k);
	int i;
	int count;
	for (i = 0, count = 0; i < n; i++) {
		int h;
		scanf("%d", &h);
		if (h >= k)
			count++;
	}
	printf("%d\n", count);
}

Measured memory_bytes: 1716
import math

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]



if __name__ == "__main__":
    N = int(input())
    total = 0
    for i in range(1,N+1):
        Y = math.floor(N/i)
        total += int(Y*(Y+1)*i/2)
    print(total)

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

int main() {
  ll n;
  cin >> n;
  vector<ll> p(n);
  rep(i, n) cin >> p[i];

  ll cnt = 0;
  for (int i = 0; i < n - 1; i++) {
    if (p[i] == i + 1) {
      swap(p[i], p[i + 1]);
      cnt++;
    }
  }
  if (p[n - 1] == n) cnt++;
  cout << cnt << endl;
  return 0;
}


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

int main() {
    string s;
    cin >> s;
    bool ok1 = true;
    bool ok2 = true;
    int n = s.size();
    rep(i,n) {
        if (s[i] != s[n-i-1]) ok1 = false;
    }
    int h = n/2;
    rep(i,h/2) {
        if (s[i] != s[h-i-1]) ok2 = false;
    }
    string ans = "No";
    if (ok1 && ok2) ans = "Yes";
    cout << ans << endl;
}

Measured memory_bytes: 256
/// 5:28 PM 17/05/20
/// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!)
#include<bits/stdc++.h>

using namespace std;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define VARIABLE_ERROR(x) cout << #x << " = " << x << endl;
#define CONTAINER_ERROR(v) cout << "{";for (auto &x:v) { cout << x << ','; }cout << "}" << endl;
#define PI 3.14159265358979323846
#define M 1000000007
#define INF 1e15
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n, m;
    cin >> n >> m;
    vector<vector<ll> > G(n);
    for(ll i=0;i<m;i++) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    vector<ll> dist(n, INF);
    vector<ll> parent(n, -1);
    vector<bool> vis(n, 0);
    vis[0] = 1;
    dist[0] = 0;
    queue<ll> q;
    q.push(0);
    while (!q.empty()) {
        ll v = q.front();
        q.pop();
        for (auto x:G[v]) {
            if(vis[x] == 0) {
                vis[x] = true;
                dist[x] = dist[v] + 1;
                parent[x] = v;
                q.push(x);
            } else {
                if(dist[v] + 1 < dist[x]) {
                    dist[x] = dist[v] + 1;
                    parent[x] = v;
                }
            }
        }
    }
    ll c = 0;
    for(auto x:parent) {
        if(x==-1) {
            c++;
        }
    }
    if (c>1) {
        cout << "No";
    } else {
        cout << "Yes" << endl;
        for(ll i=1;i<n;i++) {
            cout << parent[i] + 1 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 13840
import sys
from collections import defaultdict,Counter

sys.setrecursionlimit(10**7)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    s=list(input())
    t=list(input())[:-1]
    print('Yes' if s==t else 'No')



if __name__ == "__main__":
    main()

Measured memory_bytes: 9332