akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
#define np basic_string::npos

#define MAX 1000
bool pr[MAX];
void era(){
    for(int i=0;i<MAX;i++) pr[i]=true;
    pr[0]=false;
    pr[1]=false;
      
    for(int i=0;i*i<MAX;i++){
        if(pr[i]){
            for(int j=i*i;j<=MAX;j=j+i){
                pr[j]=false;
            }
        }
    }
}

int main(void){
    ll n,ans=1;
    era();
    cin>>n;
    vector<ll> tb(1001);
    for(int i=0;i<1000;i++){
        if(pr[i]){
            //cout<<i<<endl;
            int nn=n;
            while(nn){
                nn/=i;
                tb[i]+=nn;
                //cout<<"!"<<endl;
            }
        }
    }
    for(int i=1;i<=n;i++){
        ans*=(tb[i]+1);
        ans%=1000000007;
        //cout<<i<<" "<<ans<<endl;
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	int n,m,s=0,i,t;
	scanf("%d%d",&n,&m);
	for(i=0;i<m;i++)
	{
		scanf("%d",&t);
		s+=t;
		if(s>n)
		{
			printf("-1");
			return 0;
		}
	}
	printf("%d",n-s);
	return 0;
}

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

using   ll=long long;
using   ld=long double;

using namespace std;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define pll         	pair<ll,ll>
#define vec     		vector<ll>
#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define linf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007

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

ll mod_inverse(ll a)
{
	return mod_pow(a,mod-2);
}

void solve()
{
	ll x ;
	
	cin>>x;
	
	for(ll i=-1000;i<=1000;i++)
	{
		for(ll j=-1000;j<=1000;j++)
		{
			ll diff = pow(i,5) - pow(j,5);
			
			if(diff == x)
			{
				cout<<i<<" "<<j;
				return;
			}
		}
	}
}

signed main()
{
 
    fast;
 
    ll t;
    
    t=1;
    
    //cin>>t;
    
    while(t--)
    {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 4100
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

ll solve(string s, int k) {
    ll n = s.size();
    if (n < k) return 0;

    ll ans = 0;

    if (k == 1) {
        ans += s[0] - '0';
        ans += (n - 1) * 9;
    } else if (k == 2) {
        ans += (s[0] - '0' - 1) * 9 * (n - 1);
        ans += 81 * (n - 1) * (n - 2) / 2;
        string t = s.substr(1, n - 1);
        while (t.size() > 0 && t[0] == '0') t = t.substr(1, t.size() - 1);
        ans += solve(t, 1);
    } else if (k == 3) {
        ans += (s[0] - '0' - 1) * 81 * (n - 1) * (n - 2) / 2;
        ans += 729 * (n - 1) * (n - 2) * (n - 3) / 6;
        string t = s.substr(1, n - 1);
        while (t.size() > 0 && t[0] == '0') t = t.substr(1, t.size() - 1);
        ans += solve(t, 2);
    }

    return ans;
}

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

    string n;
    int k;
    cin >> n >> k;

    solve(n, k);

    cout << solve(n, k) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n,k;
  if(scanf("%d%d",&n,&k)==1){}
  int i,tmp;
  int count=0;
  for(i=0;i<n;i++){
    if(scanf("%d",&tmp)==1){}
    if(tmp>=k){count++;}
  }
  printf("%d",count);
  return 0;
}

Measured memory_bytes: 128
inf = float('inf')
# ベルマンフォード法 計算量(VE)
# [引数]: 隣接リスト, 始点, 終点
class Bellmanford:
    def __init__(self, to:list, start:int, goal:int):
        self.N = len(to)
        self.to = [s[:] for s in to]
        self.start = start
        self.goal = goal
        self.dist = [inf] * self.N
        self.dist[start] = 0
        self.exists_negative_cycle = False
        self.exists_negative_cycle_stog = False
        self.is_updated = [False] * self.N

    # distを更新
    def update(self) -> None:
        for _ in range(self.N - 1):
            for v, s in enumerate(self.to):
                if not s: continue
                for nv, w in s:
                    if self.dist[nv] > self.dist[v] + w:
                        self.dist[nv] = self.dist[v] + w

    # グラフの負閉路検出
    def detection(self) -> bool:
        for v, s in enumerate(self.to):
            if not s: continue
            for nv, w in s:
                if self.dist[nv] > self.dist[v] + w:
                    self.dist[nv] = self.dist[v] + w
                    self.exists_negative_cycle = True
        return self.exists_negative_cycle

    # スタートからゴールまでのパスの負閉路検出
    def detection_stog(self) -> bool:
        for _ in range(self.N):
            for v, s in enumerate(self.to):
                if not s: continue
                for nv, w in s:
                    if self.dist[nv] > self.dist[v] + w:
                        self.dist[nv] = self.dist[v] + w
                        self.is_updated[nv] = True
                    if self.is_updated[v] is True:
                        self.is_updated[nv] = True
        self.exists_negative_cycle_stog = self.is_updated[self.goal]
        return self.exists_negative_cycle_stog

N, M, r = map(int,input().split())
to = [[] for _ in range(N)]
for _ in range(M):
    s, t, d = map(int,input().split())
    to[s].append((t, d))

BF = Bellmanford(to, r, -1)
BF.update()

if BF.detection():
    print("NEGATIVE CYCLE")
else:
    for d in BF.dist:
        if d == inf:
            print("INF")
        else:
            print(d)


Measured memory_bytes: 6252
n=int(input())
l=[]
for i in range(n):
        city,point = input().split()
        point=int(point)
        l.append([city,-point,i+1])

l=sorted(l, key = lambda x: (x[1]))
l=sorted(l, key = lambda x: (x[0]))

for i in range(n):
        print(l[i][2])

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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
    int cnt=0;
    int idx=0;
    while(idx<n-1) {
        if(p[idx]==idx){
            cnt++;
            swap(p[idx],p[idx+1]);
        }
        idx++;
    }
    if(p[n-1]==n-1) cnt++;
    cout << cnt << "\n";

    return 0;
}

Measured memory_bytes: 3728
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
  int N, K;
  std::cin >> N >> K;
  std::vector<int> H(N);
  for (int i = 0; i < N; i++) std::cin >> H.at(i);
  sort(H.begin(), H.end());
  reverse(H.begin(), H.end());
  long ans = 0;
  for (int i = K; i < N; i++) ans += H.at(i);
  std::cout << ans << std::endl;
}


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

using namespace std;

const int max_n = 10111, inf = 1000111222;

int n, k, a[max_n];
long long ans;
vector<long long> v;

bool get_bit(long long x, int pos) {
    return (x >> pos) & 1;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        long long sum = 0;
        for (int j = i; j < n; ++j) {
            sum += a[j];
            v.push_back(sum);
        }
    }
    for (int b = 55; b >= 0; --b) {
        int cnt = 0;
        for (long long x : v) {
            if ((x & ans) == ans) {
                cnt += get_bit(x, b);
            }
        }
        if (cnt >= k) {
            ans += 1LL << b;
        }
    }
    cout << ans << endl;
    return 0;
}


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

#define endl "\n"
#define f first
#define s second
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ll long long
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const ll M = 998244353;
const int N = 1e5+5;
const int K = 3000;
const ll INF = 1e18;
const double EPS = 1e-6;

string s;
ll n,a[N],b[N],c[N],cnt,mx,mn;
map <ll,int> m, z;
vector <ll> v;

int main () {
	faster
	cin>>n;
	for (int i = 1; i<=n; i++) {
		cin>>a[i];
		if (m[a[i]] == 0) {
			cnt++;
			m[a[i]]++;
			v.pb(a[i]);
		}
	}
	if (cnt>2) {
		cout<<"No";
		return 0;
	}
	if (v.size() == 1) {
		if (v[0]*2 <= n || v[0] == n-1) cout<<"Yes";
		else cout<<"No";
		return 0;
	}
	ll q = v[0], w = v[1];
	if (q>w) swap(q,w);
	for (int i = 1; i<=n; i++) {
		if (a[i] == q) mn++;
		else mx++;
	}
	if (q >= mn && 2*(w - mn) <= mx) {
		cout<<"Yes";
	}
	else cout<<"No";

    return 0;
}


Measured memory_bytes: 8052
char buf[2<<20],out[6];
sz;
cnt[1<<20];
main()
{
	read(0,buf,2<<20);
	int N=0;
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(int i=0;i<N;i++)
	{
		int A=0;
		for(;;)
		{
			char k=buf[sz++];
			if(k<'0')break;
			A=A*10+k-'0';
		}
		cnt[A]++;
	}
	int ans=0;
	for(int i=1;i<=1000000;i++)
	{
		if(cnt[i])
		{
			ans+=cnt[i]<2;
			for(int j=i+i;j<=1000000;j+=i)cnt[j]=0;
		}
	}
	int osz=6;
	do{
		out[--osz]=ans%10+'0';
	}while(ans/=10);
	write(1,out+osz,6-osz);
}


Measured memory_bytes: 6600
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(H: int, W: int):
    if H == 1 or W == 1:
        ret = 1
    else:
        ret = ((W + 1) // 2) * ((H + 1) // 2) + (W // 2) * (H // 2)
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    solve(H, W)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;


int main(){
    int n;
    cin>>n;
    ll ans=0;
    rep(i,n){
        ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef long long int lli;

int main(){
	string s;
	cin >> s;
	int n = s.length();
	for(int i=0; i<n; i++){
		for(int j=i; j<n; j++){
			if(s.substr(0,i) +s.substr(j,n-j+1) == "keyence"){
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
    int N, a, count = 0, ans = 0;
    cin >> N;
    for (int i = 1; i <= N; i ++){
        cin >> a;
        if(a == i){
            count += 1;
        }else{
            ans += (count + 1) / 2;
            count = 0;
        }
    }
    ans += (count + 1) / 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char c;
	scanf("%c", &c);
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
		printf("vowel");
	}
	else{
		printf("consonant");
	}



	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

bool f(int v, int* a, int n){
	if(v == 0) return true;
	if(v<0 || n==0) return false;
	return f(v-a[n-1], a, n-1)||f(v,a,n-1);
}

int main(){
	int n,m;
	int a[30],v[300];
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf(" %d",&a[i]);
	}
	scanf("%d", &m);
	for(int i=0;i<m;i++){
		scanf(" %d", &v[i]);
	}
	for(int i=0;i<m;i++){
		if( f(v[i], a, n) ){
			printf("yes\n");
		} else {
			printf("no\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1168
#include <iostream>
#include <fstream>
#include <utility>
#include <queue>
#include <vector>
#include <array>
#include <stack>
#include <list>
#include <map>
#include <unordered_set>
#include <set>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <cmath>

using namespace std;

typedef long long ll;

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

string s;
int n, dp[6000][6000], dq[6000][6000];

int rec(int l1, int l2) {
	if (l1 >= n || l2 >= n) return 0;
	if (dq[l1][l2] == 0) {
		if (s[l1] == s[l2]) dp[l1][l2] = min(abs(l1 - l2), rec(l1 + 1, l2 + 1) + 1);
		dq[l1][l2] = 1;
	}
	return dp[l1][l2];
}

int main() {
	cin >> n >> s;
	int r = 0;
	rep(i, n)rep(j, n)r = max(r, rec(i, j));
	cout << r << endl;
}

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

void myPrint(string str, int a, int b){
	for(int i = a; i <= b; i++ ){
		cout<<str[i];
	}
	cout<<endl;
}
string reverse(string str,int a,int b){
	string temp = str;
	for(int i = 0; i <= (b-a) ; i++){
		str[a+i] = temp[b-i];
	}
	return str;
}

string replace(string str,int a,int b, string repStr){
	for(int i = 0; i <= (b-a) ; i++){
		str[a+i] = repStr[i];
	}
	return str;
}


int main()
{
	string str;
	string commandStr;
	string repStr;
	int itterNum;
	int a,b;
	cin>>str;
	cin>>itterNum;
	for(int i = 0; i < itterNum; i++){
		cin>>commandStr;
		if(commandStr == "print"){
			cin>>a>>b;
			myPrint(str,a,b);
		}else if(commandStr == "replace"){
			cin>>a>>b>>repStr;
			str = replace(str,a,b,repStr);
		}else if(commandStr == "reverse"){
			cin>>a>>b;
			str = reverse(str,a,b);
		}
	}
	return 0;
}

Measured memory_bytes: 3144
#include <iostream>
#include <cstdio>
#include <list>
using namespace std; 

int main(){
    long long n;
    cin >> n;

    list<long long> a;

    for(long long i = 0; i < n; i++){
        long long x;
        cin >> x;
        if(i%2 == 0){
            a.push_back(x);
        }
        else{
            a.push_front(x);
        }

    }
    if(n % 2 == 1){
        a.reverse();
    }

    list<long long>::iterator it;
    for(it = a.begin(); it != a.end(); it++){
       printf("%lld ", *it);
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 8448
// abc.087 C - Candies

#include <bits/stdc++.h>
using namespace std;

int main( void ) {
    int n;
    cin >> n;
    vector<int> a1( n ), a2( n );
    for( int i = 0; i < n; i++ ) {
        cin >> a1.at( i );
    }
    for( int i = 0; i < n; i++ ) {
        cin >> a2.at( i );
    }
    int sum = 0, asum = 0, ans = 0;
    for( int i = 0; i < n; i++ ) {
        sum = 0;
        asum += a1.at( i );
        sum += asum;
        for( int j = i; j < n; j++ ) {
            sum += a2.at( j );
        }
        ans = max( ans, sum );
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main(){
  string S;
  cin >> S;
  int total = 0;
  for(int i = 0;i < 4;i++){
    if(S.substr(i,1) == "+"){
      total++;
    }
    else if(S.substr(i,1)=="-"){
      total--;
    }
  }

  cout << total << endl;
}


Measured memory_bytes: 256
import numpy as np
import itertools
N, M, X = (int(i) for i in input().split())
Y = np.zeros((N, M+1))
for i in range(N):
    Y[i,:] = [int(i) for i in input().split()]
C = Y[:,0]
A = np.matrix(Y[:,1:])
res = np.inf
f = '0'+str(N)+'b'
for i in range(2**N):
    z = np.array([int(s) for s in list(format(i, f))])
    cost = z @ C
    skill = z * A
    if (skill >= X).all() and (cost < res):
        res = cost
if np.isinf(res):
    print(-1)
else:
    print(int(res))

Measured memory_bytes: 27308
import java.util.Scanner;

class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   long N = sc.nextLong();
   int K = sc.nextInt();

   for(int i=0;;i++){
    if((Math.pow(K, i))>N){
    System.out.println(i);
      break;
    }
   }
 
 }
}


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

sum = 0
for i in range(N):
    li = []
    li = list(input().split())
    #print(li)
    if(str(li[1]) == "JPY"):
        sum += float(li[0])
    elif(str(li[1]) == "BTC"):
        sum += float(li[0])*380000

print(sum)

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

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

int a, b, c;

int main() {
  cin >> a >> b >> c;
  if(c > a + b) cout << 2 * b + a + 1;
  else cout << c + b;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
import copy

sys.setrecursionlimit(1000000)

# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

A, B, C = map(int, input().split())

if A > B:
    A, B = B, A

print("Yes" if A < C and C < B else "No")


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

main()
{
    int n; cin>>n;
    vector<int> a(n);
    for(int &x:a) cin>>x;
    sort(rbegin(a), rend(a));
    int m=n-2;
    long long ans=a[0];
    for(int i=1; i<n and m>0; i++)
    {
        if(m>1)
        {
            ans+=a[i]*2;
            m-=2;
        }
        else
        {
            ans+=a[i];
            m=0;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 4048
/*3.2 hightierra*/
#include <stdio.h>
 
int main(void){
    //変数の定義
    int N,amari;
    scanf("%d",&N);
    //iにNの１の位を代入
    amari = N % 10;
 
    //iの値で場合わけ
    switch(amari){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
          printf("hon");
          break;
        case 0:
        case 1:
        case 6:
        case 8:
          printf("pon");
          break;
        case 3:
          printf("bon");
          break;
    }
    return 0;
}

Measured memory_bytes: 1716
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello
{

    public static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        string ans = "Impossible";
        if (int.Parse(s[0]) % 3 == 0) ans = "Possible";
        else if (int.Parse(s[1]) % 3 == 0) ans = "Possible";
        else if ((int.Parse(s[0]) + int.Parse(s[1])) % 3 == 0) ans = "Possible";
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	string s;
	cin>>s;
	int out=inf;
	rep(i,26){
		int ma=0,co=0;
		rep(j,s.size()){
			if(s[s.size()-1-j]-'a'==i){
				ma=max(ma,co);
				co=0;
			}else co++;
		}
		ma=max(ma,co);
		out=min(out,ma);
	}
	cout<<out<<endl;
}










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

using namespace std;
//typedef long long ll;
typedef unsigned long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;


int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll ans = (b / c) - (a / c);
    if (a % c == 0) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 256
def main():
    N=int(input())
    a=list(map(int,input().split()))
    table=[0]*N
    result=0
    result_li=[]
    for i in range(N):
        i=N-i
        count=0
        for j in range(i,N+1,i):
            count+=table[j-1]
        if count%2==a[i-1]:
            pass
        else:
            table[i-1]=1
            result+=1
    for i in range(N):
        if table[i]==1:
            result_li.append(i+1)
    print(result)
    if len(result_li)>=1:
        print(" ".join(map(str,result_li)))

if __name__=="__main__":
    main()

Measured memory_bytes: 20536
#include<iostream>

int main(){
    char c[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            std::cin >> c[i][j];
        }
    }
    for(int i = 0; i < 3; i++){
        std::cout << c[i][i];
    }
    std::cout << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

struct Q {
    char c, d;
};

int main() {
    int n, q;
    string s;
    cin >> n >> q >> s;

    vector<Q> queries(q);
    for (Q &query : queries) cin >> query.c >> query.d;


    auto check_l = [&](int i) -> bool {
        int now = i;
        for (Q query : queries) {
            if (s[now] == query.c) {
                if (query.d == 'L') now--;
                else now++;
            }
            if(now == n) return true;
            if (now == -1) return false;
        }
        return true;
    };

    auto check_r = [&](int i) -> bool {
        int now = i;
        for (Q query : queries) {
            if (s[now] == query.c) {
                if (query.d == 'L') now--;
                else now++;
            }
            if (now == n) return false;
            if(now == -1) return true;
        }
        return true;
    };

    if (!check_r(0) || !check_l(n - 1)) {
        cout << 0 << endl;
        ret();
    }

    auto find_l = [&]() -> int {
        int floor = 0, ceil = n;
        while (floor + 1 < ceil) {
            int mid = (floor + ceil) / 2;
            bool ok = check_l(mid);
            if (!ok) floor = mid;
            else ceil = mid;
        }
        return ceil;
    };

    auto find_r = [&]() -> int {
        int floor = 0, ceil = n;
        while (floor + 1 < ceil) {
            int mid = (floor + ceil) / 2;
            bool ok = check_r(mid);
            if (ok) floor = mid;
            else ceil = mid;
        }
        return floor;
    };

    int l = find_l();
    int r = find_r();

    int ans = r - l + 1;
    cout << ans << endl;

}


Measured memory_bytes: 3872
#include<stdio.h>
#include<string.h>
#define MAX(x,y) ((x>y)?x:y)
int count(int n,int r){
	int i,m=0;
	for(i=0;i<r;i++)
		if(!((n&(1<<i))^(1<<i)))m++;
	return m;
}
int main(){
	int r,c,i,j,k,a[10005],ans,x,y;
	FILE *fp;
	//fp=fopen("test.txt","r");
	fp=stdin;
	while(1){
		fscanf(fp,"%d%d",&r,&c);
		if(r==0 && c==0)break;
		memset(a,0,sizeof(a));
		for(i=0;i<r;i++){
			for(j=0;j<c;j++){
				fscanf(fp,"%d",&k);
				if(k==1)a[j]+=1<<i;
			}
		}
		ans=0;
		for(i=0;i<1<<r;i++){
			x=0;
			for(j=0;j<c;j++){
				y=count(i^a[j],r);
				x+=MAX(r-y,y);
			}
			ans=MAX(ans,x);
		}
		printf("%d\n",ans);
	}
	fclose(fp);
	return 0;
}

Measured memory_bytes: 456
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long inf=1e9;
const double pi = 3.1415926535897932384626433832795;
int main(){
	int N; cin>>N;
	deque<pair<double,pair<long,long>>> vp;
	rep(i,0,N){
		long x,y; cin>>x>>y;
		if(x == 0 && y == 0) continue;
		vp.push_back({atan2(y, x), {x, y}});
	}sort(vp.begin(), vp.end());
	int n = vp.size();
	rep(i,0,n){
		vp.push_back(vp[i]);
		vp.back().first += 2 * pi;
	}
	long ans = 0;
	rep(i,0,vp.size()){
		long x = 0, y = 0;
		rep(j,i,vp.size()){
			if(vp[j].first <= vp[i].first + pi){
				x += vp[j].second.first;
				y += vp[j].second.second;
			}ans = max(ans, x * x + y * y);
		}
	}
    cout.precision(15);
    cout<<fixed<<sqrt(ans)<<endl;
}

Measured memory_bytes: 384
import sys
input_num = input().split()
N = int(input_num[0])
M = int(input_num[1])

AB = [input() for i in range(0, N + M)]
A = AB[0: N]
B = AB[N:]

diff = N - M
matches = []
for i in range(0, diff+1):
    l = 0
    while N - l > diff:
        index = A[i][l:].find(B[0])
        if index != -1 and i <= diff:
            matches.append((index, l, i))
        l += 1
if len(matches) == 0:
    print("No")
    sys.exit()
count_no = []
for m, l, i in matches:
    for a, b in zip(A[i:], B):
        if a[l:].find(b) != m:
            count_no.append(0)
            break
if len(count_no) == len(matches):
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
    int n,a,b;
    scanf("%d",&n);
    if(n==1){
        printf("Hello World\n");
    }
    else if(n==2){
        scanf("%d %d",&a,&b);
        printf("%d\n",a+b);
    }
    return 0;
}

Measured memory_bytes: 128
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	
	a := ScanInt(scanner)
	b := ScanInt(scanner)
	c := ScanInt(scanner)
	d := ScanInt(scanner)
	
	fmt.Println(Min(a, b) + Min(c, d))
}

func ScanInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func ScanFloat64(scanner *bufio.Scanner) float64 {
	scanner.Scan()
	f, e := strconv.ParseFloat(scanner.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func ScanText(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func Max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Abs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}
 

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(),(v).end()
#define out(a) cout << (a) << endl
using namespace std;
using ll = long long;
int main(){
    int n, i;
    cin >> n >> i;
    out(n-i+1);
}

Measured memory_bytes: 256
#include "stdio.h"
int main() {
	long a, b, ans;
	scanf("%lu%lu", &a, &b);
	ans = a * b;
 	long ii = a < b ? a : b;
	for (long i = a < b ? a : b; i >= 2; i--) {
		if (a % i == 0 && b % i == 0) {
			a /= i;
			b /= i;
			ans /= i;
		}
	}
	printf("%lu", ans);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  vector<int>vec(N);
  vector<int>v(N);
  for(int X=0;X<N;X++){
    cin>>vec.at(X);
    v[vec.at(X)-1]=X+1;
  }
  for(int X=0;X<N;X++){
    if(X==N-1){
      cout<<v.at(X)<<endl;
    }
    else{
      cout<<v.at(X)<<" ";
    }
  }
}


Measured memory_bytes: 3992
n,k = map(int,input().split())

pi = [0 for _ in range(n)]
si = [0 for _ in range(n)]

pi = [int(s) for s in input().split()]
pi = [(1+s)/2 for s in pi]

si[0] = pi[0]
for i in range(1,n):
    si[i] = si[i-1] + pi[i]

#print(pi)
#print(si)
#print(si[2]-si[0])

ans = 0
if not (n==k):
    for i in range(n-k):
        ans = max(si[i+k]-si[i],ans)
else:
    ans = si[n-1]

print(float(ans))

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

#define int long long
#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cps CLOCKS_PER_SEC
#define mod (long long)1000000007
#define f first
#define s second
#define debug1(x) cerr<<x<<"\n"
#define debug2(x,y) cerr<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cerr<<x<<" "<<y<<" "<<z<<"\n"
#define nl cerr<<"\n";
#define pq priority_queue
#define inf 0x3f3f3f3f
#define test cerr<<"abcd\n";
#define pi pair<int,int>
#define pii pair<int,pi>
#define pb push_back
#define mxn 500005

vector<int> g[mxn];
int n,k;


int f[mxn],fi[mxn];

int modexp(int a,int n,int m=mod){
    int r=1LL;
    while(n){
        if(n&1)
            r=(r*a)%m;
        a=(a*a)%m;
        n>>=1LL;
    }
    return r;
}

int inv(int a){
    return modexp(a,mod-2);
}

void comb(){
    f[0]=f[1]=fi[0]=fi[1]=1LL;
    for(int i=2LL; i<mxn; ++i)
        f[i]=(1LL*f[i-1]*i)%mod;
    int temp=inv(f[mxn-1]);
    for(int i=mxn-1; i>1; --i){
        fi[i]=temp;
        temp=(temp*i)%mod;
    }
}

int npr(int n,int r){
    if(n<r||r<0||n<0)
        return 0;
    return (1LL*f[n]*fi[n-r])%mod;
}

int ans=1;

void dfs(int x=1,int par=0,int lev=0){
    if(lev==0){
        ans=(1LL*ans*k)%mod;
        ans=(1LL*ans*npr(k-1,g[x].size()))%mod;
    }
    else
        ans=(1LL*ans*npr(k-2,g[x].size()-1))%mod;
    for(auto &it:g[x])
        if(it!=par)
            dfs(it,x,lev+1);
}

int32_t main(){
sp;

    comb();
    cin>>n>>k;
    if(n==1){
        cout<<k;
        return 0;
    }
    for(int i=1; i<n; ++i){
        int x,y;
        cin>>x>>y;
        g[x].pb(y);
        g[y].pb(x);
    }
    dfs();
    cout<<ans<<"\n";
    return 0;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl

const int MOD = 1000000007;

inline void add(int &a, int b) {
    a += b;
    if (a >= MOD) {
       a -= MOD;
   }
}

inline void sub(int &a, int b) {
    a -= b;
    if (a < 0) {
       a += MOD;
   }
}

inline int mul(int a, int b) {
    return (long long) a * b % MOD;
}

inline int power(int a, int b) {
    int res = 1;

    while (b > 0) {
        if (b & 1) res = mul(res, a);
        b >>= 1;
        a = mul(a, a);
    }

    return res;
}

inline int inverse(int x) {
    return power(x, MOD - 2);
}

const int MX = 200010;
ll inv[MX], fact[MX], ifact[MX];

void init() {
    inv[1] = 1;
    for (int i = 2; i < MX; ++i) {
        inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
    }
    fact[0] = ifact[0] = 1;
    for (int i = 1; i < MX; ++i) {
        fact[i] = fact[i-1] * i % MOD;
        ifact[i] = ifact[i-1] * inv[i] % MOD;
    }
}

ll comb(int n, int r) {
    if (n < 0 || r < 0 || r > n) return 0;
    return fact[n] * ifact[r] % MOD * ifact[n - r] % MOD;
}

const int MN = 3010;

ll dp[MN];

int main() {
	init();
	int H, W, N; cin >> H >> W >> N;
	vector<pii> vec;
	vec.eb(H-1, W-1);

	rep(i, N) {
		int r, c;
		cin >> r >> c;
		--r; --c;
		vec.eb(r, c);
	}
	sort(ALL(vec));

	for (int i = 0; i < (int)vec.size(); ++i) {
		int r = vec[i].fi, c = vec[i].se;
		dp[i] = comb(r + c, r);
		rep(j, i) {
			int r2 = vec[j].fi, c2 = vec[j].se;
			if (c2 <= c) {
				dp[i] -= dp[j] * comb(r + c - r2 - c2, r - r2);
				dp[i] %= MOD;
				if (dp[i] < 0) dp[i] += MOD;
			}
		}
	}

	cout << dp[(int)vec.size() - 1] << endl;

	return 0;
}

Measured memory_bytes: 4992
from functools import lru_cache

N, M, Q = map(int, input().split())

BCD = [[] for _ in range(N)]
for _ in range(Q):
    a, b, c, d = map(int, input().split())
    BCD[a - 1].append((b - a, c, d))

@lru_cache(maxsize=None)
def search(mi, A):
    if len(A) > N:
        return 0

    ret = 0
    for i in range(1, A[-1] + 1):
        ret = max(ret, search(i, A + (i,)))

    d = len(A)
    for b, c, d in BCD[N - d]:
        if A[-(b + 1)] - A[-1] == c:
            ret += d
    return ret

ans = 0
for i in range(1, M + 1):
    ans = max(ans, search(i, (i,)))
print(ans)


Measured memory_bytes: 109924
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n;i++)
#define ll long long
#include <bits/stdc++.h>
using namespace std;
 
  int main(){
    string a,b;cin>>a>>b;
    string s,t;
    if(stoi(a)<stoi(b))
    {
      for(int i=0;i<stoi(b);i++)
      {
        s+=a;
      }
      cout<<s;
    }
    else
    {
      for(int i=0;i<stoi(a);i++)
      {
        t+=b;
      }
      cout<<t;
    }
    
  }
    
    
      
    

Measured memory_bytes: 256
import sys
a,b,c,d,e,f=map(int,input().split())

if a>b:
    a, b = b, a

ans1 = a*100
ans2 = 0

for _a in range(f//(a*100) + 1):
    for _b in range((f - _a*100)//(b*100) + 1):
        
        max_sugar = min(f-(_a+_b)*100, (f-(_a+_b)*100)//100*e)
        
        for _c in range(max_sugar//c + 1):
            for _d in range((max_sugar-c*_c)//d + 1):
                if a*100*_a+b*100*_b+c*_c+d*_d == 0:
                    continue                
                if a*100*_a+b*100*_b+c*_c+d*_d > f:
                    break 
                    
                if (c*_c+d*_d)/(a*100*_a+b*100*_b+c*_c+d*_d) == e/(100+e):
                    print(a*100*_a+b*100*_b+c*_c+d*_d, c*_c+d*_d)
                    sys.exit(0)
                elif (c*_c+d*_d)/(a*100*_a+b*100*_b+c*_c+d*_d) > e/(100+e):
                    continue
                else:
                    if ans2/ans1 < (c*_c+d*_d)/(a*100*_a+b*100*_b+c*_c+d*_d):
                        ans1 = a*100*_a+b*100*_b+c*_c+d*_d
                        ans2 = c*_c+d*_d


else:
    print(ans1, ans2)


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	int N,K,Q;
	int A[100010]={};
	lint point[100010]={};

	cin >> N >> K >> Q;
	for(int i=0;i<Q;i++)
	{
		cin >> A[i];
		A[i]--;
	}

	for(int i=0;i<N;i++)
		point[i]=K;

	for(int i=0;i<Q;i++)
		point[A[i]]++;
	
	for(int i=0;i<N;i++)
	{
		if(point[i]-Q>0)
			cout << "Yes";
		else
			cout << "No";
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 1792
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl((ld)1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

bool solve(){
  ll a,b,c;cin>>a>>b>>c;
  ll ans=0;
  if(a%2==1 and b%2==0 and c%2==0){
    ans++;
    b++;c++;
  }
  if(a%2==0 and b%2==1 and c%2==0){
    ans++;
    a++;c++;
  }
  if(a%2==0 and b%2==0 and c%2==1){
    ans++;
    b++;a++;
  }
  if(a%2==1 and b%2==1 and c%2==0){
    ans++;
    a++;b++;
  }
  if(a%2==1 and b%2==0 and c%2==1){
    ans++;
    a++;c++;
  }
  if(a%2==0 and b%2==1 and c%2==1){
    ans++;
    b++;c++;
  }
  ans+=(max({a,b,c})-a)/2;
  ans+=(max({a,b,c})-b)/2;
  ans+=(max({a,b,c})-c)/2;

  cout<<ans<<endl;
  return false;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	return solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define PI acos(-1)
#define ll long long int
#define MOD (int) (1e9+7)
#define in_arr(ar) for(int i=0;i<sizeof(ar)/sizeof(ar[0]);i++)cin>>ar[i];
#define val(x) cout<<"Value of "<<(#x)<<" is "<<x<<endl;
 
 
 
int main()
{
	long double a,b;
	cin>>a>>b;
	ll fao = (double)a*b;
	cout<<fao<<endl;
}

Measured memory_bytes: 3796
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy

## input

# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))

N,K = map(int,input().split()) 

ans = float(0)

if K <= N:
    ans += (N-K+1)/N
    X = K
else:
    X = N+1

for i in range(1,X):
    tmp = float(1/N)
    tmp2 = i
    while tmp2 < K:
        tmp2 *= 2
        tmp /= 2
    ans += tmp

print(ans)

Measured memory_bytes: 77684
from bisect import bisect_left, bisect_right
import random
def is_prime(q,k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
 
    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

prime = []
like = [3]
for i in range(3, 10**5+1):
    if is_prime(i):
        prime.append(i)
p_set = set(prime)
for i in prime:
    if (i+1)//2 in p_set:
        like.append(i)

Q = int(input())

for _ in range(Q):
    l, r = map(int,input().split())
    print(bisect_right(like, r) - bisect_left(like, l))

Measured memory_bytes: 88884
import java.util.*;

public class Main{

	static int[][] tou1 = new int[3][10];
	static int[][] tou2 = new int[3][10];
	static int[][] tou3 = new int[3][10];
	static int[][] tou4 = new int[3][10];
	
	static void Output(int[][] tou,int last){
		for(int x = 0 ; x < 3 ; x++){
			for(int y = 0; y < 10 ; y++){
				System.out.print(" " + tou[x][y]);
			}
			System.out.println();
		}
		for(int i = 0 ; i < 20 ; i++){
			if(last == 1){break;}
			System.out.print("#");
		}
		if (last != 1) {
			System.out.println();
		}
		
	}
	
	static void Jouhou(int b,int f,int r,int v){
		switch(b){ 
		case 1: tou1[f-1][r-1]=tou1[f-1][r-1]+v;	break;
		case 2: tou2[f-1][r-1]=tou2[f-1][r-1]+v;	break;
		case 3: tou3[f-1][r-1]=tou3[f-1][r-1]+v;	break;
		case 4: tou4[f-1][r-1]=tou4[f-1][r-1]+v;	break;
		}
	}
	
	
	static void Input(){
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		for(int i = 0; i < N ; i++){
			int b = scanner.nextInt();
			int f = scanner.nextInt();
			int r = scanner.nextInt();
			int v = scanner.nextInt();
			Jouhou(b, f, r, v);
		}
		scanner.close();
		
	}
	
	public static void main(String[] args) {
		Input();
		
		Output(tou1, 0);
		Output(tou2, 0);
		Output(tou3, 0);
		Output(tou4, 1);
	}

}

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

long long n, x;

vector<long long> brg;
vector<long long> pa;

long long solve(long long n, long long x){
  if(n == 0) return 1;
  if(x <= 1) return 0;
   
  if(x <= brg.at(n-1) + 1) return solve(n-1, x-1);
  if(x == brg.at(n-1) + 2) return pa.at(n-1) + 1;
  if(x <= 2 * brg.at(n-1) + 2) return solve(n-1, x-brg.at(n-1)-2) + pa.at(n-1) + 1;
  return pa.at(n-1) * 2 + 1;
}

int main(){
  cin >> n >> x;
  
  brg.resize(n+1);
  pa.resize(n+1);
  brg.at(0) = 1;
  pa.at(0) = 1;
  for(int i = 1; i < n+1; ++i){
    brg.at(i) = brg.at(i-1) * 2 + 3;
    pa.at(i) = pa.at(i-1) * 2 + 1;
  }
  
  cout << solve(n, x) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	cout << fixed << setprecision(10);
	ll L;
	cin >> L;
	ld ans = 1LL * L * L * L;
	ans /= 3.0;    
	ans /= 3.0;    
	ans /= 3.0;
	cout << ans << endl;    
	return 0;
}

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

int main(){
  long long A,V,B,W,T;
  cin >>A >>V >>B >>W >>T;
  bool can = false;
  
  if(V>W && ((double)abs(A-B))/(V-W)<=T){can = true;}
  //cout << ((double)abs(A-B))/(V-W) <<endl;
  
  if(can){cout << "YES" << endl;}
  else{cout << "NO" << endl;}
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int N;
	cin >> N;
	int cnt = 0;
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= i; j++) {
			if (i % j == 0) {
				cnt++;
			}
		}
		if (cnt == 8&&i%2==1) {
			ans++;
		}
		cnt = 0;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    X = int(input())

    if X == 1:
        print(1, 0)
        return

    ii = 2 if X % 2 else 1

    N = 10**9

    for x in range(1, N, ii):
        if X % x:
            continue
        for i in range(N):
            j = i - x

            ij = i**5 - j**5
            diff = ij - X
            if diff == 0:
                print(i, j)
                return
            elif j > 0 and diff > 0:
                break




if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9200
n,m,c = map(int,input().split())
b = list(map(int,input().split()))

cnt = 0

for i in range(n):
    a = list(map(int,input().split()))
    ab = [x*y for x,y in zip(a,b)]
    if sum(ab) + c > 0:
        cnt += 1
        
print(cnt)

Measured memory_bytes: 9136
#include<stdio.h>
int max(int a,int b);
int min(int a,int b);
int main(void){
	int a,i=1;
	do{
		scanf("%d",&a);
		if(a!=0)printf("Case %d: %d\n",i,a);
		i++;
	}while(a!=0);
	return 0;
}


Measured memory_bytes: 2036
N,M=map(int,input().split())
island=[[] for i in range(N)]
for j in range(M):
    c,d=map(int,input().split())
    island[d-1].append(c)
    island[c-1].append(d)
f = 0
for k in range(N):
    if 1 in island[k]:
        if N in island[k]:
            f += 1
            break
        else:
            pass
    else:
        pass
if f>0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 38336
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

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

        Map<Integer, String> map = new HashMap<>();
        Cell[][] bingo = new Cell[3][3];
        for (int y = 0; y < 3; y++) {
            for (int x = 0; x < 3; x++) {
                int number = scanner.nextInt();
                bingo[y][x] = new Cell(number);
                map.put(number, String.format("%s_%s", y, x));
            }
        }

        int execCount = scanner.nextInt();

        for (int i = 0; i < execCount; i++) {
            int hitNumber = scanner.nextInt();
            String point = map.get(hitNumber);
            if (point != null) {
                String[] yx = point.split("_");
                int y = Integer.parseInt(yx[0]);
                int x = Integer.parseInt(yx[1]);
                bingo[y][x].read = true;
            }
        }

        System.out.println(result(bingo) ? "Yes" : "No");
    }

    static boolean result(Cell[][] bingo) {
        for (int y = 0; y < 3; y++) {
            boolean ok = true;
            for (int x = 0; x < 3; x++) {
                if (!bingo[y][x].read) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                return true;
            }
        }
        for (int x = 0; x < 3; x++) {
            boolean ok = true;
            for (int y = 0; y < 3; y++) {
                if (!bingo[y][x].read) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                return true;
            }
        }
        if (bingo[0][0].read && bingo[1][1].read && bingo[2][2].read) {
            return true;
        }
        if (bingo[2][0].read && bingo[1][1].read && bingo[0][2].read) {
            return true;
        }
        return false;
    }

    static class Cell {
        int number;
        boolean read = false;

        public Cell(int number) {
            this.number = number;
        }
    }
}

Measured memory_bytes: 21844
// ConsoleApplication3.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

//#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
	int a, b,c,d;
	d = 0;
	cin >> a >> b >> c;
	while (a <= b) {
		if (c%a == 0) {
			d++;
		}
		a++;
	}
	cout << d << endl;
	return 0;
}




Measured memory_bytes: 3096