akhauriyash/Code-Regression huggingface dataset:
//{
//    author: Manas Singh
//    created on Friday, 16 August, 2019 at 19:31:40 UTC+5:30
//    atdp1
//}

/*
    _____                                  _________ __               .__
   /     \ _____    ____ _____    ______  /   _____/|__| ____    ____ |  |____
  /  \ /  \__   \  /    \__  \  /  ___ /  \_____  \ |  |/    \  / ___\|  |  \  /
 /    Y    \/ __ \|   |  \/ __ \_\___ \   /        \|  |   |  \/ /_/  >   Y   /
 \____|__  (____  /___|  (____  /____  > /_______  /|__|___|  /\___  /|___|  /
         \/     \/     \/     \/     \/          \/         \//_____/      \/
*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define MOD 1000000007
#define inf 1e18 + 5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define __                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0)
#define vi vector<int>
#define vpii vector<pair<int, int>>
#define vvi vector<vector<int>>
#define rep(a, b, i) for (int i = a; i < b; i++)
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                    \
    sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
    {
sim > struct rge
{
    c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
    ~debug()
    {
        cerr << endl;
    }
    eni(!=) cerr << boolalpha << i;
    ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
    sim dor(const c &)
    {
        ris;
    }
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int, int> pii;

//-------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------

const int maxn = 100005;
int32_t main()
{
    __;
    int n;
    cin >> n;
    int arr[n + 1];
    rep(1, n + 1, i) cin >> arr[i];
    int dp[n + 1];
    dp[1] = 0;
    dp[2] = abs(arr[2] - arr[1]);
    rep(3, n + 1, i) dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp[i - 2] + abs(arr[i] - arr[i - 2]));
    cout << dp[n] << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,x,mn=1e9,m; cin>>n>>x;
	for (int i=0; i<n; i++) {
		cin>>m;
		x-=m;
		mn=min(mn,m);
	}
	cout << n + x/mn << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int N;
    int i, j;
    scanf("%d", &N);

    for (i = 1; i < 10; i++)
    {
        for (j = 1; j < 10; j++)
        {
            if(N == i * j)
            {
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");

    return 0;
}


Measured memory_bytes: 128
using System;

namespace abc166_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string s;
            s = Console.ReadLine();
            if (s.Equals("ABC"))
            {
                Console.WriteLine("ARC");
            }
            else
            {
                Console.WriteLine("ABC");
            }
        }
    }
}


Measured memory_bytes: 17380
gets.to_i.times do
  funds = gets.to_i
  years = gets.to_i
  oprs = []
  gets.to_i.times do
    oprs << gets.split(" ")
    oprs[-1][0] = oprs[-1][0].strip
    oprs[-1][1] = oprs[-1][1].to_f
    oprs[-1][2] = oprs[-1][2].to_i
  end

  max = 0
  oprs.each do |opr|
    now = funds
    int = 0
    years.times do
      int += ((now + (opr[0] == "0" ? 0 : int)) * opr[1]).to_i
      now -= opr[2]
    end
    max = [max, now + int].max
  end
  puts max
end

Measured memory_bytes: 6116
#include <iostream>
#include <vector>
using namespace std;
int root[100000], dis[100001];
int find(int x) {
  if (root[x] == x) {
    return x;
  }
  int old_root = root[x];
  root[x] = find(root[x]);
  dis[x] += dis[old_root];
  return root[x];
  //return root[x] = find(root[x]);
}
int main(void) {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) root[i] = i;
  vector<int> l(m), r(m), d(m);
  for (int i = 0; i < m; i++) {
    cin >> l[i] >> r[i] >> d[i];
  }
  bool flag = true;
  for (int i = 0; i < m; i++) {
    int parl = find(l[i]), parr = find(r[i]);
    if (parl == parr) {
      if (dis[r[i]] - dis[l[i]] != d[i]) flag = false;
    } else {
      root[parr] = parl;
      dis[parr] = dis[l[i]] - dis[r[i]] + d[i];
    }
  }
  if (flag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3328
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)n; ++i)

int main()
{
	int n;
	int sum;
	int a;

	while(true) {
		sum = 0;
		cin >> n;
		if(n == 0) break;

		for(int i = 0; i < n / 4; ++i) {
			cin >> a;
			sum += a;
		}

		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
from bisect import *

N, D, A = map(int, input().split())

data = []
for _ in range(N):
    x, h = map(int, input().split())
    data.append((x,h))
data.sort()

X = []
H = []
for x, h in data:
    X.append(x)
    H.append(h)

Imos = [0]*(N+1)
cnt = 0
damage = 0
res = 0
for i in range(N):
    damage -= Imos[i]*A
    h = H[i] - damage
    x = X[i]
    if h > 0:
        cnt = h//A + (h%A!=0)
        p = min(bisect_right(X, x+2*D)-1, N-1)
        Imos[p+1] += cnt
        damage = damage + cnt * A
        res += cnt
print(res)


Measured memory_bytes: 124980
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pii pair<int , int>
#define pll pair<long long int,long long int>
#define mod 1000000007
#define inf 1e18+7
#define eps 0.00001
#define endl '\n'
int main()
{
    fastio;
    
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    ll x=a[n-1]/2;
    ll min=inf,mini=-1,i=0;
    for(i=0;i<n-1;i++)
    {
        if(abs(x-a[i])<=min)
        {
            min=abs(x-a[i]);
            mini=i;
        }
    }
    cout<<a[n-1]<<" "<<a[mini];
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <algorithm>
#include <functional>
#define _USE_MATH_DEFINES
#include <math.h>
 
using namespace std;
 
int n, pos;
vector<int> pre, in, post;
 
void rec(int l, int r)
{
    if (l >= r)
    {
        return;
    }
    int root = pre[pos++];
    int m = distance(in.begin(), find(in.begin(), in.end(), root));
    rec(l, m);
    rec(m + 1, r);
    post.push_back(root);
}
 
void solve()
{
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        int k;
        cin >> k;
        pre.push_back(k);
    }
    for (int i = 0; i < n; ++i)
    {
        int k;
        cin >> k;
        in.push_back(k);
    }
    pos = 0;
    rec(0, pre.size());
    for (int i = 0; i < n; ++i)
    {
        if (i)
        {
            cout << " ";
        }
        cout << post[i];
    }
    cout << endl;
}
 
int main()
{
    solve();
    return(0);
}


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

int A[23], B[23];
set<int> s;
set<int>::iterator it;

int main() {
    int N, x, t = 0, r, i, j;
    scanf("%d", &N);
    if (N > 23) {printf("0\n"); return 0;}
    if (N == 23) {
        for (i = 0; i < N; ++i) scanf("%d", &A[i]);
        sort(A, A + N);
        for (i = 0; i < N; ++i) if (A[i] != i / 2 + 1) {printf("0\n"); return 0;}
        printf("1\n");
        return 0;
    }
    for (i = 0; i < N; ++i) scanf("%d", &A[i]);
    for (i = 0; i < (1 << N); ++i) {
        s.insert(0);
        s.insert(24);
        r = 24;
        for (j = 0; j < N; ++j) {
            x = (i & (1 << j)) ? 24 - A[j] : A[j];
            it = s.upper_bound(x);
            if (it == s.end()) {
                printf("0\n");
                return 0;
            }
            r = min(r, abs(*it - x));
            r = min(r, abs(x - *(--it)));
            s.insert(x);
        }
        s.clear();
        t = max(t, r);
    }
    printf("%d\n", t);
    return 0;
}


Measured memory_bytes: 256
s = input()
sum = 0
n = [i for i in s]
#print(n)
l = len(n)

for i in range(2 ** (l-1)):
    #注意!!実際の組み合わせの数をbitに直したら１つ数が落ちる。
    #組み合わせのループ
    s1 = []
    for j in range(l):
        #bitshift用のループ
        if 1  & i >> j:
            s1.append(n[j])
            s1.append('+')
        else:
            s1.append(n[j])
    s2 = ''
    for i in s1:
        s2 += i
    s2 = s2.split('+')
    sum1 = 0
    for c in s2:
        sum1 += int(c)
    #print(sum1, s1)
    sum += sum1

print(sum)


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

using namespace std;

int main() {
    int rounds;
    cin >> rounds;
    int pts_taro = 0, pts_hanako = 0;
    for (int r = 0; r < rounds; r++) {
        string taro, hanako;
        cin >> taro >> hanako;

        int compare = taro.compare(hanako);
        if (compare == 0) {
            pts_taro += 1;
            pts_hanako += 1;
        }
        else if (compare < 0) {
            pts_hanako += 3;
        }
        else {
            pts_taro += 3;
        }
    }

    cout << pts_taro << ' ' << pts_hanako << '\n';

    return 0;
}


Measured memory_bytes: 3164
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define All(v) (v).begin(),(v).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
int main(){
    int h, w;
    cin >> h >> w;
    string a[110];
    rep(i, h) cin >> a[i];
    string s = "";
    rep(i, w + 2) s += '#';
    cout << s << endl;
    rep(i, h)
    {
        cout << '#' << a[i] << '#' << endl;
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <queue>

using namespace std;


int main() {
	int n, m;
	cin >> n >> m;

	int x, y, z;

	vector<vector<int>> to(n);
	for (int i = 0; i < m; i++) {
		cin >> x >> y >> z;
		x--;
		y--;

		to[x].emplace_back(y);
		to[y].emplace_back(x);
	}

	int ans = 0;
	vector<bool> used(n, false);

	for (int i = 0; i < n; i++) {
		if (used[i]) {
			continue;
		}

		ans++;

		queue<int> que;
		que.push(i);
		used[i] = true;

		while (!que.empty()) {
			auto x = que.front();
			que.pop();

			for (auto y: to[x]) {
				if (!used[y]) {
					used[y] = true;
					que.push(y);
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 6520
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007

using namespace std;

int main(void) {
	long long int N;
	long long int p, q;
	cin >> N;

	
		FOR(i, 1, 3500) {
			FOR(t,i,3500) {
				p = i*t*N;
				q = 4 * i*t - i*N - t*N;
				if (q <= 0) {
					continue;
				}
				if (p % q == 0) {
					cout << i << " " << t << " " << p / q << endl;
					goto warp;
				}
				
			}
		}
	
	warp:
	return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val a = sc.nextLong()
  val b = sc.nextLong()
  val c = sc.nextLong()

  val abc = mutableListOf<Long>()
  abc.add(a)
  abc.add(b)
  abc.add(c)

  for (i in abc) {
    if (i % 2L == 0L) {
      println(0)
      return
    }
  }

  val sort = abc.sorted()
  val f = sort.get(0)
  val s = sort.get(1)
  val t = sort.get(2)

  val tmp = t / 2L

  val red = tmp * f * s
  val blue = (t - tmp) * f * s

  println(blue - red)

}


Measured memory_bytes: 39944
#include <iostream>

using namespace std;

int main() {
    int A,B,C,X;
    int count = 0;
    cin >> A >> B >> C >> X;

    for (int i=0; i<=A; i++) {
        for (int j=0; j<=B; j++) {
            for (int k=0; k<=C; k++) {
                if ((500 * i + 100 * j + 50 * k) == X) {
                    count++;
                }
            }
        }
    }

    cout << count << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <climits>
#include <cmath>

using namespace std;



long long int height[50], count_p[50];



int main(int argc, char *argv[])
{
	int t;
	int x;
	double ans = 0;
	//input
	cin >> t >> x;



	//calc
	ans = (double)t / x;

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


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
	int s;
	cin>>s;
	set<int> mySet;
	int n=1;
	vector<int> F;
	F.push_back(0);
	for (n=1;n<=1000000;n++){
		if (n%2==0){
			F.push_back(n/2);
		}else{
			F.push_back(3*n+1);
		}
	}
	int A=s;
	int m=1;
	set<int>::iterator sit; 
	while (true){
		mySet.insert(A);
		m++;
		A=F[A];
		sit=mySet.find(A);
		if (sit!=mySet.end()){
			cout<<m<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 6256
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split('\n');

let scores = [];

while (line = lines.shift()) {
    const numbers = line.split(' ').map(Number);
    const output = numbers;

    if(output.length === 1 && output[0] === 0) break;
    else if((output.length === 1 && output[0] > 0)) continue;
    else

    scores.push(output.sort((a, b) => a-b));
}

scores.forEach(list => {
	let temp = -1;

	list.forEach((item, index) => {
		try {
			const result= Math.abs(item - list[index + 1]);

			if(temp === -1) temp = result

			else if(temp > result) temp = result;
		} catch (e) {
			return;
		}
	});

	console.log(temp);
});


Measured memory_bytes: 19224
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
typedef vector<ll> vl;
#define rp(i, f, t) for (long long int i = f; i < t; i++)
#define pr(i, f, t) for (int i = t - 1; i >= f; i--)
#define ca(n, a) rp(ca_i, 0, n) cout << a[ca_i] << ((ca_i == n - 1) ? "\n" : " ")
#define za(n, a) rp(za_i, 0, n) a[za_i] = 0
#define be(a) a.begin(), a.end()
#define ce(a) cout << (a) << endl
int main()
{
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    ll mod = 1000000007;
    rp(i, k, n + 1)
    {
        ll hi = (n + n - i + 1) * (i) / 2;
        ll lo = ((i - 1) * i / 2);

        ans += hi - lo + 1;
        ans %= mod;
    }
    ce(ans + 1);
}

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

using namespace std;

int main()
{
    int A,B;
    cin >> A >> B;
    if (A == B){
        cout << 2*A << endl;
    }else if(A > B){
        cout << A + A - 1 << endl;
    }else{
        cout << B + B - 1 << endl;
    }
    
}


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

#define all(x) (x).begin(), (x).end()
#define make_unique(vec) sort(all(vec)); vec.resize(unique(all(vec)) - vec.begin());
#define dbg(x) cerr<<#x<<" = "<<x<<endl

using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

bool tests = false;

void solve(){
    int a, b, c, k; cin >> a >> b >> c >> k;

    if (k <= a){
        cout << k << endl;
        return;
    }
    if (k <= a+b){
        cout << a << endl;
        return;
    }
    cout << a - (k-a-b) << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    if (tests){
        cin >> t;
    }
    while (t--){
        solve();
    }
    return 0;
}


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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<long long>
#define inf 1000000100
#define infll 1LL << 50

int main()
{
    string s;
    cin >> s;
    bool rp = 0;
    map<int, int> mp;
    for(int i = 0; s[i]; i++)
    {
        if((++mp[s[i]-'a']) > 1)
        {
            rp = 1;
        }
    }
    if(rp)
    {
        cout << "no" << endl;
    }
    else
    {
        cout << "yes" << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    char o[51], e[51], ans[101] = "";
    scanf("%s %s", o, e);

    for(int i = 0; o[i] != '\0'; i++){
        sprintf(ans, "%s%c%c", ans, o[i], e[i]);
    }
    printf("%s\n", ans);
    return 0;
}

Measured memory_bytes: 128
n = int(input())
R = []
for i in range(n):
    r = int(input())
    R.append(r)

mins = [0] * n
mins[0] = float('inf')
for i in range(1, n):
    # the minimum value of R[:i]
    mins[i] = min(mins[i-1], R[i-1])

print(max(R[i] - mins[i] for i in range(n)))



Measured memory_bytes: 15176
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int n,u,v;
vector<int> g[100005];

void dfs(int now,vector<int> &vec,int step){
  if(vec[now] != -1) return;
  vec[now] = step;
  for(auto to:g[now]){
    if(to == now) continue;
    dfs(to,vec,step+1);
  }
}

int main(){
  cin >> n >> u >> v;
  u--;v--;
  vector<int> a_step(n,-1),b_step(n,-1);

  rep(i,n-1){
    int a,b; cin >> a >> b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  dfs(u,a_step,0);
  dfs(v,b_step,0);

  int ans = 0;

  rep(i,n){
    if(a_step[i] < b_step[i]) chmax(ans,b_step[i]);
  }

  ans--;
  printf("%d\n",ans);

  return 0;
}

Measured memory_bytes: 10368
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int R, G, B, N;
	
	cin >> R >> G >> B >> N;
	int count = 0;
	for (int i = 0; i <= N / R; i++)
	{
		for (int j = 0; j <= N / G; j++)
		{
			if ( (i* R + j*G <= N) && (N - i*R- j * G) % B == 0)
			{
				//cout << i << " " << j <<  " " <<(N - i*R- j * G) % B << " " << endl;
				count++;
			}
		}
	}

	cout << count << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		
		int ans = 0;
		if (a < b){
			if (b < c)
				ans = a * b / 2;
			else
				ans = a * c / 2;
		}
		else if (a < c)
			ans = a * b / 2;
		else
			ans = b * c / 2;
		
		System.out.println(ans);

	}

}

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


def solve(S: str):
    a = S[::2].count("1") + S[1::2].count("0")
    b = S[::2].count("0") + S[1::2].count("1")
    print(min(a, b))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <iostream>

using namespace std;

int a, b, c, d;

int main() {
	cin >> a >> b >> c >> d;
	if (a + b == c + d)
		cout << "Balanced";
	else if (a + b > c + d)
		cout << "Left";
	else
		cout << "Right";
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
N = int(input())
D, X = map(int,input().split())
A = [int(input()) for _ in range(N)]
cnt = 0
for a in A:
  for i in range(D):
    k = a * i + 1
    if(k <= D):
      cnt += 1
    else:
      break
print(cnt + X)

Measured memory_bytes: 3060
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

a,b,k=map(int,input().split())
ans=[]
for i in range(a,min(a+k,b+1)):
  ans.append(i)
for i in range(max(b-k+1,a),b+1):
  ans.append(i)
ans = sorted(list(set(ans)))
for i in ans:
  print(i)

Measured memory_bytes: 9196
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;


int main() {
    int n,k;
    cin >> n >> k;
    int ans = k;
    rep(i,n-1) {
        ans *= k-1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define ld long double
#define pb push_back

using namespace std;

const int N=2e5+5;

ll x,ans;

int main()
{
    cin >> x;
    for (ll i=63;i>-1;i--)
    {
        if ((1ll<<i)&x)
        {
            ans+=(1ll<<i);
            break;
        }
    }
    ans*=2ll;
    ans--;
    cout << ans << endl;
    return 0;
}



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

int main()
{
    int N;
    cin >> N;

    int ans = 0;
    int i = 0;
    while (true)
    {
        if (pow(2, i) > N)
        {
            break;
        }
        else
        {
            ans = pow(2, i);
            i++;
        }
    }

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll a,b;
  cin >> a >> b;
  if(a + b >= 10)cout << "error" << endl;
  else cout << a+b << endl;
}

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

int main() {
    int n;
    cin >> n;

    vector<string> s(n);
    rep(i, 0, n) cin >> s[i];

    int m;
    cin >> m;

    vector<string> t(m);
    rep(i, 0, m) cin >> t[i];

    map<string, int> mp;
    rep(i, 0, n) mp[s[i]]++;
    rep(i, 0, m) mp[t[i]]--;

    int ans = 0;
    for (auto e : mp) {
        ans = max(ans, e.second);
    }

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

Measured memory_bytes: 256
using System;

class A{
  public static void Main(){
    string[] Ar = Console.ReadLine().Split(' ');
    int a = int.Parse(Ar[0]);
    int b = int.Parse(Ar[2]);
    if (Ar[1] == "+") Console.WriteLine(a + b);
    else Console.WriteLine(a - b);
  }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#define INF 1000000007
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> P;

int main() {

	int a, b;
	cin >> a >> b;

	if (a > b) {
		cout << a-1 << endl;
	}
	else {
		cout << a  << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

ll dp[210][100002];

int main(){
    int n,x;
    cin >> n >> x;
    vector<int>s(n);
    rep(i,n)cin >> s[i];
    sort(s.begin(),s.end(),greater<int>());
    dp[0][x] = 1;
    rep(i,n){
        rep(j,100001){
            dp[i+1][j] += dp[i][j]*(n-1-i)%mod;
            dp[i+1][j] %= mod;
            dp[i+1][j%s[i]] += dp[i][j];
            dp[i+1][j%s[i]] %= mod;
        }
    }
    ll ans = 0;
    rep(j,100001){
        ans += dp[n][j] * j %mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 157184
/*
    When you are not practicing someone else is,
    and the day u meet them u will Lose.

    So, all you need is Practice, Practice and Practice.
*/
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,a,b)       for(i=a;i<=b;i++)
#define FOR(i,a,b)      for(i=a;i>=b;i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define sz(v)           (int)v.size()
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p) {int ans=1;x%=mod;while(p>0){if(p&1)ans=(ans*x)%mod;p=p>>1;x=(x*x)%mod;}return ans;}
int inv(int x){return po(x,mod-2)%mod;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
/**********************************************************************************/



const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r,f,q;








void sol()
{   
    cin>>n;
    in(a,n);
    int ans=0,sm=0;
    FOR(i,n-1,0)
    {
        ans=(ans+a[i]*sm)%mod;
        sm=(sm+a[i])%mod;
    }
    
    
    
    cout<< ans <<endl;
}





int32_t main()
{   
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //pre();
    //sp(10);
    // w(t)
    sol();
    return 0;
}


Measured memory_bytes: 4784
//package cp;
import java.util.*;
import java.io.*;
public class Main {
	long gcd(long a,long b) {if(b==0)return a;else return gcd(b,a%b);}
	void swap(long a,long b) {long temp=a;a=b;b=temp;}
	StringBuilder sb=new StringBuilder();
	Integer[] ARR=new Integer[5];
	//Integer sort-TLE-Initialize object elements i.e a[0].
	long ceil(int n) {return (long)Math.ceil(1.0*n/2);}
	void divisor(long n,int start) {
		int cnt=0;for(int i=start;i<=Math.sqrt(n);i++) {
		if(n%i==0) {if(i==n/i)cnt++;else cnt+=2;}}}
	
	public static void main(String[] args) throws IOException {	
		PrintWriter out = new PrintWriter(System.out);
		Readers.init(System.in);
		Main obj=new Main();
		String s=Readers.next();
		int x=0;int o=0;
		for (int i = 0; i < s.length(); i++) {
			if(s.charAt(i)=='o')o++;
			else x++;
		}
		int n=s.length();
		if(o+(15-n)>=8)System.out.println("YES");
		else System.out.println("NO");
		out.flush();
	}

}
class Readers {
 
    static BufferedReader reader;
 
    static StringTokenizer tokenizer;
 
 
 
    /** call this method to initialize reader for InputStream */
 
    static void init(InputStream input) {
 
        reader = new BufferedReader(
 
                     new InputStreamReader(input) );
 
        tokenizer = new StringTokenizer("");
 
    }
 
 
 
    /** get next word */
 
    static String next() throws IOException {
 
        while ( ! tokenizer.hasMoreTokens() ) {
 
            //TODO add check for eof if necessary
 
            tokenizer = new StringTokenizer(
 
                   reader.readLine() );
 
        }
 
        return tokenizer.nextToken();
 
    }
 
 
 
    static int nextInt() throws IOException {
 
        return Integer.parseInt( next() );
 
    }
 
	
 
    static double nextDouble() throws IOException {
 
        return Double.parseDouble( next() );
 
    }
    
    
    static long nextLong() throws IOException{
    	
		return Long.parseLong(next());
	}
 
}


Measured memory_bytes: 32828
def chousa(b):
    poped = ["x"]*len(b)
    a = []
    isnt_sorted = len(b)
    for i,v in enumerate(b[::-1]):
        if len(b)-i < v:
            print(-1)
            return

    while isnt_sorted:
        for i,v in enumerate(b[::-1]):
            if v == 1 and poped[len(b)-i-1] == "x":
                a.insert(v-1, [len(b)-i,v])
                poped[len(b)-i-1] = "o"
                isnt_sorted -= 1
                break
            elif len(a) >= v-1 and a[v-2][0] < len(b)-i and poped[len(b)-i-1] == "x":
                a.insert(v-1, [len(b)-i,v])
                poped[len(b)-i-1] = "o"
                isnt_sorted -= 1
                break

        print(v)
def main():
    N = int(input())
    b = list(map(int,input().split()))
    chousa(b)
if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
 
    using namespace std;
    using namespace __gnu_pbds;
 
    #define endl "\n"
    #define fi first
    #define se second
    #define pb push_back
    #define int long long
    #define ll long long
    #define ld long double
    #define pii pair<ll,ll>
 
    #define read(t) ll t;cin>>t;
    #define all(x) x.begin(),x.end()
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define For(i,n) for(ll i=0;i<n;i++)
 
    #define what(x) cerr << #x << " is " << x << endl;
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;
 
    typedef tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> omultiset;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> oset;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> oset1;
 
/*.....................................................................................................................*/
 
    const ll mod=(ll)1e9+ 7;
 
    ll add(ll x,ll y) {return (x+y)%mod;}
    ll mult(ll x, ll y){return ((x%mod )* (y%mod)) % mod;}
 
    long long binpow(long long x, long long p) 
    {
        if (p == 0) {return 1;} 
    	if (p == 2 || (p & 1)) {return mult(x, binpow(x, p - 1));}
    	return binpow(binpow(x, p / 2), 2);
    }
    ll modinv(ll a) {return binpow(a,mod-2);}
 
    //A.erase(unique(A.begin(),A.end()),A.end());
    double pi=3.141592653589793238462641;
    ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
    const ll  man  =   (int)200005 ,  inf   =   1e18;
 
 
/*......................................................................................................................*/



signed main()
{
    fast;
    int n;
    cin>>n;
    cout<<(1000-n%1000)%1000<<endl;
}   

Measured memory_bytes: 3660
#include <stdio.h>
int n, m, x, y, z;
#define U_Fsize 200000
int U_Fx[U_Fsize];
int U_Fs[U_Fsize];
int U_Fq[U_Fsize];
int U_Ff;
int root(int U_Fc) {
	if (U_Ff == 0) {
		for (int i = 0; i < U_Fsize; i++) {
			U_Fx[i] = -1;
			U_Fs[i] = -1;
		}
		U_Ff = 1;
	}
	int U_Ft = 0;
	while (U_Fx[U_Fc] >= 0) {
		U_Fq[U_Ft] = U_Fc;
		U_Fc = U_Fx[U_Fc];
		U_Ft++;
	}
	for (int i = U_Ft - 2; i >= 0; i--) {
		U_Fx[U_Fq[i]] = U_Fc;
	}
	return U_Fc;
}
void merge(int U_Fa, int U_Fb) {
	U_Fa = root(U_Fa);
	U_Fb = root(U_Fb);
	if (U_Fa == U_Fb)return;
	if (U_Fx[U_Fa] < U_Fx[U_Fb]) {
		U_Fs[U_Fa] += U_Fs[U_Fb];
		U_Fx[U_Fb] = U_Fa;
	}
	else if (U_Fx[U_Fa] == U_Fx[U_Fb]) {
		U_Fx[U_Fa]--;
		U_Fs[U_Fa] += U_Fs[U_Fb];
		U_Fx[U_Fb] = U_Fa;
	}
	else {
		U_Fs[U_Fb] += U_Fs[U_Fa];
		U_Fx[U_Fa] = U_Fb;
	}
}
int bu(int U_Fd) {
	U_Fd = root(U_Fd);
	return -U_Fs[U_Fd];
}
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &x, &y);
		merge(x - 1, y - 1);
	}
	for (int i = 0; i < n; i++) {
		if (z < bu(i))z = bu(i);
	}
	printf("%d\n", z);
}

Measured memory_bytes: 3296
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define NIL NULL

int key;
struct node{
  int key;
  struct node *left;
  struct node *right;
  struct node *parent;
};
  typedef struct node * Node;

Node Tree;

 void insert(int k){
   Node y = NIL;
   Node x = Tree;
   Node z;

   z = malloc(sizeof(struct node));
   z->key  = k;
   z->left = NIL;
   z->right = NIL;

   while(x != NIL){
     y = x;
     if(z->key < x->key){
       x = x->left;
     }
     else{
       x = x->right;
     }
   }
     z->parent = y;

     if( y == NIL){
       Tree = z;
     }
     else if( z->key < y->key ){
       y->left = z;
     }
     else{
       y->right = z;
     }
 }

     void InOrder(Node T){
       if(T == NIL) return;
	 InOrder(T->left);
	 printf(" %d", T->key);
	 InOrder(T->right);
       }
     

       void PreOrder(Node T){
	     if(T == NIL) return;
	   printf(" %d", T->key);
	   PreOrder(T->left);
	   PreOrder(T->right);
	 }
       
      
int main(){
  int i,x,n;
  char c[5];

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%s", c);
    if(strcmp(c,"insert")==0){
      scanf("%d", &x);
      insert(x);
    }

    else if(strcmp(c,"print")==0){
      if(Tree != NIL){
	InOrder(Tree);
      }
	printf("\n");
	if(Tree != NIL){
	PreOrder(Tree);
	}
	printf("\n");
    }
  }

  return 0;
}

Measured memory_bytes: 24040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define gcd(a,b)   __gcd(a,b)
#define lcm(a,b)   (a*b)/gcd
#define rep(i,n)   for(int i=0;i<n;i++)
#define Rep(i,n)   for(int i=1;i<=n;i++)
#define REP(i,j,n) for(int i=j;i<=n;i++)
#define fast   ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)


int main()
{ 
	fast;
	ll n,m;
	cin>>n>>m;
	ll maxi=max(n,m);
	ll mini=min(n,m);
	for(int i=1;i<=maxi;i++){
		cout<<mini;
	}
	cout<<endl;
	return 0;

}

Measured memory_bytes: 3648
#include <stdio.h>

int main(){
  int n,A[100],i,j,x,temp,c=0;

  scanf("%d",&n);

  for(i=0 ; i<n ; i++){
    scanf("%d",&A[i]);
  }

  for(i=0 ; i<n-1 ; i++){
     x=i;
    for(j=i ; j<n ; j++){
      if(A[j] < A[x])x=j;
    }
    if(x!=i){
      temp=A[i];
      A[i]=A[x];
      A[x]=temp;
      c++;
    }
  }

  for(i=0 ; i<n ; i++){
    printf("%d",A[i]);
    if(i!=n-1) printf(" ");
  }

  printf("\n");
  printf("%d\n",c);
  
  return 0;
}

  



Measured memory_bytes: 2732
class Heap
  attr_accessor :data, :size

  def initialize
    @data=[]
  end

  def push(e)
    @data.push(e)

    cur = @data.size-1
    return if cur.zero?
    parent_i = parent(cur)

    while cur > 0 && @data[cur] < @data[parent_i]
      parent = @data[parent_i]
      @data[parent_i] = e
      @data[cur] = parent
      cur = parent_i
      parent_i = parent(cur)
    end
  end

  def pop
    ret = data.first
    last = data.last
    cur = 0
    while left_i(cur) < data.size
      li = left_i(cur)
      l = data[li]
      ri = right_i(cur)
      r = data[ri]

      ni=li
      ni = ri if ri < data.size && r < l

      break if data[ni] >= last

      data[cur] = data[ni]
      cur = ni
    end

    data[cur]=last
    data.pop

    ret
  end

  def left_i(i)
    2*i+1
  end

  def right_i(i)
    2*i+2
  end

  def parent(i)
    return 0 if i.zero?
    (i-1)/2
  end
end

n = gets.strip.to_i
aa = gets.strip.split.map(&:to_i)

left_h = Heap.new
right_h = Heap.new
n.times do |i|
  left_h.push(aa[i])
  right_h.push(-aa[2*n+i])
end

left_score = left_h.data.inject(:+)
left_scores = [left_score]
right_score = right_h.data.inject(:+)
right_scores = [-right_score]

n.times do |i|
  c_l = aa[n+i]
  if c_l >= left_h.data.first
    left_h.push(c_l)
    left_score += c_l
    left_score -= left_h.pop
  end
  left_scores.push(left_score)

  c_r = -aa[2*n-1-i]
  if c_r >= right_h.data.first
    right_h.push(c_r)
    right_score += c_r
    right_score -= right_h.pop
  end
  right_scores.unshift(-right_score)

end

#p left_scores.zip(right_scores)
#p left_scores.zip(right_scores).map {|l, r| l-r }
p left_scores.zip(right_scores).map {|l, r| l-r }.max



Measured memory_bytes: 34872
import itertools as ite

n,m,q = map(int,input().split())
a,b,c,d = [],[],[],[]
for i in range(q):
    aa,bb,cc,dd = map(int,input().split())
    a.append(aa)
    b.append(bb)
    c.append(cc)
    d.append(dd)

# subscritableとかcollableのとき、すでに使ってる変数に注意！
combs = ite.combinations_with_replacement([i for i in range(1,m+1)], n)
scores = []
for arr in combs:
    arr = list(arr)
    score = 0
    for i in range(q):
        aa,bb,cc,dd = a[i]-1,b[i]-1,c[i],d[i]
        if arr[bb]-arr[aa] == cc : score += dd
    scores.append(score)

ans = max(scores)
print(ans)




Measured memory_bytes: 12688
package main
import (
	"bufio"
	"fmt"
	"os"
)

var r = bufio.NewReader(os.Stdin)

func main() {
	var x, y int
	fmt.Fscan(r, &x)
	fmt.Fscan(r, &y)
    ans := x * y
    ans2 := x*2 + y*2
	fmt.Println(ans ,ans2)
}


Measured memory_bytes: 1140
s = int(input())

def f(n):
    if n % 2 == 0:
        return n // 2
    else:
        return 3 * n + 1

se = set()
se.add(s)

i = 2
a = s
while True:
    a = f(a)
    if a in se:
        print(i)
        break
    se.add(a)
    i += 1


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

int main() {
	string S;
	cin >> S;
	if (S == "RRR") cout << 3 << endl;
	else if (S == "RRS" || S == "SRR") cout << 2 << endl;
	else if (S == "RSS" || S == "SRS" || S == "SSR" || S == "RSR") cout << 1 << endl;
	else cout << 0 << endl;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;
typedef pair<int,int> ii;

// A

void solve() {

}

int main() {
  int n;
  cin >> n;
  ll v = 0;
  while( v < n ) {
    v = v + 1000;
  }
  cout << v - n << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main(void){
	int i,x;
	x = 1;

	for(i=1;i<=10000;i++){
		while(x != 0){
			scanf("%d",&x);
				if(x != 0){
					printf("Case %d: %d\n",i++,x);
				}
				else{
					break;
				}
		}
	}

	return 0;
}

Measured memory_bytes: 2664
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    vector<int> A(10);
    for(int i = 0; 10 > i; i++){
        cin>>A[i];
    }
    sort(A.begin(),A.end(),greater<int>());
    for(int i = 0; 3 > i; i++){
        cout << A[i] << endl;
    }
}


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

#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define dforn(i,n) for(int i=int(n-1);i>=0;i--)
#define forn(i,n) for(int i=0;i<int(n);i++)
#define D(a) cerr << #a << " = " << a << endl
#define all(a) a.begin(),a.end()
#define si(a) int((a).size())
typedef pair<int,int> pii;
typedef long long int ll;
typedef vector<int> vi;
#define pb emplace_back
#define mp make_pair
#define snd second
#define fst first

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    
    int n,r; cin >> n >> r;
    cout << r + (n >= 10 ? 0 : 100*(10-n)) << endl;
    return 0;
}


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

int main() {
    int c[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c[i][j];
        }
    }
    for (int i = 0; i < 2; i++) {
        set<int> s;
        for (int j = 0; j < 3; j++) {
            s.insert(c[i][j] - c[i + 1][j]);
        }
        if (s.size() > 1){
            cout << "No" << endl;
            return 0;
        }
    }
    for (int i = 0; i < 2; i++) {
        set<int> s;
        for (int j = 0; j < 3; j++) {
            s.insert(c[j][i] - c[j][i + 1]);
        }
        if (s.size() > 1) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var h, w int
	fmt.Scan(&h, &w)
	ar := make([]string, h)
	for i := range ar {
		fmt.Scan(&ar[i])
	}
	vh := []int{-1, 1, 0, 0}
	vw := []int{0, 0, -1, 1}
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if ar[i][j] == '.' {
				continue
			}
			ng := true
			for k := 0; k < 4; k++ {
				r := i + vh[k]
				c := j + vw[k]
				if 0 <= r && r < h && 0 <= c && c < w {
					if ar[r][c] == '#' {
						ng = false
						break
					}
				}
			}
			if ng {
				fmt.Println("No")
				return
			}
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 512
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int ans = 7;
	REP(i, 3) {
		char c;
		cin >> c;
		if (c == 'o')ans++;
	}
	cout << ans * 100 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    string s,t;
    cin >> s >> t;
    ll cnt = INF;
    ll x = s.size(), y = t. size();
    for (ll i = 0; i <= x - y; i++) {
        ll tmp = y;
        string u = s.substr(i, y);
        for (ll j = 0; j < y;j++){
            if (u[j] == t[j]) tmp--;
        }
        chmin(cnt, tmp);
    }

            cout << cnt << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define rall(x) (x).rbegin(), (x).rend()
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;
const int mod = 1e9 + 7;

int main(){
    ll n,c; cin >> n >> c;
    vvl v(c,vl(100005,0));
    rep(i,n){
        ll s,t,d; cin >> s >> t >> d;
        d--;
        v[d][s]++;
        v[d][t+1]--;
    }
    rep(i,c){
        rep(j,100001){
            v[i][j+1] += v[i][j];
        }
    }
    ll ans = 0;
    rep(j,100001){
        ll sum = 0;
        rep(i,c) sum += v[i][j]>=1 ? 1 : 0;
        ans = max(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 24576
#include <stdio.h>

int main(void){
    long long N,ans;
    scanf("%lld",&N);
    long long MOV[5];
    long long min=1000000000000001;
    for (int i=0;i<5;i++){
        scanf("%lld",&MOV[i]);
        if(MOV[i]<min){
            min = MOV[i];
        }
    }
    ans=N/min;
    if(N%min!=0)ans++;
    printf("%lld",ans+4);
}



Measured memory_bytes: 128
#include <queue>
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define set0(x) memset(x,0,sizeof(x))
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef vector<int> vi;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();int f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
int n,a,b,rv[200010];
void gen(int n,int v[],int req,vi cr){
	if(n == 0)return;
	if(req == 1){
		gen(n-1,v,req,cr);
		for(int i=1<<(n-1);i<1<<(n);i++)v[i]=v[(1<<(n-1))-1]^(1<<cr[n-1]);
		gen(n-1,v+(1<<(n-1)),req,cr);
	}else{
		gen(n-1,v,req-2,cr);
		for(int i=1<<(n-1);i<1<<(n);i++)v[i]=v[(1<<(n-1))-1]^(1<<cr[n-1]);
		vi nr = cr;
		nr[n-2] = cr[n-req];
		nr[n-req] = cr[n-2];
		gen(n-1,v+(1<<(n-1)),1,nr);
	}
}
int main() {
	read(n);read(a);read(b);
	if((__builtin_popcount(a^b)&1) == 0){cout<<"NO"<<endl;return 0;}
	vi cr;
	for(int i=0;i<n;i++)if(!((1<<i)&(a^b)))cr.push_back(i);
	for(int i=0;i<n;i++)if((1<<i)&(a^b))cr.push_back(i);
	
	gen(n,rv,__builtin_popcount(a^b),cr);
	cout<<"YES"<<endl;
	for(int i=0;i<1<<n;i++)cout<<(a^rv[i])<<' ';
	cout<<endl;
	return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#include<set>
#include<map>
#include<bitset>
#define rep(i,a,b)  for(i=a;i<b;i++)
#define itrep(at)	for(auto it=at.begin();it!=at.end();it++)
#define lli long long int
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define db double
#define M 1000000007
#define pi 3.1415926535897932384626433832795028841971
#define INF 1e18

#define MAX 1000005

using namespace std;
lli min(lli a,lli b){return a<b?a:b;}
lli min(lli a,lli b,lli c){a=min(a,b);a=min(a,c);return a;}
lli max(lli a,lli b){return a>b?a:b;}
lli max(lli a,lli b,lli c){a=max(a,b);a=max(a,c);return a;}
lli dsum(lli n){lli ans=0;while(n){ans+=(n%10);n/=10;}return ans;}
lli power(lli a,lli b){lli res=1;while(b){if(b&1) res=res*a;a=a*a;b>>=1;}return res;}

struct pll{
	lli x,y;
};
bool comp(pll a,pll b){
	if(a.x==b.x)	return a.y<b.y;
	else	return a.x<b.x;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	char ch;
	db aa,bb,cc;
	string s1,s2,s3,str;
    lli i,j,k,a,b,c,n,m,sum=0,ans=0,temp,t;
	cin>>n;
	a=n%10;
	n/=10;
	b=n%10;
	n/=10;
	if(a==7||b==7||n==7)	cout<<"Yes";
	else	cout<<"No";
    
    
    return 0;
}





















/* UJJWAL KESHRI */

Measured memory_bytes: 3644