akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const int MAXS = 114514;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
signed main(){
    int n;
    cin>>n;
    vector<pair<int,pair<int,int>>> d(n);
    for(int i=0;i<n;i++)cin>>d[i].second.first>>d[i].second.second>>d[i].first;
    sort(All(d));
    reverse(All(d));
    //中心座標について全探索
    for(int cx=0;cx<=100;cx++){
        for(int cy=0;cy<=100;cy++){
            //頂点の高さHを決め打ち
            int H = d[0].first+abs(d[0].second.first-cx)+abs(d[0].second.second-cy);
            bool ok=true;
            //それが全部満たすか知らべる
            for(int i=0;i<n;i++){
                if(d[i].first != max(0,H-abs(d[i].second.first-cx)-abs(d[i].second.second-cy))){
                    ok=false;
                }
            } 
            if(ok){
                cout<<cx<<' '<<cy<<' '<<H<<endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int AS = 500001;
char cn[AS], * ci = cn, ct;
inline int getint() {
	int A = 0;
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
char * di = cn;
int dat[2 * AS];

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


	int N = 0;
	while ((ct = getchar_unlocked()) >= '0') N = N * 10 + ct - '0';
	fread(cn, 1, N + 1, stdin);
	auto da = dat + AS;
	rep(i, N) *da++ = (1 << *ci++ - 'a');
	da = dat + AS - 1;
	for (auto db = dat + AS * 2 - 1; da > dat; da--) *da = *db-- | *db--;

	ci = cn;
	fread(cn, 1, AS, stdin);
	int Q = getint();

	rep(j, Q) {
		char q = *ci++;
		ci++;
		if (q == '1') {
			int i = getint() - 1 + AS;
			for (dat[i] = 1 << *ci++ - 'a'; i > 1; i >>= 1) dat[i >> 1] = dat[i] | dat[i ^ 1];
			ci++;
		}
		else {
			int ret = 0;
			for (int l = getint() - 1 + AS, r = getint() + AS; l < r; l >>= 1, r >>= 1) {
				if (l & 1) ret |= dat[l++];
				if (r & 1) ret |= dat[--r];
			}
			int kotae = __builtin_popcount(ret);
			int ue = kotae / 10;
			if (ue) *di++ = ue + '0';
			*di++ = kotae - ue * 10 + '0';
			*di++ = '\n';
		}
	}
	fwrite(cn, 1, di - cn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 4608
/*
精灵引路
对应原理
尽量往后排 同样
*/
#include<bits/stdc++.h>
#define MAXN 3000005
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
typedef long long ll;
const ll INF=1e18;
const ll MOD=998244353;
const ll mod=998244353;
//wa说明精度太大了 把精度减小 变成3e-7
const double eps=1e-6;
ll n,a,b,k,inv[MAXN],c[MAXN],ans;
ll add(ll x,ll y)
{
    ll ret=x+y;
    if(ret>=mod)
    {
        return ret-mod;
    }
    return ret;
}
ll mul(ll x,ll y)
{
    return (x*y)%mod;
}
void init()
{
    inv[1]=1;
    for(ll i=2;i<=n;i++)
    {
        ll a=MOD/i,b=MOD%i;
        inv[i]=(inv[b]*(-a)%MOD+MOD)%MOD;
    }
    c[0]=1;
    for(ll i=1;i<=n;i++)
    {
        c[i]=mul(mul(c[i-1],(n-i+1)),inv[i]);
    }
}
int main()
{
//    freopen("c://duipai//939cdata.txt", "r", stdin);
//    freopen("c://duipai//939cac.txt", "w", stdout);
    while(~scanf("%lld %lld %lld %lld",&n,&a,&b,&k))
    {
        init();
        for(ll i=0;i<=n;i++)
        {
            ll s1=a*i;
            ll s2=k-s1;
            ll n2;
            if(s2%b)
            {
                continue;
            }
            else
            {
                n2=s2/b;
            }
            if(n2>=0)
            {
                ans=add(ans,mul(c[i],c[n2]));
            }
           // printf("%lld %lld\n",i,n2);

        }
        printf("%lld\n",ans);
    }
}
/*
1
2 3
  +---+       +---+
 /     \     /     \
+       +---+   T   +
 \           \     /
  +   +       +---+
 /     \     /     \
+       +---+       +
 \                 /
  +---+   S   +---+
       \     /
        +---+
*/


Measured memory_bytes: 8448
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

int main(int argc, char const *argv[])
{
	char str[100];
	scanf("%s",str);
	printf("%c%d%c\n", str[0],strlen(str) - 2,str[strlen(str) - 1]);
	return 0;
}

Measured memory_bytes: 128
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int N;
	cin >> N;
	vector<int>v(N);
	for (int i = 0; i < N; i++)
	{
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	int number = 1;
	for (int i = 0; i < N-1 ; i++)
	{
		if (v[i] < v[i + 1])
		{
			number = number + 1;
		}
	}
	cout << number << endl;
}

Measured memory_bytes: 256
import sys

# import bisect
from collections import Counter, deque, defaultdict

# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, x, y = list(map(int, readline().split()))
    x -= 1
    y -= 1

    ans = [0] * n

    for i in range(n - 1):
        for j in range(i + 1, n):
            dist = min(j - i, abs(i - x) + abs(y - j) + 1, abs(i - y) + abs(x - j) + 1)
            ans[dist] += 1

    for k in range(1,n):
        print(ans[k])


if __name__ == '__main__':
    main()


Measured memory_bytes: 45788
#include<iostream>
#include<cmath>
#include<vector>

int main(void){
    int n;
    std::cin >> n;

    std::vector<int> a(n);
    for(int i = 0; i < n; i++){
        std::cin >> a[i];
    }

    long long total_number = std::pow(3, n);

    long long even_number = 1;

    for(int i = 0; i < n; i++){
        if(a[i] % 2 == 0) even_number *= 2;
    }

    long long ans = total_number - even_number;

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

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

int main() {
  string s;
  cin >> s;
  int counter = 0;

  if(s[0] == '1') counter++;
  if(s[1] == '1') counter++;
  if(s[2] == '1') counter++;

  cout << counter << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;

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

    for(int i = 1; i <= N; ++i){
        if((i%3 != 0) && (i%5 != 0)) ans += i;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
#define N (int)2e5
#define fi first
#define se second
#define mp make_pair
#define pb push_back
int n,m,memo[N];
vector <int> adj[N];

int dp(int u) {
    if (adj[u].size() == 0) return 0;
    int &sol = memo[u];
    if (sol != -1) return sol;
    int keep = INT_MIN;
    for (int v : adj[u]) {
        keep = max(
            keep ,
            dp(v) + 1
        );
    }
    return sol = keep;
}

int main() {
    scanf("%d%d" , &n , &m);
    for (int i = 1 ; i <= m ; i++) {
        int u,v; scanf("%d%d" , &u , &v);
        adj[u].pb(v);
    }
    memset (memo , -1 , sizeof memo);
    int sol = INT_MIN;
    for (int u = 1 ; u <= n ; u++)
        sol = max(sol , dp(u));
    printf("%d\n" , sol);
}


Measured memory_bytes: 14336
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

int sign(ll x) {
  return (x > 0) - (x < 0);
}

int main() {
  int N;
  ll K, A[SIZE];
  vector<ll> pos, neg;

  scanf("%d%lld", &N, &K);

  for (int i = 0; i < N; i++) {
    scanf("%lld", A + i);
    pos.push_back(A[i]);
    neg.push_back(-A[i]);
  }

  sort(pos.begin(), pos.end());
  sort(neg.begin(), neg.end());

  ll e18 = (ll)(1e18);

  ll l = 0, r = e18 * 2;

  while (l < r) {
    ll _mid = (l + r) / 2;
    ll mid = _mid - e18;

    ll sum = 0;
    for (int i = 0; i < N; i++) {
      int num = 0;

      if (A[i] == 0) {
        num = mid >= 0 ? N : 0;
      } else {
        ll th = mid / abs(A[i]);
        if (mid < 0 && mid % abs(A[i])) th--;

        if (A[i] >= 0) {
          num += upper_bound(pos.begin(), pos.end(), th) - pos.begin();
        } else {
          num += upper_bound(neg.begin(), neg.end(), th) - neg.begin();
        }
      }

      num -= A[i] * A[i] <= mid;
      sum += num;
    }

    debug(mid);
    debug(sum);

    if (sum >= K * 2) {
      r = _mid;
    } else {
      l = _mid + 1;
    }
  }

  cout << l - e18 << endl;

  return 0;
}


Measured memory_bytes: 5092
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

#n,*a = map(int,readline().split())

"""
a = "dream"[::-1]
b = "dreamer"[::-1]
c = "erase"[::-1]
d = "eraser"[::-1]
"""
s = [*input()]
a = [*"dream"]
b = [*"dreamer"]
c = [*"erase"]
d = [*"eraser"]

while True:
    if not s:
        print("YES")
        break
    elif s[-5:] == a:
        for _ in range(5): s.pop()
    elif s[-5:] == c:
        for _ in range(5): s.pop()
    elif s[-7:] == b:
        for _ in range(7): s.pop()
    elif s[-6:] == d:
        for _ in range(6): s.pop()
    else:
        print("NO")
        break






Measured memory_bytes: 9752
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        var N = int.Parse(inputs[0]);
        var M = int.Parse(inputs[1]);
        var L = new int[M];
        var R = new int[M];
        for (int i = 0; i < M; i++)
        {
            inputs = Console.ReadLine().Split(' ');
            L[i] = int.Parse(inputs[0]);
            R[i] = int.Parse(inputs[1]);
        }

        var Lmax = 0;
        var Rmin = 1000000;
        for (int i = 0; i < M; i++)
        {
            Lmax = Math.Max(L[i], Lmax);
            Rmin = Math.Min(R[i], Rmin);
        }
        var count = Rmin - Lmax + 1;
        if (count <= 0)
        {
            Console.WriteLine(0);
        }
        else
        {
            Console.WriteLine(count);
        }
    }

}



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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll, ll> Pll;
typedef pair<int, Pii > P1;

#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define mp1(a,b,c) P1(a,P(b,c))
#define get_arsize(a) (sizeof(a)/sizeof(a[0]))

const ll MOD = 1000000007;
const double EPS = 1e-10;
const int MAX = 200000;

ll gcd2(ll i, ll j) {
  if (i == 0) return j;
  return gcd2(j%i, i);
}

ll gcd3(ll i, ll j, ll k) {
  ll a = gcd2(i, j);
  return gcd2(a, k);
}

int main() {
  int k;
  cin >> k;
  ll sum = 0;
  for(int i = 1; i <= k; ++i) {
    for(int j = 1; j <= k; ++j) {
      for(int l = 1; l <= k; ++l) {
        sum += gcd3(i, j, l);
      }
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    char op;
    while(1){
        cin >> a >> op >> b;
        if (op=='?'){
            break;
        }
        switch (op){
            case '+':
                cout << (a+b) <<endl;
                break;
            case '-':
                cout << (a-b) <<endl;
                break;
            case '*':
                cout << (a*b) <<endl;
                break;
            case '/':
                cout << (a/b) <<endl;
                break;
        }
    }
}


Measured memory_bytes: 3060
h, w = gets.chomp.split(" ").map(&:to_i)

c = Array.new()
10.times do
  c << gets.chomp.split(" ").map(&:to_i)
end

a = Array.new()
h.times do
  a << gets.chomp.split(" ").map(&:to_i)
end

# dijkstra
INF = 10**6
n = 10
s = 1
d = Array.new(n, INF)
used = Array.new(n, false)
d[s] = 0

while true
  v = -1
  n.times do |u|
    if !used[u] && (v == -1 || d[u] < d[v])
      v = u
    end
  end
  break if v == -1
  used[v] = true
  n.times do |u|
    if d[u] > d[v] + c[u][v]
      d[u] = d[v] + c[u][v]
    end
  end
end

ans = 0
a.each do |row|
  row.each do |cell|
    if cell < 0
      next
    else
      ans += d[cell]
    end
  end
end

puts ans

Measured memory_bytes: 2556
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define lp(i,n) for(int i=0;i<(n);i++)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)2e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define CTOI(x) (x - 'A') 
#define ctoi(x) (x - 'a')
#define BIT(x) (1 << (x))
#define int long long
using namespace std;

signed main(){
    int x, a, b;
    cin >> x >> a >> b;
    if(abs(x-a)>abs(x-b)){
        cout << "B" << endl;
    }else{
        cout << "A" << endl;
    }
    return 0;
}


Measured memory_bytes: 384
import java.util.*;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int N=in.nextInt();
			if(N==0)
				return;
			jump a[][]=new jump[N][N];
			ArrayList<jump>AL=new ArrayList<jump>();
			int field[][]=new int[N][N];
			boolean judge[][]=new boolean[N][N];
			int cnt=0;
			for(int i=0;i<N;i++)
				for(int j=0;j<N;j++)
					a[j][i]=new jump(in.nextInt(),in.nextInt());

			for(int i=0;i<N;i++)
				for(int j=0;j<N;j++)
				{
					int xx=j;
					int yy=i;
					if(field[j][i]==0)
						for(;;)					
						{
							if(field[xx][yy]==2)
							{
								if(judge[xx][yy]==false)
								{
									cnt++;
									judge[xx][yy]=true;
								}
								break;
							}
							field[xx][yy]=2;
							AL.add(new jump(xx, yy));
							int tx=a[xx][yy].x;
							int ty=a[xx][yy].y;
							xx=tx;
							yy=ty;
						}
					for(int k=0;k<AL.size();k++)
					{
						int rex=AL.get(k).x;
						int rey=AL.get(k).y;
						judge[rex][rey]=true;
					}
				}
			System.out.println(cnt);
		}
	}
}
class jump
{
	int x;
	int y;
	public jump(int a,int b) 
	{
		x=a;
		y=b;
	}
}

Measured memory_bytes: 61060
from functools import reduce
import math
import fractions

def lcm(a,b):
    return (a*b)/fractions.gcd(a,b)

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    X,Y = (int(_) for _ in input().split())
    ans = 0
    tmp = X
    while tmp<=Y:
        ans +=1
        tmp *= 2
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 5128
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-10;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)


//ここから編集

vector<vector<pii>> g(100010);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int N; cin >> N;
  REP(i,N-1){
    int a, b, c; cin >> a >> b >> c;
    a--; b--;
    g[a].push_back({b, c});
    g[b].push_back({a, c});
  }

  int Q, K; cin >> Q >> K;
  K--;
  vector<ll> dist(N, (1LL<<60));
  dist[K] = 0;
  priority_queue<PLL, vector<PLL>, greater<PLL>> q;
  q.push({0, K});
  while(q.size()){
    auto p = q.top();
    q.pop();

    int v = p.second;
    ll cost = p.first;
    if(dist[v] < cost) continue;

    for(auto e: g[v]){
      if(dist[e.first] > dist[v] + e.second){
        dist[e.first] = dist[v] + e.second;
        q.push({dist[e.first], e.first});
      }
    }
  }

  REP(i,Q){
    int x, y; cin >> x >> y;
    x--; y--;
    cout << dist[x] + dist[y] << endl;
  }
  return 0;
}


Measured memory_bytes: 12368
from math import ceil

n, k = [int(_) for _ in input().split()]

a = [int(_) for _ in input().split()]

# a.sort()


l, r = 0, 10**9

while r-l > 1:

    m = (l+r)//2
    c = 0
    for i in range(n):
        if a[i] < m:
            continue
        c += a[i]//m-(a[i] % m == 0)
    # print(c, l, r, m)
    if c > k:
        l = m
    else:
        r = m

print(r)


Measured memory_bytes: 31088
n = int(input())
mat = []

for x in range(1, n+1):
    if x % 3 == 0:
        # 3で割り切れればOK
        mat.append(x)
    else:
        y = x
        # xは保存するため、仮の変数yを置く
        while y != 0:
            if y % 10 == 3:
                # 下1桁が3のときはOKとしてリストに追加
                mat.append(x)
                break
            else:
                # 一桁右シフトして繰り返し。0になったら終了
                y = y // 10

for i in range(len(mat)):
    print(" {}".format(mat[i]), end='')
print()




Measured memory_bytes: 6104
#include<algorithm>
#include<iostream>
#include<map>
#include <bits/stdc++.h>
#include<cmath>
#define mod 1000000007
#define ll long long 
using namespace std;

int main() {

  ll x,y;
  cin>>x>>y;
  ll yy=x*y/__gcd(x,y);
  cout<<yy<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define int long long
#define moder 1234567
#define inf 1000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;


signed main() {
	string s;
	cin>>s;
	if(s[0]!='A'){
		cout<<"WA"<<endl;
		return 0;
	}
	bool c=false;
	for(int i=1;i<s.size();i++){
		if(s[i]<'a'&&!(s[i]=='C'&&i>=2&&i<=s.size()-2&&!c)){
			cout<<"WA"<<endl;
			return 0;
		}else if(s[i]=='C'){
			c=true;
		}
	}
	if(!c)cout<<"WA"<<endl;
	else cout<<"AC"<<endl;
}


Measured memory_bytes: 256
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};

use std::io::prelude::*;

fn input<T>() -> T
    where T: std::str::FromStr {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    // s
    let n: i64 = input();
    // c
    let m: i64 = input();
    // s を全て食べる
    let res  = m - n * 2;

    //  全部食べれる時
    if res >= 0 {
        println!("{}", n + res / 4);

    // 全部食べれなっかった時
    } else {
        if n - m / 2 >= 0 {
            println!("{}", m / 2);
        }
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define f(a,j,k) for(int i = a ; i < j ; i += k)
#define f1(a,j,k) for(int i = a ; i > j ; i -= k)
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
typedef vector<int> vi;
typedef pair<int,int> pri;
typedef pair<long long,long long> prl;

int main() {
	std::ios::sync_with_stdio(false);
  ll a , b;
	cin >> a >> b;
	f(0,1001,1) if(i * 8 / 100 == a && i / 10 == b)
	{
		 cout << i << endl;
		 return 0;
	}
	cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
/*
Aldew
PROB: Multiple of Three
CLASSIFICATION: Math
DIFFICULTY:
*/

#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <cmath>
#include <string>
#include <map>
#include <math.h>
#include <cstdio>
#define ll long long int


using namespace std;


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

    if (a == 0) cout << 1 << endl;
    else if (b == 0) cout << 2 << endl;
    else if (c == 0) cout << 3 << endl;
    else if (d == 0) cout << 4 << endl;
    else cout << 5 << endl;
    return 0;
}



Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T> >;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repb(i, n) for(ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define reprb(i, a, b) for(ll i = (b)-1; i >= (a); i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class S, class T>inline bool chmax(S &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class S, class T>inline bool chmin(S &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    map<string, ll> mp;
    mp["Male"] = 0;
    mp["Female"] = 1;
    ll n;
    cin >> n;
    vi status(n);
    cout << 0 << endl;
    string s0;
    cin >> s0;
    if(s0 == "Vacant"){
        return 0;
    }
    status[0] = mp[s0];
    ll lb = 1, ub = n-1;
    rep(q, 19){
        ll mid = (lb+ub)/2;
        cout << mid << endl;
        string s;
        cin >> s;
        if(s == "Vacant"){
            return 0;
        }
        status[mid] = mp[s];
        dump((mid-lb+1) & 1, status[mid] != status[lb-1]);
        if(((mid-lb+1) & 1) == (status[mid] != status[lb-1])){
            lb = mid + 1;
        }else{
            ub = mid - 1;
        }
    }
    assert(0);
    return 0;
}

Measured memory_bytes: 1236
H, W = map(int, input().split())
s = []
for i in range(H):
    s.append(input())

is_white = True
st = []
st.append([False, H-1, W-1, 0])
dp = [[1000] * W for i in range(H)]

for h in reversed(range(H)):
    for w in reversed(range(W)):
        if h == H-1 and w == W-1:
            if s[h][w] == '#':
                dp[h][w] = 1
            else:
                dp[h][w] = 0
            continue

        if w+1 < W:
            cnt = dp[h][w+1]
            if s[h][w] == '#' and s[h][w+1] == '.':
                cnt += 1
            if cnt < dp[h][w]:
                dp[h][w] = cnt

        if h+1 < H:
            cnt = dp[h+1][w]
            if s[h][w] == '#' and s[h+1][w] == '.':
                cnt += 1
            if cnt < dp[h][w]:
                dp[h][w] = cnt

print(dp[0][0])


Measured memory_bytes: 41456
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.buffer.readline
def dfs(G,v,p):
    for nv in G[v]:
        if(nv==p):
            continue
        point[nv]+=point[v]
        dfs(G,nv,v)

N,Q=map(int,input().split())
G=[[] for i in range(N)]
for i in range(N-1):
    a,b=map(lambda x:int(x)-1,input().split())
    G[a].append(b)
    G[b].append(a)
point=[0]*N
for i in range(Q):
    p,x=map(int,input().split())
    point[p-1]+=x
dfs(G,0,-1)
print(*point)


Measured memory_bytes: 232788
#include <string>
#include<iostream>
#include <algorithm>
#include<sstream>
#include<list>
 #include <cstdio>
//#include <stdio.h>
using namespace std;                      



int main ()
{
string S;

cin>>S;
list<char> ans;
for(int i =0;i<S.size();i++ ){


if(S[i]=='1' or S[i]=='0' ){
ans.push_back(S[i]);
}

else if(S[i]=='B' && ans.size()>=1){

    ans.pop_back();
}

}

list<char>::iterator itr;

for( itr = ans.begin(); itr != ans.end(); ++itr) {
        std::cout << *itr;
    }

return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 25

int n, i, id, flag = 0;
int use[MAX];
typedef struct pp
{
    int parent;
    int sib;
    int dph;
    int height;
    int left, right;
}g;
g Q[MAX];

void dfs(int q, int d)
{
    if(Q[q].dph<d) Q[q].dph=d;
    if(Q[q].left !=-1)
    {
        Q[Q[q].left].parent = q;
        dfs(Q[q].left, d+1);
    }
    if(Q[q].right !=-1)
    {
        Q[Q[q].right].parent = q;
        dfs(Q[q].right, d+1);
    }
}

void height_finder(int q)
{
    if(Q[q].parent != -1) 
    {
        if(Q[Q[q].parent].height<Q[q].height + 1) Q[Q[q].parent].height = Q[q].height + 1;
        height_finder(Q[q].parent);
    }
}

int main()
{
    for(int j=0; j<MAX; j++)
    {
        use[j] = 0;
        Q[j].parent = -1;
        Q[j].dph = -1;
        Q[j].height = 0;
    }
    //input
    scanf("%d", &n);
    while(1)
    {
        if((scanf("%d", &id)) == EOF) break;
        scanf("%d", &Q[id].left);
        scanf("%d", &Q[id].right);
        if(Q[id].left != -1)
        {
            Q[Q[id].right].sib = Q[id].left;
            use[Q[id].left] = 1;
        }
        else
        {
            Q[Q[id].right].sib = -1;
        }
        if(Q[id].right != -1)
        {
            Q[Q[id].left].sib = Q[id].right;
            use[Q[id].right] = 1;
        }
        else
        {
            Q[Q[id].left].sib = -1;
        }

    }

    for(int j=0; j<MAX; j++)
    {
        if(use[j] == 0) 
        {
            Q[j].sib = -1;
            dfs(j, 0);
            for(int k=0; k<n; k++)
            {
                if(Q[k].left == -1 && Q[k].right == -1) height_finder(k);
            }
            break;
        }
    }
    //output results
    for(int j=0; j<n; j++)
    {
        printf("node %d: ",j);
        printf("parent = %d, ",Q[j].parent);
        printf("sibling = %d, ",Q[j].sib);
        if(Q[j].right == -1 && Q[j].left == -1) printf("degree = 0, ");
        else if(Q[j].right != -1 && Q[j].left == -1) printf("degree = 1, ");
        else if(Q[j].right == -1 && Q[j].left != -1) printf("degree = 1, ");
        else printf("degree = 2, ");
        printf("depth = %d, ",Q[j].dph);
        printf("height = %d, ", Q[j].height);
        if(Q[j].parent == -1) printf("root\n");
        else if(Q[j].left == -1 && Q[j].right == -1) printf("leaf\n");
        else printf("internal node\n");
    }

    return 0;
}


Measured memory_bytes: 2088
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = 0;
//-----------------------------------------------//

int main() {
	string s, t;
	cin >> s >> t;
	sort(ALL(s));
	sort(ALL(t), greater<char>());
	
	if (s < t) puts("Yes");
	else puts("No");
}

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

int main(){

  int a, b, c, n;
  int p[1111], m[1111], k[1111], q[1111];
  int data[333];

  while(cin >> a >> b >> c, a){
    for(int i=1;i<=a+b+c;i++) data[i] = 2;
    
    cin >> n;
    for(int i=0;i<n;i++) cin >> p[i] >> m[i] >> k[i] >> q[i];
    
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(q[j]) data[p[j]] = data[m[j]] = data[k[j]] = q[j];
	else{
	  if(data[p[j]] == 1 && data[m[j]] == 1) data[k[j]] = 0;
	  if(data[m[j]] == 1 && data[k[j]] == 1) data[p[j]] = 0;
	  if(data[p[j]] == 1 && data[k[j]] == 1) data[m[j]] = 0;
	}
      }
    }
    for(int i=1;i<=a+b+c;i++) cout << data[i] << endl;
  }
  
}

Measured memory_bytes: 1176
#include <iostream>
#include <string> 
#include <vector>
#include <map>
#include <set>

using namespace std;

template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {
	o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;
}

template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {
	o << "{" << obj.first << ", " << obj.second << "}"; return o;
}

template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

void print(void) {
	cout << endl;
}

template <class Head> void print(Head&& head) {
	cout << head;
	print();
}

template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {
	cout << head << " ";
	print(forward<Tail>(tail)...);
}

int main() {
	int N;
	cin >> N;
  	if(N<1000) cout << "ABC" << endl;
  	else cout << "ABD" << endl;

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define mem(a) memset(a,0,sizeof(a))
#define pd(a) printf("%.10f\n",a)
#define pb(a) push_back(a)
#define in(a) insert(a)
#define pi M_PI
#define R cin>>
#define F first
#define S second
#define C class
#define ll long long
#define ln cout<<'\n'
#define _(_1,_2,_3,N,...)N
#define pr(...) _(__VA_ARGS__,pr3,pr2,pr1)(__VA_ARGS__)
template<C T>void pr1(T a){cout<<a;ln;}
template<C T,C T2>void pr2(T a,T2 b){cout<<a<<' '<<b;ln;}
template<C T,C T2,C T3>void pr3(T a,T2 b,T3 c){cout<<a<<' '<<b<<' '<<c;ln;}
template<C T>void PR(T a,int n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
bool check(int n,int m,int x,int y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
typedef pair<int,int> P;
string s[9];
int a[9];
int ans;

void dfs(int t) {
  if(t==(1<<9)-1) {
    ans++;
    return;
  }
  int k=__builtin_popcount(t);
  rep(i,9) {
    if(t&(1<<i)) continue;
    rep(j,4) {
      rotate(s[i].begin(),s[i].begin()+1,s[i].end());
      bool f=1;
      if(k%3) {
        if(abs(s[i][3]-s[a[k-1]][1])!=abs('A'-'a')) f=0;
      }
      if(k>=3) {
        if(abs(s[i][0]-s[a[k-3]][2])!=abs('A'-'a')) f=0;
      }
      if(f) {
        a[k]=i;
        dfs(t|(1<<i));
      }
    }
  }
}

void Main() {
  int T;
  R T;
  while(T--) {
    rep(i,9) R s[i];
    ans=0;
    dfs(0);
    pr(ans);
  }
}

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


Measured memory_bytes: 1232
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

string s;
string table[] = { "dream","dreamer","erase","eraser" };
bool f[100100];

int main() {
	cin >> s;
	f[0] = 1;
	rep(i, s.size()) {
		if (f[i]) {
			rep(j, 4) {
				bool F = 1;
				rep(k, table[j].size()) {
					if (table[j][k] != s[i + k])F = 0;
				}
				if (F)f[i + table[j].size()] = 1;
			}
		}
	}
	if (f[s.size()])cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 512
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size()) 
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
#define rep(i, n) for(int i=0;i<n;i++)

int IT_MAX = 1 << 17;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x1f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-12;

char in[500050];
int dp[500050];
int main() {
	int N, i, j;
	scanf("%d %s", &N, in + 1);

	int prv = 0, prv2 = -1;
	for (i = 1; i <= N; i++) {
		dp[i] = dp[i - 1];
		if (in[i] == '0') {
			prv2 = prv;
			prv = i;
			continue;
		}
		if (i < 3) continue;
		
		if (prv <= 1) continue;
		if(prv2+1 != prv) dp[i] = max(dp[i], dp[prv - 2] + i - prv);
		if (prv + 1 == i && prv2 + 1 != prv) dp[i] = max(dp[i], dp[prv2] + (prv - prv2 - 1));
		if (prv + 1 == i && prv2 + 2 != prv) dp[i] = max(dp[i], dp[prv2 + 1] + (prv - prv2 - 2));
	}
	return !printf("%d\n", dp[N]);
}

Measured memory_bytes: 2688
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	int people[6];
	int hand[5];

	while( cin >> people[0] , people[0] )
	{
		for(int i = 1; i <= 4; i++)
		{
			cin >> people[i];
		}

		memset(hand, 0, sizeof(hand));
		
		for(int i = 0; i < 5; i++)
		{
			hand[people[i]]++;
		}

		if(hand[1] && hand[2] && hand[3])
		{
			for(int i = 0; i < 5; i++)
			{
				people[i] = 3;
			}
		}
		else if(hand[1] && hand[2])
		{
			for(int i = 0; i < 5; i++)
			{
				if(people[i] == 1)
				{
					people[i] = 1;
				}
				else
				{
					people[i] = 2;
				}
			}
		}
		else if(hand[2] && hand[3])
		{
			for(int i = 0; i < 5; i++)
			{
				if(people[i] == 2)
				{
					people[i] = 1;
				}
				else 
				{
					people[i] = 2;
				}
			}
		}
		else if(hand[1] && hand[3])
		{
			for(int i = 0; i < 5; i++)
			{
				if(people[i] == 3)
				{
					people[i] = 1;
				}
				else
				{
					people[i] = 2;
				}
			}
		}
		else
		{
			for(int i = 0; i < 5; i++)
			{
				people[i] = 3;
			}
		}

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

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,a,b) for(int i(a);i<b;i++)
#define rep(i,n) for(int i(0);i<n;i++)
#define fast  ios_base::sync_with_stdio(0); cin.tie(0);
#define open freopen("input.txt","r",stdin) ; freopen("output.txt","w",stdout);
#define watch(x) cout<<(#x)<<" is "<<x<<"\n";
#define mod 1000000007

int32_t main(){
	
	fast;
	//open;

	int n,x,p=0,ans=1,k;
	cin>>n>>x;
	rep(i,n){
		cin>>k;
		p+=k;
		if(p<=x)ans++;
		else break;
	}
	cout<<ans;


	return 0;
}

Measured memory_bytes: 256
S=list(input())
if S[0]==S[1]:
    if S[2]==S[3]:
        if S[1]!=S[2]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')

elif S[0]==S[2]:
    if S[1]==S[3]:
        if S[1]!=S[2]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
elif S[0]==S[3]:
    if S[1]==S[2]:
        if S[0]!=S[2]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
elif S[1]==S[2]:
    if S[0]==S[3]:
        if S[0]!=S[2]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
elif S[1]==S[3]:
    if S[0]==S[2]:
        if S[1]!=S[2]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
elif S[2]==S[3]:
    if S[0]==S[1]:
        if S[1]!=S[2]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')


Measured memory_bytes: 3064
while True:
    a, op, b = input().split()   
    a =int(a)                   
    b = int(b)                   


    if op=="?": # opが"?"の時は終了
        break
    else:

        if op=="+":

            print(a+b)

        elif op=="-":

            print(a-b)

        elif op=="*":

            print(a*b)

        elif op=="/":

            print(a//b)



Measured memory_bytes: 5596
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
using namespace std;

int main(){
	string s;
	int cnt=0;
	cin >> s;
	if (s[0] != 'C') cnt++;
	if (s[1] != 'O') cnt++;
	if (s[2] != 'D') cnt++;
	if (s[3] != 'E') cnt++;
	if (s[4] != 'F') cnt++;
	if (s[5] != 'E') cnt++;
	if (s[6] != 'S') cnt++;
	if (s[7] != 'T') cnt++;
	if (s[8] != 'I') cnt++;
	if (s[9] != 'V') cnt++;
	if (s[10] != 'A') cnt++;
	if (s[11] != 'L') cnt++;
	if (s[12] != '2') cnt++;
	if (s[13] != '0') cnt++;
	if (s[14] != '1') cnt++;
	if (s[15] != '6') cnt++;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>
#include <cassert>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>
#include <functional>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* ---------- Functions */
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; }

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int N, K;
    cin >> N >> K;
    vector<bool> flags(N, false);

    for (int k = 0; k < K; k++) {
        int d;
        cin >> d;
        for (int i = 0; i < d; i++) {
            int a;
            cin >> a;
            a--;
            flags[a] = true;
        }
    }

    int cnt = 0;
    for (int i = 0; i < N; i++) if (!flags[i]) cnt++;
    cout << cnt << endl;

    return 0;
}

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

using namespace std;

main(){
  int w, d, cnt[21], in;
  while(cin >> w >> d && (w|d)){
    fill(cnt, cnt+21, 0);
    int ans = 0;
    for(int i=0;i<w;i++){
      cin >> in;
      cnt[in]++;
      ans += in;
    }
    for(int i=0;i<d;i++){
      cin >> in;
      if(cnt[in]-- < 1) ans += in;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <fstream>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>

#define x first
#define y second
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define pii pair<int,int>
#define bit __builtin_popcount
#define all(x) x.begin(),x.end()

typedef long long ll;
typedef long double ld;

using namespace std;

const ll INF=1e18;
const ld EPS=1e-9;
const int inf=1e9;
const int MOD=1e9+7;
const int N=1e5;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll x,y,z;
	cin>>x>>y>>z;
	for(ll i=N;i>=0;i--){
		if(i*y+(i+1)*z<=x){
			cout<<i;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
//#include <bits/stdc++.h>

#define ll long long int
#define pb push_back
#define llu unsigned long long int
#define fo(i,n) for(int i=0;i<n;i++)
#define eb emplace_back
#define M 1000000007
#define vi vector<int>
#define vlli vector<lli>
#define pi pair<int,int>
#define mp make_pair
#define mapi map<int,int>

using namespace std;
int min(int x,int y)
{
	if(x<y)
		return x;
	return y;
}
int max(int x,int y)
{
	if(x>y)
		return x;
	return y;
}
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    ll sum=0;
    cin >> n;
    vector<ll> a(100000,0);
    for(int i=0;i<n;i++)
    {
    	int temp;
    	cin >> temp;
    	sum += temp;
    	a[temp-1]++;
	}
	int q;
	cin >> q;
	while(q--)
	{
		ll a1,a2;
		cin >> a1 >> a2;
		sum = sum - a[a1-1]*a1 + a[a1-1]*a2;
		a[a2-1] += a[a1-1];
		a[a1-1] = 0;
		cout << sum << endl;
	}
    return 0;
}



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

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

int main(){
  int s;
  cin >> s;
  
  cout << 2 * s * M_PI << endl;
  
  return 0;
  
}

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

int main() {
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;
	if (N > K) {
		cout << X*K + Y*(N - K) << endl;
	}
	else {
		cout << X*N << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    BTC_TO_YEN = 380000.0
    result = 0.0
    otoshidama = [i.split() for i in inputs]
    for o in otoshidama:
        if o[1] == "BTC":
            result += float(o[0]) * BTC_TO_YEN
        else:
            result += float(o[0])
    return result


def string_to_float(string):
    return list(map(lambda x: float(x), string.split()))


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    N = int(input())
    ret = solve(inputs(N))
    print(ret)


Measured memory_bytes: 3316
using System.Collections.Generic;
 
using System.Linq;
using System;
 
namespace Application
{
	class Solution
	{
		static void Main(string[] args)
		{
			var riceCakeCount = int.Parse(Console.ReadLine());
 
			var riceCakeDiameters = new List<int>(riceCakeCount);
 
			for (var i = 0; i < riceCakeCount; i++)
			{
				var diameter = int.Parse(Console.ReadLine());
				riceCakeDiameters.Add(diameter);
			}
 
			var result = riceCakeDiameters.Distinct().Count();
			Console.WriteLine(result);
		}
	}
}

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


int main() {
  ll n;
  cin>>n;
  ll a[n+1];
  a[0]=0;
  queue<ll>q;
  for(int i=1;i<=n;i++)
  {
    cin>>a[i];
    q.push(a[i]);
  }
  ll c=0;
  for(int i=1;i<=n;i++)
  {
    
    while(q.front()!=i && q.empty()==0)
    {
      //cout<<"q "<<q.front()<<" "<<i<<endl;
         q.pop();
         c++;
    }
    if(q.front()==i)
    {
      q.pop();
    }
  }
  if(c==n)
  {
    cout<<-1<<endl;
  }
  else{cout<<c<<endl;}
}

Measured memory_bytes: 3456
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        String str = sc.next();
        for (int i = str.length() - 1; i >= 0; i--) {
        	System.out.print(str.charAt(i));
		}
        System.out.println();
    }
}


Measured memory_bytes: 26072
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    long long int k;
    cin>>n>>k;
    vector<int>a (n+1);
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        a[i]=x;
    }
    vector<int> vis(n+1,0);
    int ce=1;
    while(vis[ce]!=1)
    {
        vis[ce]=1;
        ce=a[ce];
    }
    int len=1;
    int cn=a[ce];
    while(cn!=ce)
    {
        len++;
        cn=a[cn];
    }
    cn=1;
    while(cn!=ce)
    {
        k--;
        cn=a[cn];
        if(k==0)
        {
            cout<<cn<<endl;
            return 0;
        }
    }
    k=k%len;
    cn=ce;
    while(k>0)
    {
        cn=a[cn];
        k--;
    }
    cout<<cn<<endl;
}

Measured memory_bytes: 4764