akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define FAST ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define f(i,n) for(int i=0 ; i<n ; i++)
#define fll(i,n) for(ll i=0 ; i<n ; i++)
#define f1(a,b,i) for(ll i=a ; i<b ; i++)
#define fd(i,n) for(int i=n-1 ; i>=0 ; i--)
#define ll long long
#define ld long double
#define vi vector<int>
#define  pii pair<int,int>
#define vl vector<ll>
#define INF 1e9
#define epsn 1e-12

using namespace std ;
int M=1e9+7 ;
ll pow(ll a, ll b){
    if(b==0)return 1 ;
    else if(b%2)return a*pow(a,b-1) ;
    else return pow(a,b/2)*pow(a,b/2) ;
}

int main(){
    ll n,x,ans=1e9,temp,pos,M=0 ;
    cin>>x>>n ;

    map<ll,ll>m ;

    fll(i,n){
        cin>>temp ;
        m[temp]++ ;
        M=max(M,temp) ;
    }
    if(x>M)pos=x ;
    else{
    for(ll i=0 ;i<=M+1 ; i++){
        if(!m[i]){
            ll d=abs(x-i) ;
            if(d<ans){
                ans=d ;
                pos=i ;
            }
        }
    }}

    cout<<pos<<'\n' ;
    return 0 ;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(x) x.begin(),x.end()
typedef long long ll;
ll mod = 1000000007;
ll inf = 1e18;
int main(){

    int n;
    cin >> n;
    vector<int> a(n),b(n),c(n);
    rep(i,n) cin >> a[i];
    sort(all(a));
    rep(i,n) cin >> b[i];
    sort(all(b));
    rep(i,n) cin >> c[i];
    sort(all(c));
    
    ll sum=0;
    rep(i,n){
        auto x=lower_bound(all(a),b[i]);
        ll pos1 = distance(a.begin(),x);
        auto y=upper_bound(all(c),b[i]);
        ll pos2 = distance(c.begin(),y);
        sum+=pos1*(n-pos2);
    // cout << pos1 << ' ' << n-pos2 << ' ' << sum << endl;
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 4560
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True
#for i in range(n):

ans=0

n=I()
s,t=input().split()

ans=[]
for i in range(n):
    ans.append(s[i]+t[i])


print(''.join(ans))




Measured memory_bytes: 39276
import java.util.*;
class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int X = sc.nextInt();
        int[] a = new int[N];
        for(int i = 0 ;i < N; i++){
            a[i] = Math.abs(sc.nextInt() - X);
        }

        for(int i = 1; i < N; i++){
            a[i] = Yuu(Math.max(a[i], a[i-1]), Math.min(a[i], a[i-1]));
        }
        System.out.println(a[N-1]);

    }

    public static int Yuu (int a, int b)
    {
        int res = 1;
        while(a > 1 && b > 1){
            a %= b;
            if(a == 0){
                res = b;
            }
            else if(a == 1){
                res = 1;
            }
            else{
                int c = a;
                a = b;
                b = c;
            }
        }
        return res;
    }
}

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

using namespace std;

int main(){
  string s;
  
  cin >> s;
 
 long long int dp[100010][2]={};
  
  dp[0][0]=1;
  
  for(int i=0;i<s.size();i++){
    
    dp[i+1][1] += 3*dp[i][1];
    
    if(s[i]=='1'){
    
      dp[i+1][0] += 2*dp[i][0];
     
    
      dp[i+1][1] += dp[i][0];
    }
    else{
      
      dp[i+1][0] += dp[i][0];
      
     
    }
    
    dp[i+1][0]%=1000000007;
    
    dp[i+1][1]%=1000000007;
  }
  
  cout << (dp[s.size()][0]+dp[s.size()][1])%1000000007 << endl;
}


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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

// [1, n]
ll calc_xor(ll n)
{
    if (n%4 == 0) return n;
    if (n%4 == 1) return 1;
    if (n%4 == 2) return n+1;
    return 0;
}

// [a, b]
ll calc_range_xor(ll a, ll b)
{
    return calc_xor(b)^calc_xor(a-1);
}

int main()
{
    ll a, b;
    cin >> a >> b;
    cout << calc_range_xor(a, b) << endl;
}


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

#define DEBUG(C) cerr << #C << " = " << C << endl

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  bool f = (a % 3 == 0) || (b % 3 == 0) || ((a + b) % 3 == 0);
  cout << (f ? "Possible" : "Impossible") << endl;
  return 0;
}

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

double getProbability (const vector <double> &p) {
    int n = p.size();
    vector <double> dp(n + 1);
    dp[0] = 1;
    for (int i = 1; i <= n; ++i) {
        vector <double> curr(n + 1);
        for (int j = 0; j <= n; ++j) {
            if (j > 0) {
                curr[j] += dp[j - 1] * p[i - 1];
            }
            curr[j] += dp[j] * (1 - p[i - 1]);
        }
        dp = curr;
    }
    double result = 0;
    for (int heads = 0; heads <= n; ++heads) {
        int tails = n - heads;
        if (heads > tails) {
            result += dp[heads];
        }
    }
    return result;
}

int main() {
    int n;
    cin >> n;
    vector <double> p(n);
    for (int i = 0; i < n; ++i) {
        cin >> p[i];
    }
    double result = getProbability(p);
    printf("%.10f\n", result);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<ll,P> pip;
typedef vector<pip> vip;
const ll INF=1ll<<60;

class Union_Find_Tree{
	public:
	vi p,r;
	Union_Find_Tree(int n){
		p=r=vi(n);
		for(int i=0;i<n;i++) p[i]=i;
	}
	int Par(int x){
		if(p[x]==x) return x;
		return p[x]=Par(p[x]);
	}
	bool Unite(int x,int y){
		x=Par(x);
		y=Par(y);
		if(x==y) return 0;
		if(r[x]<r[y]) p[x]=y;
		else{
			p[y]=x;
			if(r[x]==r[y]) r[x]++;
		}
		return 1;
	}
};

const P Inf={INF,INF};
ll n;
vl a,b;
vp dp[2];
vvp g;
vvi G;

void dfs(int v,int pre){
	vp c;
	c.push_back(Inf);
	c.push_back(Inf);
	for(auto p:g[v]){
		ll u=p.first,w=p.second;
		if(u!=pre){
			dfs(u,v);
			P p1=dp[0][u],p2=dp[1][u];
			c.push_back({p1.first+w,p1.second});
			c.push_back({p2.first+w,p2.second});
			c.push_back({a[u]+w,b[u]});
		}
	}
	sort(c.begin(),c.end());
	ll t=INF,I=0;
	for(auto p:c){
		ll tmp=p.second;
		if(tmp!=t||tmp==INF){
			t=tmp;
			dp[I++][v]=p;
		}
		if(I==2) break;
	}
}

void DFS(int v,int pre,ll d){
	if(pre>=0){
		vp c;
		c.push_back(dp[0][v]);
		c.push_back(dp[1][v]);
		c.push_back({dp[0][pre].first+d,dp[0][pre].second});
		c.push_back({dp[1][pre].first+d,dp[1][pre].second});
		c.push_back({d+a[pre],b[pre]});
		sort(c.begin(),c.end());
		ll t=INF,I=0;
		for(auto p:c){
			ll tmp=p.second;
			if(tmp!=t||tmp==INF){
				t=tmp;
				dp[I++][v]=p;
			}
			if(I==2) break;
		}
	}
	for(auto p:g[v]){
		ll u=p.first,w=p.second;
		if(u!=pre) DFS(u,v,w);
	}
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll d;
	cin>>n>>d;
	a=b=vl(n);
	g=vvp(n);
	G=vvi(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n-1;i++){
		g[i].push_back({i+1,d});
		g[i+1].push_back({i,d});
	}
	Union_Find_Tree uft(n);
	ll cnt=0,res=0;
	while(1){
		dp[0]=dp[1]=vp(n,Inf);
		vl c(n);
		for(int i=0;i<n;i++){
			b[i]=uft.Par(i);
			c[b[i]]=i;
		}
		dfs(0,-1);
		DFS(0,-1,0);
		map<ll,P> mp;
		for(int v=0;v<n;v++){
			P p=dp[0][v];
			if(p.second==b[v]) p=dp[1][v];
			if(mp.find(b[v])==mp.end()) mp[b[v]]=Inf;
			P pre=mp[b[v]];
			mp[b[v]]=min(pre,{p.first+a[v],p.second});
		}
		for(auto i=mp.begin();i!=mp.end();i++){
			P p=i->second;
			ll u=c[i->first],v=c[p.second];
			if(uft.Unite(u,v)) res+=p.first,cnt++;
		}
		if(cnt==n-1) break;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 72192
#include <stdio.h>

#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#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 STR(i,str) for(int i=0;(str)[i];i++)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX3(a,b,c) ((a)>(b)?(a)>(c)?(a):(c):(b)>(c)?(b):(c))
#define MIN3(a,b,c) ((a)<(b)?(a)<(c)?(a):(c):(b)<(c)?(b):(c))
#define RNG(a,b) ((a)>(b)?(a)-(b):(b)-(a))
#define RNG3(a,b,c) ((a)>(b)?(b)>(c)?(a)-(c):(c)>(a)?(c)-(b):(a)-(b):(b)>(c)?(c)>(a)?(b)-(a):(b)-(c):(c)-(a))
#define MAXS(a,b) {if((a)<(b))(a)=(b);}
#define MINS(a,b) {if((a)>(b))(a)=(b);}

int main(){
	int n;
	int count = 0, ans = 0;
	scanf("%d", &n);
	REP(i, n){
		int hoge;
		scanf("%d", &hoge);
		if(i + 1 == hoge){
			count++;
			if(count%2) ans++;
		}else count = 0;
	}
	printf("%d\n", ans);
}

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

#define endl "\n"
#define PB push_back
#define F first 
#define S second
#define int long long 
#define Runner_up ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
vector <int> g[100005];
signed main()
{	
	Runner_up 
	int t=1; //cin>>t;
	while(t--){
		int x; cin>>x;
		
		for(int i=-255; i<=255; i++){
			for(int j=-255; j<=255; j++){
		    	int z = pow(i, 5) - pow(j, 5);
				if(z == x) return cout<<i<<" "<<j, 0; 
			}
		}
		
	}
	return 0;	
}

Measured memory_bytes: 6372
n=int(input())
a=list(map(int,input().split()))
aa=sorted(a)
ans1=0
ans2=0
for i in range(n):
  if i%2==0:
    ans1+=aa[i]
  else:
    ans2+=aa[i]
print([ans2-ans1,ans1-ans2][n%2])

Measured memory_bytes: 8860
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace Atcoder_Answer
{
    class Program
    {
        const int mod = 1000000007;

        static void Main(string[] args)
        {
            string[] Reader = ReadLine().Split(' ');
            int N = int.Parse(Reader[0]); 
            int R = int.Parse(Reader[1]);

            if (N >= 10)
            {
                WriteLine(R);
            }
            else WriteLine(R + 100 * (10 - N));
        }

    }

    class IntString 
    {
        public int IntValue { get; set; }
        public string StrValue { get; set; }

        public static IntString operator ++(IntString THIS) 
        {
            return new IntString() { IntValue = THIS.IntValue++, StrValue = THIS.StrValue };
        }
    }
    
    public static class Extension
    {
        #region 拡張:bool
        #region キャスト関連
        public static int ToInt(this bool Bool)
        {
            if (Bool) return 1;
            else return 0;
        }

        public static string ToString(this bool Bool, string TrueStr, string FalseStr)
        {
            if (Bool) return TrueStr;
            else return FalseStr;
        }
        #endregion
        #endregion

        #region 拡張:int
        #region キャスト関連
        public static char ToAlphaBets(this int Base) => (char)Base;
        #endregion
        #endregion

        #region 拡張:char
        #region 変換関連
        public static char NextAlpha(this char Char) => (char)((Char) + 1); //次の文字を取得
        #endregion
        #endregion

        #region 拡張:int[]
        public static long Sum(this int[] Array)
        {
            int Ret = 0;
            for (int loop = 0; loop < Array.Length; loop++) Ret += Array[loop];
            return Ret;
        }
        #endregion

        #region 拡張: string
        public static string Multi(this string THIS, int Value) 
        {
            string RetValue = "";

            for (int loop = 0; loop < Value; loop++) RetValue += THIS;

            return RetValue;
        }
        #endregion

        #region 拡張: List<string>
        public static string Sum(this List<string> THIS, string Split) 
        {
            string RetValue = "";

            for (int loop = 0; loop < THIS.Count; loop++) 
            {
                RetValue += THIS[loop];
            }

            return RetValue;
        }
        #endregion
    }
}


Measured memory_bytes: 11092
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned int ui;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
#define All(v) (v).begin(),(v).end()
#define Rep(i,n) for(int i = 0; i < (int)n; i++)
#define Reps(i,n) for(int i = 1; i <= (int)n; i++)
#define For(i,m,n) for(int i = m; i < n; i++)
#define Fors(i,m,n) for(int i = m; i <= n; i++)
#define inf 2e9
#define f first
#define s second
#define pb push_back
#define mp make_pair
struct speed{speed(){cin.tie(); ios::sync_with_stdio(false); cout << fixed << setprecision(18);}}speed;

int dy[] = {0,0,1,-1};
int dx[] = {1,-1,0,0};

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

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


int main (){
    int n,m;
    cin >> n >>m;
    vector<p> lr(m,mp(0,0));
    Rep(i,m){
        cin >> lr[i].f >> lr[i].s;
    }
    int maxl = 0;
    int minr = n;
    Rep(i,m){
        maxl = max(lr[i].f,maxl);
        minr = min(lr[i].s,minr);
    }
    if(maxl > minr) cout << 0 << "\n";
    else cout << minr-maxl+1 << endl;
}

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

int main() {
	string S;
	cin >> S;
	string S1 = "RRR", S2 = "RRS", S3 = "SRR", S4 = "SSS";

	if (S == S1) {
		cout << 3 << endl;
	}
	else if (S == S2 || S == S3) {
		cout << 2 << endl;
	}
	else if (S == S4) {
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;
	}

}

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

int main() {
  int h,w;
  cin >> h >> w;
  vector<vector<int>> maze(h,vector<int>(w));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      char c;
      cin >> c;
      if(c == '.'){
        maze[i][j] = 1;
      }else{
        maze[i][j] = 0;
      }
    }
  }
  
  vector<vector<int>> right(h,vector<int>(w));
  vector<vector<int>> left(h,vector<int>(w));
  vector<vector<int>> up(h,vector<int>(w));
  vector<vector<int>> down(h,vector<int>(w));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(maze[i][j] == 0) continue;
      if(j==0){
        left[i][j] = 1;
      }else{
        left[i][j] = left[i][j-1] + 1;
      }
      if(i==0){
        up[i][j] = 1;
      }else{
        up[i][j] = up[i-1][j] + 1;
      }
    }
  }
  
  for(int i=h-1;i>=0;i--){
    for(int j=w-1;j>=0;j--){
      if(maze[i][j] == 0) continue;
      if(j==w-1){
        right[i][j] = 1;
      }else{
        right[i][j] = right[i][j+1] + 1;
      }
      if(i==h-1){
        down[i][j] = 1;
      }else{
        down[i][j] = down[i+1][j] + 1;
      }
    }
  }
  
  //vector<vector<int>> dp(h,vector<int>(w));
  int ans=0;
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      int light=right[i][j]+left[i][j]+up[i][j]+down[i][j]-3;
      if(ans < light){
        ans = light;
      }
    }
  }
  
  cout << ans << endl;
  
  return(0);
}

Measured memory_bytes: 81644
N=int(input())
plist=list(map(int,input().split()))

sit=[[1]*N for _ in range(N)]
dist=[[min(i,j,N-1-i,N-1-j) for j in range(N)] for i in range(N)]

answer=0
for p in plist:
  i=(p-1)//N
  j=(p-1)%N
  #print(i,j)
  sit[i][j]=0
  answer+=dist[i][j]
  
  queue=[(i,j,dist[i][j])]
  d=0
  while queue:
    x,y,d=queue.pop()
    if x>0 and dist[x-1][y]>d:
      dist[x-1][y]=d
      queue.append((x-1,y,d+sit[x-1][y]))
    if x<N-1 and dist[x+1][y]>d:
      dist[x+1][y]=d
      queue.append((x+1,y,d+sit[x+1][y]))    
    if y>0 and dist[x][y-1]>d:
      dist[x][y-1]=d
      queue.append((x,y-1,d+sit[x][y-1]))
    if y<N-1 and dist[x][y+1]>d:
      dist[x][y+1]=d
      queue.append((x,y+1,d+sit[x][y+1]))
      
print(answer)

Measured memory_bytes: 188468
#include<iostream>
using namespace std;
const int maxn=105;
int main(){
    int a=0,b=0,c=0;
    char s[maxn];
    scanf("%s",s);
    for (int i=0; i<3; ++i) {
        if (s[i]=='a') {
            a++;
        }
        else if(s[i]=='b'){
            b++;
        }
        else if(s[i]=='c'){
            c++;
        }
    }
    if(a==1&&b==1&&c==1){
        printf("Yes\n");
    }
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] di = new int[N];
            string[] D = Console.ReadLine().Split(' ');
            for(int i=0; i<N;i++)
            {
                di[i] = int.Parse(D[i]);
            }
            long sum = 0;
            for(int i=0;i<N-1;i++)
            {
                for(int j=i+1;j<N;j++)
                {
                    sum = sum + (di[i] * di[j]);
                }
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 27440
#include<iostream>

using namespace std;

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

	for (int i = 0; i <= A; i++) {
		if ((N - i) % 500 == 0) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
def c_typical_stairs(N, M, A, MOD=10**9 + 7):
    a = set(A)
    stairs = [0] * (N + 1)
    stairs[0] = 1
    for i in range(N):
        if i + 1 <= N and (i + 1) not in a:
            stairs[i + 1] += stairs[i]
        if i + 2 <= N and (i + 2) not in a:
            stairs[i + 2] += stairs[i]
    return stairs[N] % MOD

N, M = [int(i) for i in input().split()]
A = [int(input()) for _ in range(M)]
print(c_typical_stairs(N, M, A))

Measured memory_bytes: 462708
import numpy
import re
import math

def main():
	"""
	テストコード実行
	:return:
	"""
	n, y = map(int, re.split(" +", input()))
	flag = False
	for i in range(0, n + 1):
		if flag is True:
			break
		for j in range(0, n + 1):
			if y == 10000 * i + 5000 * j + 1000 * (n - i - j) and n - i - j >= 0:
				print("{} {} {}".format(i, j, n - i - j))
				flag = True

	if flag is False:
		print("-1 -1 -1")

if __name__ == '__main__':
	main()

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

int main(){
int a;
 cin>>a;
vector<long long>b(a+1);
  b[0]=2;
  b[1]=1;
  for(int i=0;i<a-1;i++){
    b[i+2]=b[i]+b[i+1];
  }
  cout<<b[a]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  
  cin >> A;
  
  map<string, int> OOT;
  vector<string> JNY(200);
  vector<string> TKB(200);
  vector<int> PPP(200);
  
  for(int YUNI=0;YUNI < A; YUNI++){
    cin >> JNY.at(YUNI);
  }
  
  for(int YUNI=0;YUNI < A; YUNI++){
    OOT[JNY.at(YUNI)]++;
  }
  
  cin >> B;
  
  for(int YUNI=0;YUNI < B; YUNI++){
    cin >> TKB.at(YUNI);
  }
  
  for(int YUNI=0;YUNI < B; YUNI++){
    OOT[TKB.at(YUNI)]--;
  }
  
  vector<int> TOKYO(100);
  
  for(int YUNI=0;YUNI < A; YUNI++){
    TOKYO.at(YUNI) = OOT[JNY.at(YUNI)];
  }
  
  int D = *max_element(TOKYO.begin(), TOKYO.end());
  
  //if(D <= 0){
  //  D = 0;
  //}
  
  cout << D << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b&& b==c) printf("No\n");
    else if(a==b) printf("Yes\n");
    else if(b==c)printf("Yes\n");
    else if(a==c)printf("Yes\n");

    else printf("No\n");




    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    ll n, *a;   cin >> n;
    a = new ll[n];
    for (int i = 0; i < n; i++)
        a[i] = 0;

    for (int i = 0; i < n-1; i++) {
        ll b;   cin >> b;
        b--;
        a[b]++;
    }   

    for (int i = 0; i < n; i++)
        cout << a[i] << endl;
    return 0;
}

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

typedef long long ll;
const ll MOD=1e9+7;
const ll LINF=1LL<<61;
ll dp[110][100000];
int main(){
  int n,W;
  cin>>n>>W;
  vector<ll> w(n+10),v(n+10);
  for(int i=1;i<=n;i++)cin>>w[i]>>v[i];
  for(int i=0;i<=n;i++){
    for(int j=0;j<=W;j++){
      dp[i][j]=-LINF;
      dp[0][0]=0;
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=0;j<=W;j++){
      if(j>=w[i]){
        dp[i][j]=max(dp[i][j],dp[i-1][j-w[i]]+v[i]);
      }
      dp[i][j]=max(dp[i][j],dp[i-1][j]);
    }
  }
  ll ans=0;
  for(int i=0;i<=W;i++)ans=max(ans,dp[n][i]);
  cout<<ans<<endl;
}

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

void Main() {
    // input
    u_int64_t N, D;
    cin >> N >> D;



    // process
    u_int64_t count = 0;
    for (u_int64_t i = 0; i < N; i++) {
        int64_t x, y;
        cin >> x >> y;
        if (x*x + y*y <= D*D) {
            count++;
        }
    }


    // output
    cout << count << endl;

}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
#define MAX_N 1001

int main(void) {
	int num, m, n, i, j;
	int cim1[MAX_N], ci[MAX_N];
	char x[MAX_N], y[MAX_N], xi;

	scanf("%d ", &num);
	while (num--) {
		scanf("%s %s ", x, y);
		m = strlen(x);
		n = strlen(y);

		for (i = 0; i < n+1; i++) {
			ci[i] = cim1[i] = 0;
		}
		for (i = 1; i < m+1; i++) {
			xi = x[i-1];
			for (j = 1; j < n+1; j++) {
				if (xi == y[j-1]) {
					ci[j] = cim1[j-1] + 1;
				} else if (cim1[j] >= ci[j-1]) {
					ci[j] = cim1[j];
				} else {
					ci[j] = ci[j-1];
				}
			}
			for (j = 1; j < n+1; j++) {
				cim1[j] = ci[j];
			}
		}
		printf("%d\n", cim1[n]);
	}
	return 0;
}

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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<long long> vecll;
typedef vector<unsigned long long> vecull;

constexpr ll MOD = 998244353;

constexpr int MAX = 510000;

ll fac[MAX], finv[MAX], inv[MAX];

// nCr 計算用初期化処理
// O(MAX)
void comb_init()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;

    for (int i = 2; i < MAX; ++i)
    {
        fac[i] = fac[i - 1] * i % MOD;                 // 累乗の累積
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; // 逆元
        finv[i] = finv[i - 1] * inv[i] % MOD;          // 逆元の累積
    }
}

// nCr mod MOD を計算する。
// O(1)
ll comb(int n, int r)
{
    if (n < r)
        return 0;
    if (n < 0 || r < 0)
        return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod; // nを2進法で展開したとき、1が立っている累乗の部分を結果に乗じていく
        a = a * a % mod; // aの2乗4乗8乗……を求めていく
        n >>= 1;
    }

    return res;
}

ll N, M, K;



int main(void) {
    comb_init();
    cin >> N >> M >> K;

    ll ans = 0;
    for (int k = 0; k <= K; ++k) {
        // N - k 個違う色で並べる
        ll t = (M * modpow(M - 1, N - k - 1, MOD)) % MOD;

        // 組み合わせるk個のブロックを入れる場所を選択する
        t = (t * comb(N - 1, k)) % MOD;

        ans = (ans + t) % MOD;
    }

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

Measured memory_bytes: 15592
using System.Linq;
using System;
using System.IO;

class Program
{
  static void Main(string[] args) => new Program().solve();

  private void solve()
  {
    var seq = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    var d = seq[0];
    var n = seq[1];

    if(n == 100) n++;
    var ans = n * Convert.ToInt32(Math.Pow(100,d));

    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,a,b;
cin>>n>>a>>b;
for(int i=a;i<=b;i++)
{
    if(i%n==0)
    {
        cout<<"OK"<<endl;
        return 0;
    }
}
cout<<"NG"<<endl;
    return 0;
}

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

using namespace std;

int main() {
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    bool okay = false;
    if (k == 0) okay = true;
    for (int i = 0; i <= n; i++) {
        int t = i*m;
        for (int j = 0; j <= m; j++) {
            int tmp = t-i*j+j*(n-i);
            if (tmp == k) okay = true;
        }
    }
    if (okay) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
using namespace std;

int main()
{
	string s;
	cin >> s;
	for (int i = 1; i <= s.size(); i++) {
		if (i % 2 != 0) {
			cout << s[i - 1];
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n; string s; cin >> s;
	if (s == "Sunny") {
		cout << "Cloudy" << endl;
	}
	if (s == "Cloudy") {
		cout << "Rainy" << endl;
	}
	if (s == "Rainy") {
		cout << "Sunny" << endl;
	}
	cin >> n;
}

Measured memory_bytes: 256
<?php

class Operator
{
    private $operated_keys;
    private $operations_count;

    public function doOperations()
    {
        fscanf(STDIN, '%d', $this->operations_count);
        $this->operated_keys = new \SplDoublyLinkedList();
        for (;$this->operations_count > 0;$this->operations_count -= 1) {
            $operation = explode(' ', trim(fgets(STDIN)));
            if ($operation[0] === 'insert') {
                $this->operated_keys->unshift($operation[1]);
            } elseif ($operation[0] === 'deleteFirst') {
                $this->operated_keys->shift();
            } elseif ($operation[0] === 'deleteLast') {
                $this->operated_keys->pop();
            } elseif ($operation[0] === 'delete') {
                foreach ($this->operated_keys as $key => $element) {
                    if ($element === $operation[1]) {
                        $this->operated_keys->offsetUnset($key);
                        break;
                    }
                }
            }
        }
    }

    public function getAnswer()
    {
        $keys_operated = array();

        while (count($this->operated_keys) > 0) {
            $keys_operated[] = $this->operated_keys->shift();
        }
        echo implode(' ', $keys_operated), PHP_EOL;
    }
}

$operator = new Operator();
$operator->doOperations();
$operator->getAnswer();



Measured memory_bytes: 136156
#include <bits/stdc++.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define uni(x) (x).erase(unique(x.begin(),x.end()),x.end())
typedef long long lint;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
using Graph=vector<vector<int>>;

int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}

int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}

int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}

int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}

int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

int main(){
  string s;
  cin>>s;
  int n=s.size();
  if(s[n-1]=='s') s+="es";
  else s+='s';
  cout<<s<<endl;
}

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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    if (B <= C || D <= A)
    {
        cout << 0 << endl;
        return 0;
    }
    int ans = 0;
    ans = min(B, D) - max(A, C);
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long ll;
typedef pair<ll,ll> P;


int n, i;

int main(){
	cin >> n >> i;
	cout << n-i +1<< endl;
	
	return 0;
}

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

using namespace std;

#define MAX_N 1000000000

int gcd(const int x, const int y)
{
    if (x < y)
        return gcd(y, x);
    else if (x % y == 0)
        return y;
    else
        return gcd(y, x - y);
}

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

    int d;
    for (int i = 0; i < n; i++)
    {
        int a;
        scanf("%d", &a);
        if (i > 0)
            d = gcd(abs(a - x), d);
        else
            d = abs(a - x);
    }

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

    return 0;
}


Measured memory_bytes: 256
using System.Linq;
using System.Text;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Diagnostics;
using System.Reflection.Metadata;
using System.Threading;
using System.Runtime.CompilerServices;

namespace AtCoder
{
    class Program
    {

        struct Point
        {
            public int x;
            public int y;

            public Point(int x, int y)
            {

                this.x = x;
                this.y = y;

            }

        }


        const int BiggestMod = 1000000007;

        public static void Main()
        {

            var n = int.Parse(Console.ReadLine());
            var args = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            var a = args[0] + 1;
            var b = args[1] + 1;

            var ans = new int[3] { 0, 0, 0 };

            args = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            foreach (var info in args)
                if (info < a)
                    ans[0]++;
                else if (info < b)
                    ans[1]++;
                else
                    ans[2]++;

            Console.WriteLine(ans.Min());

        }

    }

}

Measured memory_bytes: 28312
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>

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

using namespace std;

typedef long long ll;

string s;

int main() {

//    cin.rdbuf(in.rdbuf());

    cin >> s;

    char a = s[0];
    int ac = 1;
    char b = '0';
    int bc = 0;
    bool ans = true;
    REP(i, 4) {
        if (i == 0) {

        } else {
            if (s[i] == a) {
                ac ++;
            } else {
                if (b == '0') {
                    b = s[i];
                    bc ++;
                } else {
                    if (s[i]!= b) {
                        break;
                    } else {
                        bc ++;
                    }
                }
            }
        }
    }
    if (ac == 2 && bc == 2) {
        cout << "Yes";
    } else {
        cout << "No";
    }


    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int a[300000];
int f[50000000];
bool bad[5000000];

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

    for(int i=1;i<=m;i++)
        cin>>a[i];
    f[1] = 1;
    f[2] = 2;
    for(int i=1;i<=m;i++)
        bad[a[i]] = true;
    if(bad[1] == true)
    {
        f[1] = 0;
        f[2] = 1;
    }
    if(bad[2] == true)
        f[2] = 0;
    for(int i=3;i<=n;i++)
    {
        if(bad[i] == true)
            f[i] = 0;
        else
        {
            f[i] = f[i-1] + f[i-2];
            f[i] = f[i] % 1000000007;
        }
        
    }
    cout<<f[n]%1000000007;
}

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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

template <typename T>
inline void chkmax(T &x, T y) { if (x < y) x = y; }

template <typename T>
inline void chkmin(T &x, T y) { if (x > y) x = y; }

inline int read() {
  #define nc getchar()
  int x = 0;
  char c = nc;
  while (c < 48) c = nc;
  while (c > 47) x = (x << 3) + (x << 1) + (c ^ 48), c = nc;
  return x;
  #undef nc
}

const int P = 1e9 + 7;
bool vis[305][305][305];
int n, m, ans, state_mn[305][3], state_mx[305][3], dp[305][305][305];

inline void Add(int &x, int y) {
  x += y;
  if (x >= P) x -= P;
}

void work(int i, int j, int k) {
  if (vis[i][j][k]) return;
  vis[i][j][k] = 1;
  int pos[4];
  pos[1] = i, pos[2] = j, pos[3] = k;
  sort(pos + 1, pos + 4);
  reverse(pos + 1, pos + 4);
  int tmn, tmx;
  tmn = state_mn[pos[1]][1];
  tmx = state_mx[pos[1]][1];
  if (tmn && pos[2] >= tmn) {
    return;
  }
  tmn = state_mn[pos[1]][2];
  tmx = state_mx[pos[1]][2];
  if (tmn && (pos[3] >= tmn || pos[2] < tmx)) {
    return;
  }
  tmn = state_mn[pos[1]][3];
  tmx = state_mx[pos[1]][3];
  if (tmn && pos[3] < tmx) {
    return;
  }
  int tmp = pos[1] + 1;
  int val = dp[i][j][k];
  if (tmp > n) {
    Add(ans, val); return;
  }
  Add(dp[tmp][j][k], val);
  Add(dp[i][tmp][k], val);
  Add(dp[i][j][tmp], val);
}

int main() {
  n = read(), m = read();
  rep(i, 1, m) {
    int l = read(), r = read(), x = read();
    int &mn = state_mn[r][x], &mx = state_mx[r][x];
    if (!mn) {
      mn = mx = l;
    } else {
      chkmin(mn, l), chkmax(mx, l);
    }
  }
  dp[1][0][0] = dp[0][1][0] = dp[0][0][1] = 1;
  rep(mx, 1, n) {
    rep(p, 0, mx - 1) {
      rep(q, 0, max(0, p - 1)) {
        work(mx, p, q);
        work(mx, q, p);
        work(p, mx, q);
        work(p, q, mx);
        work(q, mx, p);
        work(q, p, mx);
      }
    }
  }
  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 138496
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#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 <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

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();}

int main(){
    std::ios::sync_with_stdio(false);
    string s;
    deque<char> pre, suf;
    int q, t, f;
    int reverse = 0;
    char c;
    cin >> s >> q;
    for(int i=0;i<q;++i)
    {
        cin >> t;
        if(t == 1)
        {
            reverse = 1 - reverse;
        }
        else
        {
            cin >> f >> c;
            string app(1, c);
            if((f == 1 && !reverse) || (f == 2 && reverse))
            {
                pre.push_front(c);
            }
            else
            {
                suf.push_back(c);
            }
        }
    }
    string ret = string(pre.begin(), pre.end()) + s + string(suf.begin(), suf.end());
    if(reverse)
    {
        ret = string(ret.rbegin(), ret.rend());
    }

    cout << ret << endl;
}

Measured memory_bytes: 1300
// pnEans.cpp.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MX = 2005;
bool d[3][3][MX];

int main()
{
	vector<string> s(3);
	rep(i, 3) cin >> s[i];
	sort(s.begin(), s.end());
	int ans = MX*3;
	do {
		rep(i, 3)rep(j, 3)rep(k, s[i].size()) {
			if (i >= j)continue;
			bool ok = true;
			for (int ni = k; ni < s[i].size(); ni++) {
				int nj = ni - k;
				if (nj >= s[j].size())break;
				if (s[j][nj] == '?' || s[i][ni] == '?')continue;
				
				if (s[i][ni] != s[j][nj]) {
					ok = false;
					break;
				}
			}
			d[i][j][k] = ok;
		}
		auto f = [&](int i, int j, int k) {
			if (k >= s[i].size())return true;
			return d[i][j][k];
		};
		rep(x, MX)rep(y, MX) {
			if (!f(0, 1, x))continue;
			if (!f(1, 2, y))continue;
			if (!f(0, 2, x+y))continue;
			int now = 0;
			now = max<int>(now, s[0].size());
			now = max<int>(now, x + s[1].size());
			now = max<int>(now, x + y + s[2].size());
			ans = min(ans, now);
		}
	} while (next_permutation(s.begin(), s.end()));

	cout << ans << endl;

	
	return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
S = input()


week = {
  "MON": 1,
  "TUE": 2,
  "WED": 3,
  "THU": 4,
  "FRI": 5,
  "SAT": 6
}

if S == "SUN":
  print(7)
else:
  print(7 - week[S])


Measured memory_bytes: 38256
#include<bitset>
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, a, n) for(int i=(a);i<(int)(n);i++)
#define repc(i, a, n) for(int i=(a);i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;
#define DBG(str) cerr<<(str)<<endl;
int main() {
	int h, w;
	cin >> h >> w;
	auto s = mat(char,h+2, w+2, '.');
	rep(i, 0, h)rep(j,0,w)cin >> s[i+1][j+1];
	
	bool ng = false;

	rep(i, 0, h) {
		rep(j, 0, w) {
			if (s[i][j] == '#') {
				char c = '.';
				int d = 0;
				if (s[i + 1][j] == c)d++;
				if (s[i - 1][j] == c)d++;
				if (s[i][j + 1] == c)d++;
				if (s[i][j - 1] == c)d++;
				if (d == 4)ng = 1;
			}

		}
	}
	Yes(!ng);

	return 0;
}





Measured memory_bytes: 256
answers = Array.new

while line = $stdin.gets
	d = line.chomp.to_i
	sum = 0
	count = 600 / d 
	count.times{ |n|
		xsize = d
		ysize = n * d
		rect  = xsize * ( ysize * ysize)
		sum += rect
	}
	answers << sum	
end

answers.each{ |a| puts a }


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

int main() {
	char r;
	stack<int> my_stack;
	stack<pair<int,int> > area_k; //存储已存在积水面积
	int i = 0;
	int area=0,f_area=0;
	while (cin >> r) {
		i++;
		if (r == '\\') {	
			my_stack.push(i);
		}
		else if (r == '/' && !my_stack.empty()) {
              int index = my_stack.top(); //栈内未计算
			  my_stack.pop();
			  f_area = i - index; //新计算的积水面积
			  area += f_area;
			  //判断是否与已存在的积水区域合并
			  //若已存在的积水区域最左侧下标j>新的积水区域的最左侧index,则合并
			  while (!area_k.empty() && area_k.top().first>index) {
				  int j = area_k.top().first;
				  f_area += area_k.top().second;
				  area_k.pop();
			  }

			  area_k.push(make_pair(index,f_area));

			
			
		}
	}
	vector<int> output_area;
	while (!area_k.empty()) {
		output_area.push_back(area_k.top().second);
		area_k.pop();
	}
	reverse(output_area.begin(), output_area.end());

	cout << area << endl;
	cout << output_area.size();
	for (vector<int>::iterator iter = output_area.begin(); iter != output_area.end();iter++) {
		cout << " " << *iter;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int takahashiLife = a / d;
  int aokiLife = c / b;
  if (a % d > 0) {
    takahashiLife = takahashiLife + 1;
  }
  if (c % b > 0) {
    aokiLife = aokiLife + 1;
  }
  if (takahashiLife >= aokiLife) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

int main() {
	int a,b;
	cin >> a >> b;
	if ( (a == 1) || (b == 1)) {
		if ( a == b) {cout << "Draw\n";}
		else if ( a > b) {cout << "Bob\n";}
		else {cout << "Alice\n";}
	}
	else {
		if ( a == b) {cout << "Draw\n";}
		else if ( a > b) {cout << "Alice\n";}
		else {cout << "Bob\n";}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


int main(){
    ll X;
    cin >> X;
    ll A = X / 500;
    ll B = (X - (500 * A)) / 5;
    cout << A * 1000 + B * 5 << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define MAX 1501 * 1001 + 1

int ch[MAX], cw[MAX];
int main()
{
	int N, M;
	while (cin >> N >> M, N || M) {
		int count = 0;
		int h[1501], w[1501];
		REP(i, 0, N) cin >> h[i];
		REP(i, 0, M) cin >> w[i];

		REP(i, 0, MAX) {
			ch[i] = 0;
			cw[i] = 0;
		}
		REP(i, 0, N) {
			int sh = 0;
			REP(j, i, N) {
				sh += h[j];
				ch[sh]++;
			}
		}
		REP(i, 0, M) {
			int sw = 0;
			REP(j, i, M) {
				sw += w[j];
				cw[sw]++;
			}
		}
		REP(i, 0, MAX) count += ch[i] * cw[i];

		cout << count << endl;
	}
    return 0;
}

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

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

using namespace std;
struct UnionFind {
  vector<int> parent;
  UnionFind (int n) { parent.assign(n, -1); }
  int root(int x) { return parent[x] < 0 ? x : parent[x] = root(parent[x]); }
  bool merge(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (parent[y] < parent[x]) swap(x, y);
    if (parent[x] == parent[y]) --parent[x];
    parent[y] = x;
    return true;
  }
};
typedef int Weight;
struct Edge{
  int src, dest; Weight weight;
  bool operator < (const Edge &rhs) const {return weight > rhs.weight;}
  bool operator != (const Edge &rhs) const {return src != rhs.src || dest != rhs.dest;}
};

typedef vector<Edge> Edges;

// Kruskal
// N, operator <
Edges kruskal(int V, Edges &es) {
  UnionFind uf(V);
  Edges res;
  REP(i, es.size()) {
    Edge e = es[i];
    if(uf.root(e.src) != uf.root(e.dest)) {
      uf.merge(e.src, e.dest);
      res.push_back(e);
    }
  }
  return res;
}

int main() {
  int n,m;
  cin>>n>>m;
  Edges es;
  REP(i,m){
    int s,t,c;
    cin>>s>>t>>c;
    --s;--t;
    es.push_back((Edge){s,t,c});
  }
  sort(es.rbegin(), es.rend());
  auto mst = kruskal(n, es);
  int csum = 0;
  for(auto e:mst) csum += e.weight;
  int cnt = 0, esum = 0;
  REP(i,n-1) {
    Edges ee;
    REP(j,m) if(es[j]!=mst[i]) ee.push_back(es[j]);
    auto mst2 = kruskal(n, ee);
    int ccsum = 0;
    for(auto e:mst2) ccsum += e.weight;
    if (ccsum != csum) {
      ++cnt;
      esum += mst[i].weight;
    }
  }
  cout << cnt << ' ' << esum << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef long long unsigned int llui;
typedef long long int lli;
typedef long double float64;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;

#define INF 1000000000
#define MOD 1000000007
#define EPS 1e-9
#define DEBUG(x) cout<< '>' << #x << ':' << x << "\n";
#define all(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define UNIQUE(x) (x).erase(unique((x).begin(),(x).end()),(x).end())
#define tr(container, it) \
    for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) 

// #define sz(a) int((a).size())
// #define pb push_back
// #define fill(a,v) memset(a,v,sizeof a)


#define trace(x) cout << '>' << #x << ':' << x << endl;
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << endl;

#define trace3(x,y,z) cout<< '>' << #x << ':' << x \
        << " | " << #y << ':' << y <<" | " << #z << ':' << z << endl;

#define trace4(x,y,z,w) cout<< '>' << #x << ':' << x \
    << " | " << #y << ':' << y <<" | " << #z << ':' << z << " | " << #w << ':' << w << endl;


inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }

#define LSOne(S) (S&(-S))

const double pi = acos(-1);

/////////////////////////////////////////////////////////////////////

/*bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
{
    return (a.second < b.second);
}*/

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } // __gcd(0,0) gives exception

const int MAX_N = 212345;

int main(){
    string s;
    cin>>s;
    for(int i=0;i<s.length()-1;i++){
        if(s[i]=='A' && s[i+1]=='C')
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
using LL = long long;
using ULL = unsigned long long;


void solve() {
	int n; cin >> n;
	int m; cin >> m;
	vector<pair<int, LL>> LC, RC;
	vector<vector<pair<int, LL>>> edges(100000);
	rep(i, m) {
		int l, r; LL c;
		cin >> l >> r >> c; l--; r--;
		LC.push_back({ l, c });
		RC.push_back({ r, c });
		edges[l].push_back({ r, c });
	}
	sort(LC.begin(), LC.end());
	sort(RC.begin(), RC.end());
	rep(i, LC.size() - 1) {
		edges[LC[i + 1].first].push_back({ LC[i].first, 0 });
	}
	auto ritr = LC.rbegin();
	for(int i = 1; i < n; i++) {
		edges[i].push_back({ i - 1, 0 });
	}

	vector<LL> dp(100000); rep(i, n) dp[i] = -1;
	priority_queue<pair<LL, int>> q;
	q.push({ 0, 0 });
	while (!q.empty()) {
		auto top = q.top(); q.pop();
		int p = top.second; LL d = -top.first;
		if (dp[p] != -1) continue;
		dp[p] = d;
		rep(i, edges[p].size()) {
			q.push({ -(d + edges[p][i].second), edges[p][i].first });
		}
	}

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

int main() {

	solve();

	return 0;
}


Measured memory_bytes: 17200