akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define mp make_pair
#define int long long
#define mod 1000000007
#define DEBUG cout<<"Hello1\n";
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))
#define deb(...) debug(#__VA_ARGS__, __VA_ARGS__);
const int N = 1e6 + 5;
const double pi =  acosl(-1);
const long long inf = 1e18 + 5;
using namespace std;
template<typename T> void debug(string s, T x) {cout << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cout << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}
template<class T> void print_container(T &container) { for (auto &t : container) { cout << t << " ";} cout << endl;}
template<class T> void printArr(T &a , int n) { for (int i = 0; i < n; i++) {cout << a[i] << " ";} cout << endl;}
typedef long long ll;
typedef pair<int, int> pii;

//Template Ends
int n, k;
int a[N];

void solve() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (int i = k; i < n; i++) {
		if (a[i] > a[i - k]) {
			cout << "Yes\n";
		} else {
			cout << "No\n";
		}
	}
}

int32_t main() {
	IOS;



	solve();

	return 0;
}




Measured memory_bytes: 5220
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_ARRAY_MAX		100000									// 最大配列数

// 内部変数
static FILE *szpFpI;											// 入力
static int si1Array[D_ARRAY_MAX];								// 配列
static int siACnt;												// 配列数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
#endif

// ソート関数 - int昇順
int
fSortFnc(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	int *lipVal1 = (int *)pzpVal1;
	int *lipVal2 = (int *)pzpVal2;

	// 昇順
	if (*lipVal1 > *lipVal2) {
		return(1);
	}
	else if (*lipVal1 < *lipVal2) {
		return(-1);
	}

	return 0;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i, j;
	char lc1Buf[1024], lc1Out[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 配列数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siACnt);

	// 配列 - 取得
	for (i = 0; i < siACnt; i++) {
		fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
		sscanf(lc1Buf, "%d", &si1Array[i]);
	}
	
	// 配列 - ソート
	qsort(si1Array, siACnt, sizeof(int), fSortFnc);

	// 初期値
	int liLVal = si1Array[0];
	int liRVal = si1Array[siACnt - 1];
	long long llSum = liRVal - liLVal;
	int liSNo = 1;
	int liENo = siACnt - 2;

	// 合計 - セット
	for (i = 0; i < siACnt - 2; i++) {

		// 端に追加時の値
		int li1Val[4];
		li1Val[0] = abs(liRVal - si1Array[liSNo]);
		li1Val[1] = abs(liLVal - si1Array[liSNo]);
		li1Val[2] = abs(liRVal - si1Array[liENo]);
		li1Val[3] = abs(liLVal - si1Array[liENo]);

		// 最大値
		int liNo = 0;
		int liMax = li1Val[liNo];
		for (j = 1; j < 4; j++) {
			if (liMax < li1Val[j]) {
				liMax = li1Val[j];
				liNo = j;
			}
		}

		// 加算
		llSum += liMax;
		switch (liNo) {
		case 0:
			liRVal = si1Array[liSNo];
			liSNo++;
			break;
		case 1:
			liLVal = si1Array[liSNo];
			liSNo++;
			break;
		case 2:
			liRVal = si1Array[liENo];
			liENo--;
			break;
		case 3:
			liLVal = si1Array[liENo];
			liENo--;
			break;
		}
	}

	// 結果 - セット
	sprintf(lc1Out, "%lld\n", llSum);

	// 結果 - 表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



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

int main() {
    int n;
    cin >> n;
    int r[n];
    rep(i,n) cin >> r[i];

    int minv=r[0];    
    int maxv=INT_MIN;
    rep1(i,n){
        maxv = max(maxv, r[i]-minv);
        minv = min(minv, r[i]);
    }
    cout << maxv;cout<<endl;
    return 0;
}



Measured memory_bytes: 3864
// based on http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2799850

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <stack>
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
#define INF 99999999
typedef std::pair<int, int> pii;
int main() {
  int N, M;
  std::stack<int> stk;
  char ch;
  while ((ch = std::cin.peek()) != EOF) {
    if (isdigit(ch)) {
      int i;
      std::cin >> i;
      stk.push(i);
    }
    else {
      std::cin.ignore();
      if (isspace(ch)) continue;
      int a = stk.top();
      stk.pop();
      int b = stk.top();
      stk.pop();
      switch(ch) {
      case '+': stk.push(a + b);
        break;
      case '-': stk.push(b - a);
        break;
      case '*': stk.push(a * b);
        break;
      }
    }
  }
  std::cout << stk.top() << std::endl;
  return 0;
}



Measured memory_bytes: 3104
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    long st = in.nextLong();
    long en = in.nextLong();
    long mod1 = in.nextLong();
    long mod2 = in.nextLong();
    in.close();
    long mod1and2 = lcmul(mod1, mod2);
    long countand = en / mod1and2;
    countand -= (st - 1) / mod1and2;
        long countor = en / mod1 - (st - 1) / mod1 + en / mod2 - (st - 1) / mod2;
    long ans = en - st - countor + countand  + 1;
    System.out.println(ans);
  }
  public static long gcdiv(long a, long b) {
    while (a != b) {
      if (a > b) {
        a -= b;// * (a / b);
      } else if (b > a) {
        b -= a;// * (b / a);
      }
    }
    return a;
  }
  public static long lcmul(long a, long b) {
    long gcdiv = gcdiv(a, b);
    a /= gcdiv;
    b /= gcdiv;
    return a * b * gcdiv;
  }
  public static long lcmul(long a, long b, long gcdiv) {
    a /= gcdiv;
    b /= gcdiv;
    return a * b * gcdiv;
  }
}

Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include "math.h"
#include <set>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl

vector <int > H;





int main()
{



	H.resize(4);
	cin >> H[0] >> H[1] >> H[2] >> H[3] ;

	sort(H.begin(),H.end());
	if(H[0] == 1 && H[1] == 4 && H[2] == 7 && H[3] == 9){
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}


}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int a=0,b=0,c=0,d=0,e=0;
  cin>>a>>b;
          c=a+b;
  d=a-b;
  e=a*b;
          if(c>d&&c>e)
          {
            cout<<c<<endl;
            return 0;
          }
          else if(d>c&&d>e)
          {
            cout<<d<<endl;
            return 0;
          }
  else if(e>c&&e>d)
  {
    cout<<e<<endl;
    return 0;
  }
  else if(c==d&&d==e)
  {
    cout<<c<<endl;
    return 0;
  }
  else if(c==d||c==e||d==e)
  {
    if(c==d||c==e)
    {
      cout<<c<<endl;
      return 0;
    }
    else
    {
      cout<<d<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
using ll = long long;
using namespace std;
/* initialize */
int n, u, k, v, c, A[100][100];

void dijkstra(){
    int c[100], d[100], p[100];
    for (int i = 0; i < n; ++i) { c[i] = 0;  d[i] = 100000000;}
    d[0] = 0;
    p[0] = -1;
    int minc;
    while(true){
        minc = INT32_MAX;
        int u = -1;
        for (int i = 0; i < n; ++i) {
            if (c[i] != 2 && d[i] < minc){
                minc = d[i];
                u = i;
            }
        }
        if(u == -1) break;

        c[u] = 2;

        for (int v = 0; v < n; ++v) {
            if (c[v] != 2 && A[u][v] != 100000000){
                if(d[u] + A[u][v] < d[v]){
                    d[v] = d[u] + A[u][v];
                    p[v] = u;
                    c[v] = 1;
                }
            }
        }
    }
    for (int i = 0; i < n; ++i) {
        cout << i << " " << (d[i] == 100000000 ? -1 : d[i]) << "\n";
    }
};
/* main */
int main() {
    cin >> n;
    for (int l = 0; l < n; ++l) {
        for (int i = 0; i < n; ++i) {
            A[l][i] = 100000000;
        }
    }
    for (int i = 0; i < n; ++i) {
        scanf("%d %d", &u, &k);
        for (int j = 0; j < k; ++j) {
            scanf("%d %d", &v, &c);
            A[u][v] = c;
        }
    }
    dijkstra();
    return 0;
}


Measured memory_bytes: 3216
n = int(input())
a = list(input())
b = list(input())
c = list(input())
def how_many_changes(p,q,r):
    if p != q and q != r and r != p:
        return 2
    if p == q != r or q == r != p or r == p != q:
        return 1
    else:
        return 0
ans = 0
for i in range(n):
    ans += how_many_changes(a[i], b[i], c[i])
print(ans)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int, int>
#define f first
#define s second 
using namespace std;
const LL INF = (LL) 1e9 + 5;
const LL MOD = (LL) 1e9 + 7;

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

	int h, w, n;
	cin >> h >> w >> n;
	h = max(h, w);
	cout << n / h + (n % h != 0) << '\n';

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include<iomanip>
#include<limits>
#include <utility>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
#define INF 1e18
 
int main()
{
	int N;
	cin>>N;

	vector<int> P(N);
	vector<string> S(N);

	struct r{
		string s;
		int p;
		int pre;
		int later;

		bool operator<( const r& right ) const {
			return s == right.s ? p > right.p : s < right.s;
		}
	};


	rep(i,N) cin>>S[i]>>P[i];
	vector<r> pairs(N);

	rep(i,N) {
		pairs[i].s = S[i];
		pairs[i].p = P[i];
		pairs[i].pre = i;
		pairs[i].later = 0;
	}

//	sort(S.begin(),S.end());

	sort(pairs.begin(),pairs.end());
/*
	rep(i,N){
		cout<<S[i]<<endl;
		cout<<pairs[i].s << ":"<<pairs[i].p << "-" << pairs[i].pre << " " <<  pairs[i].later <<endl;
	}
	*/
	rep(i,N) {
		cout << pairs[i].pre + 1 << endl;
	}

	return 0;
}

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

typedef long long ll;

int main() {
	int n,k;
	cin >> n >> k;
	vector<ll> a(n);
	for(auto& e:a) cin >> e;
	ll ans = 0;
	
	sort(a.begin(), a.end(), greater<int>());
	for(int i=0; i<min(n,k); i++) {
		a[i] = 0;
	}
	
	
	for(int i=0; i<n; i++) {
		ans += a[i];
	}
	
	
	cout << ans << '\n';
	return 0;
}


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

int main()
{
  int i;
  int n, k ,q;
  cin >> n >> k >> q;
  
  vector<int> a(q);
  vector<int> b(n, k);

  for (i = 0; i < q; i++)
  {
    cin >> a[i];
    b[a[i] - 1]++;
  }
    
  for (i = 0; i < n; i++)
  {
    if (b[i] - q > 0)
    {
      cout << "Yes" << endl;
    }
    else
    {
      cout << "No" << endl;      
    }
  }

  return 0;  
}


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

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#define MN 200000
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
pair<int,int> q[MN*2+5];
int n,mx=0,Mx,mn=2e9,Mn,A[MN+5],B[MN+5],top=0,s[MN+7];
long long ans;

long long Solve1()
{
	int Mxmn=A[Mn],Mnmx=B[Mx];
	for(int i=1;i<=n;++i)
		Mxmn=min(Mxmn,A[i]),Mnmx=max(Mnmx,B[i]);
//	cout<<"Solve1"<<mn<<" "<<Mxmn<<" "<<Mnmx<<" "<<mn<<endl;
	return 1LL*(mx-Mxmn)*(Mnmx-mn);	
}

bool Solve(int x)
{
	memset(s,0,sizeof(s));int Kind=0;
	for(int i=1,j=1;i<=top;++i)
	{
		for(;j<=top&&q[j].first<=q[i].first+x;++j) if(!s[q[j].second]++) ++Kind;
		if(Kind==n) return true;
		if(!--s[q[i].second]) --Kind;
	}
	return false;
}

long long Solve2()
{
	for(int i=1;i<=n;++i) if(i!=Mx&&i!=Mn) q[++top]=make_pair(A[i],i),q[++top]=make_pair(B[i],i);
	q[++top]=make_pair(B[Mx],n+1);q[++top]=make_pair(A[Mn],n+2);sort(q+1,q+top+1);
	int l=0,r=1e9,mid,res;
	while(l<=r)
	{
		mid=l+r>>1;
		if(Solve(mid)) res=mid,r=mid-1;
		else l=mid+1;	
	} 
	return 1LL*(mx-mn)*res;
} 

int main()
{
	n=read();
	for(int i=1;i<=n;++i)
	{
		A[i]=read();B[i]=read();
		if(A[i]<B[i]) swap(A[i],B[i]);
		if(A[i]>mx) mx=A[i],Mx=i;
		if(B[i]<mn) mn=B[i],Mn=i;	
	}
	ans=Solve1();
//	ans=4e18;
	if(Mx!=Mn) ans=min(ans,Solve2());
	printf("%lld\n",ans);
	return 0;
}



Measured memory_bytes: 5760
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    a,b=map(int,input().split())
    print(*range(b-(a-1),b+a))
        
if __name__ == '__main__':
    main()

Measured memory_bytes: 5312
from collections import Counter
N = int(input())
As = list(map(int,input().split()))
# print(As)
c = Counter(As)

# エラトステネスの篩
is_ans = [True] * (10**6 + 1)
s = list(set(As))
for x in s:
  t = x * 2
  while t <= 10**6:
    is_ans[t] = False
    t += x

cnt = 0
for x in s:
  if c[x] == 1 and is_ans[x] == True:
    cnt += 1

print(cnt)

Measured memory_bytes: 52692
H,W=map(int,input().split())
G=[list(str(input())) for _ in range(H)]
P=10**9+7

DP=[[0]*(W+1) for _ in range(H+1)]
DP[1][1]=1

for i in range(1,H+1):
    for j in range(1,W+1):
        if G[i-1][j-1]=='#':
            DP[i][j]=0
        else:
            DP[i][j]+=DP[i-1][j]+DP[i][j-1]
            DP[i][j]=DP[i][j]%P


print(DP[H][W])


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

int main() {
  int H;
  while (cin >> H, H > 0) {
    vector<vector<int>> stones(H, vector<int>(5, 0));
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < 5; j++) {
        cin >> stones[i][j];
      }
    }
    int ans = 0;
    while (true) {
      vector<vector<bool>> used(H, vector<bool>(5, false));
      for (int i = 0; i < H; i++) {
        for (int j = 0; j < 5; j++) {
          int cnt = 0;
          int pv = stones[i][j];
          if (pv == 0) continue;
          for (int k = j; k < 5; k++) {
            if (stones[i][k] != pv) break;
            cnt++;
          }
          if (cnt < 3) continue;
          ans += pv * cnt;
          for (int k = j; k < 5; k++) {
            if (stones[i][k] != pv) break;
            used[i][k] = true;
            stones[i][k] = 0;
          }
        }
      }
      bool flag = false;
      for (int i = 0; i < H; i++) {
        for (int j = 0; j < 5; j++) {
          if (used[i][j]) flag = true;
        }
      }
      if (!flag) break;
      for (int j = 0; j < 5; j++) {
        for (int i = H - 1; i >= 0; i--) {
          if (used[i][j]) continue;
          for (int k = i + 1; k < H; k++) {
            if (stones[k][j] == 0) swap(stones[k - 1][j], stones[k][j]);
          }
        }
      }
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3056
//Md. Shajibul Islam..
//East West University, CSE Department'19

#include<bits/stdc++.h>
using namespace std;
#define FAST             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define loop(i,n)        for(int i=0;i<n;i++)
#define CASE_PRINT       cout<<"Case "<<C<<": "
#define CASE_PRINT2      cout<<"Case "<<C<<":"<<endl
#define ll               long long
#define ld               long double
#define Pi               2*acos(0.0) // acos(-1.0)

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

     int sum=0;

    for(int i=0;i<s.size();i++)
    {
        sum = sum*10;
        sum+=(s[i]-'0');

        sum = sum%9;
    }

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





Measured memory_bytes: 3740
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;

long long int a = 0, b = 0, c = 1, x = 0, y = 0, z = 0, maxy = -1, mini = 9999, counter = 0,startp=0,endp=0,checker=0;
std::vector<unsigned long long int> vec{}, vecsec{};
int iremono[100001];
std::vector<long long int>kinds{}, ans{}, kaku{};
char moji,moji2;
bool okada = false,okada2=false;
std::string output, output2, input, one, two;
char cutcount[201];
int kakunou2[50][50] = {};
unsigned long long int M, A, R, C, H;

int ctoi(const char c) {
	if ('0' <= c && c <= '9') return (c - '0');
	return -1;
}
unsigned long long int LCM(unsigned long long int a, unsigned long long int b) {
	unsigned long long int i, j;
	i = a; j = b;
	while (true) {

		c = i % j;
		i = j;
		if (c != 0) {

			j = c;

		}
		else {
			break;
		}
	}
	return j * (a / j) * (b / j);
}
int main()
{

	cin >> a>>b;
	rep(i, a) {
		cin >> c;
		kaku.push_back(c);
	}
	
	std::sort(kaku.begin(), kaku.end());
	y = kaku.size();
	kaku.push_back(-1);
	for (int j = 0; j < y; j++) {
		if (kaku[j] == kaku[j + 1]) {
			x++;
		}
		if (kaku[j] != kaku[j + 1]) {
			x++;
			counter++;
			kinds.push_back(x);
			x = 0;
		}
	}

	std::sort(kinds.begin(), kinds.end());

	rep(i, kinds.size()) {
		
		if (counter > b) {
	    	z += kinds[i];
		    counter--;
		}
		
	
	}
	cout << z << endl;
}

	
	





Measured memory_bytes: 4848
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
Volume0-0044
Prime Number II
=end

require 'prime'
class Main
  def ud(n)
    i = n-1
    while true do
      if Prime::prime?(i) then
        break
      end
      i -= 1
      if i<=1 then
        abort("not found")
      end
    end

    return i
  end

  def ov(n)
    i = n+1
    while true do
      if Prime::prime?(i) then
        break
      end
      i += 1
    end
    return i
  end

  def initialize
    fh = STDIN
    while fh.gets do
      n = $_.to_i
      printf("%d %d\n", ud(n), ov(n))
    end
  end

end

if $0 == __FILE__ then
  Main.new
end

Measured memory_bytes: 8924
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
  int n;
  cin>>n;
  vector<vector<int>> arr(n,vector<int>(3));
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
      cin>>arr[i][j];
    }
  }
  for(int i=1;i<n;i++){
    arr[i][0]+=max(arr[i-1][1],arr[i-1][2]);
    arr[i][1]+=max(arr[i-1][0],arr[i-1][2]);
    arr[i][2]+=max(arr[i-1][1],arr[i-1][0]);
  }
  int ans=max(arr[n-1][0],max(arr[n-1][1],arr[n-1][2]));
  cout<<ans<<"\n";
}


Measured memory_bytes: 5760
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func main() {
	r := readf()

	ans := 2 * r * math.Pi
	fmt.Println(ans)
}

/*-------------------utilities-------------------*/

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func chmin(x *int, y int) bool {
	if *x > y {
		*x = y
		return true
	}
	return false
}

func chmax(x *int, y int) bool {
	if *x < y {
		*x = y
		return true
	}
	return false
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7
)

var (
	readString func() string
)

func init() {
	readString = newReadString(os.Stdin)
}

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

func readi64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


Measured memory_bytes: 1756
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n;
    cin >> n;
    vint x(n);
    rep(i, n) cin >> x[i];

    ll sum = accumulate(all(x), 0ll);
    ll p = sum/n;

    ll ans = 0, ans2 = 0;
    rep(i, n) ans += pow(p-x[i], 2);
    p++;
    rep(i, n) ans2 += pow(p-x[i], 2);


    cout << min(ans, ans2) << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

N = int(input())
num_of_edge = [0] * N
edge = defaultdict(list)

for i in range(N-1):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    edge[a].append((b, i))
    edge[b].append((a, i))
    num_of_edge[a] += 1
    num_of_edge[b] += 1

K = max(num_of_edge)

ans = [0] * (N-1)
stack = [(0, -1, 0)]
while stack:
    cur, past, color = stack.pop()
    color_cand = 1
    for cand, num in edge[cur]:
        if cand != past:
            if color_cand == color:
                color_cand += 1
            ans[num] = color_cand
            stack.append((cand, cur, color_cand))
            color_cand += 1

print(K)
for i in range(len(ans)):
    print(ans[i])
            



        



Measured memory_bytes: 83160
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

static const int INF = 1<<30;

struct ST {
  int a, c;
};

int dp[1<<13];

int main(){
  int N, M;
  cin >> N >> M;
  vector<ST> v;
  rep(i,M){
    int a, b;
    cin >> a >> b;
    int mask = 0;
    rep(j,b){
      int c;
      cin >> c;
      c--;
      mask |= (1<<c);
    }
    v.push_back((ST){a,mask});
  }

  rep(i,(1<<13)) dp[i] = INF;
  dp[0] = 0;
  
  rep(i,(1<<N)){
    rep(j,M){
      dp[i|v[j].c] = min(dp[i|v[j].c], dp[i] + v[j].a);
    }
  }

  if(dp[(1<<N)-1] == INF) cout << -1 << endl;
  else cout << dp[(1<<N)-1] << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N =2e2+10;
const double pi=acos(-1.0);
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
signed main(){
    int d,t,s;
    si(d);
    si(t);
    si(s);
    if(s*t>=d){
        puts("Yes");
    }else{
        puts("No");
    }
    return 0;
}

Measured memory_bytes: 3664
/*
*                                 Name : chaitanya
*
*                         Institute : ANITS,Visakhapatnam
*   "Don't regret anything you do, because in the end it makes you who you are."
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#include<sstream>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll m = 1000000007;
using namespace std;

int main()
{
    string s;
    cin >> s;
    int r = 0;
    for (int i = 0; i < s.size(); ++i)
    {
        if(s[i] == 'R')
            r++;
    }
    if (r != 2)
        cout << r;
    else
    {
        if( (s[0]=='R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R'))
            cout << 2;
        else
            cout << 1;
    }
    return 0;
}

Measured memory_bytes: 3620
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    boolean[] check;
    boolean[] used;
    List<List<Integer> > list = new ArrayList<>();
    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int N = scanner.nextInt();
        int M = scanner.nextInt();
        for (int i = 0; i < M; i++) {
            List<Integer> p = new ArrayList<>();
            p.add(scanner.nextInt() -1);
            p.add(scanner.nextInt() -1);
            list.add(p);
        }

        int ret = 0;
        for (int i = 0; i < M; i++) {
            check = new boolean[N];
            used = new boolean[M];
            dfs(0, i);
            boolean f = true;
            for (int j = 0; j < N; j++) {
                if (!check[j]) {
                    f = false;
                }
            }
            if (!f) {
                ret++;
            }
        }
        System.out.println(ret);
    }

    private void dfs(int index, int ignore) {
        check[index] = true;
        for (int i = 0; i < list.size(); i++) {
            if (i == ignore || used[i]) {
                continue;
            }
            List<Integer> p = list.get(i);
            if (p.get(0) == index) {
                used[i] = true;
                dfs(p.get(1), ignore);
            }
            if (p.get(1) == index) {
                used[i] = true;
                dfs(p.get(0), ignore);
            }
        }
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";

        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {
                    line = br.readLine();
                }
                s = line.split(reg, 0);
                i = 0;
                return s[i++];
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public int nextInt() {
            try {
                return Integer.parseInt(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }

        public double nextDouble() {
            try {
                return Double.parseDouble(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }

        public long nextLong()  {
            try {
                return Long.parseLong(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }
    }
}


Measured memory_bytes: 25172
n = int(input())

ans = 0

for i in range(3, 10):
    for j in range(3**(i)):
        s = 0
        cs = [0, 0, 0]
        for k in range(i):
            s += [3, 5, 7][(j // 3**(i - k - 1)) % 3] * 10**(i - k - 1)
            cs[(j // 3**(i - k - 1)) % 3] = 1
        if sum(cs) == 3 and s <= n:
            ans += 1

print(ans)

Measured memory_bytes: 43356
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=998244353;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

int main(){
    ll a,b,c,d;cin>>a>>b>>c>>d;
    vi dp(c+1);
    dp[a]=1;
    REP(i,b+1,d+1){
        //vi ndp(c+1);
        ll sum=0;
        REP(j,a,c+1){
            sum=(sum*(i-1)+dp[j])%mod;
            dp[j]=(dp[j]*(j-1)+sum)%mod;
            //dp[j]%=mod;
        }
    }
    ll ans=0,k=1;
    for(int i=c;i>=a;i--){
        ans=(ans+dp[i]*k)%mod;
        k=k*d%mod;
    }
    out(ans);
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H==0 && W==0){
                break;
            }
                for(int i=0;i<H;i++){
                    for(int j=0;j<W;j++){
                        if((i+j)%2==0){
                            System.out.print("#");
                        }else{
                            System.out.print(".");
                        }
                    }
                    System.out.printf("\n");
                }
                System.out.printf("\n");
        } 
          sc.close();
    }

}


Measured memory_bytes: 38184
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int al[26] = {0};
	
	string x;
	while (getline(cin, x))
	{
		for (int i = 0; i < x.size(); i++)
		{
			char a;
			// toLower
			if (x[i] >= 0x41 && x[i] <= 0x5a)
			{
				a = x[i];
				a += 0x20;
				al[(a - 0x61)] += 1;
			} else if (x[i] >= 0x61 && x[i] <= 0x7a)
			{
				a = x[i];
				al[(a - 0x61)] += 1;
			}
		}
	}
	
	for (int i = 0; i < 26; i++)
	{
		cout << (char)(0x61+i) << " : " << al[i] << endl;
	}
	
	return 0;
}

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

#define inf 0x3f3f3f3f
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector <ull> vu;
typedef vector <vector <int>> vvi;
typedef pair <int, int> pi;
typedef vector <pair <int, int>> vpi;

string s;

void read() {
  cin >> s;
}

bool good(char a) {
  if (strchr("ACGT", a))
    return 1;
  return 0;
}

void solve() {
  int sol = 0, cur = 0;
  if (good(s[0]))
    ++cur;
  for(int i = 1; s[i]; ++i) {
    if (good(s[i]))
      ++cur;
    else {
      sol = max(sol, cur);
      cur = 0;
    }
  }
  sol = max(sol, cur);
  cout << sol << "\n";
}

int main() {
  ios :: sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
//  cin >> t; //please do not forget to comment this if there are no queries
  while(t) {
    --t;
    read();
    solve();
  }
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> tree(n), in(n), out(n);
  rep(i, n) {
    int a;
    cin >> a;
    tree[i] = a - 1;
    if (a > 0) in[a - 1]++, out[i]++;
  }
  vector<int> dp(n);
  rep(i, n) if (in[i] == 0) dp[i] = k;
  for (int i = n - 1; i >= 0; i--) {
    if (tree[i] > 0) cmax(dp[tree[i]], dp[i] - 1);
  }
  rep(i, n) if (out[i] == 0) dp[i] = 1;
  cout << count_if(all(dp), [](int x) { return x > 0; }) << endl;
}

Measured memory_bytes: 4400
/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.05.16 18:39:26
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 3648
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    int t=0;
    foreach(s;stdin.byLine())
    {
        int n=0;
        foreach(c;s)
            if('0'<=c && c<='9') n=n*10+c-'0';
            else t+=n,n=0;
        t+=n;
    }
    writeln(t);
}

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

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

    string s;
    cin >> s;

    int ans = 0;
    for(int i = 0; i < s.size() / 2; i++){
        if(s[i] != s[s.size() - i - 1]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){

int X, Y;

cin >> X >> Y;

if(Y % 2 != 0)
cout << "No" << endl;

else if(X * 4 >= Y && X * 2 <= Y)
cout << "Yes" << endl;

else
cout << "No" << endl;
    
}


Measured memory_bytes: 3064
import sys

N, K = map(int, sys.stdin.readline().split())

a = 1
cnt = 0
while a <= N:
    if (2 * a) % K == 0:
        min = ((1 + a - 1) // K + 1) * K
        max = (N + a) // K * K
        #print(a, min-a, max-a)
        n = (max - min) // K + 1
        cnt += n * n
    a += 1
print(cnt)



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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	std::string s;
	std::cin >> s;
	int r0 = 0;
	int r1 = std::count(s.begin(), s.end(), 'R');
	
	int res = 1000000000;
	for (int i = 0; i <= n; i++) {
		res = std::min(res, r0 + r1 - std::min(r0, r1));
		
		if (i < n) {
			if (s[i] == 'R') r1--;
			else r0++;
		}
	}
	printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 3908
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険                                   // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
int main(){
    ll n; cin >> n;
    string s; cin >> s;

    ll res = 0;
    rep(i,0,n){
        if(s[i] == 'A'){
            if(i+2 < n && s[i+1] == 'B' && s[i+2] == 'C'){
                res++;
            }
        }
    }
    cout << res << endl;
}


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

using namespace std;

#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define mk make_pair

typedef long long LL;
typedef pair<int,int> Interval;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

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

const int maxn = 11;
LL num = 1;
LL bef = 0;
int n;
LL ans[maxn][maxn];
LL p[maxn];
set<int> si;
set<int> sii;

bool valid(int num){
    for(int a:si){
        if(si.count(num+a) || si.count(num) || sii.count(num) || sii.count(num+a)) return false;
    }
    return true;
}

map<LL,int> mp;

LL check(vector<int> &vi){
    LL ret = 0;
    _for(i,0,vi.size()-1){
        ret += ans[vi[i]][vi[i+1]];
    }
    return ret;
}

LL cal(int nn){
    vector<int> vi;
    _for(i,0,nn){
        vi.pb(i);
    }

    LL biggest = 0;
    do{
        biggest = max(biggest,check(vi));
    }while(next_permutation(ALL(vi)));
    return biggest;
}

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

    num = 1;
    _for(i,0,n){
        while(!valid(num)){
            num++;
        }
        for(auto a:si){
            sii.insert(a+num);
        }

        si.insert(num);
        p[i] = num;
    }

    num = 1;
    _for(i,1,n){
        _for(j,0,i){
            (ans[i][j] = ((ans[j][i]) = p[j] * num));;
        }
        num = cal(i+1) + 1;
        //cout <<"ok"<<endl;
    }

    //cout << cal(10) << endl;

    _for(i,0,n){
        _for(j,0,n){
            if(j) printf(" ");
            printf("%lld",ans[i][j]);
        }
        printf("\n");
    }

   // cout << longest << endl;

    return 0;
}


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

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

    string ans="NO",t="keyence";
    for(int i=0;i<=7;i++){
        if(s.substr(0,i)==t.substr(0,i)&&s.substr(s.length()-7+i,7-i)==t.substr(i,7-i)) ans="YES";
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#define Q 1000000007
#define N 1001

typedef long long int ll;
ll dp[N][N];
ll fact[N], ifact[N], inv[N];
ll ifp[N][N];

ll power(ll a, ll b){
	ll s=1;
	
	while(b){
		if(b & 1) s = s * a % Q;
		a = a * a % Q;
		b = b >> 1;
	}
	
	return s;
}

int main(void){
	int n, a, b, c, d;
	int i, j, k;
	ll tmp;

	scanf("%d %d %d %d %d", &n, &a, &b, &c, &d);
	fact[0] = 1;
	ifact[0] = 1;
	for(i=1; i<N; i++) inv[i]  = power(i, Q-2);
	for(i=1; i<N; i++) fact[i] = i * fact[i-1] % Q;
	for(i=1; i<N; i++) ifact[i] = ifact[i-1] * inv[i] % Q;
	for(i=1; i<N; i++){
		ifp[i][0] = 1;
		for(j=1; j<N; j++){
			ifp[i][j] = ifp[i][j-1] * ifact[i] % Q;
		}
	}
	dp[a-1][0] = 1;
	for(i=a; i<=b; i++){
		dp[i][0] = 1;
		for(j=1; j<=n; j++){
			dp[i][j] = dp[i-1][j];
			for(k=c; k<=d; k++){
				if(k*i > j) break;
				dp[i][j] = (dp[i][j] + dp[i-1][j-i*k]*fact[n-j+i*k]%Q * ifact[n-j]%Q * ifp[i][k]%Q * ifact[k]%Q)%Q;
			}
		}
	}
	
	printf("%lld\n", dp[b][n]);

	return 0;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pi 3.1415926536
#define pb push_back
#define N 1000000007
#define M 998244353 
#define INF 1e9
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n,m,i,j,k,t,l;
    cin>>t;
    ll ans = 3*t*t;
    cout<<ans;

 }

Measured memory_bytes: 256
#include<cstdio>
#include<cctype>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	
	int n;
	scanf("%d",&n);
	
	char str[126];
	scanf("%s",str);
	
	char y[126];
	int cnt = 0;
	
	for(int i = 0; i < n; i++){
		scanf("%s",y);
		for(int k = 0; k < strlen(y); k++){
			if(str[0] != y[k])continue;
			for(int j = 1; j < strlen(y); j++){
				int x = 0;
				for(int l = k; l < strlen(y); l+=j){
					//printf("%d\n",j);
					if(str[x] == y[l]){
						if(x == strlen(str)-1){
							cnt++;
							goto flg;
						}
						x++;
					}
					else if(str[x] != y[l]){
						//printf("x=%d k=%d l=%d j=%d a\n",x,k,l,j);
						break;
					}
				}
			}
		}
		flg:;
	}
					
	printf("%d\n",cnt);
;
	
	return 0;
}
	

Measured memory_bytes: 1028
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 11;
char cn[cm], * ci = cn, ct;
inline int getint() {
	int A = 0;
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

vector<ll> dp;

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


	fread(cn, 1, cm, stdin);
	int N = getint(), W = getint();

	dp.resize(W + 1);

	rep(i, N) {
		int w = getint();
		int v = getint();
		rep (j, W - w + 1) {
			chmax(dp[j], dp[j + w] + v);
		}
	}

	printf("%lld", dp[0]);

	Would you please return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define IN freopen("transposition-115.txt","r",stdin)
#define OUT freopen("dichromatic.out","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 2000000000000000000LL
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define SZ(v) ((int)v.size())
#define sq(x)  ((x)*(x))

using namespace __gnu_pbds;
using namespace std ;

#define maxn 1000005
#define mod 1000000007LL

using namespace std ;

int yes[maxn] , h[maxn] , player[maxn] ;
int ans[maxn] ;

char s[maxn] ;

int main()
{
    int n ;
    scanf("%s",s) ;
    int ans = 0 ;
    for(int i=0 ; s[i]!= '\0' ; i++ ) if( s[i]=='o' ) ans++ ;

    ans += ( 15 - strlen(s) ) ;

    if(ans >=8) printf("YES\n") ;
    else printf("NO\n") ;

    return 0 ;
}


Measured memory_bytes: 256
N = int(input())
W = [[0, 0] for _ in range(N)]

for i in range(N):
    X,L = map(int,input().split())
    W[i][0],W[i][1] = X-L, X+L
W.sort(key=lambda x: x[1])
ans = 0
t = -10**18
for i in range(N):
    if t <= W[i][0]:
        t = W[i][1]
        ans += 1
print(ans)


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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
//const int MOD = 1000000007;
//const int MOD = 998244353;

// Lib
//

int main(){
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int N; cin >> N;
    vector<P> res;
    int dame = N;
    if (N % 2 == 1) --dame;

    for (int i = 1; i <= N; ++i) {
        for (int j = i + 1; j <= N; ++j) {
            if (j == dame) continue;
            res.push_back(P(i, j));
        }
        --dame;
    }

    cout << res.size() << endl;
    for (auto p : res) {
        cout << p.first << " " << p.second << endl;
    }
}


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

int main(){
	int H, W, A, B;cin >> H >> W >> A >> B;
  	for(int i = 0; i < H; i++){
      for(int j = 0; j < W; j++){
        if((i < B && j < A) || (i >= B && j >= A)){
          cout << "0";
        }else{
        	cout << "1";
        }
      }
      cout << endl;
    }
    return 0;
}


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

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

    vector<long long> a(n);
    long long sum=0;
    REP(i,n){
        cin>>a[i];
        sum+=a[i]-1;
    }

    cout<<sum<<endl;
}

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

int num[1000];

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

Measured memory_bytes: 256