akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;


#define REP(i, n) for(ll i = 0; i < n; i++)




























ll val[3001][3001];
ll dp[3001][3001][4];

int main(){
    int n, m, x;
    scanf("%d %d %d", &n, &m, &x);
    for(int i = 0; i < x; i++){
        int r, c, v;
        scanf("%d %d %d", &r, &c, &v);
        r--; c--;
        val[r][c] = v;
    }
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= m; j++){
            for(int k = 0; k <= 3; k++){
                if(i < n){
                    dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][k] + (k < 3 ? val[i][j] : 0));
                }
                if(j < m){
                    if(k < 3){
                        dp[i][j + 1][k + 1] = max(dp[i][j + 1][k + 1], dp[i][j][k] + val[i][j]);
                    }
                    dp[i][j + 1][k] = max(dp[i][j + 1][k], dp[i][j][k]);
                }
            }
        }
    }
    printf("%lld\n", dp[n][m][0]);
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);
  int m, d;
  cin >> m >> d;
  int ans = 0;
  for (int i = 1; i <= m; ++i) {
    for (int j = 2; j <= d; ++j) {
      if (j/10 < 2 || j%10 < 2) continue;
      if ((j/10) * (j%10) == i) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  LL A, B; cin >> A >> B;
  set<LL> s;
  for (LL i = 1; i * i <= A; ++i) {
    if (A % i == 0) {
      LL j = A / i;
      if (B % i == 0) s.insert(i);
      if (B % j == 0) s.insert(j);
    }
  }

  vector<LL> v;
  int cnt = 0;
  for (LL i : s) {
    if (i == 1) {
      ++cnt;
      continue;
    }

    bool ok = true;
    for (LL j : v) {
      if (i % j == 0) {
        ok = false;
        break;
      }
    }
    if (ok) ++cnt;
    v.push_back(i);
  }
  cout << cnt << endl;
}


Measured memory_bytes: 4008
/*
    Ujjawal Pabreja [cuber_coder]
*/
#include <bits/stdc++.h> 
#include <functional> 
using namespace std;
#define speed_cubing    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define ld              long double
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define in              insert
#define ff              first
#define ss              second
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define sz(c)           (ll)c.size()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define rev             reverse
#define Y				"YES"
#define N 				"NO"
#define endl            "\n"
#define debug(x)        cout << #x << " : " << x << endl;
const ll inf = 1e18;  
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;

inline ll add(ll a,ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a,ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a,ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x,ll n){
    if(n == 0){
        return 1;
    }
    if(n&1){
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    } else {
        return pwr(mul(x, x), n / 2);
    }
}
ll modInv(ll n){ 
    return pwr(n, mod - 2); 
}
ll gcd(ll a,ll b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
// ====== Useful functions end ======
 
// ====== Global Variables begin ======

// ====== Global Variables end ======

void speed_solve(){
    ll n, d;
    cin >> n >> d;
    ll cnt = 0;
    rep(i,n){
        ll x, y;
        cin >> x >> y;
        cnt += (x * x + y * y <= d * d);
    }
    cout << cnt << endl;
}

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    speed_cubing;
    ll test_cases = 1;
    // cin >> test_cases;
    rep(i,test_cases){
        // cout << "Case #" << i + 1 << ": ";
        speed_solve();
    }
    return 0;
}

Measured memory_bytes: 3652
<?php
  list($k) = explode(" ", trim(fgets(STDIN)));

  if($k % 2 == 0){
    echo "-1";
    exit; 
  }

  $a = 7;
  for($i=1; $i<1000000; $i++){
    if($a % $k == 0){
      echo $i;
      exit;
    }
    $a = $a % $k;
    $a = $a * 10 + 7;
  }

  echo "-1";

  

Measured memory_bytes: 16304
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main()
{
    int r, g, b, n;
    cin >> r >> g >> b >> n;
    int ans = 0;
    rep(x, n + 1) {
        rep(y, n + 1) {
            if((n - r * x - g * y) % b == 0 && n - r * x - g * y >= 0) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
package main

import (
	"fmt"
)

func main() {
	var N, K int
	fmt.Scanf("%d%d", &N, &K)
	e := 0
	if N-(N/K)*K >= K/2 {
		e = 1
	}
	fmt.Printf("%d\n", (N/K)*(N/K)*(N/K)+(K+1)%2*(N/K+e)*(N/K+e)*(N/K+e))
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef map<int,int> mii;
 
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define mem(a) memset(a , 0 ,sizeof a)
#define rep(i,a,b) for(int i=a ; i<b ; ++i)
#define deb(x) cout << #x << " - " << x << "\n";
#define deb2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n"
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define D2(x) { cerr << "[" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }
#define ps(x,y) fixed<<setprecision(y)<<x
#define clz(x) __builtin_clzll(x)
#define setbit(x) __builtin_popcount(x)
 
#define PI 3.141592653589793
const ll MOD = 1e9 + 7;
const ll INF = 10000005;
const ll MAX_N = 1e4 + 10;

double calcAngle(double h, double m)  
{  
    // validate the input  
    // if (h <0 || m < 0 || h >12 || m > 60)  
    //     printf("Wrong input");  
  
    if (h == 12) h = 0;  
    if (m == 60) m = 0;  
  
    // Calculate the angles moved  
    // by hour and minute hands  
    // with reference to 12:00  
    double hour_angle = 0.5 * (h * 60 + m);  
    double minute_angle = 6 * m;  
  
    // Find the difference between two angles  
    double angle = abs(hour_angle - minute_angle);  
  
    // Return the smaller angle of two possible angles  
    angle = min(360 - angle, angle);  
  
    return angle;  
}  
  

int main() {
    IOS;
    double a,b; cin>>a>>b;
    double h,m; cin>>h>>m;
    double angle = calcAngle(h,m);
    angle = angle * (double)PI/(double)180.00;
    double temp = (a*a) + (b*b) - (2 * a * b * cos(angle));
    cout << fixed << setprecision(20) <<sqrt(temp);
    return 0;
}


Measured memory_bytes: 4212
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const ll LL_INF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

const int N = 100006;;
int p[100008];
int q[N];
void Eratosthenes(){
	fill(p,p + N,1);
	p[0] = p[1] = 0;
	for(int i = 2; i*i <= N; i++)
		if(p[i] == 1)
			for(int j = i*i; j <= N; j+=i)
				p[j] = 0;
  REP(i,N){
    if(p[i] && p[(i + 1) / 2]) q[i] = 1;
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int Q;
  cin >> Q;
  Eratosthenes();
  REP(i,N) q[i + 1] += q[i];
  REP(i,Q){
    int l, r;
    cin >> l >> r;
    cout << q[r] - q[l - 1] << endl;
  }
  return 0;
}


Measured memory_bytes: 1408
//#include <bits/stdc++.h>
//#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>

using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using intpv=vector<intpair>;
using llpair=pair<ll,ll>;
using llpv=vector<llpair>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;
using pairmat=vector<llpv>;

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

#define PI 3.141592653589793
#define INTINF 1<<30
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())
#define matin(mat,H,W) for(int i__=0; i__<H; i__++)for(int j__=0; j__<W; j__++) cin>>mat[i__][j__]
#define out(n) cout<<n<<endl

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

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

template<class T>
inline void outmat(T& a, int y, int x) {
	for(int i=0; i<y; i++) {
		for(int j=0; j<x; j++) cout<<a[i][j]<<" ";
		cout<<endl;
	}
}

template<class T>
inline void init(T& v) {
	for(auto &a__: v) cin>>a__;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a__: v) cin>>a__.first>>a__.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a__: v) cin>>a__;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a__: v) cin>>a__.first>>a__.second;
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

ll GCD(ll a, ll b) { //最大公約数
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll binpow(ll a, ll ex, ll p) { //繰り返し二乗法
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}

ll Fact(ll x, ll p) { //階乗
	ll f=1;
	for(ll i=2; i<=x; i++) {
		f*=i;
		f%=p;
	}
	return f;
}

int DigitNum(ll n) { //桁数
	int digit=0;
	ll div=1LL;
	while(n/div) {
		digit++;
		div*=10;
	}
	return digit;
}


char ch;

void input() {
	cin>>ch;
}

void solve() {
	if('A'<=ch && ch<='Z') cout<<'A'<<endl;
	else cout<<"a"<<endl;
}

int main() {
	while(1) {
		input();
		solve();
		break;
	}
}


Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>

using namespace std;

int n, mx, mi;
int a[55];

int abs(int p) {return (p >= 0) ? p : -p;}

int main()
{
    scanf("%d", &n);
    printf("%d\n", 2 * n - 1);
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        if(mx < abs(a[i])) mx = abs(a[i]), mi = i;
    }
    for(int i = 0; i < n; i++)
    {
        printf("%d %d\n", mi + 1, i + 1);
        a[i] += a[mi];
    }
    if(a[mi] >= 0)
    {
        for(int i = 1; i < n; i++)
        {
            printf("%d %d\n", i, i + 1);
        }
    }
    else
    {
        for(int i = n - 2; i >= 0; i--)
        {
            printf("%d %d\n", i + 2, i + 1);
        }
    }
    return 0;
}


Measured memory_bytes: 256
/*#### bits/stdc++.h */
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<string>
#include<sstream>
#include<fstream>
#include<map>
#include<set>
#include<vector>
#include<deque>
#include<queue>
#include<utility>
#include<algorithm>
using namespace std;
/*####*/

void calc(int A,int B,int L,int&cntA,int&cntB){
	int ans = (B - 1) / (A + 1) + 1;
	int lo = 0, hi = A;
	while(lo != hi){
		int mi = (lo + hi)/2;
		if((long long int)(A - mi) * ans + (mi-1) / ans + (mi % ans == 0 ? 1 : 0) > B)
			lo = mi + 1;
		else
			hi = mi;
	}
	int pos = lo;
	int leftB = B - (A - pos) * ans - (pos-1) / ans;

	if(pos + (pos-1) / ans >= L){
		cntB = L / (ans + 1);
		cntA = L - cntB;
		return;
	}
	if(pos + (pos-1) / ans + leftB >= L){
		cntA = pos;
		cntB = L - cntA;
		return;
	}
	int leftL = L - (pos + (pos-1) / ans + leftB);
	cntA = pos + (leftL-1)/(ans+1)+1;
	cntB = L - cntA;
}
int main(){
	int q,A,B,C,D;
	for(scanf("%d",&q); q--;){
		bool rev = false;
		scanf("%d%d%d%d",&A,&B,&C,&D);
//		scanf("%d%d",&A,&B); C = 1; D = A+B;
		if(A > B){
			swap(A,B);
			swap(C,D);
			C = A+B+1-C;
			D = A+B+1-D;
			rev = true;
		}
		string res = "";
		int prevA = 0, prevB = 0;
		for(int i=C-1; i<=D; i++){
			int curA, curB;
			calc(A,B,i,curA,curB);
			if(i >= C){
				if(curA > prevA)
					res += "A";
				else
					res += "B";
			}
			prevA = curA;
			prevB = curB;
		}
		if(rev){
			for(int i=0; i<res.length(); i++)
				if(res[i] == 'A')
					res[i] = 'B';
				else
					res[i] = 'A';
			reverse(res.begin(), res.end());
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 384
N = int(input())
As = [int(x) for x in input().split()]

print(" ".join(map(str,As)))
for i in range(1,N):
    v = As[i]
    j = i - 1
    while j >= 0 and As[j] > v:
        As[j+1] = As[j]
        j -= 1
    As[j+1] = v
    print(" ".join(map(str,As)))


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

int main()
{
  ll N;
  ll res = 0;
  cin >> N;

  bool even = (N%2==0);
  
  if(!even){
    cout << 0 << endl;
    return 0;
  }

  ll p = 10;
  for(;;){
    if(N<p) break;
    //cout << p << ":";
    //cout << N/p << endl;
    res += N/p;
    p *= 5;
  }
  cout << res << endl;
}

Measured memory_bytes: 256
import sys
from collections import deque
sys.stdin.readline()
A = deque()
ans = []

def push(arg):
    A.appendleft(arg[2:]) if arg[0] == '0' else A.append(arg[2:])
def randomAccess(arg):
    ans.append(A[int(arg)])
def pop(arg):
    A.popleft() if arg[0] == '0' else A.pop()

C = {'0': push, '1': randomAccess, '2': pop}

for query in sys.stdin:
    C[query[0]](query[2:])

sys.stdout.writelines(ans)



Measured memory_bytes: 34684
#include <stdio.h>
int main (void)
{
    int N=0,A=0;
    
	scanf("%d", &N);
	scanf("%d", &A); 
    
    if(N%500<=A)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<deque>

using namespace std;

int main(void){
  int loop,op,num1,num2;
  deque<int> dq;
  cin>>loop;

  for(int i=0;i<loop;i++){
    cin>>op;
    switch(op){
      case 0:
      cin>>num1>>num2;
      if(num1==0) { dq.push_front(num2); break; }
      else if(num1==1) { dq.push_back(num2); break; }
      case 1:
      cin>>num1;
      cout<<dq.at(num1)<<endl; break;
      case 2:
      cin>>num1;
      if(num1==0) { dq.pop_front(); break; }
      else if(num1==1) { dq.pop_back(); break; }
    }
  }
  return 0;
}



Measured memory_bytes: 4644
#include<bits/stdc++.h>
using namespace std;
int n;
int dist[505];
int start[505];
int cycle[505];
long long solve(int station){
	long long curr = 0;
	for(int i=station; i<n; i++){
		if(curr<=start[i]){
			curr = start[i];
		}
		else{
			long long left = curr-start[i];
			left%=cycle[i];
			if(left) curr+=cycle[i]-left;
			
		}
		curr+=dist[i];
	}
	return curr;
}
int main(){
	cin>>n;
	for(int i=1; i<n; i++){
		cin>>dist[i]>>start[i]>>cycle[i];
	}
	long long curr = 0;
	for(int i=1; i<n; i++) cout<<solve(i)<<'\n';
	cout<<0;
}

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

using namespace std;

using ll = long long;

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

    map<string, ll> cnt;
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());

        ans += cnt[s];
        cnt[s]++;
    }

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


Measured memory_bytes: 11264
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int N,L;
  cin >> N >> L;
  int a[210];
  for(int i=0;i<N;i++) a[i]=L+i;
  int sum=0;
  for(int i=0;i<N;i++) sum+=a[i];
  int min=400;
  for(int i=0;i<N;i++){
    if(abs(min)>=abs(a[i]))
      min=a[i];
  }
  cout << sum-min << endl;
}


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

int main(int argc, char const *argv[]) {
    int A, B;
    std::cin >> A >> B;
    if (A * B % 2 == 0) {
        std::cout << "No" << '\n';
    } else {
        std::cout << "Yes" << '\n';
    }
    return 0;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    cin >> n;
    vi d(n);
    rep(i, n) cin >> d[i];
    sort(all(d));
    int ans = d[n/2] - d[n/2-1];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
"""
int #整数
float #小数

#for
for name in fruits: #fruitの頭から操作
    print(name)
    
#リスト
list0 = [] #リスト生成
list0 = [1,2,3,4] #初期化
list0 = [0]*10 #[0,0,0,0,0,0,0,0,0,0]
list1= [i for i in range(10)] #>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list1 = list(map(int, input().split()))　# 複数の入力をリストに入れる
number=[int(input()) for i in range(int(input()))] #複数行の入力をリストに
list1 = list1 + [6, 7, 8] #リストの追加
list2.append(34) #リストの追加　最後に（）内が足される
list.insert(3,10) #リストの追加　任意の位置（追加したい位置,追加したい値）
len(list4) #リストの要素数
max(sa) #list saの最小値
list5.count(2) #リスト(文字列も可）内の2の数
list1.sort() #並び替え小さい順
list1.sort(reverse=True)  #並び替え大きい順
set(list1) #list1内の重複している要素を削除し、小さい順に並べる
sum([2,3,   ,3]) #リストの合計

abs(a) #aの絶対値
max(a,b) min(a,b) #最大値　最小値
text1 = text1.replace("34","test") #text1内の"34"を"test"に書き換える(文字列内の文字を入れ替える)

exit(0) #強制終了
"""
N, Y = map(int, input().split())
for i in range(N+1):
    for j in range(N+1):
        k=N-i-j
        if 0<=k and 10000*i+5000*j+1000*k==Y:
            print(i,j,k)
            exit(0)
print(-1,-1,-1)



Measured memory_bytes: 66392
package main

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

var sc = bufio.NewScanner(os.Stdin)


func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func main() {
	sc.Split(bufio.ScanWords)
	N := nextInt()
	M := nextInt()

	L := 1
	R := N
	for m := 0; m < M; m++ {
		l := nextInt()
		r := nextInt()
		if L < l {
			L = l
		}
		if r < R {
			R = r
		}
	}

	ans := 0
	if L <= R {
		ans = R - L + 1
	}
	fmt.Println(ans)
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
constexpr long long mod=998244353;

int N,R[200000],tree[1<<19];
long long DP[200001];
pair<int,int>P[200000];

void update(int x,int t){
	x+=1<<18;
	while(x){
		tree[x]=max(tree[x],t);
		x/=2;
	}
}

int calc(int l,int r){
	int a=0;
	l+=1<<18;
	r+=1<<18;
	while(l<=r){
		a=max({a,tree[l],tree[r]});
		l=(l+1)/2;
		r=(r-1)/2;
	}
	return a;
}

int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>P[i].first>>P[i].second;
	}
	sort(P,P+N);
	for(int i=N-1;i>=0;i--){
		update(i,max(i,calc(i,lower_bound(P,P+N,pair<int,int>{P[i].first+P[i].second,-1})-P-1)));
	}
	DP[0]=1;
	for(int i=0;i<N;i++){
		DP[i+1]+=DP[i];
		DP[i+1]%=mod;
		DP[tree[i+(1<<18)]+1]+=DP[i];
		DP[tree[i+(1<<18)]+1]%=mod;
	}
	cout<<DP[N]<<endl;
}


Measured memory_bytes: 5120
#include <stdio.h>

int main(){
  
  int x1,y1,x2,y2,x3,y3,x4,y4;
  scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
  
  if(x1 >= x2&&y1 <= y2){
    x3 = x2 - (y2 - y1);
    y3 = y2 + (x2 - x1);
    x4 = x1 - (y2 - y1);
    y4 = y1 + (x2 - x1);
  }else if(x1 >= x2&&y1 <= y2){
    x3 = x2 - (y2 - y1);
    y3 = y2 - (x1 - x2);
    x4 = x1 - (y2 - y1);
    y4 = y1 - (x1 - x2);
  }else if(x1 >= x2&&y1 >= y2){
    x3 = x2 + (y1 - y2);
    y3 = y2 - (x1 - x2);
    x4 = x1 + (y1 - y2);
    y4 = y1 - (x1 - x2);
  }else{
    x3 = x2 + (y1 - y2);
    y3 = y2 + (x2 - x1);
    x4 = x1 + (y1 - y2);
    y4 = y1 + (x2 - x1);
  }
  
  printf("%d %d %d %d",x3,y3,x4,y4);
  
  return 0;
}
  

Measured memory_bytes: 128
S = list(input())
s1 = [S[0],S[1]]
s2 = [S[2],S[3]]
s1 = int("".join(s1))
s2 = int("".join(s2))

if s1 >0 and s1 <13 and s2>0 and s2 <13:
    print("AMBIGUOUS")

elif s2 > 0 and s2 < 13:
    print("YYMM")

elif s1 < 13 and s1 > 0:
    print("MMYY")

else:
    print("NA")



Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
  int X,A,B;
  cin >> X >> A >> B;
  if(A >= B){
    cout << "delicious";
  }
  else if(A+X >= B){
    cout << "safe";
  }else{
    cout << "dangerous";
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll r,g,b,n;
ll ans;

int main(){
  cin >> r >> g >> b >> n;
  for(ll i = 0;i <= 3000;i++){
    for(ll j = 0;j <= 3000;j++){
      if((n-i*r-j*g)%b == 0 && (n-i*r-j*g) >= 0) ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define se second
#define fi first
using namespace std;
const int maxn = 1e6 + 4, mod = 11092019, maxx = 1e6 + 1;
typedef pair<int,int> ii;
typedef pair<long long, long long> ll;
int a[maxn], n;
long long f[maxn];

void _accepted_by_one_hit_()
{
    #ifdef NTMA
        freopen("abc.inp", "r", stdin);
        freopen("abc.out", "w", stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
}
int main()
{
    _accepted_by_one_hit_();

    int cv;
    cin >> cv >> n; long long ans = 1e17;
    for(int i=1; i<=n; ++i) cin >> a[i];
    for(int i=n+1; i<=2*n; ++i) a[i] = cv + a[i-n]; 
    
    for(int i=1; i<2*n; ++i) f[i] = f[i-1] + a[i+1] - a[i];
    for(int i=1; i<=n; ++i) ans = min(ans, f[n+i-2] - f[i-1]);
    cout << ans;
}

Measured memory_bytes: 8448
def II(): return int(input())
def MI(): return map(int,input().split())
def LMI(): return list(map(int,input().split()))
def LIIN(n): return list(int(input()) for _ in range(n))
def LMIN(n): return [list(map(int, input().split())) for _ in range(n)]
def IS(): return input()
def LS(): return list(input())
def MS(): return map(str,input().split())
def LMS(): return list(map(str,input().split()))
def LMS(): return list(map(str,input().split()))
def LISN(n): return list(input() for _ in range(n))
def LMSN(n): return [input().split() for _ in range(n)]
MOD = 10**9+7
INF = 10**18

def main():
    n = II()
    tmp = (n * 100 + 108 - 1) // 108
    if tmp * 108 //100 != n:
        print(':(')
    else:
        print(tmp)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
k = int(input())
from collections import deque

x = deque([i for i in range(1, 10)])

for i in range(k):
    a = x.popleft()
    if a%10 != 0:
        x.append(10*a + a%10 -1)
    x.append(10*a + a%10)
    if a%10 !=9:
        x.append(10*a + a%10 + 1)
print(a)

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

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...)
#endif

/**
 * @title Graph template
 * @docs graph_template.md
 */
template <typename Cost = int> class Edge{
public:
  int from,to;
  Cost cost;
  Edge() {}
  Edge(int to, Cost cost): to(to), cost(cost){}
  Edge(int from, int to, Cost cost): from(from), to(to), cost(cost){}
};

template <typename T> using Graph = std::vector<std::vector<Edge<T>>>;
template <typename T> using Tree = std::vector<std::vector<Edge<T>>>;

template <typename T, typename C> void add_edge(C &g, int from, int to, T w = 1){
  g[from].emplace_back(from, to, w);
}

template <typename T, typename C> void add_undirected(C &g, int a, int b, T w = 1){
  add_edge<T, C>(g, a, b, w);
  add_edge<T, C>(g, b, a, w);
}

/**
 * @title 0-1 BFS
 * @docs bfs_0_1.md
 */
std::vector<int> bfs_0_1(const Graph<int> &g, const std::vector<int> &src){
  int n = g.size();
  std::vector<int> ret(n, INT_MAX);
  std::vector<bool> visited(n);

  for(auto i : src) ret[i] = 0;
  std::deque<int> dq(src.begin(), src.end());

  while(not dq.empty()){
    int cur = dq.front(); dq.pop_front();

    if(visited[cur]) continue;
    visited[cur] = true;

    for(auto &e : g[cur]){
      if(ret[e.to] > ret[e.from] + e.cost){
        ret[e.to] = ret[e.from] + e.cost;
        
        if(e.cost == 0) dq.push_front(e.to);
        else dq.push_back(e.to);
      }
    }
  }
  
  return ret;
}





namespace solver{
  const int dir[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
  
  void solve(){
    int H, W; std::cin >> H >> W;
    int Ch, Cw; std::cin >> Ch >> Cw;
    int Dh, Dw; std::cin >> Dh >> Dw;

    std::vector<std::string> S(H);
    for(int i = 0; i < H; ++i) std::cin >> S[i];

    Graph<int> g(H * W);
    std::vector<std::vector<int>> index(H, std::vector<int>(W));

    {
      int k = 0;
      for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j){
          index[i][j] = k;
          ++k;
        }
      }
    }

    for(int i = 0; i < H; ++i){
      for(int j = 0; j < W; ++j){
        for(auto d : dir){
          int x = i + d[0];
          int y = j + d[1];

          if(x < 0 or x >= H or y < 0 or y >= W or S[x][y] == '#') continue;
          add_edge(g, index[i][j], index[x][y], 0);
        }

        for(int dx = -2; dx <= 2; ++dx){
          for(int dy = -2; dy <= 2; ++dy){
            int x = i + dx;
            int y = j + dy;

            if(x < 0 or x >= H or y < 0 or y >= W or S[x][y] == '#') continue;
            //dump(x, y);
            add_edge(g, index[i][j], index[x][y], 1);
          }
        }
      }
    }

    auto res = bfs_0_1(g, {index[Ch-1][Cw-1]});
    
    /*
    for(int i = 0; i < H; ++i){
      for(int j = 0; j < W; ++j){
        std::cerr << std::setw(2) << res[index[i][j]] << " ";
      }
      std::cerr << "\n";
      }*/
    
    

    auto ans = res[index[Dh-1][Dw-1]];
    dump(ans, INT_MAX);
    
    if(ans < INT_MAX){
      std::cout << ans << "\n";
    }else{
      std::cout << -1 << "\n";
    }
    
    

    
  }
}

int main(){
  solver::solve();
  return 0;
}


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

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    int res = 0;
    if( C <= A + B){
        res = B + C;
    } else {
        res = A + B + B + 1;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define int long long
using namespace std;

int mod = 1000000007;
int n, x, y, z;
int dp[41][1 << 17];	//A = {5, 5, 7, 4}は, dp[0][0] -> dp[4][(1000010000001000)b]へ至る1つの経路と対応.
						//(ただしx=5, y=5, z=7ならすでに完成しているので, dp[3][(10000100001000000)b]へ至る経路 + 10^1個の経路, の1つと対応)
int pow10[41];

signed main() {
	int i, j, k;
	
	cin >> n >> x >> y >> z;
	
	pow10[0] = 1;
	for (i = 1; i <= n; i++) pow10[i] = (pow10[i - 1] * 10) % mod;
	
	dp[0][0] = 1;
	for (i = 0; i < n; i++) {
		for (j = 0; j < (1 << 17); j++) {
			if (!dp[i][j]) continue;
			if ((j >> (x - 1)) % 2 == 1 && (j >> (x + y - 1)) % 2 == 1 && (j >> (x + y + z - 1)) % 2 == 1) continue;
			for (k = 1; k <= 10; k++) {
				int nj = (j << k) + (1 << (k - 1));
				dp[i + 1][nj & 131071] += dp[i][j];
				dp[i + 1][nj & 131071] %= mod;
			}
		}
	}
	
	int ans = 0;
	for (i = 0; i <= n; i++)
		for (j = 0; j < (1 << 17); j++)
			if ((j >> (x - 1)) % 2 == 1 && (j >> (x + y - 1)) % 2 == 1 && (j >> (x + y + z - 1)) % 2 == 1) {
				ans += dp[i][j] * pow10[n - i];
				ans %= mod;
			}
	cout << ans << endl;
	return 0;
}

//左から数字を1個ずつ決めていく. 数字を決めるごとに, 後ろからZYXを作れるか判定する.
//今まで作った数列A = a + (和が17以下であって, 長さが最大の部分b), のとき, bを知っていればZYXの判定ができるので, bを使ったDPを考えたくなる。
//実際、
//・Aからbが一意に定まること
//・A + {1～10の値}としたときに, bも(aを使わずに)更新できること
//・bを知っていればZYXの判定ができること
//より、dp[index][数列b] := 何通り？, というDPができる。
//
//あとは数列bの表現の仕方だが、bの累積和rbを0/1ビットで表現すれば、判定・更新・メモ化が簡単にできることがわかる。これで間に合うと思う。
//↑たとえば、A = {5, 5, 5, 7, 4, 1}のとき、b = {5, 7, 4, 1}、rb = {5, 12, 16, 17}で、bの表現 = (000001000000100011) (左から順に1の位, 10の位…)
//↑bとrbとbの表現が互いに全単射なので、「bの表現」についても、上記の3性質が成り立つ。(bを復元できるので)
//
//
//DP(状態をまとめた全探索)で、「そういう状態にまとめていい」条件は、
//・(状態集合, ) 初期状態, 終了状態(判定条件)が定まり、状態と選択肢から、遷移先の状態が定まること。
//ただし、これに加えて「不足なく、重複を除いて、数えられているか」に注意する必要がある。

Measured memory_bytes: 40192
private fun readStrings() = readLine()!!.split(" ")
private fun readInts() = readStrings().map { it.toInt() }

fun main(args: Array<String>) {
    val (N, K) = readInts()
    val A = readInts()
    if (K == N) {
        println(1)
    } else {
        val rem = N - K
        println(1 + (1 + (rem - 1) / (K - 1)))
    }
}

Measured memory_bytes: 49716
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long a[] = new long[n+1];
        Arrays.fill(a,1);
        
        for(int i=2;i<=n;i++){
            for(int j=1;;j++){
                if(i*j <= n){
                    a[i*j]++;
                }else{
                    break;
                }
            }
        }
        
        long sum = 0;
        for(int i = 1;i<=n;i++){
            sum += i*a[i];
        }
        
        System.out.println(sum);
    }
}

class Monmo {
}



Measured memory_bytes: 116584
from enum import Enum
import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


while True:
    N = int(input())
    if N == 0:
        break
    table = list(map(int,input().split()))

    tmp_sum = 0
    for i in range(len(table)):
        tmp_sum += table[i]
    B = tmp_sum/len(table) #平均

    squared_sum = 0
    for i in range(len(table)):
        squared_sum += table[i]*table[i]
    A = squared_sum/len(table)

    print("%.10f"%(math.sqrt(A-B*B)))


Measured memory_bytes: 6400
<?php
class Dice
{
    private $top;
    private $south;
    private $east;
    private $west;
    private $north;
    private $bottom;
    
    public function __construct ($dice_values) {
        $this->top = $dice_values[0];
        $this->south = $dice_values[1];
        $this->east = $dice_values[2];
        $this->west = $dice_values[3];
        $this->north = $dice_values[4];
        $this->bottom = $dice_values[5];
    }
    
    public function print_east($top, $south) {
        $this->set_top($top);
        $this->set_south($south);
        echo $this->east."\n";
    }
    
    public function move($directions) {
        for ($i = 0; $i < strlen($directions); $i++) {
            $this->change_value($directions[$i]);
        }
    }
    
    public function change_value($direction) {
        $top = $this->top;
        if ($direction == 'N') {
            $this->top = $this->south;
            $this->south = $this->bottom;
            $this->bottom = $this->north;
            $this->north = $top;
        } elseif ($direction == 'E') {
            $this->top = $this->west;
            $this->west = $this->bottom;
            $this->bottom = $this->east;
            $this->east = $top;
        } elseif ($direction == 'S') {
            $this->top = $this->north;
            $this->north = $this->bottom;
            $this->bottom = $this->south;
            $this->south = $top;
        } elseif ($direction == 'W') {
            $this->top = $this->east;
            $this->east = $this->bottom;
            $this->bottom = $this->west;
            $this->west = $top;
        }
    }
    
    public function set_top($top) {
        if ($this->top == $top) {
            return;
        } elseif ($this->south == $top) {
            $this->move("N");
        } elseif ($this->bottom == $top) {
            $this->move("NN");
        } elseif ($this->north == $top) {
            $this->move("S");
        } elseif ($this->east == $top) {
            $this->move("W");
        } elseif ($this->west == $top) {
            $this->move("E");
        }
    }
    
    public function set_south($south) {
        if ($this->south == $south) {
            return;
        } elseif ($this->north == $south) {
            $this->move("NEES");
        } elseif ($this->east == $south) {
            $this->move("NWS");
        } elseif ($this->west == $south) {
            $this->move("NES");
        }
    }
    
}


$dice_values = array_map("intval", explode(" ", trim(fgets(STDIN))));
fscanf(STDIN, "%d", $question_count);

for ($i = 0; $i < $question_count; $i++) {
    fscanf(STDIN, "%d %d", $top, $south);
    $dice = new Dice($dice_values);
    $dice->print_east($top, $south);
}


Measured memory_bytes: 9380
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


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

    int ans = (c+1)*c/2 - b;
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

constexpr ll mod = 1000000007;
constexpr ll modsize = 10010;
vector<ll> fac(modsize);
vector<ll> inv(modsize);
vector<ll> facinv(modsize);

void modcalc() {
	if (modsize == 0) abort();
	fac[0] = 1; fac[1] = 1; inv[1] = 1;
	facinv[0] = 1; facinv[1] = 1;
	for (ll i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modinv(ll a) {
	if (a == 0) abort();
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0 || n == 0 && k > 0) return 0;
	if (n == 0 && k == 0) return 1;
	return fac[n + k - 1] * facinv[k] % mod * facinv[n - 1] % mod;
}

ll dp[3010][3010];

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	modcalc();

	ll n, m;
	cin >> n >> m;
	m--;
	vector<ll> sum;
	sum.pb(1);
	dp[0][0] = 1;
	rep(i, m) {
		dp[i + 1][0] = (dp[i][0] + dp[i][1] - dp[i][n - 1] + mod) % mod;
		for (ll j = 1; j < n; j++) {
			dp[i + 1][j] = dp[i][j + 1] + dp[i][j - 1];
			if (dp[i + 1][j] >= mod) dp[i + 1][j] -= mod;
		}
		ll cnt = 0;
		rep(j, 3010) cnt += dp[i + 1][j];
		sum.pb(cnt % mod);
	}
	ll ans = 0;
	for (ll i = 0; i <= m; i++) {
		ans += modcomb(m, i) * sum[i] % mod * modpow(2, m - i) % mod;
	}
	cout << ans * 4 % mod << '\n';
}

Measured memory_bytes: 74284
# 「毎回最大のやつ取れない限り無理じゃね...?」 <- それできます。優先度付きキューならね
import heapq
from functools import reduce
n, m = map(int, input().split())
arr = list(map(lambda x: int(x) * -1, input().split()))
heapq.heapify(arr)
for i in range(m):
    t = -1 * heapq.heappop(arr)
    heapq.heappush(arr, -1 * (t // 2))
print(-1 * reduce(lambda a, b: a + b, arr))


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

void solve(int n,int m,int p){
    vector<int> v;
    int a;
    int sum=0;
    for(int i=0;i<n;i++){
        cin >> a;
        sum+=a;
        v.push_back(a);
    }
    if(v[m-1]) cout<<(sum*(100-p)/v[m-1])<<endl;
    else cout<<0<<endl;
}


int main(void){
    int a,b,c;
    while(cin>>a>>b>>c,a){
        solve(a,b,c);
    }
    
}

Measured memory_bytes: 3032
#include<iostream>
using namespace std;
int main()

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

  for(i=1;i<=n;i=i+2)
  {

     if(a[i]%2==1)
     {
         c++;
     }
  }
  cout<<c<<endl;

    return 0;
}


Measured memory_bytes: 3632
/* Author: Jason L.(int3xccATgmailDOTcom), Sat Jun  3 10:31:07 CST 2017 */
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using pll = pair<ll, ll>; using dd = long double;
//=========================================================================
namespace {
static bool constexpr dbg =
#ifdef INT3XCC_DEBUG
        1;
#else
        0;
#endif
#define Dprintf(fmt, ...) do{if(dbg) printf(fmt, ##__VA_ARGS__);}while(0)
#define REP0(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
//=========================================================================
ll constexpr N = -1;
ll h, w, res;
//=========================================================================
void init() {
    cin>>h>>w;
    if (h%3 == 0 || w %3 == 0) { cout<<0; return; }
    res = min(h, w);
    auto foo = [](ll a, ll b) {
        ll ret = LONG_LONG_MAX;
        for (ll i = 1; i <= a-1; ++i) {
            ll x = i*b, y = b/2 * (a-i), z = (b+1)/2 * (a-i);
            ret = min(ret, max({ abs(x-y), abs(y-z), abs(x-z)}));
        }
        return ret;
    };
    res = min({res, foo(h,w), foo(w,h)});
    cout<<res;
}
void solve() {
}}
//=========================================================================
int main() {
    if (!dbg) { std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
    cout<<fixed<<setprecision(20); init(); solve(); return 0;
}


Measured memory_bytes: 256
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

using namespace std;

int main(void) {

	char s[12], y[5], m[3], d[3];
    scanf("%s", s);

    REP(i, 0, 4) y[i] = s[i];

    REP(i, 5, 7) m[i - 5] = s[i];

    REP(i, 8, 10) d[i - 8] = s[i];

    int year = atoi(y);
    int month = atoi(m);
    int day = atoi(d);

    if ( year > 2019 ) puts("TBD");
    else if ( year < 2019 ) puts("Heisei");
    else if ( month > 4 ) puts("TBD");
    else if ( month <= 4 ) puts("Heisei");

	return 0;
}


Measured memory_bytes: 256
#  Copyright: this code was written at 2020. for AtCoder by Silviase
import itertools

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
cnt1,fin = 0,False
cntp, cntq = 0, 0
listn = [(i + 1) for i in range(n)]
for x in itertools.permutations(listn):
    fin = False
    cntp += 1
    for i in range(n):
        if x[i] != p[i]:
            fin = True
    if not fin:
        break

for x in itertools.permutations(listn):
    fin = False
    cntq += 1
    for j in range(n):
        if x[j] != q[j]:
            fin = True
    if not fin:
        break
print(str(abs(cntp - cntq)))


Measured memory_bytes: 40688
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
const int MAX_L = 10000;
int q;

string data[MAX_N][2];
ll mem[MAX_L][MAX_L];

ll eval(string &s1, string &s2, int i, int j){
	int ii = i - 1;
	int jj = j - 1;
	if (ii == -1 || jj == -1) return 0;
	if (s1[ii] == s2[jj]) return mem[i - 1][j - 1] + 1;
	if (s1[ii] != s2[jj]) return max(mem[i - 1][j], mem[i][j - 1]);
	throw "exception";
}

ll solve(string s1, string s2){

	int L1 = s1.size();
	int L2 = s2.size();
	rep(i, L1 + 1){
		rep(j, L2 + 1)
		{
			mem[i][j] = eval(s1, s2, i, j);
		}
	}

	return mem[L1][L2];
}

int main() {

	cin >> q;
	rep(i, q){
		cin >> data[i][0];
		cin >> data[i][1];
	}

	rep(i, q){
		cout << solve(data[i][0], data[i][1]) << endl;
	}
}

Measured memory_bytes: 30488
def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))
 
mod = 2019
S = input()
 
checklist = [0] * mod
checklist[0] = 1
ans = 0
obs = 1
now = 0
for i in range(len(S)-1, -1, -1):
    now = (now + int(S[i]) * obs) % mod
    obs = (obs*10)%mod
    ans += checklist[now]
    checklist[now] += 1
 
print(ans)

Measured memory_bytes: 9196
import java.util.*;
import java.io.*;
public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
		int n = Integer.parseInt(reader.readLine());
		char[] list = reader.readLine().toCharArray();
		int clip = 0;
		for(int i = 0;i<n;i++){
			if(list[i]=='1') clip++;
		}
		int[][] rems = new int[2][n+1];
		ArrayList<Integer> l = new ArrayList<>();
		l.add(-1);
		l.add(1);	
      	if(clip==1)
        {
          for(int i=0;i<n;i++)
          {
            if(list[i]=='1')
              	writer.write(0+"\n");
            else
            {
              if(list[n-1]=='1')
                    writer.write(2+"\n");
                else{
                    if(i==n-1)
                        writer.write(2+"\n");
                    else
                        writer.write(1+"\n");
                    }
            }
          }
        }
      else{
		for(int i=0;i<2;i++){
			int temp = clip + l.get(i);
			for(int j = 0;j<=n;j++){
				if(temp==0){
					rems[i][j] = 0;
					continue;
				}
				if(j==0) rems[i][j] = 1%temp;
				else rems[i][j] = (rems[i][j-1]*2)%temp;
			}
		}
		int[] remlist = new int[2];
		for(int i = 0;i<2;i++){
			int temp = clip + l.get(i);
			for(int j = 0;j<n;j++){
				if(list[j]=='1'){
					remlist[i] = (remlist[i]+rems[i][n-j-1])%temp; 
				}
			}
		}
		for(int i = 0;i<n;i++){
			if(list[i]=='1'){
				if(clip==1){
					writer.write(0+"\n");
					continue;
				}
				int lp = ((remlist[0] - rems[0][n-i-1]) + (clip-1))%(clip-1);
				writer.write((1+solve(lp))+"\n"); 
			}
			else{
				int lp = (remlist[1] + rems[1][n-i-1])%(clip+1);
				writer.write((1+solve(lp))+"\n");	
			}
		}}
		writer.flush();
	}
	public static int solve(int p){
		if(p==0) return 0;
		int temp = p;
		int cnt = 0;
		while(p>0){
			if(p%2==1) cnt++;
			p=p>>1;
		}
		if(cnt==0) return 1; 
		return 1 + solve(temp%cnt);
	}
}

Measured memory_bytes: 50348
import java.util.Scanner;


public class Main {


	public static void main(String[] args) {

//		long ans = 0;
		int ans = 0;
//		String ans = "";

		Scanner sc = new Scanner(System.in);


//		long n = sc.nextLong();
//		long m = sc.nextLong();

//		int n = sc.nextInt();
//		int m = sc.nextInt();
//		int k = sc.nextInt();
//		int v = sc.nextInt();
//		String s = sc.next();


		String string = sc.next();
//		StringBuilder s = new StringBuilder(string);
		String string2 = sc.next();
//		StringBuilder s2 = new StringBuilder(string);

		boolean f = false;

//		String[] s = new String[n];
//		int[] a = new int[n];
//		long[] a = new long[n];

//		int[][] a = new int[n][m];


//		for (int i = 0; i < h; i++) {
//			for(int j = 0; j < w; j++) {
//				a[i][j] = sc.nextInt();
//			}
//		}

//		for (int i = 0; i < n; i++) {
//			a[i] = sc.nextLong();
//		}


//		if() {
//
//		} else {
//
//		}

		String ans2 = string2 + string;


		System.out.println(ans2);

		sc.close();
	}


}

Measured memory_bytes: 21844
#include<stdio.h>
int main(){
	int x;
	int n;
	long int max=-1000000;
	long int min=1000000;
	long long int sum=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&x);
		if(max<x)max = x;
		if(min>x)min = x;
		sum += x;
	}
	printf("%d %d %lld\n",min,max,sum);
	return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	double s[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>s[i];
	}
	sort(s+1,s+n+1);
	for(int i=2;i<=n;i++)
	{
		s[i]=(s[i]+s[i-1])*1.0/2;
	}
	cout<<s[n];
	return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll n;cin >>n;
    map<string,int> mp;
    for (int i = 0; i < n; ++i) {
        string s;cin >>s;
        mp[s]++;
    }
    ll m;cin >>m;
    for (int i = 0; i < m; ++i) {
        string t;cin >>t;
        mp[t]--;
    }
    int ans=0;
    for(auto u:mp){
        ans=max(ans,u.second);
    }
    cout <<ans <<endl;
    return 0;
}

Measured memory_bytes: 256