akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; 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,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 set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int h,w;
vector<string> a;

int main(){
    cin >> h >> w;
    a.resize(h);
    rep(i,h) cin >> a[i];

    vector<int> cnt(30,0);
    rep(i,h) rep(j,w){
        cnt[a[i][j]-'a']++;
    }

    if(h%2 and w%2){
        rep(i,26) if(cnt[i]%2){
            cnt[i]--;
            break;
        }
    }

    rep(i,26) if(cnt[i]%2){
        cerr << "E1" << endl;
        cout << "No" << endl;
        return 0;
    }

    int r2=0;   // 2つペア数
    if(h%2) r2 += w/2;
    if(w%2) r2 += h/2;

    rep(i,26){
        if(cnt[i]%4==2){
            cnt[i]-=2;
            r2--;
            if(r2 < 0){
                cerr << "E2" << endl;
                cout << "No" << endl;
                return 0;
            }
        }
    }

    if(r2%2){
        cerr << "E3" << endl;
        cout << "No" << endl;
        return 0;
    }

    cerr << cnt << endl;
    rep(i,26){
        if(cnt[i]%4){
            cerr << "E4" << endl;
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		String s = in.next();

		long red = s.chars().filter(c -> c == 'R').count();
		System.out.println(N < red * 2 ? "Yes" : "No");
	}
}


Measured memory_bytes: 28240
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, a;
  cin >> N;
  vector<int> card;
  vector<int> A;
  vector<int> B;
  for (int i = 0; i < N; i++){
    cin >> a;
    card.push_back(a);
  }
  sort(card.begin(), card.end());
  reverse(card.begin(), card.end());
  for (int j = 0; j < N; j++){
    if (j % 2 == 0){
      A.push_back(card.at(j));
    }
    else{
      B.push_back(card.at(j));
    }
  }
    int A_sum = accumulate(A.begin(), A.end(), 0);
    int B_sum = accumulate(B.begin(), B.end(), 0);
    cout << A_sum - B_sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
    ld A,B,C;
    cin>>A>>B>>C;
    ll D=A;
    ll E=B;
    ll F=C;
    ld G=2.0*sqrt(A);
  	ld H=sqrt(B);
    if(ld(D+E+G*H)<ld(F)){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 3796
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;


void solve(long long N, std::string s, std::string t){
    REP(i, N+1){
        string tmp = s.substr(0, i) + t;
        if(tmp.substr(0, N)==s){
            cout << tmp.length()<<endl;
            return;
        }
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string s;
    std::cin >> s;
    std::string t;
    std::cin >> t;
    solve(N, s, t);
    return 0;
}


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

l = [1]
for i in range(n):
    l.append(a[l[i] - 1])

p = l.index(l[n])

if k <= n:
    print(l[k])
else:
    x = (k - n + 1) % (n - p)
    if x == 0:
        print(l[n - 1])
    else:
        print(l[x + p - 1])

Measured memory_bytes: 99832
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main()
{
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    x -= z;
    int ans = 0;
    while (x >= z+y)
    {
        x -= z+y;
        ans ++;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
int main(){
       int A,B, C, D,E,F;
        long long int Aa[10000000] = {};
        string S,Sa,Sb,Sc;
        cin >> A;
        if(A % 2 == 0)cout << (A + 1) * (A / 2) << endl;
        else cout << A * (A / 2 + 1) << endl;
  
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long int k;
    cin >> k;
    map<long long int,int> mp;
    long long int tmp=7;
    int now=1; 
    while(1){
        if(tmp%k==0){
            cout << now;
            return 0;
        }
        else if(mp[tmp%k]>0){
            cout << -1;
            return 0;
        }
        else{
            mp[tmp%k]++;
            tmp = (tmp*10 +7)%k; 
        }
        now++;
    }
}

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

using namespace std;
typedef long long ll;
int main(){
	int n; cin >> n;
	ll a = 0,b;
	for(int i = 0; i < n; i++){
		ll ta,tb;
		cin >> ta >> tb;
		if(ta > a){
			a = ta;
			b = tb;
		}
	}
	ll ans = 0;
	ans += a + b;
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma warning(disable:4996)
using namespace std;
using ll = long long;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
//const int INF = numeric_limits<int>::max();
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
int main() {
	int n, x;
	cin >> n >> x;
	vector<ll>v(n);
	
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	v.push_back(x);
	sort(v.begin(), v.end());
	vector<int>nv(n, 0);
	for (int i = 0; i < n; i++) {
		nv[i] = abs(v[i] - v[i + 1]);
	}
	ll m = nv[0];
	for (int i = 0; i < nv.size()-1; i++) {
		 m = GCD(m, nv[i + 1]);
	}
	cout << m << endl;
}


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

int main() {
    long long A;
    string B;
    cin >> A >> B;
    long long B100 = (B[0]-'0')*100 + (B[2]-'0')*10 + (B[3]-'0');
    cout << A * B100 / 100 << endl;
}

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

#define rep(i,n) for(signed i=0;i<n;++i)
#define int long long
#define str string
#define debg(a) cout<<#a<<":"<<a<<endl;
#define vint vector<signed>
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define yn(a) cout<<((a)?"Yes":"No")<<endl;
#define YN(a) cout<<((a)?"YES":"NO")<<endl;
#define call(a) for(auto i:(a))cout<<i<<" ";cout<<endl;
#define ENDL printf("\n");

int partSum(int sum[],int s,int e){
  if(s>e)swap(s,e);
  if(s==0)return sum[e];
  return (sum[e]-sum[s-1]);
}

signed main(){
  int n;
  cin>>n;
  int a[n],b[n];
  rep(i,n)cin>>a[i];
  rep(i,n)cin>>b[i];
  int suma[n],sumb[n];
  suma[0]=a[0];
  sumb[0]=b[0];
  for(int i=1;i<n;++i){
    suma[i]=suma[i-1]+a[i];
    sumb[i]=sumb[i-1]+b[i];
  }
  vint ans;
  rep(i,n){
    int res;
    res=partSum(suma,0,i)+partSum(sumb,i,n-1);
    ans.pb(res);
  }
  sort(all(ans));
  cout<<ans[n-1]<<endl;

  return 0;
}


Measured memory_bytes: 256
/*input
5 7 5
*/

#include <bits/stdc++.h>
 
using namespace std;
const long long MOD = 1e9+7;
vector<int> prime;
const int MAX = 100;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vector<int> arr(3);
    cin >> arr[0] >> arr[1] >> arr[2];
    sort(arr.begin(), arr.end());
    if(((arr[0]==arr[1] && arr[1]!=arr[2]) || (arr[1]==arr[2] && arr[2]!=arr[0])))
        cout << "Yes\n";
    else
        cout << "No\n";

}



Measured memory_bytes: 256
#include <stdio.h>
#define swap(a,b) a^=b^=a^=b
int main(){
  int x,y,r;
  scanf("%d%d",&x,&y);
  if(x<y)
    swap(x,y);
  while(y>0){
    r=x%y;
    x=y;
    y=r;
      }
    printf("%d\n",x);
  return 0;
}



Measured memory_bytes: 2728
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Map.Entry;
 
public class Main{
	
	public static void main(String[] args) throws IOException{
		//File file = new File("input.txt");
		//Scanner in = new Scanner(file);
		Scanner in = new Scanner(System.in);
		
		int N = in.nextInt();
		long[] march = new long[5];
		String marchS = "MARCH";
		
		for(int i = 0; i < N; i++){
			String S = in.next().substring(0, 1);
			for(int j = 0; j < 5; j++){
				if(S.equals(String.valueOf(marchS.charAt(j)))){
					march[j]++;
					break;
				}
			}
		}
		
		long ans = 0;
		for(int i = 0; i < 5 - 2; i++){
			for(int j = i + 1; j < 5 - 1; j++){
				for(int k = j + 1; k < 5; k++){
					ans += march[i] * march[j] * march[k];
				}
			}
		}
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 44792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
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 H, W,K;

ll beki(ll a, ll b){
    a %= MOD;
    if(b == 0){
        return 1;
    }
    ll ans = beki(a, b / 2);
    ans = ans * ans % MOD;
    if(b % 2 == 1){
        ans = ans * a % MOD;
    }
    return ans;
}
int main(int argc, char const *argv[]) {
  cin >> H  >> W >> K;
  vector<string> s(H);
  rep(i,H) cin >> s[i];

  int ans = 0;
  int bekiH = beki(2, H);
  int bekiW = beki(2, W);
  for (int row = 0; row < bekiH; row++) {
    for (int col = 0; col < bekiW; col++) {
      int cnt = 0;
      
      rep(i,H){
        rep(j,W){
          if (!(row & (1 << i)) && !(col & (1 << j))){
          if (s[i][j] == '#'){
            cnt++;
            }
          }
        }
      }
      if (cnt == K){
        ans++;
        //printf("row:%d col:%d \n", row,col);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

int dp[2][10001][2];
int cost[10000];
int main() {
	int n; scanf("%d", &n);
	rep(i, n - 1)scanf("%d", &cost[i]);
	memset(dp, 0x3f, sizeof(dp));
	dp[0][0][0] = 0;
	for (int i = 1; i <= n; i++) {
		int t = i & 1;
		rep(j, i + 1)rep(k, 2)dp[t][j][k] = INF;
		rep(j, i + 1) {
			if (i >= 2) {
				if (j)dp[t][j][0] = dp[!t][j - 1][1] + cost[i - 2];
				dp[t][j][1] = dp[!t][j][0] + cost[i - 2];
			}
			if (j)dp[t][j][0] = min(dp[t][j][0], dp[!t][j - 1][0]);
			dp[t][j][1] = min(dp[t][j][1], dp[!t][j][1]);
		}
	}
	printf("%d\n", min(dp[n&1][n / 2][0], dp[n&1][n / 2][1]));
}

Measured memory_bytes: 3408
// アンバランス
#include <iostream>
#include <string>
using namespace std;

string s;

int main(){
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(i+1<s.size()&&s[i]==s[i+1]){
            cout<<i+1<<" "<<i+2<<endl;
            return 0;
        }if(i+2<s.size()&&s[i]==s[i+2]){
            cout<<i+1<<" "<<i+3<<endl;
            return 0;
        }
    }
    cout<<"-1 -1\n";
    return 0;
}

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

const int MAX_N = 100001;
bool flags[MAX_N];
int list[MAX_N+1];

void erastothenes() {
  for (int i = 2; i < MAX_N; i++) {
    if (flags[i] == false) {
      for (int j = i+i; j < MAX_N; j += i) {
	flags[j] = true;
      }
    }
  }
}

void make_list() {
  fill(list, list+MAX_N+1, 0);
  for (int i = 3; i < MAX_N; i++) {
    if (!flags[i] && !flags[(i+1)/2]) {
      list[i]++;
    }
  }
  for (int i = 3; i <= MAX_N; i++) {
    list[i] += list[i-1];
  }
}

int main() {
  erastothenes();
  make_list();

  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    cout << (list[r] - list[l-1]) << endl;
  }
}

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

int main()
{
  int64_t N, ans = 0;
  cin >> N;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A.at(i);
    if (i && A.at(i - 1) == A.at(i))
    {
      A.at(i) = -1;
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
x=[]
y=[]
ans='POSSIBLE'
for i in range(m):
    a,b=map(int,input().split())
    if a==1:
        x.append(b)
    elif b==n:
        y.append(a)
if len(set(x)&set(y))==0:
    ans='IMPOSSIBLE'
print(ans)

Measured memory_bytes: 21824
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define dmp(x) cerr<<#x<<":"<<x<<endl
typedef pair<int,int> P;
typedef pair<int,P> PP; 
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;}
const int MOD = 1e9+7;

signed main(){
  int n;
  cin>>n;
  vector<P> ba;
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    ba.pb(P(b,a));
  }
  sort(all(ba));
  int sum=0;
  for(int i=0;i<n;i++){
    sum+=ba[i].se;
    if(sum>ba[i].fi){
	 cout<<"No"<<endl;
	 return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 6512
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, n) for (ll i = n; i >= 0; i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cerr << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cerr << e << " "; } cerr << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

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




// ***************************************

int main() {

    int N;
    cin >> N;
    vector<ll> A(N), S(N + 1);
    REP(i, N) {
        cin >> A[i];
        S[i + 1] = A[i] + S[i];
    }

    vector<vector<ll>> dp(N, vector<ll>(N, 1e15));

    REP(i, N) {
        dp[i][i] = 0;
    }

    FOR(w, 1, N) {
        REP(i, N - w) {
            ll j = i + w;
            FOR(k, i, j) {
                chmin<ll>(dp[i][j], dp[i][k] + dp[k + 1][j] + S.at(j + 1) - S.at(i));
            }
        }
    }

    cout << dp[0][N - 1] << endl;


#ifdef _MSC_VER
    system("PAUSE");
#endif
    return 0;
}



Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	vector<ll> sum(n + 1);
	rep(i, n) sum[i + 1] = sum[i] + a[i];
	map<ll, ll> mp;
	rep(i, n + 1) mp[sum[i]]++;
	ll ans = 0;
	for (auto& c : mp) {
		ans += c.second * (c.second - 1) / 2;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 15104
#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 rep(i,n) for(int i=0;i<n;i++)

int main() {
	int a,b,c;
  	cin>>a>>b>>c;
  	if(a+b==c || a+c==b || b+c==a ) cout<<"Yes"<<endl;
  	else cout<<"No"<<endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  int s;
  int tsum,hsum,dif;
  bool a;
  int t[100];
  int h[100];
  while(1){
    cin>>n>>m;
    if(n==0 && m==0) break;
    for(int i=0;i<100;i++){
      t[i]=0;
    }
    for(int i=0;i<100;i++){
      h[i]=0;
    }
    tsum=hsum=0;
    a=true;
    for(int i=0;i<n;i++){
      cin>>s;
      t[i]=s;
      tsum+=s;
    }
    for(int i=0;i<m;i++){
      cin>>s;
      h[i]=s;
      hsum+=s;
    }
    dif=max(tsum-hsum,hsum-tsum);
    sort(t,t+n);
    sort(h,h+m);
    /* for(int i=0;i<n;i++){
      cout<<t[i]<<" ";
    }
    cout<<endl;
    for(int i=0;i<m;i++){
      cout<<h[i]<<" ";
    }
    cout<<endl;
    cout<<tsum<<" "<<hsum<<" "<<dif<<endl;*/
    for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
	if(dif==(t[i]-h[j])*2 && tsum>=hsum){
	  cout<<t[i]<<" "<<h[j]<<endl;
	  /*cout<<i<<" "<<j<<endl;*/
	  a=false;
	}
	else if(dif==(h[j]-t[i])*2 && tsum<=hsum){
	  cout<<t[i]<<" "<<h[j]<<endl;
	  /*cout<<i<<" "<<j<<endl;*/
	  a=false;
	}
	if(!a) break;
      }
	if(!a) break;
    }
     if(a) cout<<-1<<endl;
  }
  return 0;
}



Measured memory_bytes: 3068
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	int ans=(a+b)/2;
	if((a+b)%2>=1)ans++;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main()
{
    int R[MAX], n;

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

    int maxv = -2000000000;
    int minv = R[0];

    for (int i = 1; i < n; i++)
    {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;

    return 0;
}


Measured memory_bytes: 3896
n = int(input())
abc = [list(map(int,input().split())) for _ in range(n)]

dp = [[0 for i in range(3)] for j in range(n+1)]
for i in range(1,n+1):
  a,b,c,=abc[i-1]
  dp[i][0]=max(dp[i-1][1]+a,dp[i-1][2]+a)
  dp[i][1]=max(dp[i-1][0]+b,dp[i-1][2]+b)
  dp[i][2]=max(dp[i-1][0]+c,dp[i-1][1]+c)
a,b,c = dp[-1]
print(max(a,b,c))

Measured memory_bytes: 76376
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int num =(int) (Math.log(N) / Math.log(K));
        System.out.println(num + 1);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

// 1-indexedのBIT
template <typename T>
struct BIT {
    vector<T> array;
    const int N;

    // 0として初期化
    BIT(int _N) : array(_N + 1, 0), N(_N) {}

    // 左からi番目にxを加える
    void add(int i, T x){
        int lsb;
        while(i <= N){
            array[i] += x;
            lsb = i & (-i);
            i += lsb;
        }
    }

    //左からi番目までのSUMを得る
    T getSUM1(int i){
        T ret = 0;
        int lsb;
        while(i >= 1){
            ret += array[i];
            lsb = i & (-i);
            i -= lsb;
        }
        return ret;
    }

    //左からi番目からj番目のSUMを得る
    T getSUM(int i, int j){
        return getSUM1(j) - getSUM1(i-1);
    }
};


int main(){
    int N, Q;
    cin >> N >> Q;
    BIT<ll> bit(N);
    ll a;
    for (int i = 0; i < N; i++) {
        cin >> a;
        bit.add(i+1, a);   
    }
    ll q, l, r;    
    for (int i = 0; i < Q; i++) {
        cin >> q >> l >> r;
        if(q == 0){
            bit.add(l+1, r);
        }
        else{
            printf("%lld\n", bit.getSUM(l+1, r));
        }
    }

}

Measured memory_bytes: 8212
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<long long,int> P;

ll dp[55][55][2550];

int main(){
    int n, a;
    cin >> n >> a;
    vector<int> x(n + 1);
    rep(i, n) cin >> x[i + 1];

    dp[0][0][0] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= n; j++){
            for(int k = 0; k <= 2510; k++){
                if (k < x[i]) dp[i][j][k] = dp[i-1][j][k];
                else if (j > 0 && k >= x[i]) dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i]];
                else dp[i][j][k] = 0;
            }
        }
    }
    
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        ans += dp[n][i][a*i];
    }

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

Measured memory_bytes: 56448
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <set>

using namespace std ; 

typedef long long ll ; 


char map[11][11] ; 

int main()
{
    int H, W ; 
    scanf("%d%d", &H, &W) ; 
    for(int i = 0 ; i != H ; i++)
        scanf("%s", map[i]) ; 
    bool ans = true ; 
    int x = 0, y = 0 ; 
    while(ans && (x != H-1 || y != W-1)) {
        map[x][y] = '.';
        if(x == H-1) {
            y++ ;
            if(map[x][y] != '#')
                ans = false ; 
        }
        else if(y == W-1) {
            x++ ; 
            if(map[x][y] != '#')
                ans = false ; 
        }
        else {
            if(map[x+1][y] == '#' && map[x][y+1] == '#')
                ans = false ;
            if(map[x+1][y] == '.' && map[x][y+1] == '.')
                ans = false ; 
            if(map[x+1][y] == '#')
                x++ ; 
            else
                y++ ; 
        }
        map[x][y] = '.';
    }
    for(int i = 0 ; i != H ; i++)
        for(int j = 0 ; j != W ; j++) {
            if(map[i][j] == '#')
                ans = false ; 
        }
    puts(ans ? "Possible" : "Impossible");
    return 0 ; 
}



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

int main() {
    int n, h;
    cin >> n >> h;
    vector <int> a(n), b(n);
    rep (i, n) cin >> a[i] >> b[i];

    sort(a.rbegin(), a.rend());
    sort(b.rbegin(), b.rend());

    int ans = 0;
    for (int i = 0; b[i] > a[0] && h > 0; i++) h -= b[i], ans++;

    if (h <= 0) cout << ans << endl;
    else        cout << ans + h / a[0] + (h % a[0] != 0) << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  vl abc(3);
  rep(i, 3) cin >> abc[i];
  ll K;
  cin >> K;

  stable_sort(abc.begin(), abc.end());

  rep(i, K) abc[2] *= 2;

  cout << abc[0] + abc[1] + abc[2] << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>                                                 
                                                                  
int main(void){                                                   
                                                                  
   int K,A,B,i;                                                   
   scanf("%d",&K);                                                
                                                                  
   scanf("%d %d",&A,&B);                                          
   i = B;                                                         
                                                                  
   while(i >= A ){                                                
      if(i % K == 0){                                             
         printf("OK");                                            
         break;                                                   
      }                                                           
   if(i == A){                                                    
      printf("NG");                                               
   }i--;                                                          
   }                                                              
   return 0;                                                      
}    

Measured memory_bytes: 1728
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main(void){
    char string[1001];
    int separate;
    int i=0;
    scanf("%s",string);
    scanf("%d",&separate);
    while(string[i]!='\0'){
        if(i%separate==0){
            printf("%c",string[i]);
        }
        i++;
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;
long long n,k,ans;
int main(){
	cin>>n>>k;
	ans=(n/k)*(n/k)*(n/k);
	if(k%2==0){
		ans+=(n/k+(n%k>=k/2))*(n/k+(n%k>=k/2))*(n/k+(n%k>=k/2));
		cout<<ans<<endl;return 0;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma region

#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  init();

  int H, N;
  cin >> H >> N;
  vector<int> A(N);
  cin >> A;

  ll sum = 0;
  rep(i, N) sum += A[i];

  out(sum >= H ? "Yes" : "No");
}


Measured memory_bytes: 640
#include <iostream>
#include <array>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
using namespace std;

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

    int N;
    cin >> N;

    if(N == 1){
        cout << 1 << endl;
        return 0;
    }
    if(N == 2){
        cout << 3 << endl;
        return 0;
    }

    int64_t l0 = 2;
    int64_t l1 = 1;
    int64_t ans = l0 + l1;
    for(int i = 3; i <= N; ++i){
        l0 = l1;
        l1 = ans;
        ans = l0 + l1;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p
n,k=map(int, input().split())
for i in range(1,k+1):
  print(comb(n-k+1,i,10**9+7)*comb(k-1,i-1,10**9+7)%(10**9+7))

Measured memory_bytes: 9232
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<queue>
#include<set>

#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 llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
typedef pair<ll,ll> LLP;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define INF 1000000007
#define MOD 1000000007
#define ARRAY_MAX 100005



typedef struct edge{
    pair<int,int> to;//今いる位置、会社
    int cost;//移動にかかるコスト
}EDGE;

int n,m;
map<P,vector<EDGE> > G;
set<P> used;

int bfs(){

    deque<EDGE> deq;
    deq.push_back(EDGE{P(0,-1),0});
    int ans = -1;

    while(!deq.empty()){
        EDGE es = deq.front();
        deq.pop_front();
        if(used.find(es.to) != used.end()){
            //もう使ったので調べない
            continue;
        }
        used.insert(es.to);
        if(es.to == P(n-1,-1)){
            //目的地に着いた
            //つまり、駅nの改札を出たところなら
            ans = es.cost;
            break;
        }
        for(auto itr:G[es.to]){
            //次の駅の候補を調べる
            if(used.find(itr.to) != used.end()){
                //次の駅がすでに調べられているなら調べない
                continue;
            }
            if(itr.cost == 0){
                deq.push_front({itr.to,es.cost});
            }else{
                deq.push_back({itr.to,es.cost+1});
            }
        }       
    }
    return ans;
}



int main(){

    cin >> n >> m;
    REP(i,m){
        int p,q,c;
        cin >> p >> q >> c;
        p--;
        q--;
        //同じ会社の間にコスト0の辺を張る
        G[P(p,c)].push_back((EDGE){P(q,c),0});
        G[P(q,c)].push_back((EDGE){P(p,c),0});


        //駅番号-1は駅から改札を出ることを表す,コスト0の辺を張る
        G[P(p,c)].push_back((EDGE){P(p,-1),0});
        G[P(q,c)].push_back((EDGE){P(q,-1),0});

        
        //改札を出て別の会社の駅に入る時にコスト1かかるとする,コスト1の辺を張る
        //途中で別の会社を使って再びもとの会社を使う時にもコストはかかる
        G[P(p,-1)].push_back((EDGE){P(q,c),1});
        G[P(q,-1)].push_back((EDGE){P(p,c),1});
    }

    int ans = bfs();
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 71552
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << 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...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int n;
  scanf("%d", &n);
  vector<int64> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    scanf("%lld%lld", &a[i], &b[i]);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  int64 ret;
  if (n % 2 == 1) {
    ret = b[n / 2] - a[n / 2] + 1;
  } else {
    ret = b[n / 2 - 1] + b[n / 2] - (a[n / 2 - 1] + a[n / 2]) + 1;
  }
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 6052
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>

#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()
bool comparator(P a, P b) {
	return a.first / a.second < b.first / b.second;
}

int main() {
	double n;
	cin >> n;
	cout << 2 * M_PI * n << endl;
}


Measured memory_bytes: 3264
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())-1])

Measured memory_bytes: 3316
n,k = map(int,input().split())
g = [list(map(int,input().split())) for i in range(n)]
mod = 10**9+7
ans = 0
def mul(x,y):
  res = []
  for i in range(n):
    tmp = []
    for j in range(n):
      ko = 0
      for k in range(n):
        ko += x[i][k] * y[k][j]
        ko %=mod
      tmp.append(ko)
    res.append(tmp)
  return res
while k>0:
  if k &1 ==1:
    if type(ans) is int:
      ans = g
    else:
      ans = mul(g,ans)
  g = mul(g,g)
  k >>= 1
res = 0
for i in range(n):
  for j in range(n):
    res += ans[i][j]
    res %= mod
print(res)

Measured memory_bytes: 43372
import sys
sys.setrecursionlimit(10 ** 8)

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    n = Z()
    for _ in range(n):
        A = ZZ()
        done = [False] * 10

        def dfs(i, a):
            if done[i]:
                if i+1 < 10: dfs(i+1, a)
                else: return
            else:
                if a < A[i]:
                    done[i] = True
                    if i+1 < 10: dfs(i+1, A[i])
                else:
                    if i+1 < 10: dfs(i+1, a)

        cc = 0
        for i in range(10):
            if done[i]: continue
            cc += 1
            done[i] = True
            dfs(i, A[i])

        print('YES' if cc <= 2 else 'NO')


    return

if __name__ == '__main__':
    main()



Measured memory_bytes: 5608
#include <cstdio>
#include <cctype>
#include <queue>
using namespace std;

int W, H;
char board[100][100];
int dist[100][100][2];
const int INF = 1 << 28;

const int LEFT  = 0;
const int RIGHT = 1;
const int dx[][9] = {{0, 0, 0, 1, 1, 2, -1, -1, -2}, {0, 0, 0, 1, 1, 2, -1, -1, -2}};
const int dy[][9] = {{1, 2, 3, 1, 2, 1, 1, 2, 1}, {-1, -2, -3, -1, -2, -1, -1, -2, -1}};

struct Elem {
    int x, y, foot, dist;
    bool operator<(const Elem &e) const {
        return dist > e.dist;
    }
};

void solve() {
    priority_queue<Elem> que;
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            if(board[i][j] == 'S') {
                que.push(Elem{i, j, 0, 0});
                que.push(Elem{i, j, 1, 0});
                dist[i][j][0] = dist[i][j][1] = 0;
            }
            else {
                dist[i][j][0] = dist[i][j][1] = INF;
            }
        }
    }

    int ans = INF;
    while(que.size()) {
        Elem cur = que.top(); que.pop();
        int f = cur.foot;
        for(int k=0; k<9; k++) {
            int nx = cur.x + dx[f][k];
            int ny = cur.y + dy[f][k];
            if(nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
            if(board[nx][ny] == 'X') continue;

            bool t_or_s = !isdigit(board[nx][ny]);
            int cost = (t_or_s ? 0 : board[nx][ny] - '0');
            if(dist[nx][ny][f^1] > dist[cur.x][cur.y][f] + cost) {
                dist[nx][ny][f^1] = dist[cur.x][cur.y][f] + cost;
                que.push(Elem{nx, ny, f^1, dist[nx][ny][f^1]});
                if(board[nx][ny] == 'T') {
                    if(ans > dist[nx][ny][f^1]) {
                        ans = dist[nx][ny][f^1];
                    }
                }
            }
        }
    }

    printf("%d\n", (ans == INF ? -1 : ans));
}

int main() {
    while(1) {
        scanf("%d%d", &W, &H);
        if(W == 0 && H == 0) break;

        for(int i=0; i<H; i++) {
            for(int j=0; j<W; j++) {
                scanf(" %c", &board[i][j]);
            }
        }

        solve();
    }
    return 0;
}


Measured memory_bytes: 2864
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

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

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}

ll lcm(ll a, ll b)
{
   return a / gcd(a, b) * b;
}

int main()
{
  ll x;
  cin >> x;
  ll y = 100;
  ll ans;

  reps(i,1000000){
      y*=1.01;
      if(y >= x){
          ans = i;
          break;
      }
  }

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

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define pb          push_back
#define endl        '\n'
#define pll         pair<int,int>
#define vll          vector<int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define int	    int64_t
#define ios     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
int n,i,j,k,l,sum=0,flag=0,t,dp[200005][3],ans=0,a[200005][3];
void solve(){
    cin>>n;
    for(int i=0;i<n;i++){
    	for(int j=0;j<3;j++){
    		cin>>a[i][j];
    	}
    }
    for(int i=0;i<n;i++){
    	for(int j=0;j<3;j++){
    		if(i==0){
    			dp[i][j] =a[i][j];
    		}else{
    			dp[i][j] = max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+a[i][j];
    		}
    	}
    }
    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<endl;
}
signed main()
{
    ios
    int test = 1;
    //cin>>test;
    while(test--){
    	solve();
    }
    return 0;
}

Measured memory_bytes: 8448
#include <iostream>

int main() {
  int n; std::cin >> n;
  char s[n]; std::cin >> s;
  char tmp = ' '; int c = 0;
  for(size_t i = 0; i < n; ++i)
    if(tmp != s[i]) {
      tmp = s[i];
      c++;
    }
  std::cout << c;
  return 0;
}

Measured memory_bytes: 384
N,M,Q = list(map(int,input().split()))

A=[]
for q in range(Q):
    A.append(list(map(int,input().split())))

def check_point(A,l):
    point=0
    for a in A:
        if l[a[1]-1]-l[a[0]-1] == a[2]:
            point+=a[3]

    return point

#全探索
L=[]
l=[-1]*N
d=[]
# d=0
def dfs(i,r,l):
    if r == N-1:
        for m in range(i,M):
            l[r] = m
            #処理を記述
#             print(l,check_point(A,l))
#             if d < check_point(A,l):
#                 d = check_point(A,l)
            d.append(check_point(A,l))
            L.append(l.copy())
        return 
    
    r+=1
    for m in range(i,M): 
        l[r-1] = m
        dfs(m,r,l)
        
dfs(0,0,[-1]*N)
print(max(d))

Measured memory_bytes: 95100
N = int(input())
 
alp = "abcdefghijklmnopqrstuvwxyz"
 
def dfs(s):
    i = len(s)
    if i == N:
        print(s)
    else:
        index = 0
        for k in range(len(s)):
            index = max(index, alp.index(s[k]))
        for j in range(index+2):
            dfs(s+alp[j])
 
dfs("a")


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

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).ok();
    let mut it = buf.split_whitespace();
    let n = it.next().unwrap().parse::<usize>().unwrap();
    let m = it.next().unwrap().parse::<usize>().unwrap();
    let mut c = vec![Vec::new(); n];
    for i in 0..m {
        let p = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let y = it.next().unwrap().parse::<i32>().unwrap();
        c[p].push((y, i));
    }
    let mut id = vec![(0, 0); m];
    for i in 0..n {
        c[i].sort();
        for j in 0..c[i].len() {
            id[c[i][j].1] = (i+1, j+1);
        }
    }
    for &p in &id {
        println!("{:06}{:06}", p.0, p.1);
    }
}


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

using namespace std;

#ifdef Lin1043
    #define DEBUG(msg, ...) printf("(%s #%d) " msg, __FUNCTION__, __LINE__, __VA_ARGS__)
    #define massert(...) assert(...)
#else
    #define DEBUG(...)
    #define massert(...)
#endif

#define rep(i , l , r) for(int i = (l) , ___ = (r) ; i <= ___ ; ++i )
#define per(i , r , l) for(int i = (r) , ___ = (l) ; i >= ___ ; --i )

struct iopener
{
    iopener()
    {
#ifdef Lin1043
        freopen("./in" , "r" , stdin);
#endif
    }
} iop;

typedef long long LL;

template<typename T>inline bool chkmin(T &x , const T &y) { return x > y ? (x = y , 1) : 0; }
template<typename T>inline bool chkmax(T &x , const T &y) { return x < y ? (x = y , 1) : 0; }

template<typename T>inline T read(T &f)
{
    f = 0; int x = 1 ; char c = getchar();
    while(!isdigit(c)) x = (c == '-' ? -1 : 1) , c = getchar();
    while(isdigit(c)) (f *= 10) += c & 15 , c = getchar();
    return f = x * f;
}

const int N = 100000 + 5;

int n , A[N]; LL Ans;

int main()
{
    read(n);
    rep(i , 1 , n)
        read(A[i]);
    rep(i , 1 , n)
    {
        if(i > 1 && A[i] && A[i - 1])
        {
            A[i]-- , Ans++;
        }
        Ans += A[i] / 2 , A[i] %= 2;
    }
    cout << Ans << endl;
    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
#ABC120 D

N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(M)]

#再帰的に木の根を求めることで、ある要素が属するグループを探索する
def find(x):
    if par[x] == x:#引数が根(根はグループの番号)なら根の値を返す
        return x
    else:#違うなら
        par[x] = find(par[x])#xの親を引数として見る
        return par[x]

#2つの要素が属するグループを結合する
#xの子ノードとしてyを連結する
def union(x,y):
    x = find(x)#xのグループ番号
    y = find(y)#ｙのグループ番号
    if x == y:#もし同じグループなら
        ans.append(ans[-1])#ans(i) = ans(i+1)(不便さに変化がないため)
        return
    sx = s[x]#xのグループのサイズ
    sy = s[y]#yのグループのサイズ
    if rank[x] < rank[y]:#yの木の方が高いなら
        par[x] = y#xの親をyにする
        s[y] += s[x]#yのサイズにxのサイズを足す
    else:#xの木の高さがy以上なら
        par[y] = x#yの親をxにする
        if rank[x] == rank[y]:#高さが同じなら
            rank[x] += 1#高さは+1
        s[x] += s[y]#xのサイズにyのサイズを足す
    ans.append(ans[-1] + sx*sy)#ans(i)=ans(i+1)-sx*sy(ans(i)+sx*sy=ans(i+1))

AB = AB[::-1]#逆から見る
par = [i for i in range(N)]#最初は1つずつのグループ
rank = [0 for _ in range(N)]#最初は高さ0
ans = [0]
k = N*(N-1)//2#辺の最大数
AB.pop(-1)
s = [1 for _ in range(N)]#最初はサイズ1
for a,b in AB:
    if ans[0] == k:
        ans.append(k)
        continue
    union(a-1,b-1)
for i in ans[::-1]:
    print(k-i)


Measured memory_bytes: 38364
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstdio>
#include <climits>
#include <set>
using namespace std;



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

    int cnt_l = 0;
    int cnt_r = 0;

    for(int i = 1; i < n; i++)
    {
        if(str.at(i) == 'E')
        {
            cnt_r++;
        }
    }

    int ans = cnt_r;

    for(int i = 1; i < n; i++)
    {
        if(str.at(i - 1) == 'W') cnt_l++;
        if(str.at(i) == 'E') cnt_r--;
        ans = min(ans, cnt_l + cnt_r);
    }

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

Measured memory_bytes: 900
#include <iostream>
using namespace std;
int main()
{
    string s;
    cin >> s;
    int tsize = s.size();
    int snum = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'S') {
                snum++;
        }
        if (s[i] == 'T') {
            if (snum > 0) {
                snum--;
                tsize -= 2;
            }
        }
    }
    cout << tsize << endl;
}

Measured memory_bytes: 640
x,y = map(int,input().split())

ans = 0
for i in (x,y):
    if i == 1:
        ans += 300000
    elif i == 2:
        ans += 200000
    elif i == 3:
        ans += 100000
if x == 1 and y == 1:
    ans += 400000

print(ans)

Measured memory_bytes: 38384