akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(){
	int n;
	int card[110];
	char t;
	int i;
	int x;
	scanf("%d\n",&n);
	for(i=0;i<110;i++){
		card[i]=0;
	}
	for(i=0;i<n;i++){
		scanf("%c %d\n",&t,&x);
		x-=1;
		if(t=='H') x+=13;
		else if(t=='C') x+=26;
		else if(t=='D') x+=39;
		card[x]=1;
	}
	for(i=0;i<52;i++){
		if(card[i]==0){
			if(i<13) printf("S ");
			else if(i<26) printf("H ");
			else if(i<39) printf("C ");
			else  printf("D ");
			printf("%d\n",(i%13)+1);
		}
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define sortall(obj) sort(ALL(obj))
#define revall(obj) reverse(ALL(obj))
#define SortRevAll(obj) revall(sortall(obj))
typedef string str;
typedef long long ll;
const int mod=1e9+7;
const int INF=1e9;
const ll LINF=1e18;
#define VI vector<int>
#define P pair
#define M map
#define F first()
#define S second()
#define PB(a) push_back(a)
#define IN(a) insert(a)
#define ins(a) int a;cin >> a
#define lls(a) ll a;cin >> a
#define in(a) cin >> a
#define sts(a) string (a);cin >> a
#define For(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) For(i,0,n)
#define Forr(i,m,n) for(int i=n-1;i>=m;i--)
#define repr(i,n) Forr(i,0,n)
#define print(a) cout << a << endl
#define Endl cout << endl
#define YES(n) cout << ((n)? "YES" : "NO") << endl
#define Yes(n) cout << ((n)? "Yes" : "No") << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define br(c,y,n) cout << ((c)? y : n) << endl

int main()
{
    ins(a);ins(b);ins(c);
    Yes(((a+b)==c)||((b+c)==a)||((c+a)==b));
    return 0;
}


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

int main()
{
    ll i,j,k;
    ll n;

    while(cin>>n)
    {
        ll dp[100002]={0};
        ll h[100002];

        for(i=0;i<n;i++)
            cin>>h[i];
        dp[1]=abs(h[1]-h[0]);
        for(i=2;i<n;i++)
            dp[i]=min((abs(h[i-2]-h[i])+dp[i-2]),(abs(h[i-1]-h[i])+dp[i-1]));

        cout<<dp[n-1]<<endl;

    }

    return 0;
}


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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    A=[0]*N
    xy=[]
    for i in range(N):
        A[i]=I()
        temp=[]
        for _ in range(A[i]):
            x,y=MI()
            x-=1
            temp.append((x,y))
        xy.append(temp)
        
    import itertools
    ans=0
    
    for ite in itertools.product([0,1], repeat=N):
        # ite[i]=1なら正直者，
        flag=1
        for i in range(N):
            if flag==0:
                break
            if ite[i]==1:
                for x,y in xy[i]:
                    if ite[x]!=y:
                        flag=0
                        break
        if flag:
            ans=max(ans,sum(ite))
            
    print(ans)
            

main()


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

int main() {
	int max = 0;
	int num = 0;
	string S;
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		num = 0;
		while (S[i] == 'A'|| S[i] == 'C'|| S[i] == 'G'|| S[i] == 'T') {
			num++;

			i++;
			if (num >= max)max = num;
		}
	}
	cout << max << endl;
	return 0;

}

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

int main() {
    long R, G, B, N;

    long long ans = 0;

    scanf("%ld%ld%ld%ld", &R, &G, &B, &N);

    for(int i = 0; i <= 3000 / R + 1; ++i) {
        for(int k = 0; k <= (3000 - (R * i)) / G + 1; ++k) {
            if(i * R + G * k > N) {
                break;
            }
            for(int y = ((3000 - (R * i) - (k * G)) / B) + 10; y >= 0; --y) {
                if(i * R + G * k + y * B < N) {
                    break;
                }
                if(i * R + G * k + y * B == N) {
                    ans++;
                    break;
                }
            }
        }
    }

    printf("%lld\n", ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int b;
  for(int i=0;i<n;i++){
	cin>>b;
    a[i]-=b;
  }
  int ans=0;
  for(int i=0;i<n;i++){
    if(a[i]>0){
		ans+=a[i];
    }
  }
  cout<<ans<<endl;
  return(0);
}

Measured memory_bytes: 256
import math
A, B = map(int, input().split())

# A*12.5 <= rangeA < (A+1)*12.5
rangeA = range(math.ceil(A * 12.5), math.ceil((A+1) * 12.5))
# B*10 <= rangeB < (B+1)*10
rangeB = range(math.ceil(B * 10), math.ceil((B+1) * 10))
# ans = min(common(rangeA, rangeB))
common = set(rangeA) & set(rangeB)
if len(common) > 0:
    print(min(common))
else:
    print(-1)


Measured memory_bytes: 3064
#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	int a,b,c;
	int ans = 0;
	scanf("%d %d %d",&a,&b,&c);
	for(int i = 1;i <= 1e5; i++){
		ans = i * a;
		if(ans % b == c){
			printf("YES\n");
			break;
		}
		if(i == 1e5 - 1){
			printf("NO\n");
			break;
		}
	}
}

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

// macros
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define INT_IN(a) int a; cin >> a
#define STR_IN(s) string s; cin >> s
#define PRINTLN(s) cout << s << endl
#define PRINTDOUBLELN(s) cout << setprecision(12) << (s) << endl;

// util functions
template<class T> inline T sqr(T x) {return x*x;}

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template <typename T>inline T max(vector<T> v){T max=v[0]; FOR(i, 1, v.size())max=MAX(v[i], max); return max;}
template <typename T>inline T min(vector<T> v){T min=v[0]; FOR(i, 1, v.size())min=MIN(v[i], min); return min;}
template <typename T>inline vector<T> concat(vector<T> a, vector<T> b){vector<T> ab; ab.reserve(a.size()+b.size());ab.insert(ab.end(),a.begin(),a.end());ab.insert(ab.end(),b.begin(),b.end());return ab;}

// types
typedef long long LL;

// consts
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

int main(){
    int H, W;
    while(cin >> H >> W){
        if(!H or !W) continue;
        REP(i, H){
            REP(j, W){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3100
#include <stdio.h>

int main(){

  int n,q,i,cnt=0,a,b,c;

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

  a=0;
  c=n;
  for(i=0;i<q;i++){
    while(a<c){
      b=(a+c)/2;
      if(A[b]==B[i]){
	cnt++;
	break;
      }
      else if(B[i]<A[b]) c=b;
      else a=b+1;
    }
    a=0;
    c=n;
  }

  printf("%d\n",cnt);

    return 0;
  
}



Measured memory_bytes: 2352
local function getgcd(x, y)
  while(0 < x and 0 < y) do
    if(x < y) then y = y % x else x = x % y end
  end
  return math.max(x, y)
end

local a, b, k = io.read("*n", "*n", "*n")
local c = getgcd(a, b)
local cnt = 1
for i = c, 1, -1 do
  if(c % i == 0) then
    if(cnt == k) then print(i) break
    else cnt = cnt + 1 end
  end
end


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long
inline int read(){
	char c=getchar();while (c!='-'&&(c<'0'||c>'9'))c=getchar();
	int k=1,kk=0;if (c=='-')c=getchar(),k=-1;
	while (c>='0'&&c<='9')kk=kk*10+c-'0',c=getchar();return kk*k;
}using namespace std;
void write(int x){if (x<0)putchar('-'),x=-x;if (x/10)write(x/10);putchar(x%10+'0');}
void writeln(int x){write(x);puts("");}
int n,d,dd,k;
signed main(){
	n=read();d=1;for (int i=1;i<=18;i++){
		for (int j=1;j<=9;j++)if (dd+d<=n)dd+=d,k++;
		d*=10; 
	}writeln(k);
}



Measured memory_bytes: 256
#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;
    int l;
    l=s.size();
    int lmax,ans=1000;
    string s2,s3;
    rep(i,l){
        s2=s[i];
        int k=1;
        lmax=i+1;
        rep(j,l){
            s3=s[j];
            if(s2!=s3){
                ++k;
            }
            else{
                lmax=max(k,lmax);
                k=1;
            }
        }
        lmax=max(k,lmax);
        ans=min(ans,lmax);
    }

    cout << ans-1 << endl;

    return 0;
}

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

int main () {
  int H , W ;
  while(1){
  cin >> H >> W ;
  if(H==0&&W==0) break ;
    for(int i = 1 ; i <= H ; i++ ){
      for(int j = 1 ; j <= W ; j++ ){
        if((i+j)%2==0) cout << '#' ;
        else cout << '.' ;
      }
      cout << endl ;
    }
    cout << endl ;
  }
}


Measured memory_bytes: 3124
import java.util.Scanner;
class Main{
	public static void main(String[] args){
    	Scanner sr = new Scanner(System.in);
      	int A = sr.nextInt();
      	int B = sr.nextInt();
      	int H = sr.nextInt();
      	int M = sr.nextInt();
      	
      double angleA = (H*60+M)*Math.PI/360;    
      double angleB = (M*Math.PI)/30;
      double C = A*A+B*B-(2*A*B*Math.cos(Math.abs(angleA-angleB)));
      System.out.println(Math.sqrt(C));
    }
} 

Measured memory_bytes: 35960
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {
	char A[20],B[20],C[20];
	scanf("%s%s%s" , A, B,C);

	if (A[strlen(A) - 1] == B[0] && B[strlen(B) - 1] == C[0]) {
		printf("YES");
	}
	else {
		printf("NO");
	}









}

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

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
    int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}

int w, h, x, y;
bool sol;

int main() {
	read(w), read(h), read(x), read(y);
	printf("%.10lf %d\n", (double) w * h / 2.0, 
	!(w & 1) && !(h & 1) && x == w / 2 && y == h / 2);
	return 0;
}

Measured memory_bytes: 256
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt(), M = cin.getInt();
    let A = new Array(N), X = new Array(N), Y = new Array(N), Z = new Array(N);
	for (let n = 0; n < N; n++) {
		X[n] = cin.getInt(), Y[n] = cin.getInt(), Z[n] = cin.getInt();
	}
    let ans = 0;
    for (let n = 0; n < 8; n++) {
        let B = ('00' + n.toString(2)).substr(-3);
        for (let m = 0; m < N; m++) {
            A[m]  = B[0] == 0 ? X[m]: -X[m];
            A[m] += B[1] == 0 ? Y[m]: -Y[m];
            A[m] += B[2] == 0 ? Z[m]: -Z[m];
        }
        let w = 0;
        A.sort((a, b) => b - a);
        for (let m = 0; m < M; m++) {
            w += A[m];
        }
        if (ans < w) ans = w;
    }
    console.log(ans);
}
class Inputer{constructor(t){if(typeof t=='undefined')throw new Error('引数（stdin）を省略できません！');this.cnt=0;this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');if(t<1)throw new Error('引数は1以上であること！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');if(t<1)throw new Error('引数は1以上であること！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

typedef long long LL;
const LL MOD = 1000000007;
LL fac[100010]; 

int main()
{
	fac[0] = 1;
	for (int i=1;i<=100000;i++)fac[i] = fac[i-1] * LL(i) % MOD;
	int N,M;
	scanf("%d%d",&N,&M);
	if (N<M) swap(N,M);
	if (N > M+1)
		return 0*puts("0");
	LL ans = 1;
	if (N==M)
	{	
		ans = 2LL*fac[N]*fac[M]%MOD;
	}
	else
	{
		ans = fac[N]*fac[M]%MOD;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 1024
N = int(input())
A = list(map(int, input().split()))
four_num = 0
odd_num = 0
for a in A:
    if a % 4 == 0:
        four_num += 1
    elif a % 2 == 1:
        odd_num += 1
t = 0
if four_num + odd_num == N:
    t = 1
if four_num >= odd_num - t:
    print('Yes')
else:
    print('No')


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

signed main() {
  int n, m; cin >> n >> m;
  char c[n][n], d[m][m];
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      cin >> c[i][j];
    }
  }
  for(int i = 0; i < m; i++) {
    for(int j = 0; j < m; j++) {
      cin >> d[i][j];
    }
  }

  bool flag = false;
  for(int cy = 0; cy < n-m+1; cy++) {
    for(int cx = 0; cx < n-m+1; cx++) {

      bool match = true;
      for(int dy = 0; dy < m; dy++) {
        for(int dx = 0; dx < m; dx++) {
          if(c[cy+dy][cx+dx] != d[dy][dx]) match = false;
        }
      }
      if(match) flag = true;
    }
  }
  cout << (flag ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] nums = new int[n];
    int[] dp = new int[n];
    for (int i = 0; i < n; i++) {
      nums[i] = sc.nextInt();
    }
    sc.close();
    Arrays.fill(dp, Integer.MAX_VALUE);
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 1; j <= k && i + j < n; j++) {
          dp[i + j] = Math.min(dp[i + j], dp[i] + Math.abs(nums[i] - nums[i + j]));
      }
    }
    System.out.println(dp[n - 1]);
  }
}

Measured memory_bytes: 58328
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
 
struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;
 
template<typename T1,typename T2>
ostream &operator<<(ostream &os,const pair<T1,T2>&p){
    os<<p.first<<" "<<p.second;
    return os;
}
 
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==(int)v.size()?"":" ");
    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>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}

// 2^127 = 170141183460469231731687303715884105728 ~ 10^38
using int128=__int128;
 
ostream &operator<<(ostream &os,const __int128 n){
    if(n==0){
        os<<0;
        return os;
    }
    __int128 num=n;
    bool neg=false;
    if(num<0)neg=true,num=-num;
    string res="";
    while(num>0){
        res.push_back('0'+num%10);
        num/=10;
    }
    if(neg) res.push_back('-');
    reverse(begin(res),end(res));
    os<<res;
    return os;
}
 
istream &operator>>(istream &is,__int128 &n){
    string s;
    is>>s;
    int idx=0;
    bool neg=false;
    if(s[0]=='-')neg=true,idx++;
    n=0;
    for(;idx<(int)s.size();idx++){
        n=10*n+s[idx]-'0';
    }
    if(neg) n=-n;
    return is;
}
 
__int128 abs(__int128 x){
    return x<0?-x:x;
}
 
__int128 gcd(__int128 a,__int128 b){
    if(a==0) return b;
    if(b==0) return a;
    return b>0?gcd(b,a%b):a;
}
 
pair<int128,int> freader(){
    string s;cin>>s;
    int i=0;bool neg=false;
    if(s[0]=='-')i++,neg=true;
    int128 res=0;int b=0;bool t=false;
    for(;i<(int)s.size();i++){
        if(s[i]=='.'){
            t=true;
            continue;
        }
        res=10*res+(s[i]-'0');
        if(t)b++;
    }
    if(neg)res=-res;
    return make_pair(res,b);
}


signed main(){
    int128 a;cin>>a;
    auto [b,p]=freader();
    a*=b;
    rep(_,p)a/=10;
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 3600
import collections
S = list(input())

def judge(S):
    if "N" in S and "S" in S:
        if "W" in S and "E" in S:
            judge = "Yes"
            return judge
        elif "W" not in S and "E" not in S:
            judge = "Yes"
            return judge
        else:
            judge = "No"
            return judge
    elif "W" in S and "E" in S:
        if "N" not in S and "S" not in S:
            judge = "Yes"
            return judge
        else:
            judge = "No"
            return judge
    else:
        judge = "No"
        return judge

print(judge(S))




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

signed main() {
  int N;
  cin >> N;
  for(int i=0;i<N; i++) {
    int a;
    cin >> a;
    if( a%2 ==0 )
      if( a%3 != 0 && a%5 !=0 ) {
        puts("DENIED");
        return 0;
      }
  }
  puts("APPROVED");

}


Measured memory_bytes: 256
use std::*;

#[allow(dead_code)]
fn read<T: str::FromStr>() -> T {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|a| a.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2d<T: str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let s: String = read();
    let mut tmp = 0;
    let mut max = 0;
    for c in s.chars() {
        match c {
            'A' | 'C' | 'G' | 'T' => {
                tmp += 1;
                if max < tmp {
                    max = tmp;
                }
            }
            _ => tmp = 0,
        }
    }
    println!("{}", max);
}


Measured memory_bytes: 4352
#https://abc010.contest.atcoder.jp/tasks/abc010_4
#http://kmjp.hatenablog.jp/entry/2014/06/08/0900

#よくわからない最大フロー用のdfs---------------------------------

num=201 #今回のnの最大値100*2+1

def dfs(cur):
	global vis
	global EE
	vis[cur] = 1

	if cur==num:
		return 1

	for i in range(num+1):
		if vis[i]==0 and EE[cur][i]>0 and dfs(i) > 0:
			EE[cur][i] -= 1
			EE[i][cur] += 1
			return 1
	return 0
#------------------------------------------------------------------------------------

#今回の問題分（インプット～隣接リストの作成）------------------

n=int(input())
s=[]
ss=[]
for i in range(n):
    s.append([int(i) for i in input().split()])
for i in range(n):
    ss.append([int(i) for i in input().split()])
s.sort(key=lambda x:(x[0],x[1]))
ss.sort(key=lambda x:(x[0],x[1]))

pair=[]
for i in range(len(s)):
    right=[]
    for j in range(n):    
        if s[j][0]<ss[i][0] and s[j][1]<ss[i][1]:
            right.append(j)
    pair.append(right)
pair.sort(key=lambda x:len(x))

#print(pair)

#------------------------------------------------------------------------------------

#BFSにぶち込む用のグラフ作成------------------------------------------

EE = [[0 for x in range(num+1)] for y in range(num+11)]
vis = [0] * (num+1)

for i in range(len(pair)): #1から最大100　始点s（番号0）から青い点への辺
	EE[0][i+1] = 1
	EE[i+1][0] = 1

for i in range(n): #101から最大200　赤い点から終点t（番号201）への辺
	EE[i+101][num] = 1

for i in range(len(pair)): #青い点（番号1～100に振り直し）から　赤い点（番号101～200）への辺
    for j in range(len(pair[i])):
        node1, node2 = i+1,pair[i][j]+101
#        EE[node1][node2] = EE[node2][node1] = 1　なんでこれダメなんだろう
        EE[node1][node2] = 1

#風呂～～-----------------------------------------------------------------------

flow=0
while 1:
    for i in range(0, num+1):
        vis[i] = 0
    if dfs(0) == 0:
        break
    flow += 1

print (flow)

#------------------------------------------------------------------------------------




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

int main(){
  string s;
  cin>>s;
  for(int i=0;i<19;i++){
    if(s[i]==','){
      cout<<' ';
    }
    
    else{
      cout<<s[i];
    }
  }

  return 0;
}


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

int main()
{
    long h,w,n;
    cin >> h >> w >> n;
    long a[n];
    F(n) cin >> a[i];
    long c[h][w];
    long i=0,j=0,k=0,b=1,cnt=0;
    F(h){
        if(i%2==0){
            for(int j=0;j<w;++j){
                c[i][j]=b;
                ++cnt;
                if(cnt>=a[b-1]){
                    ++b;
                    cnt=0;
                }
            }
        }
        else{
            for(int j=w-1;j>=0;--j){
                c[i][j]=b;
                ++cnt;
                if(cnt>=a[b-1]){
                    ++b;
                    cnt=0;
                }
            }
        }
    }
    F(h){
        for(int j=0;j<w;++j){
            cout << c[i][j] << ' ';
        }
        cout << endl;
    }
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  int A[2][110];
  for(int i = 0; i < 2; i++){
    for(int j = 0; j < N; j++){
	  cin >> A[i][j];
    }
  }
  
  int mx = 0;
  for(int i = 0; i < N; i++){
    int sum1 = 0;
    int sum2 = 0;
    for(int j = 0; j < i+1; j++){
	  sum1 += A[0][j];
    }
    for(int j = i; j < N; j++){
      sum2 += A[1][j];
    }
    mx = max(mx, sum1+sum2);
  }
  
  cout << mx << endl;
}
  
  
  

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
    int i = 1;
    int n;
    scanf("%d", &n);
 
    while (1) {
        int x = i;
        if (x % 3 == 0) {
            printf(" %d", i);
        } else {
            while (x) {
                if (x % 10 == 3) {
                    printf(" %d", i);
                    break;
                }
                x /= 10;
            }
        }
        if (++i > n) {
            break;
        }
    }
    printf("\n");
    return 0;
}

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

using namespace std;

#define llong long long int
#define ldouble long double
#define ternary(condition, x, y) ((condition) ? x : y) 
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static llong MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

int main (int argc, char *argv[]) {
    cin.tie(0); 
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    string s1, s2;
    cin >> s1 >> s2;

    int previous_pattern, cur;
    llong ans = 1;
    if (s1[0] == s2[0]) {
        ans *= 3;
        previous_pattern = 0;
        cur = 1;
    } else {
        ans *= 6;
        previous_pattern = 1;
        cur = 2;
    }
    
    while (cur < n) {
        if (s1[cur] == s2[cur]) {
            if (previous_pattern == 0) {
                ans *= 2;
                ans %= MOD;
            }

            previous_pattern = 0;
            ++cur;
        } else if (s1[cur] != s2[cur]) {
            if (previous_pattern == 0) {
                ans *= 2;
                ans %= MOD;
            } else {
                ans *= 3;
                ans %= MOD;
            }
            
            previous_pattern = 1;
            cur += 2;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

struct UnionFind {
  int n;
  vector<int> p;
  UnionFind() {}
  UnionFind(int n): n(n), p(n, -1) {}
  int find(int x) {
    return p[x] < 0 ? x : p[x] = find(p[x]);
  }
  void unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return;
    if (p[x] > p[y]) swap(x, y);
    p[x] += p[y];
    p[y] = x;
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
  int size(int x) {
    return -p[find(x)];
  }
};

int N, M;
int a[100010];
int x[100010], y[100010];
pii p[100010];
int pused[100010];
int vused[100010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    p[i] = {a[i], i};
  }
  sort(p, p+N);

  UnionFind uf(N);
  for (int i = 0; i < M; i++) {
    cin >> x[i] >> y[i];
    uf.unite(x[i], y[i]);
  }

  if (N < 2 * (N - M - 1)) {
    cout << "Impossible" << endl;
    return 0;
  }

  if (M == N - 1) {
    cout << 0 << endl;
    return 0;
  }

  int cnt = 0;
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    int pp = uf.find(p[i].second);
    if (pused[pp]) continue;
    pused[pp] = 1;
    cnt++;
    ans += p[i].first;
    vused[i] = 1;
  }

  int rem = 2 * (N - M - 1) - cnt;
  for (int i = 0; i < N; i++) {
    if (vused[i]) continue;
    if (rem <= 0) break;
    rem--;
    ans += p[i].first;

  }
  cout << ans << endl;

  return 0;
}

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

#define ll long long
#define INF INT_MAX

using namespace std;

const int D = 80 * 160 + 10;
const int D2 = D * 2;
typedef bitset<D2> bs;

int A[100][100];
bs dp[90][90];

int main() {
  ll H, W;
  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      int B;
      cin >> B;
      A[i][j] = abs(A[i][j] - B);
    }
  }

  dp[0][0][D - A[0][0]] = 1;
  dp[0][0][D + A[0][0]] = 1;

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (i) {
        dp[i][j] |= dp[i - 1][j] << A[i][j];
        dp[i][j] |= dp[i - 1][j] >> A[i][j];
      }
      if (j) {
        dp[i][j] |= dp[i][j - 1] << A[i][j];
        dp[i][j] |= dp[i][j - 1] >> A[i][j];
      }
    }
  }

  int ans = INF;
  for (int i = 0; i < D2; i++) {
    if (dp[H - 1][W - 1][i]) {
      ans = min(ans, abs(D - i));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 24704
#include <stdio.h>
int main(void){
    long int n,i,ans=1;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        ans*=i;
        if(1000000007<=ans) ans=ans%1000000007;
    }
    printf("%ld",ans);
    return 0;
}

Measured memory_bytes: 128
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)


k = int(input())

ans = 0
a = 1
while a <= k:
  b = a
  while b <= k:
    c = b
    while c <= k:
      if a == b and b == c:
        ans += gcd(a, b, c)
      elif a == b or b == c or c == a:
        ans += 3 * gcd(a, b, c)
      else:
        ans += 6 * gcd(a, b, c)
      c += 1
    b += 1
  a += 1
         
print(ans)


 

Measured memory_bytes: 9628
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define DB double
#define BS bitset
#define VE vector
#define VL vector<LL>
#define VP vector<pair<LL,LL>>
#define VVL vector<vector<LL>>
#define PQ priority_queue<LL>
#define PQS priority_queue<LL, vector<LL>, greater<LL>>
#define PB push_back
#define POB pop_back
#define PF push_front
#define POF pop_front
#define MP make_pair
#define TS to_string
#define TU to_ullong
#define FOR(i,a,n) for(i=a;i<n;i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define UB(a,n) *upper_bound(ALL(a),n)
#define LB(a,n) *lower_bound(ALL(a),n)
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000000000001
#define NUM 200010

void yn(LL a){if(a)printf("Yes\n");else printf("No\n");}
void YN(LL a){if(a)printf("YES\n");else printf("NO\n");}
LL pwmn(LL a,LL n){LL ans=1;while(ans<a)ans*=n;return ans;}
LL GCD(LL a,LL b){LL c=1,tmp=max(a,b);b=min(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(m,d);x-=k*y;swap(x,y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
template<typename T>bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  LL N,M,T,i,j,a=0;
  VL x(100005),y(100005),kf(50005),kn(50005);
  BS<100005> ans;
  VE<BS<50005>> f(50005);
  cin>>N>>M>>T;
  rep(i,M)cin>>x[i]>>y[i];
  if(T==1){
    FOR(i,1,N+1)f[i][i]=1;
    rep(i,M)f[x[i]]=f[y[i]]=f[x[i]]|f[y[i]];
    FOR(i,1,N+1){
      if(f[i].count()!=N)continue;
      f[i].reset();
      f[i][i]=1;
      for(j=M-1;j>=0;j--){
        if(f[i].test(x[j]))f[i][y[j]]=1,ans[j]=1;
        else if(f[i].test(y[j]))f[i][x[j]]=1,ans[j]=0;
        else ans[j]=0;
      }
      if(f[i].count()==N)a=1;
      if(a==1){
        rep(i,M)cout<<(ans.test(i)?'^':'v');
        return 0;
      }
    }
    cout<<-1<<endl;
  }else{
    FOR(i,1,N+1)kf[i]=i,kn[i]=1;
    for(i=M-1;i>=0;i--){
      if(kn[kf[x[i]]]>kn[kf[y[i]]]){
        ans[i]=0;
        kn[kf[x[i]]]--,kn[kf[y[i]]]++;
        kf[x[i]]=kf[y[i]];
      }else{
        ans[i]=1;
        kn[kf[x[i]]]++,kn[kf[y[i]]]--;
        kf[y[i]]=kf[x[i]];
      }
    }
    FOR(i,1,N+1)if(kn[i]>0)a++;
    if(a>1)rep(i,M)cout<<(ans.test(i)?'^':'v');
    else printf("-1");
  }

	return 0;
}


Measured memory_bytes: 308224
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <set>
#include <map>
using namespace std;

int main()
{
	int32_t K, X;
	cin >> K >> X;

	int32_t start = X - K + 1;
	if (start < -1000000)
		start = -1000000;

	int32_t end = X + K - 1;
	if (end > 1000000)
		end = 1000000;
	for (int32_t i = start; i <= end; i++) {
		cout << i << " ";
	}

	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("-O3")

#include<bits/stdc++.h>
using namespace std;

using l = long int;
using ll =long long int;
using u64 = uint64_t;
// using u128 = __uint128_t;
#define imax INT_MAX
#define lmax LLONG_MAX
#define pb push_back
#define ld long double
#define pii pair<l,l> 
#define pll pair<ll,ll>
#define v vector
#define vl vector<l>
#define vll vector<ll>
#define vvl vector<vector<l>>
#define vvll vector<vector<ll>>
#define vv(a) vector<vector<a>> 
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x)rend()
#define f first
#define s second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define rep(i, begin, end) \
        for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define tc l t=0;cin>>t;while(t--)

// ONLINE JUDGE START
#ifndef ONLINE_JUDGE
    // FILE

    #define file ofstream cout; ifstream cin; cout.open("output.txt"); cin.open("input.txt");  
    // DEBUG

    #define debug(x) cout<<"LINE NUMBER:     "<<__LINE__<<"\t :--> \t"<<#x<<"   =   "<<x<<endl;

#else 

    #define debug(x) 

#endif


// SYSTEM
#define DeBuG(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) for(long blockTime=NULL;(blockTime==NULL?(blockTime=clock())!=NULL:false); \
            DeBuG("%s:%.4f s\n",d,(double)(clock()-blockTime)/CLOCKS_PER_SEC))

// OVERLOADING
istream& operator >> (istream& cin,vll &a){
    for(auto &i:a)cin>>i;
    return cin;
}
ostream& operator << (ostream& cout,pll &a){
    cout<<a.f<<" "<<a.s<<"\t";
    return cout;
}
ostream& operator << (ostream& cout,vl &a){
    for(auto &i:a)cout<<i<<" ";
    return cout;
}
ostream& operator << (ostream& cout,vll &a){
    for(auto &i:a)cout<<i<<" ";
    return cout;
}
ostream& operator << (ostream& cout,v<pll> &a){
    for(auto &i:a)cout<<i<<"\t";
    return cout;
}
ostream& operator << (ostream& cout,vvl &a){
    for(auto &i:a){cout<<i<<endl;}
    return cout;
}
ostream& operator << (ostream& cout,vvll &a){
    for(auto &i:a){cout<<i<<endl;}
    return cout;
}
ostream& operator << (ostream& cout,map<l,l> &a){
    for(auto &i:a){
        cout<<i.f<<" ";
    }
    return cout;
}


// GLOBAL VARIABLE AND FUNTIONS
const ll inf = 1e9+7;

int main()
{
#ifndef ONLINE_JUDGE
    // file;
#endif 
	fast;

    l a,b;
    cin>>a>>b;
    if(a>b){
        for(l i=0;i<a;i++){
            cout<<b;
        }
    }
    else if(b>a){
        for(l i=0;i<b;i++){
            cout<<a;
        }
    }
    else{
        while(a--)cout<<b;
    }

#ifndef ONLINE_JUDGE
    // cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
#endif
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s;
	cin >> s;
	if (s == "abc" ||s== "acb" || s=="bca" ||s== "bac" ||s== "bca" ||s== "cab" ||s== "cba") {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	
		

	
		return 0;
}



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

int main(int argc, const char * argv[]) {
    
    
    int tmp,n,four=0,two=0,rest=0;
    
    scanf("%d",&n);
    
    
    for(int i=0;i<n;i++){
        
        scanf("%d",&tmp);
        
        if(tmp%4==0){
            four++;
        }else if(tmp%2==0){
            two++;
        }else{
            rest++;
        }
    }
    
    if(four+1 == rest){
        if(two==0){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }else if(four >= rest){
        printf("Yes\n");
        
    }else {
        printf("No\n");
    }
    
    return 0;
}


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

void rec(int d, long long val, vector<long long> &all) {
    // 格納
    all.push_back(val);

    // 10 桁だったらそれ以上やらずに打ち切り
    if (d == 10) return;

    // 次の桁へ進む処理
    for (int j = -1; j <= 1; ++j) {
        int add = (val % 10) + j;
        if (add >= 0 && add<= 9) rec(d+1, val*10+add, all);
    }
}

int main() {
    int K;
    cin >> K;
    vector<long long> all;
    for (int v = 1; v < 10; ++v) rec(1, v, all);

    // 小さい順に並び替える
    sort(all.begin(), all.end());

    // K 番目
    cout << all[K-1] << endl;
}

Measured memory_bytes: 2420
#include <iostream>

#define ALL(x) x.begin(), x.end()

using namespace std;

int main(){
  int x, a, b; cin >> x >> a >> b;
  if (a>=b) cout << "delicious" << endl;
  else if (b-a<=x) cout << "safe" << endl;
  else cout << "dangerous" << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace CSharp
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = input[0];
            var K = input[1];

            var p = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var max = 0;
            for (int i = 0; i < K; i++)
            {
                max += p[i];
            }
            var temp = max;

            for (int i = 1; i < N - K + 1; i++)
            {
                temp -= p[i - 1];
                temp += p[i + K - 1];
                if (temp > max)
                {
                    max = temp;
                }
            }
            Console.WriteLine($"{(max + K) / 2.0}");
        }
    }
}

Measured memory_bytes: 33116
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	int n; cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	bool flag = true;
	for (int i : a) {
		flag &= i % 2 == 1 || i % 3 == 0 || i % 5 == 0;
	}
	cout << (flag ? "APPROVED" : "DENIED") << endl;
	return 0;
}


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

int main(){
    //A
    /*
    int a;
    cin>>a;
    cout<<a+a*a+a*a*a<<endl;
    */
   //B
   string s,t;
   cin>>s>>t;
   int c=0;
   rep(i,0,s.length()){
       if(s[i]!=t[i]) c++;
   }
   cout<<c<<endl;
}

Measured memory_bytes: 3912
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int main() {
	int H = 0;
	int W = 0;
	while (1)
	{
		cin >> H >> W;
		if (H == 0 && W == 0)
		{
			break;
		}
		for (int i = 0; i < H; i++)
		{
			if (i%2==0)
			{
				for (int i = 0; i < W; i++)
				{
					if (i % 2 == 0)
					{
						cout << "#";
					}
					else
					{
						cout << ".";
					}
				}
				cout << "\n";
			}
			else
			{
				for (int i = 0; i < W; i++)
				{
					if (i % 2 == 1)
					{
						cout << "#";
					}
					else
					{
						cout << ".";
					}
				}
				cout << "\n";
			}
		}
		cout << "\n";
	}
	return 0;
}


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

int main() {
    string S;
    cin >> S;

    if (S == "SUN")cout << 7 << endl;
    if (S == "MON")cout << 6 << endl;
    if (S == "TUE")cout << 5 << endl;
    if (S == "WED")cout << 4 << endl;
    if (S == "THU")cout << 3 << endl;
    if (S == "FRI")cout << 2 << endl;
    if (S == "SAT")cout << 1 << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

typedef long long ll;


int main(){
  int n;
  int ans = 0;
  scanf("%d", &n);
  int a[n+1];
  rep(i,n){
    scanf("%d", &a[i+1]);
  }
  rep(i,n){
    if(a[a[i+1]]==i+1) ans++;
  }
  printf("%d\n",ans/2);
  return 0;
}


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

int main(){

    string s;
    cin>>s;
    if(s=="Sunny") cout<<"Cloudy"<<endl;
    if(s=="Cloudy") cout<<"Rainy"<<endl;
    if(s=="Rainy") cout<<"Sunny"<<endl;


    return 0;
}

Measured memory_bytes: 256
import numpy as np
N, M = map(int, input().split())
s, c = [], []
for i in range(M):
  tmp_s, tmp_c = map(int, input().split())
  s.append(tmp_s)
  c.append(tmp_c)

v_set = [999 for i in range(N)]
if N == 1:
  if M == 0:
    print(0)
  else:
    for i in range(M):
      if v_set[0] == 999 or v_set[0] == c[i]:
        v_set[0] = c[i]
      else:
        v_set[0] = -1
        break
    print(v_set[0])
elif N >= 2:
  for i in range(M):
    if v_set[s[i]-1] == 999 or v_set[s[i]-1] == c[i]:
      v_set[s[i]-1] = c[i]
    else:
      v_set[0] = 0
      break
  if v_set[0] == 0:
    print(-1)
  else:
    if v_set[0] == 999:
      v_set[0] = 1
    for i in range(1,N):
      if v_set[i] == 999:
        v_set[i] = 0
    out = ''
    for i in range(N):
      out += str(int(v_set[i]))
    print(out)
  

Measured memory_bytes: 12500
<?php
list($s, $t) = explode(' ', trim(fgets(STDIN)));
list($scnt, $tcnt) = explode(' ', trim(fgets(STDIN)));
$u = trim(fgets(STDIN));

if ($u === $s) {
    $scnt -= 1;
} else if ($u === $t) {
    $tcnt -= 1;
}

echo $scnt . ' ' . $tcnt.PHP_EOL;

Measured memory_bytes: 4604
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n;
bool bl[110][10];
int p[110][15];
int ans = -10000000000;

signed main() {
	cin >> n;
	for (int i = 1; i <= n; i++)for (int j = 0; j < 10; j++) {
		int a; cin >> a;
		if (a)bl[i][j] = true;
	}
	for (int i = 1; i <= n; i++)for (int j = 0; j <= 10; j++)cin >> p[i][j];
	for (int i = 1; i < 1024; i++) {
		int cnt = 0;
		for (int j = 1; j <= n; j++) {
			int cnt2 = 0;
			for (int k = 0; k < 10; k++)if (bl[j][k] && (i&(1 << k)))cnt2++;
			cnt += p[j][cnt2];
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
int dp[200001];
int h[200001];
int k;
int dpf(int n)
{
       if (dp[n]!=-1) {return dp[n];                 }
  else if (n==0     ) {return dp[n]=INT_MAX;         }
  else if (n==1     ) {return dp[n]=0;               }
  else if (n==2     ) {return dp[n]=abs(h[n]-h[n-1]);}
  else { int mini=INT_MAX ; int kk=min(n-1,k) ; for(int i=1;i<=kk;i++){ mini=min(mini,abs(h[n]-h[n-i])+dpf(n-i)); } ; return dp[n]=mini; }
  return 0;
}
int main()
{  ios_base::sync_with_stdio(false); cin.tie(NULL);
   memset(dp,-1,sizeof(dp));
   int n;cin>>n>>k;
   for(int i=1;i<=n;i++)
   {
    cin>>h[i];
   }
   int ans=dpf(n);
   cout<<ans;
   return 0;
}


Measured memory_bytes: 7680
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };



int main() {
	int H,W;
	scanf("%d%d", &H,&W);
	char a[120][120];

	int delW = 0;
	int delH = 0;

	for(int i=0;i<H;i++)
		scanf("%s", &a[i]);
	
	for (int i = 0; i < W; ) {
		int count = 0;
		for (int j = 0; j < H; j++) {
			if (a[j][i] == '.')count++;
		
		}
		if (count == H) {
			for (int j = i; j < W-1; j++)
				for (int k = 0; k < H; k++)
					a[k][j] = a[k][j+1];
			W--;
		}
		else i++;
	}
	
	for (int i = 0; i < H;) {
		int count = 0;
		for (int j = 0; j < W; j++){
			if (a[i][j] == '.')count++;
		}
		if (count == W) {
			for (int j = i; j < H-1; j++)
				for (int k = 0; k < W; k++)
					a[j][k] = a[j+1][k];
			H--;
		}
		else{
			i++;
		}
	}

	for (int i = 0; i < H; i++)	{
		for (int j = 0; j < W; j++)	{
			printf("%c", a[i][j]);
		}
		printf("\n");
	}
}



/*         提出前の確認事項

・デバッグ用の関数は＜＜コメント化＞＞しているか？
・すべての＜＜入力例＞＞は試したか？
・＜＜限界値分析＞＞はしたか？
・＜＜出力の改行＞＞の有無は確認したか？
・文字列の＜＜スペル＞＞は確認したか？
・＜＜解の存在性＞＞は確認したか？
　　　　　　　　↓
	 ＜＜提出先＞＞に注意して提出！！
*/

Measured memory_bytes: 128
N, M = map(int, input().split())
X, Y = [0]*M, [0]*M
for i in range(M):
  X[i], Y[i] = map(int,input().split())
status = [False]*N; status[0] = True;
ball = [1]*N

for i in range(M):
  ball[X[i]-1] -= 1
  ball[Y[i]-1] += 1
  if status[X[i]-1] == True:
    status[Y[i]-1] = True
    if ball[X[i]-1] == 0:
      status[X[i]-1] = False
      
print(sum(status))

Measured memory_bytes: 12404
#include <stdio.h>
int main(void){
	int a,b,i,j;
	while(1){
		scanf("%d %d",&a,&b);
		if(a==0 && b==0) break;
		printf("%d %d\n",(a>b?b:a),(a>b?a:b));
	}
	return 0;
}

Measured memory_bytes: 600
def main():
    N = int(input())
    A = [int(number) for number in input().split()]
    B = [int(number) for number in input().split()]
    C = [int(number) for number in input().split()]

    ans = sum(B)
    for i in range(N):
        if i > 0:
            if A[i-1]+1 == A[i]:
                ans += C[A[i-1]-1]
    print(ans)

if __name__ == '__main__':
    main()


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

int main() {
  int N;
  cin >> N;
  vector<char> color(N);
  
  for(int i = 0; i < N; i++) {
    cin >> color.at(i);
    if(color.at(i) == 'Y') {
      cout << "Four" << endl;
      break;
    }
    else if(i == N - 1){
      cout << "Three" << endl;
    }
  }
}

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

int main(){
    int H, W;
    string str;
    cin >> H >> W;
    vector<vector<char> > pf (H + 2, vector<char>(W + 2)); 
    for (int i = 0; i < H + 2; i++){
        if((i == 0) or (i == H + 1)){

        } else {
            cin >> str;
        }

        for (int j = 0; j < W + 2; j++){
            if ((i == 0) or (i == H + 1)){
                pf.at(i).at(j) = '#';
            }
            if ((i > 0) and (i <= H)) {
                if ((j == 0) or (j == W + 1)){
                    pf.at(i).at(j) = '#'; 
                } else {
                    pf.at(i).at(j) = str.at(j - 1);
                }
            }
        }
    }


    for (int i = 0; i < H + 2; i++){
        for (int j = 0; j < W + 2; j++){
            cout << pf.at(i).at(j);
        }  
        cout << endl;
    }

}

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

int main()
{
    int n;
    cin>>n;
    map<int,int>cnt;

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

    int ans=0;
    for(auto u:cnt){
        if(u.second>=u.first) ans +=(u.second-u.first);
        else ans +=u.second;
    }
    cout<<ans<<endl;
}

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

using namespace std;

int main() {
  int n;
  while (cin >> n, n) {
    vector<int> k(n);
    for (int i = 0; i < n; i++) {
      cin >> k[i];
    }
    string s;
    cin >> s;
    int keyid = 0;
    for (int i = 0; i < s.size(); i++) {
      char c = s[i];
      int cnt = k[keyid];
      while (0 < cnt) {
        if (c == 'a')
          c = 'Z';
        else if (c == 'A')
          c = 'z';
        else
          c--;
        cnt--;
      }
      s[i] = c;
      keyid = (keyid + 1) % n;
    }
    cout << s << endl;
  }

  return 0;
}


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

int main() {
	int k;
	cin >> k;
	string s;
	cin >> s;

	if (s.size() <= k)	cout << s << endl;
	else {
		for (int i = 0; i < k; i++)
		{
			cout << s[i];
		}
		cout << "...\n";
	}

	return 0;
}

Measured memory_bytes: 3572
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdint>
#include <vector>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;

int main(void){
    i64 x;
    cin >> x;
    vi P5(120);
    for(i64 i=1; i<120; i++) P5[i] = i*i*i*i*i;
    for(i64 a=1; a<120; a++){
        i64 a5 = P5[a];
        for(i64 b=-a; b<a; b++){
            i64 b5 = (b>=0 ? P5[b] : -P5[-b]);
            if(a5-b5 == x){
                cout << a << ' ' << b << '\n';
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3588