akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

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


const string FIZZBUZZ = "FizzBuzz";
const string FIZZ = "Fizz";
const string BUZZ = "Buzz";
bool used[1001];
int cur;
int remains;
int m, n;

void init() {
    fill( used, used+1001, false );
    remains = m;
    cur = 0;
}

VI get() {
    VI res;
    for ( int i = 0; i < m; ++ i ) {
        if ( ! used[i] ) res.push_back(i);
    }
    return res;
}

void next() {
    do {
        cur = ( cur + 1 ) % m;
    } while ( used[cur] );
}

bool check( int real, string s ) {
    if ( real % 15 == 0 ) {
        if ( s != FIZZBUZZ ) return false;
    } else if ( real % 5 == 0 ) {
        if ( s != BUZZ ) return false;
    } else if ( real % 3 == 0 ) {
        if ( s != FIZZ ) return false;
    } else {
        OSS oss;
        oss << real;
        if ( s != oss.str() ) return false;
    }
    return true;
}

void output() {
    VI v = get();
    for ( VI::iterator it_i = v.begin(); it_i != v.end(); ++ it_i ) {
        cout << (*it_i+1);
        if ( it_i + 1 != v.end() ) cout << " ";
    }
    cout << endl;
}

int main() {
    while ( cin >> m >> n && m ) {
        init();
        for ( int i = 0; i < n; ++ i ) {
            int real = i + 1;
            string s;
            cin >> s;
            if ( remains == 1 ) continue;
            if ( ! check( real, s ) ) {
                used[cur] = true;
                remains --;
            }
            next();
        }
        output();
    }
    return 0;
}

Measured memory_bytes: 944
#include<bits/stdc++.h>
using namespace std;
typedef tuple<string, int, int> node;

int main(){
  int n;
  cin >> n;
  vector<node> v(n);
  string s;
  int x;
  for (int i = 1; i <= n; i++){
    cin >> s >> x;
    v[i-1] = make_tuple(s, x, i);
  }
  sort(v.begin(), v.end(), [](const node a, const node b) {
    if(get<0>(a) != get<0>(b))
      return get<0>(a) < get<0>(b);
    return get<1>(a) > get<1>(b);
  });
  for(auto r: v){
    cout << get<2>(r) << endl;
  }
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

vector<ll> G[202020];
const ll ma = 100001;
vector<bool> visited(202020, false);

pll dfs(ll now){
	pll res = {0, 0};
	if(visited[now]) return res;
	if(now < ma) res.first++;
	if(now >= ma) res.second++;
	visited[now] = true;
	REP(i, G[now].size()){
		ll next = G[now][i];
		if(!visited[next]){
			auto tmp = dfs(next);
			res.first += tmp.first;
			res.second += tmp.second;
		}
	}
	return res;
}

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

    ll N;
    cin >> N;
    REP(i, N){
    	ll x, y;
    	cin >> x >> y;
    	G[x].push_back(ma+y);
    	G[ma+y].push_back(x);
    }
    ll res = 0;
    REP(i, 202020){
    	auto p = dfs(i);
    	res += p.first * p.second;
    }
    cout << res - N << endl;
    return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <cstdio>

using namespace std;

int main(){
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	int ans;
	ans = max(a * 10 + b + c, a + 10 * b + c);
	ans = max(ans, c * 10 + a + b);
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class b{
    public static void Main(){
        int n = int.Parse(Console.ReadLine());
        int[] num = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int ans = 0;
        for(int i=0; i<n-2; i++){
            for(int j=i+1; j<n-1; j++){
                if(i == j){
                    continue;
                }
                for(int k=j+1; k<n; k++){
                    if(i == k || j == k){
                        continue;
                    }
                    int a = num[i];
                    int b = num[j];
                    int c = num[k];
                    if(a == b || b == c || a == c){
                        continue;
                    }
                    if(((a+b) <= c) || ((a+c) <= b) || ((b+c) <= a)){
                        continue;
                    }
                    ans++;
                }
            }
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 19116
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#include <queue>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) find(Range(c), x) != c.end()
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, n, m, xs, x) vector<vector<T>> xs(n, vector<T>(m, x))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, x) T x; cin >> x
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs, 0); For(i, n) For(j, m) cin >> xs[i][j]
#define Cout(x) cout << (x) << "\n"
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"

using namespace std;
using ll = long long;

int main(void){
    Cin(int, n);
    Cin(int, y);
    for(int i = 0; i <= n; i ++){
        for(int j = 0; j <= n-i; j ++){
            int k = n-i-j;
            if(10000*i + 5000*j + 1000*k == y){
                cout << i << " " << j << " " << k << "\n";
                return 0;
            }
        }
    }
    Cout("-1 -1 -1\n");
}


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

int main(){
    vector<int> a(5);
    rep(i,5)cin>>a[i];
    cout<<distance(a.begin(),find(a.begin(),a.end(),0))+1<<endl;
}


Measured memory_bytes: 3588
// nb_9960
  #include <bits/stdc++.h> 
  using namespace std; 
  #define fi(i,a,n) for (ll i=a; i < n; i++) 
  #define ll long long
  #define pb push_back 
  #define mp make_pair 
  #define F first 
  #define S second 
  #define all(x) x.begin(), x.end() 
  #define clr(x) memset(x, 0, sizeof(x)) 
  #define sortall(x) sort(all(x)) 
  typedef pair<ll, ll> pl; 
  typedef vector<ll> vl; 
  typedef vector<pl> vpii; 
  #define sz(a) int((a).size())
  #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())

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

    ll t = 1; 
    // cin >> t;

    while (t--) { 
      ll a,b,c,d,ans;
      cin>>a>>b>>c>>d;
      ans=b*d;
      ans=max(a*d,max(a*c,max(ans,b*c)));
      cout<<ans<<endl;
    } 
    return 0; 
  } 


Measured memory_bytes: 3648
import sys
input = sys.stdin.readline
import bisect
A, B, Q = map(int, input().split())
S = [-10**11] + [int(input()) for i in range(A)] + [10**11]
T = [-10**11] + [int(input()) for i in range(B)] + [10**11]

for _ in range(Q):
    x = int(input())
    a = bisect.bisect_left(S, x)
    b = bisect.bisect_left(T, x)
    print(min(x - min(S[a-1], T[b-1]), max(S[a], T[b]) - x, x+T[b]-2*S[a-1], x+S[a]-2*T[b-1], 2*T[b]-x-S[a-1], 2*S[a]-x-T[b-1]))

Measured memory_bytes: 112476
//Judge Status Summary
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
using namespace std;
const int INF = 1 << 29;
int main ()
{
    long long N;
    cin >> N;
    map<string,int> S;
    S["AC"] = S["WA"] = S["TLE"] = S["RE"] = 0;
    for (int i = 0; i < N; i++) {
        string tmp;
        cin >> tmp;
        S[tmp]++;
    }
    cout << 
    "AC x " << S["AC"] << endl << 
    "WA x " << S["WA"] << endl <<
    "TLE x " << S["TLE"] << endl <<
    "RE x " << S["RE"] << endl;
    
    return 0;
}

Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, m, x;
  cin >> n >> m >> x;
  vl c(n);
  vector<vl> a(n, vl(m));
  rep(i, n) {
    cin >> c[i];
    rep(j, m) cin >> a[i][j];
  }
  ll ans = 1e18;
  rep(i, 1 << n) {
    vl r(m, 0);
    ll cost = 0;
    rep(j, n) {
      if(i >> j & 1) {
        rep(k, m) r[k] += a[j][k];
        cost += c[j];
      }
    }
    bool ok = true;
    rep(j, m) if(r[j] < x) ok = false;
    if(ok) ans = min(ans, cost);
  }
  cout << (ans == 1e18 ? -1 : ans) << endl;
}

Measured memory_bytes: 3624
using System;
    class Program
    {
        static void Main(string[] args)
        {

            string[] line = Console.ReadLine().Split();
            double a = double.Parse(line[0]);
            double b = double.Parse(line[1]);

            double answer = (a + b) / 2;
            if(answer == (int)answer)
            {
                Console.WriteLine((int)answer);
            }
            else
            {
                Console.WriteLine("IMPOSSIBLE");
            }
        }
    }



Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N,M,V,P;
int main(){
    cin>>N>>M>>V>>P;
    vector<ll>A(N);
    for(ll i=0;i<N;i++)cin>>A.at(i);
    sort(A.begin(),A.end(),greater<int>());
    ll cnt=P;
    ll wa=0;
    for(int i=P;i<N;i++){
        if(i!=P)wa+=A.at(i-1);
        bool ju=true;
        if(V<=P-1+N-i){
            if(A.at(i)+M>=A.at(P-1)){
                cnt++;
                ju=false;
            }
        }
        else{
            ll ok=A.at(i)+M;
            ll na=V-(P-1+N-i);
            
            
            if((wa+na*M)<=(i-P)*A.at(P-1)){
                if(ok>=A.at(P-1)){
                    cnt++;
                    ju=false;
                }
            }
            else{
                ll kan=wa+A.at(P-1);
                ll jun=kan+na*M;
                if(1.0*jun/(i-P+1)<=ok){
                    cnt++;
                    ju=false;
                }
            }
        }
        if(ju)break;
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;



int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    map<int, int> mp;
    ll ans = 7;
    for(int i = 1; ; i++){
        ans %= n;
        if(ans == 0) return cout << i, 0;
        else if(mp[ans]) return cout << -1, 0;
        mp[ans] = 1;
        ans = (ans * 10) + 7;
    }

   return 0;
}


Measured memory_bytes: 50484
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <functional>
#include <algorithm>
#include <stack>
#include <queue>
//#include <iostream>
//#include <sstream>
using namespace std;
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define pf printf
#define sf scanf
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str()
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)
#define deb(x) cout << #x" = " << x << '\n'
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())
//typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
//bitmask
int onbit(int x, int pos) {x |= (1 << pos); return pos;}
int offbit(int x, int pos) {x &= ~(1 << pos); return x;}
int test(int x, int pos) {return x & (1 << pos);}
int flip(int x, int pos) {x ^= (1 << pos); return x;}
int lsb(int x) {return x & (-x);}
int onbitall(int x, int pos) {x = (1 << pos)-1; return x;}
//constants
const double EPS = 1e-9;
const double PI = 2*acos(0.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
//moves
const int dx1[] = {0, 1, 0, -1};
const int dy1[] = {1, 0, -1, 0};
const int dx2[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy2[] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
//    freopen("input.in", "r", stdin);
	bool ok = true;
	char a[1234];
	sf("%s", a);
	if(a[0] != 'A') ok = false;
	int pos = 0, cn = 0;
	fr(i, 0, strlen(a)) {
		if(a[i] == 'C') {
			cn++;
			pos = i;
		}
	}
	if(cn != 1) ok = false;
	if(pos < 2 || pos == strlen(a)-1) ok = false;
	fr(i, 0, strlen(a)) {
		if(a[i] != 'A' && a[i] != 'C')
			if(a[i] >= 'A' && a[i] <= 'Z') ok = false;
	}
	puts(ok ? "AC" : "WA");
	return 0;
}

Measured memory_bytes: 128
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

L = rs()

n = len(L)
dp = [[0]*2 for i in range(n+1)]
dp[0][0] = 1

for i in range(n):
	if L[i] == '0':
		dp[i+1][0] += dp[i][0] % mod # (0,0)
		dp[i+1][1] += dp[i][1] % mod # (0,0)
		dp[i+1][1] += dp[i][1]*2 % mod # (1,0), (0,1)
	else:
		dp[i+1][1] += dp[i][0] + dp[i][1] % mod # (0,0)
		dp[i+1][0] += dp[i][0]*2 % mod # (0,1), (1,0)
		dp[i+1][1] += dp[i][1]*2 % mod # (0,1), (1,0)
print((dp[n][0]+dp[n][1])%mod)


Measured memory_bytes: 81820
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint T;
llint n;
vector<P> pvec, nvec;

llint calc(vector<P> &vec)
{
	set<llint> S;
	for(int i = 1; i <= (int)vec.size(); i++) S.insert(i);
	
	llint ret = 0;
	for(int i = 0; i < vec.size(); i++){
		llint v = vec[i].first, p = vec[i].second;
		auto it = S.upper_bound(p);
		if(it == S.begin()){
			auto it = S.end();
			it--;
			S.erase(it);
		}
		else{
			it--;
			S.erase(it);
			ret += v;
		}
	}
	return ret;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> T;
	for(int t = 0; t < T; t++){
		cin >> n;
		llint k, l, r, ans = 0;
		pvec.clear(), nvec.clear();
		for(int i = 1; i <= n; i++){
			cin >> k >> l >> r;
			ans += min(l, r);
			if(l >= r) pvec.push_back(P(l-r, k));
			else nvec.push_back(P(r-l, n-k));
		}
		sort(pvec.rbegin(), pvec.rend());
		sort(nvec.rbegin(), nvec.rend());
		
		ans += calc(pvec);
		ans += calc(nvec);
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 11108
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
using namespace std;
const int mxn=100010;
const int mod=1e9+7;
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int fac[mxn],inv[mxn];
void init(){
	fac[0]=fac[1]=inv[0]=inv[1]=1;
	for(int i=2;i<mxn;i++){
		fac[i]=fac[i-1]*(LL)i%mod;
		inv[i]=(-mod/i*(LL)inv[mod%i]%mod+mod)%mod;
	}
	for(int i=2;i<mxn;i++)inv[i]=(LL)inv[i-1]*inv[i]%mod;
	return;
}
int C(int n,int m){
	if(n<m)return 0;
	return fac[n]*(LL)inv[m]%mod*inv[n-m]%mod;
}
int main(){
	init();
	int n,m;
	cin>>n>>m;
	if(n<m)swap(n,m);
	if(abs(n-m)>1){
		printf("%d\n",0);return 0;
	}
	int ans=(LL)fac[n]*fac[m]%mod;
	if(n==m)ans=ans*2%mod;
	printf("%d\n",ans);
	return 0;
}

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

int main() {
    int a, b, c;  cin >> a >> b >> c;
    if (a+b >= c)  cout << "Yes" << endl;
    else  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
using namespace std;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int x;
    cin >> x;
    if (x == 3 || x == 5 || x== 7){
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    int n;
    cin >> n;
    int a[n];
    rep(i,n)cin >> a[i];
    vector<pair<int,int>>dataa(110000);
    vector<pair<int,int>>datab(110000);
    rep(i,110000){
        dataa[i].second = i;
        datab[i].second = i;
        dataa[i].first = 0;
        datab[i].first = 0;
    }
    rep(i,n){
        if(i%2==0){
            datab[a[i]].first++;
        }else {
            dataa[a[i]].first++;
        }
    }
    sort(all(dataa));
    reverse(all(dataa));
    sort(all(datab));
    reverse(all(datab));
    int x = dataa[0].second;
    int y = datab[0].second;
    if(x == y){
        if(dataa[1].first < datab[1].first)y = datab[1].second;
        else x = dataa.at(1).second;
        }
    int ans = 0;
    rep(i,n){
        if(i%2==0){
            if(a[i]!=y)ans++;
        }else{
            if(a[i]!=x)ans++;
        }
    }
    cout << ans << endl;
    //cout << x << " " << y << endl;
    
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> J{0,0,0,0};
  
  string A;
  
  for(int i=0;i<N;i++){
    cin >> A;
    if(A == "AC"){
      J.at(0)++;
    } else if (A == "WA"){
      J.at(1)++;
    } else if (A == "TLE"){
      J.at(2)++;
    } else if (A == "RE"){
      J.at(3)++;
    }
  }
  
  
  cout << "AC"<<" "<<"x"<<" "<<J.at(0) << endl;
  cout << "WA"<<" "<<"x"<<" "<<J.at(1) << endl;
  cout << "TLE"<<" "<<"x"<<" "<<J.at(2) << endl;
  cout << "RE"<<" "<<"x"<<" "<<J.at(3) << endl;

  
}


Measured memory_bytes: 3632
#include<cmath>
#include<ctime>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<set>
#include <cstdio>
using namespace std;
const int N = 200001;
char a[N], b[N];
int h, w, n, x, y;
void step(int&x, int&y, char c)
{
    switch (c){
        case 'R':
            y ++;
            break;
        case 'L':
            y --;
            break;
        case 'U':
            x --;
            break;
        case 'D':
            x ++;
            break;
    }
}
bool work(int x, int y, char ca, char cb)
{
    for (int i = 0; i < n ; i ++)
    {
        if (a[i] == ca)
        {
            int xx = x, yy = y;
            step(xx, yy, ca);
            if (xx < 1 || yy < 1 || xx > h || yy > w)
                return 0;
            x = xx;
            y = yy;
        }
        if (b[i] == cb)
        {
            int xx = x, yy = y;
            step(xx, yy, cb);
            if (xx < 1 || yy < 1 || xx > h || yy > w)
                continue;
            x = xx;
            y = yy;
        }
    }
    return 1;
}
int main(){
    scanf("%d %d %d", &h, &w, &n);
    scanf("%d %d", &x, &y);
    scanf("%s", a);
    scanf("%s", b);
    if (!work(x, y, 'U', 'D') || !work(x, y, 'D', 'U') || !work(x, y, 'L', 'R') || !work(x, y, 'R', 'L'))
        printf("NO");
    else
        printf("YES");
    return 0;
}

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

int main() {
  char c;
  cin >> c;
  if ( c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
/*bismillah ->                                                                                                         << Suirkhanov Meyirlan >>
  GL HF


                                                                                                                      42

    bless my code =)
                                                                                                            NEVER FOLLOW YOUR RULES :D HAHAHAHA
*/


///scanf ("%d%d", &x, &y);
///printf("%d", &a)

#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define pii pair < int , int >
#define pll pair < ll, ll >
#define pb push_back
#define pf psuh_front
#define mp make_pair
#define fi first
#define se second
#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define eb emplace_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll N = 2 * 1e3 + 7;
const ld pi = 3.14159265359;
const int INF = 1e20 + 7;
const double eps = 1e-9;

const int xi[4] = {-1, 0, +1, 0};
const int yj[4] = {0, +1, 0, -1};
const int xxi[4] = {+1, 0, -1, 0};
const int yyj[4] = {0, -1, 0, +1};

string s;

ll ans;

int main(){

  //freopen("bridge.in", "r", stdin);
  //freopen("bridge.out", "w", stdout);

  fast
  randoperation;

  ///           ||
  ///start here \/

  cin >> s;

  for(int i = 0; i < (1 << (s.size() - 1)); i++){

    vector < int > v;

    for(int j = 0; j < s.size() - 1; j++){
      if((i >> j) & 1){
        //u[j + 1] = 1;
        v.pb(j + 1);
      }
    }

    v.pb(s.size());
    sort(v.begin(), v.end());
    ll sum = 0;

    for(int j = 0; j < v.size(); j++){

      ll res = 0;

      if(j == 0){
        for(int k = 0; k < v[j]; k++){
          res *= 10;
          res += (int)(s[k] - '0');
        }
      }
      else{
        for(int k = v[j - 1]; k < v[j]; k++){
          res *= 10;
          res += (int)(s[k] - '0');
        }
      }

      sum += res;

    }

    ans += sum;
    v.clear();
  }

  cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

    vector<long long int> vv(n);

    bool ac = false;
    vv[0] = 0;
    for (long long int i = 1; i < n; i++) {
        if (s[i-1] == 'A' && s[i] == 'C') {
            vv[i] = vv[i-1]+1;
        } else {
            vv[i] = vv[i-1];
        }
    }

    long long int l, r;

    for (long long int i = 0; i < q; i++) {
        cin >> l >> r;
        l--;
        r--;
        if (l == 0) {
            cout << vv[r] << endl;
        } else {
            cout << vv[r]-vv[l] << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

struct UnionFind {
    UnionFind(int n) : p(n, -1) {}
    int root(int u) {
        return p[u] < 0 ? u : p[u] = root(p[u]);
    }
    int size(int u) {
        return -p[root(u)];
    }
    bool same(int u, int v) {
        return root(u) == root(v);
    }
    void unite(int u, int v) {
        u = root(u);
        v = root(v);
        if (u == v) return;
        if (p[u] > p[v]) swap(u, v);
        p[u] += p[v];
        p[v] = u;
    }
    vector<int> p;
};

struct P {
    int x, y, i;
};

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

    int n;
    cin >> n;

    vector<P> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i].x >> p[i].y;
        p[i].i = i;
    }

    UnionFind uf(n);

    sort(p.begin(), p.end(), [](const P &p1, const P &p2) {
        return p1.x < p2.x;
    });
    for (int i = 1; i < n; i++) {
        if (p[i].x == p[i - 1].x) uf.unite(p[i].i, p[i - 1].i);
    }

    sort(p.begin(), p.end(), [](const P &p1, const P &p2) {
        return p1.y < p2.y;
    });
    for (int i = 1; i < n; i++) {
        if (p[i].y == p[i - 1].y) uf.unite(p[i].i, p[i - 1].i);
    }

    for (int i = 0; i < n; i++) {
        p[i].i = uf.root(p[i].i);
    }
    sort(p.begin(), p.end(), [](const P &p1, const P &p2) {
        return p1.i < p2.i;
    });

    ll s = 0;
    int i0 = 0, i3 = p[0].i;
    for (int i1 = 0; i1 <= n; i1++) {
        if (i1 < n && p[i1].i == i3) continue;

        set<int> sx;
        for (int i = i0; i < i1; i++) {
            sx.insert(p[i].x);
        }
        set<int> sy;
        for (int i = i0; i < i1; i++) {
            sy.insert(p[i].y);
        }
        //cout << i0 << ' ' << i1 << ' ' << sx.size()  << ' ' << sy.size() << ' ' << (i1 - i0) << endl;
        s += sx.size() * sy.size() - (i1 - i0);
        if (i1 == n) break;
        i0 = i1;
        i3 = p[i1].i;
    }

    cout << s << endl;

    return 0;
}

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

void trace(int A[], int N) {
  int i;
  for(i = 0; i < N; ++i) {
    if(i > 0) {
      cout << " " << flush;
    }
    cout << A[i] << flush;
  }
  cout << endl;
}
void insertionSort(int A[],int N) {
  int i, j, v;
  for(i = 1; i < N; ++i) {
    v = A[i];
    j = i - 1;
    while(j >= 0 && A[j] > v) {
      A[j + 1] = A[j];
      --j;
    }
    A[j + 1] = v;
    trace(A, N);
  } 
}
int main() {
  int N, A[100];
  cin >> N;
  for(int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  trace(A, N);
  insertionSort(A, N);
}


Measured memory_bytes: 3088
program moji
character(1)::a
k=0
read*,a
 if(a=='A')then
 print*,'A'
 k=1
 end if
  if(a=='B')then
 print*,'A'
  k=1
 end if
  if(a=='C')then
 print*,'A'
  k=1
 end if
  if(a=='D')then
 print*,'A'
  k=1
 end if
  if(a=='E')then
 print*,'A'
  k=1
 end if
  if(a=='F')then
 print*,'A'
  k=1
 end if
  if(a=='G')then
 print*,'A'
  k=1
 end if
  if(a=='H')then
 print*,'A'
  k=1
 end if
  if(a=='I')then
 print*,'A'
  k=1
 end if
  if(a=='J')then
 print*,'A'
  k=1
 end if
  if(a=='K')then
 print*,'A'
  k=1
 end if
  if(a=='L')then
 print*,'A'
  k=1
 end if
 if(a=='M')then
 print*,'A'
  k=1
 end if
  if(a=='N')then
 print*,'A'
  k=1
 end if
  if(a=='O')then
 print*,'A'
  k=1
 end if
  if(a=='P')then
 print*,'A'
  k=1
 end if
  if(a=='Q')then
 print*,'A'
  k=1
 end if
   if(a=='R')then
 print*,'A'
  k=1
 end if
   if(a=='S')then
 print*,'A'
  k=1
 end if
   if(a=='T')then
 print*,'A'
  k=1
 end if
   if(a=='U')then
 print*,'A'
  k=1
 end if
    if(a=='V')then
 print*,'A'
  k=1
 end if
    if(a=='W')then
 print*,'A'
  k=1
 end if
    if(a=='X')then
 print*,'A'
  k=1
 end if
    if(a=='Y')then
 print*,'A'
  k=1
 end if
    if(a=='Z')then
 print*,'A'
  k=1
 end if
 
 IF(K==0)THEN
 PRINT*,'a'
 end if
end program moji

Measured memory_bytes: 2792
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repk(i,k, n) for (int i = k; i < (int)(n); ++i)
#define MAX 5000010
#define MOD 1000000007
typedef long long  ll;

using namespace std;


ll fac[MAX], finv[MAX], inv[MAX];


// n!を先に計算しておく
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

int main() {
	//ll X = 71, Y = 64;
	// ll X=4, Y=2;
	ll X, Y;
	cin >> X >> Y;

	ll k, l;

	k = (-X + (2 * Y % MOD)) % MOD;
	l = ((2 * X % MOD) - Y) % MOD;

	if ((X + Y) % 3 != 0 || k < 0 || l < 0) {
		cout << 0 << endl;
		return 0;
	}

	k /= 3;
	l /= 3;

	COMinit();
	ll ans = fac[k + l] * (finv[k] * finv[l] % MOD) % MOD;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 117504
n,k = map(int,input().split())
p = list(map(int,input().split()))
c = list(map(int,input().split()))
raw = []
seen = [0 for _ in range(n)]
for i in range(n):
  now = int(i)
  tmp = []
  if seen[i]:
    continue
  while seen[now] == 0:
    tmp.append(c[now])
    seen[now] = 1
    now = p[now] - 1
  raw.append(tmp)
#print(raw)
can = 0
for x in raw:
  sun = sum(x)
  l = len(x)
  x = x + x + x
  #print(x)
  now = [0]
  for y in x:
    now.append(now[-1]+y)
  #print(now)
  if sun > 0 and k >= l:
    ans = sun * (k//l-1)
    K = k % l + l
    #print(ans,k)
    maxi = 0
    for i in range(l):
      for j in range(i+1,3*l+1):
        if j - i <= K:
          maxi = max(maxi,now[j]-now[i])
    can = max(ans+maxi,can)
    #print(ans+maxi)
  else:
    maxi = 0
    for i in range(3*l+1):
      for j in range(i+1,3*l+1):
        if j - i <= k:
          maxi = max(maxi,now[j]-now[i])
    can = max(maxi,can)
    #print(maxi)
    #print('#')
if can == 0:
  print(max(c))
else:
  print(can)

Measured memory_bytes: 69480
mod=10**9+7
n=int(input())
a=[{} for i in range(n+1)]
def C(last4):
    if last4[:3]=='AGC' or last4[1:]=='AGC':
        return False
    for i in range(3):
        tmp=list(last4)
        tmp[i], tmp[i+1]=tmp[i+1], tmp[i]
        if ''.join(tmp).count('AGC')>0:
            return False
    return True
a[0]['TTT']=1
for i in range(1, n+1):
    for k, v in a[i-1].items():
        for c in 'ACGT':
            if C(k+c):
                if k[1:]+c in a[i]:
                    a[i][k[1:]+c]+=v
                else:
                    a[i][k[1:]+c]=v
print(sum(a[n].values())%mod)

Measured memory_bytes: 3916
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdlib>  
#include <cmath>
using namespace std;

int main(){
    float n;
    cin >> n;
  
    float Two = (float)2;
    float Zero = (float)0;
    float One = (float)1;
    float fff =0.0000001;
  
    if(n==1){
      printf("%f", 1.0);
    }else{
      int tmp = n/Two;
      if(n-tmp*2 < fff ){
        printf("%f", (float)tmp/n);
      }else{
        printf("%f", ((float)tmp+One)/n);
      }   
    }
}

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

int main(){
    ll k;cin>>k;
    ll s=100;
    ll cnt=0;
    while(s<k){
        cnt++;
        s+=s/100;
    }
    out(cnt);
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main(){
  int c=0,i,j,flag=0,cnt=0,size=0,cnt2;
  char a[101],b[101],x[2];
  cin >> a >> b;
  for(i=0;a[i]!='\0';i++){
    size++;
  }
  while(cnt!=size){
    i=cnt;
    cnt2=0;
    c=0;
    while(cnt2!=size){
      if(a[i]!=b[cnt2]){
        c=1;
        break;
      }
      i=(i+1)%(size);
      cnt2++;
    }
    cnt++;
    if(c==0){
      flag=1;
      break;
    }
  }
  if(flag==1) cout << "Yes" <<endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
T=int(input())
for TT in range(T):
	a,b,c,d=map(int,input().split(' '))
	l,x,y=(a+b)//(min(a,b)+1),0,0
	if a*l<=b:
		y=a+b
	elif b*l<=a:
		x=a+b
	else:
		x,y=(a*l-b)//(l-1),(b*l-a)//(l-1) #Like G2 tong long
	out=""
	for i in range(c,d+1):
		if i<=x:
			out+="AB"[i%(l+1)==0]
		elif a+b-i+1<=y:
			out+="BA"[(a+b-i+1)%(l+1)==0]
		else:
			out+="AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(out)


Measured memory_bytes: 48984
#include<iostream>
using namespace std;
int main()
{
int x;
bool flag = false;
cin>>x;
for(int i=0;i<3;i++)
{
if(x%10==7)
{
flag = true;
break;
}
    x/=10;
  }
flag?(cout<<"Yes" ): (cout<<"No");
  return 0;
}

Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int main(){
	int A;
	int P;
	int X;
	int Y;
	int Z;
	cin >> A;
	cin >> P;
	X = A * 3;
	Y = X + P;
	Z = Y / 2;
	cout << Z << endl;
	return 0;

}

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

#define mo 1000000007
#define ran 101101

int n, k;
int a[111];
int f[ran], s[ran];

int add(int a, int b) { return (a+=b)>=mo ? a-mo : a; }

int get_s(int l, int r) {
	if (l<=0) return s[r];
	return add(s[r], mo-s[l-1]);
}

int main() {
	scanf("%d%d", &n, &k);
	for(int i=0;i<n;i++) scanf("%d", &a[i]);
	
	for(int i=0;i<=k;i++) s[i] = 1;
	for(int i=0;i<n;i++) {
		for(int j=k;j>=0;j--)
			f[j] = get_s(max(0, j-a[i]), j);
		//for(int j=0;j<=k;j++) printf("%d%c", f[j], j<k ? ' ' : '\n');
		s[0] = f[0];
		for(int j=1;j<=k;j++)
			s[j] = add(s[j-1], f[j]);
	}
	printf("%d\n", f[k]);
	
	return 0;
}

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

struct Node {
    int index = -1;
    int depth = -1;
    int parent = -1;
    vector<int> child;
};

int get_depth(Node *node, int index) {
    if (node[index].parent < 0) {
        return 0;
    } else if (node[index].depth >= 0){
        return node[index].depth;
    }else {
        node[index].depth = get_depth(node, node[index].parent) + 1;
        return node[index].depth;
    }
}

int main() {
    int n;
    cin >> n;
    Node a[n];
    
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        a[x].index = x;
        for (int j = 0; j < y; ++j) {
            int b;
            cin >> b;
            a[x].child.push_back(b);
            a[b].parent = x;
        }
    }
    
    for (auto& i : a) {
        string child = "";
        for (auto& j : i.child) {
            string c = child == "" ? "" : ", ";
            child += c + to_string(j);
        }
        cout << "node " << i.index << ": ";
        cout << "parent = " << i.parent << ", ";
        cout << "depth = " << get_depth(a, i.index) << ", ";
        cout << (i.parent < 0 ? "root" : (i.child.size() < 1 ? "leaf" : "internal node")) << ", ";
        cout << "[" << child << "]" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 8292
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main()
{
	int n;
	long long sum = 0ll;
	scanf("%d", &n);
	rep(i, n){
		int a;
		scanf("%d", &a);
		sum += a;
	}
	printf("%lld\n", sum/n);
	
	return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);
const int MAX_LOG = (int)(335 + 5);

string s;

int n;
int doubling[MAX_LOG][MAX_N];

void make_doubling() {
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'R') {
      doubling[0][i] = i + 1;
    } else {
      doubling[0][i] = i - 1;
    }
  }

  for (int i = 1; i < MAX_LOG; ++i) {
    for (int j = 0; j < n; ++j) {
      int fst = doubling[i - 1][j];
      int snd = doubling[i - 1][fst];
      doubling[i][j] = snd;
    }
  }
}

int after[MAX_N];

int ans[MAX_N];

int main(void) {
  // Here your code !
  cin >> s;

  n = s.size();

  make_doubling();

  string binexp = "100100100100110101101001001011001010011000011011111010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
  // string binexp = "001";
 
  for (int i = 0; i < n; ++i) {
    after[i] = i;
  }

  for (int i = 0; i < binexp.size(); ++i) {
    if (binexp[i] == '0') continue;

    for (int j = 0; j < n; ++j) {
      after[j] = doubling[i][j];
    }
  }

  // for (int i = 0; i < n; ++i) {
  //   printf("%d ", doubling[0][i]);
  // }
  // printf("\n");

  for (int i = 0; i < n; ++i) {
    ans[after[i]] += 1;
  }

  for (int i = 0; i < n; ++i) {
    printf("%d ", ans[i]);
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 134272
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
 
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
 
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
int N;
int K;
ll a[114514];
ll dp[114514][2];
ll sum[114514];
vi G[114514];
int res;
void dfs(int now,int bef){
	dp[now][0]=1;
	dp[now][1]=1;
	for(int i=0;i<G[now].size();i++){
		if(G[now][i]!=bef)dfs(G[now][i],now);
	}
	for(int i=0;i<G[now].size();i++){
		if(G[now][i]!=bef){
			dp[now][0]=(dp[now][0]*(dp[G[now][i]][0]+dp[G[now][i]][1])%MOD)%MOD;
			dp[now][1]=(dp[now][1]*(dp[G[now][i]][0])%MOD)%MOD;
		}
	}
}
int main(){
	cin>>N;
	rep(i,N-1){
		int x,y;
		cin>>x>>y;x--;y--;
		G[x].pb(y);
		G[y].pb(x);
	}
	dfs(0,0);
	cout<<(dp[0][0]+dp[0][1])%MOD<<endl;
}

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

int main()
{
     int a,b,c;
     while(scanf("%d%d%d",&a,&b,&c)==3)
     {
        int sum=a*100+b*10+c,flag;
     if(sum%4==0)
        flag=1;
     else
        flag=0;
     printf("%s\n",flag==1?"YES":"NO");

     }
     return 0;

}


Measured memory_bytes: 256
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
using   ll =          long long;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define PI            (acos(-1.0))
#define repp(i,a,n)   for(int i=a;i<n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define w(t)          int t;cin>>t;while(t--)
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0),cout<<fixed<<setprecision(15);
typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
    string s;
    cin>>s;
    for(int i=0;i<SZ(s);i++)
    {
        if(s[i]=='?')s[i]='D';
    }
    cout<<s<<nl;
    return 0;
}


Measured memory_bytes: 3776
#ABC165-E Rotation Matching
"""
各頂点を円形に並べた時に、距離が等しくならないようにm個の辺を張れば良い。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,m = map(int,readline().split())
mod = n
lst1 = []
for i in range(m):
    lst1.append(i)

lst2 = []
for i in range(m):
    lst2.append(2*m-1-lst1[i])

for i in range(m//2):
    lst2[i] -= 2*m+1

for i,j in zip(lst1,lst2):
    print(i%mod+1,j%mod+1)


Measured memory_bytes: 75084
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;  
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

/* Coding space */
int main(){
  int n,tar; cin >> n >> tar;
  
  rep(x,n+1){
    rep(y,n+1){
      int z = n - x - y;
      if(z < 0) break;
      if(tar == 10000*x + 5000 * y + 1000*z){
        cout << x <<" "<< y <<" "<< z << endl;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
}

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

int main(){
    int n, d ;
    cin >> n >> d ;
    int ans = 0 ;
    if (n % (2*d + 1) != 0)
    {
        ans += 1 ;
    }
    
    ans += n /(2*d + 1) ;
    cout << ans << endl ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;


int main() {
    int k,x;
    cin >> k >> x;
    if(k*500 >= x) {
        cY
    }else {
        cN
    }
}

Measured memory_bytes: 764
#include<iostream>
#include<algorithm>
#include <vector>
#include<cmath>
#include<iomanip>
#include<queue>
using namespace std;
typedef long long int lint;
int main() {
	string W;
	cin >> W;
	int Z = W.size();
	vector<char>w(Z+2);
	for (int ia = 0; ia < Z; ia++) {
		w.at(ia) = W.at(ia);
	}
	w.at(Z) = 'A';
	w.at(Z + 1) = 'A';
	sort(w.begin(), w.end());
	reverse(w.begin(), w.end());
	int cnt = 1;
	for (int ic = 0; ic < Z+1; ic++) {
		if (w.at(ic) == w.at(ic + 1)) {
			cnt++;
		}
		else {
			if (cnt % 2 != 0) {
				cout << "No" << endl;
				return 0;
			}
			else {
				cnt = 1;
			}
		}
	}
		cout << "Yes" << endl;
		return 0;
}



	


Measured memory_bytes: 256
h,w,k=map(int,input().split())
maze=[]

for i in range(h):
    maze.append(input())
    for j in range(w):
        if maze[i][j]=="S":x,y=i,j
    
ans=float("INF")
l=[[float("INF")]*w for i in range(h)]
l[x][y]=0
from collections import deque
dq=deque([(x,y)])
#pop/append/(append,pop)_left/in/len/count/[]/index/rotate()(右へnずらす)
p={(x,y)}
while len(dq):
    nx,ny=dq.popleft()
    for a,s in [(0,1),(0,-1),(1,0),(-1,0)]:
        if 0<=a+nx<h and 0<=ny+s<w and l[a+nx][s+ny]==float("INf")and maze[a+nx][s+ny]==".":
            l[a+nx][ny+s]=l[nx][ny]+1
            if l[a+nx][ny+s]<=k:p.add((a+nx,s+ny))
            if l[a+nx][ny+s]<k:dq.append((a+nx,s+ny))
ans=float("INf")

for x,y in p:
    ans=min(ans,(min(x,y,h-1-x,w-1-y)+k-1)//k+1)
print(ans)

Measured memory_bytes: 125788
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main(){
  unsigned long long N;
  vector<unsigned long long> trans(5);
  unsigned long long time = 0;
  int min_i = 0;


  cin >> N;
  for(int i = 0;i < 5;i++){
    cin >> trans[i];
  }

  sort(trans.begin(),trans.end());

  time = (N - 1) / trans[0] + 5;

  cout << time << endl;
  

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		char[] rgb = scan.next().toCharArray();
		scan.close();
		
		long numR = 0;
		long numG = 0;
		long numB = 0;
		for(char c : rgb) {
			switch(c) {
			case 'R' : numR++; break;
			case 'G' : numG++; break;
			case 'B' : numB++; break;
			}
		}

		long ans = numR*numG*numB;

		for(int d=1;d<=n;d++){
			for(int m=0;m<n;m++){
				if(m-d<0||m+d>=n) continue;
          
				if(rgb[m-d] != rgb[m+d] && rgb[m] != rgb[m+d] && rgb[m-d] != rgb[m]) ans--;
			}
		}
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 35900