akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int[] x = sc.nextIntArray(5);
    for (int i = 0; i < 5; i++) {
      if (x[i] != 0) continue;
      System.out.println(i + 1);
      break;
    }
  }
}

Measured memory_bytes: 32600
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    X,Y=map(int,input().split())
    ans=0
    for i in [X,Y]:
        if i == 3:
            ans+=100000
        elif i==2:
            ans+=200000
        elif i==1:
            ans+=300000
    if X==Y==1:
        ans+=400000
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include<stdio.h>
#include<iostream>

using namespace std;

int main()
{
	int H, R,sum;
	scanf("%d%d", &H, &R);
	sum = H + R;
	if (sum > 0)
	{
		printf("1\n");
	}
	else if (sum == 0)
	{
		printf("0\n");
	}
	else
	{
		printf("-1\n");
	}
	return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int n,m; cin>>n>>m;
	vi v(n),a(n);
	rep(i,0,m)cin>>v[i]>>a[i];
	rep(i,0,1000000){
		string s=to_string(i);
		if(s.size()!=n)continue;
		bool ok=true;
		rep(j,0,m){
			int k=v[j]-1;
			if(s[k]!=(char)('0'+a[j])){
				ok=false;
			}
		}
		if(ok){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;

	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <ext/rope>
using namespace std;
using namespace __gnu_cxx;

using ci = const int;
using ld = long double;
using llint = long long;
using ullint = unsigned long long;
using pii = pair <int,int>;
using pcc = pair <char,char>;
using pss = pair <string,string>;
using vi = vector <int>;
using vb = vector <bool>;
using vii = vi::iterator;

#define INF (1<<30)
#define MOD 1000000007
#define mt make_tuple
#define all(c) c.begin(), c.end()
#define ms(name,val) memset(name, val, sizeof name)
#define np nullptr
// inline functions



inline bool cmp(int a, int b)
{
    return (a%10 > b%10);
}

int main()
{
    ios_base::sync_with_stdio(0);
    //cin.tie(0);

    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    vi v = {a, b, c, d, e};
    vi mod0;

    for (int t1 = 0; t1 < v.size(); ++t1)
    {
        if (v[t1] % 10 == 0)
        {
            mod0.push_back(v[t1]);
            v.erase(v.begin()+t1);
            t1 = -1;
        }
    }

    int s = accumulate(all(mod0), 0);

    if (mod0.size() == 5)
    {
        cout << s << '\n';
        return 0;
    }

    sort(all(v), cmp);

    for (int t1 = 0; t1 < v.size()-1; ++t1)
    {
        int x = v[t1];
        s += (x + 10 - x%10);
    }

    cout << s+v[v.size()-1] << '\n';


































































    return 0;
}

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

int x,y;
bool ok=false;
int main(){
	cin>>x>>y;
	rep(i,x+1){
		if(2*i+4*(x-i)==y) ok=true;
	}
	if(ok)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;	

}


Measured memory_bytes: 3636
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    ll a=in(),b=in();
    string s(b,'0'+a),t(a,'0'+b);
    cout<<min(s,t)<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

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

    int seven = 7,k,ans = 1;
    cin>>k;
    if(k%2 == 0){
        ans = -1;
    }
    else{
        while(true){
            if(seven % k == 0)break;
            if(ans > 1e7){
                ans = -1;
                break;
            }
            seven = seven % k;
            seven = seven * 10 + 7;
            ans++;
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3644
from itertools import product

h, w, k = map(int, input().split())
c = [input() for _ in range(h)]

ans = 0

for row_bit in product(range(2), repeat=h):
    for col_bit in product(range(2), repeat=w):
        cnt = 0
        for row in range(h):
            for col in range(w):
                if (c[row][col] == '#') and ((row_bit[row] == 0) and (col_bit[col] == 0)):
                    cnt += 1   
        if cnt == k:
            ans += 1
print(ans)


Measured memory_bytes: 9208
temparr = input()
temparr = temparr.split()
n = int(temparr[0])
d = int(temparr[1])

import math
count = 0 
for cord in range(n):
    temparr = input()
    temparr = temparr.split()
    x0 = int(temparr[0])
    y0 = int(temparr[1])
    pyt = math.sqrt( x0 * x0 + y0 * y0)
    if pyt <= d:
        count += 1 
print(count)

Measured memory_bytes: 70040
#include <iostream>

using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;

    int result = 0;

    if(a != b){
        result++;
    }
    if(b != c){
        result++;
    }
    if(c != a){
        result++;
    }

    if(result == 0){
        result++;
    }
    cout << result << endl;
}

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

const long long mod = 1000000007;

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

    int n;
    string a, b;
    cin >> n;
    cin >> a >> b;

    long long res;
    int i;
    if(a[i] == b[i]) {
        res = 3;
        i = 1;
    }
    else {
        res = 6;
        i = 2;
    }
    for(; i < n; i++) {
        if(a[i - 1] == b[i - 1]) {
            res *= 2;
            if(a[i] != b[i]) {
                i++;
            }
        }
        else {
            if(a[i] != b[i]) {
                res *= 3;
                i++;
            }
        }
        res %= mod;
    }
    cout << res;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  long long sum = 0, lsum = 0, rsum = 0, ans = 0;
  for (int i = 0; i < n; i++)
    sum += a[i];
  lsum = sum;
  map<long long, int> mp;
  mp[0] = 1;
  for (int i = n - 1; i >= 0; i--) {
    lsum -= a[i];
    ans += mp[sum - lsum];
    rsum += a[i];
    mp[rsum]++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define INF 1e9

int main(){
    ll N,x;
    cin>>N>>x;
    
    ll a[N],c[N];
    
    ll ans=0;
    for(int i=0;i<N;i++){
        cin>>a[i];
        c[i]=a[i];
        ans+=a[i];
    }
    for(ll t=1;t<N;t++){
        ll cost=t*x;
        for(int i=0;i<N;i++){
            c[i]=min(c[i],a[(i+N-t)%N]);
            cost+=c[i];
        }
        ans=min(ans,cost);
    }
    cout<<ans<<endl;
}

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

int main(){
	int n,m;
	cin >> n >> m;
	priority_queue<ll> p;
	for(int i = 0;i < n;i++){
		ll d; scanf("%lld",&d);
		p.push(d);
	}
	while(m--){
		int x = p.top() / 2;
		p.pop();
		p.push(x);
	}
	ll sum = 0;
	while(p.size()){
		sum += p.top();
		p.pop();
	}	
	cout << sum << endl;
	return 0;
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    string a, b;
    cin >> a >> b;

    if (a.size() > b.size()) {
        puts("GREATER");
    } else if (a.size() < b.size()) {
        puts("LESS");
    } else if (a > b) {
        puts("GREATER");
    } else if (a < b) {
        puts("LESS");
    } else {
        puts("EQUAL");
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N,ave,p,i,sum;
  cin >> N;
  sum=0;
  p=0;
  vector<int> X(N);
  for(i=0;i<N;i++)
  {
    cin >> X.at(i);
    sum=sum+X.at(i);
  }
  ave=sum/N;
  if((ave+1)*N-sum<sum-ave*N)
    ave=ave+1;
   //cout << ave << endl;
  for(i=0;i<N;i++)
  {
    p=p+(ave-X.at(i))*(ave-X.at(i));
   // cout << (ave-X.at(i))*(ave-X.at(i)) << endl;
  }
  cout << p << endl;
}
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> t(n);
	vector<int> x(n);
	vector<int> y(n);
	rep(i,n) cin >> t.at(i) >> x.at(i) >> y.at(i);
	int X=0,Y=0,T=0;
	rep(i,n){
		int m=abs(X-x.at(i))+abs(Y-y.at(i));
		if(m+T>t.at(i) || m%2!=(t.at(i)-T)%2){
			cout << "No" << endl;
			return 0;
		}
		X=x.at(i);
		Y=y.at(i);
		T=t.at(i);
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 1408
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S,C = MI()
    ans = min(S,C//2)
    S-=ans
    C-=2*ans
    if C:
        ans += C//4
    print(ans)
if __name__ == '__main__':
    main()

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

int main()
{
	int a, b;
	cin >> a >> b;
	string s;
	cin >> s;
	int flag = 1;
	if (s.size() != a + b + 1)
	{
		flag = 0;
		goto label;
	}
	for (int i=0 ;i< s.size();i++)
	{
		if (((i != a) && (s[i] >= 48) && (s[i] <= 57))||((i==a)&&(s[i]=='-')))
			flag = 1;
		else
		{
			flag = 0;
			goto label;
		}
	}
label: cout <<(flag?"Yes": "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fine cout<<"fine"<<endl;
#define ll long long int
#define pb push_back
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
const ll inf=(ll)2e18;
const int mod=1e9+7;
bool overflow(ll a,ll b){
    if (a <= (inf+b-1)/b) return false;
    return true;
}
int countdist[2005],visited[2005];
void bfs(vector<vector<int> >&v,int src){
    int dist[(int)v.size()];
    dist[src]=0;
    queue<int> q;
    q.push(src);
    visited[src]=src;
    while(q.size()){
        int x=q.front();
        q.pop();
        for(auto it:v[x]){
            if(visited[it]!=src){
                visited[it]=src;
                dist[it]=dist[x]+1;
                countdist[dist[it]]++;
                q.push(it);
            }
        }
    }
}
int main(){
int n,x,y,i;
cin>>n>>x>>y;
vector<vector<int> > v(n+1);
for(i=1;i<n;i++){
    v[i].pb(i+1);
    v[i+1].pb(i);
}
v[x].pb(y);
v[y].pb(x);
for(i=1;i<=n;i++){
    bfs(v,i);
}
for(i=1;i<n;i++){
    cout<<countdist[i]/2<<endl;
}
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, k, u, v;
string s, t;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	vll a(3);
	cin>>a[0]>>a[1]>>a[2];
	sort(all(a));
	if(a[0]==a[1] && a[1]==5 && a[2]==7) {
		cout<<"YES\n";
	}
	else cout<<"NO\n";
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
//ll const mod=998244353;
ll const mod=1e9+7;
const ll MAX=300000;
using vi=vector<int>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


//////////////////////////////////////
ll f(ll n,ll k){
    ll a=k*(n-k)+1;
}

int main(){
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    if(k>n){
        cout<<1<<endl;
        return 0;
    }
    arep(i,k,n+2){
        ans+=(i*(n-i+1)+1);
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632
//int a = s - '0'; 文字から数字
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//過半数：N/2.0で判定
//優先度付きキュー
//priority_queue<
//ll,
//vector<ll>
//> q;
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
#define PI 3.14159265358979323846264338327950L
using namespace std;

//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1));
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

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

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

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

	ll ans = 0;
	for(ll a = 1; a <= N; a++){
		ans += floor((N-1)/a);
	}

	cout << ans << endl;
}	

Measured memory_bytes: 10988
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
//自作関数
template<class T> ll llpow(T x,T n){ll ans=1;while(n--){ans*=x;}return ans;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

int INF = 1<<30;
int n,w;
int main(){
    cin>>n>>w;
    int weight[n];
    int value[n];
    rep(i,n)cin>>weight[i]>>value[i];
    int dp[n+10][1000*n+10];
    rep(i,n+1){
        rep(j,1000*n+1){dp[i][j]=INF;}
    }
    dp[0][0]=0;
    for(int i=0;i<n;i++){
        for(int sumv=0;sumv<=(1000*n);sumv++){
            if(sumv-value[i]>=0)chmin(dp[i+1][sumv],dp[i][sumv-value[i]]+weight[i]);
            chmin(dp[i+1][sumv],dp[i][sumv]);
        }
    }
    int ans=0;
    rep(i,1000*n+1){
        if(dp[n][i]<=w){
            ans=i;
        }
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 41600
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		boolean[][] s = new boolean[h][w];
		for (int i = 0; i < h; i++) {
			String text = sc.next();
			for (int j = 0; j < w; j++) {
				s[i][j] = text.substring(j, j + 1).equals(".");
			}
		}
		sc.close();

		int max = 0;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				max = Math.max(max, calc(s, i, j));
			}
		}

		System.out.println(max);
	}

	private static int calc(boolean[][] s, int x, int y) {
		if (!s[x][y]) {
			return 0;
		}

		int h = s.length;
		int w = s[0].length;
		int[][] c = new int[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				c[i][j] = Integer.MAX_VALUE;
			}
		}
		c[x][y] = 0;
		check(s, c, x, y);
		int max = 0;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (c[i][j] != Integer.MAX_VALUE) {
					max = Math.max(max, c[i][j]);
				}
			}
		}
		return max;
	}

	private static void check(boolean[][] s, int[][] c, int x, int y) {
		int h = c.length;
		int w = c[0].length;
		int[] xs = new int[] { x + 1, x - 1, x, x };
		int[] ys = new int[] { y, y, y + 1, y - 1 };

		for (int i = 0; i < xs.length; i++) {
			int x2 = xs[i];
			int y2 = ys[i];
			if (x2 >= 0 && x2 < h && y2 >= 0 && y2 < w && s[x2][y2] && c[x][y] + 1 < c[x2][y2]) {
				c[x2][y2] = c[x][y] + 1;
				check(s, c, x2, y2);
			}
		}
	}
}


Measured memory_bytes: 194088
#include<bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;
//printf("%.10f\n", n);

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}

ll prime_factor(ll n) {
	ll gh = 1;
	for (ll i = 2; i * i <= n; i++) {
		ll ok = 1;
		while (n % i == 0) {
			ok++;
			n /= i;
		}
		gh *= ok;
	}
	if (n != 1) { gh *= 2; }
	return gh;
}

ll test[12345678], aa[12345678];
signed main() {
	ll n, m, k, q, a = -1, b = -1, c = 0, cnt = 1, ans = 0; string s, t;
	cin >> n;
	if (n >= 1000000) {
		ans = 7235062807366; cnt = 1000001;
	}
	if (n >= 1500000) {
		ans = 16734924755096; cnt = 1500001;
	}
	if (n >= 2000000) {
		ans = 30326413365285; cnt = 2000001;
	}
	if (n >= 2500000) {
		ans = 48081994935671; cnt = 2500001;
	}
	if (n >= 3000000) {
		ans = 70058785460280; cnt = 3000001;
	}
	if (n >= 3500000) {
		ans = 96301520878991; cnt = 3500001;
	}
	if (n >= 4000000) {
		ans = 126850549017804; cnt = 4000001;
	}
	if (n >= 4500000) {
		ans = 161737467121483; cnt = 4500001;
	}
	if (n >= 5000000) {
		ans = 200992441246692; cnt = 5000001;
	}
	if (n >= 5500000) {
		ans = 244642548171917; cnt = 5500001;
	}
	if (n >= 6000000) {
		ans = 292711324081941; cnt = 6000001;
	}
	if (n >= 6500000) {
		ans = 345219904513529; cnt = 6500001;
	}
	if (n >= 7000000) {
		ans = 402188826344049; cnt = 7000001;
	}
	if (n >= 7500000) {
		ans = 463635895079489; cnt = 7500001;
	}
	if (n >= 8000000) {
		ans = 529581632274134; cnt = 8000001;
	}
	if (n >= 8500000) {
		ans = 600036645526326; cnt = 8500001;
	}
	if (n >= 9000000) {
		ans = 675021515919670; cnt = 9000001;
	}
	if (n >= 9500000) {
		ans = 754546104527913; cnt = 9500001;
	}
	for (int h = cnt; h <= n; h++) {
		ans += h * prime_factor(h);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        int n = Read.Int();
        HashSet<int> a = new HashSet<int> { };
        for(int i = 0; i < n; i++)
        {
            a.Add(int.Parse(Read.Str()));
        }
        Console.WriteLine(a.Count());
        Console.ReadLine();
    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    public static bool IsPrime(int num)
    {
        if (num < 2) return false;
        else if (num == 2) return true;
        else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2)
        {
            if (num % i == 0)
            {
                // 素数ではない
                return false;
            }
        }

        // 素数である
        return true;
    }
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long() { return long.Parse(Console.ReadLine()); }
    public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); }
    public static int Int() { return int.Parse(Console.ReadLine()); }
    public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

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

namespace ABC130C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            long W = long.Parse(input[0]);
            long H = long.Parse(input[1]);
            long x = long.Parse(input[2]);
            long y = long.Parse(input[3]);

            double ans;
            int plural;
            if (W % 2 == 0 && x == W / 2 && H % 2 == 0 && H / 2 == y)
            {
                //与えられた点が中央にあるとき
                ans = W * H / 2;
                plural = 1;
            }
            else
            {
                //与えられた点が中央にないとき
                ans = (double)W * (double)H / 2;
                plural = 0;
            }
            Console.WriteLine(ans + " " + plural);

        }
    }
}


Measured memory_bytes: 11092
import java.util.Scanner;

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

		boolean[] E=new boolean[300001];
		for(int i=2;i<=300000;i++) if(i%7==1 || i%7==6) E[i]=true;
		for(int i=2;i<=548;i++) if((i%7==1 || i%7==6) && E[i]) {
			for(int j=i*i;j<=300000;j+=i) E[j]=false;
		}

		while(true){
			int n=sc.nextInt();
			if(n==1) break;
			System.out.printf(n+":");
			for(int i=2;i<=n;i++) if(n%i==0 && E[i]) System.out.printf(" "+i);
			System.out.println();
		}

		return;
	}
}

Measured memory_bytes: 25956
def prim
  visited = [0]
  length = []

  until visited.length == @input_array.length do
    min_len, min_point = Float::INFINITY, 0
    visited.each do |x|
      @input_array[x].each_with_index do |y, i|
        if !visited.include?(i) && y != -1
          min_len, min_point = y , i if min_len > y
        end
      end
    end
    length << min_len
    visited << min_point
  end
  length.inject(:+)
end

@input_array = []

gets.to_i.times do
  @input_array << gets.split(" ").map{|x| x.to_i}
end

puts prim



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

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n-1);
    rep(i,n-1) cin >> b.at(i);
    a.at(0) = b.at(0);
    a.at(n-1) = b.at(n-2);

    for(int i=1;i<n-1;i++){
        a.at(i) = min(b.at(i-1),b.at(i));
    }
    ll tot = 0;
    rep(i,n) tot += a.at(i);

    cout << tot << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = 1e9;
    for(int a = 1; a <= n-1; ++a){
        int b = n - a;
        int aa = a;
        int cnt = 0;
        while(aa > 0){
            cnt += aa%10;
            aa /= 10;
        }
        while(b > 0){
            cnt += b%10;
            b /= 10;
        }
        chmin(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3660
import bisect

def PN(N):
    for i in range(2,int(N**0.5)+1):
        if N%i==0:
            return False
    return True

N=[3]
for i in range(5,100001,2):
    if PN(i) and PN((i+1)//2):
        N.append(i)

Q=int(input())

for i in range(Q):
    l,r=map(int,input().split())
    ln1=bisect.bisect_left(N,l)
    ln2=bisect.bisect_right(N,l)
    rn1=bisect.bisect_left(N,r)
    rn2=bisect.bisect_right(N,r)
    if ln1==ln2 and rn1==rn2:
        print(rn1-ln1)
    elif ln1==ln2 or rn1==rn2:
        print(rn1-ln2+1)
    else:
        print(rn1-ln2+2)





Measured memory_bytes: 3444
using System;
using System.Linq;

public class Program
{
    public static void Main(string[] args)
    {
        var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var cnt = 0;
        while (vals[0] > 0)
        {
            vals[0] -= vals[1];
            cnt++;
        }
        Console.WriteLine(cnt);
    }
}

Measured memory_bytes: 13268
#include                        <bits/stdc++.h>
#include                        <ext/pb_ds/assoc_container.hpp>
#define lb                      lower_bound
#define ub                      upper_bound
#define fe(x)                   *(x.begin())
#define le(x)                   *(x.rbegin())
#define pb                      push_back
#define load(node,n)            bool operator < (const node &n) const
#define fbo(x)                  find_by_order(x)
#define ook(x)                  order_of_key(x)
#define all(x)                  (x).begin(),(x).end()
#define FOR(i,n)                for(int i = 1; i<=n; i++)
#define REP(i,n)                for(int i = 0; i<n;  i++)
#define TT                      int TC;  scanf("%d",&TC);  while(TC--)
#define read                    freopen("input.txt","r",stdin)
#define write                   freopen("output.txt","w",stdout)
#define dbg(...)                debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#define set(x)                  tree<x,null_type,less<x>,rb_tree_tag,tree_order_statistics_node_update>
using                           namespace __gnu_pbds;
using                           namespace std;
typedef                         long long ll;
typedef                         pair<ll,ll> pll;
typedef                         pair<int,int> pii;

vector<string> vec_splitter(string s){
    s += ','; vector<string> res;
    while(!s.empty()) res.push_back(s.substr(0,s.find(','))), s = s.substr(s.find(',') + 1);
    return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused))int idx,
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T){
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") "; stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str(); debug_out(args, idx + 1, LINE_NUM, T...);
}



ll n;

bool fn(ll m){
    ll x = 100.0;
    for(ll i = 0; i<m; i++){
        x = (x + x/100.0);
//        cout<<i<<" -> "<<x<<endl;
        if(x>=n)    return 1;
    }
    return 0;
}


main(){
//read;



cin>>n;

ll l = 1, h = 1000000,m,ans;
while(l<=h){
    m = l+h>>1;
    if(fn(m))    h = m-1,ans = m;
    else l = m+1;
}
//fn(1706);
cout<<ans;


return 0;
}


Measured memory_bytes: 3624
/**
 * ?????????(?????§???)
 *
 * @author skywang
 * @date 2014/03/07
 */

#include <iostream>
#include <cstdio>
using namespace std;
const int MAX = 500010;

static int m_heap[100000];        // ??°???
static int m_capacity=100000;    // ????????????
static int m_size=0;        // ????????????(????§???????0)
int Array[MAX];
int n;
/* 
 * ?????§?????????????°???´??????
 *
 * ??¨?????°????????°?????????????¬¬N?????????????????????????´¢?????????(2N+1)????????????????´¢??????(2N+2)???
 *
 * ?????°??´??????
 *     start -- ?¢?????°??????????????§???????(?????¬???0?????¨???????¬¬1???????§?)
 *     end   -- ???????????´(?????¬?????°??????????????????????´?????´¢???)
 */
void maxheap_filterdown(int start, int end)
{
    int cur = start;          // ??????(current)???????????????
    int left = 2 * cur + 1;     // ???(left)???????????????
    int value = Array[cur];    // ??????(current)???????????§?°?

    while(left <= end)
    {
        // "left"???????????????"left+1"????????????
        if(left < end && Array[left] < Array[left + 1])
            left++;        // ?????????????????????????????§?????????m_heap[left+1]
        if(value >= Array[left])
            break;        //?°???´??????
        else
        {
            Array[cur] = Array[left];
            cur = left;
            left = 2 * left + 1;   
        }       
    }   
    Array[cur] = value;
}
  
/* 
 * ?????°?????????
 *
 * ????????????
 *     0?????¨?????????
 *    -1?????¨?????±?´\
 */
void maxheap_print()
{
    for (int i=0; i < n; i++)
        printf(" %d", Array[i]);
    printf("\n");
}
    
int main()
{
    scanf("%d", &n);
    for(int i=0; i < n; i++)
    {
        scanf("%d", &Array[i]);
    }
    for(int i = n / 2; i >=0 ;i--)
        maxheap_filterdown(i, n);

    maxheap_print();
    
    return 0;
}

Measured memory_bytes: 5080
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int Ch = sc.nextInt();
		int Cw = sc.nextInt();
		int Dh = sc.nextInt();
		int Dw = sc.nextInt();
		Main main = new Main();
		int map[][] = new int[H][W];
		int result = Integer.MAX_VALUE;
		char c[][] = new char[H][W];
		for (int i = 0; i < H; i++) {
			String s = sc.next();
			char temp[] = s.toCharArray();
			for (int j = 0; j < W; j++) {
				c[i][j] = temp[j];
			}
		}
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				map[i][j] = -1;
			}
		}
		Queue<Point> queue = new ArrayDeque<Point>();
		List<Point> accessList = new ArrayList<Point>();
		Point p = main.new Point();
		p.x = Ch - 1;
		p.y = Cw - 1;
		queue.add(p);
		accessList.add(p);
		map[Ch - 1][Cw - 1] = 0;
		while (queue.size() > 0 || accessList.size() > 0) {
			if (queue.size() > 0) {
				Point t = queue.poll();
				Point temp = main.new Point();
				if (t.x - 1 >= 0 && map[t.x - 1][t.y] == -1 && c[t.x - 1][t.y] != '#') {
					temp.x = t.x - 1;
					temp.y = t.y;
					map[t.x - 1][t.y] = map[t.x][t.y];
					queue.add(temp);
					accessList.add(temp);
				}
				temp = main.new Point();
				if (t.y - 1 >= 0 && map[t.x][t.y - 1] == -1 && c[t.x][t.y - 1] != '#') {
					temp.x = t.x;
					temp.y = t.y - 1;
					map[t.x][t.y - 1] = map[t.x][t.y];
					queue.add(temp);
					accessList.add(temp);
				}
				temp = main.new Point();
				if (t.x + 1 < H && map[t.x + 1][t.y] == -1 && c[t.x + 1][t.y] != '#') {
					temp.x = t.x + 1;
					temp.y = t.y;
					map[t.x + 1][t.y] = map[t.x][t.y];
					queue.add(temp);
					accessList.add(temp);
				}
				temp = main.new Point();
				if (t.y + 1 < W && map[t.x][t.y + 1] == -1 && c[t.x][t.y + 1] != '#') {
					temp.x = t.x;
					temp.y = t.y + 1;
					map[t.x][t.y + 1] = map[t.x][t.y];
					queue.add(temp);
					accessList.add(temp);
				}
			} else {
				List<Point> aList = new ArrayList<Point>();
				for (Point t : accessList) {
					for (int i = -2; i <= 2; i++) {
						for (int j = -2; j <= 2; j++) {
							Point temp = main.new Point();
							if (i == 0 && j == 0) {
								continue;
							}
							if ((i == -1 && j == 0) || (i == 1 && j == 0) || (i == 0 && j == 1)
									|| (i == 0 && j == -1)) {
								continue;
							}
							if (t.x + i >= 0 && t.x + i < H && t.y + j >= 0 && t.y + j < W
									&& map[t.x + i][t.y + j] == -1 && c[t.x + i][t.y + j] != '#') {
								temp.x = t.x + i;
								temp.y = t.y + j;
								queue.add(temp);
								map[t.x + i][t.y + j] = map[t.x][t.y] + 1;
								aList.add(temp);
							}
						}
					}
				}
				accessList = aList;
			}
		}
		System.out.println(map[Dh - 1][Dw - 1]);
	}

	public class Point extends Object {
		int x;
		int y;

		public int hashCode() {
			return x * 100 + y;
		}

		public boolean equals(Object o) {
			Point temp = (Point) o;
			if (temp.x == x && temp.y == y) {
				return true;
			}
			return false;
		}
	}
}

Measured memory_bytes: 72756
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	sc := newScanner(os.Stdin)
	s := sc.s()
	t := sc.s()
	pre := t[:len(t)-1]
	if s == pre {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}


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

int a, b, c, k;

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

    cin >> a >> b >> c >> k;

    if (k % 2 == 0) cout << a - b << '\n';
    else cout << b - a << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template<class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {
    
    
    ll r,d,x;
    cin>>r>>d>>x;
    for(int i=1;i<=10;i++){
        x=r*x-d;
        fin(x);
    }
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=1e9+7;



int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();

    ll n;
    cin>>n;
    cout<<(1^n);


 
 
    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

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

int main() {
  string S;
  cin >> S;
  int N = S.size();
  for (int i=0; i < N; i++) {
    if ((i%2 == 0 && S.at(i) == 'L') || (i%2 == 1 && S.at(i) == 'R')) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll cnt_c1[35] = {};
ll cnt_c2[35] = {};
ll cnt_c3[35] = {};
ll cost_c[35][35] = {};
int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);

    int N, C;
    cin >> N >> C;

    int tmp_cost;
    for(int i = 0; i < C; i++){
        for(int j = 0; j < C; j++){
            cin >> tmp_cost;
            cost_c[i][j] = tmp_cost;
        }
    }

    int tmp_c;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            cin >> tmp_c;
            tmp_c--;
            if((i+j)%3==0){
                cnt_c1[tmp_c]++;
            }else if((i+j)%3==1){
                cnt_c2[tmp_c]++;
            }else{
                cnt_c3[tmp_c]++;
            }
        }
    }

    ll ans = INF;
    ll tmp_ans = 0;
    for(int i = 0; i < C; i++){
        for(int j = 0; j < C; j++){
            for(int k = 0; k < C; k++){
                if((i == j || j == k) || i == k) continue;
                tmp_ans = 0;
                //1番目をすべてi番目の色に書き換え
                for(int l = 0; l < C; l++){
                    tmp_ans += cnt_c1[l] * cost_c[l][i];
                    tmp_ans += cnt_c2[l] * cost_c[l][j];
                    tmp_ans += cnt_c3[l] * cost_c[l][k];
                }

                chmin(ans, tmp_ans);

            }
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar(n) array<int,n>
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,l;
	cin>>n>>l;
	ll a[n];
	for(int i =0; i<n; i++)
		cin>>a[i];
	
	ll x=-1;

	for(int i =0; i<n-1; i++)
		if((a[i]+a[i+1])>=l)
			x = i+1;
	
	if(x ==-1)
		cout<<"Impossible"<<endl;
	else
	{
		cout<<"Possible"<<endl;
		int i =0;
		for(i =1; i<n; i++)
			if(i==x)
				break;
			else
				cout<<i<<endl;
		for(int j =n-1; j>i;j--	)
			cout<<j<<endl;
		cout<<x<<endl;
	}
	return 0;
}

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

using namespace std;

bool nuri[101][101];

int main(){
        int W, H, N;
        cin>>W>>H>>N;
        int x1=0, x2=W, y3=0, y4=H;
        for(int i=0;i<N;i++){
                int x, y, a;
                cin>>x>>y>>a;
                if(a==1){
                        x1=max(x1, x);
                }
                else if(a==2){
                        x2=min(x2, x);
                }
                else if(a==3){
                        y3=max(y3, y);
                }
                else if(a==4){
                        y4=min(y4, y);
                }
        }
        if(x1>x2||y3>y4){
                cout<<0<<endl;
        }
        else{
                cout<<abs(x2-x1)*abs(y4-y3)<<endl;
        }
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
typedef long long ll;
const int INF = 1<<29;
const int N = 1e6 + 9;
ll a[N];
bool cmp(const pair<double, ll> &a, const pair<double, ll> &b)
{
    if(a.first == b.first){
        return a.second < b.second;
    }
    return a.second > b.second;
}
int main()
{
    fio;
    ll n, ans = 0, k = 1;
    cin >> n;
    for(int i = 0; i < n; i ++)
    {
        cin >> a[i];
    }
    for(int i = 0; i < n; i ++)
    {
        if(a[i] == k){
            k ++;
        }
        else{
            ans ++;
        }
    }
    if(ans == n){
        ans = -1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792