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

typedef long long Int;

const int B = 5;
Int dp[222222][B];


void solve(std::string S){
	for(int i = 0;i < S.size();i++){
		for(int d = 1;d <= B;d++){
			dp[i][d-1] = 0;
			int j = i - d;
			if(j == -1){
				dp[i][d-1] = 1;
			}else if(j < 0){
				continue;
			}else{
				string s0 = S.substr(j+1,d);
				for(int d2 = 1;d2 <= B;d2++){
					if(dp[j][d2-1]==0)continue;
					int j2 = j - d2;
//					if(j2 < 0)continue;
					string s2 = S.substr(j2+1,d2);
					if(s0 == s2)continue;
					dp[i][d-1] = max(dp[j][d2-1] + 1, dp[i][d-1]);
				}
			}
		}
	}
	Int ans = -1;
	for(int i = 0;i < B;i++){
		ans = max(ans, dp[S.size()-1][i]);
	}
	cout<<ans<<endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
	std::string S;
	std::cin >> S;
	solve(S);
	return 0;
}

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

#define MAX 1000000

vector<int> prime;
bool is_prime[MAX+1];

void Sieve() {
  
  for(int i=0; i<=MAX; i++) {
    is_prime[i] = true;
  }
  
  is_prime[0] = is_prime[1] = false;
  
  for(int i=2; i<=MAX; i++) {
    if(is_prime[i]) {
      prime.push_back( i );
      for(int j=2*i; j<=MAX; j+=i) is_prime[j] = false;
    }
  }
}

int main() {
  
  Sieve();
  
  int n;
  while(cin >> n && n) {
    int sum = 0;
    for(int i=0; i<n; i++) {
      sum += prime[i];
    }
    cout << sum << endl;
  }
  
  return 0;
}

Measured memory_bytes: 2564
#include<iostream>
using namespace std;
int main(){
string q;
cin>>q;long n=0,e=0,w=0,s=0;
for(long i=0;i<q.size();i++){
    if(q[i]=='N')n++;
    if(q[i]=='W')w++;
    if(q[i]=='E')e++;
    if(q[i]=='S')s++;
}
if(n!=0&&s==0){cout<<"No"<<endl;return 0;}
if(s!=0&&n==0){cout<<"No"<<endl;return 0;}
if(e!=0&&w==0){cout<<"No"<<endl;return 0;}
if(w!=0&&e==0){cout<<"No"<<endl;return 0;}
cout<<"Yes"<<endl;}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll mod=1e9+7;

int main() {
  map<ll,ll> count;
  for(ll i=0;i<6;i++) {
    ll temp;
    cin >> temp;
    count[temp]++;
  }
  for(auto p: count) {
    if(p.second>2) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  string s;
  cin>>s;
  int n=s.size();
  for(int i=0;i<n;i++){
    if(s[i]=='C'){
      for(int j=i;j<n;j++){
        if(s[j]=='F'){cout<<"Yes"<<endl;return 0;}
      }
    }
  }
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
 
int main(){
    string s;
    cin >> s;
    bool ans = true;
    rep(i, s.size()) {
        if (i%2==0 && s[i]=='L') ans = false;
        if (i%2==1 && s[i]=='R') ans = false;
    }
    if (ans==true) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
N = list(map(int, input()))
K = int(input())

DP_conf = [[0] * (K+1) for _ in range(len(N))]
DP_unco = [[0] * (K+1) for _ in range(len(N))]

DP_conf[0][0] = 1
DP_conf[0][1] = N[0] - 1
DP_unco[0][0] = 0
DP_unco[0][1] = 1

for i in range(1,len(N)):
	for j in range(K+1):
		if j > i+1:
			break
		
		if j == 0:
			DP_conf[i][j] = 1
			DP_unco[i][j] = 0

		else:
			DP_conf[i][j] = DP_conf[i-1][j] + DP_conf[i-1][j-1] * 9
			if N[i] > 0:
				DP_conf[i][j] += DP_unco[i-1][j] + DP_unco[i-1][j-1] * (N[i] - 1)
				DP_unco[i][j] = DP_unco[i-1][j-1]
			else:
				DP_unco[i][j] = DP_unco[i-1][j]

print(DP_conf[-1][K] + DP_unco[-1][K])
			


Measured memory_bytes: 3064
from math import sqrt
def prime(n):
    if n == 2:
        return True
    elif n < 2 or n % 2 == 0:
        return False
    else:
        i = 3
        while i <= sqrt(n):
            if n % i == 0:
                return False
            i += 2
    return True

n = int(input())
c = 0
for i in range(n):
    if(prime(int(input()))):
        c += 1

print(c)

Measured memory_bytes: 7732
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

fn main() {
    let n = read1::<isize>();
    let a = readn::<isize>(" ");

    let s2 = a.iter().map(|x| x*x).sum::<isize>();
    let s1 = a.iter().sum::<isize>();
    let m1 = s1 / n;
    let m2 = (s1 + n - 1) / n;

    let ans = std::cmp::min(n * m1 * m1 + s2 - 2 * s1 * m1, n * m2 * m2 + s2 - 2 * s1 * m2);
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007

using namespace std;

typedef long long ll;

int n, da, db;
vector<vector<bool> > go(int n, int dist)
{
    vector<vector<bool> >a(2 * n, vector<bool>(2 * n));
    if(dist % 2 == 1)
    {
        for(int i = 0; i < 2 * n; ++i)
            for(int j = 0; j < 2 * n; ++j)
            {
                if((i + j) & 1)
                    a[i][j] = 1;
                else
                    a[i][j] = 0;
            }
    }
    else
        if(dist % 4 != 0)
        {
            for(int i = 0; i < 2 * n; i++)
                for(int j = 0; j < 2 * n; ++j)
                    if(i % 2 == 1)
                        a[i][j] = 1;
                    else
                        a[i][j] = 0;
        }
        else
        {
            vector<vector<bool> > a2 = go((n+1) / 2, dist / 4);
            for(int i = 0; i < n; i++)
                for(int j = 0; j < n; j++)
                    if(a2[i][j])
                    {
                        for(int ii = 0; ii < 2; ii++)
                            for(int jj = 0; jj < 2; jj++)
                                a[2 * i + ii][2 * j + jj] = 1;
                    }
        }
    return a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> da >> db;
    vector<vector<bool> >v1 = go(n, da);
    vector<vector<bool> >v2 = go(n, db);
    int s = n * n;
    for(int i = 0; i < 2 * n; i++)
        for(int j = 0; j < 2 * n; j++)
            if(!v1[i][j] && !v2[i][j] && s > 0)
            {
                s--;
                cout << i << " " << j << '\n';
            }
    return 0;
}


Measured memory_bytes: 1152
n,a,b,c=map(int,input().split())
l = []
for i in range(n):
  l.append(int(input()))
m = [a,b,c]
ans = 4000
for i in range(4**n):
  p = [0]*n
  k = i
  for j in range(n):
    p[j] = k % 4
    k //= 4
  cost = [-1,-1,-1]
  q = [[] for _ in range(4)]
  for j in range(n):
    q[p[j]].append(l[j])
  for j in range(3):
    if len(q[j+1]) != 0:
      cost[j] = 10 * (len(q[j+1]) - 1) + abs(sum(q[j+1])-m[j])
  if cost[0] != -1 and cost[1] != -1 and cost[2] != -1:
    ans = min(ans, cost[0] + cost[1] + cost[2])
print(ans)

Measured memory_bytes: 9152
/*
AOJ #2727
title:M and A
@kankichi573
2016/11/3 TLE 23/47
*/

#include <stdio.h>
#include <string.h>

int my_longest_match(char *s1,char *s2)
{
  char *p;

  for(;*s1 && *s2;s1++)
    {
      if(!(p=strchr(s2,*s1)))
	return(0);
      s2=p+1;
    }
  if(!*s1)
    return(1);
  else
    return(0);
}

char s[1001],t[1001];

int solve(char *s,char *t)
{

  int i,j,k,len = strlen(s),r1,r2;
  char buf[2][501];

  for(i=j=k=0;i<len;i++)
    if((i % 2)==0)
      buf[0][j++] = s[i];
    else
      buf[1][k++] = s[i];

  buf[0][j]=buf[1][k]='\0';


  //printf("%s\n",&buf[0][0]);
  //printf("%s\n",&buf[1][0]);

  r1=my_longest_match(&buf[0][0],t) ;
  r2=my_longest_match(&buf[1][0],t);
 
  //printf("r1,r2=%d %d\n",r1,r2);
 
  return(r1||r2);
}


int main()
{
  int ret;
  
  scanf("%s",s);
  scanf("%s",t);
  ret=solve(s,t);
  
  printf("%s\n",ret?"Yes":"No");
  return(0);
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

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

int main() {
    int H, W; cin >> H >> W;
    vector<vector<char>> g(H, vector<char> (W));
    rep(i, H) rep(j, W) cin >> g[i][j];
    int ans = 0;
    rep(i, H) rep(j, W) {
        if(g[i][j] == '#') continue;
        vector<vector<int>> seen(H, vector<int> (W, -1));
        seen[i][j] = 0;
        queue<pair<int, int>> q;
        q.push(make_pair(i, j));
        while(q.size()) {
            auto now = q.front(); q.pop();
            rep(k, 4) {
                int nx = now.first + dx[k];
                int ny = now.second + dy[k];
                if(nx < 0 || ny < 0 || nx >= H || ny >= W) continue;
                if(g[nx][ny] == '#') continue;
                if(seen[nx][ny] != -1) continue;
                seen[nx][ny] = seen[now.first][now.second] + 1;
                q.push(make_pair(nx, ny));
            }
        }
        int can = 0;
        rep(k, H) rep(l, W) chmax(can, seen[k][l]);
        chmax(ans, can);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
/*
Just Constraints are different than the other version
rest logic is similar
Constraints:
1<=n<=100
1<=wt<=10^9
1<=w[i]<=wt
1<=v[i]<=10^3
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll n , w;
    cin>>n >> w;
    ll wei[n],val[n],sum=0;
    for(int i =0; i< n;++i) {
    	cin>>wei[i] >> val[i];
      	sum+=val[i];
    }
    long long  dp[n+1][sum+1]; //n+1 weight and 1001 value
    for(int i = 0; i <= n; ++i){
    	for(int j = 0; j<= sum; ++j){
    		if(j == 0 )
    			dp[i][j] = 0;
    		else if( i == 0)
    			dp[i][j] = INT_MAX;
    		else if(val[i-1] > j )
    			dp[i][j] = dp[i-1][j];
    			else //note the difference of using min here and max in other version
    			dp[i][j]  = min(dp[i-1][j] , wei[i-1] + dp[i-1][j - val[i-1]]);
    		}
    	}
    	ll ans =0 ;
    	for(int i = 0; i <= sum; ++i){
    		if(dp[n][i] <= w && dp[n][i] != INT_MAX)
    		    ans = i;
    	}
    	cout<<ans<<endl;
}


Measured memory_bytes: 79104
N = int(input())
AB = []
for i in range(N):
    A, B = map(int, input().split())
    AB.append([A,B])
AB_list = AB
AB_list.sort(key=lambda x:x[0])
AB_list.sort(key=lambda x:x[1])
flag = True
task = 0
for i in range(N):
    task += AB_list[i][0]
    if task>AB_list[i][1]:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38112
/*****************Bismillahir Rahmanir Rahim***********************/

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

/************************Start Of Template*************************/

/******** Mahin Shefat - GhOstMan *************/


#define     pb              push_back
#define     popb            pop_back
#define     ll              long long int
#define     ull             unsigned long long int
#define     max3(a,b,c)     max(a,max(b,c))
#define     max4(a,b,c,d)   max(max3(a,b,c),d)
#define     min3(a,b,c)     min(a,min(b,c))
#define     min4(a,b,c,d)   min(a,min3(b,c,d))
#define     MOD             1000000007
#define     f               first
#define     s               second
#define     mem(a,v)        memset(a,v,sizeof(a))
#define     mp              make_pair
#define     check           printf("check")
#define     sqr(x)          (x)*(x)
#define     all(v)          v.begin(),v.end()
#define     fast            ios_base::sync_with_stdio(0);cin.tie(0)
#define     pii             pair<int,int>
#define     Pair            pair<ll,ll>
#define     MAX             1000000000000014
#define     MIN             -1000000000000014
#define     endl            '\n'
#define     Fread           freopen("inputdur.txt","r",stdin)
#define     Fwrite          freopen("output.txt","w",stdout)

/************************End Of Template*************************/
set < int > v;
set < int > :: iterator it;
std::vector< Pair > vec;
ll ans = 0;
int main(){
	int n , m;
	cin >> n >> m;
	for(int i = m; i >= 1; i--){
		v.insert(m - i);
	}		
	for(int i = 1; i <= n; i++){
		int a , b;
		cin >> a >> b;
		vec.pb(mp(b , a));
	}
	sort(all(vec));
	for(int i = vec.size() - 1; i >= 0; i--){
		int d = vec[i].s;
		d--;
		it = v.upper_bound(d - 1);
		//cout << *it << " " << d << " " << vec[i].f <<  " " << vec[i].s <<endl;
		if(it != v.end()){
			ans += vec[i].f;
			v.erase(*it);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 7156
#include<bits/stdc++.h>
using namespace std;
int ans[100005];
int main()
{
    long long a1[100005],a2[100005],a3[100005];
    long long x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    vector<long long>v;
    for(int i=0;i<a;i++)
    cin>>a1[i];
    for(int i=0;i<b;i++)
    cin>>a2[i];
    for(int i=0;i<c;i++)
    cin>>a3[i];
    sort(a1,a1+a);
    sort(a2,a2+b);
    for(int i=a-1;i>=a-x;i--)
    v.push_back(a1[i]);
    for(int i=b-1;i>=b-y;i--)
    v.push_back(a2[i]);
    for(int i=0;i<c;i++)
    v.push_back(a3[i]);
    sort(v.begin(),v.end());
    long long ans=0;
    for(int i=v.size()-1;i>=v.size()-x-y;i--)
    ans=ans+v[i];
    cout<<ans;
    return 0;
}

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

int n;

void koch(int depth,double x1,double y1,double x2,double y2){
  double sx=(2.0*x1+x2)/3.0;
  double sy=(2.0*y1+y2)/3.0;
  double ux=(x1+x2)/2.0+sqrt(3.0)*(y1-y2)/6.0;
  double uy=(y1+y2)/2.0+sqrt(3.0)*(x2-x1)/6.0;
  double tx=(x1+2.0*x2)/3.0;
  double ty=(y1+2.0*y2)/3.0;

  if(depth>=n) return;

  koch(depth+1,x1,y1,sx,sy);
  printf("%.8f %.8f\n",sx,sy);
  koch(depth+1,sx,sy,ux,uy);
  printf("%.8f %.8f\n",ux,uy);
  koch(depth+1,ux,uy,tx,ty);
  printf("%.8f %.8f\n",tx,ty);
  koch(depth+1,tx,ty,x2,y2);

}

int main(){
  cin>>n;
  printf("%.8f %.8f\n",0.0,0.0);
  koch(0,0.0,0.0,100.0,0.0);
  printf("%.8f %.8f\n",100.0,0.0);
}



Measured memory_bytes: 3240
#include <stdio.h>

#define N 251

int main() {
	int i,n;
	int H[N];

	scanf("%d",&n);
	for (i = 1; i <= n; i++) scanf("%d", &H[i]);
	for (i = 1; i <= n; i++) {
		printf("node %d: key = %d,", i, H[i]);
		if (i != 1) printf(" parent key = %d,", H[i/2]);
		if (i*2 <= n) printf(" left key = %d,", H[i*2]);
		if (i*2+1 <= n) printf(" right key = %d,", H[i*2+1]);
		printf(" \n");
	}

	return 0;
}

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

long long dp[100010][4] = {}, MOD = 1000000007;


int main() {
	string S;
	cin >> S;
	int N = S.size();

	for (int i = N; i >= 0; i--) {
		for (int j = 3; j >= 0; j--) {
			if (i == N) {
				dp[i][j] = (j == 3 ? 1 : 0);
			}
			else {
				dp[i][j] = dp[i + 1][j] * (S[i] == '?' ? 3LL : 1LL);
				if (j < 3 && (S[i] == '?' || S[i] == "ABC"[j])) {
					dp[i][j] += dp[i + 1][j + 1];
				}
				dp[i][j] %= MOD;
			}
		}
	}
	cout << dp[0][0] << endl;

	return 0;
}

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

using namespace std;


int main() {
#ifdef __APPLE__
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    string s;
    cin >> s;
    int n = s.size();
    s = "a" + s;
    vector<vector<int>> nxt(n + 1, vector<int>(26));
    vector<vector<int>> need(26);
    for (int i = 0; i <= n; ++i) {
        int c = s[i] - 'a';
        while (!need[c].empty()) {
            nxt[need[c].back()][c] = i;
            need[c].pop_back();
        }
        for (int j = 0; j < 26; ++j)
            need[j].push_back(i);
    }
    vector<char> used(n + 1);
    vector<int> par(n + 1);
    queue<int> q;
    q.push(0);
    int pos = -1;
    char fc = 0;
    while (!q.empty() && pos == -1) {
        int v = q.front();
        q.pop();
        for (int c = 0; c < 26; ++c) {
            int to = nxt[v][c];
            if (!to) {
                pos = v;
                fc = 'a' + c;
                break;
            } else {
                if (!used[to]) {
                    used[to] = true;
                    par[to] = v;
                    q.push(to);
                }
            }
        } 
    }
    string ans;
    ans += fc;
    for (int v = pos; v != 0; v = par[v]) {
        ans += s[v];
    }
    reverse(ans.begin(), ans.end());
    cout << ans;
    return 0;
}

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

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define rep1(i,n) rep(i,1,n+1)
#define repR(i,s,n) for(ll i = (n-1); i >= (s); i--)
#define repR0(i,n) repR(i,0,n)
#define repR1(i,n) repR(i,1,n+1)

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR;
#define fcout cout << fixed << setprecision(18)

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

int a[100];
int cells[100][100]; // r * c

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

  vector<pair<int, int> > pairs(N);
  rep0(i, N) {
    ll temp;
    cin >> temp;
    pairs[i] = make_pair(temp, i);
  }
  sort(pairs.begin(), pairs.end());

  cout << pairs[0].second + 1;
  rep(i, 1, N) {
    cout << SP << pairs[i].second + 1;
  }

  return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int A, B, C, K; cin >> A >> B >> C >> K;

	eREP(i, K) {
		eREP(j, K - i) {
			int a = A, b = B, c = C;
			REP(p, i)a *= 2;
			REP(p, j)b *= 2;
			REP(p,K - i - j)c *= 2;
			if (c > b&&c > a&&b > a) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 3648
macro_rules! scan_sub {
    ( $itr:ident, $t:ty ) => {
        let mut buf = String::new();
        let $itr = {
            while buf.trim().len() == 0 {
                buf = String::new();
                std::io::stdin().read_line(&mut buf).unwrap();
            }
            buf.split_whitespace().map(|n| n.parse::<$t>().unwrap())
        };
    };
}

macro_rules! scan {
    ( $x:ident; Vec<$t:ty> ) => {
        scan_sub!(itr, $t);
        let $x = itr.collect::<Vec<_>>();
    };
    ( $( $x:ident ),*; $t:ty ) => {
        scan_sub!(itr, $t);
        let mut itr = itr;
        $(
            let $x = itr.next().unwrap();
        )*
    };
}

use std::collections::HashMap;

fn main() {
    scan!(_n; usize);
    scan!(array; Vec<usize>);

    let mut table = HashMap::new();
    let mut flag = true;

    for a in array {
        if table.get(&a).is_none() {
            table.insert(a, ());
        } else {
            flag = false;
            break;
        }
    }

    println!("{}", if flag {"YES"} else {"NO"});
}


Measured memory_bytes: 14500
/* This code is written by Nemlit */
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define rep(i, a, b) for(re int i = (a); i <= (b); ++ i)
#define drep(i, a, b) for(re int i = (b); i >= (a); -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define int long long
#define D double
#define inf 10234567890000000
#define mod 1000000007
#define lb(x) (x)&(-(x))
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
il int Mul(int a, int b) { return 1ll * a * b % mod; }
il int Inc(int a, int b) { return (a += b) >= mod ? a - mod : a; }
il int Dec(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
il int qpow(int a, int b) { int r = 1; while(b) { if(b & 1) r = Mul(r, a); a = Mul(a, a), b >>= 1; } return r; }
#define ls k * 2
#define rs k * 2 + 1
#define maxn 55
namespace Graph {
	int head[maxn], cnt;
	struct edge { int v, next, a, b; }e[maxn << 2];
	il void add(int u, int v, int a, int b) { e[++ cnt] = (edge){v, head[u], a, b}, head[u] = cnt; }
}
using namespace Graph;
int n, m, dp[maxn][5005], s, c[maxn], d[maxn], vis[maxn][5005];
struct node {
	int u, v;
};
queue<node>q;
signed main() {
	n = read(), m = read(), s = min(read(), 5000ll);
	rep(i, 1, m) {
		int u = read(), v = read(), a = read(), b = read();
		add(u, v, a, b), add(v, u, a, b);
	}
	mem(dp, 63), dp[1][s] = 0;
	rep(i, 1, n) c[i] = min(2500ll, read()), d[i] = read();
	q.push((node){1, s});
	while(!q.empty()) {
		int u = q.front().u, l = q.front().v; q.pop(), vis[u][l] = 0;
		Next(i, u) {
			int v = e[i].v;
			if(l >= e[i].a && dp[u][l] + e[i].b < dp[v][l - e[i].a]) {
				dp[v][l - e[i].a] = dp[u][l] + e[i].b;
				if(vis[v][l - e[i].a] == 0) q.push((node){v, l - e[i].a}), vis[v][l - e[i].a] = 1;
			}
		}
		int tim = dp[u][l];
		l += c[u], tim += d[u];
		while(l <= 5000) {
			if(tim < dp[u][l]) {
				dp[u][l] = tim;
				if(vis[u][l] == 0) q.push((node){u, l}), vis[u][l] = 1;
			}
			l += c[u], tim += d[u];
		}
	}
	rep(i, 2, n) {
		int ans = inf;
		rep(j, 0, 5000) ans = min(ans, dp[i][j]);
		printf("%lld\n", ans);
	} 
	return 0;
}


Measured memory_bytes: 10412
#include<bits/stdc++.h>
/*
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<numeric>
#include<iomanip>
#include<utility>
#include<cstdlib>
#include<typeinfo>
#include<stack>
#include<cassert>
#include<functional>
*/
#define int long long int
#define double long double
using namespace std;
#define INT_DMAX 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define rep(i,n) for(int (i)=0, i##_len = (n);(i)<i##_len;(i)++)
#define reps(i,x) for(int (i)=1;(i)<=(int)(x);(i)++)
#define rrep(i,x) for(int (i)=((int)(x)-1);(i)>=0;(i)--)
#define rreps(i,x) for(int (i)=((int)(x));(i)>0;(i)--)
#define FOR(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define bit(n) ((int)(1)<<(n))
#define all(x) (x).begin(),(x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl 
#define nint int
using namespace std;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
typedef pair<int,int> p;
typedef pair<double,double> dop;
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 gcd(int a,int b){return b?gcd(b,a%b):a;}
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;


signed main()
{
int n;
std::cin >> n;
std::vector<int> a;
rep(i,n){
    int temp;
    std::cin >> temp;
    a.pb(temp);
}
int sum = 0;
int out = 0;
int outt = 0;
sum =  a[0];
if(sum == 0){
    out++;
    sum++;
}
for(int i = 1; i < n; i++){
    if(sum < 0){
        if(a[i] + sum > 0){
            sum = a[i] + sum;
        } else {
            out += abs(sum + a[i]) + 1; 
            sum = 1;
        }
    } else {
        if(a[i] + sum < 0){
            sum = a[i] + sum;
        } else {
            out += abs(sum + a[i]) + 1;
            sum = -1;
        }
    }
}
if(a[0] < 0){
    sum = 1;
    outt += abs(a[0])+ 1;
} else {
    sum = -1;
    outt += abs(a[0]) + 1;
}
for(int i = 1; i < n; i++){
    if(sum < 0){
        if(a[i] + sum > 0){
            sum = a[i] + sum;
        } else {
            outt += abs(sum + a[i]) + 1; 
            sum = 1;
        }
    } else {
        if(a[i] + sum < 0){
            sum = a[i] + sum;
        } else {
            outt += abs(sum + a[i]) + 1;
            sum = -1;
        }
    }
}
std::cout << min(out,outt) << std::endl;
return 0;
}

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

using namespace std;

bool compare(string &A, string &B, int idx)
{
  if(A.size() > B.size()) return (false);
  if(A.size() < B.size()) return (true);
  if(A[idx] == B[idx]) return (compare(A, B, idx + 1));
  return (A[idx] < B[idx]);
}

int main()
{
  string A, B;
  cin >> A >> B;
  if(A == B) {
    cout << "EQUAL" << endl;
  } else if(compare(A, B, 0)) {
    cout << "LESS" << endl;
  } else {
    cout << "GREATER" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define endl "\n"
#define rep(i, a, n) for (int i = a; i < n; ++i)
#define all(x) (x).begin(), (x).end()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;

    if (abs(a - b) <= (v - w) * t) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 3644
nums = input()
op = [""]*3
for i in range(2**3):
    b = bin(i)[2:]
    b = "0"*(3 - len(b)) + b
    for j in range(len(b)):
        if b[j] == "1":
            op[j] = "+"
        else:
            op[j] = "-"
    string = "".join(nums[i]+op[i] for i in range(3))+nums[-1]
    if eval(string) == 7:
        print(string + "=7")
        break

Measured memory_bytes: 9072
import math
D,G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]
perf = [(pc[i][0]*100*(i+1)+pc[i][1]) for i in range(D)]
bitD=2**D - 1
MIN=0
for i in range(D):
    MIN+=pc[i][0]
for i in range(bitD):
    b = bin(i)
    b = b.lstrip("0b")
    blen=len(b)
    j=0
    for j in range(D-blen):
        b="0"+b
    blist=list(b)
    k=0
    flag=0
    briflag=0
    count=0
    d=0
    for k in range(D):
        I=D-1-k
        if blist[k]=="1":
            d+=perf[I]
            count+=pc[I][0]
            if G < d:
                briflag=1
                break
        else:
            if flag == 0:
                flag+=1
                zanindex = I
            else:
                pass
    if briflag == 1:
        MIN=min(count,MIN)
    else:
        zan = math.ceil((G-d)/(100*(zanindex+1)))
        if zan <= pc[zanindex][0]:
        	count+=zan
        	MIN=min(count,MIN)
        else:
          pass
print(MIN)
        
                

Measured memory_bytes: 3188
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;

int main() {
  //
  int n;
  cin >> n;
  vi p(n);
  rep(i, n) cin >> p[i];
  int ans = 0;
  REP(i, 1, n - 1) {
    if ((p[i - 1] < p[i] && p[i] < p[i + 1]) ||
        (p[i - 1] > p[i] && p[i] > p[i + 1])) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 888
AB = input().split(' ')
A = int(AB[0])
B = int(AB[1])
predictA = round(A/0.08)
if predictA < A/0.08:
    predictA += 1
predict_maxA = round((A+1)/0.08)
if predict_maxA < (A+1)/0.08:
    predict_maxA += 1
predictB = B*10
predict_maxB = (B+1)*10
preA = [x for x in range(predictA,predict_maxA)]
preB = [x for x in range(predictB,predict_maxB)]
pre = preA + preB
res = [x for x in set(pre) if pre.count(x) > 1]
if len(res)>0:
    print(min(res))
else:
    print(-1)

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


int main(){
  string s;
  cin >> s;
  int ans=0;
  bool ha=false;
  int n=s.size();
  while(ha==false){
    if(n%2==0){
      n=n-2;
    }else{
      n=n-1;
    }
    bool h=true;
    for(int i=0;i<n/2;++i){
      if(s[i]!=s[i+n/2]){
        h=false;
      }
    }
    if(h==true){
      ha=true;
      ans=max(ans,n);
    }
  }
  cout << ans << endl;
  return 0;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  string S;
  cin>>N>>K>>S;
  int uh=0;
  if(S.at(0)=='L') uh++;
  if(S.at(N-1)=='R') uh++;
  for(int i=1;i<N;i++){
	if(S.at(i)=='L'&&S.at(i-1)=='R') uh+=2;
  }
  if(uh-2*K<=1)cout<<N-1<<endl;
  else cout<<N-uh+2*K<<endl;
}



Measured memory_bytes: 512
<?php
fscanf(STDIN, "%d %d", $n, $m);
$a = []; $b = []; $c = []; $d = [];
for($i = 0; $i < $n; $i++) {
    fscanf(STDIN, "%d %d", $a[$i], $b[$i]);
}
for($j = 0; $j < $m; $j++) {
    fscanf(STDIN, "%d %d", $c[$j], $d[$j]);
}
for($i = 0; $i < $n; $i++) {
    $min_dist = abs($a[$i] - $c[0]) + abs($b[$i] - $d[0]);
    $no = 1;
    for($j = 0; $j < $m; $j++) {
        $cur_dist = abs($a[$i] - $c[$j]) + abs($b[$i] - $d[$j]);
        if($min_dist > $cur_dist) {
            $min_dist = $cur_dist;
            $no = $j + 1;
        }
    }
    echo $no. "\n";
}

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

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

    int max = 0;
    for (int i = 0; i < s.size(); ++i) {
        int cnt = 0;
        for (int j = i; j < s.size(); ++j) {
            if (s[j] == 'A' || s[j] == 'G' || s[j] == 'C' || s[j] == 'T') {
                ++cnt;
            } else {
                break;
            }
        }
        max = std::max(max, cnt);
    }

    std::cout << max << std::endl;

    return 0;
}


Measured memory_bytes: 256
ll= lambda : list(map(int,input().split()))
testcases=1
# testcases=int(input())
for testcase in range(testcases):
	[w,h,x,y]=ll()
	if x==w/2 and y==h/2:
		print((w*h)/2,1)
	else:
		print((w*h)/2,0)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef long double lld;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define sortvec(a) sort(a.begin(), a.end())

void print(){cout<<endl;}
template<typename T,typename... Args>
void print(T a, Args... args) {cout<<a<<" ";print(args...);}
lli llipowerp(lli x, lli y, lli p)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
lli binarySearch(vector<int> arr, int l, int r, int x)
{
    if (r >= l)
    {
        lli mid = l + (r - l) / 2;
        if (arr[mid] == x)
            return mid;
        if (arr[mid] > x)
            return binarySearch(arr, l, mid - 1, x);
        return binarySearch(arr, mid + 1, r, x);
    }
    return -1;
}
template <typename T>
inline void printvec(vector<T> inp){
    for(auto it:inp) cout<<it<<" ";
    cout << endl;
}
//---------------------------------------------------------------------------------


lli KMP(string X, string Y)
{
    lli res=0;
    lli m = X.length();
    lli n = Y.length();

    // if Y is an empty string
    if (n == 0)
    {
        //cout << "Pattern occurs with shift 0";
        res++;
    }

    // if X's length is less than that of Y's
    if (m < n)
    {
        // cout << "Pattern not found";
        return 0LL;
    }

    // next[i] stores the index of next best partial match
    lli next[n + 1];

    for (lli i = 0; i < n + 1; i++)
        next[i] = 0;

    for (lli i = 1; i < n; i++)
    {
        lli j = next[i + 1];

        while (j > 0 && Y[j] != Y[i])
            j = next[j];

        if (j > 0 || Y[j] == Y[i])
            next[i + 1] = j + 1;
    }

    for (lli i = 0, j = 0; i < m; i++)
    {
        if (X[i] == Y[j])
        {
            if (++j == n)
                res++;
        }
        else if (j > 0)
        {
            j = next[j];
            i--; // since i will be incremented in next iteration
        }
    }
    return res;
}


int main()
{
    string inp;
    cin>>inp;
    vector<lli> rem(inp.size());
    rem[inp.size()-1]=inp[inp.size()-1]-'0';
    for(int i=inp.size()-2;i>=0;i--){
        rem[i]=(inp[i]-'0')*llipowerp(10,(inp.size()-i-1),2019)+rem[i+1];
        rem[i]%=2019;
    }
    vector<lli> counts(2019,0);
    fori(rem.size()){
        counts[rem[i]]++;
    }
    counts[0]++;
    lli ans=0;
    fori(2019){
        ans+=(counts[i]*(counts[i]-1))/2;
    }

    cout<<ans<<endl;
}

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

struct Node{
    int parent;
    int left;
    int right;
};

int D[25],H[25];
struct Node T[25];

int sibling(int u){
    if(T[u].parent == -1)return -1;
    if(T[T[u].parent].left != u && T[T[u].parent].left != -1){
        return T[T[u].parent].left;
    }
    if(T[T[u].parent].right != u && T[T[u].parent].right != -1){
        return T[T[u].parent].right;
    }
    return -1;
}

void print(int u){
    printf("node %d: parent = %d, sibling = %d, ",u,T[u].parent,sibling(u));
    int deg= 0;
    if(T[u].left != -1)deg++;
    if(T[u].right != -1)deg++;
    printf("degree = %d, depth = %d, height = %d, ",deg,D[u],H[u]);
    
    
    if(T[u].parent == -1)cout << "root\n";
    else if(T[u].left == -1 && T[u].right == -1 )cout << "leaf\n";
    else cout << "internal node\n";
    
}

void setdepth(int u,int p){
    if(u == -1)return;
    D[u] = p;
    if(T[u].right != -1){
        setdepth(T[u].right,p + 1);
    }
    if(T[u].left != -1){
        setdepth(T[u].left,p + 1);
    }
}
int setheight(int u){
    int h1 = 0;
    int h2 = 0;
    
    if(T[u].right != -1){
        h1 = setheight(T[u].right) + 1;
    }
    if(T[u].left != -1){
        h2 = setheight(T[u].left) + 1;
    }
    return H[u] = max(h1, h2);
}

int main(){
    int n,v,l,r,root = 0;
    cin >> n;
    for(int i = 0;i < n;i++){
        T[i].parent = -1;
    }
    for(int i = 0;i < n;i++){
        cin >> v >> l >> r;
        T[v].left = l;
        T[v].right = r;
        if(l != -1)T[l].parent = v;
        if(r != -1)T[r].parent = v;
        
    }
    for(int i = 0;i < n;i++){
        if(T[i].parent == -1)root = i;
    }
    setdepth(root,0);
    setheight(root);
    for(int i = 0; i < n;i++)print(i);
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main(void){
	int n;
	cin >> n;
	vector<int> c(n+2);
	vector<int> dp(200010, 0);
	vector<int> v(200010, -1);

	for(int i = 0; i < n; ++i){
		cin >> c[i];
	}
	dp[0] = 1;
	v[c[0]] = 0;
	for(int i = 1; i < n; ++i){
		dp[i] = dp[i-1];
		if(c[i] == c[i-1]) continue;
		if(v[c[i]] != -1){
			dp[i] += dp[v[c[i]]];
		}
		v[c[i]] = i;
      dp[i] %= MOD;
	}

	// for(int i = 0; i < n; ++i){
	// 	cout << dp[i] << " ";
	// }
	cout << dp[n-1] % MOD << endl;
	return 0;
}

Measured memory_bytes: 2688
#define DEBUG 0

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

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------
const double PI = acos(-1.0);

int T[3000];
int main() {
    int i;
    int N,L;
    scanf("%d %d",&N,&L);
    for (i = 0; i < N; i++) scanf("%d",&T[i]);

    int j;
    double x = 0,y = 0;
    for (i = 0; i < N; i++) {
        for (j = 1; j < N; j++) {
            double a = (double) T[i]/L,b = (double) T[(i+j) % N]/L;
            double m = (a+b)/2;
            if (((i+j) % N) < i) m += 0.5;
            x += (N-j-1)*cos(2*PI*m),y += (N-j-1)*sin(2*PI*m);
        }
    }
    LLI w = (LLI) N*(N-1)*(N-2)/6;
    x /= w,y /= w;
    printf("%.15lf %.15lf\n",x,y);

    return 0;
}



Measured memory_bytes: 768
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define ALL(x)    (x).begin(),(x).end()
#define UNIQ(c)   (c).erase(unique(ALL((c))), end((c)))
#define mp        make_pair
#define eb        emplace_back
#define REP(i, a) for (int i = 0; i < (a); i++)

int N, C;
int s[100000], t[100000], c[100000];
int sum[200002];
int tt[200002];
int main() {
	cin >> N >> C;
	for (int i = 0; i < N; i++)cin >> s[i] >> t[i] >> c[i];
	for (int i = 1; i <= C; i++) {
		for (int j = 0; j < 200002; j++) tt[j] = 0;
		for (int j = 0; j < N; j++) if (c[j] == i) tt[s[j] * 2 - 1]++, tt[t[j] * 2]--;
		for (int j = 1; j < 200002; j++) tt[j] += tt[j - 1];
		for (int j = 0; j < 200002; j++) if (tt[j] > 0) sum[j]++;
	}
	int maxl = 0;
	for (int j = 0; j < 200002; j++) if (maxl < sum[j]) maxl = sum[j];
	cout << maxl << endl;
}


Measured memory_bytes: 3072
using System;

public class Hello
{
    public static void Main()
    {
        Console.ReadLine().Trim();
        var s =Console.ReadLine().Trim();
        var s2 = s.Replace(" ", "");
        Console.ReadLine().Trim();
        var t = Console.ReadLine().Trim();
        var t2 = t.Replace(" ", "");
        Console.WriteLine(t2.CompareTo(    s2) == 1? 1:0);
    }
}



Measured memory_bytes: 9944
#include <iostream>//I AK IOI!
#include <cstring>
using namespace std;
string a,b;
int a_i,b_i;
int main(){
    cin >> a >> b;
    while(1){
        if(a_i != a.size()){
            cout << a[a_i];
            a_i++;
    }
    if(b_i!=b.size()){
      cout << b[b_i];
      b_i++;
    }
    if(a_i == a.size() && b_i == b.size())break;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MIN(a, b) (a<b?a:b)

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

int main(int argc, char const* argv[])
{
	int n, i;
	int k;
	char s[100010];
	int l=0, r=0;
	int ans=0;
	scanf("%d%d%s",&n, &k, s+1);
	s[0] = '_';
	for(i=1; i<=n; i++) {
		if(s[i]=='L') {
			if(s[i-1]=='L') {
				ans++;
			} else {
				l++;
			}
		} else if(s[i]=='R') {
			if(s[i-1]=='R') {
				ans++;
			} else {
				r++;
			}
		}
	}
	int temp = MIN(l, r);
	if(temp > k) {
		ans += k*2;
	} else {
		ans = n-1;
	}
	printf("%d\n", ans);
	
	return 0;
}


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

int main(){
	int n,m;
	cin >> n >> m;
	priority_queue<int,vector<int>,less<int>> v;
	int tmp;
	for(int i=0;i<n;i++){
		scanf("%d",&tmp);
		v.push(tmp);
	}
	for(int i=0;i<m;i++){
		tmp = v.top();
		v.pop();
		tmp = tmp/2;
		v.push(tmp);
	}
	long long res = 0;
	for(int i=0;i<n;i++){
		tmp = v.top();
		//cout << tmp << endl;
		res += tmp;
		v.pop();
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 892
# Problem D - Teleporter

# input
N, K = map(int, input().split())
a_nums = list(map(int, input().split()))

# initialization
visit_list = [0]*N
visit_list[0] = 1
pos = a_nums[0]
visit_count = 1

while visit_list[pos-1]==0 and visit_count<K:
    visit_count += 1
    visit_list[pos-1] = visit_count
    pos = a_nums[pos-1]
visit_count += 1

# calc 1
if visit_count<K:
    tmp_1 = 0
    if pos==1:
        tmp_1 = visit_count - visit_list[pos-1] # 周期
    else:
        tmp_1 = visit_count - visit_list[pos-1]
    tmp_2 = (K-visit_count) % tmp_1 # 何周するのか
    # tmp_2回分ループ処理を行う
    for i in range(tmp_2+1):
        pos = a_nums[pos-1]

# output
print(pos)


Measured memory_bytes: 32348
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));

int main() {
	string a, b, c;
	cin >> a >> b >> c;
	if (a.back() == b.front() && b.back() == c.front()) cout << "YES";
	else cout << "NO";


	return 0;
}





Measured memory_bytes: 256
'use strict';
process.stdin.on('data', function(chunk) {
  var inputs = chunk.toString().trim();
  var r = Number(inputs);

  console.log(
    Math.PI * Math.pow(r,2)
    , 2 * Math.PI * r
  );
});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 15584
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
l_a = [list(map(int, input().split())) for _ in range(n)]

res = 0
for a in l_a:
    s = c
    for x, y in zip(a, b):
        s += x * y
    if s > 0:
        res += 1
print(res)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	for(int i=0;i<2;i++){
	if(a>b){
		int tmp=a;
		a=b;
		b=tmp;
	}
	if(b>c){
		int tmp=b;
		b=c;
		c=tmp;
	}
	if(a>c){
		int tmp=a;
		a=c;
		c=tmp;
	}
	}
	cout<<a<<" "<<b<<" "<<c<<endl;
	return 0;
}

Measured memory_bytes: 1164
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);

int r = sc.nextInt();
int d = sc.nextInt();
int x2000 = sc.nextInt();

if (r >= 2 && r <= 5 && d >= 1 && d <= 100 && x2000 > d && x2000 <= 200) {

int a = ((r*x2000)-d);
System.out.println(a);
int b = ((r*a)-d);
System.out.println(b);
int c = ((r*b)-d);
System.out.println(c);
int e = ((r*c)-d);
System.out.println(e);
int f = ((r*e)-d);
System.out.println(f);
int g = ((r*f)-d);
System.out.println(g);
int h = ((r*g)-d);
System.out.println(h);
int i = ((r*h)-d);
System.out.println(i);
int j = ((r*i)-d);
System.out.println(j);
int k = ((r*j)-d);
System.out.println(k);
}
}
}

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

int main(){

  int n, k, b, f;
  int sum[110], s[110];

  while(1){
    cin>>n>>k;
    if(n==0&&k==0) break;

    for(int i=0;i<k;i++){
      cin>>s[i];
      sum[i]=0;
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<k;j++){
	cin>>b;
	sum[j]+=b;
      }
    }
    f=0;
    for(int i=0;i<k;i++){
      if(sum[i]>s[i]){
	f=1;
	break;
      }
    }
    if(f) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int constexpr maxrows = 1005;
int constexpr maxcols = 1005;
int constexpr MOD  = 1e9 + 7;
int rows, cols;
char grid[maxrows][maxcols];
int ways[maxrows][maxcols];

void read_input()
{
    cin >> rows >> cols;
    for(int i = 1; i <= rows; i++)
        for(int j = 1; j <= cols; j++) cin >> grid[i][j];
}

int go(int i, int j) {
    if(i < 1 || j < 1 || i > rows || j > cols) return 0;
    if(grid[i][j] == '#') return 0;
    if(ways[i][j] != -1) return ways[i][j];

    ways[i][j] = (go(i-1, j) + go(i, j-1)) % MOD;
    return ways[i][j];
}

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    read_input();
    for(int i = 0; i < maxrows; i++)
        for(int j = 0; j < maxcols; j++) ways[i][j] = -1;

    ways[1][1] = 1;
    cout << go(rows, cols) << endl;
}


Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
int main(){ 
    int N,M;
    cin >> N;
    string s[N];
    for(int i = 0; i < N; i++) cin >> s[i];
    cin >> M;
    string t[M];
    for(int i = 0; i < M; i++) cin >> t[i];
    int ma = 0;
    for(int i = 0; i < N; i++){
        int get = 0;
        for(int j = i; j < N; j++){
            if(s[i]==s[j]) get++;
        }
        for(int j = 0; j < M; j++){
            if(s[i]==t[j]) get--;
        }

        ma = max(ma,get);
    }
    cout << ma << endl;
    
}

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

void solve(long long N, long long T, std::vector<long long> t) {
    ll ans = 0;
    ll head = 0;
    rep(i, N) {
        if ((head - t[i]) > 0) {
            ans += T - (head - t[i]);
        } else {
            ans += T;
        }
        head = t[i] + T;
    }
    cout << ans << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    long long T;
    scanf("%lld", &T);
    std::vector<long long> t(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &t[i]);
    }
    solve(N, T, std::move(t));
    return 0;
}


Measured memory_bytes: 1792
package main

import (
	"fmt"
)

func main() {
	var a, b, v, w, t int64
	fmt.Scanf("%d %d", &a, &v)
	fmt.Scanf("%d %d", &b, &w)
	fmt.Scanf("%d", &t)

	if a < b && a+v*t >= b+w*t {
		fmt.Println("YES")
	} else if a > b && a-v*t <= b-w*t {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 1816
#include<bits/stdc++.h>
using namespace std;
int read(){
	char c=getchar();int f=1,sum=0;
	while(c>'9' or c<'0') if(c=='-'){f=-1;c=getchar();}
	while(c<='9' and c>='0'){sum=sum*10+c-'0';c=getchar();}
	return sum*f;
}
int main(){
	string a;
	cin>>a;
	int t=0,tf=1;
	for(int i=0;i<a.length();i++){
		if(a[i]=='C' and t==0) t++;
		if(a[i]=='F' and t==1){cout<<"Yes"<<endl;tf--;break;}
	}
	if(tf) cout<<"No"<<endl;

	return 0;
}

Measured memory_bytes: 256