akhauriyash/Code-Regression huggingface dataset:
line = input()
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
letters = []
for i in range(len(line)):
  letters.append(line[i])
setted = sorted(set(letters))
for j in alpha[:]:
  for k in setted:
    if j == k:
      alpha.remove(j)
if len(alpha) == 0:
  print("None")
else:
  answer = alpha[0]
  print(answer)


Measured memory_bytes: 4016
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	ll a, b, c, d; cin >> a >> b >> c >> d;
	ll ans = max(a * c, max(a * d, b * c));
	cout << max(ans, b * d) << endl;
}

Measured memory_bytes: 3632
<?php
fscanf(STDIN, "%s", $S);
$len = strlen($S);
$ans = "NO";
$target = "keyence";
for ($i = 0; $i <= 7; $i++) {
    $x = substr($S, 0, $i) . substr($S, $len - (7 - $i));
    if ($x === $target) {
        $ans = "YES";
    }
}
echo $ans;


Measured memory_bytes: 4728
const int N = 400005;
const int LG = 21;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <bitset>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(N);
    __ufact.resize(N);
    __rev.resize(N);
    __rev[1] = 1;
    for (int i = 2; i < N; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < N; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

ll n, m, q;
ll a[N], b[N], c[N], d[N];
ll ans, res;
vector<int> ids[N];
int A[N];

void check()
{
    ans = max(ans, res);
}

void rec(int pos, int fr)
{
    if (pos == n + 1)
    {
        check();
        return;
    }
    for (int i = fr; i <= m; i++)
    {
        for (auto id : ids[pos]) if (i - A[a[id]] == c[id]) res += d[id];
        A[pos] = i;
        rec(pos + 1, i);
        for (auto id : ids[pos]) if (i - A[a[id]] == c[id]) res -= d[id];
    }
}

signed main()
{
    srand(time(NULL));
    #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // ONLINE_JUDGE
    cin >> n >> m >> q;
    for (int i = 0; i < q; i++) cin >> a[i] >> b[i] >> c[i] >> d[i], ids[b[i]].push_back(i);
    rec(1, 1);
    cout << ans;
}

/* Note:
Check constants at the beginning of the code.
N is set to 4e5 but be careful in problems with large constant factor.
Check corner cases.
No def int long long for now.
*/


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

int n;

vector<int> v;

long long int ans=0;

set<int> mp;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int a;
		scanf("%d",&a);
		v.push_back(a);
		ans^=a;
		mp.insert(a);
	}
	//cout<<ans<<endl;
	int turn=0;
	int ans2=0;
	for(int i=31;i>=0;i--){
		//cout<<i<<" "<<(ans>>i)<<endl;
		int used=-1;
		if((turn^(ans>>i))&1){
			//cout<<"!! "<<i<<endl;
			if(mp.count(1<<i)==0){
				puts("-1");
				return 0;
			}
			ans2++;
			turn^=true;
			used=(1<<i);
		}
		mp.clear();
		int z=(1<<i)-1;
		vector<int> nex;
		for(auto el:v){
			if(used!=el){
				nex.push_back(el&z);
				mp.insert(el&z);
				continue;
			}
			used=-1;
		}
		v=nex;
	}
	cout<<ans2<<endl;
	return 0;
}


Measured memory_bytes: 4344
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 2 * 1e5 + 100;
typedef long long ll;

int x[N] = {0};

int main(){
	int n;
	string s;
	cin >> n >> s;
	int a = 0, b = 0;
	for(int i = 0; i < n; i++){
		if(s[i] == 'W'){
			a++;
		}
		x[i] = a;
	}
	cout << x[n-a-1] << endl;
	return 0;
}


Measured memory_bytes: 4528
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
using namespace std;
using namespace __gnu_pbds;
 
 
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize
#define ini ll_MAX
#define inl LLONG_MAX
#define MOD 1000000007
#define sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define F0R(i, a) for (ll i = 0; i < (a); i++)
#define FORR(i, a, b) for (ll i = a; i >= (b); i--)
#define F0RR(i, a) for (ll i = a; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define pbds tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
 
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
 
using pii = pair<ll, ll>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
 
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;
 
ll mod(ll a,ll b)
{
    return (b+a%b)%b;
}
 
ll gcd(ll a,ll b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}
ll po(ll a,ll b)
{
    ll ans = 1;
    while(b--)
        ans*=a;
    return ans;
}
ll pom(ll a,ll b,ll mod)
{
    if(b==0)return 1;
    ll k = pom(a,b/2,mod);
    if(b%2==0)return (k*k)%mod;
    else return ((k*k)*mod*a)%mod;
}
 
ll sqdist(ll a,ll b,ll c,ll d)
{
    return (a-c)*(a-c)+(b-d)*(b-d);
}
ll fact(ll n)
{
    if(n==0)return 1;
    ll ans = 1;
    FOR(i,1,n+1)ans*=i;
    return ans;
}
 

void solve()
{
    int k;string s;
    cin>>k>>s;
    if(s.size()>k)s = s.substr(0,k)+"...";
    cout<<s<<endl;
}
main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    solve();
}

Measured memory_bytes: 3604
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;

template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
void yesno(bool c) { OUT(c ? "yes" : "no"); };
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

int main() {
	int H, W;
	cin >> H >> W;
	vs S(H);
	REP(i, H) {
		cin >> S[i];
	}

	REP(i, W + 2) {
		cout << "#";
	}
	cout << endl;

	REP(i, H) {
		cout << "#";
		cout << S[i];
		cout << "#" << endl;
	}

	REP(i, W + 2) {
		cout << "#";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
def main():
    import heapq

    n, m, s = map(int, input().split())

    edges = [[] for _ in range(n)]
    max_cost = 0
    for _ in range(m):
        from_, to, cost, time = map(int, input().split())
        edges[from_-1].append((to-1, cost, time))
        edges[to-1].append((from_-1, cost, time))
        if cost > max_cost:
            max_cost = cost

    banks = []
    for i in range(n):
        coin, time = map(int, input().split())
        banks.append((coin, time))

    max_coin = max_cost * (n-1)
    if s > max_coin:
        s = max_coin

    INF = float('INF')
    DP = [[INF] * (max_coin+1) for _ in range(n)]
    DP[0][s] = 0

    def push_todo(node, coin, time):
        if coin < 0:
            return
        if time >= DP[node][coin]:
            return
        heapq.heappush(todo, (time, node, coin))
        DP[node][coin] = time

    def charge(node, current_coin, current_time):
        coin, time = banks[node]
        new_coin = current_coin + coin
        if new_coin > max_coin:
            new_coin = max_coin
        push_todo(node, new_coin, current_time+time)

    todo = [(0, 0, s)]  # time, node, coin
    while todo:
        current_time, node, current_coin = heapq.heappop(todo)
        if current_time > DP[node][current_coin]:
            continue

        charge(node, current_coin, current_time)

        for to, cost, time in edges[node]:
            push_todo(to, current_coin-cost, current_time+time)

    for node in range(1, n):
        print(min(DP[node]))


if __name__ == '__main__':
    main()

Measured memory_bytes: 23840
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    ll a;
    string b;
    cin >> a >> b;
    b.erase(b.begin()+1);
    ll x = stoi(b);
    cout << a * x / 100 << endl;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    List<List<Integer>> t = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      t.add(new ArrayList<>());
    }
    for (int i = 0; i < N-1; i++) {
      int a = sc.nextInt();
      a--;
      int b = sc.nextInt();
      b--;
      t.get(a).add(b);
      t.get(b).add(a);
    }
    
    if (N == 1) {
      System.out.println(K);
      return;
    }
    
    int[] child = new int[N];
    for (int i = 0; i < N; i++) {
      child[i] = -1;
    }
    LinkedList<Integer> q = new LinkedList<>();
    q.offer(0);
    while (!q.isEmpty()) {
      int p = q.poll();
      child[p] = 0;
      for (int c : t.get(p)) {
        if (child[c] == -1) {
          child[p]++;
          q.offer(c);
        }
      }
      if ((p == 0 && child[0] > K-1)
         || (p > 0 && child[p] > K-2)) {
        System.out.println(0);
        return;
      }
    }
    int[] power = new int[K+1];
    power[K] = 1;
    power[K-1]--;
    
    power[K-1]++;
    power[K-1-child[0]]--;
    
    for (int i = 1; i < N; i++) {
      if (child[i] > 0) {
        power[K-2]++;
        power[K-2-child[i]]--;
      }
    }
    
    //System.out.println(Arrays.toString(power));
    
    int num = 0;
    for (int i = K; i >=0; i--) {
      num += power[i];
      power[i] = num;
    }
    
    long ans = 1;
    for (int i = 2; i <= K; i++) {
      while (power[i]-- > 0) {
        ans *= i;
        ans %= 1_000_000_007;
      }
    }
    
    //System.out.println(Arrays.toString(child));
    //System.out.println(Arrays.toString(power));
    System.out.println(ans);
  }
}

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

int main(){
	int n,m,x;cin>>n>>m>>x;
    vector<int> a(m);
  	for(auto&& u:a)cin>>u;
  	int y=lower_bound(begin(a),end(a),x)-begin(a);
  cout<<min(y,m-y)<<endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
index=0
listD = []
while index < n:
    a, b = map(int, input().split())
    listD.append([a, b])
    index+=1
listD.sort()
count=0
money=0
index2=0
while index2 < len(listD):
    if count+listD[index2][1] <= m:
        count+=listD[index2][1]
        money+=listD[index2][0]*listD[index2][1]
    else:
        money+=listD[index2][0]*(m-count)
        count=m
    if count==m:
        break
    index2+=1
print(money)

Measured memory_bytes: 20064
from collections import deque
H,W = map(int,input().split())
S = []
Blank = 0
for i in range(H):
  temp = str(input());temp = list(temp)
  Blank += temp.count(".")
  S.append(temp)
#print(S,Blank)
INF = float("inf")
Q = deque([])
Q.append([0,0])
dxdy = [[1,0],[-1,0],[0,1],[0,-1]]
visited = [[INF]*W for _ in range(H)]
visited[0][0] = 1
while Q:
  temp = Q.popleft()
  x = temp[0]; y = temp[1]
  for i in range(4):
    nx = x+dxdy[i][0]
    ny = y+dxdy[i][1]
    if 0<=nx<H and 0<=ny<W and visited[nx][ny] == INF and S[nx][ny] == ".":
      visited[nx][ny] = visited[x][y] + 1
      Q.append([nx,ny])
      if [nx,ny] == [H,W]:
        break
#print(visited)
if visited[H-1][W-1] == INF:
  print(-1)
  exit()
ans = Blank - visited[H-1][W-1]
print(ans)

Measured memory_bytes: 9464
#include <stdio.h>
 
int  n,u,w[100][100],color[100],d[100];
 
int main(){
  int i,j,mincost,sum=0;
  scanf("%d",&n);
  
  for(i=0;i<n;i++) for(j=0;j<n;j++){
      scanf("%d",&w[i][j]);
      if(w[i][j]==-1)w[i][j]=2001;
    }
  
  for(i=0;i<n;i++){
    d[i] =2001;
    color[i] =0;
  }
  d[0]=0;
 
  while (1){
    mincost=2001;    
for(i=0;i<n;i++){
      if (color[i] != 1 && d[i] < mincost){
    mincost = d[i];
    u = i;
      }
    }
    if (mincost ==2001)
      break;
    color[u] = 1;
    for (i=0;i<n;i++){
      if (color[i] != 1 && w[u][i] < d[i]){
    d[i] = w[u][i];
      }
    }
  }
  for (i=0;i<n;i++){
    sum+=d[i];
  }
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)n;i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;


ll N,M;


int main(){
    cin>>N>>M;
    cout<<abs(N-2)*abs(M-2)<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
   string s;
    cin>>s;
    ll k;cin>>k;
    ll lsid=0,rsid=0;
    ll res=0;
    bool ok=false;
    ll n=s.size();
    if(s[0]==s[s.size()-1]){
        int i=0;
        vector<bool> used(n,false);
        while(i<n&&s[0]==s[i]){
            used[i]=true;
            i++;
        }
        lsid=i;
        i=n-1;
        while(i>=0&&!used[i]&&s[0]==s[i]){
            i--;
            rsid++;
        }
        if(lsid+rsid==n){
            ll res=n*k/2;
            cout<<res<<endl;
            return 0;
        }
        res+=((lsid+rsid)/2)*(k-1);
        res+=(lsid/2+rsid/2);
        ok=true;
    }
    ll cnt=1;
    ll tmp=0;
    char bfo;
   if(lsid<n)bfo=s[lsid];
    for(int i=lsid+1;i<n-rsid;i++){
          if(bfo==s[i])cnt++;
          else{
              tmp+=cnt/2;
              cnt=1;
              bfo=s[i];
          }
    }
    if(cnt!=1)tmp+=cnt/2;
res+=tmp*k;
cout<<res<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
string s;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  int ans=0, c=0;
  FOR(i, 0, sz(s)){
    if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
      c++;
    }else{
      c = 0;
    }
    maxs(ans, c);
  }
  cout << ans << endl;
}

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

int main()
{
	int arr[10] = {};
  
  for (int i = 0;i < 4; i++)
  {
   	char c;
    cin >> c;
    arr[c-'0']++;
  }
  
  if (arr[1]%2 && arr[4]%2 && arr[7]%2 && arr[9]%2)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 256
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>

#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

typedef long long  ll;
#define rept(x, s, n) for (int x = s; x < n; x++)

#define Yes_RTN s_cout("Yes");return 0
#define No_RTN  s_cout("No");return 0
#define YES_RTN s_cout("YES");return 0
#define NO_RTN  s_cout("NO");return 0

#define _itoa(A,N) sprintf(A, "%d", N);

int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);

int s_asorts(const void* a, const void* b);

//昇順
int s_asorts(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	for (i = 0; i < n; i++) {
		i_cin(*(a + i));
	}

	return 0;
}
int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}

long _max(long a, long b) {
	return a > b ? a : b;
}
long _min(long a, long b) {
	return a < b ? a : b;
}
int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}

#pragma endregion


int main(void) {
	int N;
	char n[5];

	i_cin(N);

	_itoa(n, N);

	if (n[1] != n[2]) { No_RTN; }
	if (n[0] == n[1] || n[2] == n[3]) { Yes_RTN; }
	No_RTN;
}



Measured memory_bytes: 128
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
#define LAST(X) X[X.size()-1]
#define MOD 1000000007
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
inline bool BETWEEN(int x, int min,int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}

using namespace std;
#pragma endregion
signed main() {
	string S;
	cin >> S;
	if (S == "SUN")
		cout << 7;
	if (S == "MON")
		cout << 6;
	if (S == "TUE")
		cout << 5;
	if (S == "WED")
		cout << 4;
	if (S == "THU")
		cout << 3;
	if (S == "FRI")
		cout << 2;
	if (S == "SAT")
		cout << 1;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxm=25;
const int maxs=(1<<15)+1;
const int maxn=2e5+5;
int n,ans,cnt;
int sum[maxs],pw[maxs],F[maxs],G[maxs],B[maxs];
int A[maxn],id[maxn];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n-1;++i){
		int a=0,b=0,c=0;
		scanf("%d%d%d",&a,&b,&c);
		A[a+1]^=c,A[b+1]^=c;
	}
	for(int i=1;i<=n;++i) ++sum[A[i]];
	for(int i=1;i<=15;++i){
		ans+=sum[i]/2;
		sum[i]%=2;
		if(sum[i]) B[++cnt]=i;
	}
	pw[0]=1;
	for(int i=1;i<=cnt;++i) pw[i]=pw[i-1]<<1,id[pw[i]]=i;
	for(int mask=1;mask<pw[cnt];++mask){
		F[mask]=10000;
		for(int i=mask;i;i-=i&-i){
			int res=mask^(i&-i),s=id[i&-i];
			G[mask]=G[res]^B[s+1];
			if(!G[res]) F[mask]=min(F[mask],F[res]);
			else F[mask]=min(F[mask],F[res]+1);
			//cout<<mask<<" "<<res<<" "<<B[s+1]<<" "<<s<<" "<<F[mask]<<" "<<G[mask]<<endl;
		}
	}
	printf("%d\n",ans+F[pw[cnt]-1]);
	return 0;
}

Measured memory_bytes: 4400
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = sc.nextInt();

        Map<Long, Long> map = new HashMap<>();
        map.put(0L, 1L);
        long remain = 0;
        long count = 0;
        for (int i = 0; i < a.length; i++) {
            remain = (remain + a[i]) % m;
            count += map.getOrDefault(remain, 0L);
            map.put(remain, map.getOrDefault(remain, 0L) + 1L);
        }
        System.out.println(count);
        sc.close();
    }
}


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

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


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 27);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastReader in = new FastReader(inputStream);
            PrintWriter out = new PrintWriter(outputStream);
            BMultipleOf9 solver = new BMultipleOf9();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class BMultipleOf9 {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            char[] c = s.next().toCharArray();
            int cur = 0;
            for (char cc : c) {
                cur *= 10;
                cur += cc - '0';
                cur %= 9;
            }
            w.println(cur == 0 ? "Yes" : "No");
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 34492
#!/usr/bin/env python3
import sys


def solve(X: int):
    a=100
    b=0
    while True:
        a=int(a*1.01)
        b+=1
        if a>=X:
            print(b)
            break
    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 word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9220
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define sz(v) (int)v.size()
#define pb push_back

using namespace std;
int a,b,c,d;
int main(){
    cin >> a >> b >> c >> d;
    if(abs(a-c)<=d || (abs(b-c)<=d && abs(a-b)<=d)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var m = int.Parse(spl[1]);
        var x = int.Parse(spl[2]);

        var ca = new int[n][];

        for (int i = 0; i < n; i++) {
            ca[i] = ToIntArray(input.ReadLine(), m + 1);
        }

        var se = new BitSearch(n);
        var min = long.MaxValue;

        do {
            var sum = 0L;
            var score = new long[m];

            for (int i = 0; i < se.Length; i++) {
                if (!se[i]) continue;

                for (int j = 1; j <= m; j++) {
                    score[j - 1] += ca[i][j];
                }
                sum += ca[i][0];
            }
            if (score.All(z => z >= x)) {
                min = Math.Min(min, sum);
            }
        } while (se.Next());

        if (min == long.MaxValue) return -1;

        return min;
    }


    class BitSearch
    {
        private int max;
        private int x;
        public int Length { get; }

        public BitSearch(int n) {
            this.Length = n;
            this.max = (int)Math.Pow(2, n);
            this.x = 0;
        }

        public bool Next() {
            if (x >= max) {
                x = 0;
                return false;
            }
            x += 1;
            return true;
        }

        //0~n-1
        public bool this[int i] {
            get {
                return ((x >> (Length - i - 1)) & 0x01) == 1;
            }
        }
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 28708
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n,q;
	cin>>n>>q;
	string s;
	cin>>s;
	vector<int> sum(n+1,0);
	bool flag=false;
	rep(i,n){
		sum[i+1]=sum[i];
		if(s[i]=='A'){
			flag=true;
			continue;
		}
		if(flag){
			if(s[i]=='C'){
				sum[i+1]++;
			}
		}
		flag=false;
	}
	while(q--){
		int l,r;
		cin>>l>>r;
		cout<<sum[r]-sum[l]<<endl;
	}
}

Measured memory_bytes: 1616
#include <iostream>
#include <string>

using namespace std;

int main(void) {
	int N;
	string S;
	cin >> N >> S;
	if (N%2==0) {
		string s1 = S.substr(0, N/2);
		string s2 = S.substr(N/2, N/2);
		if (s1 == s2) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	} else {
		cout << "No" << endl;
	}
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))

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

for i in range(N):
    asum[i + 1] = asum[i] + A[i]
res = {}
for i in range(N + 1):
    res.setdefault(asum[i] % M, 0)
    res[asum[i] % M] += 1
ans = 0
for v in res.values():
    ans += v * (v - 1) / 2
print(int(ans))

Measured memory_bytes: 17228
s = int(input())
m = 10**9+7
a = [1,0,0,1,1,1,2]
if s < 7:
    print(a[s])
    exit()

for i in range(7,s+1):
    a.append((sum(a[3:i-2])+1)%m)

print(a[s])

Measured memory_bytes: 9104
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long int lli;

lli gcd(lli a, lli b)
{
  return (b)? gcd(b, a%b): a;
}

lli lcm(lli a, lli b)
{
  if(b > a) swap(a, b);
  return a/gcd(a, b)*b;
}

int main()
{
  lli t, n, d[10001], v[10001];
  while(cin>>n && n){
    for(int i = 0; i < n; ++i){
      cin >> d[i] >> v[i];
      t = gcd(d[i], v[i]);
      d[i] /= t;
      v[i] /= t;
    }

    t = lcm(d[0], d[1]);
    for(int i = 2; i < n; ++i)
      t = lcm(t, d[i]);

    for(int i = 0; i < n; ++i)
      v[i] *= (t/d[i]);

    t = gcd(v[0], v[1]);
    for(int i = 2; i < n; ++i)
      t = gcd(t, v[i]);

    for(int i = 0; i < n; ++i)
      cout << v[i]/t << endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main() {
	char s[60][60];
	int h, w, x = 0;
	for (int i = 0; i < 60; i++) {
		for (int j = 0; j < 60; j++) {
			s[i][j] = '.';
		}
	}
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> s[i][j];
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#'&&s[i][j + 1] == '.'&&s[i + 1][j] == '.'&&s[i][j - 1] == '.'&&s[i - 1][j] == '.')
				x++;
		}
	}
	if (x == 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define PI       3.1415926535897932384626433832795028841971
#define INF 1000000000
#define EPS      1e-10
#define MOD      1000000
using namespace std;
typedef long long ll;
typedef pair<double,double> P;
typedef pair<double,P> PQ;

int r0, w, c, r;

int main(){
    while(cin >> r0 >> w >> c >> r){
        if(r0 == 0 && w == 0 && c == 0 && r == 0) break;
        for(int i = 0; i <= 100000; i++){
            if((r0+i*r-c*w) >= 0){
                cout << i << endl;
                break;
            }
        }
    }
}

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

int main(){
  int N, P[100];
  while(cin >> N){
    for(int i = 0; i < N; i++){
      cin >> P[i];
    }
    sort( P, P + N);
    int64 ret = 0, all = 0;
    for(int i = 0; i < N; i++){
      ret += P[i] + all;
      all += P[i];
    }
    cout << ret << endl;
  }
  return 0;
}

Measured memory_bytes: 1172
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cassert>
using namespace std;
void read(int &x) {
	int f=1;
	x=0;
	char s=getchar();
	while(s<'0'||s>'9') {
		if(s=='-')f=-1;
		s=getchar();
	}
	while(s>='0'&&s<='9') {
		x=x*10+s-'0';
		s=getchar();
	}
	x*=f;
}
const int N=5000;
char a[N+3];
char ans[N+3][N+3];
char mnc;
int n,m,num;
bool cmp(int x,int y){
	for(int i=1;i<=n;i++){
		if(ans[x][i]<ans[y][i]){
			return 1;
		}
		if(ans[x][i]>ans[y][i]){
			return 0;
		}
	}
	return 0;
}
int main(){
	scanf("%d%d",&n,&m);
	scanf("%s",a+1);
	mnc='z';
	for(int i=1;i<=n;i++){
		mnc=min(mnc,a[i]);
	}
	if(m>=14){
		for(int i=1;i<=n;i++){
			printf("%c",mnc);
		}
		return 0;
	}
	int len=0,mxl=0;
	for(int i=1;i<=n;i++){
		if(a[i]!=mnc){
			len=0;
		}
		else{
			len++;
		}
		if(len>mxl){
			mxl=len;
		}
	}
	len=0;
	num=0;
	for(int i=1;i<=n;i++){
		if(a[i]!=mnc){
			len=0;
		}
		else{
			len++;
		}
		if(i==n){
			num++;
			int tmp=min(n,len*(1<<m));
			for(int j=1;j<=tmp;j++){
				ans[num][j]=mnc;
			}
			for(int j=tmp+1,k=n-len;j<=n;j++,k--){
				ans[num][j]=a[k];
			}
		}
		if(len==mxl){
			num++;
			int tmp=min(n,len*(1<<m-1));
			for(int j=1;j<=tmp;j++){
				ans[num][j]=mnc;
			}
			for(int j=tmp+1,k=i+1;j<=n;j++,k++){
				ans[num][j]=a[k<=n?k:2*n+1-k];
			}
		}
	}
	int fans=1;
	for(int i=1;i<=num;i++){
		if(cmp(i,fans)){
			fans=i;
		}
	}
	for(int j=1;j<=n;j++){
		printf("%c",ans[fans][j]);
	}
	puts("");
	return 0;
}


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

typedef long long LL;
const LL mod = 1e9+7;
LL N;
map<LL,LL> mp;

void clac(LL num)
{
    for(LL i = 2; i*i <= num; ++i)
    {
        if(num%i == 0)
        {
            while(num%i == 0)
            {
                num /= i;
                mp[i]++;
            }
        }
    }
    if(num > 1) mp[num]++;
}

int main()
{
    cin >> N;
    for(LL i = 2; i <= N; ++i)
        clac(i);
    LL res = 1;
    for(auto x : mp)
        res = res*(x.second+1)%mod;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main()
{
    int a[3], mi = 1000000000;
    for (int i = 0; i < 3; ++i)
    {
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            for (int k = 0; k < 3; ++k)
            {
                if (i != j && j != k && k != i)
                {
                    mi = min(mi, abs(a[j] - a[i]) + abs(a[k] - a[j]));
                }
            }
        }
    }
    printf("%d\n", mi);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


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

    int  p,q,r;
    cin >> p >> q >> r;
    vi a = {p,q,r};
    sort(all(a));
    cout << a[0] + a[1] << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ull> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl

ull gcdl(ull a,ull b){ // log N
    while((a%=b)&&(b%=a));
    return a+b;
}

ull lcml(ull a,ull b){
    return a/gcdl(a,b)*b;
}

int gcd(int a,int b){ // log N
    while((a%=b)&&(b%=a));
    return a+b;
}

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

int main(){
    int n;
    cin>>n;
    ull t;
    ull l=1;
    REP(i,n){
        cin>>t;
        l=lcml(t,l);
    }
    cout<<l<<endl;
    return 0;
}


Measured memory_bytes: 256
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

VI g[100010];
bool used[100010];
int dfs(int num) {
  // cout << num << endl;
  used[num] = true;
  bool update = false;
  int res = 0;
  for(int i: g[num]) {
    if(used[i]) continue;
    update = true;
    res ^= dfs(i)+1;
  }
  // 葉
  if(!update) return 0;
  return res;
}

signed main(void)
{
  int n;
  cin >> n;
  REP(j, n) g[j].clear();
  memset(used, false, sizeof(used));
  REP(j, n-1) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    g[u].PB(v);
    g[v].PB(u);
  }
  // cout << dfs(0) << endl;
  if(dfs(0)) cout << "Alice" << endl;
  else cout << "Bob" << endl;

  return 0;
}


Measured memory_bytes: 8960
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int A, B;
	cin >> A >> B;
	for (int i = 1; i <= 100000; i++)
	{
		if ((int)(i * 0.08) == A)
		{
			if ((int)(i * 0.1) == B)
			{
				cout << i << endl;
				return;
			}
		}
	}
	cout << -1 << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n,r;
	int ans=0;
	cin >>n>>r;
	if(n>= 10){
		ans = r;
	}else{
		ans = r + 100 * (10 - n);
		//R=find-100*(10-n)
	}
	cout<<ans<<endl;
}

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

#define PI 3.141592653589
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector
int MOD=1e9+7;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
ll min(ll a,ll b){return (a>b)?b:a;}
ll max(ll a,ll b){return (a>b)?a:b;}
bool prime[1000005];
int freq[1000005]={0};
int a[1000005]={0};
vi primes;
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            primes.pb(p);
            for (int i=p; i<=n; i += p) 
                prime[i] = false,freq[p]+=a[i]; 
        } 
    } 
}


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

    int t=1;
    //cin>>t;
    
    //factorial(100005);
    while(t--){
        int n;
        cin>>n;
        for(int i=0;i<n;i++){
            int x;
            cin>>x;
            a[x]++;
        }
        SieveOfEratosthenes(1000000);
        
        bool cp=true,cs=true;
        for(int i:primes){
            if(freq[i]>1)
                cp=false;
            if(freq[i]>=n)
                cs=false;
        }
        if(cp)
            cout<<"pairwise coprime";
        else if(cs)
            cout<<"setwise coprime";
        else
            cout<<"not coprime";
    }
}

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

int M;

int main() {
  cin >> M;
  long long total_n=0LL;
  long long total_q=0LL;
  for (int i=0;i<M;i++) {
    long long d,c;cin >> d >> c;
    total_n+=c;
    total_q+=c*d;
  }
  cout << total_n-1L+(total_q-1L)/9L << endl;
}

Measured memory_bytes: 256
var a,b,c:string;n,i,cnt:integer;
begin
readln(n);
readln(a);
readln(b);
readln(c);
cnt:=0;
for i:=1 to n do begin
if ((a[i]=b[i]) and (b[i]=c[i])) then cnt:=cnt
else begin
if ((a[i]<>b[i]) and (b[i]<>c[i]) and (c[i]<>a[i])) then cnt:=cnt+2 else cnt:=cnt+1;
end;
end;
writeln(cnt);
end.

Measured memory_bytes: 1324