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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

struct UFTree {
    static const int MAX_N = 1e6;
    int p[MAX_N], r[MAX_N], s[MAX_N];

    UFTree(int n) : p(), r(), s() {
        for(int i = 0; i < n; ++i) {
            p[i] = i;
            r[i] = 0;
            s[i] = 1;
        }
    }

    int root(int x) {
        return p[x] == x ? x : (p[x] = root(p[x]));
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if(x == y) return;

        if(r[x] < r[y]) {
            p[x] = y;
            s[y] = s[x] + s[y];
        } else {
            p[y] = x;
            s[x] = s[x] + s[y];
            if(r[x] == r[y]) r[x]++;
        }
    }

    int size(int x) {
        return s[root(x)];
    }
};

int n, m;
string s;

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

    V<Pii> edges(m);
    REP(i, m) {
        int a, b; cin >> a >> b;
        a--; b--;
        edges[i] = {a, b};
    }

    int cnt = 0;
    REP(i, m) {
        UFTree t = UFTree(n);
        REP(j, m) {
            if (i == j) continue;
            t.unite(edges[j].first, edges[j].second);
        }
        if (t.size(0) != n) cnt++;
    }
    std::cout << cnt << '\n';

    return 0;
}


Measured memory_bytes: 12032
// 0-1 knapsack problem with rep

#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
#define ll long long
using namespace std;

void printDp(vector< vector<ll> >& dp,ll r,ll c)
{
	for(ll i=0;i<=r;i++)
	{
		for(ll j=0;j<=c;j++)
		{
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}
}

ll knapsack(vector< vector<ll> >& dp, vector<ll>& weight, vector<ll>& value,ll n, ll tw)
{
	//initializing 0th row and 0th col as 0
	for(ll i=0;i<=tw;i++)
	dp[0][i]=0;
	
	for(ll i=0;i<=n;i++)
	dp[i][0]=0;
	
	ll val;
	for(ll i=1;i<=n;i++)
	{
		for(ll w=1;w<=tw;w++)
		{
			dp[i][w]=dp[i-1][w];
			if(weight[i-1]<=w)
			{
				val=dp[i-1][w-weight[i-1]]+value[i-1];
				if(val>dp[i][w])
				{
					dp[i][w]=val;
				}
						
			}
		}
	}
	return dp[n][tw];
}

int main()
{
	ll tw;
	ll n;
	ll x,y;
	cin>>n;
	cin>>tw;
	vector<ll> items(n);
	vector<ll> value(n);
	vector< pair<ll,ll> > v;
	vector< vector<ll> > dp(n+1);
	for(ll i=0;i<=n;i++)
	{
		dp[i].resize(tw+1);
	}
	for(ll i=0;i<n;i++)
	{
		cin>>x>>y;
		v.push_back(make_pair(x,y));
	}
	for(ll i=0;i<n;i++)
	{
		items[i]=v[i].first;
	}
	for(ll i=0;i<n;i++)
	{
		value[i]=v[i].second;
	}
	cout<<knapsack(dp,items,value,n,tw);
	
	//printDp(dp,n,tw);
	return 0;
}


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

int main() {
  int N, H, W, ans = 0;
  cin >> N >> H >> W;

  int a, b;
  for (int i = 0; i < N; i++) {
    cin >> a >> b;
    if (a >= H && b >= W) {
      ans++;
    }
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,m,i=0,h[200000],ans=0,c=0;
    string s;
    cin >> n;
    for(i=0;i<n;i++)
    {
        cin >> h[i];
    }
    h[n]=100000000010;
    for(i=0;i<n;i++)
    {
        if(h[i]>=h[i+1])
        {
            c++;
            if(ans<c)
            {
                ans=c;
            }
            continue;
        }
        c=0;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4380
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
using Pair = pair<int, int>;
int main() {
    int n, m;
    cin >> n >> m;
    auto pairs = vector<Pair>(0);
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        pairs.push_back(make_pair(a, b));
    }
    // (a,b)ペアをaに関し昇順ソートしておく
    sort(pairs.begin(), pairs.end(), [](const Pair &x, const Pair &y) {
        return x.first < y.first;
    }); // (a,b)ペアをbについて重み付けした優先度付きキューの評価関数
    auto c = [](const Pair &x, const Pair &y) {
        return x.second < y.second;
    };
    // 優先度付きキューを用意
    priority_queue<Pair, vector<Pair>, decltype(c)> queue(c);
    int sum = 0;
    auto iterator = pairs.begin();
    reps(i, m) { // 後ろから1日目〜m日目についてループ
        // 後ろからi日目には，(a,b)ペアのaが新たにi以下になったものが候補に入るのでキューに入れる
        while (iterator != pairs.end() && iterator->first <= i) {
            queue.push(*iterator);
            iterator++;
        }
        // キューに入っている(a,b)ペアの中でbが最大のものを取り出す
        if (queue.size() > 0) {
            sum += queue.top().second;
            queue.pop();
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 2548
def main():
  n,k,*t=map(int,open(0).read().split())
  e=[set()for _ in[0]*n]
  for a,b in zip(t[::2],t[1::2]):
    e[a-1].add(b-1)
    e[b-1].add(a-1)
  c,q=k,[0]
  while q:
    v,i=q.pop(),1
    for w in e[v]:
      c=c*(k-i-(v>0))%(10**9+7)
      e[w]-={v}
      q+=w,
      i+=1
  print(c)
main()

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

int main() {
	int d, n;
	cin >> d >> n;
	int c = 1;
	for (int i = 1;i<=d ; i++) {
		c = c * 100;
	}
	if (n != 100) {
		cout << c * n << endl;
	}
	else {
		cout << c * 101 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

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;
}
//using P = pair<int,int>;
//pow(x,n)
//cout << fixed << setprecision(桁数);
//string = to_string(数値)
//int = stoi(文字列)
//(int)(char-'0')
//string = itoa(int)
//円周率: M_PI


int main() {
    int64_t a, b, c, k; cin>>a>>b>>c>>k;

    if(a>=k) cout << k;
    else if(a+b>=k){
        cout << a << endl;
    }
    else{
        cout << a-(k-a-b) << endl;
    }
}

Measured memory_bytes: 3632
import java.util.Scanner;

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

	private void solveD() {
		Scanner sc = new Scanner(System.in);
		long K = sc.nextLong();
		long M = K / 50L;
		long N = K % 50L;
		if (M == 0) {
			if (N == 0) {
				System.out.println(2);
				System.out.println("1 1");
			} else if (N == 1) {
				System.out.println(2);
				System.out.println("0 2");
			} else {
				System.out.println(N);
				System.out.print(N);
				for (int i = 1; i < N; i++) {
					System.out.print(" " + N);
				}
				System.out.println();
			}
		} else {
			System.out.println(50);
			System.out.print(49L + M - N);
			int i = 1;
			for (; i < 50 - N; i++) {
				System.out.print(" " + (49L + M - N));
			}
			for (; i < 50; i++) {
				System.out.print(" " + (100L + M - N));
			}
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string S;
  cin >> N >> S;
  int count = 0;
  
  for(int i=0;i<N-2;i++){
    if(S.at(i)=='A'){
      if(S.at(i+1)=='B'){
        if(S.at(i+2)=='C'){
          count++;
        }
      }
    }
  }
  cout << count << endl;
}
 

Measured memory_bytes: 3608
#include<stdio.h>

int isPrime(x) {
	int d = 1, i, k, l = 0;
	if (x == 2) {
		d = 1;
	}
    else if (x < 2 || x % 2 == 0) {
        d = 0;
    }
    else {
		for (k = 1; x > k * k; k++) {
			l = k;
		}
		for (i = 3; i < l + 2; i+= 2) {
			if (x % i == 0) {
				d = 0;
			}
		}
	}
	return d;
}

int main() {
	int N[10000], c = 0, j, n;
	scanf("%d", &n);
	for (j = 0; j < n; j++) {
		scanf("%d", &N[j]);
	}
	for (j = 0; j < n; j++) {
	    c += isPrime(N[j]);
	}
	printf("%d\n",c);
	
	return 0;
}
    


Measured memory_bytes: 2136
L=int(input())

p=[1]*21
N=0
for i in range(20):
    p[i+1]=p[i]*2
    if p[i+1]>L:
        N=i+1
        break

        
ans=[]
M=0
for i in range(N-1):#2の累乗
    ans.append([i+1,i+2,0])
    ans.append([i+1,i+2,p[i]])
    M+=2
    
path=L-p[N-1]#２進数表記でbitが1なら終点への辺を足す
N2=len(bin(path))-2    


#途中の頂点から終点まで
for i in range(N):
    if path&1 ==1:
        ans.append([i+1,N,L-p[i]])
        M+=1
        L-=p[i]
    path=path>>1
    
print(' '.join(map(str, [N,M])))
for i in range(M):
    print(' '.join(map(str, ans[i])))

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

typedef long long ll;
typedef unsigned long long ull;
typedef string st;
typedef double db;
typedef vector<long long> vecll;
typedef vector<char> vechar;

int main(){
    ll N;
    cin >> N;
    vector<tuple<string, ll, ll>> SP(N);
    for(ll i = 0; i < N; i++) {
        ll P;
        st S;
        cin >> get<0>(SP.at(i)) >> P;
        //get<0>(SP.at(i)) = S;
        get<1>(SP.at(i)) = -1 * P;
        get<2>(SP.at(i)) = i + 1;
    }
    sort(SP.begin(), SP.end());
    for(auto& i : SP) cout << get<2>(i) << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
LR=[list(map(int,input().split())) for _ in range(M)]

l,r=0,N
for lr in LR:
    x,y=lr[0],lr[1]
    l=max(l,x)
    r=min(r,y)

print(max(r-l+1,0))

Measured memory_bytes: 27332
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

using P = pair<int,int>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H,W,K;
    cin >> H >> W >> K;
    vvec<char> C(H,vec<char>(W));
    int sx,sy,gx,gy;
    cin >> sx >> sy >> gx >> gy;
    sx--; sy--; gx--; gy--;
    vec<set<int>> row(H),col(W);
    for(int i=0;i<H;i++) for(int j=0;j<W;j++){
        cin >> C[i][j];
        row[i].insert(j);
        col[j].insert(i);
    }
    for(int i=0;i<H;i++){
        row[i].insert(-1);
        row[i].insert(W);
    }
    for(int i=0;i<W;i++){
        col[i].insert(-1);
        col[i].insert(H);
    }
    int inf = 1e9;
    vvec<int> dp(H,vec<int>(W,inf));
    dp[sx][sy] = 0;
    row[sx].erase(sy);
    col[sy].erase(sx);
    queue<P> Q;
    Q.push({sx,sy});
    auto in = [&](int x,int y){
        return 0<=x && x<H && 0<=y && y<W;
    };

    while(!Q.empty()){
        auto [x,y] = Q.front(); Q.pop();
//        cerr << x << " " << y << "\n";
        int d = dp[x][y];
        //right
        auto it = row[x].upper_bound(y);
        while(it!=row[x].end()){
            int ny = *it;
            if(!in(x,ny)) break;
            if(C[x][ny]=='@') break;
            if(abs(y-ny)>K) break;
            if(dp[x][ny]==inf){
                dp[x][ny] = d+1;
                Q.push({x,ny});
                col[ny].erase(x);
            }
            it = row[x].erase(it);
        }
        //left
        it--;
        while(it!=row[x].end()){
            int ny = *it;
            if(!in(x,ny)) break;
            if(C[x][ny]=='@') break;
            if(abs(y-ny)>K) break;
            if(dp[x][ny]==inf){
                dp[x][ny] = d+1;
                Q.push({x,ny});
                col[ny].erase(x);
            }
            it = row[x].erase(it);
            it--;
        }
        
        //down
        it = col[y].upper_bound(x);
        while(it!=row[y].end()){
            int nx = *it;
            if(!in(nx,y)) break;
            if(C[nx][y]=='@') break;
            if(abs(x-nx)>K) break;
            if(dp[nx][y]==inf){
                dp[nx][y] = d+1;
                Q.push({nx,y});
                row[nx].erase(y);
            }
            it = col[y].erase(it);
        }
        //down
        it--;
        while(it!=row[y].end()){
            int nx = *it;
            if(!in(nx,y)) break;
            if(C[nx][y]=='@') break;
            if(abs(x-nx)>K) break;
            if(dp[nx][y]==inf){
                dp[nx][y] = d+1;
                Q.push({nx,y});
                row[nx].erase(y);
            }
            it = col[y].erase(it);
            it--;
        }
    }

    cout << (dp[gx][gy]!=inf? dp[gx][gy]:-1) << "\n";
}

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

int main(){
  int k; cin >> k;
  int a,b; cin >> a >> b;
  bool flag = 0;

  for(int i = a; i <= b; i++) {
    if(i % k == 0) flag = 1;
  }
  if(flag){
    cout << "OK" << endl;
  }
  else {
    cout << "NG" << endl;
  }
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <unordered_map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

struct UnionFind {
	vector<int> par;
	vector<int> rank;
	vector<long long> Size;

	UnionFind(int n)  {
	      par.resize(n); rank.resize(n); Size.resize(n);
		for(int i = 0; i <= n; i++) {par[i] = i; rank[i] = 0; Size[i] = 1;}
	}

	int find(int x) {if (par[x]==x) return x; else return par[x] = find(par[x]);}
	void unite(int x, int y) {
        x = find(x); y = find(y);
        if (x==y) return;
 
        if (rank[x]<rank[y]) swap(x, y);
        if (rank[x]==rank[y]) rank[x]++;
        par[y] = x;
        Size[x] += Size[y];
  }
	bool same(int x, int y) {return find(x)==find(y);}
	long long size(int i) {return Size[find(i)];}
};

ll ans[100005];
int N, M, K;

int main(void) {
    scanf("%d %d %d", &N, &M, &K);
    UnionFind fr(100005);

    rep(i, 0, M) {
        int a, b;
        scanf("%d %d", &a, &b);
        fr.unite(a, b);
        ans[a]++;
        ans[b]++;
    }

    rep(i, 1, N+1) ans[i] = fr.size(i) - ans[i];

    rep(i, 0, K) {
        int c, d;
        scanf("%d %d", &c, &d);
        if (fr.same(c, d)) {
            ans[c]--;
            ans[d]--;
        }
    }

    rep(i, 1, N+1) {
        if (i>1) printf(" ");
        printf("%lld", ans[i]-1);
    }
    printf("\n");



	return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
 using namespace std;
 #define rep(i,N) for(int i=0;i<int(N);++i)
 using ll = long long;
 using v_i = vector<int>;
 using v_ll = vector<ll>;
 using v_s = vector<string>;
 const int INF = 2147483647;

 int main(){
     int h1,m1,h2,m2,k;
     cin >> h1 >> m1 >> h2 >> m2 >> k;
     cout << (h2-h1)*60+m2-m1 -k<< endl;
     return 0;
 }

     //int nin = *max_element(a.begin(),p.end());
    //int nax = *max_element(a.begin(),p.end())-p.begin();
    //int min_index = min_element(p.begin(),p.end())-p.begin();
     //sort(l.begin(),l.end(),greater<int>());
     //stringは",charは'
     //ちょっとあやしかったら立ち止まって考える
     //例外処理はreturn忘れずに
     //文字列連結 文字+="aa" でできる

Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int H, W, m;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> H >> W >> m;

  vector<P> hm(H);
  REP(i, H) hm[i] = P(0, i);
  vector<P> wm(W);
  REP(i, W) wm[i] = P(0, i);

  set<P> se;
  REP(i, m) {
    int h, w;
    cin >> h >> w;
    h--; w--;
    se.insert(P(h, w));
    P ph = hm[h];
    P pw = wm[w];

    hm[h] = P(ph.first + 1, h);
    wm[w] = P(pw.first + 1, w);
  }

  sort(hm.begin(), hm.end(), greater<P>());
  sort(wm.begin(), wm.end(), greater<P>());

  int sum = hm[0].first + wm[0].first;
  int ans = 0;
  REP(i, hm.size()) REP(j, wm.size()) {
    if(sum > hm[i].first + wm[j].first) break;
    if(se.find(P(hm[i].second, wm[j].second)) != se.end()) {
      ans = max(ans, hm[i].first + wm[j].first - 1);
    } else {
      ans = max(ans, hm[i].first + wm[j].first);
      break;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 21924
#include <stdio.h>
#define N 100000

struct node{
  int id;
  int parent;
  int left;
  int right;
  int flag[3];
};

void serP(struct node *,int);

int main(){

  int h,i;
  struct node T[N];
  
  scanf("%d",&h);
  for( i = 1 ; i <= h ; i++){
    scanf("%d",&T[i].id);
  }

  serP(T,h);

  //test
  for( i = 1 ; i <= h ; i++){
    printf("node %d: key = %d, ",i,T[i].id);
    if(T[i].flag[0] != -1) printf("parent key = %d, ",T[i].parent);
    if(T[i].flag[1] != -1) printf("left key = %d, ",T[i].left);
    if(T[i].flag[2] != -1) printf("right key = %d, ",T[i].right);
    printf("\n");
  }

  return 0;
}


void serP(struct node *a,int h){

  int i,parent;

  for(i = 1 ; i <= h ; i++){
    
    parent = i/2;
    if(i == 1) a[i].flag[0] = -1;
    else a[i].parent = a[parent].id;

    if(i*2 > h) a[i].flag[1] = -1;
    else a[i].left = a[i*2].id;
   

    if(i*2+1 > h) a[i].flag[2] = -1;
    else a[i].right = a[i*2+1].id;
    
  }
  
}



Measured memory_bytes: 2052
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#define ll long long
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define pi(n) prllf("%d",n)
#define pl(n) prllf("%d",n)
using namespace std;

int main(){
  int a,b;
  cin>>a>>b;
  int m = a+b;
  int n = a-b;
  int o = a*b;
  int k = max(m,max(n,o));
  cout<<k<<endl;

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			int in = Integer.parseInt(br.readLine());
			System.out.println(48-in);

		}
	}
}

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

using namespace std;

using ll = long long;

const long long MOD_NUMBER = 1000000007;
const double PI = 3.14159265358979323846;

int main() {
  ll a, b2;
  string b;
  cin >> a >> b;
  b2 = (b[0] - '0') * 100;
  b2 += (b[2] - '0') * 10;
  b2 += b[3] - '0';
  cout << a * b2 / 100 << endl;
  return 0;
}


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

int main(){
  int a,b,c;
  while(cin >> a >> b,a+b){
    if(a < b)swap(a,b);
    int cnt = 0;
    while(1){
      c = a%b;
      a = b;
      b = c;
      cnt++;
      if(c == 0)break;
    }
    cout << a <<" "<<cnt <<  endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
     
int main() 
{
   int N;
   cin >> N;
   string S;
   bool flag=false;

   rep(i, N) 
    {
      cin >> S;
      if (S == "Y") flag=true;
    }
  
    if (flag) cout << "Four" << endl;
    else  cout << "Three" << endl;
}

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

int main()
{
  string str;  long long i,sz;
  
  cin>>str;  sz=str.size();
  
  for(i=0;i<sz;i++)
  {
     if(str[i]=='?')str[i]='D';
    
    cout<<str[i];
  }
  
  
  return 0;
}

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

int main() {
    double L;
    cin >> L;

    printf("%.7f\n", L / 3.0 * L / 3.0 * L / 3.0);

    return 0;
}

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

int main()
{

        int N;
        cin >> N;

        int amari = N % 10;

        if (amari == 2 || amari == 4 || amari == 5 ||
                amari == 7 || amari == 9) {
                cout << "hon" << endl;
        }
        else if (amari == 0 || amari == 1 || amari == 6 ||
                amari == 8) {
                cout << "pon" << endl;
        }
        else {
                cout << "bon" << endl;
        }


}


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

#define maxn (200000 + 8)

using namespace std;

int n;
long long sum[maxn];

int main() {
    while (scanf("%d",&n)==1) {
        sum[0]=0;
        for (int i=1;i<=n;++i) {
            int a;
            scanf("%d",&a);
            sum[i]=sum[i-1]+a;
        }
        sort(sum,sum+n+1);
        unsigned long long res=0llu,cnt=1llu;
        for (int i=1;i<=n;++i) {
            if (sum[i]==sum[i-1]) {
                ++cnt;
                if (i==n) res+=cnt*(cnt-1llu)/2llu;
            }
            else {
                res+=cnt*(cnt-1llu)/2llu;
                cnt=1llu;
            }
        }
        printf("%llu\n",res);
    }
    return 0;
}


Measured memory_bytes: 1664
s_in = list(input())
S = [int(i) for i in s_in]
count = 0
Ans=[i % 2 for i in range(len(S))]
for i in range(len(S)):
    if S[i] != Ans[i]:
        count = count + 1
if count <= (len(S)//2):
    print(count)
else:
    print(len(S) - count)

Measured memory_bytes: 5420
#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);

int main() {
    ll n; cin >> n;
    vector<pair<ll, ll>> v;
    rep(i, n) {
        ll x, l; cin >> x >> l;
        v.push_back(make_pair(x + l, x));
    }
    sort(all(v));
    ll ans = 1;
    ll now = v[0].first;
    Rep(i, 1, n) {
        if(now <= v[i].second - (v[i].first - v[i].second)) {
            ans++;
            now = v[i].first;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 5256
# C

# input

N = int(input())
x_list = [0]*N
y_list = [0]*N
h_list = [0]*N

for i in range(N):
    x, y, h = map(int, input().split())
    x_list[i] = x
    y_list[i] = y
    h_list[i] = h
    
# brute force
done = False
for CX in range(101):
    for CY in range(101):
        for i in range(N):
            if h_list[i] > 0:
                H = h_list[i] + abs(CX - x_list[i]) + abs(CY - y_list[i])
                break
        done = True
        for i in range(N):
            if h_list[i] != max(0, H - abs(CX - x_list[i]) - abs(CY - y_list[i])):
                done = False
                break
        if done:
            break
    if done:
        break
print(" ".join([str(CX), str(CY), str(H)]))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  string S;
  cin >> S;
  
  int N=S.size();
  vector<int> T(N);
  for(int i=0;i<N;i++){
  if(S.at(i)=='0')T.at(i)=0;
  else T.at(i)=1;
  }
  
  int Ans1=0,Ans2=0;
  
  for(int i=0;i<N;i++){
  if(T.at(i)!=i%2) Ans1++;
  if(T.at(i)!=1-(i%2)) Ans2++;
  }
  
  int Answer=min(Ans1,Ans2);
  
  cout << Answer << endl;
  
  return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define F first
#define S second
#include<unordered_map>
using namespace std;
typedef long long ll;
const ll inf=(1ll<<61);
const ll mod=1e9+7;
const int MX=3e5+9;
ll n,a[MX],b[MX],sum,sum1,sum2;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
    for(int i=1;i<=n;i++)scanf("%lld",&b[i]);
    for(int i=1;i<=n;i++){
        if(a[i]==b[i]){sum++;continue;}
        if(a[i]<b[i]){sum1+=(b[i]-a[i])/2;}
        else sum2+=a[i]-b[i];
    }
    if(sum1==0&&sum2==0){
        puts("Yes");
        return 0;
    }
    if(sum1==sum2){
        puts("Yes");
        return 0;
    }
    if(sum1<sum2){
        puts("No");
        return 0;
    }
    puts("Yes");
}


Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
// ascending order
#define asort(array, N) sort(array, array + N)
// descending order
#define asort_r(array, N) sort(array, array + N, greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	cin >> N;
	ll rslt = 1;
	for(ll i = 1; i <= N; i++) {
		rslt = (rslt * i) % 1000000007;
	}
	cout << rslt << endl;
}


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

int main(){
    int mt[10], tmp;
    int g = 1;

    for(int i = 0; i < 10; ++i){
        cin >> mt[i]; 
    }
    while(g){
        g = 0;
        for(int i = 1; i < 10; ++i){
            if(mt[i - 1] < mt[i]){
                tmp = mt[i - 1];
                mt[i - 1] = mt[i];
                mt[i] = tmp;
                g = 1;
            }
        }
    }
    
    for(int i = 0; i < 3; ++i){
        cout << mt[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}
void OUT(bool b){cout<<(b?"YES":"NO")<<endl;}
void Out(bool b){cout<<(b?"Yes":"No")<<endl;}
void out(bool b){cout<<(b?"yes":"no")<<endl;}
template<class T>
void puta(T&&t){cout<<t<<endl;}
template<class H,class...T>
void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}

int popcnt(int x){return __builtin_popcount(x);}
int popcnt(ll x){return __builtin_popcountll(x);}
int bsr(int x){return 31 - __builtin_clz(x);}
int bsr(ll x){return 63 - __builtin_clzll(x);}
int bsf(int x){return __builtin_ctz(x);}
int bsf(ll x){return __builtin_ctzll(x);}

/*他のライブラリを入れる場所*/

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	cout<<n+1-m<<endl;
	return 0;
}

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

#define int long long

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

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

void solve(long long A, long long B){
    cout<<lcm(A, B)<<endl;
}

signed main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


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

using namespace std;

#define endl "\n"
#define ll long long

#define forr(a,b,v) for(int v=a; v<=b; v++)
#define ford(a,b,v) for(int v=a; v>=b; v--)

// https://www.topcoder.com/community/competitive-programming/tutorials/power-up-c-with-the-standard-template-library-part-1/#map
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef pair< int,int > ii;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())


string to_string(string s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

// get default value from map type
template<class K, class V>
V get(map<K,V> m, K k, V def) {
    if (m.find(k) != m.end()) {
        return m[k];
    } else {
        return def;
    }
}

// <geometry>
const double PI = acos(-1.0);

double toDegreeFromMinutes(double minutes) {
  return (minutes/60);
}

double toRadians(double degree) {
  return (degree * PI/180.0);
}

double toDegree(double radian) {
  if (radian < 0) radian += 2 * PI;
  return (radian * 180 / PI);  
}

double fixAngle(double A) {
  return A > 1 ? 1 : (A < -1 ? -1 : A);
}

// sin(A)/a = sin(B)/b = sin(C)/c
double getSide_a_bAB(double b, double A, double B) {
  return (sin(A)*b)/sin(B);
}

double getAngle_A_abB(double a, double b, double B) {
  return asin( fixAngle(  (a*sin(B))/b ));  
}

// a^2 = b^2 + c^2 - 2*b*c*cos(A)
double getAngle_A_abc(double a, double b, double c) {
  return acos( fixAngle(  (b*b*c*c-a*a) / (2*b*c)  ) );  
}
// </geometry>


#define INF 1e9+5

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

    int n;
    int k;


    cin >> n >> k;  

    int h[n+k+5];

    for (int i=1; i<=n; i++) {
        cin >> h[i];
    }
    vector<ll> dp(n+k+5, INF) ;
    dp[1] = 0;

    for (int i=1; i<n+1; i++) {
        for (int kk=1; kk<=k; kk++) {
            // cout << dp[i] << " " << abs(h[i] - h[i+kk]) << endl;
            dp[i+kk] = min(dp[i+kk], dp[i] + abs(h[i] - h[i+kk]));
        }
    }
    // cout << to_string(dp) << endl;
    cout << dp[n];

    

    return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <string.h>
#include "math.h"


int main(int argc, char *argv[]){

  int i;
  int n;
  char s[128];
  int l = 0;

  scanf("%d", &n);
  scanf("%s", s);

  if(n%2 == 1){
    l++;
  }else{
    for(i=0; i<=n/2-1; i++){
      if(s[i]!=s[n/2+i]){
        l++;
      }
    }
  }

  if(l==0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }


  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
using namespace std;


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

  char in[120];
  pair<pair<string,int>,int> p[110];
  int n; cin >> n;
  rep(i,0,n){
    int t; cin >> in >> t;
    string tmp=in;
    p[i]=make_pair(make_pair(in,-t),i);
  }
  sort(p,p+n);
  rep(i,0,n)  cout << p[i].second+1 << endl;
 
}






Measured memory_bytes: 256
// C - Typical Stairs
#include <bits/stdc++.h>

using namespace std;

#define	MOD	1000000007

int main(int argc, char *argv[])
{
	int n, m;
	cin >> n >> m;
	vector<long long> dp(n + 1);
	dp[0] = 1;

	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
		dp[a[i]] = -1;
	}

	for (int i = 1; i <= n; i++)
		if (dp[i] < 0) {
			dp[i] = 0;
		} else {
			dp[i] = dp[i - 1];
			if (i - 2 >= 0) dp[i] = (dp[i] + dp[i - 2]) % MOD;
		}
	cout << dp[n] << endl;

	return 0;
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;

int main(){
    int a, b, c;
    ll k;
    scanf("%d %d %d %lld", &a, &b, &c, &k);

    if (k%2 == 0) printf("%d\n", a-b);
    else printf("%d\n", b-a);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  a--;
  b--;

  char map[100][100] = {};
  REP(i, 100) {
    REP(j, 100) {
      if (i < 50) {
        map[i][j] = '.';
      } else {
        map[i][j] = '#';
      }
    }
  }

  int c = 0;
  while (b > 0) {
    int i = c / 100;
    int j = c % 100;
    if (i % 2 == 0) {
      c += 2;
      continue;
    }
    map[i][j] = '#';
    b--;
    c += 2;
  }

  c = 5000;
  while (a > 0) {
    int i = c / 100;
    int j = c % 100;
    if (i % 2 == 0) {
      c += 2;
      continue;
    }
    map[i][j] = '.';
    a--;
    c += 2;
  }

  cout << 100 << " " << 100 << endl;
  REP(i, 100) {
    REP(j, 100) { cout << map[i][j]; }
    cout << endl;
  }
}


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

struct UnionFind {
	vector<int> par;

	UnionFind(int n) : par(n, -1) { }
	void init(int n) { par.assign(n, -1); }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N; 
	map<int, int>pi;//index,x
	vector<pair<int, int>>v(N);
	map<int, int>py;//y,x
	for (int n = 0; n < N; ++n) {
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		v[n] = {x,y};
		pi[n] = x;
		py[y] = x;
	}
	sort(v.begin(), v.end());
	UnionFind uf(N);
	priority_queue<int, vector<int>, greater<int> > q;
	for (int i = 0; i < N; ++i) {
		int y = v[i].second;
		int ysub = y;
		while (!q.empty()) {
			int y0 = q.top();
			q.pop();
			if (y0 > y) {
				q.push(y0);
				break;
			}
			else {
				ysub = min(ysub,y0);
				uf.merge(py[y], py[y0]);
			}
		}
		q.push(ysub);
	}
	for (int n = 0; n < N; ++n) {
		cout << uf.size(pi[n]) << endl;
	}
	return 0;
}


Measured memory_bytes: 24296
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let ab = readInts()
    let a = ab[0]
    let b = ab[1]
    
    if a >= 13 {
        print(b)
    } else if a >= 6 {
        print(b / 2)
    } else {
        print("0")
    }
}

main()


Measured memory_bytes: 8092
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    int a,b,c,x;
    cin >> a >> b >> c >> x;

    int ans=0;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                if(500*i+100*j+50*k==x)ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3604
#include<stdio.h>
int main()
{
  int n,i,d;
  long long sum;
  sum=0;
  scanf("%d", &n);
  
  int h[n];
  
  for (i=0;i<n;i++)
  {
	scanf("%d",&h[i]);    
  }
  
  for (i=0;i<n-1;i++)
  {
   if (h[i]>h[i+1])
   {
	d=h[i]-h[i+1];
	h[i+1]=h[i+1]+d;
    sum=sum+d;
   }
  }
  printf("%lld",sum);
  return 0;
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<VI> cost(n, vector<int>(n));
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> cost[i][j];
    ll res = 0;
    for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) res += min(cost[i][j], cost[j][i]);
    cout << res << endl;
}


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

ll ans=0;
int n,m,q;

ll calc(vector<vector<int>> &rule, vector<int>A){
    ll result=0;
    for(int i=0; i<q; i++){
        int a,b,c,d;
        a = rule.at(i).at(0);
        b = rule.at(i).at(1);
        c = rule.at(i).at(2);
        d = rule.at(i).at(3);
        if(A.at(b)-A.at(a) == c) result += (ll)d;
    }
    return result;
}

void dfs(vector<vector<int>> &rule, int last, vector<int> A){
    if(A.size() >= n){
        ans = max(ans, calc(rule, A));
        return;
    }
    else{
        for(int i=last; i<=m;i++){
            A.push_back(i);
            /*
            for(int j=0; j<A.size(); j++){
                cout << A.at(j) << " ";
            }
            cout << "s" << A.size();
            cout << endl;
            */
            dfs(rule, i, A);
            A.pop_back();
        }
    }
}

int main(){
    cin >> n >> m >> q;
    vector<vector<int>> rule(q, vector<int>(4));
    for(int i=0; i<q; i++){
        cin>>rule.at(i).at(0)>>rule.at(i).at(1)>>rule.at(i).at(2)>>rule.at(i).at(3);
        rule.at(i).at(0)--;
        rule.at(i).at(1)--;
    }
    for(int i=1; i<=m; i++){
        vector<int> A(0);
        A.push_back(i);
        dfs(rule, i, A);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n, l;
	cin >> n >> l;
	string arr[n];
	for(int i = 0; i < n; i++)
		cin >> arr[i];
	sort(arr,arr+n);
	for(int i = 0; i < n; i++)
		cout << arr[i];
}

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

int main(){
    int n,k;cin>>n>>k;
    string s;
    cin>>s;

    int res = 0;
    for(int i = 0; i < n-1; i++){
        if(s[i] == s[i+1]) res++;
    }

    int ans = min(n-1,res+2*k);
    cout<<ans;
}


Measured memory_bytes: 512
# 逆元を利用した組み合わせの計算
#############################################################
def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n - r] % mod

N = 10**5
mod = 10**9 + 7

g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)
#############################################################

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

mod = 10**9 + 7
# Σf(X) = Σ(max(X)-min(X)) = Σmax(X) - Σmin(X) = ans1 - ans2
# ソートしておくことで、集合の最大値は右端の値、最小値は左端の値とすることが出来る
ans1 = 0
ans2 = 0
for i in range(1, N + 1):
    # A[i-1]の左にある(i-1)個の中から(K-1)個選ぶ
    ans1 += A[i-1]*cmb(i - 1, K - 1, mod)
    # A[i-1]の右にある(N-i)個の中から(K-1)個選ぶ
    ans2 += A[i-1]*cmb(N - i, K - 1, mod)

ans = (ans1 - ans2) % mod
print(ans)


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

int main()
{
	int sum=0, summ=0;
	for (int i = 0; i < 4; i++)
	{
		int s; cin >> s; sum += s;
	}
	for (size_t i = 0; i < 4; i++)
	{
		int s; cin >> s; summ += s;
	}
	if (sum >= summ) { cout << sum<<endl; }
	else { cout << summ<<endl; }
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define loop(i, a, b) for (int i = a; i < b; i++)
#define loopr(i, a, b) for (int i = a; i >= b; i--)
#define loops(i, a, b, step) for (int i = a; i < b; i += step)
#define looprs(i, a, b, step) for (int i = a; i >= b; i -= step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie();                        \
    cout.tie();
#define FILE_READ_IN freopen("input.txt", "r", stdin);
#define FILE_READ_OUT freopen("output.txt", "w", stdout);
#define all(a) a.begin(), a.end()
#define ld long double
using namespace std;
// For ordered_set
using namespace __gnu_pbds;
template <typename T>
using ord_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);

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

    int ans = 0;
    for (int i = 0; i < k; i++)
    {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++)
        {
            int temp;
            cin >> temp;
            temp--;
            a[temp] = 1;
        }
    }

    for (int i = 0; i < n; i++)
        if (a[i] == 0)
            ans++;

    cout << ans;

    return 0;
}

Measured memory_bytes: 3640
import java.util.*;
import java.text.SimpleDateFormat;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd");
        try {
          Date date = format.parse(sc.next());
          Date last = format.parse("2019/04/30");
    
		  // 出力
		  System.out.println(date.after(last) ? "TBD" : "Heisei");
        } catch (Exception e) {
        }
	}
}

Measured memory_bytes: 22096
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

char S[100010];

signed main()
{
	cin >> S;

	int len = strlen(S);
	int m = S[len / 2];

	if (len % 2 == 0)
	{
		int ans = len / 2;
		for (int i = 0; i < len / 2; i++)
		{
			if (S[len / 2 + i] != m) break;
			if (S[len / 2 - i - 1] != m) break;
			ans++;
		}
		cout << ans << endl;
	}
	else
	{
		int ans = len / 2 + 1;
		for (int i = 0; i < len / 2; i++)
		{
			if (S[len / 2 + i + 1] != m) break;
			if (S[len / 2 - i - 1] != m) break;
			ans++;
		}
		cout << ans << endl;
	}
}



Measured memory_bytes: 1016
#include<stdio.h>
int main(void)
{
	int i,a,cnt[101],max=-1;
	for(i=1;i<=100;i++){
		cnt[i]=0;
	}
	while(scanf("%d",&a)!=EOF){
		cnt[a]++;
	}
	for(i=1;i<=100;i++){
		if(max<cnt[i]){
			max=cnt[i];
		}
	}
	for(i=1;i<=100;i++){
		if(cnt[i]==max){
			printf("%d\n",i);
		}
	}
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String first = sc.nextLine();
        String second = sc.nextLine();
        String S = sc.nextLine();
        String T = sc.nextLine();
        String[] f = first.split(" ");
        String[] sec = second.split(" ");
        int srow = Integer.parseInt(sec[0]);
        int scol = Integer.parseInt(sec[1]);
        int H = Integer.parseInt(f[0]);
        int W = Integer.parseInt(f[1]);
        int N = Integer.parseInt(f[2]);
        // System.out.println(W);
        // System.out.println(T);
        int maxH = H;
        int minH = 1;
        int maxW = W;
        int minW = 1;
        boolean ans = true;
        for (int i = N-1; i>=0; i--) {
            //aoki
            char aoki = T.charAt(i);
            switch(aoki) {
                case 'L':
                    maxW = Math.min(W,maxW+1);
                    break;
                case 'R':
                    minW = Math.max(1,minW-1);
                    break;
                case 'U':
                    maxH = Math.min(H,maxH+1);
                    break;
                case 'D':
                    minH = Math.max(1,minH-1);
                    break;
            }

            //takahashi
            char takahashi = S.charAt(i);
            switch(takahashi) {
                case 'L':
                    minW = minW+1;
                    break;
                case 'R':
                    maxW = maxW-1;
                    break;
                case 'U':
                    minH = minH+1;
                    break;
                case 'D':
                    maxH = maxH-1;
                    break;
            }
            if (minW > maxW || minH > maxH) {
                //maxH <= H, maxW <= W, minH >= 1, minW >= 1 after aoki
                ans = false;
                break;
            }
        //     System.out.print(minW);
        //     System.out.print(" ");
        //     System.out.print(maxW);
        //     System.out.print(" ");
        //     System.out.print(minH);
        //     System.out.print(" ");
        //     System.out.print(maxH);
        //     System.out.println(" ");
        //     System.out.println("--------- ");
        }
        if(!ans) {
            System.out.println("NO");
        } else {
            ans = (srow >= minH) && (srow <= maxH) && (scol >= minW) && (scol <= maxW);
            if (ans) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }

        }



    }
}

Measured memory_bytes: 29992
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>


using namespace std;

int main(){
    int N;
    string s;

    cin >> N >> s;

    int acount=0;
    int bcount=0;

    for(int i=0;i<N;i++){
        if(s[i]=='R')acount++;
        else bcount++;
    }
    
    if(acount > bcount )cout << "Yes" << endl;
    else cout << "No" << endl;


    
}


Measured memory_bytes: 256
# 2019-11-18 17:34:23(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 

weather = ['Sunny', 'Cloudy', 'Rainy']
mod = 3

def main():
    today = sys.stdin.readline().rstrip()
    
    tomorrow = weather[(weather.index(today)+1)%mod]
    print(tomorrow)
        
if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
function main(input) {
  input=input.trim();
  const N = parseInt(input.split(" ")[0], 10);
  const W = input.split('\n').map((n)=>(n));
  W.shift();
  var ans=0;
  for(var i=1; i<N; i++){
    if(W[i].slice(0,1)==W[i-1].slice(-1)){
    }else{
      ans++
    }
  }
  var c = W.filter(function (x, i, self) {
    return self.indexOf(x) !== self.lastIndexOf(x);
  });
  if(c.length==0&&ans==0){
    console.log("Yes");
  }else{
    console.log("No");
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));





Measured memory_bytes: 7496