akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

const char p[7] = {'R','G','B','Y','P','O','.'};
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
string f[12];
int cnt = 0;

void debug(){
	cout << endl;
	for(int y=0 ; y<12 ; ++y )
		cout << f[y] << endl;
	cout << endl;
}

void downPuyo(int x,int y){
	char t = f[y+1][x] ;
	f[y+1][x] = f[y][x];
	f[y][x] = t;
	
	if( y+1 != 11 && f[y+2][x] == '.' ){
		downPuyo( x , y+1 );
	}
}

void checkPuyo(int x,int y,char color){
	f[y][x] += 'a' - 'A';
	for(int i=0 ; i<4 ; ++i ){
		int mx = x + dx[i];
		int my = y + dy[i];

		if( mx < 0 || my < 0 || mx >= 6 || my >= 12 )
			continue;

		if( f[my][mx] == color ){
			++cnt;
			checkPuyo( mx , my , color );
		}
	}
}
void eracePuyo(int x,int y,char color){
	f[y][x] = '.';
	for(int i=0 ; i<4 ; ++i ){
		int mx = x + dx[i];
		int my = y + dy[i];

		if( mx < 0 || my < 0 || mx >= 6 || my >= 12 )
			continue;

		if( f[my][mx] == color ){
			eracePuyo( mx , my , color );
		}
		if( f[my][mx] == 'O' ){
			f[my][mx] = '.';
		}
	}
}

int main(){
	int n, chain;
	
	cin >> n;
	for(int i=0 ; i<n ; ++i ){
		for(int y=0 ; y<12 ; ++y ){
			cin >> f[y];
		}

		//ú»
		bool flag = true;
		chain = 0;

		//Á¦éÕæªÈ­ÈéÜÅ[v
		while( flag ){
			flag = false;

			/*cout << "Á¦éO" << endl;
			debug();
			cout << endl;*/

			for(int i=0 ; i<5 ; ++i ){
				for(int y=0 ; y<12 ; ++y ){
					for(int x=0 ; x<6 ; ++x ){
						cnt = 0;
						//àµFÕæ¾Á½ç
						if( f[y][x] == p[i] ){
							cnt++;
							checkPuyo( x , y , p[i] );
							//àµSÂÈã­ÁÂ¢Ä¢½ç¯·
							if( cnt >= 4 ){
								flag = true;
								eracePuyo( x , y , p[i] + ('a'-'A') );
							}
						}
					}
				}
			}

			//ú»
			for(int i=0 ; i<5 ; ++i ){
				for(int y=0 ; y<12 ; ++y ){
					for(int x=0 ; x<6 ; ++x ){
						char c = p[i] + ('a'-'A');
						if( f[y][x] == c ){
							f[y][x] -= ('a'-'A');
						}
					}
				}
			}

			/*cout << "Á¦½ã" << endl;
			debug();
			cout << endl;*/

			//Á¦éÕæª éÆ«
			if( flag ){
				chain++;

				for(int i=0 ; i<6 ; ++i ){
					for(int y=10 ; y>=0 ; --y ){
						for(int x=0 ; x<6 ; ++x ){
							if( f[y][x] == p[i] && f[y+1][x] == '.' ){
								downPuyo( x , y );
							}
						}
					}
				}
				for(int i=0 ; i<6 ; ++i ){
					for(int y=10 ; y>=0 ; --y ){
						for(int x=0 ; x<6 ; ++x ){
							if( f[y][x] == p[i] && f[y+1][x] == '.' ){
								downPuyo( x , y );
							}
						}
					}
				}
				for(int i=0 ; i<6 ; ++i ){
					for(int y=10 ; y>=0 ; --y ){
						for(int x=0 ; x<6 ; ++x ){
							if( f[y][x] == p[i] && f[y+1][x] == '.' ){
								downPuyo( x , y );
							}
						}
					}
				}
				for(int i=0 ; i<6 ; ++i ){
					for(int y=10 ; y>=0 ; --y ){
						for(int x=0 ; x<6 ; ++x ){
							if( f[y][x] == p[i] && f[y+1][x] == '.' ){
								downPuyo( x , y );
							}
						}
					}
				}
				/*cout << "ºã" << endl;
				debug();
				cout << endl;*/
			}		
		}
		cout << chain << endl;
	}
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

vector<pair<int, int> > PrimeFactor(int n) {
  vector<pair<int, int> > ret;
  FOREQ(i, 2, n) {
    int cnt = 0;
    while (n % i == 0) {
      n /= i;
      cnt++;
    }
    if (cnt != 0) {
      ret.push_back(make_pair(i, cnt));
    }
  }
  return ret;
}

ll calc(ll m, ll v) {
  if (m < v) { return 0; }
  return m / v + calc(m / v, v);
}

ll convert(string s, ll base) {
  ll ret = 0;
  FORIT(it, s) {
    ll v = 0;
    if (isdigit(*it)) { v = *it - '0'; }
    else { v = *it - 'A' + 10; }
    ret = ret * base + v;
  }
  return ret;
}

ll n;
string str;
int main() {
  while (cin >> n >> str, n) {
    ll m = convert(str, n);
    vector<pair<int, int> > factor = PrimeFactor(n);
    ll ans = 1LL << 62;
    FORIT(it, factor) {
      ans = min(ans, calc(m, it->first) / it->second);
    }
    printf("%lld\n", ans);
  }
}

Measured memory_bytes: 944
package main

import (
	"fmt"
	"sort"
)

func main() {
	var h, n int
	fmt.Scan(&h, &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	// fmt.Println(a)
	for i := 0; i < len(a); i++ {
		h -= a[i]
		if h == 0 || h < 0 {
			fmt.Println("Yes")
			break
		}
	}
	if h > 0 {
		fmt.Println("No")
	}
}


Measured memory_bytes: 5504
import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,sys.stdin.readline().split())

n,d=intinput()
p=[]
for i in range(n):
    p.append(list(intinput()))
ans=0
for i in range(n):
    for j in range(i+1,n):
        tmp=0
        for k in range(d):
            tmp+=(p[i][k]-p[j][k])**2
        if int(tmp**0.5)**2==tmp:
            ans+=1
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>

using namespace std;

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s >= 0;s--)

int main()
{
	ll n, ans = 0, a[5],count=0;
	string s;

	cin >> n >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];

	vecll now(5, 0);

	forll(i, 0, 5)
		if (n / a[i] == 0)
			now[i] == 0;
		else
			now[i] == 1;

	count = max((n-1) / a[0] + now[0], (n - 1) / a[1] + now[1]);

	forll(i, 2, 5)
	{
		count = max(count, (n - 1) / a[i] + now[i]);
	}

	count += 5;
	
	cout << count;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    int h, w; cin >> h >> w;
    vector<string> a(h);
    rep(i, h) cin >> a[i];

    vector<vector<char>> ans(h + 2, vector<char>());
    rep(i, h + 2) {
        if (i == 0 or i == h + 1) {
            rep(j, w + 2) ans[i].push_back('#');
        } else {
            rep(j, w + 2) {
                if (j == 0 or j == w + 1) ans[i].push_back('#');
                else ans[i].push_back(a[i - 1][j - 1]);
            }
        }
    }
    rep(i, h + 2) {
        rep(j, w + 2) cout << ans[i][j];
        cout << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){
    int n,i2,sum;
    double m,a,a2;
    for(;;){
        scanf("%d",&n);
        if(n==0){
            break;
        }else{
            int s[n];
            sum=0;
            for(i2=0;i2<=n-1;i2++){
                scanf("%d",&s[i2]);
                sum=sum+s[i2];
                //printf("%d ",s[i2]);
            }
            m=(double)sum/(double)n;
            a2=0.0;
            for(i2=0;i2<=n-1;i2++){
                a2=a2+(s[i2]-m)*(s[i2]-m);
            }
            a2=a2/n;
            a=sqrt(a2);
            printf("%lf\n",a);
        }
    }
    return 0;
}

Measured memory_bytes: 636
#include <iostream>

using namespace std;

int main() {
  int n, sum[105];
  cin >> n;
  sum[0] = 0;
  for (int i = 0; i < n; ++i) {
    int w;
    cin >> w;
    sum[i + 1] = sum[i] + w;
  }
  int mn = sum[n];
  for (int i = 1; i < n; ++i) mn = min(mn, abs(sum[i] * 2 - sum[n]));
  cout << mn << endl;
}


Measured memory_bytes: 256
r, c = gets.split.map{|v|
      v.to_i
}
ary = Array.new(r+1){ Array.new(c+1) }

for i in 1..r
  ary[i-1] = gets.split(" ").map(&:to_i)
end
for i in 1..r
  n = 0
  for j in 1..c
    n += ary[i-1][j-1]
  end
  ary[i-1][j] = n
end

for j in 1..c
  n = 0
  for i in 1..r
    n += ary[i-1][j-1]
  end
  ary[i][j-1] = n
end
n = 0
for i in 1..r
  n += ary[i-1][c]
end
ary[r][c] = n

for i in 1..r+1
  for j in 1..c
    print ary[i-1][j-1], " "
  end
  print ary[i-1][c], "\n"
end




Measured memory_bytes: 7140
#include<iostream>
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
 
bool a[100005];
int b[100005];
 
int main()
{
    int n,m;
    while(cin>>n>>m)
    {
        int i;
        memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        for(i=1;i<=n;i++)
            b[i]=1;
        a[1]=1;
        while(m--)
        {
            int x1,x2;
            cin>>x1>>x2;
            if(a[x1]==1&&b[x1]==1)
            {
                a[x1]=0;
                a[x2]=1;
            }
            else if(a[x1]==1)
                a[x2]=1;
            b[x1]--;
            b[x2]++;
        }
        int sum=0;
        for(i=1;i<=n;i++)
        {
            if(a[i]&&b[i]>0)
            {
                sum++;
            }
        }
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 768
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;


public class Test
{	
    public static void Main()
	{
	    int[] n = Console.ReadLine().Split(' ').Select(s=>int.Parse(s)).ToArray();
	    if((n[0] * n[1]) %2 == 0) Console.WriteLine("Even");
	    else Console.WriteLine("Odd");
	} 
}

Measured memory_bytes: 11220
h, w = map(int, input().split())
S=[]
S.append(["."] * (w + 2))
for i in range(h):
  S.append(["."] + list(input()) + ["."])
S.append(["."] * (w + 2))


for i in range(1, h+1):
  for j in range(1, w+1):
    counter = 0
    if S[i][j] == ".":
      if S[i-1][j-1] == "#":
        counter += 1
      if S[i-1][j] == "#":
        counter += 1
      if S[i-1][j+1] == "#":
        counter += 1
      if S[i][j-1] == "#":
        counter += 1
      if S[i][j+1] == "#":
        counter += 1
      if S[i+1][j-1] == "#":
        counter += 1
      if S[i+1][j] == "#":
        counter += 1
      if S[i+1][j+1] == "#":
        counter += 1
      S[i][j] = counter

for i in range(1,h+1):
  for j in range(1, w+1):
    print(S[i][j], end="")
  print()

Measured memory_bytes: 46444
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.B
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadLong();
            var A = ReadLongs();

            if (A.Contains(0))
            {
                return 0;
            }

            var ans = 1L;
            var pre = ans;
            var max = (long)Math.Pow(10, 18);
            foreach (var item in A)
            {
                ans *= item;
                if (ans > max || ans < pre)
                {
                    return -1;
                }

                pre = ans;
            }
            return ans;
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 41844
#include <bits/stdc++.h>
using namespace std ;
typedef long long ll ;
int gcd(int a ,int b)
{
  return b == 0 ? a : gcd(b , a % b) ;
}
int main()
{
  int k ;
  cin >> k ;
  ll ans = 0 ;
  for(int i = 1; i <= k ;i ++)
   for(int j = 1; j <= k ;j ++)
    for(int h = 1 ;h <= k ;h ++)
     ans += gcd(i , gcd(j , h)) ;
   cout << ans << endl ;
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
int main() {
    int n;
    cin>>n;
    int d[n],num[110]={0};
    rep(i,n){
        cin>>d[i];
        num[d[i]]++;
    }
    int cnt=0;
    rep(i,110){
        if(num[i]!=0) cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3580
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {

    map<int,int> m;
    string s;
    cin>>s;
    reverse(all(s));
    int csum=0;
    int x=1;
    rep(i,s.size()){
        m[csum]++;
        csum+=(s[i]-'0')*x;
        csum%=2019;
        x*=10;
        x%=2019;
    }
    m[csum]++;
    ll ans=0;
    irep(i,m){
        ans+=(i->second)*(i->second-1)/2;
    }
    fin(ans);
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

const int MAXN=1e6+10;
vector<int> sieve[MAXN];
int c[MAXN];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    for (int i=2;i<MAXN;i+=2)
        sieve[i].push_back(2);
    for (int i=3;i<MAXN;i+=2)
        if (!sz(sieve[i]))
            for (int j=i;j<MAXN;j+=i)
                sieve[j].push_back(i);
    int n,k;
    cin>>n;
    for (int i=0;i<n;++i)
    {
        cin>>k;
        for (int j : sieve[k])
            ++c[j];
    }
    bool ok=1;
    for (int i=2;i<MAXN;++i)
        if (c[i]>1)
            ok=0;
    if (ok)
    {
        cout<<"pairwise coprime";
        return 0;
    }
    ok=1;
    for (int i=2;i<MAXN;++i)
        if (c[i]==n)
            ok=0;
    if (ok)
    {
        cout<<"setwise coprime";
        return 0;
    }
    cout<<"not coprime";
    return 0;
}

Measured memory_bytes: 62892
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;

const int n = 8;

int row[n], col[n], dpos[2 * n - 1], dneg[2 * n - 1];

bool x[n][n];

void initialize() {
  rep(i, n) {
    row[i] = 1;
    col[i] = 1;
  }
  rep(i, 2 * n - 1) {
    dpos[i] = 1;
    dneg[i] = 1;
  }
}

void printboard() {
  rep(i, n) {
    rep(j, n) {
      if (x[i][j]) {
        if (row[i] != j) return;
      }
    }
  }
  rep(i, n) {
    rep(j, n) {
      cout << ((row[i] == j) ? "Q" : ".");
    }
    cout << endl;
  }
}

void recursive(int i) {
  if (i == n) {
    printboard();
    return;
  }
  rep(j, n) {
    if (col[j] == -1 || dpos[i + j] == -1 || dneg[i - j + n - 1] == -1) {
      continue;
    }
    row[i] = j;
    col[j] = -1;
    dpos[i + j] = -1;
    dneg[i - j + n - 1] = -1;
    recursive(i + 1);
    row[i] = 1;
    col[j] = 1;
    dpos[i + j] = 1;
    dneg[i - j + n - 1] = 1;
  }
}



int main() {
  initialize();
  rep(i, n) {
    rep(j, n) {
      x[i][j] = false;
    }
  }
  int k;
  cin >> k;
  rep(i, k) {
    int r, c;
    cin >> r >> c;
    x[r][c] = true;
  }

  recursive(0);
  
  return 0;
}


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

int main()
{
	int i,h,N;
	char S[100000],a[100000];
	while(cin>>N>>S)
	{
		for(i=0;S[i]!='\0';i++){
			h=S[i]+N;
			if(h<91){
				a[i]=h;
			}
			else{
				a[i]=h-26;
			}
		}
		cout<<a<<endl;
	}
}

Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll N,M;
	scan(N);scan(M);
	ll ans;
	if(N>=M/2) ans=M/2;
	else{
		ans=N;
		M-=2*N;
		ans+=M/4;
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
typedef pair<int, int> P;
typedef long long ll;
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc150/abc150_a.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
const int INF = 100100100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int X, K;
  cin >> K >> X;

  cout << ((K * 500 >= X) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

bool isPrime(long long a) {
	if (a < 2) return false;
	for (long long i = 2; i * i <= a; i++) {
		if (a % i == 0) return false;
	}
	return true;
}

int main() {
	int n;
	cin >> n;
	int l[n], r[n], Max = -1;
	for (int i = 0; i < n; i++) {
		cin >> l[i] >> r[i];
		Max = max(Max, r[i]);
	}
	int Cnt[100010] = {};
	for (int i = 3; i <= 100000; i += 2) {
		if (isPrime(i) && isPrime((i + 1) / 2)) {
			Cnt[i] = 1;
		}
	}
	int Cmp[100010] = {};
	Cmp[1] = Cnt[0];
	for (int i = 1; i <= 100000; i++) {
		Cmp[i] = Cnt[i] + Cmp[i - 1];
	}
	// for (int i = 0; i <= Max; i++) {
	// 	cout << Cnt[i] << " ";
	// }
	// cout << endl;
        // for (int i = 0; i <= Max; i++) {
	// 	cout << Cmp[i] << " ";
	// }
	// cout << endl;
	for (int i = 0; i < n; i++) {
		cout << Cmp[r[i]] - Cmp[l[i] - 1] << endl;
	}
	return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    ll a,b,c,k; cin >> a >> b >> c >> k;
    ll ans = 0;
    if(k > 0){
        ll n = min(a,k);
        ans += n;
        k -= n;
    }
    if(k > 0){
        ll n = min(b,k);
        k -= n;
    }
    if(k > 0){
        ll n = min(c,k);
        ans -= n;
        k -= n;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3656
#define DEBUG(...)
/*                        Strip me down and go to town                        */
/*                          Lick me over upside down                          */
/*                     Pound and pound and pound and pound                    */
/*                        Baby make me make that sound                        */
/*                Aaah, aaah, aaah, aaah, aaaaaaaaaaaaaaaaaah!                */
#include<stdio.h>
#include<algorithm>

using namespace std;

int dp[1005][1 << 13];
int ar[1005], br[1005];
int N, M;

int serc(int x, int m) {
  if (x == N) {
    if (m == (1 << M) - 1) return 0;
    else return 1000000000;
  }
  if (dp[x][m] != -1) return dp[x][m];
  return dp[x][m] = min(ar[x] + serc(x+1, m|br[x]), serc(x+1, m));
}

int main() {
  scanf("%d %d", &M, &N);
  for (int i = 0; i < N; i++) {
    int c;
    scanf("%d %d", &ar[i], &c);
    while (c--) {
      int x;
      scanf("%d", &x);
      br[i] |= (1 << (x-1));
    }
    for (int j = 0; j < (1 << M); j++) {
      dp[i][j] = -1;
    }
  }
  int ans = serc(0, 0);
  if (ans == 1000000000) ans = -1;
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 30976
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000011
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
 
int main(){
  int n;
  cin>>n;
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  
  string s;
  cin>>s;
  
  a--;
  b--;
  c--;
  d--;
  
  bool sup=true;
  bool hup=true;
  for(int i=a;i<=b;i++){
    if(i+1<n){
  if(s[i]=='#'&&s[i+1]=='#'){
    sup=false;}
    }
  }
  for(int i=c;i<=d;i++){
    if(i+1<n){
     if(s[i]=='#'&&s[i+1]=='#'){
    hup=false;}
    }
  }
  
  if(c<d){
    if(sup&&hup){
      cout<<"Yes"<<endl;}
    else{
      cout<<"No"<<endl;}
  }
  
  if(c>d){
    bool can=false;
    for(int i=b;i<=d;i++){
      if(s[i]=='.'&&s[i-1]=='.'&&s[i+1]=='.'){
        can=true;
     }
    }
    
    if(sup&&hup&&can){
      cout<<"Yes"<<endl;}
    else{
      cout<<"No"<<endl;}
  }
  return 0;
 
 
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main(){
	
int A,B,C,D,Y,X;
scanf("%d%d%d%d",&A,&B,&C,&D);

Y=A*B;
X=C*D;

if(Y>X)
printf("%d",Y);
else
printf("%d",X);

}


Measured memory_bytes: 256
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

typedef long long ll;

int main(){
  ll n;
  cin >> n;
  ll a[200200];
  rep(i, n) a[i] = 0;
  ll num;
  rep(i, n-1){
    cin >> num;
    a[num-1]++;
  }
  
  rep(i, n) cout << a[i] << endl;
  
  return 0;
}

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

using namespace std;

bool hasOddNumberOfDigits(int n) {
	int counter = 0;

	while (n > 0) {
		counter++;
		n /= 10;
	}

	return counter % 2 == 1;
}

int main()
{
	int n;
	cin >> n;
	int res = 0;
	for (int i = 1; i <= n; i++) {
		if (hasOddNumberOfDigits(i)) res++;
	}

	cout << res;
}

Measured memory_bytes: 256
<?php
// 入力
$s = trim(fgets(STDIN));

$n = strlen($s);
// 答え出力用配列に0格納
// $result = array_fill(0, $n, 0);
for ($i = 0; $i < $n; $i++) {
    $result[$i] = 0;
}

$r_top = 0;
// 'R...RL...L'ごとに処理
while($r_top < $n) {
    $l_top = strpos($s, 'L', $r_top);
    $r_last = $l_top - 1;
    if (strpos($s, 'R', $l_top)) { // 次の'R'が見つかった場合
        $l_last = strpos($s, 'R', $l_top) - 1;
    } else { // 次の'R'が見つからない場合
        $l_last = $n - 1;
    }
    $r_cnt = $r_last - $r_top + 1; // 'R'の個数
    $l_cnt = $l_last - $l_top + 1; // 'L'の個数

    // 'RL'の'R'に移動するのは'R'までの距離が偶数の'R'と'L'
    $result[$r_last] = ceil($r_cnt / 2) + floor($l_cnt / 2);
    // 'RL'の'L'に移動するのは'L'までの距離が偶数の'R'と'L'
    $result[$l_top] = floor($r_cnt / 2) + ceil($l_cnt / 2);

    $r_top = $l_last + 1;
}
echo implode(' ', $result).PHP_EOL;

Measured memory_bytes: 35572
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n;
    std::cin >> n;
    std::vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        std::cin >> a[i];
    }

    std::vector<int> ret(n + 1);
    for (int i = n; i > 0; i--) {
        int s = 0;
        for (int j = 2; j * i <= n; j++) {
            s += ret[j * i];
        }
        s &= 1;
        ret[i] = s ^ a[i];
    }

    int c = std::count(ret.begin(), ret.end(), 1);
    std::cout << c << std::endl;
    for (int i = 1; i <= n; i++) if (ret[i]) std::cout << i << " ";
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
using Graphl = vector<vector<ll>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define FOR(itr, v) for (auto itr = (v).begin(); itr != (v).end(); ++itr)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
#define ERASE(a)  (a).erase(unique((a).begin(), (a).end()), (a).end()); // sortしてから
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; }
template<class T> void PrintVector(const vector<T> &vec) {for (auto val : vec) cout << val << " "; cout << endl;}
const long long INF = 1LL << 60;
const long long minusINF = -(1LL << 40);
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int a; cin >> a;
    cout << a + a * a + a * a * a << endl;
}

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

typedef complex<double> P;
typedef pair<P,P> L;

const double EPS = 1E-6;

double dot(P a, P b){ return real(conj(a)*b); }
double cross(P a, P b){ return imag(conj(a)*b); }

int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

double area(vector<P> v){
  double sum = 0.0;
  int n = v.size();
  for(int i=0;i<n;i++) sum += (real(v[i]) - real(v[(i+1)%n])) * (imag(v[i]) + imag(v[(i+1)%n]));
  return fabs(sum) / 2;
};

P crossPoint(L l, L m){
  double A = cross(l.second - l.first, m.second - m.first);
  double B = cross(l.second - l.first, l.second - m.first);
  if(fabs(A) < EPS && fabs(B) < EPS) return m.first;
  else if(fabs(A) >= EPS) return m.first + B / A * (m.second - m.first);
}

vector<P> convex_cut(vector<P> G, L l){
  vector<P> ans;
  for(int i=0;i<G.size();i++){
    P A = G[i];
    P B = G[(i+1)%G.size()];
    if(ccw(l.first, l.second, A) != -1) ans.push_back(A);
    if(ccw(l.first, l.second, A) * ccw(l.first, l.second, B) < 0)
      ans.push_back(crossPoint(L(A,B), l));
  }
  return ans;
}


int N,M;
vector<P> V,C;

int main(){

  while( cin >> N >> M && (N||M) ){
    V.clear(); C.clear();
    for(int i=0;i<N;i++){
      int x,y; cin >> x >> y;
      V.push_back(P(x,y));
    }
    for(int i=0;i<M;i++){
      int x,y; cin >> x >> y;
      C.push_back(P(x,y));
    }

    for(int i=0;i<M;i++){
      vector<P> sp = V;
      for(int j=0;j<M;j++){
        if( i == j ) continue;
        P c = (C[i] - C[j])/2.0 + C[j];
        P r = C[i]-C[j];
        r = P( r.imag(), -r.real() );
        L s = L(c,c+r);
        //	cout << i << " <> " << j << " " << s.first << " "<< s.second << endl;
        sp = convex_cut(sp,s);
      }
      printf("%.10lf\n",area(sp));
    }


  }
  
}

Measured memory_bytes: 1248
def gcd(a, b):
     while b:
         a, b = b, a%b
     return a

n, m = map(int, input().split())
s, t = input(), input()

l = n*m//gcd(n, m)

a = [i*(l//n) for i in range(n)]
b = [i*(l//m) for i in range(m)]

x = set(a) & set(b)

for i in x:
    if s[a.index(i)] != t[b.index(i)]:
        print(-1)
        exit()

print(l)

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

int main() {
  string s,t;
  cin >> s >> t;

  int ans=0;

  for(int i=0;i<s.length();i++){
      if(s[i]!=t[i]) ans++;
  }

  if(ans==0) cout << "Yes"<< endl;
  else cout << "No" << endl;

}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n;
  cin>>n;
  vector<ll> h(n);
  rep(i,n)cin>>h[i];
  vector<ll> c(n);
  c[1]=abs(h[1]-h[0]);
  repeat(i,2,n) {
    c[i]=min(c[i-2]+abs(h[i]-h[i-2]),c[i-1]+abs(h[i]-h[i-1]));
  }
  cout << c[n-1] << endl;
  return 0;
}


Measured memory_bytes: 1792
/*
	DATE:		2020-03-12 11:41:54
	NAME:		
	PROBLEM:	ATDPJ
*/
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 300;

double et[MAXN + 7][MAXN + 7][MAXN + 7];

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

  int c1, c2, c3;
  c1 = c2 = c3 = 0;

  for (int i = 1; i <= n; i++) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      c1++;
    }
    else if (t == 2) {
      c2++;
    }
    else {
      c3++;
    }
  }

  for (int k = 0; k <= n; k++) {
    for (int j = 0; j <= n; j++) {
      for (int i = 0; i <= n; i++) {
        double &e = et[i][j][k];
        e = 0;
        if (i == 0 and j == 0 and k == 0) {
          continue;
        }
        int c0 = n - (i + j + k);
        if (c0 < 0) {
          continue;
        }
        e = c0 * 1.0 / n;
        if (i > 0) {
          e += i * 1.0 / n * (et[(i - 1)][j][k] + 1);
        }
        if (j > 0) {
          e += j * 1.0 / n * (et[(i + 1)][(j - 1)][k] + 1);
        }
        if (k > 0) {
          e += k * 1.0 / n * (et[i][(j + 1)][(k - 1)] + 1);
        }
        e /= (1 - c0 * 1.0 / n);
      }
    }
  }

  printf("%.9lf\n", et[c1][c2][c3]);

  return 0;
}

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

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

  int i;
  vector<int> A(N);
  vector<int> dp(N,0);
  for(i=0;i<N;i++){
    cin>>A.at(i);
    dp.at(0)+=A.at(i);
  }

  for(i=1;i<=N-1;i+=2){
    dp.at(0)-=2*A.at(i);
  }
  for(i=0;i<N-1;i++){
    dp.at(i+1)=2*A.at(i)-dp.at(i);
  }
  for(i=0;i<N-1;i++)
  cout<<dp.at(i)<<" ";
  cout<<dp.at(N-1)<<endl;

}


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

int main(int argc, const char * argv[]) {
    int N = 0;
    int R = 0;
    
    cin >> N;
    cin >> R;

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

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>


int di[]={-1,0,1,0,-1,1,1,-1};
int dj[]={0,1,0,-1,1,1,-1,-1};

char t[8][8],ch,turn='o';

char u[8][8];

int calc(int I,int J,char turn){
  u[I][J]=turn;
  int i,j,k,l,sum=0,cnt;
  for(k=0;k<8;k++){
    i=I;
    j=J;
    cnt=0;
    while(1){
      i+=di[k];
      j+=dj[k];      
      if(i<0||j<0||i>=8||j>=8||t[i][j]=='.'){
        cnt=0;
        break;
      }
      if(t[i][j]==turn){
        break;
      }
      cnt++;
    }
    sum+=cnt;
    i=I;
    j=J;
    for(l=0;l<cnt;l++){
      i+=di[k];
      j+=dj[k];      
      u[i][j]=turn;
    }
  }
  return sum;
}

int func(){
  int i,j,I,J,X;
  int ci,cj,maxm=0;

  for(i=0;i<8;i++){
    for(j=0;j<8;j++){
      I=i;
      J=j;
      if(turn=='x'){
        I=7-i;
        J=7-j;
      }
      if(t[I][J]!='.')continue;
      X=calc(I,J,turn);    
      if(X <= maxm)continue;
      maxm=X;
      ci=I;
      cj=J;
    }
  }

  if(maxm==0)return 0;
  
  for(i=0;i<8;i++)for(j=0;j<8;j++)u[i][j]=t[i][j];
  calc(ci,cj,turn);
  for(i=0;i<8;i++)for(j=0;j<8;j++)t[i][j]=u[i][j];
  
  return 1;
}

int main(){
  int i,j;
  for(i=0;i<8;i++){
    for(j=0;j<8;j++)scanf("%c",&t[i][j]);
    scanf("%c",&ch);
  }
  int c=0;
  while(1){
    if(c==2)break;
    int x=func();
    if(x==0)c++;
    else c=0;
    if(turn=='o')turn='x';
    else turn='o';
  }
  
  for(i=0;i<8;i++){
    for(j=0;j<8;j++)printf("%c",t[i][j]);
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 524
#include <iostream>

using namespace std;

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

  int a[2] = {1, M + 2}, b[2] = {M + 1, 2 * M + 1};
  for (int i = 0; i < M; ++i) {
    cout << (a[i & 1] + (i >> 1)) << ' '
         << (b[i & 1] - (i >> 1)) << endl;
  }

  return 0;
}


Measured memory_bytes: 3636
import Data.Char (ord, chr)
import Data.List (isInfixOf)
import System.IO (isEOF)

main = do
    quit <- isEOF
    if quit then return () else do
        line <- getLine
        putStrLn $ decipher line
        main

rotate :: String -> Int -> String
s `rotate` n = map (rotateChar n) s
    where
    rotateChar n c
        | ord c >= ord 'a' && ord c <= ord 'z'
            = chr (((ord c) - (ord 'a') + n) `mod` 26 + (ord 'a'))
        | otherwise
            = c

containsAny :: String -> [String] -> Bool
s `containsAny` ws = any (`isInfixOf` s) ws

decipher :: String -> String
decipher s = head $ filter (`containsAny` ["the","this","that"]) $ map (s `rotate`) [0..25]

Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
int main(){
  string N;
  cin >> N;
  if (((N[0]==N[1])&&(N[1]==N[2])) || ((N[1]==N[2])&&(N[2]==N[3])))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int ans = 0;
        for (int i = 0; i < n - 1; i++) {
            if(a[i] == a[i + 1]) {
                ans++;
                i++;
            }
        }
        System.out.println(ans);
    }
}

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

int compare(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

void Mysort(void* arr, int len, long unsigned int size){
    qsort(arr, len, size, compare);
}

int main(void){
    int a,b;
    scanf("%d%d", &a, &b);
    if(a <= 5){
        printf("0\n");
    }else if(a <= 12){
        printf("%d\n", b/2);
    }else{
        printf("%d\n", b);
    }
    return 0;
}

Measured memory_bytes: 128
s = input()
q = int(input())
ht = 1
head = ''
tail = ''
count = 0
for i in range(q):
    txt3 = input().split()
    if txt3[0] == '1':
        ht = 3 - ht
        count += 1
    else:
        if int(txt3[1]) == ht:
            head = txt3[2] + head
        else:
            tail = tail + txt3[2]
s = head + s + tail
if count % 2 == 1:
    s = s[::-1]
print(s)


Measured memory_bytes: 4412
import math

I=list(map(int,input().split()))
X=(2*I[1]-I[0])//3
Y=(2*I[0]-I[1])//3
n=X+Y
r=X

if (X<0 or Y<0 or (I[0]+I[1])%3!=0):
    print(0)
    exit()

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 6
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

print(cmb(n, r, p))

Measured memory_bytes: 121852
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn input_vec() -> Vec<u64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn main() {
    let mut card: Vec<Vec<u64>> = Vec::new();
    for i in 0..3 {
        let row = input_vec();
        card.push(row);
    }    
    let n: u64 = input();
    let mut b_vec: Vec<u64> = Vec::new();
    for _ in 0..n {
        let b: u64 = input();
        b_vec.push(b);
    }
    let mut status: Vec<Vec<u64>> = vec![vec![0;3];3];
    for b in b_vec {
        for i in 0..3 {
            for j in 0..3 {
                if card[i][j] == b {
                    status[i][j] = 1;
                }
            }
        }

        // check row
        for i in 0..3 {
            let mut flag = true;
            for j in 0..3 {
                if status[i][j] != 1 {
                    flag = false;
                }
                if !flag {
                    break;
                }
            }
            if flag {
                println!("Yes");
                return;
            }
        }

        // check column
        for i in 0..3 {
            let mut flag = true;
            for j in 0..3 {
                if status[j][i] != 1 {
                    flag = false;
                }
                if !flag {
                    break;
                }
            }
            if flag {
                println!("Yes");
                return;
            }
        }

        if status[0][0] == 1 && status[1][1] == 1 && status[2][2] == 1 {
            println!("Yes");
            return;
        }

        if status[0][2] == 1 && status[1][1] == 1 && status[2][0] == 1 {
            println!("Yes");
            return;
        }
    }
    println!("No");
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define cu continue
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf 1000000000
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define f first
#define s second
#define vll vector <ll>
#define dbg(n) cout<<n<<' ';

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n,k;
    cin>>n>>k;
    ll a[n+1];
    for(ll i=1;i<=n;i++)
        cin>>a[i];
    ll dp[n+1][k+1];
    ll pre[k+1];
    memset(dp,0,sizeof dp);
    memset(pre,0,sizeof pre);
    for(ll j=0;j<=min(a[1],k);j++)
        dp[1][j]=1;
    for(ll i=1;i<=n;i++)
        dp[i][0]=1;
    for(ll i=2;i<=n;i++)
    {
        pre[0]=1;
        for(ll j=1;j<=k;j++)
        {
            pre[j]=(pre[j-1]+dp[i-1][j])%mod;
            dp[i][j]=pre[j];
            if(j-a[i]>0)
            {
                dp[i][j]=(dp[i][j]-pre[j-a[i]-1]+mod)%mod;
            }
        }
    }

    // for(ll i=0;i<=n;i++)
    // {
    //     for(ll j=0;j<=k;j++)
    //         dbg(dp[i][j]);
    //     cout<<endl;
    // }
    cout<<dp[n][k]<<'\n';
}       


Measured memory_bytes: 80000
#include <stdio.h>
#include <iostream>
int main(void){
  int n;
  int a[200000];
  int b[200000];
  std::cin >> n;
  for(int i=0;i<n;i++){
    std::cin >> a[i];
  }
  int j=n-1;
  if(n%2 == 0){
    for(int i=n-1;i>=n/2;i--){
      b[n-1-i] = a[j];
      b[i] = a[j-1];
      j-=2;
    }
  }else{
    for(int i=n-1;i>=n/2;i--){
      b[n-1-i] = a[j];
      b[i] = a[j-1];
      j-=2;
    }
    b[(n-1)/2]=a[0];
  }
  for(int i=0;i<n;i++){
    printf("%d ",b[i]);
  }
  return 0;
}

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

string S;
int dp[80000][11];

int rec(int idx, int mod)
{
  if(idx == S.size()) return(mod == 0);
  if(~dp[idx][mod]) return(dp[idx][mod]);
  return(dp[idx][mod] = rec(idx + 1, (mod * 10 + S[idx] - '0') % 11) + (mod == 0));
}

int main()
{
  while(cin >> S, S != "0") {
    memset(dp, -1, sizeof(dp));
    int ret = 0;
    for(int i = 0; i < S.size(); i++) {
      if(S[i] != '0') ret += rec(i + 1, S[i] - '0');
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 8504
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define PER(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define PAIR pair<double, double>
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1LL << (x))
#define PI acos(-1)
const LL MOD = (LL)1e9+7;
const LL INF = (LL)1e9+7;
const LL INFLL = (LL)1e18;
using namespace std;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

LL modpow(LL x, LL b){
	LL res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

LL modinv(LL x){
	return modpow(x, MOD-2);
}

int main(){
	int n;
	cin >> n;
	vector<LL> line(n);
	LL sum = 0;
	foreach(i, line){
		cin >> i;
		sum ^= i;
	}

	foreach(i, line){
		i &= ~sum;
	}
	int rank = 0;

	PER(i, 61){
		int j;
		for(j=rank;j<n;++j)if(line[j]&BIT(i))break;
		if(j==n)continue;
		swap(line[rank], line[j]);
		REP(k, n)if(k!=rank)chmin(line[k], line[k]^line[rank]);
		++rank;
	}

	LL asum = 0;
	foreach(i, line)asum ^= i;
	cout << sum + asum * 2 << endl;

	return 0;

}


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

#define MOD 1000000007
#define DEBUG 0


using namespace std;

long long int modpow(long long int a, int n) {

	if (n == 0)return 1;
	if (n == 1) return a;

	long long int wk = modpow(a, n / 2);

	long long int ret = 0;
	if (n % 2 == 0) {
		ret = 1;
	}
	else {
		ret = a;
	}

	return (((ret * wk) % MOD) * wk) % MOD;

}

long long int gcd(long long int a, long long int b) {
	long long int tmp;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	long long int r = a % b;

	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

long long int lcm(long long int a, long long int b) {

	long long int wk_int;

	wk_int = (a * b) % MOD;
	
	long long int ret;

	ret = (wk_int * modpow(gcd(a, b), MOD - 2)) % MOD;

	return ret;

}

bool isPrime(int n) {
	if (n == 1)return false;
	if (n == 2)return true;

	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}

	return true;
}




int dis[10][10];






int main()
{

	long long int n;
	cin >> n;

	long long int wk = n;

	int fx = 0;
	while (wk > 0) {
		fx += wk % 10;
		wk /= 10;
	}
	
	if (n % fx == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	

	return 0;

}



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

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    set<int> st;
    st.insert(a);
    st.insert(b);
    st.insert(c);
    
    cout << st.size() << endl;
    
    
    return 0;
}

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

int n, q, t, ans = 0;

int bin(int t, int *S, int l=0, int h=n-1) {
	if (t == S[l] || t == S[h]) {
		return 1;
	}
	else if (l == h) {
		return 0;
	}
	else {
		int m = (l + h) / 2;
		if (t < S[m]) {
			return bin(t,S, l, m - 1);
		}
		else {
			return bin(t,S, m, h - 1);
		}
	}
}

int main(){
	scanf("%d", &n);
	int S[n];
	for (int i = 0; i < n; i++) {
		scanf("%d", &S[i]);
	}
	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		scanf("%d", &t);
		ans += bin(t, S);
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 2944
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
#define tget(a,b) get<a>(b)
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int MOD = 1e9 + 7;
string S; ll N; char ans;
int main(void) {
	cin >> S>>N;
	ll length = S.length();
	FOR(i, 0, 101) {
		if (S[i] != '1') {
			ans = S[i]; break;
		}
		if (i == N - 1) { ans = '1'; break; }
	}
	ct(ans);
	return 0;
}

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

typedef long long ll;
ll a[3];
int main()
{
	ll i;
	for (i = 0; i < 3; i++) {
		scanf ("%lld", &a[i]);
		if (a[i] % 2 == 0) {
			cout << 0;
			return 0;
		}
	}
	sort(a, a + 3);
	cout << a[0] * a[1];
    return 0;
}


Measured memory_bytes: 256
import math
import itertools
inputs = [input() for i in range(5)]
nl = [0, 1, 2, 3, 4]
l = list(itertools.permutations(nl))
t = 0
ans = -1
for li in l:
    for a in li:
        t = (math.ceil((t)/10)) * 10 + int(inputs[a])
    if ans == -1 or t < ans:
        ans = t
        c = li
    t = 0
print(ans)


Measured memory_bytes: 3060
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
#include<set>
#include<queue>
#include<deque>
#include<iomanip>
#include<sstream>
#include<cmath>
#include<tuple>
#include<bitset>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
typedef long long int ll;
typedef long double ld;
const ll INF = (1LL << 62);
ll n,k, m, t,q,h1,h2,m1,m2; string s;
const ld PI = acos(-1);
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
    std::fill((T*)array, (T*)(array + N), val);
}
int main() {
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    h1 *= 60; h2 *= 60;
    cout << h2 + m2 - h1 - m1 - k << endl;
}

Measured memory_bytes: 3592
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Function

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
toTuple (x : y : _) = (x, y)

main = do
    [n,m] <- getIntList
    pys <- flip zip [1..] . map toTuple <$> replicateM m getIntList
    let ans = map snd . sort . concatMap (zipWith cityNum [1..]) . groupBy ((==) `on` (fst . fst)) $ sort pys
    mapM_ putStrLn ans

cityNum k ((p,y),i) = (i , ((six p) ++ (six k)))
    where six a = let n = length (show a) in drop n ("000000" ++ (show a))

Measured memory_bytes: 72060