akhauriyash/Code-Regression huggingface dataset:
using System.Collections.Generic;
using System;

public class Process
{
    public string pname { get; set; }
    public int ptime { get; set; }
}

public class hello
{
    public static void Main()
    {
        var que = new Queue<Process>();
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var q = int.Parse(line[1]);
        for (int i = 0; i < n; i++)
        {
            string[] line2 = Console.ReadLine().Trim().Split(' ');
            var a = new Process { pname = line2[0], ptime = int.Parse(line2[1] )};
            que.Enqueue(a);
        }
        var count = 0;
        while(que.Count > 0)
        {
            var s = que.Dequeue();
            if (s.ptime - q <=0 )
            {
                Console.WriteLine("{0} {1}", s.pname, count + s.ptime);
                count += s.ptime;
            }
            else
            {
                s.ptime -= q;
                que.Enqueue(s);
                count += q;
            }
        }


    }
}

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

const string INF="-";

void maxChar(string &a, string b){
    if(a==INF) a=b;
    if(a.size()<b.size()) a=b;
    if(a.size()==b.size() && a<b) a=b;
}

int main(void){
    ll match[10]={2,5,5,4,5,6,3,7,6};
    string dp[11000];

    int N,M; cin >> N >> M;
    vector<int> A(M);
    for(int i=0; i<M; i++) cin >> A[i];
    for(int i=0; i<11000; i++) dp[i]=INF;

    dp[0]="";

    for(int i=0; i<=N; i++){
        if(dp[i]==INF) continue;
        
        for(auto a:A) maxChar(dp[i+match[a-1]], dp[i]+(char)('0'+a));
    }

    cout << dp[N] << endl;


}

Measured memory_bytes: 43776
#include <stdio.h>
#include <string.h>
int main(void){
    int h,w;
    scanf("%d %d",&h,&w);
    char gazou[h][w+1];

    for(int i = 0;i<h;i++){
        scanf("%s",gazou[i]);
    }

    for(int i = 0;i<h;i++){
        for(int j = 0;j<w;j++){
            for(int k = 0;k<h;k++){
                if(strstr(gazou[i],"#") != NULL && gazou[k][j] != '.'){
                    printf("%c",gazou[i][j]);
                    break;
                }
            }
            if(j == w-1 && strstr(gazou[i],"#") != NULL){
                printf("\n");
            }
            // printf("%d,%d\n",i,j);
        }
    }
}

Measured memory_bytes: 128
#include <iostream>
#include <set>

using namespace std;

int main() {
  while(1) {
    int n;
    cin>>n;
    if(n==1) {
      break;
    }

    cout<<n<<":";
    for(int i=6; i<=n; i++) {
      if(i%7 == 1 || i%7 == 6) { // 月曜土曜素数であり
	if(n%i == 0) { // かつ元の数の約数である
	  bool flag=true;
	  for(int j=6; j<i && flag==true; j++) {
	    if(j%7 == 1 || j%7 == 6) { // 月曜土曜素数
	      if(i%j == 0) { 
		flag = false;
	      }
	    }
	  }
	  if(flag == true) {
	    cout<<" "<<i;
	  }
	}
      }
    }
    cout<<endl;
  }
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

typedef long long ll;

int main(){
    int mod = 1000000007;
    int n;
    cin >> n;
    ll first = 1;
    ll second = 1;
    ll third = 1;
    ll mod_buf[3] = {0,0,0};
    for(int i = 0; i < n; i++){
        first *= 10;
        second *= 9;
        third *= 8;
        if(first > mod){
            first %= mod;
            mod_buf[0]++;
        } 
        if(second > mod){
            second %= mod;
            mod_buf[1]++;
        }
        if(third > mod){
            third %= mod;
            mod_buf[2]++;
        }
    }
    //cout << first << " " << second << " " << third << endl;


    second *= 2;
    if(second > mod){
        second %= mod;
        mod_buf[1]++;
    }
    if(second < third) second += mod;
    ll dif = second - third;
    //dif %= mod;
    if(first < dif) first += mod;
    ll ans = first - dif;
    //if (ans <= 0)ans += mod;
    ans %= mod;
    cout << ans << endl; 

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<int,int>;

const int MOD = 1e9 + 7;

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

    int a[3][3];
    rep(i, 3){
        rep(j, 3){
            cin >> a[i][j];
        }
    }

    int n;
    cin >> n;
    vector<int> b(n);
    rep(i, n){
        cin >> b[i];
    }

    rep(i, 3){
        rep(j, 3){
            bool f = false;
            rep(k, n){
                if(a[i][j] == b[k]){
                    f = true;
                }
            }
            if(f) {
                a[i][j] = 1;
            }else{
                a[i][j] = 0;
            }
        }
    }

    bool ok = false;
    int cnt[8] = {0};
    rep(i, 3){
        cnt[0] += a[0][i];
        cnt[1] += a[1][i];
        cnt[2] += a[2][i];
        cnt[3] += a[i][0];
        cnt[4] += a[i][1];
        cnt[5] += a[i][2];
    }

    cnt[6] = a[0][0] + a[1][1] + a[2][2];
    cnt[7] = a[0][2] + a[1][1] + a[2][0];

    rep(i, 8){
        if(cnt[i] == 3){
            ok = true;
        }
    }

    cout << (ok ? "Yes": "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
const int maxc = 26;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);
const double eps = 1e-8;
inline int read(){
    int f = 1,x = 0; char ch = getchar();
    while(ch < '0' || ch > '9'){if(ch == '-')f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x * 10 + ch - 48;ch = getchar();}
    return f * x;
}
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll qw(ll x,ll y){ll ans = 1;while(y){if(y&1) ans *= x;x *= x;y >>= 1;}return ans;}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool is_prime(ll x){if(x <= 1) return 0;for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;	}
int n,m,u,v,h[maxn];
bool vis[maxn];
int ans = 0;
void solve(){
	for(int i = 1;i <= n;i++){
		if(!vis[i]) ans++;
	}
	cout << ans << endl;
}
int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	rep(i,1,n) cin >> h[i];
	while(m--){
		cin >> u >> v;
		if(h[u] > h[v]) vis[v] = 1;
		else if(h[v] > h[u]) vis[u] = 1;
		else vis[u] = vis[v] = 1;
	}
	solve();
	return 0;	
}

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

int main()
{
  string s;
  cin >> s;
  int i;
  int c = 0;
  int f = 0;
  int check;
  for(i = 0; i < s.size(); i++)
  {
    if(s.at(i) == 'C')
    {
      c++;
      check = i;
    }
  }
  for(i = 0; i < s.size(); i++)
  {
    if(s.at(i) == 'F' && i > check)
    {
      f++;
    }
  }
  if(c >= 1 && f >= 1)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

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

int calc(int y, int m, int d) {
  int ans = 0;
  ans += (y - 1) * 195 + (y - 1) / 3 * 5;
  ans += (m - 1) * 19 + ((y % 3 == 0) ? m - 1 : m / 2);
  ans += d;
  return ans;
}

int main() {
  int n; cin >> n;
  for (int i = 0; i < n; ++i) {
    int Y, M, D; cin >> Y >> M >> D;
    cout << calc(1000, 1, 1) - calc(Y, M, D) << endl;
  }
  return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld double
bool fun(string s){
    int i=0; int j=(int)s.size()-1;
    while(i<j){
        if(s[i]!=s[j]) return false;
        i++;
        j--;
    }
    return true;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    string s;
    cin>>s;
    int n=s.size();
    if(fun(s) && fun(s.substr(0,(n-1)/2)) && fun(s.substr((n+3)/2-1,n)) ) cout<<"Yes";
    else cout<<"No"; 
}

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

int main() {
    int N, M;
    cin >> N >> M;
    int A;
    int work = 0;
    for(int i = 0; i < M; i++) {
        cin >> A;
        work += A;
    }

    if(work > N) {
        cout << "-1" << endl;
    } else {
        cout << (N - work) << endl;
    }

    return 0;
}

Measured memory_bytes: 3620
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
int main()
{
    string s;
    while(cin>>s)
    {
        int a=0;
        int b=0;
        for(int i=0;i<s.size();i++)
        {
            if(s[i]=='B')b++;
            else a++;
        }
        if(a!=0&&b!=0)cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;
}


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

int main(){
    int N, A;
    scanf("%d%d", &N, &A);
    if (A >= N % 500) {
        printf("%s\n", "Yes");
    } else {
        printf("%s\n", "No");
    }
    return 0;
}


Measured memory_bytes: 256
//abc123 b 最後に注文するものを決める
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int n; cin>>n;
    int ans=0;
    //563
    int x=n;
    while(x>0){
        ans+=x%10;
        x/=10;
    }
    //cout<<ans<<endl;
    if(n%ans==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n - 1); i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    forn(i, 0, n) cin >> a[i];
    vector<int> b;
    for (int i = n - 1; i >= 0; i -= 2)
        b.eb(a[i]);
    for (int i = n % 2; i < n; i += 2)
        b.eb(a[i]);
    forn(i, 0, n) cout << b[i] << ' ';
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print1(a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=200005;
//i_am_noob
int n;

int solve(int n){return n==1?1:(solve(n>>1)<<1)+1;}

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	print1(solve(n));
	return 0;
}

Measured memory_bytes: 256
// AOJ 1232: Calling Extraterrestrial Intelligence Ag...
// 2017.10.14 bal4u@uu

#include <stdio.h>
#include <math.h>

#define MAX  100000
#define SQRT 316     // sqrt(MAX)
char prime[MAX+5], *pmax = prime + MAX;

void mkprime()
{
	int k;
	register char *p, *q;
//	prime[1] = 1, prime[2] = 0;
//	for (p = prime + 4; p <= pmax; p += 2) *p = 1;
	for (k = 3, p = prime + 3; k <= SQRT; k += 2, p += 2)
		if (!*p) for (q = p + k; q <= pmax; q += k) *q = 1;
}

int main()
{
	int m, a, b, p, q;
	int k, t, max, pmax, qmax;

	mkprime();
	while (scanf("%d%d%d", &m, &a, &b) && m > 0) {
		k = (int)sqrt(m); if (k > 2 && !(k & 1)) k--;
		while (prime[k]) k -= 2;
		for (max = 0, p = k; p >= 2; p-=2) if (!prime[p]) {
			q = m/p, t = p*b/a;
			if (q > t) q = t;
			if (q > 2 && !(q & 1)) q--;
			while (prime[q]) q -= 2;
			if ((t = p*q) > max) max = t, pmax = p, qmax = q;
		}
		printf("%d %d\n", pmax, qmax);
    }
    return 0;
}

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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	ll i,j,n,m,k,cnt=0,ans=0,t=1;
	cin>>n;
	ll a[n];
	rep(i,0,n) cin>>a[i];
	double val=0;
	rep(i,0,n){
		val+=(1.0/(1.0*a[i]));
	}	
	val=(1.0/val);
	cout<<setprecision(8)<<fixed<<val;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define double long double
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) begin(v), end(v)
#define allg(v) begin(v), end(v), greater<int>()



signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  string s;
  ll n;
  
  cin >> n;
  bool ans = false;
  
  rep(i, 0, 100/4 +1) {
    rep(j, 0, 100/7 +1) {
      if(i*4 + j*7 == n)
        ans = true;
    }
  }
  
  cout << ( ans ?"Yes" :"No") << "\n";

}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let q:usize = read();
    let st:String = read();
    let chars = st.chars().collect::<Vec<char>>();

    let mut s = vec![0; n+1];
    for i in 0..n {
        if i +1 < n && chars[i] == 'A' && chars[i+1] == 'C' {
            s[i+1] = s[i] + 1;
        } else {
            s[i+1] = s[i];
        }
    }

    for _ in 0..q {
        let l:usize = read();
        let r:usize = read();
        println!("{}", s[r-1] - s[l-1]);
    }
}


Measured memory_bytes: 4860
#include <stdio.h>

int main(int argc,char* argv[]){
  int i;
  int graph[101];

  for(;;){
    int from = -1,to = -1,odd_num = 0;

    for(i = 1; i <= 100; i++){
      graph[i] = -1;
    }

    while(scanf("%d %d",&from,&to) != EOF){
      if(from == 0 && to == 0){
	break;
      }else{
	graph[to] = (graph[to] == -1) ? 1 : graph[to]+1;
	graph[from] = (graph[from] == -1) ? 1 : graph[from]+1;
      }
    }

    if(from != 0 || to != 0){
      break;
    }

    for(i = 1; i <= 100; i++){
      if(graph[i] == -1){break;}
      if(graph[i]%2 == 1){odd_num++;}
    }

    if(odd_num == 2){
      printf("OK\n");
    }else{
      printf("NG\n");
    }
  }

  return 0;
  
}

Measured memory_bytes: 0
#include <iostream>

using namespace std;

int main(){
  int N, M, cnt=0, sum=0;
  cin >> N >> M;
  int A[N];
  for(int i=0; i<N; i++) cin >> A[i];
  for(int i=0; i<N; i++) sum += A[i];
  for(int i=0; i<N; i++){
    if(A[i]*4*M >= sum) cnt++;
  }
  if(cnt < M) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
M=10**9+7;F=lambda X:pow(X,M-2,M);H,W,A,B=map(int,input().split());Z=C=1
for I in range(H-1):Z=C=C*(W+H-B-2-I)*F(I+1)%M
for I in range(1,H-A):C=C*(B-1+I)*(H-I)*F(I*(W+H-B-1-I))%M;Z=(Z+C)%M
print(Z)

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

int main() {
 int N ;
 cin >> N ;
 string ans = "No" ;
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      if (N == i*j){
        ans = "Yes";
      }
    }
   }
  cout << ans;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <cassert>
#include <cstring>

using namespace std;

const int N = 1e5 + 7;

int n, a[N];

void first() {
	puts("First");
	exit(0);
}

void second() {
	puts("Second");
	exit(0);
}

int main() {
	scanf("%d", &n);
	long long tot = 0;
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]), tot += a[i];
	if (n == 1) {
		if (a[1] == 1) second();
		else first();
	}
	if (n % 2 == 0) {
		if (tot % 2 == 1) {
			first();
		} else {
			second();
		}
	} else {
		int c = 0;
		while (tot % 2 == 1) {
			int pos = 0, cnt = 0;
			for (int i = 1; i <= n; i++) {
				if (a[i] % 2 == 1) {
					cnt++;
					pos = i;
				}
			}
			if (cnt > 1) break;
			assert(cnt != 0);
			if (a[pos] == 1) break;
			c ^= 1;
			a[pos]--;
			tot = 0;
			int g = a[1];
			for (int i = 2; i <= n; i++) {
				g = __gcd(g, a[i]);
			}
			for (int i = 1; i <= n; i++) {
				tot += (a[i] /= g);
			}
		}
		if (tot % 2 == 1) {
			c ^= 1;
		}
		if (c == 0) first();
		else second();
	}
	return 0;
}


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

int main()
{
    int n;
    std::cin >> n;
    std::vector<int> a(n + 1),b(n);
    for(int i = 0; i <= n; i++)std::cin >> a[i]; // モンスターの数
    for(int i = 0; i < n; i++)std::cin >> b[i];  //勇者の体力
    long long cnt = 0;
    for(int i = 0; i <= n; i++){
        if(a[i] - b[i] < 0){
            b[i] -= a[i];
            cnt += a[i];
            int p = a[i + 1];
            a[i + 1] = std::max(a[i + 1] - b[i], 0);
            cnt += p - a[i + 1]; 
        }else{
            cnt += b[i]; //その街で倒せるだけ倒して終わり
        }
    }
    std::cout << cnt << std::endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <string.h>
#define ll int
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string a;
    char c;
    ll y, h = 0, x;
    cin >> a;
    ll q;
    cin >> q;
    for (ll i = 1; i <= q; i++)
    {
        cin >> x;
        if (x == 1)
        {
            if (h == 0)
                h = 1;
            else
                h = 0;
        }
        else
        {
            cin >> y >> c;
            if (y == 1)
            {
                if (h == 0)
                    a.insert(a.begin(), c);
                else
                {
                    a.insert(a.end(), c);
                }
            }
            else
            {
                if (h == 0)
                    a.insert(a.end(), c);
                else
                    a.insert(a.begin(), c);
            }
        }
    }
    if (h == 1)
        reverse(a.begin(),a.end());
    cout << a << endl;
}

Measured memory_bytes: 912
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for _ in range(n)]
def LIR(n):
    return [LI() for _ in range(n)]
def SR(n):
    return [S() for _ in range(n)]
def LSR(n):
    return [LS() for _ in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    ans = pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod)
    print(ans%mod)
    return

#Solve
if __name__ == "__main__":
    solve()


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

using namespace std;

int main() {
	int w[10];
	int k[10];
	for (int i = 0; i < 10; i++){
		cin >> w[i];
	}
	for (int i = 0; i < 10; i++) {
		cin >> k[i];
	}
	sort(k, k + 10);
	sort(w, w + 10);
	cout << w[9] + w[8] + w[7] << " " << k[9] + k[8] + k[7] << endl;
}

Measured memory_bytes: 3040
#include <stdio.h>

#define N 100000

int min(long long a, int b) {
	return a < b ? a : b;
}

int main() {
	int n, a, b, x, x_;
	long long ans;

	scanf("%d%d%d", &n, &a, &b);
	ans = 0;
	x_ = -1;
	while (n--) {
		scanf("%d", &x);
		if (x_ != -1)
			ans += min((long long) (x - x_) * a, b);
		x_ = x;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

// AOJ 0061
public class Main {
	static Scanner sc = new Scanner(System.in);
	static final double EPS = 1e-8;
	public static void main(String[] args) {
		
		ArrayList<C> ary = new ArrayList<C>();
		while (true) {
			String[] ss = sc.next().split(",");
			int a = new Integer(ss[0]), b = new Integer(ss[1]);
			if (a == 0 && b == 0) break;
			ary.add(new C(a, b));
		}
		
		C[] cs = new C[ary.size()];
		for (int i = 0; i < cs.length; i++) cs[i] = ary.get(i);
		sort(cs);
		
		cs[0].rank = 1;
		for (int i = 1; i < cs.length; i++)
			if (cs[i].score == cs[i - 1].score)
				cs[i].rank = cs[i - 1].rank;
			else
				cs[i].rank = cs[i - 1].rank + 1;
		
		
		while (sc.hasNextInt()) {
			int q = sc.nextInt();
			for (int i = 0; i < cs.length; i++) {
				if (cs[i].no == q) {
					System.out.println(cs[i].rank);
					break;
				}
			}
		}
	}
}

class C implements Comparable<C> {
	int no, score, rank;
	C (int no, int score) {
		this.no = no;
		this.score = score;
	}
	
	public int compareTo(C c) {
		return c.score - this.score;
	}
	
	public String toString() {
		return this.no + " " + this.score + " " + this.rank;
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <deque>
#include <string.h>
#include <math.h>
typedef long long ll;
typedef long long int lli;
#define INF			100000
#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MIN(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define SWAP
#define REP(i,x,y)	for (int (i)=(x);(i)<(y);(i)++)
#define REP_(i,x,y)	for ((i)=(x);(i)<(y);(i)++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;
typedef pair<int, int> Point;
typedef vector<vector<Point>> Graph;

lli n;
bool x[INF];
int i,j;
int main() {
	
	cin >> n;
	
	for (i=2;i*i<60000;i++) if (!x[i])for (j=2*i;j<60000;j+=i)x[j]=true;

	i=11;
	
	while (n>0) {
		if (!x[i]) {
			cout << i << " ";
			n--;
		}
		i += 10;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repX(i, n ,x) for (int i = x; i < (int)(n); ++i)
#define repBack(i, n) for (int i = n; i >= 0; --i)
#define dup(x, y) (((x) + (y)-1) / (y))

int main() {
    int N;
    ll K;
    cin >> N >> K;
    vector<int>A(N);
    rep(i,N){
        cin >> A[i];
        --A[i];
    }
    vector<p> count(N,p(0,0));
    count[0] = p(1,0);
    int i = 0;
    int l = 0;
    while(true){
        int j = i;
        i=A[i];
        if(count[i].first!=0){
            i=j;
            break;
        }
        count[i] = p(count[j].first+1,i);
    }
    int ls = count[A[i]].first;
    int le = count[i].first;
    sort(count.begin(),count.end(),greater<p>());
    p zero = p(0,0);
    while(true){
        if(count[count.size()-1] == zero){
            count.pop_back();
        }else{
            break;
        }
    }
    reverse(count.begin(),count.end());
    //********count[i-1]********
    if(K - (ls-1)<=0){
        cout << count[K].second +1 << endl;
    }else{
        cout << count[ls-1+((K - (ls - 1)) % ((le - ls) + 1))].second +1 << endl;
    }
    return 0;
}

Measured memory_bytes: 5632
/**
 *    author:  FromDihPout
 *    created: 2020-06-25
**/

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


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    long long n, m;
    cin >> n >> m;
    
    if (n >= m / 2) {
        cout << m / 2 << endl;
    }
    else {
        long long add = (m - 2 * n) / 4;
        cout << n + add << endl;
    }
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <ctime>
#include <map>
#include <set>
#define fi first
#define se second
#define pii pair<int,int>
//#define ivorysi
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define MAXN 6005
using namespace std;
typedef long long int64;
typedef double db;
typedef unsigned int u32;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9' ) {
		res = res * 10 - '0' + c;
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
namespace task {
	char s[MAXN];
	int N,a[MAXN],b[MAXN],tota,totb,pos[MAXN];
	string str[MAXN];
	bool vis[MAXN];
	void Init() {
		read(N);
		scanf("%s",s + 1);
		tota = 0;totb = 0;
		for(int i = 1 ; i <= 2 * N ; ++i) {
			if(s[i] == 'a') {a[++tota] = i;pos[i] = tota;}
			else {b[++totb] = i;pos[i] = totb;}
		}
	}
	void Solve() {
		str[2 * N + 1] = "";
		for(int i = 2 * N ; i >= 1 ; --i) {
			str[i] = max(str[i],str[i + 1]);
			string t = "";
			int p = pos[i];
			if(s[i] == 'a' && a[p] < b[p]) {
				str[i] = max(str[i],"ab" + str[b[p] + 1]);
			}
			else if(s[i] == 'b' && b[p] < a[p]) {
				memset(vis,0,sizeof(vis));
				int maxv = a[p];
				for(int j = i ; j <= maxv ; ++j) {
					if(s[j] == 'b') {
						p = pos[j];
						vis[b[p]] = 1;vis[a[p]] = 1;
						maxv = max(a[p],maxv);
					}
					if(vis[j]) t += s[j];
				}
				t += str[maxv + 1];
				str[i] = max(str[i],t);
			}
		}
		cout<<str[1]<<endl;
	}
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	task::Init();
	task::Solve();
	return 0;
}

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

int main(void){
    int a, b, f;
    char aa[9], bb[9];

    scanf("%d %d", &a, &b);

    if(a < b){
        for(int i = 0 ; i < b ; i++){
            printf("%d", a);
        }
    }
    else {
        for(int i = 0 ; i < a ; i++){
            printf("%d", b);
        }
    }
    printf("\n");

}

Measured memory_bytes: 128
package main

import (
  "fmt"
)

func main() {
  var n, y int
  fmt.Scanf("%d %d", &n, &y)

  var a,b,c int
  end := false
  for i:=0; i<=n; i++ {
	for j:=0; j<=n-i; j++ {
	  if 10000*i + 5000*j + 1000*(n-i-j) == y {
	    end = true
	    a = i
	    b = j
	    c = n-i-j
	  }
	if end {break}
	}
  if end {break}
  }
  if end {
	fmt.Println(a,b,c)
  } else {
	fmt.Println("-1 -1 -1")
  }
}


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

int main(){
    int a, b, c, x;    cin >> a >> b >> c >> x;
    x /= 50;
    int cnt=0;
    for(int i=0; i<=a; i++){
        for(int j=0; j<=b; j++){
            for(int k=0; k<=c; k++)
            if(10*i+j*2+k==x) cnt += 1;
        }
    }
    cout << cnt << endl;
}

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

int main() {
  int h,w;
  cin >> h >> w;
  int mod = 1000000007;
  vector<vector<string>> field(h+1, vector<string>(w+1));
  rep(i,1,h+1) {
    string s;
    cin >> s;
    rep(j,1,w+1) field[i][j] = s.substr(j-1,1);
  }
  vector<vector<int>> dp(h+1, vector<int>(w+1,0));
  dp[1][1] = 1;
  rep(i,1,h+1) rep(j,1,w+1) {
    if (i == 1 && j == 1) continue;
    if (field[i][j] == "#") continue;
    dp[i][j] = dp[i-1][j] + dp[i][j-1];
    dp[i][j] %= mod;
  }
  cout << dp[h][w] << endl;
  return 0;
}


Measured memory_bytes: 38860
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
using static ConsoleApplication.Utils;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var nt = ReadInts();
            var a = ReadInts();
            var lst = new List<int>();
            var min = int.MaxValue;
            foreach (var i in a)
            {
                if (min > i) min = i;
                lst.Add(i - min);
            }
            var res = lst.GroupBy(i => i).Max(g => g.Key).Count();
            WriteLine(res);
        }
    }

    public static class Utils
    {
        #region Extensions for IO

        public static long ReadLong()
            => ReadLine().ToLong();
        public static int ReadInt()
            => ReadLine().ToInt();

        public static IEnumerable<int> ReadInts()
            => ReadStrings().Select(int.Parse);

        public static IEnumerable<string> ReadStrings()
            => ReadLine().Split(' ');

        public static IEnumerable<string> ReadLines(int n)
        {
            foreach (var i in Enumerable.Range(0, n))
            {
                yield return ReadLine();
            }
        }

        #endregion

        #region Extensions of int

        public static bool IsOdd(this int n)
            => !n.IsEven();

        public static bool IsEven(this int n)
            => n % 2 == 0;

        public static bool CanDivideWith(this int n, int divisor)
            => n % divisor == 0;

        #endregion

        #region Extensions of string

        public static int ToInt(this string str)
            => int.Parse(str);

        public static long ToLong(this string str)
            => long.Parse(str);

        public static double ToDouble(this string str)
            => double.Parse(str);

        public static bool IsNullOrEmpty(this string str)
            => string.IsNullOrEmpty(str);

        #endregion

        public static TSource Max<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
            where TKey : IComparable
        {
            // var max = source.First();
            // foreach (var item in source)
            // {
            //     if (keySelector(max).CompareTo(keySelector(item)) < 0) max = item;
            // }
            // return max;
            return source.OrderByDescending(keySelector).First();
        }

        public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
        {
            foreach (var item in source)
            {
                action(item);
            }
        }

        public static IEnumerable<T> Peek<T>(this IEnumerable<T> source, Action<T> action)
        {
            foreach (var item in source)
            {
                action(item);
            }
            return source;
        }
    }
}


Measured memory_bytes: 26108
// Problem : C - Step
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


/*ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀🌙｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、 
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 🚶ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	int N;
	cin>>N;
	vi v(N);
	cin>>v[0];
	ll ans=0;
	FOR(x,1,N)
	{
		cin>>v[x];
		if(v[x]<v[x-1])
			ans+=v[x-1]-v[x],v[x]=v[x-1];
	}
	cout<<ans<<nl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 4024
//package gfg;

import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		char c=br.readLine().trim().charAt(0);
		if(c>=96) {
			System.out.println("a");
		}
		else {
			System.out.println("A");	
		}
		
		
		
	}

}


Measured memory_bytes: 32368
N, M, Q = map(int, input().split())

LR_plane = [[0 for i in range(N+1)] for j in range(N+1)]

for i in range(M):
    L, R = map(int, input().split())
    LR_plane[L-1][R-1] += 1

for i in range(N-1, -1, -1):
    for j in range(N+1):
        LR_plane[i][j] = LR_plane[i+1][j] + LR_plane[i][j]
        
for i in range(N+1):
    for j in range(1, N+1):
        LR_plane[i][j] = LR_plane[i][j-1] + LR_plane[i][j]

for i in range(Q):
    p, q = map(int, input().split())
    print(LR_plane[p-1][q-1])

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

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

int main() {
    cout.precision(20);
    long double a, b, h, m;
    cin >> a >> b >> h >> m;
    long double h_angle = h/12+(m/60)/12;
    long double m_angle = m/60;

    h_angle*=2*M_PI;
    m_angle*=2*M_PI;

    cout << sqrtl((a*a+b*b) - (2*a*b)*cosl(h_angle-m_angle));
    return 0;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int h,w;
    bool hantei=true;
    cin >> h >> w;
    vector<string> masu(100);
    rep(i,h){
        string a;
        cin >> a;
        masu[i] = a;
    }
    vector<int> idou_x={1,0,-1,0},idou_y={0,1,0,-1};
    rep(i,h){
        rep(j,w){
            if(masu[i][j] == '#'){
                int cnt=0;
                rep(k,4){
                    if(j+idou_x[k] >= 0 && j+idou_x[k] <w && i+idou_y[k] >=0 && i+idou_y[k] <h){
                        if(masu[i+idou_y[k]][j+idou_x[k]] == '#') cnt++;
                    }
                }
                if(cnt == 0) hantei =false;
            }
        }
    }
    if(hantei) cout<< "Yes" <<endl;
    else cout << "No" <<endl;
    
}

Measured memory_bytes: 256
from collections import defaultdict
N, K = map(int,input().split())
d = defaultdict(int)
for _ in range(N):
    a, b = map(int,input().split())
    d[a] += b
cnt = 0
for i in range(1,10**5+1):
    cnt += d[i]
    if cnt >= K:
        print(i)
        break

Measured memory_bytes: 17472
fun main(args: Array<String>) {
    val (N, A, B, C) = listOfInt()
    val L = (0 until N).map { nextInt() }
    var ans = Int.MAX_VALUE
    fun calc(V: IntArray) {
        var mp = 0
        val abc = Array(4) { 0 }
        for (n in 0 until N) {
            if (V[n] == 3) continue
            if (abc[V[n]] > 0) mp += 10
            abc[V[n]] += L[n]
        }
        abc[3] = 1001001001
        mp += Math.abs(abc[0] - A) + Math.abs(abc[1] - B) + Math.abs(abc[2] - C)
        if (abc.min()!! > 0) ans = Math.min(ans, mp)
    }
    fun dfs(d: Int, v: IntArray) {
        if (d == N) calc(v)
        else for (n in 0 until 4) {
            v[d] = n
            dfs(d + 1, v)
        }
    }
    dfs(0, IntArray(N))
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)

Measured memory_bytes: 40584
import sys

input = sys.stdin.readline

def main():
    ans = 0
    N = int(input())
    ans = [0, 0, 0, 0]
    S = ['AC', 'WA', 'TLE', 'RE']
    for i in range(N):
        s = input().rstrip('\n')
        ans[S.index(s)] += 1
    print(f'AC x {ans[0]}')
    print(f'WA x {ans[1]}')
    print(f'TLE x {ans[2]}')
    print(f'RE x {ans[3]}')

if __name__ == '__main__':
    main()

Measured memory_bytes: 9168
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include<numeric>
#include<limits.h>
#include<utility>
#include<cstdlib>
#define LP(i,n) for(int i=0;i<n;i++)
#define LPIN(n,a) for(int i=0;i<n;i++)cin >> a[i]
using namespace std;
 
int main(){
  int a[3],n;
  long long int ans=0;
cin >> a[0] >> a[1] >> a[2] >> n;
sort(a,a+3);
  for(int i=0; a[2] * i <= n;i++){
    for(int j=0;j * a[1] + a[2] * i <= n;j++){
if( (n -j  * a[1] - a[2] * i) % a[0] == 0)ans++;
    }
  }
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
   int a,b,m;
   scanf("%d %d %d",&a,&b,&m);
   int ai[a],bi[b],c[m][3];
   int i,j;
   int a_min = 100000,b_min = 100000,sum_min = 0,abmin = 200000;
   for(i = 0; i < a; i++){
      scanf("%d",&ai[i]);
      if(ai[i]<a_min){
         a_min = ai[i];
      }
   }
   for(i = 0; i < b; i++){
      scanf("%d",&bi[i]);
      if(bi[i]<b_min){
         b_min = bi[i];
      }
   }
   sum_min = a_min+b_min;  
   for(i = 0; i < m; i++){
      for(j = 0; j < 3; j++){
         scanf("%d",&c[i][j]);
      }
   }

   int sum = 0;
   for(i = 0;i < m; i++){
      
      sum += (ai[c[i][0]-1]+bi[c[i][1]-1]-c[i][2]);
      if(sum < sum_min){
         sum_min = sum;
      }
      sum = 0;
   }
  
    printf("%d",sum_min);
  
   return 0;
}


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

int main() {

	int N,c[2];
	cin >> N;
	vector<int> x(N),y(N);
	for (int i = 0; i < N;i++) {
		cin >> x[i];
	}
	y = x;
	sort(y.begin(), y.end());
	c[0] = y[N / 2 - 1];
	c[1] = y[N / 2];
	if (c[0] == c[1]) {
		for (int i = 0; i < N; i++) {
			cout << c[0] << endl;
		}
	}
	else {
		for (int i = 0; i < N; i++) {
			if (x[i] <= c[0] ) {
				cout << c[1] << endl;
			}
			else {
				cout << c[0] << endl;
			}
		}
	}
	/*
	if (x-a >= 0 && x-a < b) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	*/
	return 0;
}

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

int main()
{
	int sx,sy,tx,ty,disx,disy,i;
	cin >> sx>>sy>>tx>>ty;
	disx = tx - sx;
	disy = ty - sy;
	char s[1000000];
	for (i = 0; i < disx; i++) {
		s[i] = 'R';
	}
	for (i = disx; i < disx + disy; i++) {
		s[i] = 'U';
	}
	for (i = disx+disy; i < 2*disx + disy; i++) {
		s[i] = 'L';
	}
	for (i = 2*disx+disy; i < 2*disx + 2*disy; i++) {
		s[i] = 'D';
	}
	s[2 * disx + 2 * disy] = 'L';
	for (i = 2 * disx + 2*disy+1; i < 2 * disx + 2 * disy+1+1+disy; i++) {
		s[i] = 'U';
	}
	for (i = 2 * disx + 2 * disy + 1 + 1 + disy; i < 3 * disx + 3 * disy + 1 + 1 + 1; i++) {
		s[i] = 'R';
	}
	s[3 * disx + 3 * disy + 1 + 1 + 1] = 'D';
	s[3 * disx + 3 * disy + 1 + 1 + 1 + 1] = 'R';
	for (i = 3 * disx + 3 * disy + 5; i < 3 * disx + 4 * disy + 6; i++) {
		s[i] = 'D';
	}
	for (i = 3 * disx + 4 * disy + 6; i < 4 * disx + 4 * disy + 7; i++) {
		s[i] = 'L';
	}
	s[4 * disx + 4 * disy + 7] = 'U';
	for (i = 0; i <= 4 * disx + 4 * disy + 7; i++) {

		cout << s[i] ;
	}
    return 0;
}



Measured memory_bytes: 256
N,M = map(int, input().split())
a = [int(input()) for _ in range(M)]
dp = [0 for _ in range(N+1)]
dp[0] = 1
no_step = 0
for i in range(N+1):
    if no_step >= M:
        if i+1 <= N:
            dp[i+1] += dp[i]
        if i+2 <= N:
            dp[i+2] += dp[i]
    else:
        if i == a[no_step]:
            no_step += 1
            continue
        else:
            if i+1 != a[no_step] and i+1 <= N:
                dp[i+1] += dp[i]
            if i+2 != a[no_step] and i+2 <= N:
                dp[i+2] += dp[i]
print(dp[-1]%1000000007)

Measured memory_bytes: 462708
package main

import (
	"fmt"
	"math"
)

type plan struct {
	T float64
	X float64
	Y float64
}

func main() {
	n := 0
	fmt.Scan(&n)

	plans := make([]plan, n+1)
	for i := 1; i <= n; i++ {
		fmt.Scan(&plans[i].T, &plans[i].X, &plans[i].Y)
	}

	for i := range plans {
		if i == 0 {
			continue
		}

		p := plans
		absT := int(math.Abs(p[i].T - p[i-1].T))
		absX := int(math.Abs(p[i].X - p[i-1].X))
		absY := int(math.Abs(p[i].Y - p[i-1].Y))
		if absT%2 != (absX+absY)%2 || absT < (absX+absY) {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}


Measured memory_bytes: 5760
using System;

public class p0102{
	p0102 ()
	{
		string str;
		string[] st;
		int n;
		int[,] a = new int[11, 11];
		
		while ((str=Console.ReadLine())!=null && str != "0") {
			n = int.Parse (str);
			
			a [n, n] = 0;
			for (int i = 0; i < n; ++i) {
				st = (Console.ReadLine ()).Split (' ');
				a [i, n] = a [n, i] = 0;
				for (int j = 0; j < n; ++j) {
					a [i, j] = int.Parse (st [j]);
					a [i, n] += a [i, j];
				}
			}
			for (int i = 0; i < n; ++i)
				for (int j = 0; j <= n; ++j)
					a [n, j] += a [i, j];
			
			for(int i = 0; i <= n; ++i){
				for(int j = 0; j <= n; ++j)
					Console.Write("{0,5}", a[i,j]);
				Console.WriteLine("");
			}
		}
	}
	
	public static int Main (string[] args)
	{
		new p0102 ();
		return 0;
	}
}

Measured memory_bytes: 5724
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
--
local A, B = read.nn()
local ans = math.max(A-2*B,0)
print(ans)

Measured memory_bytes: 1136
#include<iostream>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>//min,max,swap,rand,reverse,sort,lower_bound
#include<functional>
#include<vector>
#include<list>
#include<map>
#include<tuple>
#include<cmath>//abs, sin, cos
using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;
	cout << A * B;
	return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define forn(b) for(int i = 0; i < b; i++)
#define rforn(b) for(int i = b - 1 ;i >= 0; i--)
#define It(m) for(auto it = m.begin(); it != m.end(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
const ll mod = (ll)1e9 + 7;
	
int main(){
	speed;
	int t; cin >> t;
	map<string, int> m;
	while(t--) {
		string s; cin >> s;
		m[s]++;
	}	
	cout << "AC x " << m["AC"] << endl;
	cout << "WA x " << m["WA"] << endl;
	cout << "TLE x " << m["TLE"] << endl;
	cout << "RE x " << m["RE"] << endl;
	return 0;
}

Measured memory_bytes: 3652
//Author rahuliitkgp

/*A thing of beauty is a joy forever,
Its loveliness increases,
it will never pass into nothingness.*/
//Men at Work :)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;

#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define INF (int)1e9 + (int)1e8
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void cpp(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

class graph{
public:
    vector<ll>* adjList;
    vector<vector<ll> > dp;
    graph(ll n){
        adjList = new vector<ll>[n];
        dp = vector<vector<ll> >(n, vector<ll>(2, -1));
    }
    void addEdge(ll u, ll v){
        adjList[u].push_back(v);
        adjList[v].push_back(u);
    }
    ll dfs(ll curr, ll par, ll color){
        if(dp[curr][color]!=-1) return dp[curr][color];
        ll ans1 = 1;
        for(auto ch: adjList[curr]){
            if(ch!=par){
                if(color==1){
                    ans1*=(dfs(ch, curr, 1)+dfs(ch, curr, 0));
                    ans1%=mod;
                }
                else{
                    ans1*=dfs(ch, curr, 1);
                    ans1%=mod;
                }
            }
        }
        return dp[curr][color]=ans1;
    }
};


int main(){
    cpp();
    ll n;
    cin>>n;
    graph g(n);
    for(ll i=0; i<n-1; i++){
        ll x, y;
        cin>>x>>y;
        g.addEdge(--x, --y);
    }
    ll ans = g.dfs(0, -1, 1)+g.dfs(0, -1, 0);
    cout<<ans%mod<<endl;
    return 0;
}






Measured memory_bytes: 23764
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int x,a,b;
		x = sc.nextInt();
		a = sc.nextInt();
		b = sc.nextInt();
		
		if(a>=b)
			System.out.println("delicious");
		else if((b-a)>x)
			System.out.println("dangerous");
		else
			System.out.println("safe");
		
	}
}

Measured memory_bytes: 23124
//omg that took waaay me longer that it should

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

ll y,z;
int x,pntr;

bool all9(string ss) {
	for (int aa = 0; aa < ss.length(); aa++) {
		if (ss[aa] != '9') return 0;
	}
	return 1;
}

int listnum(string ans,bool fst,int tarlen) {
	if (ans.length() == tarlen) {
		y++;
		if (y == x) {
			cout << ans << "\n";
			exit(0);
		}
		if (all9(ans)) listnum("",1,tarlen+1);
	} else {
		if (fst == 1) {
			for (int a = 1; a <= 9; a++) {
				string tmp = to_string(a);
				listnum(ans + tmp,0,tarlen);				
			}
		} else {
			int tmp2 = int(ans[ans.length()-1])-48;
			for (int a = max(0,tmp2-1); a <= min(9,tmp2+1); a++) {
				string tmp3 = to_string(a);
				listnum(ans+tmp3,0,tarlen);				
			}
		}
	}
}

int main() {
	scanf("%d",&x);
	listnum("",1,1);
}

Measured memory_bytes: 256