akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    string S;
    cin >>S;
    if(S[0]==S[2]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }


    return 0;
    

}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    string x;cin>>x;
    int a=x[0]-48,b=x[1]-48,c=x[2]-48,d=x[3]-48;
    string op[8]={"+++","++-","+-+","-++","+--","-+-","--+","---"};
    int ans;
    for (auto i: op){
        ans=a;
        if (i[0]=='+')ans+=b;
        else ans-=b;
        if (i[1]=='+')ans+=c;
        else ans-=c;
        if (i[2]=='+')ans+=d;
        else ans-=d;
        if (ans==7){
            cout<<a<<i[0]<<b<<i[1]<<c<<i[2]<<d<<"=7";
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;

int main(void) {
  int n; cin >> n;
  vector<int> u(n-1);
  vector<int> v(n-1);
  vector<int> w(n-1);
  vector< vector<pair<int, int> > > x(n); 
  for(int i=0; i<n-1; i++) {
    cin >> u[i] >> v[i] >> w[i];
    u[i]--; v[i]--;
    w[i] %= 2;
    x[u[i]].push_back({v[i], w[i]});
    x[v[i]].push_back({u[i], w[i]});
  }

  vector<int> a(n, -1);
  a[0] = 0;
  queue<int> q;
  q.push(0);
  while(!q.empty()) {
    int p = q.front();
    q.pop();

    for(int i=0; i<x[p].size(); i++) {
      if(a[x[p][i].first] != -1) continue;

      if(x[p][i].second == 0){
        a[x[p][i].first] = a[p];
      }
      else {
        if(a[p] == 0) a[x[p][i].first] = 1;
        else a[x[p][i].first] = 0;
      }

      q.push(x[p][i].first);
    }
  }

  for(int i=0; i<n; i++) {
    cout << a[i] << endl;
  }

  return 0;
}



// EOF


Measured memory_bytes: 7936
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>

#define CK(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long  LLINF = 1e18;

using namespace std;

int N, M, R;
int r[10];
int load[205][205];
int ans;

void dfs(int state, int visitTown, int cost){
  state |= (1<<visitTown);
  //cout<<"state: "<<state<<", visitTown: "<<visitTown<<", cost: "<<cost<<endl;
  if(state == (1<<R)-1){
    ans = min(ans, cost);
    //cout<<"ans: "<<ans<<endl;
    return;
  }
  REP(i,0,R){
    if((state & (1<<i))) continue;
    int nextState = state | (1<<i);
    int nextTown = i;
    //cout<<"nextTown: "<<nextTown<<endl;
    int nextCost = cost + load[r[visitTown]][r[nextTown]];
    //cout<<cost<<" + "<<load[r[visitTown]][r[nextTown]]<<endl;
    dfs(nextState, nextTown, nextCost);
  }
  return;
}

int main(){
  cin>>N>>M>>R;
  REP(i,0,R) cin>>r[i], r[i]--;

  REP(i,0,N){
    REP(j,0,N){
      load[i][j] = INF;
    }
  }

  REP(i,0,M){
    int a, b, c;
    cin>>a>>b>>c;
    load[a-1][b-1] = c;
    load[b-1][a-1] = c;
  }

  REP(k,0,N){
    REP(i,0,N){
      REP(j,0,N){
        load[i][j] = min(load[i][j], load[i][k] + load[k][j]);
      }
    }
  }

  //test
  // REP(i,0,N){
  //   REP(j,0,N){
  //     cout<<load[i][j]<<" ";
  //   }
  //   cout<<endl;
  // }

  ans = INF;
  REP(i,0,R){
    dfs(0, i, 0);
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
map<string,int>g;
map<string,int>f;
string s;

int F(string s);

int G(string s)
{
	if(g.find(s)!=g.end()) return g[s];
	int &re=g[s];
	if(s.size()==1) return (re=s[0]-'0'+1);
	int i,j,k,res,len=s.size();
	for(i=1;i<len;++i)
	 if(len%i==0){
	 	res=len/i;
	 	string tp;
	 	for(j=0;j<i;++j){
	 		for(k=0;k<res;++k)
	 		 if(s[k*i+j]!='1') break;
	 	    tp+= k>=res? '1':'0';
		}
		re=(1ll*re+F(tp))%mod;
	 }
	return re;
}

int F(string s)
{
	if(f.find(s)!=f.end()) return f[s];
	int &re=f[s];
	int i,len=s.size();
	for(int i=1;i<=len;++i)
		re=(re+1ll*F(s.substr(0,len-i))*G(s.substr(len-i,i))%mod)%mod;
    return re;
}

int main(){
    cin>>s;
    f[""]=1;
    printf("%d",F(s));
}

Measured memory_bytes: 14848
N = int(input())
List = []
for i in range(N):
  List.append(list(map(str, input().split())))
Names = []
Points = []
for i in range(N):
  Names.append(List[i][0])
  Points.append(int(List[i][1]))
slName = set(Names)
NewName = list(slName)
NewName.sort()
Points.sort(reverse = True)
for i in range(len(NewName)):
  for j in range(len(Points)):
    for k in range(N):
      if List[k][0] == NewName[i] and int(List[k][1]) == Points[j]:
        print(k+1)
      else:
        pass

Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define ll long long
#define pp pair<int, int> 
//int 2×10の9乗
 
int main() {
    string s;
    cin >> s;
    int b=0, r=0;
    rep(i, s.size()){
        if(s[i]=='0') r++;
        else b++;
    }
    int ansk=min(b, r);
    int ans=ansk*2;
    cout << ans << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &i : a) cin >> i;
  long long ans = 1000;
  for (int i = 0; i < n - 1; i++) if (a[i] < a[i + 1]) ans += (ans / a[i]) * (a[i + 1] - a[i]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3548
ans = []

while True:
    a = list(input().split())
    if a[0] == "#":
        break
    a[1], a[2], a[3] = int(a[1]), int(a[2]), int(a[3])
    if a[1] > 31:
        ans.append(["?", a[1] - 30, a[2], a[3]])
    
    elif a[1] == 31:    
        if a[2] >= 5:
            ans.append(["?", 1, a[2], a[3]])
        else:
            ans.append([a[0], a[1], a[2], a[3]])

    else:
        ans.append([a[0], a[1], a[2], a[3]])


for i in ans:
    print("{} {} {} {}".format(i[0], i[1], i[2], i[3]))



Measured memory_bytes: 5616
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	int N;
	int cnt=0;
	cin>>N;
	vector<int>a(N);

	for(auto& e:a)cin>>e;

	while(1) {
		for(int i=0; i<N;++i) {
			if(a[i]%2==0) {
				a[i]/=2;
				++cnt;
				break;
			}
			else if(i==N-1) {
				cout<<cnt<<endl;
				return 0;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read()
{
	int out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		fh=-1,jp=getchar();
	while (jp>='0'&&jp<='9')
		out=out*10+jp-'0',jp=getchar();
	return out*fh;
}
const int MAXN=1e5+10;
int n,A[MAXN],a[MAXN];
#define lowbit(x) x&(-x)
int bit[MAXN];
void add(int x,int c)
{
	for(;x<=n;x+=lowbit(x))
		bit[x]=max(bit[x],c);
}
int sum(int x)
{
	int s=0;
	for(;x;x-=lowbit(x))
		s=max(s,bit[x]);
	return s;
}
int main()
{
	n=read();
	for(int i=1;i<=n;++i)
		A[i]=a[i]=read();
	sort(A+1,A+1+n);
	int m=unique(A+1,A+1+n)-A-1;
	for(int i=1;i<=n;++i)
	{
		int x=lower_bound(A+1,A+1+m,a[i])-A;
		x=m+1-x;
		int y=sum(x)+1;
		add(x,y);
	}
	cout<<sum(n)<<endl;
	return 0;
}


Measured memory_bytes: 1408
mod = 1000000007
l = input().split()
m = int(l[0])
n = int(l[1])


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y/2)**2 % mod
    else:
        return power(x, int(y/2))**2 * x % mod


ans = power(m, n)
print(ans)



Measured memory_bytes: 5608
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(20);
}

#define int ll
void solve() {
	while (true) {
		int n, m, query;
		cin >> n >> m >> query;
		if (n == 0) return;
		ll dp[1000];
		REP(i, m) {
			dp[i] = (1LL << (n + 1LL)) - 1LL;
		}
		int back = 0;
		REP(i, query) {
			string a, b;
			cin >> a >> b;
			int geko = 0;
			for (int q = 0; q < a.length(); ++q) {
				geko += (1LL << q) * (long long)(a[q] - '0');
			}
			geko ^= back;
			back = geko;
			REP(i, b.length()) {
				if (b[i] == '0') {
					ll nya = (geko & dp[i]);
					dp[i] -= nya;
				}
				else {
					dp[i] &= geko;
				}
			}
		}
		REP(i, m) {
			vector<int> cnter;
			REP(q, n) {
				if ((1LL << q) & dp[i]) {
					cnter.push_back(q);
				}
			}
			if (cnter.size() == 1) {
				if (cnter[0] <= 9) {
					cout << cnter[0];
				}
				else {
					cout << (char)(cnter[0] - 10 + 'A');
				}
			}
			else {
				cout << "?";
			}
		}
		cout << endl;
	}
}

#undef int
int main() {
	init();
	solve();
}


Measured memory_bytes: 3052
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,a,b;
    cin>>k;
    cin>>a>>b;
    if(a%k==0 || a+(k-(a%k))<=b)
    {
        cout<<"OK"<<endl;
    } 
    else
    {
        
        cout<<"NG"<<endl;
    }
    

    
    return 0;
}

Measured memory_bytes: 3636
#!/usr/bin/env python3

S = input()
T = input()

if len(T) > len(S):
    print("UNRESTORABLE")
    exit()

ans = []

for i in range(len(S) - len(T) + 1):
    idx = []
    for m, j in enumerate(range(i, i + len(T))):
        idx.append(j)
        if S[j] != "?" and S[j] != T[m]:
            break
    else:
        idx = set(idx)
        tmp = [s for s in S]
        now = 0
        for k in range(len(S)):
            if tmp[k] == "?":
                if k not in idx:
                    tmp[k] = "a"
                else:
                    tmp[k] = T[now]
                    now += 1
            else:
                if k in idx:
                    now += 1
        ans.append("".join(tmp))

if len(ans) > 0:
    print(min(ans))
else:
    print("UNRESTORABLE")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
const int maxn = 200200;
const int mod = 998244353;
typedef long long ll;
inline ll pow(ll a,int b,ll ans = 1) {
	for(;b;b >>= 1,a = a * a % mod) if(b & 1) ans = ans * a % mod;
	return ans;
}
inline ll inverse(int x){ return pow(x, mod - 2); }
inline void reduce(int & x){ x += x >> 31 & mod; }
#define rep(i, l, r) for(int i = (l), i##end = (r);i <= i##end;++i)
int t, a, b, c, d;
int main() {
	std::ios::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> t;
	for(;t--;) {
		std::cin >> a >> b >> c >> d;
		int l = -1,r = a + b,k = (std::max(a, b) - 1) / (std::min(a, b) + 1) + 1;
		for(;l + 1 != r;){
			int mid = l + r >> 1;
			if(b - mid / (k + 1) <= (ll) (a - mid / (k + 1) * k - mid % (k + 1)) * k) l = mid;
			else r = mid;
		}
		l=r;
		r = l + (b - l / (k + 1)) - ((a - l / (k + 1) * k - l % (k + 1)) * k) + 1;
		for(int i = c;i <= std::min(d, l);++i) std::cout.put(i % (k + 1) ? 'A' : 'B');
		for(int i = std::max(c, l + 1);i <= d;++i) std::cout.put((i - r) % (k + 1) ? 'B' : 'A');
		std::cout.put(10);
	}
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define INF 1e9+7
typedef long long int ll;
const int maxn = 200000;
ll mod = INF;


int main(){

    ll n;
    ll f[maxn];
    ll ans=0;

    cin >> n;
    for(int i=0;i<n;i++)cin >> f[i];

    sort(f,f+n);

    ll cnt=1;

    for(int i=n-1;i>=0;i--){
        if(i==n-1){
            ans+=f[i];cnt++;
        }else if(cnt<=n-2){
            ans+=2*f[i];cnt+=2;
        }else if(cnt==n-1){
            ans+=f[i];cnt++;
        }
        if(cnt==n)break;
    }

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

Measured memory_bytes: 5188
#include<stdio.h>
int main(void)
{
	int n,m,a[1000],b[1000],cnt[1001],i,j;
	scanf("%d",&n);
	scanf("%d",&m);
	for(i=0;i<m;i++)	scanf("%d",&a[i]);
	for(i=1;i<=n;i++)	cnt[i]=0;
	for(i=0;i<m;i++){
		for(j=1;j<=n;j++){
			scanf("%d",&b[j]);
			if(a[i]==b[j])	cnt[j]+=1;
			else	cnt[a[i]]+=1;
		}
	}
	for(i=1;i<=n;i++)	printf("%d\n",cnt[i]);
	return 0;
}



Measured memory_bytes: 2148
use std::cmp::{min, max};

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let n = read::<i32>();
    let r0 = read::<i32>();
    let r1 = read::<i32>();
    let mut m = min(r0, r1);
    let mut ans = r1 - r0;

    for _ in 2..n {
        let r = read::<i32>();
        ans = max(ans, r - m);
        m = min(m, r);
    }

    println!("{}", ans);
}


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



int main() 
{
  ll S,K; cin>>K>>S;
  ll ans=0;
  rep(i,K+1)
  {
    rep(j,K+1)
    {
      ll X=i,Y=j;
      if(S-K<=X+Y&&X+Y<=S)
      {
        ans++;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		boolean find = false;
		for(int i = a; i <= b; i++) {
			if(i % k == 0) {
				System.out.println("OK");
				find = true;
				break;
			}
		}
		if(!find)
			System.out.println("NG");
    }
}

Measured memory_bytes: 35776
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
	int n, m, a, b;
	cin >> n >> m;
	vector<int> h(n);
	for (int i = 0; i < n; ++i) cin >> h[i];
	vector<vector<int>> v(n, vector<int>(0));
	for (int i = 0; i < m; ++i) {
		cin >> a >> b;
		--a, --b;
		v[a].emplace_back(b);
		v[b].emplace_back(a);
	}
	int cnt = 0;
	for (int i = 0; i < n; ++i) {
		bool good = true;
		for (int j = 0; j < v[i].size(); ++j) {
			if (h[i] <= h[v[i][j]]) {
				good = false;
				break;
			}
		}
		if (good) ++cnt;
	}
	cout << cnt;
	return 0;
}

Measured memory_bytes: 8728
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define pb push_back
#define f first
#define s second
#define mp make_pair
#define SZ(x) ((int)(x.size()))
#define FOI(i, a, n) for(int i = int(a); i <= int(n); i++)
#define FOD(i, a, n) for(int i = int(a); i >= int(n); i--)
#define IN(x, y) ((y).find(x) != (y).end())
#define ALL(t) t.begin(),t.end()
#define MSET(tabl,i) memset(tabl, i, sizeof(tabl))
#define PSET(x,y) fixed<<setprecision(y)<<lf(x)
#define DBG(c) cout << #c << " = " << c << endl;
#define Rtime1 ((double)clock()/(double)CLOCKS_PER_SEC)
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


typedef long long ll;
typedef long double lf;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < int > vi;
typedef vector<vi> vvi;
typedef complex<double> base;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const int N = 3e5 + 5;
const int lgN = 1e6+5;
const ll MOD = 1e9+7;
const ll MOD2 = 1299709;
const ll MOD3 = 1e9 + 9;
const lf pi = 3.141592653589793238462643383;
const ll IMAX = 4e18 + 5; 
const double PI = 3.141592653589793;


template<class T>
using max_pq = priority_queue<T>;
template<class T>
using min_pq = priority_queue<T,vector<T>,greater<T>>; 
template<class T>
using OST = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll x,y;
template<class T> T gcd(T a,T b){ if(a==0) {x=0,y=1; return b;}T gc=gcd(b%a,a);T temp;temp=x;x=y-(b/a)*temp;y=temp;return gc;}

//(a^x)%m   
ll po(ll a, ll x,ll m){ if(x==0){return 1;}ll ans=1;ll k=1;  while(k<=x) {if(x&k){ans=((ans*a)%m);} k<<=1; a*=a; a%=m; }return ans; } 

int dp[N][3];
int a[N][3];

int main(){
    sync
    int n;
    cin>>n;
    FOI(j,1,n)
    FOI(i,0,2)
    cin>>a[j][i];

    FOI(i,1,n){
        FOI(j,0,2){
            int ma = 0;
            FOI(k,0,2){
                if(k!=j)
                    ma = max(dp[i-1][k], ma);
            }
            dp[i][j] = ma + a[i][j];
        }
    }
    int ans = 0;
    FOI(i,0,2)
        ans = max(ans, dp[n][i]);
    cout<<ans<<endl;
}


Measured memory_bytes: 5632
h,w=map(int,input().split())
n=int(input())
a=list(map(int,input().split()))
c=[]
for i in range(n):
    for _ in range(a[i]):
        c.append(i+1)
#print(c)

z=0
for i in range(h):
    l=c[i*w:i*w+w]
    if z==0:
        print(" ".join(map(str,l)))
        z=1
    elif z==1:
        print(" ".join(map(str,l[::-1])))
        z=0
    
    


Measured memory_bytes: 3572
n = int(input())
C = list(map(int, input().split()))
q = int(input())

data = []
for _ in range(q):
    t, x, d = map(int, input().split())
    data.append([t, x, d])

apple = [0] * n
for D in data:
    t, x, d = D
    if t == 1:
        apple[x-1] += d
        if apple[x-1] > C[x-1]:
            print(x)
            break
    else:
        apple[x-1] -= d
        if apple[x-1] < 0:
            print(x)
            break
else:
    print(0)


Measured memory_bytes: 20836
#include <bits/stdc++.h>
#define fr(a, b, c) for(int a = b, __ = c; a < __; ++a)
#define dbg(x) cerr << ">>>> " << x << endl;
#define _ << " , " << 

using namespace std;

int main(){
	// ios::sync_with_stdio(0);
	char str[111];
	scanf("AtCoder %s Contest", str);
	printf("A%cC\n", str[0]);
	return 0;
}

Measured memory_bytes: 764
#ABC175  B
import itertools
n = int(input())
l = list(map(int, input().split()))
if len(l) <= 2:
  print(0)
else:
  count = 0
  for i in itertools.combinations(l, 3):
    if i[0] != i[1] and i[1] != i[2] and i[2] != i[0]:
      if i[0] > abs(i[1]-i[2]) and i[0] < i[1] + i[2]:
        count += 1
  print(count)

Measured memory_bytes: 9196
import sys
input = sys.stdin.readline

def main():
  h, w = map(int, input().split())
  A = [list(map(int, input().split())) for _ in range(h)]
  B = [list(map(int, input().split())) for _ in range(h)]
  M = 80*(h+w)
  dp = [[0]*w for i in range(h)]
  d = abs(A[0][0] - B[0][0])
  mask = (1 << (2*M)) - 1
  dp[0][0] |= 1 << (M-d)
  dp[0][0] |= 1 << (M+d)
  for i in range(h):
    for j in range(w):
      d = abs(A[i][j] - B[i][j])
      if i:
        dp[i][j] |= (dp[i-1][j] << d) & mask
        dp[i][j] |= dp[i-1][j] >> d
      if j:
        dp[i][j] |= (dp[i][j-1] << d) & mask
        dp[i][j] |= dp[i][j-1] >> d
  t = dp[-1][-1] >> M
  ans = (t & (-t)).bit_length() - 1
  print(ans)
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 20596
import sys
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int():
    return int(input())

def map_int_input():
    return map(int, input())

MII = map_int_input

def MII_split():
    return map(int, input().split())

def MII_to_index():
    return map(to_index, input())

def MII_split_to_index():
    return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs():
    return list(map(int, input()))

LII = list_int_inputs

def LII_split():
    return list(map(int, input().split()))

# 2次元リスト化
def LII_2D(rows_number):
    return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number):
    return [LII_split() for _ in range(rows_number)]

N = input_int()
count = 0
for i in range(1, N + 1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        count += i
print(count)

Measured memory_bytes: 9104
class RollingHash():
    def __init__(self, s):
        self.length = len(s)
        self.base1 = 1009
        self.base2 = 1013
        self.mod1 = 10**9 + 7
        self.mod2 = 10**9 + 9
        self.hash1 = [0] * (self.length + 1)
        self.hash2 = [0] * (self.length + 1)
        self.pow1 = [1] * (self.length + 1)
        self.pow2 = [1] * (self.length + 1)

        for i in range(self.length):
            self.hash1[i+1] = (self.hash1[i] + ord(s[i])) * self.base1 % self.mod1
            self.hash2[i+1] = (self.hash2[i] + ord(s[i])) * self.base2 % self.mod2
            self.pow1[i+1] = self.pow1[i] * self.base1 % self.mod1
            self.pow2[i+1] = self.pow2[i] * self.base2 % self.mod2
        
    def get(self, l, r):
        t1 = ((self.hash1[r] - self.hash1[l] * self.pow1[r-l]) % self.mod1 + self.mod1) % self.mod1
        t2 = ((self.hash2[r] - self.hash2[l] * self.pow2[r-l]) % self.mod2 + self.mod2) % self.mod2
        return (t1, t2)

t_tmp = input().rstrip()
s = input().rstrip()

# Same character goes to infinity
if t_tmp.count(t_tmp[0]) == len(t_tmp) and s.count(s[0]) == len(s) and s[0] == t_tmp[0]:
    print(-1)
    exit()

t = ""
while len(t) <= len(s):
    t += t_tmp
max_ans = (len(t) * 2) // len(s)
t = t * 3
lent = len(t)
lens = len(s)

RHt = RollingHash(t)
RHs = RollingHash(s)
s_hash = RHs.get(0, lens)

match = [0] * (lent - lens + 1)
for i in range(lent - lens + 1):
    if RHt.get(i, i+lens) == s_hash:
        match[i] = 1
ans = max(match[:lens])
for i in range(len(match) - lens):
    if match[i+lens] != 0:
        match[i+lens] += match[i]
        ans = max(ans, match[i+lens])

if ans > max_ans:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 188400
// Mon Sep 14 19:59:49 IST 2020  


#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)       for(int64 ii = (int64)a ; ii < (int64)b  ; ii++ )
#define scan(any)          for(auto &i:any) cin>>i;
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long   
#define all(x)             (x).begin(),(x).end() 
#define ff                 first
#define ss                 second
#define pppp               pair <int,int> 
#define flushOff           fflush(stdout) 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
using namespace std ;    
// policy based   
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
 
const int MOD1 = 1e9+7;
const int MOD2 = 1e9+9;
const double pi = 3.141592653589793238;
const int INF = 2e9+7;
const int64 big = INT64_MAX;

const int N = 2e5+7;
struct compare{
    bool operator()(pair <int,int> A, pair <int,int> B){
        if(A.first == B.first)
            return A.second > B.second;
        return A.first > B.first;
    }
}; 
void print(vector <int>v){
    for(int t : v) 
        cout << t << ' ';
    cout << '\n';
    return;
}
void printSet(multiset <int>v){
    cout << "===\n";
    for(int t : v) 
        cout << t << ' ';
    cout << '\n';
    return;
}
int64 bigPower(int64 num, int64 n){
	int64 product = 1LL;
    forn(i,0,n)
      product = (product*num)%MOD1;
    return product;
}
int tests(){ 
    int64 n;
    cin >> n;
    int64 everyone = bigPower(10, n);
    everyone = everyone -2*bigPower(9,n)+MOD1+MOD1;
    everyone %= MOD1;
    everyone += bigPower(8,n);
    everyone += MOD1;
    everyone %= MOD1;
    cout << everyone << '\n' ;
    return 0;
}    
int main(){
    I__O ;      
    int cases = 1 ;  
    // cin >> cases ;
    while(cases--)
        tests(); 
    return 0 ; 
}
 


Measured memory_bytes: 3624
#include <iostream>
#include <cmath>

using namespace std;

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

    bool ans;
    if (abs(a - c) <= d) ans = true;
    else if (abs(a-b) <= d && abs(b-c) <= d) ans = true;
    else ans = false;

    cout << (ans? "Yes":"No") << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
static const int giga = pow(10,9);

int main(void){
  char a,b;
  cin >> a >> b;
  int c,d;
  if(a == 'H'){
    c = 0;
  } else {
    c = 1;
  }
  if(b == 'H'){
    d = 0;
  } else {
    d = 1;
  }
  if((c+d)%2 == 0){
    cout << "H" << endl;
  } else {
    cout << "D" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
require 'set'
Move = [ [2],
         [2, 5], [0, 1, 3, 6], [2, 7],
         [5], [1, 4, 6, 9], [2, 5, 7, 10], [3, 6, 8, 11], [7],
         [5, 10], [6, 9, 11, 12], [7, 10],
         [10] ]
R = [0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4]
C = [2, 1, 2, 3, 0, 1, 2, 3, 4, 1, 2, 3, 2]

while n = gets.to_i
  break if n == -1
  brd = [n, 4.times.map{ gets.split.map(&:to_i) } ].flatten
  q = [[brd, 0]]
  ans = -1
  set = SortedSet.new([])
  set.add(brd)
  until q.empty?
    b, d = q.shift
    if (1..11).all?{ |v| b[v] == v }
      ans = d
      break
    end
    x = d
    13.times do |i|
      if b[i] > 0
        [R, C].each do |a|
          x += (a[i] - a[b[i]]).abs
        end
      end
    end
    unless x > 20
      13.times do |i|
        if b[i] == 0
          Move[i].each do |m|
            b[i], b[m] = b[m], b[i]
            unless set.include?(b)
              set.add(nb = b.dup)
              q << [nb, d + 1]
            end
            b[i], b[m] = b[m], b[i]
          end
        end
      end
    end
  end
  puts ans == -1 ? 'NA' : ans
end

Measured memory_bytes: 12640
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <map>
#include <set>
using namespace std;

typedef pair<int, string> State; 

bool allZero(const string &s) {
  for(int i = 0; i < s.size(); ++i) {
    if(s[i] != 0) return false;
  }
  return true;
}

string change(string str, int s, int e, char a) {
  for(int i = s; i < e; ++i) str[i] = (10+str[i]-a)%10;
  return str;
}

int solve(string start) {
  State s(0, start);
  queue<State> que;
  set<string> vis;
  que.push(s);
  vis.insert(s.second);
  while(!que.empty()) {
    s = que.front(); que.pop();
    /*
    for(int i = 0; i < s.second.size(); ++i) cout << (int)s.second[i];
    cout << endl;
    */
    string &str = s.second;
    if(allZero(s.second)) return s.first;
    int l;
    for(l = 0; l < str.size() && str[l] == 0; ++l);
    for(int i = l; i < str.size(); ++i) {
      State t(s.first+1, change(str, l, i+1, str[l]));
      if(vis.find(t.second) != vis.end()) continue;
      vis.insert(t.second);
      que.push(t);
    }
  }
  return -1;
}

int main() {
  int N;
  while(cin >> N && N) {
    string s, t;
    cin >> s >> t;
    for(int i = 0; i < s.size(); ++i) {
      s[i] = (10 + t[i] - s[i]) % 10;
    }
    cout << solve(s) << endl;
  }
}

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


int main(){
    int H, W;
    int count;

    cin >> H;
    cin >> W;

    char S[H][W];

    rep(i, H)
    {
        cin >> S[i];
    }

    rep(i, H)
    {
        rep(j, W){
            if (S[i][j] == '.'){
                count = 0;
                for (int k = -1; k < 2; k++)
                {
                    if((i + k >= 0) && (i + k <= H - 1)){
                        for (int l = -1; l < 2; l++)
                        {
                            if((j + l >= 0) && (j + l <= W - 1)){
                                if((k == 0) && (l == 0)){
                                }else{
                                    // cout << i + k;
                                    if (S[i + k][j + l] == '#') count++;
                                }
                            }
                        }
                    }
                }

                cout << count;
            }else{
                cout << '#';
            }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3568
import math

N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())


def dist(x1, y1, x2, y2):
    d = math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
    return d


route = 0
for i in range(N):
    for j in range(i + 1, N):
        route+=dist(x[i], y[i], x[j], y[j])
ave = (route * (2 * math.factorial(N - 1))) / math.factorial(N)
print(ave)


Measured memory_bytes: 3188
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($format:expr) => (write!(out,$format).unwrap());
        ($format:expr, $($args:expr),+) => (write!(out,$format,$($args),*).unwrap())
    }
    input!{
        n: usize,
        k: usize,
        q: usize,
        a: [i64; n],
    }
    let mut coord = a.clone();
    coord.sort();
    coord.dedup();
    let mut mi: i64 = 1 << 40;
    for y in coord {
        let mut pool = Vec::new();
        let mut cur = Vec::new();
        for i in 0 .. n {
            if a[i] >= y {
                cur.push(a[i]);
            } else {
                pool.push(cur);
                cur = Vec::new();
            }
        }
        pool.push(cur);
        let mut picked = Vec::new();
        for mut v in pool {
            v.sort();
            if v.len() >= k {
                let l = v.len();
                picked.append(&mut v[..l - k + 1].to_vec());
            }
        }
        picked.sort();
        if picked.len() >= q {
            mi = min(mi, picked[q - 1] - y);
        }
    }
    puts!("{}\n", mi);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
using System;

namespace ConsoleApplication11
{
    class Program
    {
        static void Main(string[] args)
        {
            string [] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int x = n / 3600;
            int y = n % 3600 / 60;
            int z =n%3600%60;
            Console.WriteLine(x + ":" + y + ":" + z);
          
        }
    }
}

Measured memory_bytes: 9260
#include<bits/stdc++.h>
using namespace std;
struct R
{
    int x,y;
}a[100005];
bool cmp(R lhs,R rhs)
{
    return lhs.x<rhs.x;
}
int  main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;++i)
    {
        cin>>a[i].x;
        a[i].y=i+1;
    }
    sort(a,a+n,cmp);
    for(int i=0;i<n;++i)cout<<a[i].y<<' ';
    return 0;
}


Measured memory_bytes: 1536
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
typedef long long ll;

using namespace std;


int main() {
	ll n; cin >> n;
	vector<ll> h(n);
	ll ma = 0;
	ll mi = 0;
	rep(i, n) {
		cin >> h[i];
		ma = max(ma, h[i]);
	}
	ll ans = 0;
	while (ma > 0) {
		ma -= 1;
		ll num0 = 0;
		rep(i, n - 1) {
			if (h[i] == 0 && h[i + 1] != 0) {
				num0 += 1;
			}
		}
		if (h[0] == 0) num0 -= 1;
		ans += num0+1;
		rep(i, n) {
			if (h[i] > 0)h[i] -= 1;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int n,a[100];
	float s[100],g=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		s[i]=1.0/a[i];
		g+=s[i];	
	}
	cout<<1/g<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=105;
int n;
int f[N];
signed main(){
    scanf("%lld",&n);
    f[0]=2;f[1]=1;
    for(int i=2;i<=n;i++) f[i]=f[i-1]+f[i-2];
    printf("%lld\n",f[n]);
    exit(0);
}

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


struct team{

	  int  id, c, p;
	  vector<int> w;
	  team(int i, int correct, int pena, int num_pro){
			id = i; c = correct; p = pena; w = vector<int>(num_pro+1,0);
	  }
	  bool operator < (const team& tgt) const {
			if(c != tgt.c) return c < tgt.c;
			if(p != tgt.p) return p > tgt.p;
			return id > tgt.id;
	  }
	  bool operator > (const team& tgt) const {
			if(c != tgt.c) return c > tgt.c;
			if(p != tgt.p) return p > tgt.p;
			return id > tgt.id;
	  }

};

int main(){
	  
	  while(1){
			int t,p,r; cin >> t >> p >> r;
			if(!t) break;

			vector<team> teams;
			teams.push_back( team(10000,-1,1000000,10) );
			for(int i=1; i<=t; i++)
				  teams.push_back( team(i,0,0,p) );
			
			for(int i=0; i<r; i++){
				  int tid,pid,time;
				  string m;
				  cin >> tid >> pid >> time >> m;

				  if(m == "CORRECT"){
						teams[tid].c ++;
						teams[tid].p += teams[tid].w[pid] * 1200 + time;
				  }
				  else{
						teams[tid].w[pid]++;
				  }
			}
			sort(teams.begin(),teams.end());
			reverse(teams.begin(),teams.end());
			for(int i=0; i<t; i++)
				  cout << teams[i].id << " " << teams[i].c << " " << teams[i].p << endl;
				  
	  }
	  
}

Measured memory_bytes: 1256
#include <stdio.h>
#include <string.h>
int main(void){
  char str[20],i,j,tmp;
  scanf("%s",str);
  i=0;
  j=strlen(str)-1;
  while(i<j){
    tmp=str[i];
    str[i]=str[j];
    str[j]=tmp;
    i++;
    j--;
  }
  printf("%s\n",str);
  return(0);
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back 
const int  mod=1e9+7;

int main(){
      ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0);
       int n,m;
         cin>>n>>m;
         char  grid[n][m];
         for(int i=0; i<n; i++){
         for(int j=0; j<m ;j++){
           cin>>grid[i][j];
          }
          }
           
       int dp[n][m];
        
         for(int i=0; i<n; i++){
	     for(int j=0; j<m; j++){
		       if(i==0&&j==0)
		         dp[i][j]=1;
		       else if(i==0)
		         {   if(grid[i][j]=='#')
					    dp[i][j]=0;
					  else
					    dp[i][j]=dp[i][j-1];  
				 }  
			   else if(j==0){
			        if(grid[i][j]=='#')
					    dp[i][j]=0;
					  else
					    dp[i][j]=dp[i-1][j];  
			   } 
			   else{
			     if(grid[i][j]=='#')
					    dp[i][j]=0;
				 else{
				    dp[i][j]=((dp[i-1][j])%mod + (dp[i][j-1])%mod)%mod;
				 }	
			   }
		    }
		  }
		  cout<<dp[n-1][m-1]<<endl;
		  
           
    }

Measured memory_bytes: 5120
def main():
    n = int(input())
    ans = 0
    for i in range(1,10):
        for j in range(1,10):
            if n == i * j:
                ans = 1
                return ans
                break
        else:
            continue
        return ans
        break

if __name__ == "__main__":
    ans = main()
    if ans == 1:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3060
N,X=map(int,input().split())
D=N
L=N-X
S=X
if N==2*X:
    D=3*X
else:
    for i in range(100):
        
        if L%S==0:
            D=D+(2*S)*(L//S)-S
            break
        else:
            D=D+(2*S)*(L//S)
            A=L
            B=S
            L=B
            S=A%B
            #print(D)
print(D)

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

int main(void)
{
  string s;
  cin >> s;
  int lose = 0;
  for (string::iterator i = s.begin(); i != s.end(); ++i) {
    if (*i == 'x') ++lose;
  }
  if (lose <= 7)
    cout << "YES";
  else
    cout << "NO";

  return 0;
}


Measured memory_bytes: 760
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <ctype.h>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string n;
    cin >> n;
    if(n[0] == '9' || n[1] == '9'){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private static int solve(int s) {
        boolean[] appeared = new boolean[1000000];
        int n = 1;

        while (!appeared[s]) {
            appeared[s] = true;
            n += 1;

            if (s % 2 == 0) {
                s = s / 2;
            } else {
                s = 3 * s + 1;
            }
        }

        return n;
    }

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

        int s = sc.nextInt();
        int ans = solve(s);

        System.out.println(ans);
    }
}


Measured memory_bytes: 25812
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;
int sz[10001];
int n, q;
int P[10001];
int s;
int x, y;
int root(int a)
{
	if(P[a]==a)
	{
		return a;
	}
	else
	{
		return (P[a]=root(P[a]));
	}
}
bool is_the_same_set(int a, int b)
{
	return (root(a)==root(b));
}
void unite(int a, int b)
{
	if(sz[root(a)]<sz[root(b)])
	{
		swap(a, b);
	}
	sz[root(a)]+=sz[root(b)];
	P[root(b)]=root(a);
}
int main()
{
	cin >> n >> q;
	repp(i, 1, n+1)
	{
		P[i]=i;
		sz[i]=1;
	}
	rep(i, q)
	{
		cin >> s >> x >> y;
		if(s==0)
		{
			unite(x, y);
		}
		else
		{
			if(is_the_same_set(x, y))
			{
				cout << 1 << endl;
			}
			else
			{
				cout << 0 << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3188
#include<cstdio>

int main()
{
	int i,n,a,c[10];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&c[i]);
	for(i=0;i<n;i++)
	{
		printf("Case %d:\n",i+1);
		for(a=0;a<10;a++)
			printf("%d\n",c[i]=(c[i]*c[i])/100%10000);
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int x,y,z,k;
  cin>>x>>y>>z>>k;
  vector<long long>a(x),b(y),c(z),ab,ans;
  for(int i=0;i<x;i++)cin>>a[i];
  for(int i=0;i<y;i++)cin>>b[i];
  for(int i=0;i<z;i++)cin>>c[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  for(int i=0;i<x;i++)for(int j=0;j<y;j++)ab.push_back(a[i]+b[j]);
  sort(ab.begin(),ab.end());
  reverse(ab.begin(),ab.end());
  for(int i=0;i<min(3000,x*y);i++)for(int j=0;j<z;j++)ans.push_back(ab[i]+c[j]);
  sort(ans.begin(),ans.end());
  for(int i=0;i<k;i++)cout<<ans[ans.size()-1-i]<<endl;
  return 0;
}


Measured memory_bytes: 43368
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> D(K);
    rep(i, K) cin >> D[i];
    
    int cnt = N;
    while (true) {
        vector<int> digits(5);
        int keta = 0;
        int copy = cnt;
        while (copy > 0) {
            digits[keta] = copy % 10;
            copy /= 10;
            ++keta;
        }
        
        bool judge = true;
        rep(i, keta) {
            if (count(D.begin(), D.end(), digits[i])) judge = false;
        }
        if (judge) {
            cout << cnt << endl;
            break;
        }
        ++cnt;
    }
    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        N: u8,
        A: [u8 ;N-1],
        B: [u8 ;N-1],
    }
    match N {
        1 => println!("Hello World"),
        2 => println!("{}", A[0] + B[0]),
        _ => (),
    }
}


Measured memory_bytes: 4352
#!/usr/bin/env python3
import sys
from collections import deque


def solve(S, Q, query):

    state = 1 # forward
    head = deque([])
    tail = deque([])

    for qq in query:
        if qq[0] == "1":
            state *= -1
        else:
            if qq[1] == "1":
                is_head = (state==1)
            elif qq[1] == "2":
                is_head = (state==-1)
            
            if is_head:
                head.append(qq[2])
            else:
                tail.append(qq[2])
    
    head = "".join([head.pop() for _ in range(len(head))])
    tail = "".join([tail.popleft() for _ in range(len(tail))])

    print((head + S + tail)[::state])

    
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            # for word in line.split():
            yield line
    tokens = iterate_tokens()
    S = str(next(tokens)).replace('\n', '')  # type: str
    Q = str(next(tokens)).replace('\n', '')  # type: str
    query = []
    for x in tokens:
        sp = x.split()
        # print(sp)
        if sp[0] == "1": query.append(sp[0])
        else :
            query.append((sp[0], sp[1], sp[2]))
    # print(query)

    solve(S, Q, query)

if __name__ == '__main__':
    main()


Measured memory_bytes: 22448
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

n = int(input())

s = []
t = []
for i in range(n):
    ss,tt = [i for i in readline().split()]
    s.append(ss)
    t.append(int(tt))
#b = tuple(int(i) for i in readline().split())
x = input()

from itertools import accumulate
t = list(accumulate(t))

i = s.index(x)

print(t[-1]-t[i])





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

using namespace std;
using ll =long long;
using db = double;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(v) SORT(v);(v).erase(unique((v).begin(),(v).end()),(v).end())
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
const int mod = 1e9 + 7;

ll ans;
//ここから書き始める
int main()
{
	cout << setprecision(10);
	string A, B, C;
	cin >> A >> B >> C;
	int ac=0,bc=0,cc=0;
	char c = A[ac];
	ac =1;
	while(1){
		if(c=='a'){
			c=A[ac];
			ac ++ ;
			//che(ac,"ac");
			if(ac>A.size()){
				cout<<'A'<<endl;
				return 0;
			}
		}else if(c=='b'){
			c=B[bc];
			bc++;
			//che(bc,"bc");
			if(bc>B.size()){
				cout << 'B'<<endl;
				return 0;
			}
		}else{
			c=C[cc];
			cc++;
			//che(cc,"cc");
			if(cc>C.size()){
				cout <<'C'<<endl;
				return 0;
			}
		}
	}



}
	


Measured memory_bytes: 256
n, m, x, y = map(int, input().split())
ls_x = list(map(int, input().split()))
ls_y = list(map(int, input().split()))

for z in range(-100, 101):
    if (x < z) and (z <= y) and (max(ls_x) < z) and (z <= min(ls_y)):
        print("No War")
        break
    elif z == 100:
        print("War")

Measured memory_bytes: 3060