akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <algorithm>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD (ll)(1e9+7)
#define MAX (ll)(1e5*2+200)
#define print(x) cout << x << endl;
#define printArr(arr) REP(i, (sizeof arr / sizeof arr[0])){print(arr[i])}
#define printVec(vec) REP(i, vec.size()){print(vec[i])}
using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K, S, num = 0;
    cin >> K >> S;
    REP(x, K+1){
        REP(y, K+1){
            if(x + y <= S && S - x - y <= K){
                num += 1; 
            }
        }
    }
    
    print(num);
        
    return 0;
}


Measured memory_bytes: 256
def input_from_console():
    s = input().rstrip()
    return s


def solve(s):
    if s.count('o') + 15 - len(s) >= 8:
        return 'YES'
    return 'NO'


def main():
    s = input_from_console()
    print(solve(s))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
//2-dim:vector<vector<Type>> vv(n, vector<Type>(m, d));
//3-dim:vector<vector<vector<Type>>> vvv(n, vector<vector<Type>>(m, vector<Type>(l, d)));


signed main(){
    int d,t,s; cin >> d >> t >> s;
    if(s*t<d) cout << "No" << endl;
    else cout << "Yes" << endl;
}




Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

const int INF = 1e9;
char a[1000][1000];
bool used[1000][1000];
int t[1000][1000];

int main() {
    int h, w;
    cin >> h >> w;
    for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) cin >> a[i][j];

    // for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) t[i][j] = INF;
    queue<pair<int, int>> que;
    for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) {
        if (a[i][j] == '#') {
            used[i][j] = true;
            t[i][j] = 0;
            que.emplace(i, j);
        }
    }

    while (!que.empty()) {
        auto p = que.front(); que.pop();
        const int dx[] = {0, 1, 0, -1};
        const int dy[] = {1, 0, -1, 0};
        for (int i = 0; i < 4; ++i) {
            int x = p.first + dx[i];
            int y = p.second + dy[i];
            if (used[x][y]) continue;
            if (x < 0 || y < 0 || x >= h || y >= w) continue;
            used[x][y] = true;
            t[x][y] = t[p.first][p.second]+1;
            que.emplace(x, y);
        }
    }

    int ans = 0;
    for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) ans = max(ans, t[i][j]);
    cout << ans << endl;

    return 0;
}


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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 N,L;
    cin >> N >> L;

    i64 x=0;
    rep(i,0,N) x+=L+i;

    i64 ans=inf64,diff=inf64;
    rep(i,0,N){
        i64 s=0;
        rep(j,0,N){
            if(i==j) continue;
            s+=L+j;
        }
        if(diff>abs(x-s)){
            ans=s;
            diff=abs(x-s);
        }
    }

    cout << ans << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

const int MAX_H = 120;
const int MAX_K = 26;
int H, W;
std::string a[MAX_H];
int nums[MAX_K] = {};
int mod_nums[4];

int main(int argc, char **argv) {
    std::cin >> H >> W;

    for (int i = 0; i < H; i++) {
        std::cin >> a[i];
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            int tmp = a[i][j] - 'a';
            assert(0 <= tmp && tmp < MAX_K);
            nums[tmp]++;
        }
    }

    for (int i = 0; i < MAX_K; i++) {
        mod_nums[nums[i] % 4]++;
    }

    if (H % 2 == 0 && W % 2 == 0) {
        if (mod_nums[1] != 0 || mod_nums[2] != 0 || mod_nums[3] != 0) {
            std::cout << "No" << std::endl;
        } else {
            std::cout << "Yes" << std::endl;
        }
    } else if (H % 2 != 0 && W % 2 != 0) {
        if (mod_nums[1] + mod_nums[3] != 1) {
            std::cout << "No" << std::endl;
        } else {
            int max_mod2_num = (H - 1) / 2 + (W - 1) / 2;
            if (mod_nums[3] == 1) {
                max_mod2_num--;
            }
            if (mod_nums[2] <= max_mod2_num) {
                std::cout << "Yes" << std::endl;
            } else {
                std::cout << "No" << std::endl;
            }
        }
    } else {
        //std::cout << mod_nums[1] << " " << mod_nums[2] << " " << mod_nums[3] << std::endl;
        if (mod_nums[1] + mod_nums[3] != 0) {
            std::cout << "No" << std::endl;
        } else {
            int max_mod2_num = (H % 2 == 1) ? W / 2 : H / 2;
            if (mod_nums[2] <= max_mod2_num) {
                std::cout << "Yes" << std::endl;
            } else {
                std::cout << "No" << std::endl;
            }
        }
    }

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
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);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
vector<ll> getPrime(ll N) {
    vector<ll> p={2};
    for (ll i = 2; i * i <= N; i++) {
        for (ll j = 0; j <= p.size(); j++) {
            
        }
    }
    return p;
}
bool isp(ll N){
    if(N==1)return false;
    for(ll i=2;i*i<=N;i++) {
        if(N%i==0)return false;
    }
    return true;
}
int main(){
    ll N;
    cin>>N;
    
    if(N==1){
        cout<<0;return 0;
    }
    ll soi;
    
    ll ii;
    ll cnt=0;
    for(ii=2;ii<sqrt(N);ii++){
        if(N%ii==0){
            soi=0;
            while(true){
                if(N%ii==0){
                    N/=ii;
                    soi++;
                }else break;
            }
            //sl(ii,soi[ii],N)
            ll t=soi;
            ll o=1;
            while(t>=o){
                //sl(t,ii);
                t-=o++;
                cnt++;
            }
            // for(ll j = 1; ; j++) {
            //     if(t >= j) {
            //         t -= j;
            //         cnt++;
            //     } else break;
            // }
        }
    }
    //sl(N)
    if(N!=1)cnt++;
    cout<<cnt;
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3724
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int q = sc.nextInt();
		int count = 0;
		TreeMap<Integer, Integer> map = new TreeMap<>();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < q; i++) {
			int op = sc.nextInt();
			int y = sc.nextInt();
			switch (op) {
				case 0:
					if (!map.keySet().contains(y)) {
						map.put(y, 1);
					} else {
						map.put(y, map.get(y) + 1);
					}
					sb.append(++count);
					sb.append('\n');
					break;
				case 1:
					if (map.keySet().contains(y)) {
						sb.append(map.get(y));
					} else {
						sb.append('0');
					}
					sb.append('\n');
					break;
				case 2:
					if (map.keySet().contains(y)) {
						int num2 = map.get(y);
						map.remove(y);
						count -= num2;
					}
					break;
				case 3:
					int z = sc.nextInt() + 1;
					Set<Integer> subset = map.subMap(y, z).keySet();
					for (int num : subset) {
						int end = map.get(num);
						for (int j = 0; j < end; j++) {
							sb.append(num);
							sb.append('\n');
						}
					}
					break;
			}
		}
		System.out.print(sb.toString());
	}
}




Measured memory_bytes: 172584
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;


int main(){
    ll n;
    cin >> n;
    vector<ll> p(n);
    rep(i,n){
        cin >> p[i];
    }

    ll ans =0;
    ll tmp = 1000000000;

    rep(i,n){
        if(p[i] <= tmp){
            ans++;
            tmp = p[i];
        }
    }

    dunk(ans);
}
  

Measured memory_bytes: 1792
//
//  main.cpp
//  atcoderX
//
//  Created by 村井真奈美 on 2018/06/16.
//  Copyright © 2018年 村井真奈美. All rights reserved.
//

#include <bits/stdc++.h>
using namespace std;

int main() {
    
    int D,N;
    cin >> D >> N;
    
    int d = 0;
    if(D == 1) d = 100;
    if(D == 2) d = 10000;
    
    if(N != 100){
        if(d == 0)cout << N << endl;
        else{
            cout << d*N << endl;
        }
    }else{
        if(d == 0)cout << N+1 << endl;
        else cout << d*(N+1) << endl;
    }
        

 
}


Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a > b){
		printf("a > b\n");
	}else if(a < b){
		printf("a < b\n");
	}else{
		printf("a == b\n");
	}
}



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

int* primeNumberList(int n){
    int *list = new int[n];
    
    for(int i=2;i<=n;++i){
        list[i-1]=1;
    }
    
    for(int i=2;i<=n;++i){
        if(list[i-1] == 1){
            for(int j=2*i;j<=n;j+=i){
                list[j-1] = 0;
            }
        }
    }
    
    return list;
}
int main(){
    int max = 60000;
    int *pl = primeNumberList(max);
    int n,plowermax,pgreatermin;
    
    while(cin>>n){
        for(int i=n-1;i>=1;--i){
            if(pl[i-1] == 1){
                cout << i << " ";
                break;
            }
        }
        for(int i=n+1;i<=60000;++i){
            if(pl[i-1] == 1){
                cout << i << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1412
#include<stdio.h>
 
int main(){
 
int N;
 int ans;
scanf("%d",&N);
 
if(N%2==0){
ans=(N/2)-1;
printf("%d",ans);
}else{
ans=(N+1)/2 -1;
printf("%d",ans);
}
 
return 0;
 
}

Measured memory_bytes: 128
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main(){
    int N, M;
    cin >> N >> M;
    priority_queue<P> que1;
    priority_queue<int> que2;

    rep(i, N){
        P tmp;
        cin >> tmp.first >> tmp.second;
        tmp.first = -tmp.first;
        que1.push(tmp);
    }

    int sum = 0, work_n = 0;

    for(int i = 1; i <= M; i++){
        while(!que1.empty()){
            P tmp;
            tmp = que1.top();
            int a = -1 * tmp.first, b = tmp.second;
            if(a <= i){
                que1.pop();
                que2.push(b);
            } 
            else break;
        }
        if(!que2.empty()){
            sum += que2.top();
            que2.pop();
        }
    }
    
    cout << sum << endl;
}

Measured memory_bytes: 1908
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> A, B;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        int l = 0, r = 0, cur = 0;
        for (auto &&j : s) {
            if(j == '('){
                cur++;
                r = max(r, cur);
            }else {
                cur--;
                l = min(l, cur);
            }
        }
        if(-l < cur-l){
            A.emplace_back(-l, cur-l);
        }else {
            B.emplace_back(-l, cur-l);
        }
    }
    using P = pair<int, int>;
    sort(A.begin(),A.end(), [&](P a, P b){ return a.first < b.first; });
    sort(B.begin(),B.end(), [&](P a, P b){ return a.second > b.second; });
    int cur = 0, mn = 0;
    for (auto &&i : A) {
        cur -= i.first;
        mn = min(mn, cur);
        cur += i.second;
    }
    for (auto &&i : B) {
        cur -= i.first;
        mn = min(mn, cur);
        cur += i.second;
    }
    if(cur == 0 && mn >= 0){
        puts("Yes");
    }else {
        puts("No");
    }
    return 0;
}

Measured memory_bytes: 11332
#!ruby -rprime
m=0
a=(0..1e5).map{|i|[i,-~i/2].all?(&:prime?)?m+=1:m}
[*$<].each{|s|
  s=~/ /
  s[' ']&&(p a[$'.to_i]-a[$`.to_i-1])
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VI x(n), y(n), z(n);
  rep(i,n) cin >> x[i] >> y[i];
  iota(all(z), 0);
  double ans = 0;
  do{
    rep(i, n-1) ans += sqrt(pow(x[z[i+1]] - x[z[i]], 2) + pow(y[z[i+1]] - y[z[i]], 2));
  }while(next_permutation(all(z)));
  rep(i, n) ans /= (i + 1);
  cout << setprecision(20) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<iostream>
#include<iomanip>
#include<set>
#include<string>
#include<math.h>
#include<string>
#include<queue>
#include<vector>
using namespace std;
typedef long long int ll;
typedef pair<int, ll> P;

//--------------
//#define DEBUG
//--------------

#ifdef DEBUG
	#define debugprint(x) cout<<x<<" "
	#define debugendl cout<<endl
	#define debug(x) x
#else
	#define debugprint(x)
	#define debugendl
	#define debug(x)
#endif

class zahyo{
	public:
	int x;
	int y;
	zahyo(){
		x=0;
		y=0;
	}
	zahyo(int x_,int y_){
		x=x_;
		y=y_;
	}
	void print(){
		cout<<x<<" "<<y;
	}
	zahyo operator+(zahyo add){
		add.x=this->x+add.x;
		add.y=this->y+add.y;
		return add;
	}
	zahyo operator-(zahyo add){
		add.x=this->x-add.x;
		add.y=this->y-add.y;
		return add;
	}
	zahyo operator*(int t){
		zahyo temp;
		temp.x=this->x*t;
		temp.y=this->y*t;
		return temp;
	}
	zahyo operator%(int t){
		zahyo temp(this->x%t,this->y%t);
		return temp;
	}
	zahyo operator/(int t){
		zahyo temp(this->x/t,this->y/t);
		return temp;
	}
	bool operator==(const zahyo add) const{
		if(add.x==this->x and add.y==this->y){return true;}
		else{return false;}
	}
	bool operator!=(const zahyo add) const{
		if(add.x==this->x or add.y==this->y){return false;}
		else{return true;}
	}
	bool operator<(const zahyo add) const{
		if(this->x<add.x){return true;}
		else if(this->x==add.x and this->y<add.y){return true;}
		else{return false;}
	}
	bool operator>(const zahyo add) const{
		if(this->x>add.x){return true;}
		else if(this->x==add.x and this->y>add.y){return true;}
		else{return false;}
	}
	void input(){
		cin>>x>>y;
	}
};

zahyo ways[4];



int main(){
	ways[0].x=1;
	ways[1].x=-1;
	ways[2].y=1;
	ways[3].y=-1;
	int c,r;
	while(1){
		cin>>r>>c;
		if(c==0 and r==0){break;}
		int conect[50][50][4]={};
		int arrived[50][50]={};
		for(int i=0;i<c;i++){
			for(int j=0;j<r-1;j++){
				int temp;
				cin>>temp;
				if(temp==0){
					conect[i][j][2]=1;
					conect[i][j+1][3]=1;
				}
			}
			if(i!=c-1){
				for(int j=0;j<r;j++){
					int temp;
					cin>>temp;
					if(temp==0){
						conect[i][j][0]=1;
						conect[i+1][j][1]=1;
					}
				}
			}
		}
		int ans=1;
		queue<zahyo> widesearch;
		zahyo start(0,0);
		zahyo goal(c-1,r-1);
		bool ungoaled=true;
		arrived[0][0]=1;
		widesearch.push(start);
		while(widesearch.size()>0){
			if(ungoaled==false){break;}
			ans++;
			int size=widesearch.size();
			for(int i=0;i<size;i++){
				zahyo temp=widesearch.front();
				debug(temp.print());
				debug(cout<<",";)
				widesearch.pop();
				for(int j=0;j<4;j++){
					zahyo now=temp+(ways[j]*conect[temp.x][temp.y][j]);
					if(now==goal){
						ungoaled=false;
					}
					if(now.x>=0 and now.x<c and now.y>=0 and now.y<r){
						if(arrived[now.x][now.y]==0){
							arrived[now.x][now.y]=1;
							widesearch.push(now);
						}
					}
				}
			}
			debugendl;
		}
		if(ungoaled){
			cout<<0<<endl;
		}
		else{
			cout<<ans<<endl;
		}
	}
	return 0;
}



Measured memory_bytes: 3188
#include <stdio.h>



int A[2000001],B[2000001],n;
void CountingSort(int *,int *,int k);

int main(){
    int i,j,mx=0;

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

void CountingSort(int A[],int B[],int k){
    int i,j;
    int C[10001];

    for(i=0;i<=k;i++){
        C[i] = 0;
    }

    for(j=0;j<n;j++){
        C[A[j]]++;
    }
    for(i=1;i<=k;i++){
        C[i] += C[i-1];
    }

    for(j=n-1;j>=0;j--){
        B[C[A[j]]-1] = A[j];
        C[A[j]]--;
    }

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


Measured memory_bytes: 17400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 212345
vi v[N];

int main(){
	int n; scanf("%d", &n);
	REP(i, n){
		int a; scanf("%d", &a);
		v[a].EB(i);
	}
	int ans = -1, p = 0;
	FOR(i, 1, n+1){
		auto it = lower_bound(ALL(v[i]), p);
		if(it == v[i].end()) break;
		p = *it;
		DEBUG("use %d\n", p);
		ans = n-i;
	}
	printf("%d\n", ans);
}


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

int main() {
  int a,b,c,d;cin>>a>>b>>c>>d;
  int ans = max(a*b,c*d);
  // cout << (ans?"H":"D") << endl;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"

#define fr(i, a, b) for (ll i = a; i <= b; ++ i)
#define rf(i, a, b) for (ll i = a; i >= b; -- i)

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cerr << "Ready\n";
}

const int N = 4e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const ll P = 53;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

int a[N];

int main () {
    to_pray();
    
    cin >> a[1] >> a[2] >> a[3];
    
    sort(a + 1, a + 1 + 3);
    
    cout << ((a[3] * 10) + a[2] + a[1]);
    cout << '\n';
    return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())

trick=[True]*n

for i in range(k):
    input()
    a_lis=list(map(int,input().split()))
    for a in a_lis:
        trick[a-1]=False


ans=0
for i in range(n):
    if(trick[i]):
        ans+=1

print(ans)

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

int main()
{
	int N;
	cin >> N;
	vector<long long> A( N );
	vector<long long> B( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i] >> B[i];
	}

	sort( A.begin(), A.end() );
	sort( B.begin(), B.end() );
	long long ans;
	if( N % 2 ) {
		long long am = A[N / 2];
		long long bm = B[N / 2];
		ans = bm - am + 1;
	}
	else {
		double am = (double)(A[N / 2 - 1] + A[N / 2]) / 2;
		double bm = (double)(B[N / 2 - 1] + B[N / 2]) / 2;
		ans = (bm - am) * 2 + 1;
	}

	cout << ans << endl;
}


Measured memory_bytes: 6408
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
#define int 		long long
#define vi 			vector<int>
#define vec(x) 		vector<x>
#define matrix 		vector<vector<int>>
#define pii 		pair<int,int>
#define rep(i,s,e)  for(int i=s;i<e;i++)
#define rrep(i,e,s) for(int i=e;i>=s;i--)
#define MOD			1000000007
#define pb 			push_back
#define ff 			first
#define ss 			second		
#define w(x)		int x; cin>>x; while(x--)
const int INF=1e18;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
// find_by_order(k-1)  returns iterator to kth element starting from 0; Returns the kth smallest element
// order_of_key(k) returns count of elements strictly smaller than k;Returns the number of elements less than k
// erase,insert same as normal set


void solve(){
	int n,m;
	cin>>n>>m;

	int cnt=0;
	int sum=0;
	vi v(n);
	for(int i=0;i<n;i++){
		int num;
		cin>>num;
		v[i]=num;
		sum+=num;
	}

	int rv=ceil(double(sum)/(double)(4*m));

	for(auto c:v){
		if(c>=rv) cnt++;
	}

	//cout<<cnt<<endl;

	if(cnt>=m){
		cout<<"Yes\n";
	}
	else{
		cout<<"No\n";
	}
}
 
int32_t main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt","r",stdin);
// 	freopen("output.txt","w",stdout);
// #endif
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}


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

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b-1);i>=a;i--)
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;

constexpr int INF = 1e9;

signed main() {
    while (1) {
        int N, M, L, K, A, H;
        cin >> N >> M >> L >> K >> A >> H;
        if (N == 0) {
            break;
        }
        vector<vector<pii>> g(N);
        vector<bool> has(N);
        rep(i, 0, L) {
            int x;
            cin >> x;
            has[x] = true;
        }
        rep(i, 0, K) {
            int a, b, c;
            cin >> a >> b >> c;
            g[a].push_back({b, c});
            g[b].push_back({a, c});
        }

        priority_queue<pair<int, pii>, vector<pair<int, pii>>, greater<pair<int, pii>>> q;
        vector<vector<int>> dist(N, vector<int>(M + 1, INF));
        dist[A][M] = 0;
        q.push({0, {A, M}});
        while (q.size()) {
            int d, v, r;
            d = q.top().first;
            tie(v, r) = q.top().second; q.pop();
            if (dist[v][r] < d) continue;
            for (pii e : g[v]) {
                int w, c;
                tie(w, c) = e;
                if (r - c < 0) continue;
                if (dist[w][r - c] > dist[v][r] + c) {
                    dist[w][r - c] = dist[v][r] + c;
                    q.push({dist[w][r - c], {w, r - c}});
                }
            }
            if (has[v]) {
                rep(i, 0, M + 1) {
                    if (r + i > M) break;
                    if (dist[v][r + i] > dist[v][r] + i) {
                        dist[v][r + i] = dist[v][r] + i;
                        q.push({dist[v][r + i], {v, r + i}});
                    }
                }
            }
        }
        int ans = INF;
        rep(i, 0, M + 1) {
            ans = min(ans, dist[H][i]);
        }
        cout << (ans == INF ? "Help!" : to_string(ans)) << endl;
    }
}




Measured memory_bytes: 3632
n, m = map(int, input().split())

ans = [-1] * n
for i in range(m):
    s, c = map(int, input().split())
    s = s - 1
    if ans[s] != -1 and ans[s] != c:
        print(-1)
        exit()
    if n != 1 and s == 0 and c == 0:
        print(-1)
        exit()
    ans[s] = c

for i in range(n):
    if ans[i] == -1:
        ans[i] = '0'
    else:
        ans[i] = str(ans[i])

if ans[0] == '0' and n != 1:
    ans[0] = '1'
print(''.join(ans))


Measured memory_bytes: 38384
#include<stdio.h>
#include<string.h>
#define N 2000000
#define L 12
#define NIL (-1)
#define TRUE 1
#define FALSE 0

char H[N][L];

int getnum(char c){
  if(c=='A') return 1;
  else if(c=='C') return 2;
  else if(c=='G') return 3;
  else if(c=='T') return 4;
  else return 0;
}

long long getkey(char c[]){
  long long sum=0,i,j=1;
  for(i=0;i<strlen(c);i++){
    sum+=j*(getnum(c[i]));
    j*=5;
  }
  return sum;
}

int h1(int key){
  return key%N;
}
int h2(int key){
  return 1+(key%(N-1));
}

int search(char c[]){
  long long key,i,h;
  key=getkey(c);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%N;
    if(strcmp(H[h],c)==0) return TRUE;
    else if(H[h][0]=='0') return FALSE;
  }
  return FALSE;
}

void insert(char c[]){
  long long key,i,h;
  key=getkey(c);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%N;
    if(strcmp(H[h],c)==0) return;
        else if(H[h][0]=='0'){
      strcpy(H[h],c);
      return;
    }
  }
}

int main(){
  int i,j=0,n,h,a[N],sum=0;
  char c[L],order[10];

  for(i=0;i<N;i++) H[i][0]='0';
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",order,c);
    if(order[0]=='i'){
      insert(c);
    }
    else{
      sum++;
      if(search(c)==TRUE) a[j]=TRUE;
      else a[j]=FALSE;
      j++;
      }
    }
  for(i=0;i<sum;i++){
    if(a[i]==TRUE) printf("yes\n");
      else printf("no\n");
  }

  return 0;
}


Measured memory_bytes: 26836
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int[] p = new int[n];
        long wa = 0;
        long ac = 0;
        for (int i = 0; i < m; i++) {
            int pi = Integer.parseInt(sc.next());
            String s = sc.next();
            if ("WA".equals(s) && p[pi - 1] != -1) {
                p[pi - 1]++;
            } else if ("AC".equals(s) && p[pi - 1] >= 0) {
                ac++;
                wa += p[pi - 1];
                p[pi - 1] = -1;
            }
        }
        System.out.println(ac + " " + wa);
    }
}

Measured memory_bytes: 51252
s = input()
keta = len(s)

ans=0
for ib in range(1<<(keta-1)):
    f = s
    cnt = 1
    for i in range(0, keta):
        if (ib >> i & 1):
            # +を入れる。
            f = f[0:i+cnt]+"+"+f[i+cnt:]
            cnt += 1
    
    #+で分割する。
    cnt = list(map(int, f.split("+")))
    ans += sum(cnt)
print(ans)

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

typedef long long ll;
using vi = vector<int>;
using vll = vector<ll>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

    vi a(n);
    rep(i, n) {
        a[i] = (i+1);
    }

    vi pq(n, 0);
    vll ans;
    rep(i, 2) {
        rep(j, n) {
            cin >> pq[j];
        }
        int k = 0;
    do {
        bool can = true;
        rep(i, n) {
            if(a[i] != pq[i]) can = false;
        }
        if(can) ans.push_back(k + 1);
        k++;
    } while(next_permutation(a.begin(), a.end()));
    }

    
    
    
    cout << abs(ans[0] - ans[1]) << endl;
    

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  int T;
  int X;
  cin >>T>>X;
  double a=(double)T/(double)X;
  cout << a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vl vector<long long>
#define fin(ar,k,n) for(int i=k;i<n;i++) cin>>ar[i]
#define fout(ar,k,n) for(int i=k;i<n;i++) cout<<ar[i]<<' '
#define vs vector<string>
#define mx INT_MAX
#define mn INT_MIN
#define all(z) z.begin(),z.end()
#define mcc 1000000007
#define mcf 998244353
#define mi map<int,int>
#define mem(a,n) memset(a,n,sizeof(a))
using namespace std;

//ll maxl(ll a,ll b) {return (a>b)? a:b;}
//ll minl(ll a,ll b) {return (a<b)? a:b;}
//ll gcdl(ll a,ll b) {return b ? gcdl(b,a%b):a;}
//bool sortc(const vi &v1,const vi &v2) {return v1[0]>v2[0];}

void solve()
{
    string s;
    cin>>s;
    for (auto const a: s)
    {
        if (a=='7')
        {
            cout<<"Yes";
            return;
        }
    }
    cout<<"No";
}


#if 1
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}
#endif

//------------------------Google-------------------
#if 0
int main()
{
    #ifdef __WIN32
    freopen("input.txt","r",stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t,ct=0;
    cin>>t;
    while(t--)
    {
        cout<<"Case #"<<++ct<<": ";
        solve();
    }
    return 0;
}
#endif


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

int main()
{
    char a;
    cin >> a;

    if ('A' <= a && a <= 'Z')
    {
        cout << "A" << endl;
        return 0;
    }
    else if ('a' <= a && a <= 'z')
    {
        cout << "a" << endl;
        return 0;
    }
}

Measured memory_bytes: 3616
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int maxx = 1e5;

int main()
{
	int a, b;
	cin >> a >> b;
	if(a <= 2 * b) puts("0");
	else cout << a - 2 * b << '\n'; 

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LLI long long int
#define LI long int 
const LI MOD=1e9+7;
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//            When something is important enough, you do it even if the odds are not in your favor.
LLI fac[(LI)1e6+4];
long long int power(long long int x, unsigned long long  int y, unsigned  long long int m)
{
    long long res = 1;
    x%=m;
    while (y > 0) {
        if (y & 1)
            res = res * x%m;
        x = x * x%m;
        y >>= 1;
    }
    return res;
}
long long int modInverse(long long int a,long long  int m=MOD)
{
            return power(a, m-2, m);
 
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LLI x,y;cin>>x>>y;
      if((x+y)%3!=0){cout<<0;return 0;}
      if(2*x-y<0||2*y-x<0){cout<<0;return 0;}
      LLI i,m=(2*x-y)/3,n=(2*y-x)/3;
      fac[0]=1,fac[1]=1;
      fo(i,2,1e6+4){
        fac[i]=fac[i-1]*i%MOD;
      }
      cout<<(fac[m+n]*((modInverse(fac[m])*modInverse(fac[n]))%MOD))%MOD;
    }
    return 0;
}

Measured memory_bytes: 11428
/*
平方根が少数のときに気をつける
*/

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    int target = Integer.parseInt(a + b);
    boolean flag = false;

    //デバッグ
    //System.out.println(target);
    for(double i = 1; i <= Math.sqrt(target); i++){
      if((double)target / i == i){
        flag = true;
        /*System.out.println(target / i);
        System.out.println(i);*/
        break;
      }
    }

    if(flag){System.out.println("Yes");}
    else{System.out.println("No");}
  }
}

/*
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String blank = sc.nextLine();
String s = sc.nextLine();
System.out.println();
System.exit(0)
*/


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int t = 0;
    
    rep(i, n) {
        t = t ^ a[i];
    }
    
    cout << ((t == 0) ? "Yes" : "No") << endl;
    return 0;
}


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

int table[3][6] = {
	{1,0,1,4,5,2} ,
	{2,3,0,5,2,1} ,
	{0,1,2,3,4,5}
} ;

main(){
	string s ;
	while( cin >> s ){
		if( s == "#" ) break ;
		
		bool ans = false ;
		int pos = 0 ;
		for( int i=0 ; i<s.size() ; i++ ){
			pos = table[s[i]-'0'][pos] ;
			if( pos == 0 ) break ;
		}
		if( pos == 5 ) ans = true ;
		
		if( ans ) cout << "Yes" << endl ;
		else cout << "No" << endl ;
	}
}

Measured memory_bytes: 1180
#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<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#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++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };



void solve() {
    ll a, b, c, d, n, k, x,l,r;
    string s, t;
    ll ans = 0;
    double dans = 0;
    string sans = "Good";

    cin  >> r >> d >> a;

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



    // std::cout << ans << endl; 
    // std::cout << sans << endl; 
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int number[1000];
  int N;
  int count=0;
  int gcount=0;
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%d",&number[i]);
    }

  while(1){
    for(int j=0;j<N;j++){
      if(number[j]%2==0) gcount++;
    }
    if(gcount==N){
      count++;
      for(int k=0;k<N;k++){
        number[k]/=2;
      }
    }else{
      break;
    }
    gcount=0;
  }

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



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

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio( false ), cin.tie( nullptr ), cout.tie( nullptr );

    int a, N; cin >> N; map< ll, int > x; ll sum = 0, count = 0;

    for( int i = 0; i < N; i++ )
        cin >> a, x[ sum += a ]++;

    for( auto p: x )
    {
        ll n = p.second;

        if ( p.first == 0 )
            count += n;

        if ( n > 1 )
            n *= n - 1, count +=  n / 2;
    }

    cout << count;
}


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

int main() {
	char s[11], t[11];
	scanf("%s%s", s, t);
	
	int ans = 0;
	for(int i=0;i<3;i++)
		if(s[i]==t[i]) ans++;
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 256
main(a,b,c,n,s)
{
  for(;~scanf("%d",&n);printf("%d\n",s))
    for(s=a=0;a<10;a++)
      for(b=0;b<10;b++)
        for(c=0;c<10;c++)
          if(n-a-b-c<10 && n-a-b-c>=0)s++;
}

Measured memory_bytes: 0
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

long long comb2(long long n) {
    return n * (n-1) / 2;
}

int main() {
    int N; cin >> N;
    map<int, int> mp;
    auto itr = mp.begin();
    vector<int> v; v.reserve(N);

    for(int i = 0; i < N; ++i) {
        int a; cin >> a;
        v.push_back(a);

        // mapに追加済の場合
        if((itr = mp.find(a)) != mp.end()) {
            mp[a] += 1;

        // mapに未追加の場合
        } else {
            mp[a] = 1;
        }
    }

    long long sum = 0;
    for(auto i = mp.begin(); i != mp.end(); ++i) {
        if(i->second > 1) sum += comb2(i->second);
    }

    for(int i = 0; i < N; ++i) {
        int index = v[i];
        if(mp[index] == 1) cout << sum << endl;
        else if(mp[index] > 2) cout << sum - mp[index] + 1 << endl;
        else cout << std::max((sum - 1), (long long)0) << endl;
    }
}


Measured memory_bytes: 8320
from operator import itemgetter
# N = 5
# R = [[0, 0],
#      [7, 3],
#      [2, 2],
#      [4, 8],
#      [1, 6]]

# B = [[8, 5], 
#      [6, 9], 
#      [5, 4], 
#      [9, 1],
#      [3, 7]]
N = int(input())
R = []
for i in range(N):
    a, b = map(int, input().split())
    R.append([a, b])
B = []
for i in range(N):
    c, d = map(int, input().split())
    B.append([c, d])
R.sort(key=itemgetter(0))
B.sort(key=itemgetter(0))
# print(R)
# print(B)
res = 0
for r in R[::-1]:
    rx, ry = r[0], r[1]
    flag1 = False
    flag2 = False
    
    for i, b in enumerate(B):
        if b[0] > rx:
            flag1 = True
            break
    
    if flag1:
        B_tmp = B.copy()[i:]
        B_tmp.sort(key=itemgetter(1))
        for ii, b in enumerate(B_tmp):
            if b[1] > ry:
                flag2 = True
                break
        if flag2:
            res += 1
            B.remove(b)
print(res)

Measured memory_bytes: 3064
#!/usr/bin/env python3
import sys, os
 
def main():
    inp = [int(x) for x in os.read(0, os.fstat(0).st_size).split()]
    n, m = inp[0],inp[1]
 
    wi, vi = inp[2], inp[3]
 
 
    dp = [0] * (m + 1)
    for j in range(wi, m + 1):
        dp[j] = vi
 
    for i in range(n - 1):
        wi = inp[2*i + 4]
        vi = inp[2*i + 5]
        for j in range(m, wi-1, -1):
            x = vi + dp[j - wi]
            if dp[j] < x:
                dp[j] = x
 
    print(dp[-1])
main()


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

using namespace std;

int N,M,R;
int graph[201][201];
int r[9];
int A,B,C;
int ans = 1e9;

int main()
{
    //入力
    cin >> N >> M >> R;
    //グラフの初期化
    //iとjが違う時に入れていくのが大事。初めは十分大きな値で初期化する。
    for(int i=0;i<N;i++) for(int j=0;j<N;j++) if(i != j) graph[i][j] = 1e9;
    for(int i=0;i<R;i++){
        cin >> r[i];
        //デクリメントしておくことでインデックスを揃える。
        r[i]--;
    }
    //グラフを作る
    for(int i=0;i<M;i++)
    {
        cin >> A >> B >> C;
        //デクリメントしておくことでインデックスを揃える。
        A--;
        B--;
        //無向グラフなのでどちらの方向にも辺の大きさを代入する。
        if(graph[A][B] > C) graph[A][B] = graph[B][A] = C;
    }
    //ワーシャルフロイド法
    //頂点から頂点の最短距離を求める
    for(int k=0; k<N;k++)
        for(int i=0;i<N;i++)
            for(int j=0;j<N;j++)
                graph[i][j] = min(graph[i][j],graph[i][k]+graph[k][j]);

    //訪れた場所のパターンを全列挙
    sort(r,r+R);
    do{
        int here = 0;
        for(int i = 1; i < R; i++)
        {
            here += graph[r[i-1]][r[i]];
        }
        ans = min(ans,here);
    }while (next_permutation(r,r+R));

    //出力
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
import math

k = int(input())

total = 0
for a in range(1,k+1):
    for b in range(a,k+1):
        for c in range(b,k+1):
            abc = {a,b,c}
            div = 1
            if len(abc) == 2:
                div = 3
            elif len(abc) == 1:
                div = 1
            elif len(abc) == 3:
                div = 6
            #print(str(a) + " " + str(b) + " " + str(c))
            add = div * math.gcd(math.gcd(a,b),c)
            #print(len(abc))
            #print(div)
            #print(add)
            total += add

print(total)


Measured memory_bytes: 9196
# 解き直し https://atcoder.jp/contests/keyence2020/tasks/keyence2020_b
N = int(input())
R = [None] * N
for i in range(N):
    X, L = map(int, input().split())
    R[i] = (X-L, X+L)
# 右端でソート
R.sort(key=lambda x: x[1])
ans = N
max_R = R[0][1]
for i in range(1, N):
    if R[i][0] < max_R:
        ans -= 1
    else:
        max_R = R[i][1]
print(ans)

Measured memory_bytes: 18216
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner cin =new Scanner(System.in);
		double max=0;
		double min=990485039;
		while(cin.hasNext()){
			double d = cin.nextDouble();
			if(max<d){
				max=d;
			}
			if(min>d){
				min=d;
			}
		}
		System.out.println(max-min);

	}

}

Measured memory_bytes: 12000
N, K = list(map(int, input().split()))
l = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = list(map(int, input().split()))
    l[a].append(b)
    l[b].append(a)

deg1 = [0] * (N + 1)
deg2 = [0] * (N + 1)
history = [True] * (N + 1)
stack = [1]
ans = 1

while stack:
    node = stack.pop()
    ans *= K - deg1[node] - deg2[node]
    ans %= 1000000007
    history[node] = False
    for child in l[node]:
        if history[child]:
            deg1[child] += 1
            deg2[child] += deg1[node]
            deg1[node] += 1
            stack.append(child)
            
print(ans)

Measured memory_bytes: 34536