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

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;
#define fastio ios_base::sync_with_stdio(false); \
		cin.tie(0);							     \
		cout.tie(0);
#define sz(arr) int(arr.size())

using namespace std;

using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 9;
const double PI = 4.0 * atan(1.0);

ll powmod(ll a, ll b, const ll MOD) { ll res = 1; a %= MOD; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % MOD; a = a * a % MOD; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p); }
ll div_floor(ll a, ll b) { return a / b - (((a ^ b) < 0) and a % b); }
ll div_ceil(ll a, ll b) { return a / b + (((a ^ b) >= 0) and a % b); }

//ll f[200005];
//ll kCn(ll k, ll n) { return (f[n] * modInverse((f[n - k] * f[k]) % MOD, MOD)) % MOD; }


int main() {
	//#ifndef ONLINE_JUDGE
	//	(void)freopen("input.txt", "r", stdin);
	//	(void)freopen("output.txt", "w", stdout);
	//#endif // !ONLINE_JUDGE
	fastio;
	set<string> m;
	int n;
	cin >> n;
	while (n--) {
		string t;
		cin >> t;
		m.insert(t);
	}
	cout << m.size();
	return 0;
}

Measured memory_bytes: 19248
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
   int a,b;
   cin >>a;
   cin >>b;
   if(a<b){
       cout << "a < b";
   } else if (a>b){
       cout << "a > b";
   } else {
       cout << "a == b";
   }
   cout << endl;
}



Measured memory_bytes: 3084
#include<bits/stdc++.h>
 
using namespace std;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()
 
int GCD(int a,int b){ return b ? GCD(b,a%b) : a ;}
int LCM(int a,int b){ return a*b / GCD(a,b) ;}
 
typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;
const int MOD = 1e9+7;

int main(){
      int a,b,c;cin >> a >> b >> c;
      int Max = max({a,b,c});
      int sum = a+b+c;
      if(sum%2 == Max%2)cout << (Max*3-sum)/2 << endl;
      else cout << ((Max+1)*3-sum)/2 << endl;
      return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
  #define debug(...) printf(__VA_ARGS__)
#else
  #define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int main() {
  string S;
  cin >> S;
  if (S[2] == S[3] && S[4] == S[5])
    puts("Yes");
  else
    puts("No");
  return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
V = [int(i) for i in input().split()]
V2 = V[::-1]
R = min(N, K)
ans = 0
for a in range(R+1):
    for b in range(R-a+1):
        c = K - (a + b)
        t = 0
        for v in sorted(V[:a]+V2[:b]):
            if v < 0 and c > 0:
                c -= 1
                continue
            t += v
        ans=max(t, ans)
print(ans)


Measured memory_bytes: 3064
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

N, M = mapint()
uf = UnionFind(N)
for _ in range(M):
    a, b = mapint()
    uf.union(a-1, b-1)

print(max([uf.size(r) for r in uf.roots()]))

Measured memory_bytes: 94284
#include<iostream>
#include<algorithm>
using namespace std;
string s[100010];
long long x=0;
int main(){
	int n;
    int i,j,k;
    cin >> n;
    for(i=0;i<n;i++){
    	cin >> s[i];
    	int a[26]={0};
    	for(j=0;j<s[i].size();j++){
    		a[s[i][j]-'a']++;
		}
		s[i]="";
		for(j=0;j<26;j++){
			for(k=0;k<a[j];k++){
				s[i]+=char(j+'a');
			}
		}
	}
	sort(s,s+n);
	s[n]="###";
	long long w=1;
	for(i=1;i<=n;i++){
		if(s[i]!=s[i-1]){
			x=x+w*(w-1)/2;
			w=1;
		}
		else
			w++;
	}
	cout << x << endl;
    return 0;
}


Measured memory_bytes: 7296
import bisect
import sys
input=sys.stdin.readline

n=int(input())
a=[]
for i in range(3):
   a.append(list(map(int,input().split())))

for j in range(3):
    a[j].sort()
ans=0
for l in a[1]:
    aa=bisect.bisect_left(a[0],l)
    bb=(n-bisect.bisect_right(a[2],l))
    ans+=aa*bb
print(ans)


Measured memory_bytes: 22592
S = input()
T = input()

rs = list(S[::-1])
rt = list(T[::-1])

idx = None
for i in range(len(rs)-len(rt)+1):
  flg = True
  for j in range(len(rt)):
    si = i + j
    if rs[si] != rt[j] and rs[si] != '?':
      flg = False
  if flg:
    idx = i
    break

if idx is None:
  print('UNRESTORABLE')
else:
  for i in range(idx, idx+len(rt)):
    rs[i] = rt[i-idx]
  for i in range(len(rs)):
    if rs[i] == '?':
      rs[i] = 'a'
  print("".join(rs[::-1]))


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

int main() {
  int i,n,total;
  cin>>n;
  i=n;
  while(n>0){
    total+=n%10;
   //cout<<total<<endl;
    n/=10;
  }
  if(i%total==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  
        
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define D(x) cout<<#x<<" = "<<x<<endl


int n, t, m, k;


int main()
{
    cin>>n;
    for(int i = 0;i<n;i++){
        cout<<"ACL";
    }
    cout<<endl;
    return 0;
}


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

int main(){
int n,k;
cin >> n >>k;
vector<int> v;
for(int i=0;i<n;i++) {
  int a; cin >>a;
  v.push_back(a);
}

long long ans = 0;
sort(v.begin(),v.end());
for(int i=0;i<k;i++) ans +=v[i];

cout << ans <<endl;



}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans = "A";
		switch (s) {
		case "A":
			ans = "T";
			break;
		case "T":
			ans = "A";
			break;
		case "C":
			ans = "G";
			break;
		case "G":
			ans = "C";
		}
		System.out.println(ans);
	}
	
}


Measured memory_bytes: 21844
N = int(input())
TXY = [map(int,input().split()) for _ in range(N)]
ans = "Yes"
for t,x,y in TXY:
    if (x+y)%2 != t%2:
        ans = "No"
        break
    if x+y > t:
        ans = "No"
        break
print(ans)


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] a_asArgs)
        {
			Console.ReadLine();
			int[] l_aiInput1 = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
			int[] l_aiInput2 = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

			int l_iSum1 = l_aiInput1.Sum();
			int l_iSum2 = l_aiInput2.Sum();

			int l_iGetMax = 0;
			for (int l_iIndex = 0; l_iIndex < l_aiInput1.Length; l_iIndex++)
			{
				int l_iGet = l_aiInput1.Where((a, i) => i <= l_iIndex).Sum() + l_aiInput2.Where((a, i) => i >= l_iIndex).Sum();
				l_iGetMax = l_iGetMax > l_iGet ? l_iGetMax : l_iGet;
			}
			Console.WriteLine(l_iGetMax);
		}
	}
}


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

int main(){
  int a, b, c, x, ans = 0; cin >> a >> b >> c >> x;
  for(int n500 = 0; n500 <= a; n500++){
      for(int n100 = 0; n100 <= b; n100++){
          for(int n50 = 0; n50 <= c; n50++){
              if(500*n500 + 100*n100 + 50*n50 == x) ans++;
          }
      }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
    string s;
    cin >> s;
    vector<ll> count(2019, 0);
    ll ans = 0LL;
    // deque<pair<int, int>> ans;

    for (int i = 0; i < s.length(); i++) {
        int n = s[i] - '0';
        vector<ll> count_new(2019, 0);
        for (int j = 0; j < 2019; j++) {
            count_new[(10 * j + n) % 2019] = count[j];
        }
        count_new[n] += 1LL;
        count = count_new;
        // for (int j = 0; j < 2019; j++) {
        //     if (count[j] != 0) {
        //         cout << j << ", ";
        //     }
        // }
        // cout << endl;
        ans += count[0];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3752
#include <stdio.h>

int r0,r1,r2,a0=1,a1=0,a2,b0=0,b1=1,b2,q;
int main(void){
  scanf("%d %d", &r0, &r1);
  for(;r1>0;){
    q=r0/r1;
    r2=r0%r1;
    a2=a0-q*a1;
    b2=b0-q*b1;
    r0=r1,r1=r2;
    a0=a1,a1=a2;
    b0=b1,b1=b2;
  }
  printf("%d %d\n", a0, b0);
  return 0;
}


Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
long long P = 998244353; 
long long inv[1000010]; 
int N; 
long long A[200010]; 
long long cnt[1000010]; 
long long sum[1000010]; // sum[i] := iの倍数の総和
long long keisuu[1000010]; 
bool isprime(int num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	for(int i = 3; i * i <= num; i++){
		if(num % i == 0) return false; 
	}
	return true; 
}
void init() {
	inv[1] = 1;
	for(int i = 2; i < 1000005; i++) {
		inv[i] = P - inv[P % i] * (P / i) % P;
	}
}
int main(){
	cin >> N; 
	for(int i = 0; i < N; i++){
		cin >> A[i]; cnt[A[i]] ++; 
		sum[1] += A[i]; 
		if(A[i] > 1) sum[A[i]] += A[i]; 
	}
	for(long long i = 2; i <= 1000000; i++){
		if(!cnt[i]) continue; 
		for(long long j = 2; j * j <= i; j++){
			if(i % j == 0){
				sum[j] += cnt[i] * i; 
				if(j != i/j) sum[i/j] += cnt[i] * i;
			} 
		}
	}
	init(); 
	fill(keisuu, keisuu+1000005, 1); 
	for(long long i = 2; i <= 1000000; i++){
		if(!isprime((int) i)) continue; 
		long long mul = (P + 1 - i) % P; 
		for(int j = 1; i * j <= 1000000; j++){
			keisuu[i*j] *= mul; 
			keisuu[i*j] %= P; 
		}
	}
	long long ans = P; 
	ans -= sum[1] % P; 
	for(int i = 1; i <= 1000000; i++){
		if(!sum[i]) continue; 
		ans += (((((sum[i] % P) * (sum[i] % P)) % P) * keisuu[i] % P) * inv[i]) % P; 
		if(ans >= P) ans -= P; 
	}
	ans *= inv[2]; ans %= P; 
	cout << ans << endl; 
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a)for(int i=b;i>=a;i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

	stack<ll> st;
	vector<ll> L(n),R(n);

	L[0] = 0;
	rep(i,n){
		while(st.size() && h[st.top()]>=h[i])st.pop();
		L[i] = (st.empty()?0:st.top()+1);
		st.push(i);
	}
	while(st.size())st.pop();
	R[n-1]=0;
	repr(i,n-1,0){
		while(st.size() && h[st.top()]>=h[i])st.pop();
		R[i] = (st.empty()?n:st.top());
		st.push(i);
	}
	while(st.size())st.pop();

	ll ans=0;
	rep(i,n){
		ans = max(ans,h[i]*(R[i]-L[i]));
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 6180
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[200010];
int B[200010];

signed main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	B[0]=A[0];
	REP(i,N){
		B[i+1]=max(B[i],A[i+1]);
	}
	int ans=0;
	REP(i,N){
		ans+=B[i]-A[i];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 6648
#include <iostream>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>
#include <algorithm>

using namespace std;

int max(int a, int b);
int min(int a, int b);

int main(int argc, char const* argv[])
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++) 
    {
        int n;
        cin >> n;
        int min_num=0;
        int max_num=0;
        int pre=0;
        int next=0;
        cin >> pre;
        for (int j = 0; j < n-1; j++) 
        {
            next = pre;
            cin >> pre;
            max_num = max( max_num, next-pre);
            min_num = min( min_num, next-pre);
        }
        //cout << max_num << " " << -1 * min_num << endl;
        cout << -1 * min_num << " " << max_num << endl;
    }
    return 0;
}

int max(int a, int b)
{
    if (a > b) 
    {
        return a;
    }
    else{
        return b;
    }
}
int min(int a, int b)
{
    if (a > b) 
    {
        return b;
    }
    else{
        return a;
    }
}

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

int main() {
	long long int a[110000] = {};
	long long int n, k, b;
	cin >> n >> k;
	while(cin >> n >> b){
		a[n] += b;
	}
	n = 1;
	do{
		k -= a[n];
		n++;
	} while (k > 0);
	cout << --n << endl;
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define all(v) (v).begin(),(v).end()
#define pb push_back
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  double l;
  cin>>l;
  l/=3.0;
  double ans=l*l*l;

  cout<<setprecision(10)<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
from math import *
n = int(input())
x = []
y = []
x[:] = map(int,input().split())
y[:] = map(int,input().split())

dxy1 = 0.0
dxy2 = 0.0
dxy3 = 0.0
dxyinf = 0.0

for i in range(0,n):
    dxy1 += abs(x[i]-y[i])
    dxy2 += (x[i]-y[i])**2
    dxy3 += (abs(x[i]-y[i]))**3
    if (dxyinf < abs(x[i]-y[i])):
        dxyinf = abs(x[i]-y[i])
dxy2 = sqrt(dxy2)
dxy3 = pow(dxy3, 1.0/3.0)
print(dxy1)
print(dxy2)
print(dxy3)
print(dxyinf)



Measured memory_bytes: 5700
#include "bits/stdc++.h"
using namespace std;
int main() {
	int N, M, C, cunt = 0;
	cin >> N >> M >> C;
	vector<int> B(M);
	vector<int> A(M);
	for (int i = 0; i < M; i++)	{cin >> B.at(i);}

	for (int i = 0; i < N; i++) { 
		int res = 0;
		for (int x = 0; x < M; x++) { cin >> A.at(x); }
		for (int y = 0; y < M; y++) { 
			res = res + A.at(y)*B.at(y);
		}
		if (res+C >0) {
			cunt++;
		}
	}
	cout << cunt << endl;
}


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

ll N, M;
vector<ll> A;
vector<ll> Asum;


// 「1回の握手がa以上」の握手を全て行ったとき、握手の回数がm でスコアが score
void calc( int a, ll &m, ll &score ){
	m = 0;
	score = 0;
	
	for ( int i = 0; i < N; i++ ){
		auto it = lower_bound( A.begin(), A.end(), a-A[i] );
		int j = it - A.begin();
		m += N-j;
		score += (Asum[N]-Asum[j]) + A[i]*(N-j);
	}
	//cout << "a=" << a << " m=" << m << " score=" << score << endl;
}



int main(){
	cin >> N >> M;
	A.resize(N);
	Asum.resize(N+1);
	
	for ( int i = 0; i < N; i++ ){
		cin >> A[i];
	}
	sort( A.begin(), A.end() );
	
	ll sum = 0;
	for ( int i = 0; i < N; i++ ){
		Asum[i] = sum;
		sum += A[i];
	}
	Asum[N] = sum;
	
	
	int a_min = A[0]*2;
	int a_max = A[N-1]*2+1;
	{
		ll m;
		ll score;
		while ( a_max - a_min > 1 ) {
			
			int a = a_min + (a_max-a_min)/2;
			
			calc( a, m, score );
			
			if ( M < m ){
				a_min = a;
			}
			else{
				a_max = a;
			}
		}
	}
	
	
	// この段階で、 a_min を選ぶと M < m 、 a_max を選ぶと m <= M
	ll m1, m0;
	ll score1, score0;
	calc( a_min, m1, score1 );
	calc( a_max, m0, score0 );
	
	ll score = score0;
	if ( m0 < M ){
		score += ((score1-score0)/(m1-m0)) * (M-m0);
	}
	
	cout << score << endl;
	
	return 0;
}



Measured memory_bytes: 1920
#include <iostream>
#include <cstdio>
#include <cstring>
#define max_n 200000
using namespace std;
int n,tr[max_n+1][2],tot=1;
long long l;
bool num[100];
char s[max_n+1],*ed;
void ins(int v,char*now){
    int&x=tr[v][*now^'0'];
    !x&&(x=++tot);
    now<ed&&(ins(x,now+1),1);
}
void dfs(int v,int d){
#define k 0
    tr[v][k]?dfs(tr[v][k],d+1),1:(l-d>0&&(num[__builtin_ctzll(l-d)]^=1));
#undef k
#define k 1
    tr[v][k]?dfs(tr[v][k],d+1),1:(l-d>0&&(num[__builtin_ctzll(l-d)]^=1));
#undef k
}
int main(){
    scanf("%d%lld",&n,&l),ed=s;
    char*tmp;
    for(int i=0; ++i<=n; ){
        scanf("%s",tmp=ed+1);
		ed+=strlen(tmp);
        ins(1,tmp);
    }
    dfs(1,0);
    for(int i=0;i<=60;i++) if(num[i]) {puts("Alice");return 0;}
    puts("Bob");
    return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a <= b){
    for (int i=0; i<b;i++){
      cout << a;
    }
  } else {
    for (int i=0; i<a;i++){
      cout << b;
    }
  }
  cout << endl;
  return 0;
}


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

#define ll long long
using namespace std; 

int main() 
{ 
    ll n;
    cin>>n;
  	ll arr[n];
  	for(int i=0;i<n;i++)
    {
    	cin>>arr[i];
    }
  	ll d=0;
  	for(int i=1;i<n;i++)
    {
    	if(arr[i]<arr[i-1])
    	{
          d+=arr[i-1]-arr[i];
          arr[i]=arr[i-1];
    	} 
    }
  	cout<<d<<endl;
    return 0;
    
}

Measured memory_bytes: 5144
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) (a).begin(),(a).end()

int digit(ll a, ll b){
    int ka, kb;
    ka = kb = 1;
    while(a >= 10)ka++, a/=10;
    while(b >= 10)kb++, b/=10;
    return max(ka, kb);
}
int main(){
    ll n;
    cin >> n;
    ll sq = sqrt(n);
    int ans = 15;
    for(ll i = 1; i < sq*2; i++)if(n%i == 0)ans=min(ans, digit(i, n/i));
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		int total = 0;
		for (int i = 0; i < n; i++) {
		    arr[i] = sc.nextInt();
		    total += arr[i];
		}
		if (total % 2 == 0) {
		    System.out.println(total / 2);
		    return;
		}
		Arrays.sort(arr);
		for (int i = 0; i < n; i++) {
		    if (arr[i] % 2 == 1) {
		        System.out.println((total - arr[i]) / 2);
		        return;
		    }
		}
	}
}



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

int main(){
	long long n,s,i,x,sum;
	long long temp1,temp2,last;
	while (cin >> n >> s){
	//	if (s==1){
	//		cout<<n<<endl;continue;
	//	}
		if(n==1){
			if (s==1){
				cout <<2<<endl;
				continue;
			}else{
				cout<<-1<<endl;
				continue;
			}				
		}
		
		if(n==s){
			cout <<s+1<<endl;
			continue;
		}
		
		if(s>n){
			cout<<-1<<endl;
			continue;
		}
		
		sum = 0;
		for (i=2;i*i<=n;i++){
			
			x=n;sum=0;
			while((long long)(x/i)>0) {
				sum+=x%i;
				x=x/i;
				
		//		cout <<sum<<"sum x"<< x<<endl;
				if(sum > s)
					break;
			}
			sum+=x%i;
			
			if(sum==s){
				cout << i<<endl;
				break;
			}
			
		}
		if(sum==s)
			continue;
		
		last = 0;
		for (i=1;i*i<n;i++){
			temp1 = n/i; //5000
			temp2 = n/(i+1); //3333
			
//			cout <<"s"<<s<<endl;            //3
//			cout <<i + n%temp1<<endl;       //2
//			cout <<i + n%(temp2+1)<<endl;   //2+ 

			if( s >= (i + n%temp1) && s<= (i + n%(temp2+1))){
				if((n-(s-i))%i==0){
				
					last = (n-(s-i))/i;          //(10000-(10-2))/2 
//					cout <<"###2 "<< last <<endl;     
				}
			}
				
		}
		
		if(last != 0){
				cout << last <<endl;
		}else{
			
				cout<<-1<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n;
    cin>>n;
    int b[100],ans=0;
    for(int i=0;i<n-1;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        if(i==0) ans+=b[0];
        else if(i==n-1) ans+=b[n-2];
        else ans+=min(b[i],b[i-1]);
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200050
#define M 200
#define int long long
#define pb push_back
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
#define ll long long
#define SIZE N

using namespace std;
int n,q,ans;
map< int , int > ma;

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin>>n;
	for(int i=0;i<n;i++){
	    int a; cin>>a;
	    ma[a]++;
	    ans += a;
	}
	cin>>q;
	while(q--){
	    int a,b; cin>>a>>b;
	    ans -= ma[a]*a;
	    ans += ma[a]*b;
	    ma[b] += ma[a];
	    ma[a] =0;
	    cout<<ans<<"\n";
	}
}


Measured memory_bytes: 9560
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

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

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod
#define AddMult(x, y, z) x = (x + (y) * (z)) % mod



signed main(){

    int N, M, C; cin >> N >> M >> C;
    vec B(M); readv(B);
    mat A(N, vec(M));
    REP(i, N) readv(A[i]);
    int ans = 0;
    REP(i, N){
        int tmp = C;
        REP(j, M) tmp += A[i][j] * B[j];
        if(tmp > 0) ans++;
    }
    cout << ans << endl;

    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int a, b;
    cin >> a >> b;
    int cnt = 0;
    string s;
    for (int i = a; i <= b; i++)
    {
        s = to_string(i);
        string t = s;
        reverse(ALL(t));

        if (s.substr(0, s.size() / 2) == t.substr(0, t.size() / 2))
            cnt++;
    }
    OP(cnt);
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef priority_queue<long long> prque;
#define ain(i,n,a) for(long long i=0;i<(long long)(n);i++){cin>>a[i];}
#define aout(i,n,a) for(long long i=0;i<(long long)(n);i++){if(i){cout<<" ";}cout<<a[i];if(i==n-1){cout<<endl;}}
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define vsort(v) sort((v).begin(), (v).end())
#define vrsort(v) sort((v).rbegin(), (v).rend())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 2000000009
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  string f;int i;cin>>f;rep(i,3){if(f.at(i) ==f.at(i+1)){cout<<"Bad"<<endl;return 0;}}
  //caricurate
  cout<<"Good"<<endl;
  //output
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1) 

const ll INF = 10010001010;
const int inf = 2000000000;


typedef tuple<string, int, int> TUP;

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

int main()
{
    int N;
    cin >> N;
    ll power = 1;
    for (int i = 1; i <= N;i++)
    {
        power *= i;
        power %= mod107;
    }
    cout << power << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char ak[10]="KIHBR";
int size[10] = {1,1,2,2};
int main(void)
{
	char str[100];
	while(scanf("%s",str)!=EOF)
	{
	int l = strlen(str);
	if(l > 9)
	printf("NO\n");
	else 
	{
	   char stc[10];
	   int id[10];
	   int cn = 0;
	   bool flag = true;
	   for(int i = 0;i < l;i++)
	   {
	      if(str[i]!='A')
		  {
		  	 if(cn == 0)
		  	 {
		  	 	if(str[i] != ak[cn]||i > 1)
		  	 	flag = false;
		  	 	else id[cn] = i;
		  	 	cn++;
			 }
			 else 
			 {
			 	if(str[i] != ak[cn]||i - id[cn-1] > size[cn-1]||cn >= 5)
			 	flag = false;
			 	else 
			 	{
			 	  id[cn] = i;	
				}
				cn++;
			 }
		  }	 
	   }
	   if(cn != 5)flag = false;
	   int t = 0;
	   for(int i = l-1;i >= 0;i--)
	   if(str[i] == 'A')t++;
	   else break;
	   if(t > 1)
	   flag = false;
	   if(flag)
	   printf("YES\n");
	   else printf("NO\n");
	}}
	return 0;
}

Measured memory_bytes: 256
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

dic = {}
for i in A:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

dic_sort = sorted(dic.items(), key=lambda x:x[1], reverse=True)

ans = []
for i in range(K, len(dic_sort)):
    ans.append(dic_sort[i][1])

print(sum(ans))

Measured memory_bytes: 39040
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int P[] = new int[N];
    int min = 0;
    int answer = 0;
    for(int i=0;i<N;i++){
      P[i]=sc.nextInt();
    }
    min = P[0];
    answer = answer+1;
    for(int i=1;i<N;i++){
      if(P[i]<min){
        answer=answer+1;
        min=P[i];
      }
    }
    System.out.println(answer);
  }
  

  
}

Measured memory_bytes: 65192
#include <bits/stdc++.h>
#include <queue>
#include <string.h>
#include <stdint.h>
#include <cmath>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double
#define ull unsigned long long
#define ut uint64_t

#define pb push_back
#define ins insert
#define er erase

#define fi(i, b) for (int i=0;i<b;i++)
#define fll(i, b) for (ll i=0;i<b;i++)
#define fla(i,a,b) for (ll i=a;i<b;i++)

#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vb vector<bool>
#define vst vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvl vector<vector<ll>> 


#define all(v) v.begin(), v.end()
#define lb lower_bound
#define ub upper_bound
#define mxe max_element
#define mne min_element

#define srt(v) sort(all(v))
#define rsrt(v) sort(v.rbegin(), v.rend())

#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second

#define mii map<int, int>
#define mll map<ll, ll>
#define umii unordered_map<int, int>
#define umll unordered_map<ll, ll>

#define si set<int>
#define sll set<ll>
#define usi unordered_set<int>
#define usll unordered_set<ll>
#define spii set<pii>
#define spll set<pll>

#define pqi priority_queue<int>
#define pqll priority_queue<ll>

 #define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)

#define nl "\n"
using namespace std;

double PI = (acos(-1));

ll md = 1000000007;
ll ma = 998244353;

ll pw(ll a, ll b)
{
    ll c = 1, m = a;
    while (b){
        if (b & 1)c = (c * m);
        m = (m * m);
        b /= 2;
    }
    return c;
}

ll pwmd(ll a, ll b){
    ll c = 1, m = a;
    while (b){
        if (b & 1)
            c = ((c * m)) % md;
        m = (m * m) % md;
        b /= 2;
    }
    return c;
}


ll modinv(ll n)
{
    return pwmd(n, md - 2);
}
ll min(ll a,ll b){
    if(a>=b)return b;
    return a;
}
//vst vect={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};




// AB DEKHO JAADU...

void solve(){
    ld a,b,v,w,t;
    cin>>a>>v>>b>>w>>t;
   
    
    if(w>=v){cout<<"NO";
        
    }
    else{
        if((abs(b-a))/(v-w)<=t)cout<<"YES";
        else cout<<"NO";
    }
    
    }


    
    


int main(){
    fast;
    ll tests=1;
    //cin>>tests;
    while(tests--){
        solve();
    }

    return 0;
    }

// KHATAM HO GAYA:)...





Measured memory_bytes: 3760
import java.util.*;
import java.math.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] x = new int[M];
    int[] y = new int[M];
    for (int i = 0; i < M; i++) {
      x[i] = sc.nextInt();
      y[i] = sc.nextInt();
    }
    sc.close();

    Map<Integer, Set<Integer>> edge = new HashMap<>();
    for (int i = 0; i < M; i++) {
      Integer key = Integer.valueOf(x[i]);
      if (!edge.containsKey(key)) {
        edge.put(key, new HashSet<>());
      }
      edge.get(key).add(y[i]);
    }

    int[] memo = new int[N + 1];
    Arrays.fill(memo, -1);

    int ans = 0;
    for (int xi = 1; xi < N + 1; xi++)
      ans = Math.max(ans, count(memo, edge, xi));

    System.out.println(ans);
  }

  private static int count(int[] memo, Map<Integer, Set<Integer>> edge, int xi) {
    if (memo[xi] != -1) return memo[xi];
    memo[xi] = 0;
    Set<Integer> dest = edge.get(xi);
    if (dest == null) return memo[xi];
    for (int yi : dest)
      memo[xi] = Math.max(memo[xi], (memo[yi] != -1 ? memo[yi] : count(memo, edge, yi)) + 1);
    return memo[xi];
  }
}

Measured memory_bytes: 94812
n = gets.to_i
until n == 0
    score_board = Hash.new
    n.times do
        x = gets.split(" ").map{|k| k.to_i }
        time_sum = 0
        for i in 1..8 do
            if i % 2 == 1
                time_sum += x[i] * 60
            elsif i % 2 == 0
                time_sum += x[i]
            end
        end
        score_board[x[0]] = time_sum
    end
    score_board1 = score_board.sort_by{ |_, v| v }
        Hash[*score_board1.first].each do |k,v|
            puts k
        end
        score_board1.shift
        Hash[*score_board1.first].each do |k,v|
            puts k
        end
        Hash[*score_board1.to_a.at(score_board1.size-2)].each do |k,v|
            puts k
        end
    n = gets.to_i 
end


Measured memory_bytes: 7420
# E - Yutori
def find_workdays(
    total_days: int, workdays_length: int, days_off_length: int, schedule: list) -> list:
    if days_off_length == 0:
        workdays = [i for i, can_work in enumerate(schedule, 1) if can_work]
        return workdays if len(workdays) <= workdays_length else []

    workdays_left, workdays_right = [], []

    for workdays, gen in [
        (workdays_left, enumerate(schedule, 1)),
        (workdays_right, ((total_days - i, x) for i, x in enumerate(schedule[::-1]))),
    ]:
        days_off = 0
        for i, can_work in gen:
            if days_off:
                days_off -= 1
                continue
            if can_work:
                workdays.append(i)
                days_off = days_off_length
                if len(workdays) == workdays_length:
                    break

    return [l for l, r in zip(workdays_left, workdays_right[::-1]) if l == r]


def main():
    N, K, C = map(int, input().split())
    S = input().rstrip()
    workdays = find_workdays(N, K, C, [s == "o" for s in S])
    print("\n".join(map(str, workdays)))


if __name__ == "__main__":
    main()


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

int main()
{
	string ch;
	int n;

	while (1)
	{
		cin >> ch;
		if (ch == "-")
		{
			break;
		}
		cin >> n;
		int h[n];
		for (int i = 0; i < n; i++)
		{
			cin >> h[i];
			ch = ch.substr(h[i], ch.size()) + ch.substr(0, h[i]);
		}
		cout << ch << endl;
	}
}

Measured memory_bytes: 3160
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
using namespace std;

/*
const int MAX_E=2*(100-1);
const int MAX_V=100;
const long long int INF=100000000;
struct edge { int from,to,cost;};
edge es[MAX_E];
//int d[MAX_V];
int V,E;
void shortest_path(int s,int e,vector<int>& d);
int main(){
	int n,k;
	while(cin >> n >> k&&n!=0&&k!=0){
		int V=n;
		int E=2*(n-1);
		vector<int> land(V);
		int l=0;
		for(int i=0; i<E; ++i){
			es[i].cost=-1;
			es[i].from=-1;
			es[i].to=-1;
		}
		for(int i=0; i<k; ++k){
			int m;
			cin >> m;
			if(m==0){
				int a,b;
				cin >> a >> b;
				shortest_path(a,b,land);
				cout << land[b] << "\n";
			} else if(m==1){
				int c,d,e;
				cin >> c >> d >> e;
				es[l].from=c;
				es[l].to=d;
				es[l].cost=e;
				es[l+1].from=d;
				es[l+1].to=c;
				es[l+1].cost=e;
				l+=2;
			}
		}
	}
	return 0;
}

void shortest_path(int s,int e,vector<int>& d){
	cout << "ok1\n";
	for(int i=0; i<V; ++i) {
		cout << "ok\n";
		d[i]=INF;
	}
	d[s]=0;
	while(true){
		cout << "ok2\n";
		bool update=false;
		for(int i=0; i<E; ++i){
			edge e=es[i];
			if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				update=true;
			}
		}
		if(!update) break;
	}
}
*/
/*
const int INF=100000000;
int main(){
	int n;
	while(cin >> n&&n!=0){
		vector<int> color;
		for(int i=0; i<n; ++i){
			int t;
			cin >> t;
			color.push_back(t);
		}
		int maxDel=INF;
		for(int i=0; i<n; ++i){
			for(int j=1; j<=3; ++j){
				if(color[i]==j) continue;
				int up=i-1;
				int down=i+1;
				int sum=0;
				int c=1;
				int col=j;
				while(1){
					int nCal=-1;
					while(1){
						if(up<0) break;
						if(color[up]!=col){
							nCal=color[up];
							break;
						}
						up--;
						c++;
					}
					while(1){
						if(down>=n) break;
						if(color[down]!=col){
							if(nCal==-1) nCal=color[down];
							break;
						}
						++down;
						++c;
					}
					if(c>=4){
						sum+=c;
					} else{
						break;
					}
					c=0;
					if(nCal==-1){
						break;
					}else{
						col=nCal;
					}
				}
				maxDel=min(maxDel,n-sum);
			}
		}
		cout << maxDel << "\n";
	}
	return 0;
}
*/

int main(){
	int n;
	cin >> n;
	vector<int> team(n+1);
	for(int i=0; i<n*(n-1)/2; ++i){
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		if(c>d) team[a]+=3;
		if(d>c) team[b]+=3;
		if(c==d){
			team[a]++;
			team[b]++;
		}
	}
	for(int i=1; i<n+1; ++i){
		int cnt=0;
		for(int j=1; j<n+1; ++j){
			if(i!=j){
				if(team[i]<team[j])++cnt;
			}else{
				if(team[i]<=team[j])++cnt;
			}
		}
		cout << cnt << "\n";
	}
	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long A;
  string b;
  cin>>A>>b;
  long long B=(b.at(0)-'0')*100+(b.at(2)-'0')*10+(b.at(3)-'0');
  cout<<A*B/100<<endl;
}

Measured memory_bytes: 3512
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt(),l = scanner.nextInt();
		String[] s = new String[n];
		for(int i=0;i<n;i++){
			s[i] = scanner.next();
		}
		Arrays.sort(s);
		for(int i=0;i<n;i++){
			System.out.print(s[i]);
		}
		System.out.println();
	}

}


Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=20000000000;
//setprecision(2) <<

const int MOD = 1000000007;

long long max(long long a,long long b){
	if(a<b)return b;
	else return a;	
}
long long min(long long a,long long b){
	if(a>b)return b;
	else return a;	
}

int A[100006];
int N;

int f(double n){
	int ret=0;
	bool a = (n<A[0]);
	for(int i=0;i<N-1;i++){
		if((A[i]-n)*(A[i+1]-n)<0){
			if(a){
				ret++;
				a=false;
			}
			else a=true;
		}
	}
	if(a)ret++;
	//cout<<n<<" "<<ret<<endl;
	return ret;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N,K;
	cin>>N>>K;
	int h[N];
	int ans=0;
	for(int i=0;i<N;i++){
		cin>>h[i];
		if(h[i]>=K)ans++;
		}
		cout<<ans<<endl;
	
}
	


Measured memory_bytes: 640
import bisect
from collections import deque
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
# mod = 10 ** 9 + 7
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]



def main():
    N = int(input())
    t = 0
    f = False
    for _ in range(N):
        a, b = read_values()
        if a == b:
            t += 1
        else:
            t = 0

        if t == 3:
            f = True
    
    print("Yes" if f else "No")


if __name__ == "__main__":
    main()



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

vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p=-1){
    for(int u : to[v]){
        if(u == p) continue;
        ans[u] += ans[v];
        dfs(u,v);
    }
}

int main()
{
    // input
    int n,q;
    cin >> n >> q;
    rep(i,n-1){
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    ans.resize(n);
    rep(i,q){
        int p,x;
        cin >> p >> x;
        p--;
        ans[p] += x;
    }
    
    // solve
    dfs(0);

    // output
    rep(i,n) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 23424
#include<stdio.h>
#include<math.h>

int main()
{
    double a1,a2,b1,b2,c1,c2,x,y,p,q;


    while(scanf("%lf %lf %lf %lf %lf %lf",&a1,&b1,&c1,&a2,&b2,&c2)!=EOF){

    x=(b2*c1-c2*b1)/(a1*b2-a2*b1);
    y=(a1*c2-a2*c1)/(a1*b2-a2*b1);
    p=((int)(1000*x))/1000.0;
    q=((int)(1000*y))/1000.0;

    printf("%.3lf %.3lf\n",p,q);
    }
    return 0;
}

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

int main()
{
	int a,b;

	cin >> a >> b;

	if (a % 500 <= b) {
		cout << "Yes" << endl;
	}

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

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;


namespace ConsoleApp_CS
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = CIn.ReadInt();
            var b = CIn.ReadInt();
            a = a + b;
            if (a >= 10)
            {
                Console.WriteLine("error");
            }
            else
            {
                Console.WriteLine(a);
            }
        }
    }

    class CIn
    {
        private static readonly Queue<string> fieldBuffer = new Queue<string>();

        public static string Read()
        {
            if (fieldBuffer.Count == 0)
            {
                foreach (var field in Console.ReadLine().Split())
                {
                    fieldBuffer.Enqueue(field);
                }
            }
            return fieldBuffer.Dequeue();
        }

        public static int ReadInt() => int.Parse(Read());
        public static long ReadLong() => long.Parse(Read());
        public static double ReadDouble() => double.Parse(Read());

        public static string[] ReadStringArray(long n)
        {
            var array = new string[n];
            for (var i = 0; i < n; i++)
            {
                array[i] = Read();
            }
            return array;
        }

        public static int[] ReadIntArray(long n)
        {
            var array = new int[n];
            for (var i = 0; i < n; i++)
            {
                array[i] = ReadInt();
            }
            return array;
        }

        public static long[] ReadLongArray(long n)
        {
            var array = new long[n];
            for (var i = 0; i < n; i++)
            {
                array[i] = ReadLong();
            }
            return array;
        }

        public static double[] ReadDoubleArray(long n)
        {
            var array = new double[n];
            for (var i = 0; i < n; i++)
            {
                array[i] = ReadDouble();
            }
            return array;
        }
    }
}


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

namespace ABC176
{
    using static Ex;
    public class Solve
    {
        public static void Main(string[] args)
        {
            new ABC_A();
        }
    }
    public class ABC_A
    {
        public ABC_A()
        {
            var (n, x, t) = ReadIntArray().ToTpl3();
            int ans = n / x;
            if (n % x > 0) ans++;
            ans *= t;
            ans.Cw();
        }
    }
    public class ABC_B
    {
        public ABC_B()
        {
        }
    }
    public class ABC_C
    {
        public ABC_C()
        {
        }
    }

    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }



        public static bool Mins<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
        public static bool Maxs<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
        public static void Swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
        public static void Swap<T>(List<T> list, int i, int j) { T tmp = list[j]; list[j] = list[i]; list[i] = tmp; }

        public static long Lcm(int x, int y) { return x / Gcd(x, y) * y; }
        public static long Gcd(long m, long n) { if (n == 0) return m; return Gcd(n, m % n); }
        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static void yesno(this bool b) { (b ? "yes" : "no").Cw(); }
        public static void YesNo(this bool b) { (b ? "Yes" : "No").Cw(); }
        public static void YESNO(this bool b) { (b ? "YES" : "NO").Cw(); }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var v = new string[N]; for (long i = 0; i < N; ++i) v[i] = Read; return v; }
        public static int[] ReadIntArray(long N) { var v = new int[N]; for (long i = 0; i < N; ++i) v[i] = ReadInt; return v; }
        public static long[] ReadLongArray(long N) { var v = new long[N]; for (long i = 0; i < N; ++i) v[i] = ReadLong; return v; }

        public static (T, T) ToTpl2<T>(this T[] v) { return (v[0], v[1]); }
        public static (T, T, T) ToTpl3<T>(this T[] v) { return (v[0], v[1], v[2]); }
        public static (T, T, T, T) ToTpl4<T>(this T[] v) { return (v[0], v[1], v[2], v[3]); }
        public static (T, T, T, T, T) ToTpl5<T>(this T[] v) { return (v[0], v[1], v[2], v[3], v[4]); }
    }
}


Measured memory_bytes: 28260
#include <stdio.h>
#include <stdbool.h>
#define N 8
#define FREE -1
#define NOT_FREE 1

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

bool X[N][N];

void initialize(){
  int i;
  for(i=0;i<N;i++){
    row[i]=FREE;
    col[i]=FREE;
  }
  for(i=0;i<2*N-1;i++){
    dpos[i]=FREE;
    dneg[i]=FREE;
  }
}

void printBoard(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(X[i][j]){
        if(row[i]!=j){
          return;
        }
      }
    }
  }
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      printf((row[i]==j)?"Q":".");
    }
    printf("\n");
  }
}

void recursive(int i){
  int j;
  if(i==N){
    printBoard();
    return;
  }
  for(j=0;j<N;j++){
    if(NOT_FREE==col[j] ||
       NOT_FREE==dpos[i+j] ||
       NOT_FREE==dneg[i-j+N-1]) continue;

    row[i]=j;
    col[j]=NOT_FREE;
    dpos[i+j]=NOT_FREE;
    dneg[i-j+N-1]=NOT_FREE;

    recursive(i+1);

    row[i]=FREE;
    col[j]=FREE;
    dpos[i+j]=FREE;
    dneg[i-j+N-1]=FREE;
  }
}

int main(){
  int i,j,k,r,c;

  initialize();

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      X[i][j]=false;
    }
  }
  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d",&r);
    scanf("%d",&c);
    X[r][c]=true;
  }
  recursive(0);
  return 0;
}


Measured memory_bytes: 2108
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String y = s.substring(0, 4);
		String m = s.substring(5, 7);
		String d = s.substring(8, 10);

		int ye = Integer.parseInt(y);
		int mo = Integer.parseInt(m);
		int da = Integer.parseInt(d);

		boolean tbd = true;
		if (ye <= 2018) {
			tbd = false;
		}else if(ye>=2020){
	tbd=true;
}else if(mo<=4){
	tbd=false;

}else{
	tbd=true;
}
		if(tbd){
			System.out.println("TBD");
		}else{System.out.println("Heisei");}



	}
}

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

int main() {
    string S;
    cin >> S;
    rep(i, S.size()){
        cout << "x";
    }
}


Measured memory_bytes: 256