akhauriyash/Code-Regression huggingface dataset:
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

main :: IO ()
main = do
    [a, b, c, d] <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    putStrLn $ case compare (a + b) (c + d) of
                GT -> "Left"
                EQ -> "Balanced"
                LT -> "Right"


Measured memory_bytes: 380
#include<stdio.h>
int main()
{
    int i,j,s=0,m=0,n,x,y;
    scanf("%d", &n);
    int a[n+5];
    for(i=0;i<n;i++)
    {
        scanf("%d", &a[i]);
        if(a[i]>m)
            m=a[i];
        s=s+a[i];
    }
    s=s-m;
    if(s>m)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 1664
//A.cpp
#include <iostream>
#include <string>
#include <math.h>
using namespace std;

int main(){
  int K;
  cin >> K;
  if(K%2==0) printf("%d\n",(K/2)*(K/2));
  else printf("%d\n",((K/2)+1)*(K/2));
  return 0;
}


Measured memory_bytes: 256
a,b,c = map(int,input().split())
k = int(input())
for i in range(k):
  if b<=a:
    b = b*2
    continue
  elif c<=b:
    c = c*2
    continue
  else:
    break

if a<b<c:
  print("Yes")
else:
  print("No")
  

Measured memory_bytes: 9100
// I - Coins
#include <bits/stdc++.h>
using namespace std;
using dl = double;

int main(){
	int N; scanf("%d",&N);
	int C = (N+1)/2;
	vector<dl> dp(N+2);
	dp[1] = 1.;
	for(int lv=1; lv<=N; lv++){
		dl p; scanf("%lf",&p);
		dl q = 1.-p;
		int e = max(1, lv-C+2);
		for(int i=lv+1; i>=e; i--) dp[i] = q*dp[i] + p*dp[i-1];
	}
	dl a = 0; for(int i=N+1; i>C; i--) a += dp[i];
	printf("%.10g\n",a);
}

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

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

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

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

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

signed main(void)
{
  int a;
  cin >> a;

  int i = 2, res = 1;
  while(res < a) res += i++;

  string ans = string(i-res-1+a, ')') + '(' + string(res-a, ')') + string(i-2, '(');
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3324
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <random>
#include <deque>
#include <bitset>
#include <string>
#include <queue>
#include <complex>

//#define int long long

#define mp(a, b) make_pair(a, b)
#define all(v) (v).begin(), (v).end()

#define endl '\n'

using namespace std;
typedef long long ll;
typedef long double ld;

mt19937 mrand(random_device{}());

double PI = acos((double)-1);
const double eps = 1e-8;
const ll inf0 = 1023 * 1024 * 1024;
const ll inf = inf0 * inf0;
const ll mod = 1e9 + 7;
//const ll mod2 = 998244353;

void solve();
void scan();

signed main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	cout << fixed; cout.precision(15);
	solve();
	return 0;
}

void solve() {
	map<string, int> ans = {
	{"SUN", 7},
	{"MON", 6},
	{"TUE", 5},
	{"WED", 4},
	{"THU", 3},
	{"FRI", 2},
	{"SAT", 1}
	};
	string s; cin >> s;
	cout << ans[s] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int X, A, B;
    cin >> X >> A >> B;

    if(-1*A + B <= 0){
        cout << "delicious" << endl;
    }else if(-1*A + B <= X){
        cout << "safe" << endl;
    }else{
        cout << "dangerous" << endl;
    }

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
map<int,int> m;
vector<int> v;
int n,ans;
int main()
{
	cin>>n;
	for (register int i=1;i<=n;++i)
	{
		int x;
		cin>>x;
		if (m[x]==0)
		{
			v.push_back(x);
		}
		m[x]++;
	}
	for (register int i=0;i<v.size();++i)
	{
		if (m[v[i]]>=v[i])
		{
			ans+=m[v[i]]-v[i];
		}
		else
		{
			ans+=m[v[i]];
		}
	}
	cout<<ans<<"\n";
	return 0;
}

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

int main(){
    int N, K;
    cin >> N >> K;
    int ans = 1;
    for(int i = 0; i < N; i++){
        if(ans < K){
            ans *= 2;
        }else{
            ans += K;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
arr = [int(n) for n in input().split()]

swap_cnt = 0
for i in range(0, N):
    minj = i
    for j in range(i, N):
        if arr[j] < arr[minj]:
            minj = j
    if (i != minj):
        arr[i], arr[minj] = arr[minj], arr[i]
        swap_cnt += 1

print(' '.join(map(str, arr)))
print(swap_cnt)



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

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

  vector<int> A(N);
  map<int, int> m;
  rep(i,0,N-1) {
    cin >> A[i];
    m[A[i]]++;
  }
  sort(A.begin(), A.end());

  int min_a = A[0];
  int min_a_len = m[min_a];
  int rest = N - min_a_len;
  int ans = (rest + K - 2) / (K - 1);

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


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

int main() {
  int n;
  int a;
  int b;
  cin >> n;
  cin >> a;
  cin >> b;
  
  int t = n * a;
  
  if (t > b ) {
    cout << b << endl;
  }
  else if (t < b ) {
    cout << t << endl;
  }
  else if (t = b ) {
    cout << b << endl;
  }
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(LL i = (a); i < (LL)(n); ++i)
#define REM(i,a,n) for(LL i = ((n) - 1); i >= (a); --i)
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const string INFSTR = "\x7f";
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
// all_of
// partial_sum, adjacent_difference

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#include "Geometry.h"
#include "Matrix.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif


int N, C, K;
int A[100000];
int main() {
	cin >> N >> C >> K;
	REP(i, 0, N) {
		cin >> A[i];
	}
	sort(A, A + N, greater<int>());
	
	int cnt = 0;
	for (int i = 0; i < N;) {
		++cnt;
		int front = A[i];
		int piv = i;
		while (A[i] >= front - K && i < piv + C && i < N) {
			++i;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  int n;
  cin >> n ;
  vector<int> a(n);
  int sum=0;
  for(auto &it:a){
      cin >> it;
      sum+=it;
  }

  double ave = (double)sum/(double)n;
  int value = (int)(ave+0.5);
  int ans=10000000000;
  for(int j=-1;j<2;j++){
    int buf=0;
  for(int i=0;i<n;i++){
    buf += (a[i]-value+j)*(a[i]-value+j);
  }
    ans = min(ans,buf);
  }
  cout <<ans <<endl;
  return 0;
}

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

using namespace std;

long long n, ans;

main(){
    cin >> n;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= n; j++){
            for (int f = 1; f <= n; f++){
                ans += __gcd(__gcd(i, j), f);
            }
        }
    }
    cout << ans;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<climits>
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> vec;
    long ans = 0;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        vec.push_back(x);
    }
    sort(vec.begin(),vec.end(),greater<int>());
    if(n%2){
        ans += vec.front();
        for(int i=1;i<n/2;i++)
            ans += 2*vec[i];
        ans += vec[(n/2)];
    }
    else{
        ans += vec.front();
        for(int i=1;i<n/2;i++)
            ans += 2*vec[i];
    }
    cout<<ans<<endl;
}


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

int main() {
  string s;
  cin >> s;

  ll a = 0;
  for (int i = 0, l = 0, r = 0; i < s.size(); i++) {
    if (s[i] == '<') {
      l++;
    } else if (s[i] == '>') {
      r++;
    }

    if (i + 1 == s.size() || s[i] == '>' && s[i + 1] == '<') {
      for (int i = 0; i < l; i++) a += i;
      for (int i = 0; i < r; i++) a += i;
      a += max(l, r);
      l = 0;
      r = 0;
    }
  }
  cout << a << endl;
}


Measured memory_bytes: 900
import Data.List

main :: IO ()
main = do
  n  <- readLn
  as <- map read . words <$> getLine
  putStrLn . unwords . map show $ solve n as

solve :: Int -> [Int] -> [Int]
solve n as = scanl f x1 $ take (n-1) as
 where
  f x a = 2 * a - x
  s  = sum as
  x1 = s - 2 * sum (map fst . filter snd $ zip (tail as) (cycle [True, False]))

Measured memory_bytes: 34172
#include<iostream>
#include<stack>
#include<cstdio>
#include<map>
#include<set>
#include<queue>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define me(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
const int N=500005;
int main()
{
	int n,m,i,j,k,l,r,sum=0,w=0;
	int v[500];
	me(v,0);
	
	cin>>n>>m;
	int a[50];
	me(a,0);
	for(i=1;i<=m;i++)
	{
		cin>>l>>r;
		if(v[l]==0)
		{
			v[l]=1;
		  a[l]=r;
	    }
		else 
		{
			if(r!=a[l])
			{
				w=1;
				
			}
		}
	}
	if(w==1)cout<<-1;
	else if(v[1]==1&&a[1]==0&&n!=1)cout<<-1;
	else 
	{
		
		if(a[1]==0&&n!=1)
		a[1]=1;
		
		
		
			for(i=1;i<=n;i++)
			cout<<a[i];
		
		
	}
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

S = tuple(map(int, list(input())))
MOD = 2019

d = defaultdict(int)
d[0] = 1

tmp = 0
for i, s in enumerate(reversed(S)):
    tmp = (tmp + s * pow(10, i, MOD)) % MOD
    d[tmp] += 1
print(sum(v * (v - 1) // 2 for v in d.values()))


Measured memory_bytes: 12764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> h(N + 1);
  h.at(0) = 100000;
  for (int i = 1; i <= N; i++) {
    cin >> h.at(i);
  }
  vector<int64_t> cost(N + 1, 1000000000000000);
  cost.at(0) = 0;
  cost.at(1) = 0;
  for (int i = 2; i <= N; i++) {
    cost.at(i) = min((cost.at(i - 1) + abs(h.at(i - 1) - h.at(i))), cost.at(i));
    cost.at(i) = min(cost.at(i), (cost.at(i - 2) + abs(h.at(i - 2) - h.at(i))));
  }
  cout << cost.at(N) << endl;
}
    


Measured memory_bytes: 4496
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	while(1){
		c=c-b;
		if(c<=0){
			printf("Yes");
			break;
		}
		a=a-d;
		if(a<=0){
			printf("No");
			break;
		}
	}
	return 0;
} 

Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define mod  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint comb(ll n, ll a){
  mint x=1,y=1;
  rep(i,a) x*=(n-i);
  rep(i,a) y*=(i+1);
  return x/y;
}

mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}
ll beki(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = beki(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}

int main(int argc, char const *argv[]) {
  //ABC156-D
  ll a,b,n;
  cin >> n >> a >> b;
  mint ans=beki(2,n);
  ans-=1;
  ans-=comb(n,a);
  ans-=comb(n,b);

  cout << ans.x << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>

using namespace std;

#define ll long long int
#define pii pair<ll,ll>

struct BIT
{
    std::vector<int> bit;
    
    BIT(int size) : bit(size, 0){ }
    
    void add(int k, int x) {
        while (k < bit.size()) {
            bit[k] += x;
            k += k &-k;
        }
    }
    int sum(int k) {
        int res = 0;
        while (k > 0) {
            res += bit[k];
            k -= k&-k;
        }
        return res;
    }
};

struct UnionFind {
    vector<int> data;
    
    UnionFind(int size) : data(size, -1) { }
    
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y)
        {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};

vector<vector<pii>> v;
ll score[10000];
int n,m;

ll infi = (ll)1e15;

ll dfs(ll from, ll s, ll depth)
{
    if(depth > 2100)
    {
        return infi;
    }
    ll mm = -infi;
    for(auto e = v[from].rbegin(); e != v[from].rend();e++)
    {
        auto c = e->first + s;
        if(score[e->second] < c)
        {
            score[e->second] = c;
            mm = max(mm, dfs(e->second, c, depth+1));
        }
    }
    if(from == n)
    {
        if(mm == -infi)
        {
            return score[from];
        }
        return max(score[from], mm);
    }
    return mm;
}

#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>
#include <iostream>
#include <string>
#include <cctype>

using namespace std;

int main(void)
{
    ll h, w;
    cin >> h >> w;
    
    if((h % 3 == 0) || (w % 3 == 0))
    {
        cout << 0 << endl;
        return 0;
    }
    
    ll minDiff = min(w, h);
    
    for(int y = 1;y < h;y++)
    {
        ll a[3];
        a[0] = y * w;
        auto left = w/2;
        auto right = w - w/2;
        a[1] = (h-y) * left;
        a[2] = (h-y) * right;
        auto upper = max(a[0], a[2]);
        auto lower = min(a[0], a[1]);
        minDiff = min(minDiff, upper - lower);
    }
    for(int x = 1;x < w;x++)
    {
        ll a[3];
        a[0] = x * h;
        auto top = h/2;
        auto bottom = h - h/2;
        a[1] = (w-x) * top;
        a[2] = (w-x) * bottom;
        auto upper = max(a[0], a[2]);
        auto lower = min(a[0], a[1]);
        minDiff = min(minDiff, upper - lower);
    }
    cout << minDiff << endl;
    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
li = []
for i in range(m):
    p,y = map(int,input().split())
    li.append([p,y,i])
li.sort(key= lambda x:x[1])
li.sort(key= lambda x:x[0])
pre = li[0][0]
cnt = 1
ans = []
for p,y,i in li:
    if p==pre:
        ans.append(   (str(p).zfill(6) + str(cnt).zfill(6) ,i))
        cnt+=1
    else:
        pre = p
        ans.append((str(p).zfill(6) + str(1).zfill(6),i))
        cnt=2
ans.sort(key=lambda x:x[1])
for a,i in ans:
    print(a)

Measured memory_bytes: 37808
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()
#define fs first
#define sd second
template<class T> using V = vector<T>;
template<class T> using V2 = V<V<T>>;
template<class T> using V3 = V<V2<T>>;
constexpr ll mod = 1000000007;


void solve(){
  string k; int d, n;cin >> k >> d;
  n = k.size();
  V3<ll> dp(2, V2<ll>(2,V<ll>(d,0)) );
  dp[0][1][0] = 1;
  FOR(i,0,n){
    FOR(j,0,d){
      dp[1][0][j] = 0;
      dp[1][1][j] = 0;
    }
    FOR(j,0,d){
      char c = k[i] - '0';
      FOR(k,0,10){
        (dp[1][0][(j+k)%d] += dp[0][0][j]) %= mod;
      }
      FOR(k,0,c){
        (dp[1][0][(j+k)%d] += dp[0][1][j]) %= mod;
      }
      (dp[1][1][(j+c)%d] += dp[0][1][j]) %= mod;
    }
    swap(dp[0],dp[1]);
  }
  cout << ((dp[0][0][0]+dp[0][1][0]-1+mod)%mod) << "\n";
}

int main(void){
    solve();
    return 0;
}

Measured memory_bytes: 256
#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()

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

    // start
    int a, b, c;
    cin >> a >> b >> c;
    cout << ((a + b >= c) ? "Yes" : "No") << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i, n) for (ll i=0;i<n;i++)
#define ll long long
#define llc(n) ll n; cin >> n;
using namespace std;
int main() {
  llc(n);
  ll b=1;
  vector<ll> a(n);
  r(i,n) {
    cin >> a.at(i);
    if(a.at(i)==b) b++;
  }
  if(b==1) cout << -1 << endl;
  else cout << n-b+1 << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
 
#define int long long int
#define pb push_back
#define mp make_pair
#define loop(i,x,n) for(int i=x;i<=n;i++)
#define rloop(i,x,n) for(int i=x;i>=n;i--)
#define ff first
#define ss second
#define N4RUTO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 
typedef tree<int, null_type, less<int>, rb_tree_tag,  
// typedef tree<int, null_type, less_equal<int>, rb_tree_tag,  
tree_order_statistics_node_update>
ordered_set;
 
int32_t main(){
    N4RUTO;
    int t;
    t=1;
    // cin>>t;
    while(t--){
        int n;
        cin>>n;
        int ans = 0;
        loop(i,1,n){
            loop(j,1,n){
                loop(k,1,n){
                    ans+=__gcd(__gcd(i,j),k);
                }
            }
        }
        cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 3652
// ===========================================
// 20.03.04
// 
// 
// ===========================================

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(int i=1; i<=n; i++)
#define rez(i,n) for(int i = 0; i<n; i++)
#define ET "\n"
#define CLR(arr) memset(&arr, 0, sizeof(arr))
#define PAIR pair<int, int>
const ll INF = 1LL << 50;
const int mini = 10e5+5;



int main(){
    
    int n, k;
    cin >> n >> k;
    
    int h[n+1];
    rep(i,n) cin >> h[i];
    
    ll dp[n+1];
    rep(i,n) dp[i] = INF;
    dp[1] = 0;
    dp[2] = abs(h[2] - h[1]);
    
    for(int i=3; i<=n; i++){
        for(int j=1; 1<=i-j && j<=k; j++){
            dp[i] = min(dp[i], dp[i-j] + abs(h[i]-h[i-j]) );
        }
    }
    
    cout << dp[n];
}



Measured memory_bytes: 1408
#include<stdio.h>
#include<stdbool.h>

int main(void){
        char s[10], c;
        int l = 0, i, cnt = 0;
        bool ok = true;
        while((c=getchar())!='\n') s[l++] = c;
        for(i=0; i<l; i++){
                if('a'<=s[i] && s[i]<='z') cnt++;
                else if(s[i]=='C') ok &= (1<i && i<l-1);
                else if(s[i]=='A') ok &= (i==0);
                else ok = false;
        }
        if(ok && cnt==l-2) puts("AC");
        else puts("WA");
        return 0;
}

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

int main() {

  int H, W;
  cin >> H >> W;
  vector<vector<char>> data(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> data.at(i).at(j);
    }
  }

  for (int i = 0; i < 2*H; i++) {
    for (int j = 0; j < W; j++) {
        cout << data.at(i/2).at(j);
    }
    cout << endl;
  }
}

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

const int N = 2e5 + 5;
int n, q;
vector<int> ad[N];
int dd[N], st[N], en[N], id, it[4 * N], lazy[4 * N];

void dfs(int i)
{
    dd[i] = 1;
    id++;
    st[i] = id;
    for(auto &v : ad[i])
    {
        if(!dd[v]) dfs(v);
    }
    en[i] = id;
}

void trans(int i)
{
    if(lazy[i])
    {
        int va = lazy[i];
        lazy[2 * i] += va;
        lazy[2 * i + 1] += va;
        it[2 * i] += va;
        it[2 * i + 1] += va;
        lazy[i] = 0;
    }
}

void upd(int i, int l, int r, int u, int v, int va)
{
    if(u > r || v < l) return;
    if(u <= l && r <= v)
    {
        it[i] += va;
        lazy[i] += va;
        return;
    }
    trans(i);
    int mid = l + (r - l) / 2;
    upd(2 * i, l, mid, u, v, va);
    upd(2 * i + 1, mid + 1, r, u, v, va);
    it[i] = it[2 * i] + it[2 * i + 1];
}

int get(int i, int l, int r, int u, int v)
{
    if(u > r || v < l) return 0;
    if(u <= l && r <= v) return it[i];
    trans(i);
    int mid = l + (r - l) / 2;
    return get(2 * i, l, mid, u, v) + get(2 * i + 1, mid + 1, r, u, v);
}

main()
{
    cin >> n >> q;
    for(int i = 1; i < n; ++i)
    {
        int u, v;
        cin >> u >> v;
        ad[u].push_back(v);
        ad[v].push_back(u);
    }
    dfs(1);
    for(int i = 1; i <= q; ++i)
    {
        int p, x;
        cin >> p >> x;
        upd(1, 1, n, st[p], en[p], x);
    }
    for(int i = 1; i <= n; ++i)
    {
        cout << get(1, 1, n, st[i], st[i]) << ' ';
    }
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

#define INF 1<<29

template <typename T>
struct MaxFlow {
  struct Edge {
    int to, rev; T cap;
    Edge(int to, int rev, T cap) : to(to), rev(rev), cap(cap) { }
  };

  typedef vector<Edge> Edges;
  vector<Edges> G;
  int V;
  vector<int> level, iter;

  MaxFlow(int V) : V(V) { G.resize(V); }

  void add_edge(int from, int to, T cap) {
    G[from].push_back(Edge(to, (int)G[to].size(), cap));
    G[to].push_back(Edge(from, (int)G[from].size()-1, 0));
  }

  void bfs(int source) {
    level.assign(V, -1);
    queue<int> que;
    que.push(source);
    level[source] = 0;
    while (!que.empty()) {
      int v = que.front(); que.pop();
      for (int i = 0; i < (int)G[v].size(); i++) {
	Edge &e = G[v][i];
	if (e.cap > 0 && level[e.to] < 0) {
	  level[e.to] = level[v] + 1;
	  que.push(e.to);
	}
      }
    }
  }

  T dfs(int v, int sink, T flow) {
    if (v == sink) return flow;
    for (int &i = iter[v]; i < (int)G[v].size(); i++) {
      Edge &e = G[v][i];
      if (e.cap > 0 && level[v] < level[e.to]) {
	T d = dfs(e.to, sink, min(e.cap, flow));
	if (d > 0) {
	  e.cap -= d;
	  G[e.to][e.rev].cap += d;
	  return d;
	}
      }
    }
    return 0;
  }

  T dinic(int source, int sink) {
    T flow = 0;
    while (true) {
      bfs(source);
      if (level[sink] < 0) return flow;
      iter.assign(V, 0);
      T f;
      while ((f = dfs(source, sink, INF)) > 0) {
	flow += f;
      }
    }
  }
};

int main() {

  int N;
  while (scanf("%d", &N) != EOF) {
    int M, L; scanf("%d %d", &M, &L);
    vector<vector<int>> Adj(N, vector<int>(N, INF));
    REP(i, N) Adj[i][i] = 0;
    REP(i, M) {
      int A, B, D; scanf("%d %d %d", &A, &B, &D); A--, B--;
      Adj[A][B] = Adj[B][A] = D;
    }
    REP(k, N) REP(i, N) REP(j, N) Adj[i][j] = min(Adj[i][j], Adj[i][k] + Adj[k][j]);
    MaxFlow<int> mf(2*N+2);
    REP(i, N) {
      int P; scanf("%d", &P);
      mf.add_edge(2*N, i, P);
    }
    REP(i, N) {
      int K; scanf("%d", &K);
      mf.add_edge(i+N, 2*N+1, K);
    }
    REP(i, N) REP(j, N) {
      if (Adj[i][j] < L) {
	mf.add_edge(i, j+N, INF);
      }
    }
    printf("%d\n", mf.dinic(2*N, 2*N+1));
  }
  return 0;
}

Measured memory_bytes: 3320
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int N, K;
	string S;

	cin >> N >> K;
	cin >> S;
	if (S[K - 1] == 'A') {
		S[K - 1] = 'a';
	}
	if (S[K - 1] == 'B') {
		S[K - 1] = 'b';
	}
	if (S[K - 1] == 'C') {
		S[K - 1] = 'c';
	}
	cout << S;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){ T x; cin >> x; return (x); }
template<typename T=int,typename C=vector<T>>
C vecin(int N){ C x(N);REP(i,N){ x[i]=in<T>(); }return move(x); }

void vout(){ cout << endl; }
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){ cout << ' ' << h;vout(forward<Tail>(t)...); }
void out(){ cout << endl; }
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){ cout << h;vout(forward<Tail>(t)...); }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int H=in(),W=in(),K=in();
	int D=max(H,W);
	out((K+D-1)/D);
	return 0;
}


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

int main(){
  int A1,A2,A3;
  int sum = 0;
  cin >> A1 >> A2 >> A3;
  sum = A1 + A2 + A3;
  
  if(sum >= 22){
    cout <<"bust"<<endl;
  }else{
    cout <<"win"<<endl;
  }
  
}

Measured memory_bytes: 256
import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

N,M = MAP()
Y = [0]*(10**5)
P = [0]*(10**5)
yd =[[] for _ in range(N)]
for i in range(M):
    p,y = MAP()
    P[i] = p-1
    Y[i] = y
    yd[p-1].append(y)

for i in range(N):
    yd[i].sort()

for i in range(M):
    print("{0:06d}".format(P[i]+1),end="")
    print("{0:06d}".format(bisect.bisect_left(yd[P[i]],Y[i])+1))

Measured memory_bytes: 30728
# -*- coding: utf-8 -*-

N, Q = map(int, input().split())
S = input()

Sl = [0]
for i in range(N):
    Sl.append(Sl[-1] + 1 if S[i:i+2] == "AC" else Sl[-1])

for _ in range(Q):
    l, r = map(int, input().split())
    print(Sl[r - 1] - Sl[l - 1])


Measured memory_bytes: 6100
inp = input().split(" ")
h = int(inp[0])
w = int(inp[1])

grid = []

for i in range(h):
	grid.append(list(input()))

for i in range(h):
	for j in range(w):
		c = grid[i][j]
		if c == ".":
			total = 0
			adj = []
			if i > 0:
				adj.append(grid[i-1][j])
			if j > 0:
				adj.append(grid[i][j-1])
			if i < h-1:
				adj.append(grid[i+1][j])
			if j < w-1:
				adj.append(grid[i][j+1])
			if i > 0 and j > 0:
				adj.append(grid[i-1][j-1])
			if i > 0 and j < w-1:
				adj.append(grid[i-1][j+1])
			if i < h-1 and j > 0:
				adj.append(grid[i+1][j-1])
			if i < h-1 and j < w-1:
				adj.append(grid[i+1][j+1])
			for k in adj:
				if k == "#":
					total += 1
			grid[i][j] = str(total)

for i in grid:
	print("".join(i))


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

const int MAX = 1e6;
const int MOD = 1e9 + 7;

long long f[MAX], finv[MAX], inv[MAX];

void CombInit() {
  f[0] = f[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    f[i] = f[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

long long Perm(int n, int k) {
  if (n < k || k < 0) return 0;
  return f[n] * finv[n - k] % MOD;
}

long long Comb(int n, int k) {
  if (n < k || k < 0) return 0;
  return f[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  CombInit();

  int N; cin >> N;
  vector<long long> C(N); rep(i, N) cin >> C[i];

  sort(C.rbegin(), C.rend());

  vector <long long> pow2(N + 1);
  pow2[0] = 1;
  rep(i, N) {
    pow2[i + 1] = pow2[i] * 2 % MOD;
  }

  rep(i, N) {
    C[i] = C[i] * pow2[N - i - 1] % MOD;
  }


  long long ans = C[0];
  rep(i, N) {
    if (i == 0) continue;
    long long tmp = pow2[i - 1] * (i + 2) % MOD;
    tmp = tmp * C[i] % MOD;
    ans = (ans + tmp) % MOD;
  }

  ans = ans * pow2[N] % MOD;

  cout << ans << endl;
}

Measured memory_bytes: 26752
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>

const long INF = (1l << 30);
const long LINF = (1l << 60);

typedef std::complex<double> Com;

//geometric library
//#include <complex>
//typedef complex<double> Com;
//c++ -std=c++14

//内積
double dot_product(const Com a, const Com b){
	return (conj(a)*b).real();
}
//外積
double cross_product(const Com a, const Com b){
	return (conj(a)*b).imag();
}
//点と直線の距離
double dist_dot_line(const Com st, const Com en, const Com dt){
    return std::abs(cross_product(dt-st, en-st) / std::abs(en-st));
}
//点と線分の距離
double dist_dot_seg(const Com st, const Com en, const Com dt){
	if(dot_product(en-st, dt-st) <= 0){
		return std::abs(dt-st);
	}else if(dot_product(st-en, dt-en) <= 0){
		return std::abs(dt-en);
	}else{
		return dist_dot_line(st, en, dt);
	}
}
//線分の交差判定
bool seg_crossing(const Com st1, const Com en1, const Com st2, const Com en2){
	double cross1 = cross_product(en1-st1, st2-st1) * cross_product(en1-st1, en2-st1);
	double cross2 = cross_product(en2-st2, st1-st2) * cross_product(en2-st2, en1-st2);
	return (cross1 <= 0) && (cross2 <= 0);
}
//線分と線分の距離
double dist_seg(const Com st1, const Com en1, const Com st2, const Com en2){
	if(seg_crossing(st1, en1, st2, en2)){
		return 0;
	}
	return std::min(std::min(dist_dot_seg(st1, en1, st2), dist_dot_seg(st1, en1, en2)), std::min(dist_dot_seg(st2, en2, st1), dist_dot_seg(st2, en2, en1)));
}

Com p1, p2;
long q;
Com p;

int main(){
    double xp1, yp1, xp2, yp2;
    scanf("%lf%lf%lf%lf", &xp1, &yp1, &xp2, &yp2);
    p1 = Com(xp1, yp1);
    p2 = Com(xp2, yp2);
    scanf("%ld", &q);
    for(int i = 0; i < q; i++){
        double x, y;
        scanf("%lf%lf", &x, &y);
        p = Com(x, y);
        Com a = p - p1;
        Com b = p2 - p1;
        Com ans = dot_product(a, b) / (std::abs(b) * std::abs(b)) * b + p1;
        printf("%.10lf %.10lf\n", real(ans), imag(ans));
    }
}



Measured memory_bytes: 3284
n,k = gets.split.map &:to_i
hs = gets.split.map &:to_i

cost = Array.new(n + 1, Float::INFINITY)

cost[0] = 0

(1...n).each{ |i|
	start = i - k < 0 ? 0 : i - k
	
	(start ... i).each{ |j|
		next_cost = cost[j] + (hs[j] - hs[i]).abs
		cost[i] = next_cost if cost[i] > next_cost
	}
}

puts cost[n-1]

Measured memory_bytes: 11396
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int T = sc.nextInt();
		double max = 0;
		for (int i = 0; i < T; ++i) {
			max = Math.max(max, calc());
		}
		System.out.println(max > calc() + 0.0000001 ? "YES" : "NO");
	}

	static double calc() {
		int N = sc.nextInt();
		int M = sc.nextInt();
		double sum = 0;
		double sumR = 0;
		for (int i = 0; i < M; ++i) {
			int V = sc.nextInt();
			double R = sc.nextDouble();
			sum += V * R;
			sumR += R;
		}
		return sum / sumR;
	}

}

Measured memory_bytes: 28432
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  int a,b;
  cin>>a>>b;
  int ans=0;
  for(int i=a;i<=b;++i){
    int num=i;
    string s[5];
    rep(j,5){
      s[j]=num%10;
      num/=10;
    }
    if(s[0]==s[4] && s[1]==s[3])
      ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;


public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean able = false;
		for(int i = 1; i <= 9; i++) {
			if(n/i==(double)n/i&&n/i<10) {
				able = true;
				break;
			}
		}
		System.out.println(able?"Yes":"No");
	}	
}

Measured memory_bytes: 21972
n, k = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
INF = 1e18

DP = [[0] * 41 for i in range(2)]
DP[0][40] = -INF

for i in range(39, -1, -1):
    b = 1 << i
    cnt = [0, 0]
    for a in A:
        cnt[(a >> i) & 1] += 1
    for j in range(2):
        cnt[j] *= b
    if (k >> i) & 1:
        DP[1][i] = DP[1][i+1] + cnt[0]
        DP[0][i] = max(DP[0][i+1] + cnt[0], DP[0][i+1] + cnt[1], DP[1][i+1] + cnt[1])
    else:
        DP[1][i] = DP[1][i+1] + cnt[1]
        DP[0][i] = DP[0][i+1] + max(cnt)

print(max(DP[i][0] for i in range(2)))

Measured memory_bytes: 14620
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=j; i<=k; i++)
#define FFOR(i, j, k) for(int i=j; i<k; i++)
#define DFOR(i, j, k) for(int i=j; i>=k; i--)
#define bug(x) cerr<<#x<<" = "<<x<<'\n'
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
template <typename T> inline void read(T &x){
    char c;
    bool nega=0;
    while((!isdigit(c=getchar()))&&(c!='-'));
    if(c=='-'){
        nega=1;
        c=getchar();
    }
    x=c-48;
    while(isdigit(c=getchar())) x=x*10+c-48;
    if(nega) x=-x;
}
template <typename T> inline void writep(T x){
    if(x>9) writep(x/10);
    putchar(x%10+48);
}
template <typename T> inline void write(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    writep(x);
}
template <typename T> inline void writeln(T x){
    write(x);
    putchar('\n');
}
#define taskname "D"
#define MAX 100005
int n, q, k;
int a, b;
ll c;
vector <pair <int, ll> > g[MAX];
ll d[MAX];
bool done[MAX];
void dfs(int u){
    done[u]=1;
    for(pair <int, ll> v: g[u]) if(!done[v.first]){
        d[v.first]=d[u]+v.second;
        dfs(v.first);
    }
}
int main(){
    #ifdef Megumin
        if(fopen(taskname".inp", "r"))
            freopen(taskname".inp", "r", stdin);
    #endif // Megumin
    read(n);
    FFOR(i, 1, n){
        read(a);
        read(b);
        read(c);
        g[a].pb(mp(b, c));
        g[b].pb(mp(a, c));
    }
    read(q);
    read(k);
    dfs(k);
    FOR(i, 1, q){
        read(a);
        read(b);
        writeln(d[a]+d[b]);
    }
    return 0;
}

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

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main(){
	int X;
	cin >> X;
	int ans=0;
	ans+=X/500*1000;
	X%=500;
	ans+=X/5*5;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>

using namespace std;

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)

int main()
{
	ll n;
	double ans;

	cin >> n;

	{
		double len=(double)n/(double)3;

		ans = pow(len, 3);
	}

	cout << fixed << setprecision(12)<<ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
#define INF 100000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 100005;
const int MOD = 1000000007;
int main(){
    int r,d;
    ll x;
    cin>>r>>d>>x;
    REP(i,10){
        x=r*x-d;
        OUT(x);
    }
    return 0;
}

Measured memory_bytes: 256
using System;

namespace AtCoderABC128B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            string[][] rest = new string[N][];

            for (int i = 0; i < N; i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                rest[i] = new string[2];

                int score = 100 - int.Parse(s[1]);

                rest[i][0] = s[0] + score.ToString("000");
                rest[i][1] = (i + 1).ToString();
            }

            OrgComparer comp = new OrgComparer();
            Array.Sort(rest, comp);

            for (int i = 0; i < N; i++)
                Console.WriteLine(rest[i][1]);
        }
    }

    public class OrgComparer : System.Collections.IComparer
    {
        //配列２項目目で昇順
        public int Compare(object x, object y)
        {
            string[] X = (string[])x;
            string[] Y = (string[])y;

            if (X[0].CompareTo(Y[0]) < 0)
                return -1;
            if (X[0].CompareTo(Y[0]) > 0)
                return 1;

            return 0;
        }
    }

}


Measured memory_bytes: 11488
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int[] arr = new int[w+1];
    for(int i=0; i<=w; i++) {
      arr[i] = i;
    }
    int n = sc.nextInt();
    String drop = sc.nextLine();
    for(int i=0; i<n; i++) {
      String line = sc.nextLine();
      String[] tmp = line.split(",");
      int a = Integer.parseInt(tmp[0]);
      int b = Integer.parseInt(tmp[1]);
      int c = arr[a];
      arr[a] = arr[b];
      arr[b] = c;
    }
    for(int i=1; i<=w; i++) {
      System.out.println(arr[i]);
    }
  }
}

Measured memory_bytes: 26112
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main(int argc, char const *argv[])
{

    int n;
    cin >> n;
    int l[n];
    ll suml[n + 1], sumr[n + 1];
    rep(i, n + 1)
    {
        suml[i] = 0; //**********<=こっちがわ
        sumr[i] = 0; //=>**********こっちがわ
    }

    rep(i, n)
    {
        cin >> l[i];
    }
    suml[0] = 0;
    rep(i, 0, n)
    {
        suml[i + 1] = -suml[i] + l[i];
    }

    sumr[n] = 0;
    for (int i = n; i >= 0; i--)
    {
        sumr[i - 1] = -sumr[i] - l[i - 1];
    }
    rep(i, n)
    {
        cout << suml[i] + l[i] + sumr[i + 1] << " ";
    }
    cout << endl;

    return 0;
}


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

int N,K,ans;

int main()
{
    cin>>N>>K;
    ans=1;
    for(int i=0;i!=N;++i){
        ans=min(ans+K,ans*2);
    }
    cout<<ans<<endl;
    return 0;
}


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

int main()
{
    cin.tie(0);

    int n;
    cin >> n;
    vector<int64_t> as(n);
    for (int i = 0; i < n; i++)
        cin >> as[i];

    int64_t ans = 0x7fffffffffffffffL;

    for (int j = 0; j < 2; j++) {
        int64_t sum = 0, cur = 0;
        for (int i = 0; i < n; i++) {
            int plus = i % 2 == j % 2;

            sum += as[i];
            if (plus && sum > 0 || !plus && sum < 0) {
                continue;
            }

            if (plus) {
                cur += 1 - sum;
                sum = 1;
            } else {
                cur += sum - (-1);
                sum = -1;
            }
        }
        ans = min(ans, cur);
    }

    cout << ans << endl;

    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
   int h,w;
   cin >> h >> w;
    
   if(h == 1 || w == 1)
   {
       cout << 1;
       return;
   }
    
   if((h%2) == 0 || (w%2) == 0) cout << ((w*h)/2);
   else cout << (w*h)/2 + 1; 
    
}

signed main()
{
    fast;
    solve();
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i) 

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int a, b;
    cin>>a>>b;
    cout<<a/b<<" "<<a%b<<" ";
    printf("%.10f\n", (double)a / b);
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {

  int n;
  cin >> n;
  
  ll ans = 0;
  for(int i = 0; i <= n; i++) {
    if(i % 3 == 0 && i % 5 == 0)continue;
    if(i % 3 == 0) continue;
    if(i % 5 == 0) continue;
    ans = ans + i;
  }
  cout << ans << endl;
}

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

const int MAX = 101000;

int main() {
    int N;
    cin >> N;
    string s;
    vector<int> c(5,0);
    while(N--) {
        cin >> s;
        if(s[0] == 'M') c[0]++;
        else if(s[0] == 'A') c[1]++;
        else if(s[0] == 'R') c[2]++;
        else if(s[0] == 'C') c[3]++;
        else if(s[0] == 'H') c[4]++;
    }

    ll ans = 0;
    for(int i=0;i<5;++i) {
        for(int j=i+1;j<5;++j) {
            for(int k=j+1;k<5;++k) ans += (ll)c[i]*c[j]*c[k];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
/* ALDS1_9_A: Complete Binary Tree */

#include <iostream>
#include <cstdio>

inline bool between(int value, int begin, int end) {
    return begin <= value && value <= end;
}

int main() {
    int n_nodes;
    scanf("%d\n", &n_nodes);

    int tree[n_nodes + 1];
    for (int i = 1; i <= n_nodes; i++)
        scanf("%d", &tree[i]);

    int ip, il, ir;
    for (int i = 1; i <= n_nodes; i++) {
        printf("node %d: key = %d, ", i, tree[i]);

        ip = i / 2;
        if ( between(ip, 1, n_nodes) )
            printf("parent key = %d, ", tree[ip]);

        il = i * 2;
        if ( between(il, 1, n_nodes) )
            printf("left key = %d, ", tree[il]);

        ir = i * 2 + 1;
        if ( between(ir, 1, n_nodes) )
            printf("right key = %d, ", tree[ir]);

        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <string>
#include <numeric>

using namespace std;

int main() {
    int n;
    cin >> n;
    string s = to_string(n);
    cout << (n % (accumulate(s.begin(), s.end(), 0) - '0' * s.size()) ? "No" : "Yes") << endl;
    return 0;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/abc138/tasks/abc138_d
//D - Ki
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

template< typename T >
struct edge {
	int src, to;
	T cost;
	edge(int _to, T _cost) : src(-1), to(_to), cost(_cost) {}
	edge(int _src, int _to, T _cost) : src(_src), to(_to), cost(_cost) {}
	edge &operator=(const int &x) {
		to = x;
		return *this;
	}
	operator int() const { return to; }
};

template< typename T>
struct node {
	vector<edge<T>> edges;
    ll count=0;
    ll total=0;
    bool flag=false;
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< node< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;
//template graphで書き直し
int main(){
    ll N,Q; cin>>N>>Q;
    WeightedGraph<ll> graph(N+1);    
    REP(i,N-1){
        ll a,b; cin>>a>>b;
        graph.at(a).edges.emplace_back(a,b,1);
        graph.at(b).edges.emplace_back(b,a,1);
    }
    REP(i,Q){
        ll p,q; cin>>p>>q;
        graph.at(p).count+=q;
    }

    function<void(ll,ll)> dfs0 = [&](ll n,ll count){
        auto& node = graph.at(n);
        if(node.flag) return;
        node.flag = true;
        node.total = node.count + count;
        for(auto&& e: node.edges){
            dfs0(e.to, node.total);
        }
    };
    dfs0(1,0);

    FOR(i,1, N+1){
        if (i!=1) cout<<" ";
        cout<<graph.at(i).total;
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 34688