akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int ans=INF;
int N,M;
int A[309][309];
bool les[309];

void dfs(int cnt){
    if(cnt==M) return;
    map<int,int> dic;
    rep(i,N){
        rep(j,M){
            int a=A[i][j];
            if(les[a]) continue;
            dic[a]++;
            break;
        }
    }
    int best=-1, mx=-1;
    for(auto d:dic){
        if(mx<d.second){
            best=d.first;
            mx=d.second;
        }
    }
    chmin(ans,mx);
    les[best]=1;
    dfs(cnt+1);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N>>M;
    rep(i,N)rep(j,M) cin>>A[i][j];
    
    dfs(0);
    cout1(ans)
}

Measured memory_bytes: 2432
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class37
    {
        static void Main()
        {
            var nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = nk[0], k = nk[1];
            var h = Console.ReadLine().Split().Select(long.Parse).OrderByDescending(x => x).ToArray();
            for (int i = 0; i < k&&i<h.Length; i++) h[i] = 0;
            long ans = h.Sum();
            Console.WriteLine(ans);
        }
    }
}


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

int main(int argc, const char * argv[]) {
    int n, m;
    int i, j;
    int a[100][100]={};
    int b[100]={};
    int c[100]={};
    
    cin >> n >> m;
    
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            cin >> a[i][j];
        }
    }
    
    for(j=0;j<m;j++){
        cin >> b[j];
    }
    
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            c[i] += a[i][j] * b[j];
        }
        cout << c[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3148
S = input()

if S == 'RRR':
  print(3)
elif S == 'RRS' or S == 'SRR':
  print(2)
elif S == 'RSS' or S == 'SSR' or S == 'SRS' or S == 'RSR':
  print(1)
else:
  print(0)

Measured memory_bytes: 9096
#include <iostream>
#include <numeric>
#include <vector>

int main(void) {
	int H = 0;
	int A = 0;
	std::vector<int> moves;
	std::cin >> H >> A;
	int val = 0;
	for (int i = 0; i < A; i++) {
		std::cin >> val;
		moves.push_back(val);
	}
	
	if (std::accumulate(moves.begin(), moves.end(), 0) < H) {
		std::cout << "No" << std::endl;
		return 0;
	}
	std::cout << "Yes" << std::endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 3e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
int ans[MAXN];
pii id[MAXN];
char S[MAXN];

void chmin(pii &a,int x)
{
    if(x==-1)return;
    if(a.f==x||a.s==x)return;

    if(a.f==-1){a.f = x; return;}
    else if(A[a.f]<=A[x]){
        a.s = a.f; a.f = x;
        return;
    }
    else {
        if(a.s==-1)a.s = x;
        else if(A[a.s]<A[x])a.s = x;
        return;
    }
}

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n;

    for(int i=0;i<(1<<n);i++)
        cin>>A[i];

    id[0] = pii(0,-1);

    for(int i=1;i<(1<<n);i++){
        id[i] = pii(i,-1);
        for(int j=0;j<n;j++){
            if(!((1<<j)&i))continue;
            cur = i^(1<<j);
            chmin(id[i],id[cur].f);
            chmin(id[i],id[cur].s);
            chmin(id[i],(1<<j));
        }
        ans[i] = max(ans[i-1],A[id[i].f]+A[id[i].s]);
    }

    for(int i=1;i<(1<<n);i++)
        cout<<ans[i]<<"\n";

    return 0;
}


Measured memory_bytes: 7680
import math
a,b,c,d,e,f = map(int,input().split())
max_nodo = e/(e+100)
answer = {}
for i in range(31):
  for j in range(31):
    water = 100*a*i + 100*b*j
    max_sugar = water*e/100
    sugar_range = int(math.ceil(max_sugar/c))
    if water >= f:
      break
    for k in range(sugar_range):
      for l in range(sugar_range):
        sugar = c*k + d*l
        total = water + sugar
        nodo = sugar / total
        if total > f:
          break
        if sugar > max_sugar:
          break
        answer[nodo] = [total,sugar]
ans = max(answer.items(),key = lambda x:x[0])[1]

#print(answer)
print(str(ans[0]) + " " + str(ans[1]))

Measured memory_bytes: 4596
/* ex 6_1
   potter0723sw */

#include <stdio.h>

typedef struct point{
    int x_elem;
    int y_elem;
}point;

point shift_point(point pre, int x_shift, int y_shift){
    point post;
    post.x_elem = pre.x_elem + x_shift;
    post.y_elem = pre.y_elem + y_shift;
    return post;
}

int main(void){
    int dif_x, dif_y;
    point point_a, point_b, point_c, point_d;
    scanf("%d %d %d %d", &point_a.x_elem, &point_a.y_elem, &point_b.x_elem, &point_b.y_elem);
    dif_x = point_a.x_elem - point_b.x_elem;//aからbへのx座標の動き
    dif_y = point_a.y_elem - point_b.y_elem;//y座標の動き
    point_c = shift_point(point_b, dif_y, -dif_x);//３つ目の頂点は２つ目からx方向にdif_y,y方向に-dif_x動けば良い 
    point_d = shift_point(point_a, dif_y, -dif_x);//４つ目は１つ目から上と同じ動きをすれば良い
    printf("%d %d %d %d\n", point_c.x_elem, point_c.y_elem, point_d.x_elem, point_d.y_elem);
    return 0;
}

Measured memory_bytes: 1732
from heapq import heappush, heappop
n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
  a, b, c = map(int, input().split())
  edges[a].append((b, c))

dist = [0] * n
que = []
heappush(que, (0, 0))
while que:
  total, node = heappop(que)
  total *= -1
  for to, cost in edges[node]:
    if dist[to] < total + cost:
      dist[to] = total + cost
      heappush(que, (-(total + cost), to))
print(dist[n - 1])


Measured memory_bytes: 5756
// type a
//a...いけそう
//b...自信がない
//c...お試し
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
#include <array>
// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using ld = long double;
using ulint = unsigned long long;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr lint mod = 1000000007;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#define INF (lint)10000000000000000
#define mod (lint)1000000007
#pragma endregion

int n;
vector<int> d;
void input() {
	cin >> n;
	d.resize(n);
	for (int i = 0; i < n; i++) cin >> d[i];
	return;
}
int solve() {
	int ans = mod;
	for (int i = -100; i <= 100; i++) {
		int cnt = 0;
		for (int j = 0; j < n; j++) {
			cnt += (d[j] - i) * (d[j] - i);
		}
		ans = min(ans, cnt);
	}
	return ans;
}

int main(void) {
	input();
	printf("%d\n", solve());
	
	return 0;
}

Measured memory_bytes: 3760
# frozen_string_literal: true

n, d = gets.split.map(&:to_i)
xy = n.times.map { gets.split.map(&:to_i) }
c = 0
xy.each do |e|
  x = e[0]
  y = e[1]
  c += 1 if x*x + y*y <= d*d
end
puts c


Measured memory_bytes: 28360
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int n,k;
  cin >> n >> k;
  
  double ans = 0;
  for(int i = 1 ; i <= n ; i++){
    int a = i;
    for(int j = 0 ; j < 20 ; j++){
      if(a >= k){
        double b = (1<<j);
        ans += 1/b;
        break;
      }
      a *= 2;
    }
  }
  cout << fixed << setprecision(20);
  cout << ans/n << endl;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n;
  cin>>n;
  int a[n];
  int s=0;
  int m;
  REP(i,n){
    cin>>a[i];
    s += a[i];
  }
  m = s/n;
  int ans=0,res=0;
  REP(i,n){
    ans += (a[i]-m)*(a[i]-m);
    res += (a[i]-m-1)*(a[i]-m-1);
  }
  
  ans = min(ans,res);
  cout<<ans<<endl;
  return 0;
}



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

int main(){
  int a,b;
  cin >> a >> b;
  for (int i=0;i<a;++i){
    for (int j=0;j<b;++j){
      string s;
      cin >> s;
      if (s=="snuke"){
        cout << (char)('A'+j) << i+1 << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
N,K = map(int, input().split())
AList = list(map(int, input().split()))

A=str(K)
i=int(A)
j=0
while j<=N-K:
    #BList=AList[j:i]
    if j==0:
        MAE=AList[j]
    elif MAE>=AList[i-1]:
        print("No")
        MAE=AList[j]
    elif MAE<AList[i-1]:
        print("Yes")
        MAE=AList[j]
    i+=1
    j+=1

Measured memory_bytes: 31744
#include<stdio.h>
int main(){
	int c, r, x[101][101] = {}, i, j, k;
	scanf("%d %d", &c, &r);
	for(i=0; i<c; i++){
		for(j=0; j<r; j++){
			scanf("%d", &x[i][j]);
			x[i][r] += x[i][j];
		}
	}
	for(i=0;i<=r;i++){
		for(j=0;j<c;j++){
			x[c][i] += x[j][i];
		}
	}
	for(i=0;i<=c;i++){
		for(j=0;j<=r;j++){
			printf("%d", x[i][j]);
			if(j != r){
				printf(" ");
			}
		}
		printf("\n");
	}
}


Measured memory_bytes: 2068
#!/usr/bin/env python3
# sys.stdin.readline()
import numpy as np
import sys
import math
input = sys.stdin.readline
n,c,k = map(int,input().split())
A = [int(input()) for i in range(n)]
a = sorted(A)
ans = 0
time = 0.1 
num = 0
for i in range(n):
    if ans == 0:
        ans +=1
        time = a[0] 
        num +=1
    elif ans != 0 and a[i] <= time +k and num < c :
        num +=1
    elif  ans != 0 and (c <=num  or  time +k <=a[i]):
      
        time = a[i] 
        num = 1
        ans +=1
print(ans)

Measured memory_bytes: 17528
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include <string.h>
using namespace std;

#define KAME 4
#define TSURU 2

int main() {
    int     X, Y;
    
    cin >> X >> Y;
    
    for ( int ii = 0; ii <= X; ii++ ) {
        if ( ii * KAME + (X - ii) * TSURU == Y ) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3680
import java.io.IOException;
import java.util.Scanner;
 
public class Main {
  /**
   * Main method.
   */
  public static void main(String[] args) throws IOException {
    Scanner s = new Scanner(System.in);
    
    String S = s.next();
    
    if (S.contains("a") && S.contains("b") && S.contains("c")) {
    	System.out.println("Yes");
    } else {
    	System.out.println("No");
    }

  }
}


Measured memory_bytes: 23764
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main(){
	int a, b;
	cin >> a >> b;
	if (a <= b)cout << a << endl;
	else cout << a-1 << endl;
	char nyaa;
	cin >> nyaa;
	return 0;
}

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

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

  if ((N[0] == N[1] && N[1] == N[2]) || (N[1] == N[2] && N[2] == N[3])) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

int main(){
  int N;
  cin >> N;
  vector<int> T(N);
  int ans = 0;
  for(int i=0; i<N; i++){
    cin >> T.at(i);
    ans+=T.at(i);
  }
  int M;
  cin >> M;
  vector<int> P(M);
  vector<int> X(M);
  for(int i=0; i<M; i++){
    cin >> P.at(i) >> X.at(i);
  }
  for(int i=0; i<M; i++){
    cout << ans - (T.at(P.at(i)-1)-X.at(i)) << endl;
  }
}

Measured memory_bytes: 256
// 参考: https://atcoder.jp/contests/abc153/submissions/9768005

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int n;
    ll d, a;
    cin >> n >> d >> a;
    vector<P> p(n);
    rep(i, n) cin >> p[i].first >> p[i].second;
    sort(p.begin(), p.end());
    ll ans = 0;
    vector<int> right(n);
    // 尺取り法によりp[j].first - p[i].first > 2*Dとなる最小のjをright[i]に入れておく
    int j = 0;
    rep(i, n) {
        while (j < n && p[j].first - p[i].first <= 2*d) {
            j ++;
        }
        right[i] = j;
    }
    ll total = 0;
    vector<ll> imos(n + 1); // いもす法
    rep(i, n) {
        int x = p[i].first;
        ll h = p[i].second;
        total += imos[i];
        h -= total;
        if (h > 0) {
            ll num = (h + a - 1) / a;
            ans += num;
            ll damage = num * a;
            total += damage;
            imos[right[i]] -= damage;
        }
    }
    cout << ans << endl;
    return 0;
}

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

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


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

using namespace std;

const int mod = (int) 1e9 + 7;
int add(int a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}

int mul(int a, int b) {
  return (long long) a * b % mod;
}

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  int res = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      res += (a[i] > a[j]);
    }
  }
  res = mul(res, k);
  
  for (int i = 0; i < n; i++) {
    int larger = 0;
    for (int j = 0; j < n; j++) {
      larger += (a[j] > a[i]);
    }
    res = add(res, mul(larger, (long long) k * (k - 1) / 2 % mod));
  }
  cout << res << '\n';
  return 0;
}

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

using namespace std;

int main(int argc, char** argv) {
    string s;
    cin >> s;

    if(s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline

n,k,q = map(int, input().split())
l = [0 for _ in range(n + 1)]
for _ in range(q):
	l[int(input())] += 1
for i in range(1, n + 1):
	if k - (q - l[i]) > 0:
		print("Yes")
	else:
		print("No")





Measured memory_bytes: 47152
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=1e5+500;
char st[N];
int n,m;
int main()
{
    scanf("%d%d",&n,&m);int cnt=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%s",st+1);
        for(int j=1;j<=m;j++)cnt+=st[j]=='#';
    }
    puts(cnt==n+m-1?"Possible":"Impossible");
}

Measured memory_bytes: 3740
import sys

input = sys.stdin.readline


def main():
    K, Q = map(int, input().split())
    D = list(map(int, input().split()))

    for _ in range(Q):
        n, x, m = map(int, input().split())
        md = [D[i] % m for i in range(K)]
        smda = 0
        mda0 = 0
        for i in range((n - 1) % K):
            if md[i] == 0:
                mda0 += 1
            smda += md[i]
        smd = smda
        md0 = mda0
        for i in range((n - 1) % K, K):
            if md[i] == 0:
                md0 += 1
            smd += md[i]
        roop = (n - 1) // K
        res = n - 1 - (x % m + smd * roop + smda) // m - md0 * roop - mda0
        print(res)


main()


Measured memory_bytes: 60380
using System;

namespace atcoder {
    class Program 
    {
        static void Main (string[] args)
        {
            ABC140.Password();
        }
    }

    class ABC140
    {
        public static void Password()
        {
            double n = double.Parse(Console.ReadLine());
            Console.WriteLine(Math.Pow(n, 3));
        }

    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main(){
    int n,m,t;
    cin >> n >> m >> t;
    int a[n];
    for(int i=0;i<n;i++) cin >> a[i];
    int ans=0;
    for(int i=0;i<n;i++){
        if(i==0)
            ans+=a[0]-m;
        if(i==n-1)
            if(t-a[n-1]>m)
                ans+=t-a[n-1]-m;
        if((1!=0)&&(i!=n-1)&&((a[i+1]-a[i]-2*m)>=0))
            ans+=(a[i+1]-a[i]-2*m);
    }
    cout << ans << endl;

}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ARB ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const int maxn=1e5+5;
const long double EPS = 1e-14;
int main()
{
    ARB
    long double a,b,c;
    cin >> a >> b >> c;
    if (sqrt(a)+sqrt(b)<sqrt(c)-EPS)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n,k;
  cin>>n>>k;
  vector<Int> cnt(k);
  for(Int i=1;i<=n;i++) cnt[i%k]+=(i<<1)%k==0;
  Int ans=0;
  for(Int i=0;i<k;i++) ans+=cnt[i]*cnt[i]*cnt[i];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
using namespace std;
int main(){
	int64_t n, k;
	vector<int64_t> v(1000001, 0);
	cin >> n >> k; k--;
	for (int64_t i = 0; i < n; ++i) {
		int64_t ai, bi;
		cin >> ai >> bi;
		v[ai] += bi;
	}
	for (int64_t ai = 0; ai < v.size(); ++ai) {
		if (v[ai] == 0) continue;
		k -= v[ai];
		if (k < 0) {
			cout << ai << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 8064
import java.util.*;

import static java.lang.System.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();

        // 6, 5, 6, 5 ...のときが最小の操作回数
        long cnt = (long) (N / 11) * 2;

        long rest = N % 11;
        if (rest > 0) {
            if (rest <= 6) {
                cnt += 1;
            } else {
                cnt += 2;
            }
        }

        out.println(cnt);
    }
}

Measured memory_bytes: 23124
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

int H, W, K;
string S[6];
int ans = 0;

signed main(){
    cin >> H >> W >> K;
    rep(i, H) cin >> S[i];

    rep(i, 1<<H){
        rep(j, 1<<W){
            int tmp = 0;
            rep(k, H){
                rep(l, W){
                    tmp += (S[k][l] == '#' && ((i>>k)&1) == 0 && ((j>>l)&1) == 0);
                }
            }
            if(tmp == K) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    long double sa = sqrt((long double)a);
    long double sb = sqrt((long double)b);
    long double sc = sqrt((long double)c);    
    if(a+2*sa*sb+b<c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define lowbit(x) x&(-x)
#define PII  pair<int, int> 
#define all(x) x.begin(), x.end()
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
typedef long long ll;
const ll inf = 1e18;
const int mod = (int)1e9 + 7;
const int maxn = (int)1e3 + 5;
using namespace std;

#define int ll

struct node{
	int x, y;
}a[maxn];

int d[50];
int dir[4][2] = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} };
string s = "LRUD";
int n, cnt = 0;

int dis(int x1, int y1, int x2, int y2){
	return abs(x1 - x2) + abs(y1 - y2);
}

void work(int x, int y){
	node now;
	now.x = now.y = 0;
	for(int i = 1; i <= cnt; i++){
		int Min = inf;
		int pos = 0;
		for(int j = 0; j < 4; j++){
			int tx = now.x + dir[j][0] * d[i], ty = now.y + dir[j][1] * d[i];
			int t = dis(tx, ty, x, y);
			if(Min > t) Min = t, pos = j;
		}
		now.x += d[i] * dir[pos][0], now.y += d[i] * dir[pos][1];
		putchar(s[pos]);
	}
	puts("");
}

int32_t main()
{
	scanf("%lld", &n);
	for(int i = 1; i <= n; i++){
		scanf("%lld %lld", &a[i].x, &a[i].y);
		if((abs(a[i].x + a[i].y) & 1) != (abs(a[1].x + a[1].y) & 1)) return 0 * puts("-1");
	}
	for(int i = 30; i >= 0; i--){
		d[++cnt] = 1 << i;
	}
	if((a[1].x + a[1].y) % 2 == 0) d[++cnt] = 1;
	printf("%lld\n", cnt);
	for(int i = 1; i < cnt; i++)
		printf("%lld ", d[i]);
	printf("%lld\n", d[cnt]);
	for(int i = 1; i <= n; i++){
		work(a[i].x, a[i].y);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for (int i=a; i<b; ++i)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll N,K;
    cin >> N >> K;
    vector <ll> A(N);
    loop(i,0,N) cin >> A[i];
    sort(A.begin(), A.end());
    cout << accumulate(A.begin(), A.begin()+K, 0ll) << "\n";
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    int ans = 1e9;
    ans = MIN(ans, A * X + B * Y);
    ans = MIN(ans, C * 2 * X + B * MAX(Y - X, 0));
    ans = MIN(ans, A * MAX(X - Y, 0) + C * 2 * Y);
    ans = MIN(ans, C * 2 * MAX(X, Y));

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define MAX 1 << 15

using namespace std;

bool prime[MAX+1];

void eratos(){
  int n=MAX;
  for(int i=0;i<=n;i++) prime[i]=false;
  for(int i=3;i<=n;i+=2) prime[i]=true;
  prime[2]=true;
  int limit=(int)sqrt((double)n)+1;
  for(int i=3;i<=limit;i+=2){
    if(!prime[i]) continue;
    for(int j=i+i;j<=n;j+=i)
      prime[j]=false;
  }
}

main(){
  eratos();
  int data[3513];
  for(int i=0, j=0;i<=MAX;i++){
    if(prime[i]) data[j++]=i;
  }
  data[3512]=-1;
  int x;
  while(1){
    cin >> x;
    if(x==0) break;
    int ans=0;
    for(int i=0;;i++){
      if(data[i]==-1) break;
      if(data[i]>x/2) break;
      if(prime[x-data[i]]){
	ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main() {
  long long N,K;
  cin>>N>>K;
  
  vector<long long> vec(N);
  rep(i,N){cin >> vec.at(i);}
  
  rep(i,N-K){
    if(vec.at(i)<vec.at(i+K)){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
  }
}

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

const int64_t MOD = 1000 * 1000 * 1000 + 7;

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

  // i番目の文字を見た時に13との剰余がnになる個数を数え上げる
  std::vector<int64_t> dp((s.length() + 1) * 13);

  dp[0] = 1;

  for (int i = 0, e = s.length(); i < e; ++i) {
    // ?ならvalは-1になる
    int val = -1;
    if (s[i] != '?') val = s[i] - '0';

    // 今がhatenaなら
    if (val == -1) {
      // 次の文字は0-10のどれかで
      for (int next = 0; next < 10; ++next) {
        // 現在地の剰余の結果は0-13のどこかになるので
        for (int here = 0; here < 13; ++here) {
          // here * 10 + nextでひっ算的なことができる
          auto &next_dp = dp[(i + 1) * 13 + ((here * 10 + next) % 13)];
          const auto &here_dp = dp[i * 13 + here];
          next_dp = (next_dp + here_dp) % MOD;
        }
      }
    } else {
      for (int here = 0; here < 13; ++here) {
        auto &next_dp = dp[(i + 1) * 13 + ((here * 10 + val) % 13)];
        const auto &here_dp = dp[i * 13 + here];
        next_dp = (next_dp + here_dp) % MOD;
      }
    }
  }
  std::cout << dp[s.length() * 13 + 5] << std::endl;
  return 0;
}

Measured memory_bytes: 10624
//AOJ0537 bingo
#include <iostream>
#include <algorithm>
#include <vector>
#define MOD 100000
using namespace std;

int main(){
	int n,m,s;
	/*int dp[2001][50][3001] = {};
	dp[1][1][1] = 1;
	dp[1][0][0] = 1;
	for(int i = 2;i <= 2000;i++){
		for(int j = 0;j <= 49;j++){
			for(int k = 0;k <= 3000;k++){
				if(j == 0) dp[i][j][0] = 1;
				else if(k - i >= 0) dp[i][j][k] = (dp[i - 1][j][k] + dp[i - 1][j - 1][k - i]) % MOD;
				else dp[i][j][k] = dp[i - 1][j][k];
			}
		}
	}*/
	while(1){
		cin >> n >> m >> s;
		if(!n) break;
		int dp[2][50][3001] = {};
		dp[1][1][1] = 1;
		dp[1][0][0] = 1;
		for(int i = 2;i <= m;i++){
			for(int j = 0;j <= n * n;j++){
				for(int k = 0;k <= s;k++){
					if(j == 0) dp[i % 2][j][0] = 1;
					else if(k - i >= 0) dp[i % 2][j][k] = (dp[(i + 1) % 2][j][k] + dp[(i + 1) % 2][j - 1][k - i]) % MOD;
					else dp[i % 2][j][k] = dp[(i + 1) % 2][j][k];
				}
			}
		}
		cout << dp[m % 2][n * n][s] << endl;
	}
	return 0;
}

Measured memory_bytes: 4148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll n,m;
    cin>>n>>m;
    vector<pair<ll,ll>>a(n);
    rep(0,i,n){
        cin>>a[i].first>>a[i].second;
    }
    sort(a.begin(),a.end());
    ll ans=0,i=0;
    ++m;
    while(--m){
        if(i==n)break;
        if(a[i].second==0)++i;
        --a[i].second;
        ans+=a[i].first;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
K, N = map(int, input().split())
A = list(map(int, input().split()))
tmp = 0
for i in range(N-1):
    tmp = max(A[i+1] - A[i], tmp)
tmp = max(tmp, A[0]+K - A[-1])
print(K-tmp)

Measured memory_bytes: 25832
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
int main(){
  ll N,K;
  cin>>N>>K;
  ll A,B;
  ll X[100010]={0};
  rep(i,N){
    cin>>A>>B;
    X[A-1]+=B;
  }
  ll S=0,ans;
  rep(i,100010){
    S+=X[i];
    if(S>=K){
      ans=i+1;
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include<algorithm>
#define int long long
using namespace std;
typedef pair<int,int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000000

int MOD=1000000007;
int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}

int gyaku(int n){
    return modpow(n,MOD-2);
}
////////////////////////////////////////////////////////////
int keta(int n){
  int c=0;
  while(n>0){
    n/=10;
    c++;
  }
  return c;
}
signed main() {
  int n,k;
  cin>>n>>k;
  int ans=0;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  rep(i,n-1){
    int t=a[i]+a[i+1];
    if(t>k){
      if(t-k>a[i+1]){
        a[i+1]=0;
      }
      else{
        a[i+1]-=(t-k);
      }
      ans+=(t-k);
    }

  }
  cout<<ans<<endl;
}


Measured memory_bytes: 4048
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int n;
  cin >> n;
  int b[n - 1];
  for (int i = 0; i < n - 1; i++)
  {
    cin >> b[i];
  }
  ll ans = b[0];
  for (int i = 1; i < n - 1; i++)
  {
    ans += min(b[i - 1], b[i]);
  }
  ans += b[n - 2];
  
  cout << ans << endl;
}

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

int main(int argc, char const *argv[])
{
	char a[4];
	for (int i = 0; i < 4; ++i)
	{
		cin>>a[i];
	}
	int op[4]={};
	while (op[3]==0)
	{
		int now=a[0]-'0';
		for (int i = 0; i < 3; ++i)
		{
			if (op[i]==0)
			{
				now+=a[i+1]-'0';
			}
			else
			{
				now-=a[i+1]-'0';
			}
		}
		if (now==7)
		{
			string ans;
			for (int i = 0; i < 3; ++i)
			{
				ans+=a[i];
				if (op[i]==0)
				{
					ans+="+";
				}
				else
				{
					ans+="-";
				}
			}
			ans+=a[3];
			ans+="=7";
			cout<<ans<<endl;
			return 0;
		}
		int tmp=0;
		while (op[tmp]==1)
		{
			op[tmp]=0;
			++tmp;
		}
		op[tmp]=1;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,a[ohara],b[ohara],c[ohara],d,tmp,tmpp,m,h,w,x,y,sum[ohara],pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll z;
map<P,ll> mp;
ll cntt;
priority_queue<ll> ans;

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>x>>y>>z>>k;
    rep(i,x)cin>>a[i];
    rep(i,y)cin>>b[i];
    rep(i,z)cin>>c[i];
    sort(a,a+x);
    rep(i,y){
        rep(j,z){
            sum[cnt++]=b[i]+c[j];
        }
    }
    sort(sum,sum+cnt);
    reverse(sum,sum+cnt);
    ll lim=0;
    rep(i,cnt){
        lim++;
        if(lim==k+1)break;
        rep(j,x){
            ans.push(sum[i]+a[j]);
        }
    }
    rep(i,k){
        Cout(ans.top());
        ans.pop();
    }
    return 0;
}


Measured memory_bytes: 47076
n, m, x = map(int,input().split())
c_a_list=[list(map(int,input().split())) for _ in range(n)]

import itertools

on_off_list = list(itertools.product([0,1], repeat=n))

dp_c_a = [[0 for i in range(m+1)] for j in range(len(on_off_list))]

# iはパターン、jは参考書、kはアルゴリズム
for i in range(len(on_off_list)):
    for j in range(len(on_off_list[i])):
        for k in range(m+1):
            dp_c_a[i][k] +=  c_a_list[j][k] * on_off_list[i][j]

ans_min = 1000000000
for i in range(len(dp_c_a)):
    count = 0
    for j in range(1, len(dp_c_a[i])):
        if dp_c_a[i][j] < x:
            count += 1
    if count == 0:
        ans_min = min(ans_min, dp_c_a[i][0])

if ans_min == 1000000000:
    print(-1)
else:
    print(ans_min)

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

#include <unordered_map>

//#include <iostream>//POJ
//#include <vector>
//#include <string>
//#include <iomanip>
//#include <math.h>
//#include <algorithm>
//#include <cstring>
using namespace std;
#define setc cin.tie(0);ios::sync_with_stdio(0)
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define repi_(i,a,b) for(int i=(a), i##_len=(b); i<=i##_len; ++i)
#define rep_(i,n) repi_(i,0,n)
#define repir(i,a,b) for(int i=(a)-1, i##_first=(b); i>=i##_first; --i)
#define repr(i,n) repir(i,n,0)
#define repir_(i,a,b) for(int i=(a), i##_first=(b); i>=i##_first; --i)
#define repr_(i,n) repir_(i,n,0)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
//template<typename T> T vpop(vector<T> *v) {
//	T res = v->back();
//	v->pop_back();
//	return res;
//}
//char vpop(string *v) {
//	char res = v->back();
//	v->pop_back();
//	return res;
//}
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define contain(q) !q.empty()
#define cont(q) !q.empty()
//#define qpop(q, a, b) a=q.back().first;b=q.back().second;q.pop()
//#define pqpop(p, a, b) a=q.top().first;b=q.top().second;q.pop()
#define el "\n"
#define sp " "
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#define POSSIBLE(c) coc(c, "POSSIBLE", "IMPOSSIBLE")
#define Possible(c) coc(c, "Possible", "Impossible")
#define possible(c) coc(c, "possible", "impossible")
#define inf INT_MAX
#define wildcard(T) numeric_limits<T>::min()

#define pb push_back
#define pq priority_queue
#define np next_permutation

#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
const unsigned int bf0 = (1 << 0);
const unsigned int bf1 = (1 << 1);
const unsigned int bf2 = (1 << 2);
const unsigned int bf3 = (1 << 3);
const unsigned int bf4 = (1 << 4);
const unsigned int bf5 = (1 << 5);
const unsigned int bf6 = (1 << 6);
const unsigned int bf7 = (1 << 7);

typedef long long lint;
typedef vector<int> ivec; typedef vector<string> svec;
typedef vector<lint> lvec;
typedef vector<vector<int>> ivvec;
typedef pair<int, int> P;

const int
dx8[8] = { 0,1,1,1,0,-1,-1,-1 },
dy8[8] = { 1,1,0,-1,-1,-1,0,1 },
dx4[4] = { 0,1,0,-1 },
dy4[4] = { 1,0,-1,0 };

template<class T>inline bool maxi(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool mini(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

int main(){
	setc;

	string in;cin>>in;
	in[5]=' ';
	in[13]=' ';
	co(in);
	gc();
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	string s,t;
	cin>>s>>t;
	if(t.size() - s.size() != 1)
	{
		puts("No");
		return 0;
	} 
	for(int i=0; i<s.size(); i++)
	{
		if(s[i] != t[i])
		{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 3132
N = int(input())
A = [int(v) for v in input().split(' ')]
B = [int(v) for v in input().split(' ')]
C = [int(v) for v in input().split(' ')]

point = 0
prev_dish = -1
for i in range(0, N):
    dish = A[i]
    point += B[dish - 1]

    if prev_dish + 1 == dish:
        point += C[prev_dish - 1]
    prev_dish = dish

print(point)

Measured memory_bytes: 3064
class BinaryTree
  attr_accessor :nodes

  class Node
    attr_accessor :id, :left, :right, :parent

    def initialize(id)
      @id = id
      @left = nil
      @right = nil
      @parent = nil
    end

  end

  def initialize
    @nodes = []
  end

  def add_node(id, left, right)
    @nodes[id] = Node.new(id) unless @nodes[id]
    if left != -1
      @nodes[left] = Node.new(left) unless @nodes[left]
      @nodes[id].left = @nodes[left]
      @nodes[id].left.parent = @nodes[id]
    end
    if right != -1
      @nodes[right] = Node.new(right) unless @nodes[right]
      @nodes[id].right = @nodes[right]
      @nodes[id].right.parent = @nodes[id]
    end
  end

  def preorder(n)
    return unless n
    print " #{n.id}"
    preorder(n.left)
    preorder(n.right)
  end

  def inorder(n)
    return unless n
    inorder(n.left)
    print " #{n.id}"
    inorder(n.right)
  end

  def postorder(n)
    return unless n
    postorder(n.left)
    postorder(n.right)
    print " #{n.id}"
  end

end

n = gets.to_i
bt = BinaryTree.new
n.times do |i|
  id, left, right = gets.split.map { |i| i.to_i }
  bt.add_node(id, left, right)
end

root = bt.nodes.select do |n|
  n.parent  == nil
end

puts "Preorder"
bt.preorder(root[0])
print "\n"

puts "Inorder"
bt.inorder(root[0])
print "\n"

puts "Postorder"
bt.postorder(root[0])
print "\n"

Measured memory_bytes: 8752
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define mp make_pair
#define pb push_back
int main()
{
	SPEED
	int r,d,x;
	cin >> r >> d >> x;
	for (int i = 0; i < 10; ++i)
	{
		x = (r*x) - d;
		cout << x << '\n';
	}
	return 0;
}

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

int N, M;
vector<int> c;
vector<bool> a;

int main() {
  cin >> N >> M;
  c.resize(N);
  a.resize(N);

  for (int i = 0; i < N; ++i) {
    c[i] = 1;
  }
  a[0] = true;
  for (int i = 1; i < N; ++i) {
    a[i] = false;
  }

  for (int i = 0; i < M; ++i) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    if (a[x]) {
      if (c[x] == 1) {
        a[x] = false;
      }
      a[y] = true;
    }
    --c[x], ++c[y];
  }

  int t = 0;
  for (int i = 0; i < N; ++i) {
    if (a[i]) {
      ++t;
    }
  }
  cout << t << endl;

  return 0;
}


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

using ll = long long int;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

#define pi 3.14159265358979

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




ll cnt_rep = 0;
ll powmod(ll N, ll P, ll M){
  cnt_rep++;
  if(P == 0) return 1;
  if(P%2 == 0){
    ll t = powmod(N, P/2, M);
    return t*t % M;
  }
  return (N * powmod(N, P-1, M)) % M;
}


ll gcd(ll a, ll b){
  ll resi, g, l;
  if(a > b){
    g = a; l = b;
  }else if(b > a){
    g = b; l = a;
  }else{
    return a;
  }
  resi = g % l;
  if(resi != 0){
    return gcd(l, resi);
  }else{
    return l;
  } 
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

int ans = 0;
int N, M, Q;

template<typename T>
void showall(vector<T> v){
  rep(i, 0, v.size()){
    cout << v[i] << " ";
  }
  cout << endl;
}


void dfs(vector<ll> ls, vector<vector<ll>> way, int ){
  ll cur = ls.back();
  ls.pop_back();

  rep(i, 0, N){
    if(way[cur][i] != 0){

    }
  }

}

 
int main() {
  string S, T;
  cin >> S >> T;

  rep(i, 0, S.length()){
    if(S[i] != T[i]){
      cout << "No" << endl;
      return 0;
    }
  }

  if(S.length() + 1 == T.length()){
    cout << "Yes" << endl;
      return 0;
  }else{
    cout << "No" << endl;
      return 0;
  }
  
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
 
using namespace std;
 
// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair 
#define mt make_tuple
#define fi first
#define se second
#define gcd __gcd
#define maxe *max_element
#define mine *min_element
#define deb debug
 
#define forz(i,n) for(long long int i=0;i<n;i++)
#define rep(i,k,n) for (lli i = k; i <= n; i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)
 
typedef pair <lli,lli> pll;
 
 
lli countGreater(lli arr[], lli n, lli k) 
{ 
    lli l = 0; 
    lli r = n - 1; 
  
    // Stores the index of the left most element 
    // from the array which is greater than k 
    lli leftGreater = n; 
  
    // Finds number of elements greater than k 
    while (l <= r) { 
        lli m = l + (r - l) / 2; 
  
        // If mid element is greater than 
        // k update leftGreater and r 
        if (arr[m] > k) { 
            leftGreater = m; 
            r = m - 1; 
        } 
  
        // If mid element is less than 
        // or equal to k update l 
        else
            l = m + 1; 
    } 
  
    // Return the count of elements greater than k 
    return (n - leftGreater); 
}
 
bool is_palin(string input)
{
if (input == string(input.rbegin(), input.rend())) 
    return true;
return false;
}
void solve()
{
    string s;cin>>s;
    if(s=="ARC")
    {
        cout<<"ABC"<<endl;
    }
    else
    {
        cout<<"ARC"<<endl;
    }
}
 
int main()
{
    kira; 
 
    lli t=1;// cin>>t;
    while(t--)
    {
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3656
# coding=utf-8

if __name__ == '__main__':
    N = int(input())

    li = list(map(int, input().split()))

    M = max(li)
    # print(M)

    MV = li[0]
    C = 0
    hai = li.index(M)
    #print(hai)
    for i in range(N):
        if i < hai:
            if MV > li[i]:
                C += MV - li[i]
            else:
                MV = li[i]

        else:
            C += M - li[i]
        #print(C)

    print(C)


Measured memory_bytes: 32272
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld  = long double;
using pll = pair<ll, ll> ;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=1LL<<60;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用（EPSより小さいと0と判定など）
 
#define gcd __gcd //llは受け取ってくれない
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define ALL(a) a.begin(),a.end() //sort(ALL(vec));
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define PB push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに

//最大値、最小値を更新する。aよりbのが大きい（小さい）か等しければaを更新してtrueを返す。そうでなければ何もせずfalseを返す chmax(nowmax,x);
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
// ----- template end ---- //
 
// ------- library ------- //





// ----- library end ----- //



int main() {

  ll L, R;
  cin >> L >> R;

  ll t = 2019;

  if ((R/t)!=(L/t) || L==t || R==t || L == 0 || R == 0){
    cout << 0 << endl;
    return 0;
  }

  ll ans = LINF;
  //2019を含まない、全探索
  REP(l, L, R){ //Rはjが使うから使えない
    REP(r, l+1, R+1){
      chmin(ans, (l % t)*(r % t) % t);
//      cout << l << ' ' << r << ' ' << (((l % t)*(r % t)) % t) << endl;
    }
  }

  cout << ans << endl;
  return 0;

// -- main() end -- //
}



Measured memory_bytes: 256
import sys

input = sys.stdin.readline
N, K = map(int, input().split())
A = [int(input()) for _ in range(N)]


class SegmentTree:
    def __init__(self, n, segfunc=min, ele=10**10):
        self.ide_ele = ele
        self.num = pow(2, (n-1).bit_length())
        self.seg = [self.ide_ele] * 2 * self.num
        self.segfunc = segfunc

    def init(self, init_val):
        #set_val
        for i in range(len(init_val)):
            self.seg[i+self.num-1] = init_val[i]
        #built
        for i in range(self.num-2, -1, -1):
            self.seg[i] = self.segfunc(self.seg[2*i+1], self.seg[2*i+2])

    def update(self, k, x):
        k += self.num-1
        self.seg[k] = x
        while k:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1], self.seg[k*2+2])

    def query(self, p, q):
        if q <= p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res = self.ide_ele
        while q-p > 1:
            if p & 1 == 0:
                res = self.segfunc(res, self.seg[p])
            if q & 1 == 1:
                res = self.segfunc(res, self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res, self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res, self.seg[p]), self.seg[q])
        return res

    def get_val(self, k):
        k += self.num-1
        return self.seg[k]


n = 3*pow(10, 5)
st = SegmentTree(n + 1, segfunc=max, ele=0)
for a in A:
    c = st.query(max(0, a - K), min(n + 1, a + K+1))
    st.update(a, c + 1)
print(st.query(0, n+1))


Measured memory_bytes: 124672