akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void){
  int n,num;
  scanf("%d",&n);
  num = n % 10;
  if(num == 2 || num == 4 || num == 5 || num == 7 || num == 9)
    printf("hon");
  
  else if(num == 0 || num == 1 || num == 6 || num == 8)
    printf("pon");
  
  else if(num == 3)
    printf("bon");
  return 0;
}

Measured memory_bytes: 1720
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;

ll X[50], Y[50], res = llmax;
int K, N;

int main() {
	cin >> N >> K;
	for (int i = 0; i != N; ++i)
		cin >> X[i] >> Y[i];
	for (int i = 0; i != N; ++i) {
		for (int j = i + 1; j != N; ++j) {
			ll xl = min(X[i], X[j]);
			ll xr = max(X[i], X[j]);
			for (int k = 0; k != N; ++k) {
				for (int l = k + 1; l != N; ++l) {
					ll yl = min(Y[k], Y[l]);
					ll yr = max(Y[k], Y[l]);
					int cnt = 0;
					for (int m = 0; m != N; ++m) {
						if (xl <= X[m] && X[m] <= xr && yl <= Y[m] && Y[m] <= yr)
							++cnt;
					}
					if (cnt >= K)
						res = min(res, (xr - xl)*(yr - yl));
				}
			}
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
int G(x,y){return y?G(y,x%y):x;}
#define L(x,y)((long long)x/G(x,y)*y)
n[3],a[3],m[3];main(i,x){for(;scanf("%d%d%d%d%d%d",a,m,a+1,m+1,a+2,m+2),*m;n[0]*=n[1]/G(n[0],n[1]),printf("%lld\n",L(n[0],n[2])))for(i=3;i--;)for(x=n[i]=1;(x=a[i]*x%m[i])>1;n[i]++);}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int dp1[6000][6006],dp2[6000][6006];

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,T;
	cin >> N >> T;
	vector<int> a(N),b(N);
	rep(i,N)cin >> a[i] >> b[i];
	rep(i,N){
		for(int j=0;j<T;j++){
			if(j>=a[i]){
				if(i==0){
					dp1[i][j] = b[i];
				}else{
					dp1[i][j] = max(dp1[i-1][j],dp1[i-1][j-a[i]] + b[i]);
				}
			}else{
				if(i==0)dp1[i][j] = 0;
				else dp1[i][j] = dp1[i-1][j];
			}
		}
	}
	for(int i=N-1;i>=0;i--){
		for(int j=0;j<T;j++){
			if(j>=a[i]){
				if(i==N-1)dp2[i][j] = b[i];
				else dp2[i][j] = max(dp2[i+1][j],dp2[i+1][j-a[i]] + b[i]);
			}else{
				if(i==N-1)dp2[i][j] = 0;
				else dp2[i][j] = dp2[i+1][j];
			}
		}
	}
	int ans = max(b[0] + dp2[1][T-1], b[N-1] + dp1[N-2][T-1]);
	for(int i=1;i<N-1;i++){
		int t;
		for(int j=0;j<T;j++){
			t = dp1[i-1][j] + b[i] + dp2[i+1][T-1-j];
			ans = max(ans,t);
		}
	}
	cout << ans << endl;
}

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

// @author: pashka

const long MOD = 1000000007;

vector<long> fact, inv_fact;

long mult(long a, long b) {
    return (a * b) % MOD;
}

long power(long a, long b) {
    long res = 1;
    while (b > 0) {
        if (b & 1)
            res = mult(res, a);
        a = mult(a, a);
        b /= 2;
    }
    return res;
}

long inv(long a) {
    return power(a, MOD - 2);
}

long calc_c(long n, long k) {

    while (n >= (int)fact.size()) {
        fact.push_back(mult(fact.back(), fact.size()));
        inv_fact.push_back(inv(fact.back()));
    }

    long res = fact[n];
    res = mult(res, inv_fact[k]);
    res = mult(res, inv_fact[n - k]);
    return res;
}

long calc(long r, long c) {
    return calc_c(r + c + 2, r + 1) - 1;
}

int main() {
    ios::sync_with_stdio(false);
    fact.push_back(1);
    inv_fact.push_back(1);

    long r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    long res = calc(r2, c2) - calc(r2, c1 - 1) - calc(r1 - 1, c2)
            + calc(r1 - 1, c1 - 1);
    res %= MOD;
    if (res < 0) res += MOD;
    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 32204
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char s[] = sc.next().toCharArray();
        int luck[] = new int[n];
        for(int i=0;i<n;i++){
            luck[i]=Integer.parseInt(""+s[i]);
        }
        int count[] = new int[10];

        int ans = 0;
        for(int i=0;i<10;i++)for(int j=0;j<10;j++)for(int k=0;k<10;k++){
            int l=0;
            boolean ok=false;
            for(;l<n;l++){
                if(luck[l]==i)break;
            }
            for(l++;l<n;l++){
                if(luck[l]==j)break;
            }
            for(l++;l<n;l++){
                if(luck[l]==k){
                    ok=true;
                    break;
                }
            }
            if(ok)ans++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 29004
from collections import deque
from bisect import bisect_left

N = int(input())
A = [int(input()) for _ in range(N)]

q = deque([A[0]])

for x in A[1:]:
    i = bisect_left(q,x)
    if i == 0:q.appendleft(x)
    else:q[i-1]=x
print(len(q))


Measured memory_bytes: 54360
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_bacm
#define mp mame_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    ll a, b;
    cin >> a >> b;
    cout << a*b/gcd(a,b) << '\n';
}

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

    //int t; cin >> t; while (t--)
        solve();
}


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

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

    int N, A, B;
    cin >> N >> A >> B;

    int ans = 0;

    for(int i = 1; i <= N; i++) {
        int x = i;
        int c = 0;
        for(int j = 0; j < 5; j++) {
            c += x % 10;
            x /= 10;
        }

        if(A <= c && c <= B) {
            ans += i;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#define MOD 1000000007LL
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
int main() {
    string s;
    cin>>s;
    
    int ans=114514;
    for(int i=0;i<26;i++){
        char c='a'+i;
        string t(s);
        int tl=t.length();
        int a=0;
        bool ff=true;
        for(int j=1;j<tl;j++){
            if(t[j]!=t[j-1]){
                ff=false;
            }
        }
        if(ff){
            ans=0;
            break;
        }
        while(1){
            tl--;
            for(int j=0;j<tl;j++){
                if(t[j]==c||t[j+1]==c){
                    t[j]=c;
                }
            }
            a++;
            bool f=true;
            for(int j=1;j<tl;j++){
                if(t[j]!=t[j-1]){
                    f=false;
                    break;
                }
            }
            if(f){
                if(a<ans){
                    ans=a;
                }
                break;
            }
        }
    }
    cout<<ans<<endl;
}


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



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

  vector<int> H(N);
  for(int i = 0;i < N;i++) {
      cin >> H.at(i);
  }

  bool can = true;
  if(N > 1) {
    if(H.at(0) - H.at(1) > 1) can = false;
    else H.at(0)--;
  }

  for(int i = 1;i < N - 1;i++) {
      if(H.at(i) - H.at(i + 1) > 1) {
          can = false;
      }else if(H.at(i) - H.at(i + 1) == 1) {
          if(H.at(i) > H.at(i - 1)) {
              H.at(i)--;
          }else {
              can = false;
          }
      }else {
          if(H.at(i) > H.at(i - 1)) H.at(i)--;
      }
  }

  if(can) {
      cout << "Yes" << endl;
  }else {
      cout << "No" << endl;
  }

}


Measured memory_bytes: 640
const MAX_DIGIT: usize = 11;
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut pow3: Vec<usize> = vec![0; MAX_DIGIT];
    pow3[0] = 1;
    for x in 1..pow3.len() {
        pow3[x] = 3 * pow3[x - 1];
    }
    let mut result = 0;
    for d in 0..MAX_DIGIT {
        for bit in 0..pow3[d]+1 {
            let mut tmp_bit = bit;
            let mut res = 0;
            for i in 0..d {
                match tmp_bit % 3 {
                    0 => res = 10 * res + 3,
                    1 => res = 10 * res + 5,
                    _ => res = 10 * res + 7,
                }
                tmp_bit /= 3;
                if res > n {
                    break;
                }
            }
            if res <= n {
                let mut cnts = std::collections::HashSet::new();
                while res > 0 {
                    cnts.insert(res % 10);
                    res /= 10;
                }
                if cnts.len() == 3 {
                    result += 1;
                }
            }
        }
    }
    println!("{}", result);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

using namespace std;
#define int int64_t
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define gsort(x) sort((x).begin(), (x).end(), greater<int>())
#define rv(s) reverse((s).begin(), (s).end())
#define pii pair<int, int>
#define re(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).flont_back(a)
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9 + 7;

signed main()
{
   cin.tie(0);
   ios::sync_with_stdio(false);
   string s;
   cin >> s;
   int ans = 0;
   string prv = "";
   string cur = "";
   for (int i = 0; i < s.size(); i++)
   {
      cur += s[i];
      if (cur != prv)
      {
         //cout << i << ' ' << s[i] << ' ' << cur << ' ' << prv << ' ';
         prv = cur;
         cur = "";
         ans++;
         //cout << ans << '\n';
      }
      //else
      //cout << s[i] << ' ' << cur << ' ' << prv << ' ' << ans << '\n';
   }
   cout << ans;
   return 0;
}

Measured memory_bytes: 720
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
ll gcd(ll a, ll b){if (a%b == 0)  return(b);else  return(gcd(b, a%b));}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
 
int main() {
	int a,b;
	cin >> a >> b;
	if (a > b) cout << "a > b" << endl;
	else if (a <b) cout << "a < b" << endl;
	else if (a == b) cout << "a == b" << endl;
}


Measured memory_bytes: 3088
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <string>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

using namespace std;
using ll = long long;
int n;

void max_self(ll & a, ll b) {
    a = max(a,b);
}

int main(int argc, char *argv[]) {
    cin >> n;
    vector<int> h(n);
    vector<int> a(n);
    int base = 1;
    while (base <= n) {
        base *= 2;
    }
    vector<ll> tree(2*base);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<ll> dp(n + 1);
    // dp[i] - the max total beauty so far 
    // if the last taken flower has height i
    for (int flower = 0; flower < n; ++flower) {
        int x = h[flower] + base;
        ll best = 0;
        // get current max from tree
        while(x > 1) {
            if (x%2 == 1)
                max_self(best, tree[x-1]);
            x /= 2;
        }
        // update dp
        dp[h[flower]] = best + a[flower];
        // set new val in the tree
        for (int i = h[flower] + base; i >= 1; i /=2) {
            max_self(tree[i], dp[h[flower]]);
        }
    }
    printf("%lld\n", tree[1]);
    return 0;
}

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

public class Program
{

	public void Proc()
	{
        int inputCount = int.Parse(Reader.ReadLine());
        Dictionary<int, int> cnt = new Dictionary<int, int>();
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        foreach(int item in inpt) {
            for (int i = item - 1; i <= item + 1; i++) {
                if(cnt.ContainsKey(i)) {
                    cnt[i]++;
                } else {
                    cnt.Add(i, 1);
                }
            }
        }
        Console.WriteLine(cnt.Max(a=>a.Value));
    }


    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"


7
3 1 4 1 5 9 2


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 24288
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <cmath>
#include <cstring>

using namespace std;

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)
#define SCANFD(x) scanf("%d",&x)

int main(){
    int N,Y;
    scanf("%d%d",&N,&Y);
    for(int i=0;i<=N;i++){
        for(int j=N-i;j>=0;j--){
            if(10000*i+5000*j+1000*(N-i-j) == Y) {
                printf("%d %d %d\n",i,j,N-i-j);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	int x = sc.nextInt();
      	List<Integer> list = new ArrayList<>();
      
      	int count = 1, d = 0;
      	for(int i = 0; i < n; i++){
        	list.add(sc.nextInt());
        } 
      	
      	int temp;
      	for(int i = 1; i <= n; i++){
           	temp = d;
        	d = temp + list.get(i-1);
          	if(d <= x){
            	count++;
            }else{
            	break;
            }
        }
      
      	System.out.println(count);
    }
}

Measured memory_bytes: 22868
// Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;

#ifdef LOCAL
#include "contest.h"
#else
#define dump(x) 
#endif

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }

void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}
//}}}

int main(){
    iostream_init();
    int N, M;
    while(cin >> N >> M) {
        map<int, int> raw_count;
        REP(i, N) {
            int x;
            cin >> x;
            raw_count[x] ++;
        }
        map<int, int> count;
        map<int, int> same;
        for(auto p : raw_count) {
            const int k = p.first;
            const int v = p.second;
            count[k % M] += v;
            same[k % M] += v / 2;
        }
        int answer = 0;
        for(int i = 0; i < M; i++) {
            int j = (M - i + M) % M;
            if(i < j) {
                int c1 = count[i];
                int c2 = count[j];
                int max_sub = 0;
                for(int k = 0; k <= min(c1, c2); k ++) {
                    int p1 = k;
                    int p2 = min(same[i], (c1 - k) / 2);
                    int p3 = min(same[j], (c2 - k) / 2);
                    max_sub = max(max_sub, p1 + p2 + p3);
                }
                answer += max_sub;
            } else if(i == j) {
                answer += count[i] / 2;
            }
        }
        cout << answer << endl;
    }
    return 0;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)
#define MOD (1000000007)
#define MAX (500000)
#define pii pair<int, int>

/////////////////////////////////////////////////////////

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

class e{
public:
  ll a, b;
  e() {a = b = -1;}
  e(ll u, ll v) {a = u; b = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> &V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

template<typename T>
T euclid(T a, T b){
  if(b == 0) return a;
  else return euclid(b, a % b);
}

vector<ll> fact(MAX, 0), fact_inv(MAX, 0);

ll pow_mod(ll a, ll b){
	ll res = 1;
	while(b > 0){
		if(b & 1) res = res * a % MOD;
		a = a * a % MOD;
		b >>= 1;
	}
	return res;
}

void prepare_comb_mod(ll n){
	fact[0] = 1LL;
	for(ll i = 0; i < n; i++) fact[i+1] = fact[i] * (i + 1) % MOD;
	fact_inv[n] = pow_mod(fact[n], MOD - 2);
	for(ll i = n - 1; i >= 0; i--) fact_inv[i] = fact_inv[i + 1] * (i + 1) % MOD;
}

ll comb_mod(ll n, ll r){
	return (fact[n] * fact_inv[r]) % MOD * fact_inv[n - r] % MOD;
}

/////////////////////////////////////////////////////////

void Main() {
  int N, M, L; cin >> N >> M >> L;

  vector<vector<ll>> d(N, vector<ll>(N, INF));
  rep(i, 0, N) d[i][i] = 0;
  rep(n, 0, M){
    int A, B, C; cin >> A >> B >> C; A--; B--;
    d[A][B] = C;
    d[B][A] = C;
  }

  rep(k, 0, N){
    rep(i, 0, N){
      rep(j, 0, N){
        chmin(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }

  vector<vector<ll>> d2(N, vector<ll>(N, INF));
  rep(i, 0, N){
    rep(j, 0, N){
      if(i == j) d2[i][j] = 0;
      else if(d[i][j] <= L) d2[i][j] = 1;
    }
  }

  rep(k, 0, N){
    rep(i, 0, N){
      rep(j, 0, N){
        chmin(d2[i][j], d2[i][k] + d2[k][j]);
      }
    }
  }

  int Q; cin >> Q;
  rep(i, 0, Q){
    int s, t; cin >> s >> t; s--; t--;
    int res = d2[s][t];
    if(res == INF) res = -1;
    else res--;
    cout << res << endl;
  }
}

/////////////////////////////////////////////////////////

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();
}


Measured memory_bytes: 9856
import sys


input = sys.stdin.readline

N, M = map(int, input().split())
has_broken = [1]*(N+1)
for _ in range(M):
    has_broken[int(input())] = 0

dp = [1]*(N+1)
dp[1] = 1 if has_broken[1] == 1 else 0
MOD = 10**9+7
for i in range(2, N+1):
    dp[i] = has_broken[i]*(dp[i-1] + dp[i-2])

print(dp[N]%MOD)

Measured memory_bytes: 463476
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main() {
    double T, X;
    cin >> T >> X;
    cout << T / X << endl;
}


Measured memory_bytes: 3764
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

template<typename Monoid>
struct SegmentTree{
    using F = function<Monoid(Monoid, Monoid)>;

    int sz;
    vector<Monoid> seg;

    const F f;      // モノイドに対して二項演算を行う関数オブジェクト
    const Monoid M1;

    SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1){
        sz = 1;
        while(sz < n)   sz <<= 1;
        seg.assign(2 * sz, M1);
    }

    void set(int k, const Monoid &x){
        seg[k + sz] = x;
    }

    void build(){
        for(int k = sz - 1; k > 0; --k){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }

    void update(int k, const Monoid &x){
        k += sz;
        seg[k] = x;
        while(k >>= 1){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }

    Monoid query(int a, int b){
        Monoid L = M1, R = M1;
        for(a += sz, b += sz; a < b; a >>= 1, b >>= 1){
            if(a & 1)   L = f(L, seg[a++]);
            if(b & 1)   R = f(seg[--b], R);
        }
        return f(L, R);
    }

    Monoid operator[](const int &k) const{
        return seg[k + sz];
    }
};

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

    int N;
    cin >> N;
    vector<int> h(N), a(N);
    for(int i = 0; i < N; ++i)  cin >> h[i];
    for(int i = 0; i < N; ++i)  cin >> a[i];
    SegmentTree<ll> dp(N + 5, [](ll a, ll b){return max(a, b);}, 0LL);
    for(int i = 0; i < N; ++i){
        dp.update(h[i], a[i] + dp.query(0, h[i]));
    }
    cout << dp.query(0, N + 1) << endl;
}

Measured memory_bytes: 8932
from operator import itemgetter


def main():
    N = int(input())
    ab = [tuple(int(j) for j in input().split()) for i in range(N)]
    cd = [tuple(int(j) for j in input().split()) for i in range(N)]
    # y 降順
    ab.sort(key=itemgetter(1), reverse=True)
    # x 昇順
    cd.sort()
    ans = 0
    for bx, by in cd:
        for rx, ry in ab:
            if rx < bx and ry < by:
                ab.remove((rx, ry))
                ans += 1
                break
    print(ans)
    return


main()


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

int main(){
  int num[3],c=0;
  cin>>num[0]>>num[1]>>num[2];
  sort(num,num+3);
  while(num[1]<num[2]){
    num[0]++;
    num[1]++;
    c++;
  }
  while(num[0]<num[1]){
    num[0]+=2;
    c++;
  }
  if(num[0]>num[1]){
    cout<<c+1<<endl;
  }else{
    cout<<c<<endl;
  }
}

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

int main(int argc, char **argv) {
    int n;scanf("%d",&n);
    for(int i = 0; i < n; i++) {
        int cnum[9];
        int cnt[3][12] = {{0}};
        for(int j = 0; j < 9; j++) {
            scanf("%d", &cnum[j]);
        }
        for(int j = 0; j < 9; j++) {
            char c;
            scanf(" %c", &c);
            cnt[c=='R'?0:c=='G'?1:2][cnum[j]-1]++;
        }
        bool flag = true;
        for(int j = 0; j < 3; j++) {
            for(int k = 0; k < 12; k++) {
                if(cnt[j][k]<0) {
                    flag = false;
                    goto finish_loop;
                }
                cnt[j][k]%=3;
                if(k<9) {
                    cnt[j][k+2] -= cnt[j][k];
                    cnt[j][k+1] -= cnt[j][k];
                }
            }
        }
finish_loop:
        printf("%d\n", flag);
    }
    return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace Codeforces
{
	internal class Template
	{
		private void Solve()
		{
			var a = cin.NextString();
			var b = cin.NextString();
			Console.WriteLine(a == b ? "H" : "D");
		}

		private static readonly Scanner cin = new Scanner();

		private static void Main()
		{
#if DEBUG
			var inputText = File.ReadAllText(@"..\..\input.txt");
			var testCases = inputText.Split(new[] { "input" }, StringSplitOptions.RemoveEmptyEntries);
			var consoleOut = Console.Out;
			for (var i = 0; i < testCases.Length; i++)
			{
				var parts = testCases[i].Split(new[] { "output" }, StringSplitOptions.RemoveEmptyEntries);
				Console.SetIn(new StringReader(parts[0].Trim()));
				var stringWriter = new StringWriter();
				Console.SetOut(stringWriter);
				var sw = Stopwatch.StartNew();
				new Template().Solve();
				sw.Stop();
				var output = stringWriter.ToString();

				Console.SetOut(consoleOut);
				var color = ConsoleColor.Green;
				var status = "Passed";
				if (parts[1].Trim() != output.Trim())
				{
					color = ConsoleColor.Red;
					status = "Failed";
				}
				Console.ForegroundColor = color;
				Console.WriteLine("Test {0} {1} in {2}ms", i + 1, status, sw.ElapsedMilliseconds);
			}
			Console.ReadLine();
			Console.ReadKey();
#else
			new Template().Solve();
			Console.ReadLine();
#endif
		}
	}

	internal class Scanner
	{
		private string[] s = new string[0];
		private int i;
		private readonly char[] cs = { ' ' };

		public string NextString()
		{
			if (i < s.Length) return s[i++];
			var line = Console.ReadLine() ?? string.Empty;
			s = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			i = 1;
			return s.First();
		}

		public double NextDouble()
		{
			return double.Parse(NextString());
		}

		public int NextInt()
		{
			return int.Parse(NextString());
		}

		public long NextLong()
		{
			return long.Parse(NextString());
		}
	}
}

Measured memory_bytes: 11220
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7 ;
const ll N = 1e5 + 10 ;

int main(){
    fastio
 int a,b;
 cin>>a>>b;
 if(b%a==0)
 cout<<a+b<<endl;
 else
 {
     cout<<b-a<<endl;
 }
 
  
    return 0 ;
}

Measured memory_bytes: 256
n = int(input())
s = list(input())
ans = []
for i in range(1, n):
    first_falf = set(s[:i])
    after_falf = set(s[i:])
    count = 0
    for word in first_falf:
        if word in after_falf:
            count += 1
    ans.append(count)
print(max(ans))


Measured memory_bytes: 9156
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main(){
	int n, m;
	while (cin >> n >> m, n) {
		int a[101] = {};
		rep(i, n) {
			int d, w; cin >> d >> w;
			a[d] = max(a[d], w);
		}
		int out = 0;
		rep1(i, m) {
			out += a[i];
		}
		cout << out << endl;
	}
	return 0;
}


Measured memory_bytes: 2996
module Main where
import Control.Monad
import Data.List

count :: Int -> Int -> [String] -> [Int] -> [Int] -> Int
count h w s rs cs = length [() | i<-[0..h-1], j<-[0..w-1], notElem i rs && notElem j cs && s !! i !! j == '#']

main :: IO ()
main = do
    [h, w, k] <- map read . words <$> getLine 
    s <- replicateM h getLine
    print $ length [() | rs<-subsequences [0..h-1], cs<-subsequences [0..w-1], count h w s rs cs == k]

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

int a, b, i;
int main() {
	cin >> a >> b;
	for(i=0; i<10000; i++) {
		if(i*8/100==a && i/10==b) return printf("%d", i)*0;
	}
	return puts("-1")*0;
}

Measured memory_bytes: 256
use std::io::Read;

const INF: i64 = 1e16 as i64;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n = iter.next().unwrap().parse().unwrap();
    let a: Vec<i64> = (0..n)
        .map(|_| iter.next().unwrap().parse().unwrap())
        .collect();

    if *(a.iter().max().unwrap()) == 0 {
        println!("0");
        return;
    }

    let stones: Vec<i64> = vec![0, 2, 1, 2, 0];
    let mut dp = vec![vec![INF; stones.len()]; n + 1];

    dp[0][0] = 0;
    for i in 0..n + 1 {
        for j in 0..stones.len() {
            if j > 0 && dp[i][j - 1] < dp[i][j] {
                dp[i][j] = dp[i][j - 1];
            }

            if i > 0 {
                let next = if stones[j] > a[i - 1] {
                    dp[i - 1][j] + stones[j] - a[i - 1]
                } else if stones[j] > 0 {
                    dp[i - 1][j] + (a[i - 1] - stones[j]) % 2
                } else {
                    dp[i - 1][j] + a[i - 1]
                };
                if next < dp[i][j] {
                    dp[i][j] = next;
                }
            }
        }
    }
    //    dbg!(&dp);
    println!("{}", dp[n][4]);
}


Measured memory_bytes: 24824
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

namespace ConsoleAppAtCoderABC170
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

            var ans = x.Select((n, i) => (n, i)).First(x => x.n == 0).i + 1;

            WriteLine(ans);
        }
    }
}


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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

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

int N, M;
vector<vector<int>> edges(100001);
vector<int> ds(100001, -1);
int ans = 0;

int dfs(int v) {
    int res = 0;
    for (int n : edges[v]) {
        if (ds[n] == -1)
            res = max(dfs(n) + 1, res);
        else
            res = max(ds[n] + 1, res);
    }
    ds[v] = max(ds[v], res);
    ans = max(ans, res);
    return res;
}

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

    cin >> N >> M;
    REP(i, M) {
        int x, y;
        cin >> x >> y;
        edges[x].push_back(y);
    }

    FOR(i, 1, N + 1)
    dfs(i);

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

Measured memory_bytes: 8832
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_limit=(n); i<i##_limit; ++i)
#define FOR(i, a, b) for (int i=(a), i##_limit=(b); i<i##_limit; ++i)
#define pb push_back
#define mp make_pair
using namespace std;
using ll = long long;
using pi = pair<int, int>;

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

    int o = 0;
    FOR(i, 1, N+1)
    {
        if (i%2 == 1) ++o;
    }

    cout << o/(double)N << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define null nullptr
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

using namespace std;

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;
typedef unordered_map<int,int> mp;

const int mod = 1e9+7;

void print(stack<string> s){
    cout << "Stack content : " ;
    while(!s.empty()){
        cout << s.top() << " ";
        s.pop();
    }
}

void solve(string &s){
    int n = s.size();
    string t = "";

    stack<string> f;

    for(int x=0;x<n;x++){
        t.push_back(s[x]);
        if(f.empty()){
            f.push(t);
            t = "";
            continue;
        }

        if(f.top() != t){
            f.push(t);
            t = "";
            continue;
        }

        if(t.size() == 2){
            f.push(t);
            t = "";
        }

        if(x == n-2){
            if(s[x] == s[x+1]){
                t.push_back(s[x+1]);
                f.push(t);
                break;
            }
        }

        
    }

    //print(f);

    cout << f.size() << endl;

}

int32_t main(){
    FAST;

    string s;   cin >> s;
    solve(s);



    return 0;
}


Measured memory_bytes: 11028
//	created : 16/03/13
// 	author   : Rp7rf
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <set>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define INF 1e9
static const int N = 100;

int main(void){
	int n, p[N+1], m[N+1][N+1];
	cin>>n;
	rep(i,n+1){
		cin>>p[i]>>p[i+1];
	}
	
    loop(i,1,n+2)m[i][i] = 0;
 
    loop(l,2,n+1){
        loop(i,1,n-l+2){
            int j = i + l - 1;
            m[i][j] = (1<<21);
            loop(k,i,j){
                m[i][j] = min(m[i][j],m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]);
            }
        }
    }
	cout<<m[1][n]<<endl;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a,b;
    b=0;
    cin>>a;
    int c[26];
    int s[26][365];
    fr(i,26){
        cin>>a;
        c[i]=a;
    }
    fr(i,26){
        fr(h,365){
            int b;
            cin>>b;
            s[i][h]=b;
        }
    }
  Fr(h,365){
      fr(i,26){
      if(s[b][h]<s[i][h]){b=i;}
  }
  cout<<b+1<<"\n";
  b=0;
  }
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

using namespace std;

#define int long long
#define deb(x) cout << #x << " " << x << endl;
#define pb push_back
#define pp pop_back
#define F first
#define S second
#define all(x) x.begin(),x.end()

#define MOD 1000000007
#define MAX 50000

typedef long double ld;
const int N = 1e5 + 10;
const long double Pie = acos(-1);

signed main() 
{	
	int n;
	cin >> n;
	
	vector<int> h(n);
	for (auto &it : h) 
	{
		cin >> it;
	}
	
	vector<int> dp(n, 0);
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	
	for (int i = 2; i <= n; i++)
	{
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]) , dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	
	cout << dp[n - 1];
	
	return 0;
}


Measured memory_bytes: 1792
#!/usr/bin/perl -w 2 use strict;
 use warnings;

 my $s = <>;
 my $flag = 0;
 chomp($s);
 for my $alpha ('a'..'z'){
 my $count = 0;
 while($s =~ m/$alpha/g){$count++;}
 if($count %2 != 0){$flag = 1;}
 }
 if($flag ==0){print"Yes\n";}
 else{print "No\n"}


Measured memory_bytes: 640
def main():
    S=input()
    T=input()
    di_S=dict()
    di_T=dict()
    for i in range(len(S)):
        if S[i] not in di_S:
            di_S[S[i]]=1
        else:
            di_S[S[i]]+=1
        if T[i] not in di_T:
            di_T[T[i]]=1
        else:
            di_T[T[i]]+=1
    li_S=sorted(di_S.values())
    li_T=sorted(di_T.values())

    flag=True
    for i in range(len(li_S)):
        if li_S!=li_T:
            flag=False
            print("No")
            break
    if flag:
        print("Yes")
if __name__=="__main__":
    main()

Measured memory_bytes: 3632
/*
	メモ化っぽいやつ
*/

#include <stdio.h>
#define MAX 1000		//	入力の最大サイズ
#define LOWER_LIMIT -1	//	下限値
//#define MAX_M 2000000

//	メモ用配列
int dp[MAX][MAX];
int n, m;

//	2次元正方配列から最大値を返す関数宣言
int getMax(int **source, int width);

int main(void) {
//	int n, m;
	int a[MAX];
	int i, j;
	int v_max;

	//	多次元配列を関数に渡す用のポインタ
	int *dp_p[MAX];
	
	while (1) {
		memset(dp, -1, sizeof(dp));	//	メモ化テーブルを-1で初期化．以下のForループと同義
	//  for (int i = 0; i < MAX_N + 1; i++)
	//    for (int j = 0; j < MAX_W + 1; j++)
	//      dp[i][j] = -1;

		//	n,m の入力
		scanf("%d %d", &n, &m);

		//	終了判定
		if (n == m && n == 0) { break; }
		
		//	a_n の入力
		for (i = 0; i < n; i++) {
			scanf("%d", &a[i]);
		}

		//	すべての組み合わせに対してメモ化テーブルを作成
		for (i = 0; i < n; i++) {
			for (j = 0; j < n; j++) {
				if (i == j || dp[i][j] > 0) { continue; }	//	既に探索済みの場合，計算をしない．
				dp[i][j] = a[i] + a[j];
			}
			dp_p[i] = dp[i];
		}

		//	メモ化テーブルから最大値を検索
		v_max = getMax(dp_p, n);
		if (v_max < 0) {	//	最大値がゼロ以下 = 制約を満たす解が無い (getMax関数内のmax変数の初期値 LOWER_LIMIT が返ってくる)
			puts("NONE");
		}
		else {
			printf("%d\n", v_max);
		}
	}
	
	return 0;
}

int getMax(int **source, int width) {
	int i, j;
	int max = LOWER_LIMIT;
	for (i=0; i < width; i++) {
		for (j=0; j < width; j++) {
//			printf("dp[%d][%d] : %d\n", i, j, source[i][j]);
			if (source[i][j] > max && source[i][j] <= m) { max = source[i][j]; }
		}
	}
	return max;
}




Measured memory_bytes: 5652
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
using ll = long long;
using ld = long double;
const int N = 2e5+10, P = 1e4+1;

int n, p;
string s;

int pw[N];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> p >> s;
  if (p != 2 && p != 5) {
    pw[0] = 1;
    for (int i = 1; i < N; i++) {
      pw[i] = pw[i-1] * 10 % p;
    }
    ll ans = 0;
    unordered_map<int, int> cnt;
    cnt[0]++;
    int cur = 0;
    for (int i = 0; i < n; i++) {
      cur += (s[i]-'0') * pw[n-1-i];
      cur %= p;
      ans += cnt[cur];
      cnt[cur]++;
    }
    cout << ans << nl;
  } else {
    ll ans = 0;
    for (int i = 0; i < n; i++) {
      if ((s[i]-'0')%p == 0) {
        ans += i+1;
      }
    }
    cout << ans << nl;
  }
}


Measured memory_bytes: 1684
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}


int main() {
    ll r,d,x;
    cin >> r >> d >> x;

    rep(i,10){
        x = r*x-d;
        cout << x << endl;
    }

    return 0;
}
 
 


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

using namespace std;

int main() {
    int n;
    long long k;
    cin >> n >> k;
    vector<int> a(n+1);
    for (int i = 1; i <= n; i++) cin >> a[i];
    vector<int> visited(n+1, 0);
    int cnt = 1, now = 1, term;
    while (cnt <= n) {
        if (visited[now] != 0) {
            term = cnt-visited[now];
            break;
        }
        visited[now] = cnt;
        now = a[now];
        cnt++;
    }
    int ans = 1;
    if (k <= n) {
        for (int i = 0; i < k; i++) ans = a[ans];
    } else {
        for (int i = 0; i < visited[now]-1; i++) ans = a[ans];
        k = (k-visited[now]+1)%term;
        for (int i = 0; i < k; i++) ans = a[ans];
    }
    cout << ans << endl;
}


Measured memory_bytes: 4468
package main

import "fmt"

func main() {
	var n, x int
	fmt.Scan(&n, &x)
	prev := 0
	ans := 1
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		next := prev + a
		if next > x {
			break
		}
		ans++
		prev = next
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
def ac(s, t, int3, int5, int7):
    if s == "":
        return ac(s + "3", t, int3 + 1, int5, int7) \
               + ac(s + "5", t, int3, int5+1, int7) \
               + ac(s + "7", t, int3, int5, int7+1)
    elif int(s) <= t:
        if int3 != 0 and int5 != 0 and int7 != 0:
            return 1 \
                   + ac(s + "3", t, int3 + 1, int5, int7) \
                   + ac(s + "5", t, int3, int5+1, int7) \
                   + ac(s + "7", t, int3, int5, int7+1)
        else:
            return 0 \
                   + ac(s + "3", t, int3 + 1, int5, int7) \
                   + ac(s + "5", t, int3, int5 + 1, int7) \
                   + ac(s + "7", t, int3, int5, int7 + 1)
    else:
        return 0


a = int(input())
print(ac("", a, 0, 0, 0))


Measured memory_bytes: 3064
//Prime

#include<stdio.h>

int Isprime(int x){
    int i;
    
    if( x < 2) return 0;
    else if(x == 2 || x == 3) return 1;
    else if(x % 2 == 0) return 0;
    else if(x % 3 == 0) return 0;
    for(i = 5; i * i <= x; i += 2){
        if(x % i == 0) return 0;
    }
    return 1;
}


int main(void){
    int i;
    int n, x;
    int count = 0;
    scanf("%d", &n);
    
    for(i = 0; i < n; i++){
        scanf("%d", &x);
        if(Isprime(x))  count++;
    }
    
    printf("%d\n", count);
    
    return 0;
}

Measured memory_bytes: 596
#include<stdio.h>

int selectionSort(int A[], int N) {
	int i, j, t, sw = 0, minj;
	for (i = 0; i < N - 1; i++) {
		minj = i;
		for (j = i; j < N; j++) {
			if (A[j] < A[minj]) minj = j;
		}
		t = A[i]; A[i] = A[minj]; A[minj] = t;
		if (i != minj)sw++;
	}
	return sw;
}

int main() {
	int A[100], N, i, sw;

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

	sw = selectionSort(A, N);

	for (i = 0; i < N; i++) {
		if (i > 0)printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
	printf("%d\n", sw);

	return 0;
}

Measured memory_bytes: 604
def factor(n):
    table = []
    i = 2
    while i * i <= n:
        if n % i == 0:
            cnt = 0
            while n % i == 0:
                n //= i
                cnt += 1
            table.append((i, cnt))
        i += 1
    if n > 1:
        table.append((n, 1))
    return table

N = int(input())
memo = {}
for n in range(2, N + 1):
    for k, v in factor(n):
        memo[k] = memo.get(k, 0) + v

def num(n):
    return sum(1 for v in memo.values() if v >= n - 1)

print(
    num(75) +
    num(25) * (num(3) - 1) +
    num(15) * (num(5) - 1) +
    num(5) * (num(5) - 1) * (num(3) - 2) // 2
)


Measured memory_bytes: 3064
#!/user/bin/env python3
# -*- conding: utf-8 -*-

import math

def ans(a, b, c):
    rab = math.sqrt(a * b)
    

    if c - a - b <= 0:
        return 'No'
    elif (c - a - b) ** 2 > 4 * a * b:
        return 'Yes'
    else:
        return 'No'


def main():
    a, b, c = map(int, input().split())

    print(ans(a, b, c))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int n,x,t;

int main(void){
    cin >>n >> x>>t;
    int ans=0;
    while(n>0){
        ans+=t;
        n-=x;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
using namespace std;
int gcd(int x,int y){
    return y?gcd(y,x%y):x;
}

signed main(){
    vi a(3);
    rep(i,3)cin>>a[i];
    sort(all(a));
    cout<<abs(a[1]-a[0])+abs(a[2]-a[1])<<endl;
    return 0;
}

Measured memory_bytes: 256
use proconio::input;

#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Usize1};
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::ops::*;

#[derive(Clone, Debug, Default)]
struct Struct;

// [l,h) の中でもっとも手前のfalseになる場所を探す. 全てのtrueはfalseより手前にある必要がある.
fn partition_point<F>(l0: usize, h0: usize, f: F) -> usize
where
    F: Fn(usize) -> bool,
{
    let mut l = l0;
    let mut h = h0;

    while h - l > 0 {
        let m = l + (h - l) / 2;
        if f(m) {
            l = m + 1;
        } else {
            h = m;
        }
    }
    return l;
}

const MAX_A: usize = 1000_000_001;

fn dfs(
    a: &Vec<usize>,
    v: &Vec<Vec<usize>>,
    i: usize,
    parent: usize,
    dp: &mut Vec<usize>,
    ans: &mut Vec<usize>,
) {
    let pos = partition_point(0, dp.len(), |pos| dp[pos] < a[i]);
    if pos == dp.len() {
        dp.push(MAX_A);
    }
    let last_val = dp[pos];
    dp[pos] = a[i];
    
    ans[i] = dp.len()-1;
    for &next_i in &v[i] {
        if next_i != parent {
            dfs(a, v, next_i, i, dp, ans);
        }
    }
    
    dp[pos] = last_val;
    if last_val == MAX_A {
        dp.pop();
    }
}

//#[proconio::fastout]
fn main() {
    input! {
        n: usize,
        a: [usize;n],
        uv: [(Usize1,Usize1);n-1],
    }

    let mut v = vec![Vec::new(); n];
    for x in &uv {
        v[x.0].push(x.1);
        v[x.1].push(x.0);
    }

    let mut dp = Vec::new();
    dp.push(0);
    let mut ans = vec![0; n];

    dfs(&a, &v, 0, n, &mut dp, &mut ans);
    for i in 0..n {
        println!("{}", ans[i]);
    }
}


Measured memory_bytes: 39668