akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int a, int b)
{
	return a == 0 ? b : gcd(b % a, a);
}
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}

long long kaijo(long long x){
  long long l=10*10*10*10*10*10*10*10*10+7;
  long long sum=1;
  for(int i=x;i>0;i--){
    sum*=i;
    if(sum>l){
      sum%=l;
    }
  }
  return sum;
}






int main(){
  string S;
  cin>>S;
  long long N=S.size();
  long long sum=0;
  for(int i=0;i<1<<N;i++){
    long long tmp=0;
    for(int j=0;j<N;j++){
      if(i&1<<j){
        sum+=tmp;
        tmp=0;

      }else{
        tmp=tmp*10+S[j]-'0';
      }
    }
    sum+=tmp;
  }
  cout<<sum<<endl;

}


Measured memory_bytes: 256
#include <iostream>

int main()
{
    int density[10][10] = {};
    int x, y, size;
    char comma;
    while (std::cin >> x >> comma >> y >> comma >> size) {
        switch (size) {
        case 3:
            if (x - 2 >= 0) ++density[x - 2][y];
            if (y - 2 >= 0) ++density[x][y - 2];
            if (x + 2 < 10) ++density[x + 2][y];
            if (y + 2 < 10) ++density[x][y + 2];
            // fall through
        case 2:
            if (x - 1 >= 0 && y - 1 >= 0) ++density[x - 1][y - 1];
            if (x - 1 >= 0 && y + 1 < 10) ++density[x - 1][y + 1];
            if (x + 1 < 10 && y - 1 >= 0) ++density[x + 1][y - 1];
            if (x + 1 < 10 && y + 1 < 10) ++density[x + 1][y + 1];
            // fall through
        case 1:
            if (x - 1 >= 0) ++density[x - 1][y];
            if (y - 1 >= 0) ++density[x][y - 1];
            if (x + 1 < 10) ++density[x + 1][y];
            if (y + 1 < 10) ++density[x][y + 1];
        }
        ++density[x][y];
    }

    int cnt = 0, max = 0;
    for (int i = 0; i < 10; ++i) {
        for (int j = 0; j < 10; ++j) {
            if (density[i][j] == 0) ++cnt;
            if (max < density[i][j]) max = density[i][j];
        }
    }
    std::cout << cnt << std::endl << max << std::endl;
}

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

namespace code_festival_2017_quala_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] count = new int[26];
            for (int i = 0; i < x[0]; i++)
            {
                string s = Console.ReadLine();
                for (int j = 0; j < x[1]; j++) count[s[j] - 'a']++;
            }
            int oddcount = 0;
            for (int i = 0; i < 26; i++) oddcount += count[i] % 2;
            if (x.Min() == 1)
            {
                Console.WriteLine(oddcount < 2 ? "Yes" : "No");
            }
            else
            {
                int notfour = 0;
                if (x[0] % 2 == 1) notfour -= x[1] / 2;
                if (x[1] % 2 == 1) notfour -= x[0] / 2;
                if (x[0] % 2 == 1 && x[1] % 2 == 1) oddcount--;
                for (int i = 0; i < 26; i++)
                {
                    if (count[i] % 2 == 0 && count[i] % 4 != 0) notfour++;
                }
                Console.WriteLine(oddcount < 1 && notfour < 1 ? "Yes" : "No");
            }
        }
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P; typedef unsigned long long int ull;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define sz size()
#define vec vector<int>
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr) {
	if (firstItr < 0 || secondItr>int(str.size() - 1))return str;
	while (firstItr < secondItr) {
		swap(str[firstItr], str[secondItr]);
		firstItr++; secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str) {
	int itr = 0; std::string res;
	while (itr < int(str.size())) {
		char tmp = str[itr++];
		int length = 1;
		while (itr <int(str.size()) && str[itr] == tmp) { ++itr; ++length; }
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
std::string split(std::string str, size_t first_itr, bool isFront) {
	if (first_itr < 0 || first_itr > str.size()) {
		return str;
	}
	else {
		if (isFront) {
			std::string tmp;
			for (size_t i = 0; i < first_itr; i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
		else {
			std::string tmp;
			for (size_t i = first_itr; i < str.size(); i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
	}
}


bool dfs(int depth, int now) {
	/*if (depth == n)return !now;
	for (int i = 0; i < k; i++) {
		if (dfs(depth + 1, now ^ t[depth][i]))return true;
	}
	/**/
	return false;
}



int main() {
	int n; cin >> n;
	str s; cin >> s;
	int ans = 0;
	rep(i, n) {
		if (s.at(i) == 'A') {
			if (i > n - 3) {
				break;
			}
			else {
				if (s.at(i + 1) == 'B') {
					if (s.at(i + 2) == 'C') {
						ans++;
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

bool binarySearch(vector<int> vec,int num){
    int l = 0,r = vec.size();
    while(r-l>0){
        int mid = (l+r)/2;
        if(vec.at(mid) == num){
            return true;
        }else if(vec.at(mid) > num){
            r = mid;
        }else{
            l = mid + 1;
        }
    }
    return false;
}

int main(){
    int n,q;
    cin >> n;
    vector<int> S(n);
    for(int i=0;i < n;i++) cin >> S.at(i);
    cin >> q;
    vector<int> T(q);
    for(int i=0;i < q;i++) cin >> T.at(i);
    
    int ans = 0;
    
    for(int i=0;i < q;i++){
        if(binarySearch(S,T.at(i))) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3952
N = int(input())
nums = list(map(int, input().split()))
sums = 0

for i in range(len(nums)):
  sums ^= nums[i]

ans = True
for i in range(len(nums)):
  if nums[i] == sums ^ nums[i]:
    pass
  else:
    ans = False
    
if ans:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 14212
#include <iostream>
#include <cmath>
#include <queue>
#include <algorithm>
#include <memory.h>
#include <vector>
#include <map>
#include <cstdlib>
#include <ctime>
using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
typedef pair<double, int> state;

double memo[100];
int pre[100];
int name[100];
double x[100];
double y[100];

map<int, int> nums;

double dis(int i, int j){
  return sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]));
}

int main(){
  int n, m;
  int b;
  int s, g;
  while(cin >> n &&n){
    nums.clear();
    rep(i, n){
      cin >> b >> x[i] >> y[i];
      name[i] = b;
      nums[b] = i;
    }
    cin >> m;
    rep(i, m){
      memset(pre, -1, sizeof(pre));
      fill(memo, memo + 100, 1e10);
      cin >> s >> g;
      memo[nums[s]] = 0;
      priority_queue<state, vector<state>, greater<state> > que;
      que.push(state(0, nums[s]));
      while(!que.empty()){
	state st = que.top();
	que.pop();
	int v = st.second;
	double cost = st.first;
	if(name[v] == g){
	  break;
	}
	if(cost > memo[v]) continue;
	rep(i, n){
	  double d = dis(v, i);
	  if(d > 50.0) continue;
	  if(memo[i] > memo[v] + d){
	    memo[i] = memo[v] + d;
	    pre[i] = v;
	    que.push(state(memo[i], i));
	  }
	}
      }
      if(pre[nums[g]] == -1 && s != g){
	cout << "NA" << endl;
      }else{
	vector<int> res;
	int v = nums[g];
	res.push_back(v);
	while(pre[v] >= 0){
	  v = pre[v];
	  res.push_back(v);
	}
	rep(i, (int)res.size()){
	  if(i != 0) cout << " " ;
	  cout << name[res[res.size() - 1 - i]];
	}
	cout << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,x,y) for(int (i)=(x);i<(y);i++)

int main()
{
  while(true){
    int n;
    cin>>n;
    if(n==0){
      break;
    }

    string str1;
    string str2;
    vector<int> start,end;
    int sh,sm,ss,eh,em,es;
    rep(i,0,n){
      cin>>str1>>str2;
      sh=stoi(str1.substr(0,2));
      sm=stoi(str1.substr(3,2));
      ss=stoi(str1.substr(6,2));
      eh=stoi(str2.substr(0,2));
      em=stoi(str2.substr(3,2));
      es=stoi(str2.substr(6,2));
      start.emplace_back(sh*3600+sm*60+ss);
      end.emplace_back(eh*3600+em*60+es);
    }

    for(int i=n-1;i>=0;i--){
      for(int j=0;j<i;j++){
        if(start[j]>start[j+1]){
          swap(start[j],start[j+1]);
          swap(end[j],end[j+1]);
        }
      }
    }

    vector<int> trains;
    int t=0;
    trains.push_back(t);

    rep(i,0,n){
      bool flag=false;
      int size=trains.size();
      rep(j,0,size){
        if(trains[j]<=start[i]){
          trains[j]=end[i];
          flag=true;
          break;
        }
      }
      if(flag==false){
        t=end[i];
        trains.push_back(t);
      }
    }

    cout<<trains.size()<<endl;
  }

  return 0;
}

Measured memory_bytes: 3276
/***************************************************************
Esse é um problema parecido com o problema da mochila.
Usando o código do exercício anterior
Taro realmente precisa procurar o que fazer
n = qtd de itens
w = limite da mochila
mochila[peso][valor] de cada item
***************************************************************/
#include <bits/stdc++.h>

using namespace std;

int main(){
    int n=0, w=0;

    cin >> n >> w;
    
    int peso[n+1], valor[n+1];
    //Sem ser ull res = 705032704, valor nada a ver
    //ATENÇÃO: The answer may not fit into a 32-bit integer type.
    unsigned long long resp[n+1][w+1], q=0;
    
    for (int i = 0; i < n; i++){
        cin >> peso[i] >> valor[i];
    }

    for (int i = 0; i <= n; i++){
        for (int j = 0; j <= w; j++){
            if(i==0 || j==0){
                q = 0;
            } else if (peso[i-1] <= j) {
                q = max(resp[i-1][j], valor[i-1]+resp[i-1][j- peso[i-1] ]);
            } else{
                 q = resp[i-1][j]; 
            }
            // cout << "j: " << j << " j: " << j << endl;
            resp[i][j]=q;
            // cout << "To no j" << endl;
        }
        // cout << "To no i" << endl;
    }
    
    
    // for (int i = 0; i < n; i++){
    //     for (int j = 0; j < w; j++){
    //         cout << resp[i][j] << " ";  
    //     }
    //     cout << endl;
    // }
    
    cout << resp[n][w] << endl;
}

Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[101][100001];
ll n,capacity;
ll *weight,*price;

ll knapsack(ll maxprofit)
{
	ll inf=1e11;
	for(ll N=0;N<=n;N++)
	{
		for(ll profit=0;profit<=maxprofit;profit++)
		{
			if(N==0&&profit==0)
				dp[N][profit]=0;
			else if(N==0)dp[N][profit]=inf;
			else if(price[N-1]<=profit)
				dp[N][profit]=min(weight[N-1]+dp[N-1][profit-price[N-1]],dp[N-1][profit]);
			else
				dp[N][profit]=dp[N-1][profit];
		}
	}
	ll ans=0;
	for(ll profit=0;profit<=maxprofit;profit++)
		if(dp[n][profit]<=capacity)ans=profit;
	return ans;

}


int main()
{
	cin>>n>>capacity;
	weight=new ll[n];
	price=new ll[n];

	ll maxprofit=0;
	for(int i=0;i<n;i++)
	{
		cin>>weight[i]>>price[i];
		maxprofit+=price[i];
	}
	cout<<knapsack(maxprofit);

}

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

int main()
{
  int64_t n, k;
  cin >> n >> k;
  double ans(0);

  for (int i = 1; i <= n; i++) {
    int64_t p(1);
    for (int j = i; j < k; j *= 2) {
      p *= 2;
    }
    ans += 1 / double(n * p);
  }
  cout << setprecision(12) << ans << endl;
}


Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
using ll = long long;
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;



int main() {
  ll n;
  string k;
  cin >> n;
  std::vector<string> v;
  rep(i,n) {
    cin >> k;
    v.pb(k);
  }

  std::sort(v.begin(), v.end());
  v.erase(std::unique(v.begin(), v.end()), v.end());
  cout << v.size() << endl;
}


Measured memory_bytes: 9048
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
vector<int> A,B;
vector<mp> A2,B2;
map<int,int> a1,a2;
int save[100000+1][3];
int main(){
	fastio;
	int n;
	cin>>n;
	LL res=0;
	LL tmp=0,tmp2=0;
	rb(i,1,n){
		int a,b;
		cin>>a>>b;
		save[i][1]=a;
		save[i][2]=b;
		A.PB(a);
		B.PB(b);
		A2.PB(II(a,i));
		B2.PB(II(b,i));
		tmp+=a;
		tmp2+=b;
	}
	sort(ALL(A));
	sort(ALL(B));
	res=min(tmp2,tmp);
	sort(ALL(A2));
	sort(ALL(B2));
	tmp=0;
	int pa=0,pb=0;
	vector<int> final;
	rb(i,1,n){
		if(pa==n){
				a2[B2[pb].SEC]=1;
				final.PB(B[pb]);
				tmp+=B[pb++];
			}
			if(pb==n){
				a1[A2[pa].SEC]=1;
				final.PB(A[pa]);
				tmp+=A[pa++]; 
			}
			if(A[pa]<B[pb]){
				final.PB(A[pa]);
				a1[A2[pa].SEC]=1;
				tmp+=A[pa++]; 
			} 
			else{final.PB(B[pb]);
				a2[B2[pb].SEC]=1;
				tmp+=B[pb++];
			}
	}
//	cout<<final.size()<<endl;
	rb(i,1,n){
		tmp2=tmp;
		tmp2+=save[i][1]+save[i][2];
		if(a1[i]==0&&a2[i]==0){
			tmp2-=final[n-1];
			tmp2-=final[n-2];
		}
		if(a1[i]==1&&a2[i]==1){
			tmp2-=save[i][1]+save[i][2];
		}
		if(a1[i]==1&&a2[i]==0){
			int pt=n-1;
			if(final[pt]==save[i][1]) pt--;
			tmp2-=final[pt];
			tmp2-=save[i][1];
			
		}
		if(a1[i]==0&&a2[i]==1){
			int pt=n-1;
			if(final[pt]==save[i][2]) pt--;
			tmp2-=final[pt];
			tmp2-=save[i][2];
			
		}
		res=min(res,tmp2);
	}
	cout<<res;
	return 0;
}


Measured memory_bytes: 13532
#include <iostream>
#include <vector>
#include <set>

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

  std::vector<std::set<int>> Indices(27);
  for (int i=0; i<N; i++) {
    char c;
    std::cin >> c;
    Indices[c-'a'].insert(i);
  }

  int Q;
  std::cin >> Q;

  for (int q=0; q<Q; q++) {
    int t;
    std::cin >> t;

    if (t == 1) {
      int i;
      char c;
      std::cin >> i >> c;
      i--;

      for (auto& s : Indices) {
        s.erase(i);
      }
      Indices[c-'a'].insert(i);
    } else {
      int l, r;
      std::cin >> l >> r;
      l--; r--;

      int ans = 0;
      for (auto const& s : Indices) {
        auto it = s.lower_bound(l);
        if (it != s.end() && *it<=r) {
          ans++;
        }
      }
      std::cout << ans << '\n';
    }
  }

  return 0;
}


Measured memory_bytes: 23680
import sys

input = sys.stdin.readline


def main():
    n = int(input())
    print(
        sum(
            [
                sum([i % j == 0 for j in range(1, i + 1)]) == 8
                for i in range(1, n + 1, 2)
            ]
        )
    )


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <iostream>
using namespace std;
int main(void){
  
    char str[4];
    int n = 0;
    
    std::cin >> str;
    
    for(int i = 0; i < 4; i++){
        if(str[i] == '+') n++;
        else n--;
    }
    
    std::cout << n << std::endl;
    
    return 0;
}

Measured memory_bytes: 256
def solve():
    S = [_ for _ in raw_input()]
    dict = {}
    for ele in S:
        if ele in dict.keys():
            dict[ele] += 1
        else:
            dict[ele] = 1
    if len(dict) == 2 and dict.values() == [2, 2]:
        print 'Yes'
    else:
        print 'No'

if __name__ == '__main__':
    solve()


Measured memory_bytes: 27884
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define INF 1000000000000
#define MOD 10000007
#define PI 3.14159265359
#define dij priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>
typedef long long ll;
//
int main(){
  int d,t,s;cin>>d>>t>>s;
  bool ans;
  if(d<=t*s)ans=true;
  else ans=false;
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <math.h>
int minimum(int a, int b) { return a < b ? a : b; }
int maximum(int a, int b) { return a > b ? a : b; }
const long long mod = 1000000007;
//const long long mod = 998244353;


int main() {
	int k, q;
	scanf("%d %d", &k, &q);
	auto d = new int[k];
	auto a = new int[q];
	for (int i = 0; i < k; i++)scanf("%d", d + i);
	for (int i = 0; i < q; i++) {
		int n, x, m;
		scanf("%d %d %d", &n, &x, &m);
		long long round = 0, hasuu;
		for (int j = 0; j < k; j++) {
			if (j == (n - 1) % k)hasuu = round;
			round += d[j] % m == 0 ? m : d[j] % m;
		}
		long long sigma = x % m + round * ((n - 1) / k) + hasuu;
		a[i] = n - ((sigma) / m) - 1;
	}
	for (int i = 0; i < q; i++)printf("%d\n", a[i]);
	return 0;
}

Measured memory_bytes: 384
// #pragma GCC optimize(3)
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cstring>
#include <iostream>
#include <algorithm>
#define maxn 310
#define int long long
#define MOD 1000000007
using namespace std;
void write(int x){if(x<0){putchar('-');x=-x;}if(x>9) write(x/10);putchar(x%10+'0');}
int read(){int d=0,w=1;char c=getchar();for(;c<'0'||c>'9';c=getchar())if(c=='-')
w=-1;for(;c>='0'&&c<='9';c=getchar())d=(d<<1)+(d<<3)+c-48;return d*w;}
void wln(int x){write(x);putchar('\n');}
void wrs(int x){write(x);putchar(' ');}
int n,m,f[maxn][maxn][maxn],ans;
vector<pair<int,int>> haha[maxn];
void update(int x)
{
	for(int i=0;i<haha[x].size();i++)
		for(int j=0;j<x;j++)
			for(int k=0;k<x;k++)
				if(j!=k||j==0)
				{
					int tmp=haha[x][i].first,ttmp=(j>=tmp)+(k>=tmp)+1;
					if(ttmp!=haha[x][i].second) f[x][j][k]=f[j][x][k]=f[j][k][x]=0;
				}
}
signed main()
{
	// freopen(".in","r",stdin);
	// freopen(".out","w",stdout);
	n=read();
	m=read();
	for(int i=1;i<=m;i++)
	{
		int x=read(),y=read(),z=read();
		haha[y].push_back(make_pair(x,z));
	}
	f[0][0][0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<i;j++)
			for(int k=0;k<i;k++)
				if(j!=k||j==0)
				{
					if(i==1&&j==0&&k==0)
					{
						f[0][0][1]=f[0][1][0]=f[1][0][0]=1;
						continue;
					}
					if(j!=i-1&&k!=i-1)
					{
						(f[j][k][i]=f[j][k][i-1])%=MOD;
						(f[j][i][k]=f[j][i-1][k])%=MOD;
						(f[i][j][k]=f[i-1][j][k])%=MOD;
					}
					if(j==i-1)
						for(int l=0;l<i-1;l++)
							if(l!=k||l==0)
							{
								(f[j][k][i]+=f[j][k][l])%=MOD;
								(f[j][i][k]+=f[j][l][k])%=MOD;
								(f[i][j][k]+=f[l][j][k])%=MOD;
							}
					if(k==i-1)
						for(int l=0;l<i-1;l++)
							if(l!=j||l==0)
							{
								(f[j][k][i]+=f[j][k][l])%=MOD;
								(f[j][i][k]+=f[j][l][k])%=MOD;
								(f[i][j][k]+=f[l][j][k])%=MOD;
							}
				}
		update(i);
	}
	// for(int i=0;i<=n;i++)
	// 	for(int j=0;j<=n;j++)
	// 		for(int k=0;k<=n;k++)
	// 			printf("f[%d][%d][%d]=%d\n",i,j,k,f[i][j][k]);
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(i!=j||i==0) (ans+=f[i][j][n]+f[i][n][j]+f[n][i][j])%=MOD;
	write(ans);
	return 0;
}


Measured memory_bytes: 227584
while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        break
    for i in range(h):
        for j in range(w):
            if (i+j) % 2 == 0:
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()



Measured memory_bytes: 7008
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>
#include <cstring>
#include <iomanip>
#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1000000000
typedef long long  ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

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

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a /g* b ;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(int 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;
}
template<typename T>
int  GetDigit(T num){
    int digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}


class DisjointSet{
    public:
        vector<int> rank, p;

        DisjointSet(){
        }

        DisjointSet(int size){
            rank.resize(size, 0);
            p.resize(size, 0);
            for (int i = 0; i < size;i++){
                makeSet(i);
            }
        }
        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(int x,int y){
            return findSet(x) == findSet(y);
        }
        void unite(int x,int y){
            link(findSet(x), findSet(y));
        }
        void link(int x,int y){
            if(rank[x]>rank[y]){
                p[y] = x;
            }else{
                p[x] = y;
                if(rank[x]==rank[y]){
                    rank[y]++;
                }
            }
        }
        int findSet(int x){
            if(x!=p[x]){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};


int main()
{
    string S;
    cin >> S;
    int s[26];
    if(S[0]==S[1]){
        if(S[0]!=S[2]&&S[2]==S[3]){
            cout << "Yes" << endl;
            return 0;
        }
    }

    if(S[0]==S[2]){
        if(S[0]!=S[1]&&S[1]==S[3]){
            cout << "Yes" << endl;
            return 0;
        }
    }

    if(S[0]==S[3]){
        if(S[0]!=S[2]&&S[2]==S[1]){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    

}

Measured memory_bytes: 256
def Candles(n , k , xl):

    ans = 10**9

    for i in range(n - k + 1):
        lr = min(abs(xl[i]) + abs(xl[i] - xl[i + k - 1]) , abs(xl[i + k - 1]) + abs(xl[i + k - 1] - xl[i]))
        ans = min(ans , lr)

    return ans

def main():
    n , k = map(int , input().split())
    xl = list(map(int , input().split()))
    print(Candles(n , k , xl))

if __name__ == '__main__':
    main()

Measured memory_bytes: 14384
import math
N, M = map(int, input().split())
if abs(M-N) >= 2:
    print(0)
elif M == N:
    ans = math.factorial(M) * math.factorial(N) * 2 % (10**9+7)
    print(ans)
else:
    ans = math.factorial(M) * math.factorial(N) % (10**9+7)
    print(ans)


Measured memory_bytes: 5192
from itertools import permutations
n,m,rl=map(int,input().split());r=list(map(int,input().split()))
d=[[float("inf")for _ in range(n)]for _ in range(n)]
for i in range(m):
  x,y,z=map(int,input().split())
  d[x-1][y-1],d[y-1][x-1]=z,z
for i in range(n):d[i][i]=0
for k in range(n):
  for i in range(n):
    for j in range(n):d[i][j]=min(d[i][j],d[i][k]+d[k][j])
a=float("inf")
for i in permutations(r,rl):
  aa=0
  for j in range(rl-1):aa+=d[i[j]-1][i[j+1]-1]
  a=min(a,aa)
print(a)


Measured memory_bytes: 72664
import fractions
a, b, c, d = [int(i) for i in input().split()]
gcd = c * d // fractions.gcd(c, d)
num = b - a + 1
num -= b // c - (a - 1) // c
num -= b // d - (a - 1) // d
num += b // gcd - (a - 1) // gcd
print(num)


Measured memory_bytes: 5048
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
#define PI acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define nl printf("\n")
#define sf scanf
#define pf printf
#define INF (ll)1e15
#define mod 1000000007

///#define isValid(n,m,nx,ny)nx>=0&&nx<n&&ny>=0&&ny<m
///int kx[]={1, 1, -1, -1, 2, 2, -2, -2}; //knight moves
///int ky[]={2,-2,  2, -2, 1,-1,  1, -1}; //knight moves
///int dx[]={1,-1,0,0,1,-1,1,-1};//eight direction
///int dy[]={0,0,1,-1,1,-1,-1,1};//eight direction
 
///using namespace __gnu_pbds;
using namespace std;
 
///inline double toRad(double deg){return deg*PI/180;}
///inline double toDeg(double rad){return rad*180/PI;}
///typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
 
const int S=123456;
int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    #endif
    int n;
    while(sf("%d",&n)==1)
    {
        int ara[n+5];
        ara[0]=0;
        for(int i=1;i<=n;i++)sf("%d",&ara[i]);
        ara[n+1]=0;

        int tot=0;
        for(int i=1;i<=n+1;i++)
        {
            tot+=abs(ara[i]-ara[i-1]);
        }

        for(int i=1;i<=n;i++)
        {
            int cur=tot;
            cur-=abs(ara[i]-ara[i-1]);
            cur-=abs(ara[i]-ara[i+1]);
            cur+=abs(ara[i-1]-ara[i+1]);
            pf("%d\n",cur);
        }
    }
    return 0;
}
 









 




























Measured memory_bytes: 1664
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i, N) {
    cin >> a[i];
    a[i]--;
  }

  int64_t s = 0;
  vector<int> cntL(N, 0), cntR(N, 0);
  vector<int> f(N, 0);
  rep(i, N) {
    f[i] += cntL[a[i]];
    f[N - 1 - i] += cntR[a[N - 1 - i]];
    s += cntL[a[i]];

    cntL[a[i]]++;
    cntR[a[N - 1 - i]]++;
  }

  rep(i, N) { cout << s - f[i] << "\n"; }

  return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
int lcm(int a, int b) { return a / __gcd(a, b) * b; }
int dp[100001][3];
int n,k;
int a[100001];
int b[100001];
int c[100001];

int solve(int in,int f){
     
    if(in>=n){
        return 0;
    }
    if(dp[in][f] !=-1){
        return dp[in][f];
    }
    int ans = 0;
    if(f==0){
        ans = max(ans, a[in]+ solve(in + 1, 1));
        ans = max(ans, a[in] + solve(in + 1, 2));
    }
    else if(f==1){
        ans = max(ans, b[in] + solve(in + 1, 0));
        ans = max(ans, b[in] + solve(in + 1, 2));
    }
    else{
        ans = max(ans, c[in] + solve(in + 1, 1));
        ans = max(ans, c[in] + solve(in + 1, 0));
    }
     
     
    return dp[in][f]=ans;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tc;
    tc = 1;
    memset(dp, -1, sizeof(dp));
    //cin >> tc;
    while (tc--)
    {

        cin >> n;
        for(int i=0;i<n;i++){
            cin >>a[i]>>b[i]>>c[i];
        }
         
        int f = max(solve(0,0),max(solve(0,1),solve(0,2)));
        cout << f << endl;
    }

    return 0;
}

Measured memory_bytes: 9600
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        var sc = new Scanner(System.in);
        var n = sc.nextInt();

        var sum = 0l;
        for (int i = 1; i <= n; i++) {
            if (i % 3 != 0 && i % 5 != 0) {
                sum += i;
            }
        }
        System.out.println(sum);

        sc.close();
    }
}


Measured memory_bytes: 35700
package main

import "fmt"

func main() {
	var K, A, B int
	fmt.Scan(&K, &A, &B)
	// 1円を1回ビスケットを交換したときの初期値
	ans := B

	// 1回交換した後は、ビスケットA枚を1円に交換→1円をビスケットB枚に交換を繰り返す
	// ビスケット交換が間に合わない場合はビスケットを1枚ずつ増やす
	// 交換すると損する場合はひたすらビスケットを1枚ずつ増やす
	if A+2 < B && K > A {
		ans += ((K-(A+1))/2)*(B-A) + (K-(A+1))%2
		fmt.Println(ans)
	} else {
		fmt.Println(K + 1)
	}
}


Measured memory_bytes: 512
package main

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

func main() {
	io := NewIo()
	defer io.Flush()
	a, b, c := io.NextInt(), io.NextInt(), io.NextInt()
	for i := 0; i < 61; i++ {
		for j := 0; j < 61; j++ {
			if (a+b)*i-60*j <= c && c <= (a+b)*i-60*j+a {
				io.Println(60*j + c)
				return
			}
		}
	}
	io.Println(-1)
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := make([]interface{}, 0, len(a))
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := make([]interface{}, 0, len(a))
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}



Measured memory_bytes: 1120
# AtCoder
from collections import defaultdict
import bisect
N, M = map(int, input().split())

cities = defaultdict(list)
p = [[int(j) for j in input().split()] for i in range(M)]

for x, y in sorted(p):
    cities[x].append(y)

for x, y in p:
    z = bisect.bisect(cities[x], y)
    print("%06d%06d" % (x, z))


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

namespace Atc_0040
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();

            var N = int.Parse(S.Split(' ')[0]);
            var D = int.Parse(S.Split(' ')[1]);

            int i = 0;

            List<List<int>> Dms = new List<List<int>>();

            while (i < N)
            {
                i++;

                var s = Console.ReadLine();

                List<int> nums = new List<int>();

                for (int j = 0; j < D; j++)
                {
                    nums.Add(int.Parse(s.Split(' ')[j]));
                }

                Dms.Add(nums);
            }

            int result = 0;

            for (i = 0; i < N - 1; i++)
            {
                for (int j = i + 1; j < N; j++)
                {
                    double f = 0;

                    for (int k = 0; k < D; k++)
                    {
                        f += Math.Pow(Dms[j][k] - Dms[i][k], 2);
                    }

                    f = Math.Sqrt(f);

                    if ((int)f == f)
                    {
                        result++;
                    }
                }
            }

            Console.WriteLine(result);

        }
    }
}


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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

int main(void){
    //絶対値が一番大きいものをa_iとする
    //簡単のためa_i > 0とする
    //a_j (i != j)にa_iを足すと、マイナスのものは符号がとれる
    //二回足すとそいつの絶対値は最大になる
    int N; cin >> N;
    int max_abs = 0;
    int idx = 0;
    rep(i, N){
        int v; cin >> v;
        if(abs(v) > abs(max_abs)) {max_abs = v; idx = i+1;}
    }
    if(max_abs == 0) cout << 0 << endl;
    else{
        cout << 2*N << endl;
        if(max_abs > 0){
            for(int i = 1; i <= N; i++){
                cout << idx << " " << i << endl;
                cout << idx << " " << i << endl;
                idx = i;
            }
        }
        else{
            for(int i = N; i >= 1; i--){
                cout << idx << " " << i << endl;
                cout << idx << " " << i << endl;
                idx = i;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,ans=0,x;string s;cin>>n>>s;
  vector<lvector> dp(5001,lvector(5001,0));
  for(ll i=n-1;i>-1;--i) {
    for(ll j=n-1;j>-1;--j) {
      if(s[i]!=s[j]) continue;
      else dp[i][j]=dp[i+1][j+1]+1;
    }
  }
  rep(i,n)rep(j,n) {
    if(i>=j) continue;
    x=min(dp[i][j],j-i);
    ans=max(ans,x);
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 198840
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main() {
    int N, T, A;
    cin >> N >> T >> A;
    int H[N];
    double x[N];     //平均気温とAの差の絶対値

    rep(i, N) {
        cin >> H[i];
        x[i] = abs(T - A - 0.006*H[i]);        
    }

    double min = x[0];
    int i;
    int ans = 1;
    for(i = 1; i < N; i++) {
        if(x[i] < min) {
            ans = i+1; 
            min = x[i];
        }
    }

    cout << ans;

    cout << endl;
    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  string s; cin >> s;
  int x = 0;
  REP(i, s.size()) if (s[i] == 'x') x++;
  cout << (x <= 7 ? "YES":"NO") << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 256
/*
  Esteban Arango Medina
*/
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <tuple>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
using namespace std;

using ll=long long;
#define int ll

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<string,int> si;
typedef pair<int,ii> iii;
typedef vector <si> vsi;
typedef vector <ii> vii;
typedef vector <int> vi;
typedef vector <char> vc;
typedef vector <string> vs;
typedef map <string,vs> msvs;
typedef map <string,int> msi;
typedef map <char,int> mci;
typedef map <int,int> mii;
typedef map <string,string> mss;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define endl '\n' // Normal `cout << endl` flushes the output every time wich hit performance badly
#define INF 1000000000
#define deb(x) cout<<#x<<": "<<x<<endl;
#define printArray(arr) for(auto x: arr) { cout<<x<<", "; }
#define printMatrix(mat) for(auto x: mat) { cout<<" "; printArray(x); cout<<endl; }
#define printMap(mmap) for(auto p: mmap) { cout<< p.first<<": "<<p.second<<endl; }

int intlog(double base, double x) {
  return (int)(log(x) / log(base));
}

signed main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL); // Fast input
  #ifdef LOCAL_PROJECT
    freopen("in.in", "r", stdin);
    // freopen("out.out", "w", stdout);
  #endif

  int T = 1; //cin>>T;
  while(T--) {
    double x; cin>>x;
    int ans = 0;
    int total = 100;
    while(total < x){
      total += total * 0.01;
      ans++;
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
pl v[200200];
multiset<ll> rb,bb;
int main() {
	ios::sync_with_stdio(0);cin.tie(0);
	int n;
	cin >> n;
	for(int i=0;i<n;i++) {
		ll a,b;
		cin >> a >> b;
		if(a > b) {swap(a,b);}
		v[i] = {a,b};
		rb.insert(a);
		bb.insert(b);
	}
	sort(v,v+n);
	ll ma = 1LL<<61;
	for(int i=0;i<n;i++) {
		ll rv = (*rb.rbegin())-(*rb.begin());
		ll bv = (*bb.rbegin())-(*bb.begin());
		ma = min(ma,rv*bv);
		ll a = v[i].first,b = v[i].second;
		rb.erase(rb.find(a));
		bb.erase(bb.find(b));
		rb.insert(b);
		bb.insert(a);
	}
	ll rv = (*rb.rbegin())-(*rb.begin());
	ll bv = (*bb.rbegin())-(*bb.begin());
	ma = min(ma,rv*bv);
	cout << ma << '\n';
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))
template<typename T> inline bool __max__(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool __min__(T &x, const T &y) { return x > y ? x = y, 1 : 0; }

#define pb push_back
#define mp make_pair

static const ll MOD = 1e9 + 7;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    cin.tie(0);
    ios::sync_with_stdio(false);

    int r, g;

    cin >> r;
    cin >> g;

    if (r <= g) cout << g * 2 - r << '\n';
    else cout << g - (r - g) << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
map<string,int>m;
vector<string>v[100];
int c;
int dfs(string s){
  int res=m[s],p=-1,res2=0;
  for(int i=0;i<c;i++){
    if(v[i][0]==s)p=i;
  }
  if(p!=-1)for(int i=1;i<v[p].size();i++){
    res2+=dfs(v[p][i]);
  }
  else return res;
  //cout<<s<<' '<<res<<' '<<res2;
  return min(res,res2);
}
int main(){
  int n;
  while(cin>>n,n){
    c=0;
    for(int i=0;i<100;i++)v[i].clear();
      m.clear();
    while(n--){
      string t;
      int p;
      cin>>t>>p;
      m[t]=p;
    }
    int m;
    cin>>m;
    for(int i=0;i<m;i++){
      string t;
      cin>>t;
      v[i].push_back(t);
      int p;c++;
      cin>>p;
      while(p--){
        cin>>t;
        v[i].push_back(t);
      }
    }
    string t;
    cin>>t;
    cout<<dfs(t)<<endl;
  }
}

Measured memory_bytes: 3040
// M
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 303;
int q, n;
ll A[N];
char S[N];
int main()
{
	scanf("%d", &q);
	for (; q; q --)
	{
		scanf("%d", &n);
		for (int i = 0; i < n; i ++)
			scanf("%lld", &A[i]);
		memset(S, 0, sizeof(S));
		scanf("%s", &S);
		bool Sec = 0;
		vector < ll > B;
		for (int i = n - 1; ~ i; i --)
			if (A[i])
			{
				if (S[i] == '0')
				{
					ll a = A[i];
					for (ll b : B)
						a = min(a, a ^ b);
					for (ll &b : B)
						b = min(b, a ^ b);
					if (a) B.push_back(a);
				}
				else
				{
					ll a = A[i];
					for (ll b : B)
						a = min(a, a ^ b);
					if (a) {Sec = 1; break;}
				}
			}
		printf("%d\n", (int)Sec);
	}
	return 0;
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/math/tools/minima.hpp>

const int MOD = 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::math::tools::brent_find_minima;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::split;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	int n;
	string s, t;
	cin >> n >> s >> t;
	rep(i, n)
	{
		if (s.substr(i, n - i) == t.substr(0, n - i))
		{
			cout << 2 * n - (n - i) << endl;
			return ;
		}
	}
	cout << 2 * n << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

public static class Program
{
  public static void Main(string[] args)
  {
    List<int>[] graphList;
    int n = int.Parse(Console.ReadLine());
    graphList = new List<int>[n];
    for(int i = 0;i < n; i++)
    {
      graphList[i] = new List<int>();
      var inputLine = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
      for(int j = 0;j < inputLine[1]; j++)
      {
        graphList[i].Add(inputLine[j + 2]);
      }      
    }
    
    int[][] graphMatrix = new int[n][];
    for(int i = 0; i < n; i++)
    {
      graphMatrix[i] = new int[n];
    }
    
    for(int i = 0;i < n; i++)
    {
      int listNum = graphList[i].Count;
      for(int j = 0; j < listNum; j++)
      {
          graphMatrix[i][graphList[i][j] - 1] = 1;
      }
    }
    
    
    for(int i = 0; i < n; i++)
    {
      for(int j = 0; j < n; j++)
      {
        Console.Write(graphMatrix[i][j]);
        if(j < n - 1)
        {
          Console.Write(" ");
        }      
      }
      Console.WriteLine();
    }
  }
}


Measured memory_bytes: 9884