akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    long long A, B, N, ans = 0, x;
    cin >> A >> B >> N;
    if(N >= B - 1) x = B - 1;
    else x = N;
    ans = A * x / B;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
//abc141_d.cpp
//Sun Sep 15 20:57:58 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	priority_queue<ll> pq1; //大きい順

	for (int i=0;i<n;i++){
		ll temp;
		cin >> temp;
		pq1.push(temp);
	}

	for (int i=0;i<m;i++){
		ll temp = pq1.top(); pq1.pop();
		temp = temp/2;
		pq1.push(temp);
	}

	ll ans = 0;
	for (int i=0;i<n;i++){
		ll temp = pq1.top();pq1.pop();
		ans += temp;
	}

	cout << ans << endl;
}

Measured memory_bytes: 1528
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int n; cin >> n;
  cout << n*(n+1)/2 << endl;
  system("pause");
}

Measured memory_bytes: 504
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

x,k,d=nii()

dist=abs(x)

num=dist//d

if num>k:
  print(abs(dist-d*k))
  exit()
else:
  k-=num
  dist1=dist-d*num

  if k>=1:
    dist2=abs(dist1-d)
    if dist2<=dist1:
      k-=1
      dist1=dist2

if k%2==0:
  print(dist1)
else:
  print(min(abs(dist1+d),abs(dist1-d)))

Measured memory_bytes: 9152
#include<bits/stdc++.h>
using namespace std;
const int maxn=4005;
int nr[maxn],ng[maxn],nb[maxn];
char s[maxn];
int main(){
	int n;
	scanf("%d",&n);
	scanf("%s",s+1);
	for(int i=n;i>=1;i--){
		nr[i]+=nr[i+1];
		nb[i]+=nb[i+1];
		ng[i]+=ng[i+1];
		if(s[i]=='R')nr[i]++;
		if(s[i]=='G')ng[i]++;
		if(s[i]=='B')nb[i]++;
	}
	long long ans=0;
	for(int i=1;i<=n-2;i++){
		for(int j=i+1;j<=n-1;j++){
			if(s[i]=='R'){
				if(s[j]=='G')ans+=nb[j];
				if(s[j]=='B')ans+=ng[j];
				if(j-i+j<=n&&s[j-i+j]!=s[j]&&s[j]!=s[i]&&s[j-i+j]!=s[i])ans--;
			}
			if(s[i]=='G'){
				if(s[j]=='R')ans+=nb[j];
				if(s[j]=='B')ans+=nr[j];
				if(s[j]!=s[i]&&j-i+j<=n&&s[j-i+j]!=s[j]&&s[j-i+j]!=s[i])ans--;
			}
			if(s[i]=='B'){
				if(s[j]=='G')ans+=nr[j];
				if(s[j]=='R')ans+=ng[j];
				if(s[j]!=s[i]&&j-i+j<=n&&s[j-i+j]!=s[j]&&s[j-i+j]!=s[i])ans--;
			}
		}
	}
	printf("%lld\n",ans);
} 

Measured memory_bytes: 3848
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long int ll;
#define MAX_N 100001



int main()
{
	char ch;
	cin>>ch;
	int num = ch;
	if( 'a' <= ch && ch <= 'z'){
		cout<<"a"<<endl;
	}else{
		cout<<"A"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3032
#include<cstdio>
#define Powered using
#define by namespace
#define Wshine std;
Powered by Wshine

int a,b;
int muti (double c,double d)
{
	double x=(c+d)/2.0;
	if(x<((a+b)/2+0.5))
	{
		return (a+b)/2;
	}
	else
	{
		return (a+b)/2+1;
	}
}

int main()
{
	scanf("%d %d",&a,&b);
	printf("%d",muti(a,b));
	return 0;
}

Measured memory_bytes: 128
N = (input())
a = list(map(int, input().split()))
f_count = 0
t_count = 0
for i in range(len(a)):
    if a[i]%4 == 0:
        f_count += 1
    elif a[i]%2 == 0:
        t_count += 1

if t_count < 2:
    if (2 * f_count  >= len(a)-1):
        print('Yes')
    else:
        print('No')
else:
    if (2 * f_count  >= len(a) - t_count):
        print('Yes')
    else:
        print('No')

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

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

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

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

// vars
int n, m;
vector<lint> h;
vector<plint> p;

void input(){
    cin >> n >> m;
    h.resize(n);
    p.resize(m);
    REP(i, n){
        cin >> h[i];
    }
    REP(i, m){
        cin >> p[i].fst >> p[i].snd;
        p[i].fst--;
        p[i].snd--;
    }
}

void solve(){
    vector<int> check(n, 1);
    REP(i, m){
        lint a = p[i].fst;
        lint b = p[i].snd;
        if(h[a] == h[b]){
            check[a] = 0;
            check[b] = 0;
        }
        else if(h[a] > h[b]){
            check[b] = 0;
        }
        else {
            check[a] = 0;
        }
    }
    int ans = 0;
    REP(i, n){
        ans += check[i];
    }
    cout << ans << endl;
}


int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 5476
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#include <iostream> 
using namespace __gnu_pbds; 
using namespace std; 
#include<bits/stdc++.h>
#define int long long
#define pb push_back 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define repa(i,a,b) for (int i=a; i<=b; i++)
#define repd(i,b,a) for (int i=b; i>=a; i--)
#define endl "\n"
typedef tree<int, null_type, less<int>, 
rb_tree_tag, tree_order_statistics_node_update> pbset; 
//debugging
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

const int N = 1e+6+5;
int big = 1e+18+3;
int mod = 1e+9+7;

signed main()
{
    IOS;
    int x; cin>>x;
  	if (x>=30)
      cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

int main() {
    int N;
    string S;
    cin >> N >> S;
    ll cnt1 = 0, cnt2 = 0, cnt3 = 0;
    rep(i, N) {
        if (S[i] == 'R')
            cnt1++;
        if (S[i] == 'G')
            cnt2++;
        if (S[i] == 'B')
            cnt3++;
    }

    ll sum = cnt1 * cnt2 * cnt3;
    ll dummy = 0;
    rep(i, N) {
        for (int j = i + 1; j < N; j++) {
            if (S[i] == S[j])
                continue;
            int k = 2 * j - i;
            if (k > j && k < N && S[k] != S[i] && S[k] != S[j])
                dummy++;
        }
    }

    ll res = sum - dummy;

    cout << res << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    ll m = 0;
    ll sum = 0;
    for(int i = 0; i < n; i++){
        sum += a[i];
        m = max(a[i],m);
    }

    cout << sum - (m/2) << endl;
    
    return 0;
}

Measured memory_bytes: 256
for _ in range(int(input())):
	n=int(input())
	print(sum([n**j*[[0,765144583,346175634,347662323,5655049,184117322,927321758,444014759,542573865,237315285,417297686,471090892,183023413,660103155,727008098,869418286],[539588932,729548371,700407153,404391958,962779130,184117322,927321758,444014759,542573865,237315285,417297686,471090892,183023413,660103155,727008098,869418286]][n&1][j]for j in range(16)])%(10**9+7))

Measured memory_bytes: 73264
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define mod 998244353
#define inf 10000000000000007
#define all(vec) vec.begin(),vec.end()
#define ggr getchar(); getchar();return 0;
#define ll long long
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

class Union_Find {
private:
	int par[200010], rankk[200010];
public:
	void init(int n) {
		rep(i, n) {
			par[i] = i;
			rankk[i] = 0;
		}
	}

	int find(int x) {
		if (par[x] == x)return x;
		else {
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;

		if (rankk[x] < rankk[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (rankk[x] == rankk[y])rankk[x]++;
		}
	}

	bool same(int x, int y) {
		return find(x) == find(y);
	}

};

int n, k, l, p[100010], q[100010], a[100010], b[100010];
map<pair<int, int>, int> mp;

signed main() {
	cin >> n >> k >> l;
	Union_Find ta, mu;
	ta.init(n + 1);
	mu.init(n + 1);
	rep(i, k) {
		cin >> p[i] >> q[i];
		ta.unite(p[i], q[i]);
	}
	rep(i, l) {
		cin >> a[i] >> b[i];
		mu.unite(a[i], b[i]);
	}
	for (int i = 1; i <= n; i++) {
		mp[make_pair(ta.find(i), mu.find(i))]++;
	}
	for (int i = 1; i <= n; i++) {
		if (i == n) {
			cout << mp[make_pair(ta.find(i), mu.find(i))] << endl;
			return 0;
		}
		else cout << mp[make_pair(ta.find(i), mu.find(i))] << " ";
	}
}


Measured memory_bytes: 16640
<?php
 fscanf(STDIN,"%s",$s);
 $front = substr($s,0,2);
 $back = substr($s,-2,2);
 
 if(($front>=1 && $front<=12) && ($back>=1 && $back<=12)){
   	echo "AMBIGUOUS";
 }elseif($front>=1 && $front<=12){
   	echo "MMYY";
 }elseif($back>=1 && $back<=12){
   	echo "YYMM";
 }else{
   	echo "NA";
 }
 

Measured memory_bytes: 16188
#include "bits/stdc++.h"
using namespace std;

int main(){
  int A,B,C,D,E,F;
  cin >> A >> B >> C >> D >> E >> F;

  set<int> waters, sugars;
  for( int i = 0; i <= 30; i++){
    for(int j = 0; j <= 30; j++){
      //if(i == 0 && j == 0) continue;
      int x = (100 * A * i) + (100 * B * j);
      if(x <= F){
        waters.insert(x);
      }
    }
  }

  for(int i = 0; i <= F ; i++){
    for(int j = 0; j <= F ; j++){
      //if(i == 0 && j == 0) continue;
        int y = (i * C) + (j * D);
        if(y <= F){
          sugars.insert(y);
        }
    }
  }

  int max_sum = 0;
  int max_sugar = 0;
  double max_per = -1.0;
  for (int x : waters){
    for (int y : sugars){
      int sum = x + y;
      if(sum > F) continue;
      double per = 100.0 * y / sum;
      if(y <= E * x / 100){
        if(per > max_per){
          //cout << sum << " " << y << endl;
          max_sum = sum;
          max_sugar = y;
          max_per = per;
        }
      }
    }
  }

  cout << max_sum << " " << max_sugar << endl;

}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    int N;cin>>N;
    int count=0;
    rep(i,N){
        int a;cin>>a;
        if(a%2 or (a%3==0 or a%5==0))count++;
    }
    if(count==N)cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
   int n,s,t;
   int num;
   while(scanf("%d%d%d",&n,&s,&t)&&(n+s+t))
      {
           num=0;
        for(int i=1;i<=(1<<n);i++)
          {
             int sum=0,res=0;
            for(int j=1;j<=n;j++)
               {
                   if(i&(1<<(j-1)))
                          {
                               res++;
                               sum+=j;
                           }
                }
           if(res==s&&sum==t)  num++;
            }
            cout<<num<<endl;
       }
      return 0;
}

Measured memory_bytes: 1208
#include <stdio.h>          // printf(), scanf()
#include <string.h>         // memcpy()

#define MAX_N 500000
#define SENTINEL 2000000000

int l[MAX_N / 2 + 2], r[MAX_N / 2 + 2];
int count;

void
merge(int a[], int left, int mid, int right)
{
	int i, j, k;

	const int n1 = mid - left;
	const int n2 = right - mid;
	memcpy(l, &a[left], sizeof(int) * n1);
	memcpy(r, &a[mid], sizeof(int) * n2);

	l[n1] = SENTINEL;
	r[n2] = SENTINEL;

	i = 0, j = 0;
	for (k = left; k < right; ++k)
	{
		count++;
		if (l[i] <= r[j])
			a[k] = l[i++];
		else
			a[k] = r[j++];
	}
}

void
mergesort(int a[], int left, int right)
{
	if (left + 1 < right)
	{
		int mid = (left + right) / 2;
		mergesort(a, left, mid);
		mergesort(a, mid, right);
		merge(a, left, mid, right);
	}	
}

int
main(int argc, char** argv)
{
	int a[MAX_N];
	int n;
	int i;

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

	count = 0;
	mergesort(a, 0, n);

	for (i = 0; i < n; ++i)
		printf("%d%c", a[i], (i != n - 1) ? ' ' : '\n');

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

Measured memory_bytes: 4520
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var Instance = new Question();
			Instance.Exec();
		}
	}

	public class Dice
	{
		public static int[] Label = new int[6];

		public static void East()
		{
			int label = Label[0];
			Label[0] = Label[3];
			Label[3] = Label[5];
			Label[5] = Label[2];
			Label[2] = label;
		}

		public static void West()
		{
			int label = Label[0];
			Label[0] = Label[2];
			Label[2] = Label[5];
			Label[5] = Label[3];
			Label[3] = label;
		}

		public static void North()
		{
			int label = Label[0];
			Label[0] = Label[1];
			Label[1] = Label[5];
			Label[5] = Label[4];
			Label[4] = label;
		}

		public static void South()
		{
			int label = Label[0];
			Label[0] = Label[4];
			Label[4] = Label[5];
			Label[5] = Label[1];
			Label[1] = label;
		}
	}

	public class Question
	{
		public void Exec()
		{
			Dice dice = new Dice();
			var array = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
			for (var i = 0; i < 6; ++i) {
				Dice.Label[i] = array[i];
			}

			string str =Console.ReadLine();
			for (var i = 0; i < str.Length; ++i) {
				switch (str[i]) {
					case 'E':
					default:
						Dice.East();
						break;
					case 'N':
						Dice.North();
						break;
					case 'S':
						Dice.South();
						break;
					case 'W':
						Dice.West();
						break;
				}
			}

			Console.WriteLine($"{Dice.Label[0]}");

			Console.ReadKey();
		}
	}
}


Measured memory_bytes: 20412
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long sum = 1;
		for (int i = 1; i <= n; i++) {
			sum = sum * i % 1000000007;
		}
		
		System.out.println(sum);
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int INF=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=2e5+7;

int L,n=1,m=0,a[22],l=0;
struct Edge{int x,y,d;}e[70];
int main()
{
    cin>>L;
    int t=L-1;
    for(int i=0;(1<<i)<=t;i++)
    {
        n++;
        t-=(1<<i);
        e[++m].x=n-1,e[m].y=n,e[m].d=0;
        e[++m].x=n-1,e[m].y=n,e[m].d=(1<<i);
    }
    t=L;
    while(t)a[++l]=(t&1),t>>=1;
    int tot=(1<<(l-1));
    for(int i=l-1;i;i--)
    if(a[i])
    {
        e[++m].x=i,e[m].y=n,e[m].d=tot;
        tot+=(1<<(i-1));
    }
    cout<<n<<" "<<m<<endl;
    for(int i=1;i<=m;i++)cout<<e[i].x<<" "<<e[i].y<<" "<<e[i].d<<endl;
}

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


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using vec_b = vector<bool>;
using vec_str = vector<string>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back


int main()
{
    ll H;
    cin >> H;

    ll m = 1;
    REP(i,0,60) {
        if(m <= H && H < m * 2) break;
        else m <<= 1;
    }
    _PR(m*2-1);

    return 0;
}

/*



*/

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <functional>
using namespace std;

#define INF 1e9;

int COST[10][10];

int status[11];
int cost[11];

void dijkstra(int s) {
	for (int i = 0; i < 10; i++) {
		status[i] = 0;
		cost[i] = INF;
	}

	cost[s] = 0;
	status[s] = 1;

	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>U;
	U.push(make_pair(cost[s], s));
	while (!U.empty()) {
		//探索が終わってない中でコスト最小の点
		int u = U.top().second; U.pop();

		if (status[u] == -1) continue;

		status[u] = -1;

		//コスト最少の点を探る
		for (int i = 0; i < 10; i++) {
			if (status[i] != -1) {
				if (cost[i] > cost[u] + COST[u][i]) {
					cost[i] = cost[u] + COST[u][i];
					status[i] = 1;
					U.push(make_pair(cost[i], i));
				}
			}
		}
	}
}

int main()
{
	int H, W; cin >> H >> W;
	vector<vector<int>>A(H, vector<int>(W));
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			int c; cin >> c;
			COST[i][j] = c;
		}
	}

	vector<int>Count(10);
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> A[i][j];
			if (A[i][j] != -1)Count[A[i][j]]++;
		}
	}

	long long ans = 0;
	for (int i = 0; i < 10; i++) {
		dijkstra(i);

		ans += Count[i] * cost[1];
	}

	cout << ans << endl;

    return 0;
}



Measured memory_bytes: 384
x, n = gets.chomp.split(' ').map{|i| i.to_i }
if n == 0
  puts x
  exit
end

pset = {}
pp = gets.chomp.split(' ').map{|i|
  ii = i.to_i
  pset[ii] = true
}

if pset[x].nil?
  puts x
else
  cursordiff = 1
  cursormax = x + cursordiff
  cursormin = x - cursordiff
  while pset[cursormax] && pset[cursormin]
    cursordiff += 1
    cursormax = x + cursordiff
    cursormin = x - cursordiff
  end

  if pset[cursormin].nil?
    puts cursormin
  else
    puts cursormax
  end
end


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

int main(){
  ll n,ans=1; cin>>n;
  bool isPrime[1001];
  memset(isPrime,1,sizeof(isPrime));
  isPrime[0]=isPrime[1]=0;
  
  for(ll i=2;i<=n;i++){
    if(isPrime[i]){
      for(ll j=i*2;j<=n;j+=i)isPrime[j]=0;
    }
  }
  
  for(ll i=2;i<=n;i++){
    if(isPrime[i]){
      ll j=i,cnt=n/j;
      while(n/j>0){
        j*=i;
        cnt+=n/j;
      }
      ans*=cnt+1;
      ans%=mod;
    }
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <set>
#include <utility>
#include <algorithm>
#include <queue>
#define rep(i,p,n) for(int i=(int)p;i<(int)n;i++)
#define rrep(i,p,n) for(int i=(int)p;i>=(int)n;i--)
#define sort(x) sort(x.begin(),x.end());
#define lli long long int
#define vi vector<int> 

using namespace std;

void p(int x) {
	cout << x << endl;
}

void pp(string s) {
	cout << s << endl;
}

int main() {
	vector <int> v(3);
	rep(i, 0, 3) cin >> v[i];
	sort(v);

	if (v[0] == v[1] && v[1] != v[2])p(v[2]);
	else p(v[0]);
	

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(3);
  for(int i=0;i<3;i++) cin >> a[i];
  
  int ans = max({a[1], a[2], a[0]})-min({a[0], a[1], a[2]});
  cout << ans << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  if (25 - n == 0) {
    cout << "Christmas" << endl;
  }
  else {
    cout << "Christmas" << endl;
    for (int i = 0; i < 25 - n; i++) {
      cout << " " << "Eve" << endl;
    }
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int h = scan.nextInt();
		int x = scan.nextInt();
		int y = scan.nextInt();
		int r = scan.nextInt();
		
		if((x - r) >= 0 && (x + r) <= w && (y - r) >= 0 && (y + r) <= h) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
	}

}



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

int main(){
    ll N, M; cin >> N >> M;
    ll cnt = 0;
    for (int i = 0; i < M; i++)
    {
        int a; cin >> a;
        cnt+=a;
    }
    
    ll ans = N - cnt;
    if(ans < 0) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 3636
def rotate(arr,i):
    if i=='W':
        arr=[arr[k-1] for k in [3,2,6,1,5,4]]
    if i=='E':
        arr=[arr[k-1] for k in [4,2,1,6,5,3]]
    if i=='N':
        arr=[arr[k-1] for k in [2,6,3,4,1,5]]
    if i=='S':
        arr=[arr[k-1] for k in [5,1,3,4,6,2]]
    return arr
arr=input().split()
deck=[]
for i in 'W'*4:
    arr=rotate(arr,i)
    for k in 'NNNN':
        arr=rotate(arr,k)
        deck.append(arr)
arr=rotate(arr,'N')
arr=rotate(arr,'W')
for k in 'NNNN':
    arr=rotate(arr,k)
    deck.append(arr)
arr=rotate(arr,'W')
arr=rotate(arr,'W')
for k in 'NNNN':
    arr=rotate(arr,k)
    deck.append(arr)
arr2=input().split()
if arr2 in deck:
    print('Yes')
else:
    print('No')



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

int main(){
int n,a,b;
int sumA=0,sumB=0;
while(cin>>n){
	if(n==0)break;
	sumA=0,sumB=0;
for(int i=0;i<n;i++){
cin>>a>>b;
if(a>b){
sumA+=a;
sumA+=b;
}
if(a==b){
sumA+=a;
sumB+=b;
}
if(a<b){
sumB+=a;
sumB+=b;
}}
printf("%d %d\n",sumA,sumB);
}}

Measured memory_bytes: 1144
n, k = map(int, input().split())
a = list(map(int, input().split()))

previ = 0
nowi = k
for _ in range(n-k):
    prev = a[previ]
    now = a[nowi]
    if now > prev:
        print('Yes')
    else:
        print('No')
    previ += 1
    nowi += 1

Measured memory_bytes: 31552
#include <iostream>
#include <vector> 
#include <cmath>
#include <algorithm>
#include <set>
#include <map>

using namespace std;

int main(){

    string s1,s2;

    cin >> s1 >> s2;

    int dp[1001][1001];

    for(int i=0;i<s1.size()+1;i++){
        dp[i][0] = i;
    }
    for(int i=0;i<s2.size()+1;i++){
        dp[0][i] = i;
    }

    int cost;

    for(int i=0;i<s1.size();i++){
        for(int j=0;j<s2.size();j++){
            if(s1[i]==s2[j]){
                cost = 0;
            }
            else{
                cost = 1;
            }
            dp[i+1][j+1] = min(dp[i+1][j]+1,min(dp[i][j+1]+1,dp[i][j]+cost));
        }
    }
    
    /*for(int i=0;i<s1.size();i++){
        for(int j=0;j<s2.size();j++){
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }*/

    cout << dp[s1.size()][s2.size()] << endl;

    return 0;
}


Measured memory_bytes: 7124
package main

import (
        "fmt"
        "math"
)

func solution(a, b int) string {
        d := helper(a, b) + b

        n := math.Sqrt(float64(d))
        if n == math.Floor(n) {
                return "Yes"
        }
        return "No"
}

func helper(a, b int) int {
        e := 1
        for b > 0 {
                b /= 10
                e *= 10
        }
        return a * e
}

func main() {
        var a, b int
        fmt.Scan(&a, &b)
        fmt.Println(solution(a, b))
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int64;
 
map< int64, int > data;
 
int64 sum(int64 k)
{
  k += 1e13;
  int ret = 0;
  for(; k > 0; k -= k & -k) {
    if(!data.count(k)) continue;
    ret += data[k];
  }
  return (ret);
}
 
void push(int64 k, int x)
{
  k += 1e13;
  for(; k < 1e14; k += k & -k) data[k] += x;
}
 
int main()
{
  int64 N, A, B;
  vector< pair< int64, int64 > > T[5];
 
  cin >> N >> A >> B;
  for(int i = 0; i < N; i++) {
    int64 a, b, c;
    cin >> a >> b >> c;
    T[--a].emplace_back(b, c);
  }
 
  for(int i = 0; i < 5; i++) {
    T[i].emplace_back(0LL, 0LL);
  }
 
  map< int64, vector< pair< int64, int > > > add;
  map< int64, vector< int64 > > que;
  map< int64, vector< pair< int64, int > > > del;
 
  for(auto &s : T[0]) {
    for(auto &t : T[1]) {
      for(auto &q : T[2]) {
        int64 a = s.first + t.first + q.first;
        int64 b = s.second + t.second + q.second;
        que[a].emplace_back(b);
      }
    }
  }
 
  for(auto &s : T[3]) {
    for(auto &t : T[4]) {
      int64 a = s.first + t.first;
      int64 b = s.second + t.second;
      pair< int64, int64 > latte = {A - a, B - a};
      pair< int64, int64 > malta = {A - b, B - b};
      if(latte.first > latte.second) continue;
      if(malta.first > malta.second) continue;
      add[latte.first].emplace_back(malta.first, +1);
      add[latte.first].emplace_back(malta.second + 1, -1);
      del[latte.second].emplace_back(malta.first, -1);
      del[latte.second].emplace_back(malta.second + 1, +1);
    }
  }
 
  auto ptr = que.begin();
  auto latte = add.begin(), malta = del.begin();
 
 
  while(ptr != que.end()) {
    while(latte != add.end() && latte->first <= ptr->first) {
      for(auto &v : latte->second) {
        push(v.first, v.second);
      }
      ++latte;
    }
    while(malta != del.end() && malta->first < ptr->first) {
      for(auto &v : malta->second) push(v.first, v.second);
      ++malta;
    }
    for(auto &v : ptr->second) {
      if(sum(v) != 0) {
        cout << "Yes" << endl;
        return (0);
      }
    }
    while(malta != del.end() && malta->first <= ptr->first) {
      for(auto &v : malta->second) push(v.first, v.second);
      ++malta;
    }
    ++ptr;
  }
 
  cout << "No" << endl;
}

Measured memory_bytes: 130772
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  ll X, Y; cin >> X >> Y;
  ll result = 0;
  while(X<=Y) { result++; X*=2; }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()

int main(){
    ll A,B,C;
    cin>>A>>B>>C;
    cout<<min(min(A+B,B+C),C+A)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 44
int fib(int);

int main(){ 
  int n,i,fib[MAX];

  scanf("%d",&n);

  fib[0]=1;
  fib[1]=1;
  
  for(i=2;i<=n;i++){
    
    fib[i]=fib[i-1]+fib[i-2];
  }
  
  printf("%d\n",fib[n]);
 
  return 0;
}



Measured memory_bytes: 2052
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;

const int INF = 1<<29;
const double EPS = 1e-8;
typedef vector<int> vec;
typedef pair<int,int> P;


int main(){
    while(1){
        int n;
        scanf("%d",&n);
        if(!n) break;

        for(int i=0;i<n;i++){
            int pm,pe,pj;
            scanf("%d%d%d",&pm,&pe,&pj);
            int ave = (pm+pe+pj)/3;
            if((pm==100||pe==100||pj==100) || (pm+pe)/2>=90 || ave>=80){
                cout << "A" << endl;
            }else if(ave>=70 || (ave>=50&&(pm>=80||pe>=80))){
                cout << "B" << endl;
            }else{
                cout << "C" << endl;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;


int main(){FIN
    
    ll n; 
    cin>>n; 
    float ans=0;
    REP(i,n){
        float x; 
        string u;
        cin>>x>>u;
        if (u!="JPY") ans += (x*380000);
        else ans += x;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
a=[[] for _ in range(h)]
for i in range(h):
    s=input()
    for j in s:
        if j=='.':
            a[i].append(-1)
        else:
            a[i].append(0)

def bfs():
    d=[[0,1],[1,0],[-1,0],[0,-1]]
    q=[]
    c=-1
    for i in range(h):
        for j in range(w):
            if a[i][j]==0:
                q.append((i,j))
    while q:
        t=q[:]
        q=[]
        c+=1
        for i,j in t:
            for dd in d:
                di,dj=dd[0],dd[1]
                if (i+di)*(h-1-i-di)>=0 and (j+dj)*(w-1-j-dj)>=0 and a[i+di][j+dj]<0:
                    a[i+di][j+dj]=1
                    q.append((i+di,j+dj))
    return(c)

print(bfs())

Measured memory_bytes: 114540
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,0,n) cin >> v[i];
  
  sort(ALL(v));
  double ans = 0.0000;
  ans = (v[0] + v[1])/2.0;
  rep(i,0,n-2){
    ans = (ans + v[i+2])/2.0;
  }
  cout << ans << endl;
}

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

int main(){
  int N,K; cin >> N >> K;
  int A,pos;
  for(int i=1; i<=N; i++){
    cin >> A;
    if(A==1){
      pos=i;
      break;
    }
  }
  int result=100000;
  for(int i=0; i<K; i++){
    result=min(result,(max(0,pos-K+i)+(K-2))/(K-1)+(max(0,N-(pos+i))+(K-2))/(K-1)+1);
  }
  cout << result << endl;
}

Measured memory_bytes: 256
from numpy import*;I=lambda:map(int,input().split());W,H,N=I();m=zeros((H,W),int)
for _ in[0]*N:x,y,a=I();m[y*(a>3):H*(a^3)or y,x*(a==2):W*~-a or x]=1
print(W*H-m.sum())

Measured memory_bytes: 12476
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back      
#define F first
#define S second
#define SS stringstream
#define sqr(x) ((x)*(x))
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define CC(x) cout << (x) << endl
#define pw(x) (1ll<<(x))
#define buli(x) __builtin_popcountll(x)
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define M 1000000007
#define N 211111

#define TASK "1"

using namespace std;

int main(){
	#ifdef home
		freopen(TASK".in","r",stdin);	
		freopen(TASK".out","w",stdout);
	#endif		
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<pair<int, int> > e;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		e.pb(mp(x, 0));
	}
	for (int i = 0; i < m; i++) {
		int x;
		cin >> x;
		e.pb(mp(x, 1));
	}
	sort(e.begin(), e.end());
	long long ans = 0;
	for (int i = 0; i < e.size(); i++) {
		if (e[i].S == 0) {
			ans += (m + 1) * 1ll * e[i].F;
			n--;
		} else {
			ans += (n + 1) * 1ll * e[i].F;
			m--;
		}
	}
	cout << ans << endl;
	return 0;
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int s; cin >> s;
  int pre = s/100;
  int suf = s%100;

  bool YYMM = (1<=suf && suf<=12) ? true:false;
  bool MMYY = (1<=pre && pre<=12) ? true:false;

  if(YYMM && MMYY) cout << "AMBIGUOUS" << endl;
  else if(YYMM) cout << "YYMM" << endl;
  else if(MMYY) cout << "MMYY" << endl;
  else cout << "NA" << endl;
  
  return 0;
}


Measured memory_bytes: 3516
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int a, b, c;

signed main() {
	cin >> a >> b >> c;
	cout << tmax(a,b,c)*9 + a+b+c << endl;
}

Measured memory_bytes: 256
# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]

r, D, x2000 = [int(x) for x in input().split()]

d = x2000
for i in range(10):
    # dp.append(r * x2000 - D)
    d = r * d - D
    print(d)




Measured memory_bytes: 2940
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
const long long MOD = 998244353;
using namespace std;


int main(int argc, char* argv[])
{
    char str[15]={0};
    scanf("%s", str);
    int i;
    for(i=11; i>=4; i--) {
        str[i+1]=str[i];
    }
    str[4]=' ';
    printf("%s\n", str);

    return 0;
}


Measured memory_bytes: 128
def main():
    N = int(input())
    A = []
    x = N
    l = int(N ** 0.5)
    for t in range(2, l + 1):
        while x % t == 0:
            A.append(t)
            x //= t

    if x > 1:
        A.append(x)

    import collections
    ans = 0
    for v in collections.Counter(A).values():
        for n in range(1, 41):
            if v < n * (n + 1) // 2:
                ans += n - 1
                break

    print(ans)


if __name__ == '__main__':
    main()

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

int main() {
    ll N;
    cin >> N;
    ll ans =0;
    ll remain =0;
    for(int i=0;i<N;i++){
        ll a;
        cin >> a;
        if(remain>0 && a>0){
            ans++;
            a--;
        }
        ans += (a/2);
        remain = a%2;

    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main() {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  int max_x = -100000;
  rep(i, N) {
    int x = 0;
    cin >> x;
    max_x = max(max_x, x);
  }
  int min_y = 100000;
  rep(i, M) {
    int y = 0;
    cin >> y;
    min_y = min(min_y, y);
  }
  //cout << max_x << " " << min_y << endl;
  vector<int> v(201, 0);
  for (int i = X + 1; i <= Y; i++) v[i + 100]++;
  for (int i = max_x + 1; i <= min_y; i++) v[i + 100]++;
  //for (int i = 0; i <= 200; i++) cout << v[i] << ",";
  //cout << endl;
  if (count(v.begin(), v.end(), 2) > 0) {
    cout << "No War" << endl;
  } else {
    cout << "War" << endl;
  }
  return 0;
}


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

int main() {
int a,b;
  bool flag=false;
  cin >> a;
  cin >> b;
  for(int i=0;i< 1000000000;i++)
    if(abs(a-i)== abs(b-i)){
      cout << i <<endl;
  		flag = true;
    }
  if(flag == false)
    cout << "IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 256
n = gets.to_i
arr = []

n.times do
  arr << gets.chomp
end

unless arr.uniq.count == arr.count
  puts "No"
  exit
end

(n-1).times do |i|
  if i == n-2 && arr[i][-1] == arr[i+1][0]
    puts "Yes"
    exit
  end

  if arr[i][-1] == arr[i+1][0]
    next
  else
    puts "No"
    exit
  end
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define forn(b) for(int i = 0; i < b; i++)
#define rforn(b) for(int i = b - 1 ;i >= 0; i--)
#define It(m) for(auto it = m.begin(); it != m.end(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
const ll mod = (ll)1e9 + 7;
bool prime(ll n) {
    for(ll i = 2; i * i <= n; i++) {
        if(n % i == 0) return false;
    }
    return true;
}
int main(){
    speed;
    ll n; cin >> n;
    map<ll, int> m;
    int res = 0;
    
        for(ll i = 2; i * i <= n; i++) {
            if(n % i == 0) {
                while(n % i == 0) {
                    m[i]++;
                    n /= i;
                }
            }
        } 
        if(n != 1) {
            m[n]++;
        } 
        It(m) {
            int k = it->second;
            int x1 = (sqrt(1+ (8 * k)) - 1) / 2;
            res += x1;
        }
    
   
    
    cout << res;
    return 0;
}

Measured memory_bytes: 3644
from collections import deque

def bfs(N, d, ans):
    Q = deque([0])
    visited = [False] * N
    visited[0] = True
    while Q:
        q = Q.popleft()

        for p in d[q]:
            if visited[p]:
                continue
            visited[p] = True
            Q.append(p)
            ans[p] += ans[q]

    return ans


def main():
    N, Q = map(int, input().split())
    d = [[] for _ in range(N)]

    for i in range(N-1):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        d[a].append(b)
        d[b].append(a)

    ans = [0] * N
    for _ in range(Q):
        p, x = map(int, input().split())
        p -= 1
        ans[p] += x

    print(*bfs(N, d, ans))
    

main()

Measured memory_bytes: 106132
import sys

INF = 2**31 - 1


class RUQ:

    def __init__(self, n):
        tmp = 1
        while tmp < n:
            tmp *= 2
        self.n = tmp * 2
        self.A = [INF] * (2 * self.n - 1)

    def update(self, a, b, x=-1, k=0, l=0, r=0):
        if r <= a or b <= l:
            return
        if a <= l and r <= b:
            if x >= 0:
                self.A[k] = x
            return
        if self.A[k] != INF:
            self.A[k*2+1] = self.A[k*2+2] = self.A[k]
        self.A[k] = INF
        self.update(a, b, x, k*2+1, l, (l+r)/2)
        self.update(a, b, x, k*2+2, (l+r)/2, r)


line = sys.stdin.readline()
n, q = map(int, line.split())
ruq = RUQ(n)
for i in range(q):
    line = sys.stdin.readline()
    if line[0] == "0":
        com, s, t, x = map(int, line.split())
        ruq.update(s, t+1, x, 0, 0, ruq.n)
    else:
        com, i = map(int, line.split())
        ruq.update(i, i+1, -1, 0, 0, ruq.n)
        print(ruq.A[i+ruq.n-1])



Measured memory_bytes: 11056
#include<algorithm>
#include<cmath>
#include<climits>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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 N;
	cin >> N;

	vector<ll> a(N);
	rep(i, N) cin >> a[i];

	vector<ll> b(N);
	rep(i, N) cin >> b[i];

	ll diffa = 0;
	ll diffb = 0;

	rep(i, N)
	{
		if (a[i] > b[i])
		{
			diffa += a[i] - b[i];
		}
		else
		{
			ll diff = b[i] - a[i];
			diffb += 2 * (diff / 2);
		}
	}

	if (diffb >= 2 * diffa)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 384
class RMQ
    INT_MAX = 2**31-1
    def initialize(n)
    @n = 2**Math::log2(n).ceil   # nが2のべき乗になるように調整
    @dat = Array.new(2*@n-1) { INT_MAX }
    end
    def update(i, x)
        i += @n-1
    @dat[i] = x
    while i > 0                # 葉から親へ辿る処理
          i = (i-1)/2
    @dat[i] = [@dat[i*2+1], @dat[i*2+2]].min
    end
    end
    def find(s, t)
        query(s, t+1, 0, 0, @n)
    end
    private
    def query(a, b, k, l, r)
    return INT_MAX if r <= a || b <= l # 交差しない?
    return @dat[k] if a <= l && r <= b         # 完全に含む?
        vl = query(a, b, k*2+1, l, (l+r)/2)
        vr = query(a, b, k*2+2,(l+r)/2, r)
        [vl, vr].min
    end
    end
    n, q = gets.split.map(&:to_i)
    rmq = RMQ.new(n)
    q.times {
      com, x, y = gets.split.map(&:to_i)
    case com
    when 0
        rmq.update(x, y)
    when 1
    puts rmq.find(x, y)
    end
    }


Measured memory_bytes: 10976
#pragma GCC optimize("O3")

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <assert.h>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <random>
#include <cmath>
#include <chrono>
#include <bitset>

#define ld long double
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;

const int INF = 2e18;
const int MOD = 1e9 + 7;
const int MB = 20;

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

void solve() {
	int a, b;
	cin >> a >> b;
	int g = gcd(a, b);
	int ans = 1;
	for (int d = 2; d * d <= g; d++) {
		if (g % d == 0) {
			while (g % d == 0) g /= d;
			ans++;
		}
	}
	if (g > 1) ans++;
	cout << ans;
}
signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout.precision(12);
	solve();
}

Measured memory_bytes: 256