akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    int H,W;
    cin >> H >> W;
    vector<string> C(H);
    for (int i = 0; i < H; i++){
        cin >> C[i];
    }
    for (int i = 0; i < 2*H; i++){
        cout << C[i/2] << endl;
    }


    return 0;
}


Measured memory_bytes: 256
/*
Hello don't you know me
I'm the dirt beneath your feet
The most important fool you forgot to see
I've seen how you give it
Now I want to receive
I know that you
Would do the same for me

I know I'm headed for the bottom
But I'm riding you all the way

For all of your kisses turned
To spit in my face
For all that reminds me
Which is my place
For all the times when
You made me disappear
This time I'm sure you will
Know that I'm here

I know I'm headed for the bottom
But I'm riding you all the way

My place was beneath you
But now I'm above
And now I send you a message
Of love
A simple reminder of what
You won't see
A future so holy without me

I know I'm headed for the bottom
But I'm riding you all the way
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd

#define eps 1e-11
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 100031;

string S="GRYB";

int H,W,d,used[600][600];
int ans[600][600];

bool outside(int a,int b){
	return (a<0||a>=H||b<0||b>=W);
}

int main(){
	//freopen("tree.in","r",stdin);
	//freopen("tree.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);

	cin>>H>>W>>d;

	if (d%2==1){
	for (int i=0;i<H;i++)
	{
		for (int j=0;j<W;j++)
		{
			if (i%2==j%2)
				cout<<"G";
			else
				cout<<"R";
		}
		cout<<endl;
	}
	return 0;
	}

//	d/=2;

	for (int i=0;i<H;i++)
	{
		for (int j=0;j<W;j++)
		{
			int p1=(j+i)/d;
			int p2=(i-j+100000)/d;
			int a=(p1%2);
			int b=(p2%2);
			cout<<S[a*2+b];
		}
		cout<<endl;
	}

	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 512
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

s = input()
if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
else:
    print("Sunny")

Measured memory_bytes: 2940
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    A, B = map(int, input().split())

    print(max([A+B,A-B,A*B]))

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc137","a",main)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << a + b + c - max(a, max(b, c))<< endl;
}

Measured memory_bytes: 256
n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for i in range(m)]
  
for i in range(n) :
  C = []  #i行目のlist
  for j in range(l) :
    c = 0
    for k in range(m) :
      c += A[i][k] * B[k][j]
      
    C.append(str(c))
  print(" ".join(C))


Measured memory_bytes: 6244
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String S = br.readLine();
		char[] ch = S.toCharArray();
		
		if(ch[0] == ch[1] && ch[1] == ch[2])
			System.out.println("No");
		else
			System.out.println("Yes");
	}

}

Measured memory_bytes: 32248
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <deque>
#include <algorithm>

typedef long long ll;
typedef unsigned long long ull;
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < n; ++i)

using namespace std;

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

	int n;
	cin >> n;
	int* a, *b, *c;
	a = new int[n];
	b = new int[n];
	c = new int[n];
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	} 

	for (int i = 0; i < n; ++i) {
		cin >> b[i];
	}

	for (int i = 0; i < n-1; ++i) {
		cin >> c[i];
	}

	int ans = b[a[0] - 1];
	int current = a[0];
	for (int i = 1; i < n; ++i) {
		ans += b[a[i] - 1];
		if (a[i] - 1 == current) {
			ans += c[current-1];
		}
		current = a[i];
	}

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


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rangeRep(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
struct Student {
	int t, n, m, s;
};

constexpr int timeOffset = 540;
//[PC][??????] = ????????????
int dp[1000][1260 - timeOffset] = { 0 };


class Solve {
public:
	Solve() {};
	~Solve() {};

	void solver() {
		std::vector<std::vector<int>> results;
		while (1) {
			int n, m, r, q;
			std::vector<Student> students;
			std::cin >> n >> m;
			if (!n) break;

			std::memset(dp, 0, 1000 * (1260 - timeOffset) * sizeof(int));
			long long a = 1000 * (1260 - timeOffset) * sizeof(int);
			results.push_back(std::vector<int>());
			//?????°???????????±
			std::cin >> r;
			Student s;
			rep(i, r) {
				//??????, PC??????, ????????????, isLogin
				std::cin >> s.t >> s.n >> s.m >> s.s;
				//?????°??????
				if (s.s) {
					//?????°??????????§???????????????????
					dp[s.n - 1][s.t - timeOffset] = s.m;
				}//?????°??¢??????
				else {
					//?????°????????¨????????§?????£?????????
					int time = s.t - timeOffset - 1;
					while (dp[s.n - 1][time] == 0) {
						dp[s.n - 1][time--] = s.m;
					} 
				}
			}

			//?????? [ts, te]??????????????????m????????¨??????
			std::cin >> q;
			rep(i, q) {
				int num = 0;
				int ts, te, m;
				std::cin >> ts >> te >> m;
				ts -= timeOffset; te -= timeOffset;
				//???????????????PC??§?????°?????????????????????????????????
				rangeRep(j, ts, te) {
					rep(k, 1000) {
						if (dp[k][j] == m) {
							num++;
							break;
						}
					}
				}
				results.back().push_back(num);
			}
		}

		for (auto& x : results) {
			for (auto& y : x) {
				std::cout << y << std::endl;
			}
		}
	}
private:

};

int main() {
	Solve solve;
	solve.solver();
	return 0;
}

Measured memory_bytes: 5884
#include<stdio.h>

int main(){

  int   W, H, x, y, r;

  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

  if(x>=W || y>=H){
    printf("No\n");
  } else if(x<=0 || y<=0){
    printf("No\n");
  } else if(H-y<r || W-x<r){
    printf("No\n");
  } else if(0<x && x<W && 0<y && y<H && W-x>=r && H-y>=r){
    printf("Yes\n");
      }

return 0;

}



Measured memory_bytes: 2108
#include <stdio.h>

int main(void){
	int N, a;
	scanf("%d", &N);
    a = N % 10;
    
    if(a == 3){
    	printf("bon\n");
    }
    else if(a == 0 || a == 1 || a == 6 || a == 8){
    	printf("pon\n");
    }
    else {
    	printf("hon\n");
    }
    return 0;
}

Measured memory_bytes: 1656
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define all(x) x.begin(),x.end()
#define pii pair<int,int> 
#define vi vector<int> 
#define FOR(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define fi first
#define se second
using namespace std;
void solve()
{
	int n;
	cin>>n;
	if(n==1)
	cout<<0;
	else if(n==2)
	cout<<2<<endl;
	else
	{ 	
		int y=1;
		for(int i=1;i<=n;i++)
		{
		y=(y*10)%MOD;
		}
		int x=1;
		for(int i=0;i<n;i++)
		{
			x=(x*9)%MOD;
		}
		x*=2;
		// x=(x*n)%MOD;
		int z=1;
		for(int i=0;i<n;i++)
		{
			z=(z*8)%MOD;
		}
		cout<<((y-x+z)%MOD+MOD)%MOD;
		
	}
}
int32_t main()
{
	//freopen("shell.in", "r", stdin);
	//freopen("shell.out", "w", stdout);
	int t=1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}
// Problem : C - Ubiquity
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)



Measured memory_bytes: 3584
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

ll p[202020];
double v[202020];

int main(){

    ll N, K;
    cin >> N >> K;
    rep1(i, N){
        cin >> p[i];
        v[i] = p[i] * (p[i] + 1) / 2.0 / p[i];
        v[i] += v[i - 1];
    }
    double ans = 0;
    rep1(i, N){
        ll j = i - K;
        if(j < 0)continue;
        chmax(ans, v[i] - v[j]);
    }
    printf("%.10f\n", ans);
    
    return 0;
}

Measured memory_bytes: 3328
#include <random>
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld eps = 1e-12;
constexpr int inf = numeric_limits<int>::max() / 2;
constexpr ll mod = 1e9 + 7;
mt19937_64 rnd{random_device()()};

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

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

  int x;cin >> x;
  cout << 8 - (x-400)/200 << endl;
}


Measured memory_bytes: 3616
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, t: f64, a: f64, h: [f64; n]);

    let mut min = 100_000_000.0;
    let mut ans = 0;
    for i in 0..h.len() {
        let sa = (a - (t - h[i] * 0.006)).abs();

        if min >= sa {
            min = sa;
            ans = i;
        }
    }

    println!("{}", ans + 1);
}


Measured memory_bytes: 2212
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

int memo[30];

int fac(int m){
  if(m==1)return 1;
  return m*fac(m-1);
}

signed main(){
  int n;
  cin>>n;
  cout<<fac(n)<<endl;
  return 0;
}

Measured memory_bytes: 3016
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);

void solve(){
    int n, k; cin >> n >> k;
    int cnt = 0;
    vector<int> a(n);
    REP(i, n){
        cin >> a[i];
    }
    while(true){
        n = n - k;
        cnt++;
        if(n <= 0) break;
        n++;
    }
    cout << cnt << endl;
}

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

Measured memory_bytes: 640
n=int(input())
a = input().split(" ")
lista = [int(n) for n in a]
kane=1000
k=0
for i in range(n-1):
  c=lista[i]
  d=lista[i+1]
  if c<d:
    b=kane//c
    kane-=b*c
    k+=b
  elif c>=d:
    kane+=k*c
    k=0
  if i==n-2:
    kane+=k*lista[n-1]
    k=0
print(kane)



Measured memory_bytes: 9012
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll INF = 1e18L + 1;

ll A[200010];
int main()
{
  int N;
  cin >> N;
  map<ll, ll> mp;
  rep(i, N)
  {
    cin >> A[i];
    mp[A[i]]++;
  };
  ll ans = 0;
  for (auto it = mp.begin(); it != mp.end(); it++)
  {
    ll freq = it->second;
    if (freq > 1)
      ans += (freq * (freq - 1) / 2);
  }
  rep(k, N)
  {
    ll t = ans;
    ll freq = mp[A[k]];
    if (freq > 1)
    {
      t -= (freq) * (freq - 1) / 2;
      t += (freq - 1) * (freq - 2) / 2;
    }
    printf("%llu\n", t);
  }
  return 0;
}

Measured memory_bytes: 11008
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define vvll vector <vll>
#define vsi vector <si>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
    freopen("a.in","r",stdin);
    #endif
    int n;
    cin>>n;
    ll ans=0;
    for (int i=1;i<=n;i++)
    {
        if (i%5!=0&&i%3!=0)
            ans+=i;
    }
    cout<<ans;




}

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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

lli n;
vll a;
bitset<4000000 + 1> b;
lli ans;

int main(){
  cin >> n;
  a = vll(n);
  for(lli i = 0;i < n;i++) cin >> a[i];
  lli s = accumulate(a.begin(),a.end(),0ll);
  b[0] = 1;
  for(lli i = 0;i < n;i++){
    b |= (b << a[i]);
  }
  ans = (s+1)/2;
  while(!b[ans]) ans++;
  cout << ans << endl;
  return 0;
}


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

int main() {
    int a;
    cin >> a;
    int s1 = a / 100;
    int s2 = max(0, a - 100 * s1) / 10;
    int s3 = max(0, a - 100 * s1 - 10 * s2);

    cout << s1 + s2 + s3 << endl;

    return 0;
}


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

using namespace std;

int n, arr[3][100000], dp[3][100000];

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

    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> arr[0][i] >> arr[1][i] >> arr[2][i];
    dp[0][0] = arr[0][0], dp[1][0] = arr[1][0], dp[2][0] = arr[2][0];
    for (int i = 1; i < n; i++)
    {
        dp[0][i] = max(dp[1][i - 1], dp[2][i - 1]) + arr[0][i];
        dp[1][i] = max(dp[0][i - 1], dp[2][i - 1]) + arr[1][i];
        dp[2][i] = max(dp[0][i - 1], dp[1][i - 1]) + arr[2][i];
    }
    cout << max(dp[0][n - 1], max(dp[1][n - 1], dp[2][n - 1])) << '\n';

    return 0;
}


Measured memory_bytes: 4992
n  = int(input())
s = input()
pref = [ 1 if s[0] == 'W' else 0 ]
for i in range(1, n):
	pref += [(pref[i - 1] + (1 if s[i] == 'W' else 0))]
pref1 = [ 1 if s[0] == 'E' else 0 ]
for i in range(1, n):
	pref1 += [(pref1[i - 1] + (1 if s[i] == 'E' else 0))]
ans = n
for i in range(n):
	ans = min(ans, (0 if i == 0 else pref[i - 1]) + (pref1[-1] - pref1[i]))
print(ans)

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

int main() {
  int n;
  cin>>n;
  vector<double> p(n+1);
  vector<double> dp(n+1);
  double a,b;
  dp[0] = 1;
  for(int i = 1;i<=n;i++) {
    cin>>p[i];
   // printf("for i = %d\n",i);
    for(int j = i; j>= 0;j--) {
      a = 0;
      b = 0;
      if(j>0) {
        a = dp[j-1]*p[i];
      }
      b = dp[j]*(1-p[i]);
      dp[j] = a + b;
     // printf("dp[%d] = %lf\n",j,dp[j]);
      
    }

  }
  double ans = 0;
  for(int i = 1;i<=n;i++) {
    if(i > (n-i)) {
      ans += dp[i];
    }
  }
  cout<<setprecision(10)<<ans<<endl;
  //dp[i] is probability of getting i heads
  //a new element j enters
  //dp[i] = dp[i]*(1-p[j]) + dp[i-1]*p[j]
  //dp[0] = 1;
}

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

typedef long long ll;
typedef pair<ll,ll> pii;

long long MOD = 1000000000 + 7;

bool compare(pii x, pii y){
  return x.second < y.second;
}

int main(){
  cout << setprecision(10);
  int N;
  cin >> N;
  vector<pii> v(N);
  for(int i = 0; i < N; i++){
    ll tmp1, tmp2;
    cin >> tmp1 >> tmp2;
    v.at(i) = make_pair(tmp1-tmp2, tmp1+tmp2);
  }
  sort(v.begin(), v.end(), compare);

  vector<ll> l(N), r(N);
  for(int i = 0; i < N; i++){
    l[i] = v.at(i).first;
    r[i] = v.at(i).second;
  }

  int ans = 1;
  ll now = r[0];
  for(int i = 1; i < N; i++){
    if(l[i] < now){
      // 残せない
    } else { 
      ans++;
      now = max(now, r[i]);
    }
  }
  cout << ans << endl;


}


Measured memory_bytes: 3328
#include <stdio.h>

#define MAX_N 200010
#define MOD 1000000007

int main(){
  int n, k;
  long long max, min;
  long long ans = 0;
  scanf("%d %d", &n, &k);
  max = 0;
  min = 0;
  for (int i = 1; i <= n+1; i++) {
    min = min + i - 1;
    max = max + n - i + 1;
    if (i >= k) {
      ans += max - min + 1;
      ans %= MOD;
    }
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1712
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		Console.WriteLine(rs().Contains('9') ? "Yes" : "No");
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13268
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
//#include <intrin.h>

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 300005
#define inf 2000000000
#define EPS 1e-7
#define MOD (ll)1e15
#define __builtin_popcount(x) __popcnt(x)

using namespace std;

typedef long long ll;
typedef pair<double, double> pr;
typedef pair<pair<int, int>, int> tup;

double find_r(double x, double y, vector<pr> &p)
{
	double l = 0, r = 1000;
	while (abs(r - l) > EPS) {
		double m = (l + r) / 2;

		bool ok = 1;
		fore(i, 0, p.size())
		{
			if ((x - p[i].first) * (x - p[i].first) + (y - p[i].second) * (y - p[i].second) - m * m > 0)
				ok = 0;
		}

		if (ok)
			r = m;
		else
			l = m;
	}

	return r;
}

double find_x(double y, vector<pr> &p)
{
	double l = 0, r = 1000;
	while (r - l > EPS) {
		double m1 = l + (r - l) / 3,
			m2 = r - (r - l) / 3;
		if (find_r(m1, y, p) > find_r(m2, y, p))
			l = m1;
		else
			r = m2;
	}
	return r;
}

inline void solve()
{
	int n;
	cin >> n;
	vector<pr> v(n);
	fore(i, 0, n)
		cin >> v[i].first >> v[i].second;

	double l = 0, r = 1000;
	while (r - l > EPS) {
		double m1 = l + (r - l) / 3,
			m2 = r - (r - l) / 3;
		if (find_r(find_x(m1, v), m1, v) > find_r(find_x(m2, v), m2, v))
			l = m1;
		else
			r = m2;
	}


	cout << fixed << setprecision(10) << find_r(find_x(r, v), r, v);
}

int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
}

Measured memory_bytes: 256
function Main(input) {
    input = input.split("\n");
    tmp = input[0].split(" ");
    var a = parseInt(input[0].slice(-1), 10)

    if ([2,4,5,7,9].indexOf(a)>=0) {
    	console.log("hon")
    }else if([0,1,6,8].indexOf(a)>=0) {
    	console.log("pon")
    }else{
    	console.log("bon")
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

l = [0]*n

for i in range(n):
  l[i] = sum(a[0][-(i+1):-(n+1):-1]) + sum(a[1][-1:-(i+2):-1])
  
print(max(l))


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int h,w;
  cin>>h>>w;
  vector< vector<string> > s(h,vector<string>(w));
  rep(i,h)rep(j,w)cin>>s[i][j];
  rep(i,h)rep(j,w)
    if(s[i][j]=="snuke"){
      char ans='A'+j;
      cout<<ans<<i+1<<endl;
      return 0;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define ll unsigned long long
using namespace std;
int main(){
    int c=-1,N,ans=0;cin>>N;
    vector<int> A(N),B(N),C(N);
    REP(i,N)cin>>A[i];
    REP(i,N)cin>>B[i];
    REP(i,N-1)cin>>C[i];
    REP(i,N){
        ans+=B[A[i]-1];
        if(c==A[i]-1)ans+=C[A[i]-2];
        c=A[i];
    }
    cout<<ans<<endl;
}

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

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 500010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
int dataa[MEM_SIZE];
int vec[MEM_SIZE];

int sum = 0;
struct Mo
{
  vector< int > left, right, order;
  vector< bool > v;
  int width;
  int nl, nr, ptr;

  Mo(int n) : width((int)sqrt(n)*2), nl(0), nr(0), ptr(0), v(n) {}

  void insert(int l, int r) /* [l, r) */
  {
    left.push_back(l);
    right.push_back(r);
  }

  /* ソート */
  void build()
  {
    order.resize(left.size());
    iota(begin(order), end(order), 0);
    sort(begin(order), end(order), [&](int a, int b)
    {
      if(left[a] / width != left[b] / width) return left[a] < left[b];
      return right[a] < right[b];
    });
  }

  /* クエリを 1 つぶんすすめて, クエリのidを返す */
  int process()
  {
    if(ptr == order.size()) return (-1);
    const auto id = order[ptr];
    while(nl > left[id]) distribute(--nl);
    while(nr < right[id]) distribute(nr++);
    while(nl < left[id]) distribute(nl++);
    while(nr > right[id]) distribute(--nr);
    return (order[ptr++]);
  }

  inline void distribute(int idx)
  {
    v[idx].flip();
    
    if(v[idx]) add(idx);
    else del(idx);
  }

  void add(int idx);

  void del(int idx);
};

void Mo::add(int idx)
{
  if(vec[dataa[idx]] == 0) ++ sum;
  vec[dataa[idx]] ++;
  // DEBUG(vec);
}


void Mo::del(int idx)
{-- vec[dataa[idx]];
  if(vec[dataa[idx]] == 0) -- sum;
}

  int ans[MEM_SIZE];
void solve(void)
{
  int n,q;
  scanf("%d %d",&n,&q);
  // vector<int> data(n,0);
  for (int i = 0; i < n; i++)
  {
    int x;
    scanf("%d",&x);
    dataa[i] = x;
  }
 
  Mo mo(n);
  for (int i = 0; i < q; i++)
  {
    int a,b;
    // cin>>a>>b;
    scanf("%d %d",&a,&b);
    mo.insert(--a,b);
  }
  mo.build();

  for (int i = 0; i < q; i++)
  {
    int idx = mo.process();
    ans[idx] = sum;
  }
  // DEBUG(ans);
  for (int i = 0; i < q; i++)
  {
    printf("%d\n",ans[i]);
  }
  
  
  

  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // std::cout << std::fixed;
  // std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 15684
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String[] S = sc.nextLine().split(" ");
    Map<Integer,Integer> map = new HashMap<>();
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(S[i]);
      if(map.get(n) == null){
        map.put(n, 1);
      }else{
        map.put(n, map.get(n)+1);
      }
    }
    
    int M = Integer.parseInt(sc.nextLine());
    String[] T = sc.nextLine().split(" ");
    String ans = "YES";
    for(int i = 0; i < M; i++){
      int m = Integer.parseInt(T[i]);
      if(map.get(m) == null){
        ans = "NO";
        break;
      }else{
        if(map.get(m) == 0){
          ans = "NO";
          break;
        }else{
          map.put(m, map.get(m)-1);
        }
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 110004
public partial class IntroductionToProgramming{
	public static void Main(){
		System.Console.ReadLine();
		string[] line = System.Console.ReadLine().Split(' ');

		decimal min = 1000000;
		decimal max = -1000000;
		decimal sum = 0;

		foreach (string s in line)
		{
			decimal decS = decimal.Parse(s);

			min = decS < min ? decS : min;
			max = max < decS ? decS : max;
			sum += decS;
		}

		System.Console.WriteLine(min.ToString("0") + " " + max.ToString("0") + " " + sum.ToString("0"));
	}
}

Measured memory_bytes: 21136
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    d,n=parseMap(split(readline()))
    if n==100
        n+=1
    end
    println(n*(100^d))
end
main()

Measured memory_bytes: 111580
#include<iostream>
#include<algorithm>

using namespace std;

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

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

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

   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<queue>
#include<string>
#include<cstring>


using namespace std;
typedef long long LL;
const int maxn=2e6+7;
LL n;
LL tot=0;
LL mn=0x3f,mx=-0x3f;
LL a[maxn];
LL bit[maxn];

struct node {
LL val,pos;
}arr[maxn];

bool cmp(node n1,node n2)
{
    return n1.val==n2.val?n1.pos<n2.pos:n1.val<n2.val;
}

void update(LL x,LL val)
{
    for(; x< maxn ;x+=(x & -x))
    {
        bit[x]+=val;
    }
}

LL getsum(LL x)
{
    LL ans=0;
    for(;x>0;x-=(x & -x))
    {
        ans += bit[x];
    }
    return ans;
}



bool check(LL x){
    memset(bit,0,sizeof(bit));
     memset(arr,0,sizeof(arr));


	for(int i=1;i<=n;i++)
    {
        if(a[i]<=x)arr[i].val=-1;
        else arr[i].val=1;
        arr[i].pos=i+1;
    }

    arr[0].val=0;
	arr[0].pos=1;

	for(int i=1;i<=n;i++)
	arr[i].val+=arr[i-1].val;
	sort(arr,arr+n+1,cmp);

	LL ans=0;
	for(int i=0;i<=n;i++)
    {
        ans+=(i-getsum(arr[i].pos));
        update(arr[i].pos,1);
    }
	return ans*2 > tot;
}


int main(){
   scanf("%lld",&n);

   for(int i=1;i<=n;i++)
    {
   	 scanf("%lld",&a[i]);
   	 mn=min(mn,a[i]);
   	 mx=max(mx,a[i]);
   	 tot+=i;
   }

   LL l=mn,r=mx;
   while(r-l>1)
    {
   	  LL mid=(l+r)/2;
   	 if(check(mid)) r=mid;
   	 else l=mid;
   	 //printf("s%d",mid);
   }
   printf("%lld\n",r);

   return 0;
}


Measured memory_bytes: 49408
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main() 
{ 
    string s; cin >> s;
    string s1; cin >> s1;
    int flag=0;
    if(s.size()+1==s1.size())
    {
        int k=s1.size();
        k--;
        s1.erase(s1.begin()+k);
        if(s==s1)
        {
            flag=1;
            cout << "Yes";
        }
    }
    if(flag==0)
    {
        cout << "No";
    }
}

Measured memory_bytes: 3628
#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]


n,m = map(int,input().split())
#初期化
#根なら-size,子なら親の頂点
par = [-1]*n


for i in range(m):
    a,b = map(int,input().split())
    unite(a-1,b-1)
ans = 0
for i in range(n):
    ans = max(ans,size(i))
print(ans)

Measured memory_bytes: 75696
class UnionFindTree:
    def __init__(self, n):
        self.nodes = [-1] * n #根にサイズを負の値で格納する。
    def find(self, i):
        if self.nodes[i] < 0: #値が負の場合は根
            return i
        else:
            self.nodes[i] = self.find(self.nodes[i]) #縮約
            return self.nodes[i]

    def union(self, i, j):
        i = self.find(i)
        j = self.find(j)
        if i == j:
            return
        if self.nodes[i] > self.nodes[j]: #サイズ比較してiの方がサイズが大きいようにする
            i, j = j, i
        self.nodes[i] += self.nodes[j] #大きい方に小さい方を統合しサイズを登録する。
        self.nodes[j] = i # jの親はi
    
    def size(self, i): # 所属する集合の大きさを返す
        i = self.find(i)
        return -self.nodes[i]

n, m = map(int, input().split())
p = list(map(lambda x : int(x) - 1, input().split()))
uft = UnionFindTree(n)
for _ in range(m):
    x, y = map(lambda  x : int(x) - 1, input().split())
    uft.union(x, y)

ans = 0
for i in range(n):
    if uft.find(p[i]) == uft.find(i):
        ans += 1
print(ans)


Measured memory_bytes: 84752
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll n, p;
  cin >> n >> p;

  ll ans = 1;
  for (ll i = 2; i*i <= p; i++) {
    int cnt = 0;
    while (p%i == 0) {
      p /= i;
      cnt++;
    }
    //ans *= pow(i, cnt/n);
    rep(j, cnt/n) {
      ans *= i;
    }
  }
  ans *= pow(p, 1/n);
  cout << ans << endl;
}


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

#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define NP next_permutation;
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define puf push_front
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;

const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;

template<class T> bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T> void decimal(T a){cout<<fixed<<setprecision(a);}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}

void YesNo(bool a){if(a) out("Yes"); else out("No");}
void yesno(bool a){if(a) out("yes"); else out("no");}
void YESNO(bool a){if(a) out("YES"); else out("NO");}
ll GCD(ll a,ll b){ll c; while(b!=0){c=a%b; a=b; b=c;} return a;}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){ll c=1; while(b>0){if(b&1){c=a * c%mod;} a=a * a%mod; b>>=1;} return c;}
vi calc(ll x){vi res; while(x>0){res.pb(x%10); x/=10;} reverse(all(res)); return res;}

void solve() {
  int a,b; cin>>a>>b;
  if(a%2==0||b%2==0) out("Even");
  else out("Odd");
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 256
import Data.List  -- sort

-- the substantial part of the algorithm

height_of_top3 :: [Int] -> [Int]
height_of_top3 = (take 3) . reverse . sort

-- the algorithm with I/O

main :: IO ()
main = do
  inp <- getContents    -- read all input
  let ls = lines inp    -- break it into a list
      hs :: [Int]
      hs = map read ls  -- convert into [Int]
      ts = height_of_top3 hs  -- the answer
  printList ts

printList :: Show a => [a] -> IO ()
printList ls = putStr $ unlines (map show ls)

Measured memory_bytes: 3560
N=int(input())
l=list(map(int,input().split()))
l2=[]
for i in range(N-1):
   if l[i+1]-l[i]>0:
      l2.append("p")
   elif l[i+1]-l[i]==0:
      l2.append("n")
   else:
      l2.append("m")
money=1000
kabu=0
for i in range(N-1):
   if kabu==0 and l2[i]=="p":
      kabu+=money//l[i]
      money-=(money//l[i])*l[i]
   elif kabu!=0 and l2[i]=="m":
      money+=l[i]*kabu
      kabu=0
if kabu>0:
   money+=kabu*l[-1]
print(money)

Measured memory_bytes: 9220
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)

int main()
{
    ll ans = 0;
    string s, t;
    cin >> s >> t;
    rep(i, s.size())
    {
        if (s[i] != t[i]) ans++;
    }
	
    cout << ans << "\n";

    return 0;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    int ans = 0;
    while(N > 0) N /= K, ans++;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int cnt = 0;
    int[] array = new int[n];
    for(int i=0;i<n;i++){
      array[i] = sc.nextInt();
    }
    for(int i=0;i<n;i++){
      if(array[i]>=k){
        cnt++;
      }
    }
    System.out.println(cnt);
  }
}


Measured memory_bytes: 51244
#!/usr/bin/python3

import math
import sys


DEBUG = False


def inp():
    return sys.stdin.readline().rstrip()


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def solve(N, A):
    d = {}
    for a in A:
        if a not in d:
            d[a] = 0
        d[a] += 1

    if N % 3 == 0:
        if len(d) > 3:
            return False

        if len(d) == 3:
            a, b, c = d
            if d[a] != d[b] or d[b] != d[c]:
                return False
            arr = [a, b, c]
        elif len(d) == 2:
            a, b = d
            if d[a] * 2 == d[b]:
                arr = [a, b, b]
            elif d[b] * 2 == d[a]:
                arr = [a, a, b]
            else:
                return False
        else:
            (a,) = d
            arr = [a, a, a]

        a, b, c = arr
        if a ^ b == c or a ^ c == b or b ^ c == a:
            return True
        return False

    if len(d) > 1:
        return False

    (a,) = d
    if a != 0:
        return False
    return True


def main():
    N = int(inp())
    A = [int(e) for e in inp().split()]

    print('Yes' if solve(N, A) else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 14212
package main

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

func main() {
	sc := NewScanner()

	n := sc.NextInt()
	d := sc.NextInt()
	x := sc.NextInt()

	ans := 0
	for i := 0; i < n; i++ {
		tmp := sc.NextInt()
		ans++
		j := 1
		for {
			if j*tmp+1 > d {
				break
			}
			j++
			ans++
		}
	}
	fmt.Printf("%v\n", ans+x)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

typedef long long ll;
typedef pair <char, int> pci;

const int MAXN = 1e2 + 5;

int N, K;
char s[MAXN];

void load() {
	scanf("%s%d", s, &K);
}

int get(const vector <pci> &v) {
	int res = 0;
	for (auto it : v)
		res += it.second / 2;
	return res;
}

ll solve() {
	N = strlen(s);
	
	int cnt = 0;
	vector <pci> blocks;
	for (int i = 0; i < N; i++) {
		cnt++;
		if (s[i] != s[i + 1]) {
			blocks.push_back({s[i], cnt});
			cnt = 0;
		}
	}
	
	if (blocks.size() == 1)
		return (ll)K * N / 2;
	
	if (blocks[0].first != blocks.back().first)
		return (ll)K * get(blocks);
	
	vector <pci> pref;
	pref = blocks;
	pref.pop_back();
	int last = blocks.back().second;
	blocks[0].second += last;
	blocks.pop_back();
	
	return get(pref) + (ll)(K - 1) * get(blocks) + last / 2;
}

int main() {
	load();
	printf("%lld\n", solve());
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
dic=defaultdict(list)
while True:
    try:
        w,p=raw_input().split()
        dic[w].append(int(p))
    except EOFError:
        for w in sorted(dic):
            print w
            dic[w].sort()
            print " ".join(map(str,dic[w]))
        break

Measured memory_bytes: 8788
N = int(input())

def main():
    a = [[int(input()), False] for _ in range(N)]
    idx = 0
    ans = 0
    while True:
        idx = a[idx][0] - 1
        ans += 1
        if idx == 1:
            break
        if a[idx][1]:
            ans = -1
            break
        a[idx][1] = True
    print(ans)

if __name__ == '__main__':
    main()


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

int main() {
  int H, W;
  cin >> H >> W;

  vector<vector<char>> data(H, vector<char>(W));
  vector<vector<char>> answerData(H+2, vector<char>(W+2));
  
  for (int y = 0; y < H; y++) {
    for (int x = 0; x < W; x++) {
      cin >> data.at(y).at(x);
    }
  }

  for (int x = 0; x < W+2; x++) answerData.at(0).at(x) = '#';
  for (int x = 0; x < W+2; x++) answerData.at(H+1).at(x) = '#';
  for (int y = 0; y < H+2; y++) answerData.at(y).at(0) = '#';
  for (int y = 0; y < H+2; y++) answerData.at(y).at(W+1) = '#';
  
  for (int y = 0; y < H; y++) {
    for (int x = 0; x < W; x++) {
      answerData.at(y+1).at(x+1) = data.at(y).at(x);
    }
  }
  
  for (int y = 0; y < H+2; y++) {
    for (int x = 0; x < W+2; x++) {
      cout << answerData.at(y).at(x);
    }
    
    cout << endl;
  }
}


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

int main() {
    long long k, n; cin >> k>>n;
    long long  arr[n];cin >> arr[0];
    long long  m = -1;
    for (int i = 1; i < n; i++){cin >> arr[i]; m = max(arr[i]-arr[i-1] ,m);}
    m= max(k-arr[n-1]+arr[0], m);
    cout << k-m;
    
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;

    ll x, y;
    for(ll i = 1; i*i <= n; i++) {
        if(n%i == 0) {
            x = i;
            y = n/i;
        }
    }

    out(x+y-2);
    re0;
}

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

class State
{
public:
  int pos, money, danger;

  State(int p, int m, int d)
    :pos(p), money(m), danger(d) {}

  bool operator < (const State& st) const
  {
    return this->danger > st.danger;
  }
};

int main()
{
  const int INF = 1 << 30;
  const int MAX_N = 100;
  const int MAX_L = 101;

  int N, M, L;
  int cost[MAX_N][MAX_L];
  bool visited[MAX_N][MAX_L];
  pair<int, int> edge[MAX_N][MAX_N];

  while (scanf("%d %d %d", &N, &M, &L) != EOF) {
    if (N == 0 && M == 0 && L == 0)
      break;

    for (int i = 0; i < MAX_N; ++i) {
      for (int j = 0; j < MAX_N; ++j)
	edge[i][j].first = edge[i][j].second = INF;
    }

    for (int i = 0; i < MAX_N; ++i) {
      for (int j = 0; j < MAX_L; ++j) {
	cost[i][j] = INF;
	visited[i][j] = false;
      }
    }

    for (int i = 0; i < M; ++i) {
      int A, B, D, E;
      scanf("%d %d %d %d", &A, &B, &D, &E);
      --A;
      --B;
      edge[A][B].first = edge[B][A].first = D;
      edge[A][B].second = edge[B][A].second = E;
    }

    priority_queue<State> que;
    cost[0][L] = 0;
    que.push(State(0, L, 0));

    while (!que.empty()) {
      State st = que.top();
      que.pop();

      if (st.pos == N-1) {
	printf("%d\n", st.danger);
	break;
      }

      if (cost[st.pos][st.money] < st.danger || visited[st.pos][st.money])
	continue;

      visited[st.pos][st.money] = true;
      for (int i = 0; i < N; ++i) {
	if (edge[st.pos][i].first == INF)
	  continue;

	if (st.money >= edge[st.pos][i].first) {
	  int m = st.money - edge[st.pos][i].first;
	  if (st.danger < cost[i][m]) {
	    cost[i][m] = st.danger;
	    que.push(State(i, m, st.danger));
	  }
	}

	int d = st.danger + edge[st.pos][i].second;
	if (d < cost[i][st.money]) {
	  cost[i][st.money] = d;
	  que.push(State(i, st.money, d));
	}
      }

    }

  }
  return 0;
}

Measured memory_bytes: 1088
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;
  int i,j;
  char a;
  
  for(i=0;i<H+2;i++){
    if((i == 0)|(i==H+1)){
      for(j=0;j<W+2;j++){
        cout << '#';
      }
      cout << endl;
    }
    else{
      cout << '#';
      for(j=0;j<W;j++){
        cin >> a;
        cout << a;
      }
      cout << '#' << endl;
    }
  }
}


Measured memory_bytes: 256
while True:
    n = int(input())
    if n == 0: break  
    y = float(input())
    id, vmax = -1, 0
    for i in range(n):
        b, r, t = map(int, input().split())
        if t == 1: m = y*(r/100)+1
        else: m = (r/100+1)**y
        if id < 0 or m >= vmax: id, vmax = b, m
    print(id)


Measured memory_bytes: 5704
x,y = [int(i) for i in input().split()]
set1 = [1,3,5,7,8,10,12]
set2 = [4,6,9,11]
set3 = [2]
if (x in set1 and y in set1) or (x in set2 and y in set2):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060