akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <bitset>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif



int main(int argc, char **argv){
	int year, month, date;
	int imeiji_s = 1868;
	int itaish_s = 1912;
	int ishowa_s = 1926;
	int iheise_s = 1989;
	std::string meiji_s = "18680908";
	std::string meiji_e = "19120729";
	std::string taish_e = "19261224";
	std::string showa_e = "19890107";

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif

#if INPUT_FROM_FILE
	while(ifs >> year >> month >> date){
#else
	while(std::cin >> year >> month >> date){
#endif
		char buf[10];
		std::string now;

		sprintf(buf, "%d%02d%02d", year, month, date);
		now = buf;

		if(now < meiji_s){
			std::cout << "pre-meiji" << std::endl;
		}
		else if(now <= meiji_e){
			std::cout << "meiji " << year - imeiji_s + 1 << " " << month << " " << date << std::endl;
		}
		else if(now <= taish_e){
			std::cout << "taisho " << year - itaish_s + 1 << " " << month << " " << date << std::endl;
		}
		else if(now <= showa_e){
			std::cout << "showa " << year - ishowa_s + 1 << " " << month << " " << date << std::endl;
		}
		else{
			std::cout << "heisei " << year - iheise_s + 1 << " " << month << " " << date << std::endl;
		}
		
	}


 
#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}


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

int main() {
	int a,b;
	cin >> a >> b;
	if(a < b) {
		cout << "a < b" << endl;
	}
	if(a == b) {
		cout << "a == b" << endl;
	}
	if(a > b) {
		cout << "a > b" << endl;
	}
	return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
main(){
int n;
cin>>n;
int h[n],m[n];
for(int i=0;i<n;i++)cin>>h[i];
m[0]=0;
m[1]=abs(h[0]-h[1]);


for(int i=2;i<n;i++)
{
m[i]=min(abs(h[i]-h[i-1])+m[i-1],abs(h[i]-h[i-2])+m[i-2]);
}
cout<<m[n-1];









}


Measured memory_bytes: 4372
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long double A,B;
	float x=10,y=100 , z=0;
	z=pow(x,y);
	cin>>A;
	cin>>B;
	if(1<=A && A<=z)
	{
		if(1<=B && B<=z)
		{
			if(A>B)
			{
				printf("GREATER");
			}
			else if(A<B)
			{
				printf("LESS");
			}
			else
			{
				printf("EQUAL");	
			}
		}
		else
		{
		printf("Error");
		}
	}
	else
	{
		printf("Error");
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;
//const ll mod=998244353;

ll z[200100];

void memo(ll x){
    ll k=0;
    bitset<30> b(x);
    ll a=x%b.count();
    k++;
    k+=z[a];
    z[x]=k;
}
ll w1[200100]={},w2[200100]={};
ll p1[200100]={},p2[200100]={};

int main(void){
    fill(z,z+200100,-1);
    z[0]=0;
    ll n;
    string s;
    cin>>n>>s;
    ll kosuu=0;
    for(int i=0;i<n;i++){
        if(s[i]=='1') kosuu++;
    }
    for(int i=1;i<=200010;i++){
        memo(i);
    }
    ll k1=kosuu+1,k2=kosuu-1;
    for(int i=0;i<n;i++){
        int e=s[i]-'0';
        w1[i+1]=(w1[i]*2+e)%k1;
        if(k2<=0) continue;
        w2[i+1]=(w2[i]*2+e)%k2;
    }
    p1[0]=(1%k1);
    if(k2>=1) p2[0]=(1%k2);
    for(int i=1;i<200010;i++){
        p1[i]=(p1[i-1]*2)%k1;
        if(k2>=1) p2[i]=(p2[i-1]*2)%k2;
    }
    for(int i=0;i<n;i++){
        ll ans=0;
        if(s[i]=='0'){
            ll c=(w1[n]+p1[n-1-i])%k1;
            ans=z[c]+1;
        }
        if(s[i]=='1'){
            if(k2==0){
                printf("0\n");
                continue;
            }
            ll c=(w2[n]-p2[n-1-i]+k2)%k2;
            ans=z[c]+1;
        }
        printf("%d\n",ans);
    }
}

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

    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = new List<List<int>>();
            A.Add(Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList());
            A.Add(Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList());

            var max = 0;
            for(var i=0;i<N;i++)
            {
                var sum = 0;
                for (var k = 0; k < N; k++)
                {
                    if(i>=k) sum += A[0][k];
                    if(i<=k) sum += A[1][k];
                }
                if (max < sum) max = sum;
            }
            Console.WriteLine(max);
        }
    }

Measured memory_bytes: 13396
fun main(args: Array<String>) {
    val (H, W) = readInputLine().split(" ").map{it.toInt()}
    val s = Array(H, {CharArray(W)})
    
    for (i in 0 until H) {
        s[i] = readInputLine().toCharArray()
    }
    
    for (i in 0 until H) {
        for (j in 0 until W) {
            if (s[i][j] == '.') {
                continue
            }
            if (i > 0 && s[i - 1][j] == '#') {
                continue
            }
            if (i < H - 1 && s[i + 1][j] == '#') {
                continue
            }
            if (j > 0 && s[i][j - 1] == '#') {
                continue
            }
            if (j < W - 1 && s[i][j + 1] == '#') {
                continue
            }
            println("No")
            return
        }
    }

    println("Yes")
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 37804
//k_tourist
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define mx 500005
#define non __builtin_popcount
#define ml map<ll, ll> 
#define uml unordered_map<ll, ll>
#define ms map<string , ll> 
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define pl pair<ll, ll>
#define vl vector<ll>
#define vll vector<pl>
#define tpl pair<ll, pl>
#define vlll vector<tpl>
#define vs vector<string>
#define pb push_back
#define mk make_pair
#define M_PI 3.14159265358979323846
#define endl '\n'
#define fst ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%I64d",&x)
#define inf ((ll)1e18 + 1)
#define bs binary_search
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
#define pow powr
#define rep(i,a,b)  for (i=(a);i<(b);i++)
#define nrep(i,a,b) for (i=(a);i>(b);i--)
using namespace std;
 
bool isp[mx];
 
void sv(){
 
	ll i,j;
	memset(isp, true, sizeof(isp));
	
	isp[1]= false;
	for(i=2;i*i<mx;i++){
		if(isp[i]){
			for(j=i*i;j<mx;j+=i)
			isp[j]= false;
		}
	}
}
 
ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

void bta_de_yarr(){
    
	ll a, b, k, a1, a2;
    cin>>a>>b>>k;

    if(a>= k)
    {
        a1= a-k;
        a2=b;
    }
    else
    {
        a1=0;
        a2= max(0LL, b-(k-a));
    }
    
	cout<<a1<<" "<<a2;
	cout<<endl;
}

int main(){
    fst
	ll t;
    t= 1;
	//cin>>t;
    while(t--){
        bta_de_yarr();
    }
    return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 256
import queue as qu
import bisect



def resolve():
    N=int(input())
    nod=[[[],[]] for i in range(N)]
    path=[[] for i in range(N-1)]
    col=[0 for i in range(N-1)]


    for i in range(N-1):
        path[i]=[int(i)-1 for i in input().split()]
        nod[path[i][1]][0].append(i)
        nod[path[i][0]][0].append(i)
    mx=0
    mnod=0
    for i in range(N):
        if len(nod[i][0])>mx:
            mx=len(nod[i][0])
            mnod=i
    print(mx)

    q=qu.Queue(N)
    q.put(mnod)

    while not q.empty():

        tagnod=q.get()
        nod[tagnod][1].sort()
        nod[tagnod][0].sort()
        cc=1
        pointer=0
        for i in range(len(nod[tagnod][0])-1,-1,-1):
            tp=nod[tagnod][0][i]

            while pointer<len(nod[tagnod][1]) and nod[tagnod][1][pointer] == cc:
                cc+=1
                pointer+=1
            col[tp]=cc
            if tagnod==path[tp][0]:
                nnod=path[tp][1]
            else:
                nnod=path[tp][0]

            bisect.insort(nod[nnod][1],cc)
            nod[nnod][0].remove(tp)
            q.put(nnod)
            cc+=1

    for i in col:
        print(i)





if __name__ == "__main__":
    resolve()
#    unittest.main()

Measured memory_bytes: 116892
dataset = []

while True:
    s = list(map(int,input().split()))
    try:
        if s[0] == 0 and s[1] == 0:
            break
        dataset.append(s)
    except:
        continue

for row in dataset:
    row.sort(key=int)
    print(row[0],row[1])

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

void solve(std::string S, std::string T, long long A, long long B, std::string U){
    if (U == S) cout << A - 1 << ' ' << B << '\n';
    else if (U == T) cout << A << ' ' << B - 1 << '\n';
}

int main(){
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    std::string U;
    std::cin >> U;
    solve(S, T, A, B, U);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>
#define INF 100000000
using namespace std;
int N,A,B,C,l;
vector<int> L;

int dfs(int depth,int a,int b,int c){
 int ret0,ret1,ret2,ret3,ret4;
 if(depth==N){
  if(a!=0 && b!=0 && c!=0)return abs(A-a)+abs(B-b)+abs(C-c)-30;//-30があまり理解できていなかった。最初のa,b,c一本目はコストかからないから最後にー３０する。
  else return INF;
 }

 ret0=dfs(depth+1,a,b,c);
 ret1=dfs(depth+1,a+L[depth],b,c)+10;
 ret2=dfs(depth+1,a,b+L[depth],c)+10;
 ret3=dfs(depth+1,a,b,c+L[depth])+10;

 return min({ret0,ret1,ret2,ret3});
}

int main(void){

 cin>>N>>A>>B>>C;

 for(int i=0; i<N; i++){
  cin>>l;
  L.push_back(l);
 }
 cout<<dfs(0,0,0,0)<<endl;

 return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <stdlib.h>
using namespace std;
using ll=long long;

int main (void) {
  ll a,b,x;
  cin >> a >> b >> x;
  ll ans=0;
  if (a==0){
    cout << b/x+1;
    return 0;
  }
  ans=b/x-(a-1)/x;
  cout << ans;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
)

func main() {
	ans := []string{}
	i := 1

	for {
		var x int
		fmt.Scanf("%d", &x)
		if x == 0 {
			break
		}
		ans = append(ans, "Case " + strconv.Itoa(i) + ": " + strconv.Itoa(x))
		i++
	}
	for _,v := range ans {
		fmt.Println(v)
	}
}



Measured memory_bytes: 3116
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define It iterator
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=100003;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}


int n,m,eLast,bLast;
string s;

int main(){
    //freopen("test.in","r",stdin);
    cin>>n>>m;
    rep(i,0,n) {
        cin>>s;
        int b=-1,e=-1;
        rep(i,0,m) if(s[i]=='#') {b=i; break;}
        if(b<0) goto quickExit;
        rep(i,b,m) if(s[i]=='.') {e=i-1; break;}
        if(e<0) e=m-1;
        rep(i,e+1,m) if(s[i]=='#') goto quickExit;

        if(b!=eLast) goto quickExit;
        bLast=b; eLast=e;
    }

    cout<<"Possible";
    return 0;
quickExit:
    cout<<"Impossible";
    return 0;
}


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

bool prime[1000003];
bool sieve() {
    memset(prime, true, sizeof(prime));
    for(int i = 2; i * i < 1000003; ++i){
        if(prime[i]){
            for(int j = 2 * i; j < 1000003; j += i){
                prime[j] = false;
            }
        }
    }
}

int main() { 
    int n;
    cin >> n;
    string s;
    cin >> s;
    if(n == 1) {
        cout << "No" << endl;
        return 0;
    }
    if(n == 2) {
        if(s[0] == s[1]){
            cout << "Yes" << endl;
            return 0;
        }
        else cout << "No" << endl;
        return 0;
    }
    if(n & 1) {
        cout << "No" << endl;
        return 0;
    }
    if(s.substr(0,n/2) == s.substr(n/2,n/2))
    cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

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

    string a, b, c; cin >> a >> b >> c;
    cout << (char)(a[0] + 'A' - 'a') << (char)(b[0] + 'A' - 'a') << (char)(c[0] + 'A' - 'a') << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int MOD = 998244353;

struct Combination{
  const int MOD = 998244353;

  vector<int> fact; //　fact[i] = iの階乗
  void init(int n){
    fact.resize(n+1);
    fact[0] = fact[1] = 1;
    for(int i = 2; i <= n; i++){
      fact[i] = i * fact[i-1] % MOD;
    }
  }

  int nCr(int n,int r){ // nCr = n!/r!(n-r)!
    return fact[n] * mod_pow(fact[r]*fact[n-r]%MOD,MOD-2,MOD) % MOD;
  }

  int mod_pow(int n,int p,int MOD){ // a/n ≡ a*n^(p-2) nとpは互いに素
    int r = 1;
    for(; p > 0; p >>= 1){
      if(p & 1LL) r = (r * n) % MOD;
      n = (n * n) % MOD;
    }
    return r; // r = n^p % MOD
  }

}comb;

signed main(){

  int n, a, b, k; cin >> n >> a >> b >> k;
  int ans = 0;
  comb.init(n);
  for(int i = 0; i <= n; i++){
    int right = k - a * i;
    if(right % b != 0 || right/b < 0 || right/b > n) continue;
    ans += comb.nCr(n, i) * comb.nCr(n, right / b);
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<cmath>

using namespace std;
using ll  = long long;
template <typename T> T In() {
    T t;
    cin >> t;
    return t;
}
template <typename T> vector<vector<T>> Vec2(int i, int j, T ini = 0) {
    vector<vector<T>> vec(i, vector<T>(i, ini));
    return move(vec);
}
template <typename T> vector<vector<vector<T>>> Vec3(int i, int j, int k, T ini = 0) {
    vector<vector<vector<T>>> vec(i, vector<vector<T>>(j, vector<T>(k, ini)));
    return move(vec);
}


int main() {
    int N = In<int>();
    vector<int> As(N + 1), Bs(N);
    for(int i = 0; i < N + 1; i++){
        As[i] = In<int>();
    }
    for(int i = 0; i < N; i++){
        Bs[i] = In<int>();
    }

    ll ans = 0;
    for(int i = N-1; i >= 0; i--){
        int K1 = min(As[i + 1], Bs[i]);
        Bs[i] -= K1;
        As[i+1] -= K1;
        ans += K1;
        int K0 = min(As[i], Bs[i]);
        Bs[i] -= K0;
        As[i] -= K0;
        ans += K0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
import heapq

class Heapq:
    def __init__(self, arr, desc=False):
        if desc:
            arr = [-a for a in arr]
        self.sign = -1 if desc else 1
        self.hq = arr
        heapq.heapify(self.hq)
 
    def pop(self):
        return heapq.heappop(self.hq) * self.sign
 
    def push(self, a):
        heapq.heappush(self.hq, a * self.sign)
 
    def top(self):
        return self.hq[0] * self.sign

n,m = map(int, input().split())
a = list(map(int, input().split()))
b = Heapq(a, True)
ans = sum(a)
while m > 0:
  i = b.pop()
  t = i // 2
  ans -= i - t
  b.push(t)
  m -= 1
print(ans)

Measured memory_bytes: 73624
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define FOR(i,x,y) for(int i=(x),i##END=(y);i<=i##END;++i)
#define DOR(i,x,y) for(int i=(x),i##END=(y);i>=i##END;--i)
template<typename T,typename _T>inline bool chk_min(T &x,const _T y){return y<x?x=y,1:0;}
template<typename T,typename _T>inline bool chk_max(T &x,const _T y){return x<y?x=y,1:0;}
typedef long long ll;
const int N=2e5+5;
const int P=1e9+7;
int dp[N],Sum[N];
int a[N];
int n;

int main()
{
	scanf("%d",&n);
	FOR(i,1,n)scanf("%d",&a[i]);
	int m=n;
	n=1;
	FOR(i,2,m)if(a[i]!=a[n])a[++n]=a[i];
	dp[0]=1;
	FOR(i,1,n)
	{
		dp[i]=(dp[i-1]+Sum[a[i]])%P;
		(Sum[a[i]]+=dp[i-1])%=P;
	}
	printf("%d\n",dp[n]);
	return 0;
}

Measured memory_bytes: 2560
import sys
input = sys.stdin.readline

class SegmentTree:
    # リストからセグメントツリーを構成
    def __init__(self, list_, ide_ele=0):
        tmp = 1
        while tmp < len(list_):
            tmp *= 2
        self.n = tmp
        self.l = [ide_ele] * (2 * self.n - 1)
        self.ide_ele = ide_ele
        self.init_val(list_)

    def func(self, x, y):
        return min(x, y)

    def init_val(self, list_):
        # list_の値で葉を埋める
        for i, val in enumerate(list_):
            self.l[self.n - 1 + i] = val
        # 下の段から初期値を埋めていく
        for i in range(self.n-2, -1, -1):
            self.l[i] = self.func(self.l[i*2+1], self.l[i*2+2])
    
    # i番目をvalで更新
    def update(self, i, val):
        i = self.n - 1 + i
        self.l[i] = val
        while i > 0:
            i = (i-1) // 2
            self.l[i] = self.func(self.l[i*2+1], self.l[i*2+2])
    
    # [a, b)の最小値を返す. l, rはノードkに対応した区間
    def query(self, a, b, k, l, r):
        if r <= a or b <= l:# 存在しない区間を参照
            return self.ide_ele  # エラーを返す
        if a <= l and r <= b:# 区間を完全に含む
            return self.l[k]
        vl = self.query(a, b, k*2+1, l, (l+r)//2)
        vr = self.query(a, b, k*2+2, (l+r)//2, r)
        return self.func(vl, vr)

def main():
    N, Q = map(int, input().split())
    tmp = (1 << 31) - 1
    seg = SegmentTree([tmp] * N, ide_ele=tmp)

    # print("init")
    # print(seg.l)

    for i in range(Q):
        c, x, y = map(int, input().split())
        if c == 0:
            # print("update: l[{}]={} -> {}".format(x, seg.l[x], y))
            seg.update(x, y)
        else:
            # print("min: {}~{}".format(x, y))
            print(seg.query(x, y+1, 0, 0, seg.n))
        # print(seg.l)

if __name__ == "__main__":
    main()


Measured memory_bytes: 9436
W,H,N = map(int,input().split())
u = H
d = 0
r = W
l = 0
for i in range(N):
    x,y,a = map(int,input().split())
    if a == 1:
        l = max(l,x)
    elif a == 2:
        r = min(r,x)
    elif a == 3:
        d = max(d,y)
    else:
        u = min(u,y)
h = u - d
w = r - l
if h < 0:
    ans = 0
elif w < 0:
    ans = 0
else:
    ans = w*h
print(ans)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
    int a,b,c,d,e,f,g,h,x,y;
    
    while (cin >> a >> b >> c >> d >> e >> f >> g >> h) {
    x = 0;
    y = 0;
        if (a==e){x=x+1 ;e=e+10;} 
        if (b==f){x=x+1;f=f+10;} 
        if (c==g){x=x+1;g=g+10;}
        if (d==h){x=x+1;h=h+10;}
        if (e==a || e==b || e==c || e==d){y=y+1;}
        if (f==a || f==b || f==c || f==d){y=y+1;}
        if (g==a || g==b || g==c || g==d){y=y+1;}
        if (h==a || h==b || h==c || h==d){y=y+1;}
        cout << x << " " <<  y << endl;
    }
    
return 0 ;
}



Measured memory_bytes: 3028
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;


int main() {
	int m, n;
	cin >> m >> n;
	cout << (m - 1)*(n - 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;

struct Data{
	int index;
	int data;
};

void q_sort(Data *A,int start,int end){
	if(start>=end) return;
	int bibot= A[start+(end-start)/2].data;

	int i=start;
	int j=end;
	while(i<j){
		if(A[i].data<bibot) i++;
		if(A[j].data>bibot){
			j--;
		}else if(!(A[i].data<bibot)){
			Data pos=A[j];
			A[j]=A[i];
			A[i]=pos;
		}
	}
	q_sort(A,start,i);
	q_sort(A,j+1,end);
}

int main()
{
	int N;
	

	cin >> N;
	Data A[N];
	int min = N, tmp, tmp2;
	for(int i=0;i<N;i++){
		cin >> A[i].data;
		A[i].index = i+1;
	}

	q_sort(A, 0, N-1);
	

	for (int i=0;i<N;i++){
		cout << A[i].index;
		if(i != N-1) cout << " ";
	}
	cout << "\n";
}

Measured memory_bytes: 1536
#include <cstdio>
#include <cstring>
#include <algorithm>

#define ll long long
#define inf 0x3f3f3f3f 
#define il inline 
#define in1(a) read(a)
#define in2(a,b) in1(a),in1(b)
#define in3(a,b,c) in2(a,b),in1(c)
#define in4(a,b,c,d) in2(a,b),in2(c,d)

inline void read( int &x ){
    x = 0 ; int f = 1 ; char c = getchar() ;
    while( c < '0' || c > '9' ) {
        if( c == '-' ) f = -1 ;
        c = getchar() ;
    }
    while( c >= '0' && c <= '9' ) {
        x = (x << 1) + (x << 3) + c - 48 ;
        c = getchar() ;
    }
    x *= f ;
}

inline void readl( ll &x ){
    x = 0 ; ll f = 1 ; char c = getchar() ;
    while( c < '0' || c > '9' ) {
        if( c == '-' ) f = -1 ;
        c = getchar() ;
    }
    while( c >= '0' && c <= '9' ) {
        x = (x << 1) + (x << 3) + c - 48 ;
        c = getchar() ;
    }
    x *= f ;
}

using namespace std ;

#define N 100010

int a[ N ] , n , m ; 

bool check( int x ) {
	int  cnt = 0 ;
	int c[ 1000 ] ;
	while( x ) {
		c[ ++ cnt ] = x %10 ;
		x /= 10 ;
	}
	for( int i = 2 ; i <= cnt ; i ++ ) if( c[ i ] != c[ i - 1 ] ) return 0 ;
	return 1 ; 
}

int main() {
	scanf( "%d" , &n ) ;
	while( 1 ) {
		if( check( n ) ) break ;
		n ++ ;
	} 
	printf( "%d" , n ) ;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	string S, T;

	cin >> N >> S >> T;

	for (int i = 0; i < N; i++) {
		cout << S[i] << T[i];
	}

	return 0;
}

Measured memory_bytes: 384
from math import ceil

abcde = []
for _ in range(5):
    abcde.append(int(input()))

result = 0
min_1  = None
for i in abcde:
    # 全て１の位を切り上げて足し合わせる
    result += ceil(i/10)*10
    if i%10 != 0:
        if min_1 == None:
            min_1 = i%10
        else:
            min_1 = min(min_1,i%10)
# すべての数の中で１の位が最も小さいものを最後の注文とする。
# その注文は切り上げなくていいことになる。
# 全てが１０で割り切れ切り上げが発生しない場合はこの処理を行わない
if min_1:
    result -= 10 - min_1

print(result)

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

void fnInput(vector<int>& rvnValue)
{
  int nValueSiz;
  cin >> nValueSiz;
  rvnValue.resize(nValueSiz);

  for (int& rnValue : rvnValue)
    cin >> rnValue;
}
  
double fnMaxValueGet(const vector<int>& cnrvnValue)
{
  vector<int> vnAsdValue(cnrvnValue);
  sort(begin(vnAsdValue), end(vnAsdValue));

  double nMaxValue = vnAsdValue[0];
  for (int i = 1; i < vnAsdValue.size(); i++)
    nMaxValue = (nMaxValue + vnAsdValue[i]) / 2;

  return nMaxValue;
}
  
int main()
{
  vector<int> vnValue;

  fnInput(vnValue);
  cout << fnMaxValueGet(vnValue) << endl;

  return 0;
}

Measured memory_bytes: 256
import math

def main():
    a, b = map(int, input().split())
    if ((a % 2) == 0 and (b % 2) == 0) or ((a % 2) == 1 and (b % 2) == 1):
        print(math.floor((a+b)/2))
    else:
        print('IMPOSSIBLE')
main()

Measured memory_bytes: 9140
#include <bits/stdc++.h>
using namespace std;
const int maxn=3001;
double dp[maxn][maxn],prob[maxn];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		scanf("%lf",&prob[i]);
	}
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		double headevent=prob[i],tailevent=1-prob[i];
		dp[0][i]=tailevent * dp[0][i-1];
		for(int heads=1;heads<=i;heads++)
		{
			dp[heads][i]=headevent * dp[heads-1][i-1] + tailevent * dp[heads][i-1];
		}
	}
	double ans=0;
	for(int i=n/2+1;i<=n;i++)
	{
		ans+=dp[i][n];
	}
	cout<<setprecision(9)<<ans;
	return 0;
}

Measured memory_bytes: 70784
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  if(a<=8 && b<=8){
    cout << "Yay!" << endl;
  }
  else cout << ":(" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 200010;
const double eps = 1e-6;
template <typename T> void inline read(T &x) {
	T f = 1;
	char ch = getchar();
	for (; '0' > ch || ch > '9'; ch = getchar()) if (ch == '-') f = -1;
	for (x = 0; '0' <= ch && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
	x *= f;
}
ll n, m;
ll a[N], ans;
bool judge(ll mid) {
	ll cnt = 0;
	for (ll i = 1; i <= n; i++) {
		cnt += ceil((double)a[i] / mid) - 1;
	}
	return cnt <= m;
}
int main() {
	read(n); read(m);
	for (ll i = 1; i <= n; i++) read(a[i]);
	ll l = 1, r = 100000000000;
	while (l <= r) {
		ll mid = (l + r) >> 1;
//		cout << l << " " << r << endl;
//		cout << mid << endl; 
		if (judge(mid)) {
			ans = mid;
			r = mid - 1;
		} else {
			l = mid + 1;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 5148
# Aizu Problem ITP_1_9_A: Finding a Word
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input2.txt", "rt")


word = input().strip().lower()
count = 0
while True:
    text = input().strip()
    if text == "END_OF_TEXT":
        break
    text = text.lower().split()
    count += text.count(word)
print(count)

Measured memory_bytes: 7484
#include<bits/stdc++.h>
#define ll long long
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=105;
inline int read()
{
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*f;
}
ll n,k;
char s[N];
int main()
{
	scanf("%s%d",s,&k); n=strlen(s);
	bool flag=1;
	for(int i=1; i<n; i++) if(s[i]!=s[i-1]) flag=0;
	if(flag) {printf("%lld\n",n*k/2); return 0;}
	
	ll l=0,r=0,cnt=0,cnt1=0;
	for(int i=1; i<n; i++,l++) if(s[i]!=s[i-1]) break;
	for(int i=n-2; i>=0; i--,r++) if(s[i]!=s[i+1]) break;
	for(int i=l+1; i<n-r-1; i++){
		if(s[i]==s[i+1]) cnt++,i++;
	}
	l++; r++;
//	cout<<l<<' '<<r<<' '<<cnt<<endl;
	ll ans;
	if(s[0]==s[n-1]) ans=cnt*k+l/2+r/2+(l+r)/2*(k-1);
	else ans=cnt*k+(l/2+r/2)*k;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i, n) for (int i = 0; i < n; i++)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
int dxx[8] = { 1, 1, 1, 0, 0, -1, -1, -1 }, dyy[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };

ll n;
int s[3] = { 3, 5, 7 };
int cnt = 0;
void dfs (int cnt3, int cnt5, int cnt7, ll now) {
    if (now > n) return;
    if (cnt3 > 0 && cnt5 > 0 && cnt7 > 0) {
        cnt++;
        //cout << now << "\n";
    }

    dfs (cnt3 + 1, cnt5, cnt7, now * 10 + 3);
    dfs (cnt3, cnt5 + 1, cnt7, now * 10 + 5);
    dfs (cnt3, cnt5, cnt7 + 1, now * 10 + 7);
}

int main() {
    cin >> n;
    dfs (0, 0, 0, (ll)0);
    cout << cnt << "\n";
}

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

int main(){
  int N, x;
  cin >> N >> x;
  int a[N];
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  sort(a, a + N);
  int ans = 0;
  for(int i = 0; i < N; i++){
    if(x - a[i] >= 0){
      x -= a[i];
      ans ++;
    }
  }
  if(x){
    ans = min(ans, N - 1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	char a[10];
	scanf("%s",&a);
	int i,n,g=0;
	n=strlen(a);
	for(i=0;i<n-1;i++)
	{
		if(a[i]==a[i+1]) 
		{
			g=1;
			break;
		}
	}
	if(g==1) printf("Bad\n");
	else printf("Good\n");
} 

Measured memory_bytes: 256
#include <stdio.h> 
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a>b){
		int t=a;a=b;b=t;
	}
	if(a>c){
		int t=a;a=c;c=t;
	}
	if(b>c){
		int t=b;b=c;c=t;
	}
	printf("%d\n",(b-a)+(c-b)); 
	return 0;
}

Measured memory_bytes: 128
//auto 関数名 = [(&:ラムダ外の引数をとる時))](引数の型1 引数名1, 引数の型2, 引数名2, ...) { 関数の処理 }; //inside main() define function. take care of };
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//   bitset<ビット数> s(tmp);
//   // (ビット列sに対する処理)
// }
// sort(配列変数.begin(), 配列変数.end());
// do {
//   // 順列に対する処理
// } while (next_permutation(配列変数.begin(), 配列変数.end()));
//const double PI = acos(-1); M_PI
// cout << fixed << setprecision(10);
// set<int>st{ 3,1,4,1,5,9,2,6,5,3,5 };
//     for (auto itr = st.begin(); itr != st.end(); ++itr) {
//         cout << *itr;
//     }
#include <bits/stdc++.h>
#include <regex>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define _GLIBCXX_DEBUG 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end() //sort(all(vec)); ,reverse(all(vec));etc
int main(){
    int n;
    cin>>n;
    int t;
    cin>>t;
    int a;
    cin>>a;
   int point=0;
   double d=1000;
   double h;
    rep(i,n){
        cin>>h;
        h=t-h*0.006;
        if(d>abs(a-h)){
            point=i;
            d=abs(a-h);
        }
    }
    cout<<point+1<<endl;
}

Measured memory_bytes: 3736
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    long long H, W, N; std::cin >> H >> W >> N;
    std::vector<long long> cnt(10);
    std::map<std::pair<int, int>, int> s;
    for (int t = 0; t < N; t++) {
        int a, b; std::cin >> a >> b;
        for (int i = -1; i <= 1; i++) {
            for (int j = -1; j <= 1; j++) {
                if (!(2 <= a + i && a + i <= H - 1)) continue;
                if (!(2 <= b + j && b + j <= W - 1)) continue;
                s[{a + i, b + j}]++;
            }
        }
    }
    for (auto &p : s) cnt[p.second]++;
    cnt[0] = H*W - 2*H - 2*W + 4
        - std::accumulate(cnt.begin(), cnt.end(), 0LL);
    for (int i = 0; i <= 9; i++) std::cout << cnt[i] << std::endl;
    return 0;
}


Measured memory_bytes: 56448
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;
const ll MOD=1e9+7;

int main() {
    ll H,W;
    cin >> H >> W;
    vector<string> s(H);
    for(int i=0;i<H;i++) cin >> s[i];

    vector<vector<ll>> dp(H,vector<ll>(W));
    dp[0][0]=1;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(s[i][j]=='#')continue;
            if(i!=H-1 && s[i+1][j]=='.') dp[i+1][j]=(dp[i+1][j]+dp[i][j])%MOD;
            if(j!=W-1 && s[i][j+1]=='.') dp[i][j+1]=(dp[i][j+1]+dp[i][j])%MOD;
        }
    }

    cout << dp[H-1][W-1] << endl;

    return 0;
}

Measured memory_bytes: 9216
N = int(input())
A = list(map(int,input().split()))

flag = 0
for i in range(N):
    if A[i] % 2 == 0:
        if (A[i] % 3 != 0) and (A[i] % 5 != 0):
            flag = 1

if flag == 0:
    print("APPROVED")
else:
    print("DENIED")


Measured memory_bytes: 3060
(defun count-a (n a)
  (let ((c (make-array n :initial-element 0)))
    (loop :for i :in a
       :do (setf (aref c (1- i)) (1+ (aref c (1- i)))))
    c))

(defun main ()
  (let* ((n (read))
         (k (read))
         (q (read))
         (a (loop :repeat q
               :collect (read)))
         (c (count-a n a)))
    (loop :for i :across c
       :do (format t "~A~%" (if (> i (- q k)) "Yes" "No")))))

(main)


Measured memory_bytes: 60264
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main() {
	int A;
	int B;
	int C;
	cin >> A >> B >> C;
	int D = 0;
	for (int x = A; x <= B; x++) {
		if (C % x == 0) {
			D = D + 1;
		}
		
	}
	cout << D << endl;
	}
	




Measured memory_bytes: 3100
using System;

class main{
    public static void Main(String[] args){

        int n = int.Parse(Console.ReadLine());
        int[] a = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);

        int index;

        index = selectionSort(a,n);
        
        for(int i = 0; i < n; i++){
            if(i != n-1){
                Console.Write(a[i] + " ");
            }else{
                Console.WriteLine(a[i]);
            }
        }
        
        Console.WriteLine(index);
    }

    internal static int selectionSort(int[] a,int n){

        int[] A = a;
        int N = n;
        int index = 0;

        for(int i = 0;i < N; i++){
            int minj = i;

            for(int j = i;j < N;j++){
                if(A[j] < A[minj]){
                    minj = j;
                }
            }

            int temp = A[i];
            A[i] = A[minj];
            A[minj] = temp;
            if(i != minj){
                index++;
            }
        }

        return index;
    }
}

Measured memory_bytes: 9056
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <random>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;


int GCD(int a, int b) {
	if (b == 0)return a;
	return GCD(b, a % b);
}

int main() {
	int K;
	cin >> K;
	LL ans = 0;
	for (int i = 1; i <= K; i++)
		for (int j = 1; j <= K; j++)
			for (int k = 1; k <= K; k++)
				ans += GCD(GCD(i,j),k);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3580
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
int k;
string s;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s>>k;
    int l=s.length();
    vector<string> ss;
    for(int i=0;i<l;i++) {
        for(int j=1;j<6;j++){
            ss.push_back(s.substr(i,j));
        }
    }
    sort(ss.begin(),ss.end());
    ss.erase(unique(ss.begin(),ss.end()),ss.end());
    cout <<ss[k-1]<< "\n";
}

Measured memory_bytes: 1660
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    a, b, x = map(int, input().split())
    if(a % x == 0):
        print(b // x - a // x + 1)
    else:
        print(b//x - a//x)
    

    

if __name__ == '__main__':
    main()


Measured memory_bytes: 68204
while True:
    n, x = list(map(int, input().split()))
    c = 0
    if n == x == 0:
        break
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            for k in range(j+1, n+1):
                if i + j + k == x:
                    c += 1
    print(c)

Measured memory_bytes: 7604
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    string s, t; cin >> s >> t; int ans = 0;
    rep(i,3) if(s[i] == t[i])ans++;
    cout << ans << endl; return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef unsigned long long ull;
typedef long long ll;
typedef double db;

#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define mk make_pair
#define pi pair<int,int>
#define vi vector<int>
#define pL pair<ll,ll>
#define vL vector<ll>
#define vp vector<pi>
#define vpL vector<pL>

const int MX=2000000;
const ll mod=998244353;
const int LG=26;



int main()
{
    FasterIO;

    string s;
    cin>>s;
    
    if(s=="RRR") cout<<3<<endl;
    else if(s=="RRS" || s=="SRR") cout<<2<<endl;
    else if(s=="SSS") cout<<0<<endl;
    else  cout<<1<<endl;
    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define IOS  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define F first
#define S second	
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define LCM(a,b) (a*b)/__gcd(a,b)
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define sz(x) (ll)x.size()
#define ld long double
#define pcnt(x) __builtin_popcountll(x)
const long long I1=1e9;
const long long I2=1e18;
const int32_t M1=1e9+7;
const int32_t M2=998244353;
template<typename T,typename T1>T maxn(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T minn(T &a,T1 b){if(b<a)a=b;return a;}
ll dp[105][100005];
void add(ll &a,ll b)
{
    (a+=b)%=M1;
}
void solve()
{
  //code begins from here//
  ll n,k;
  cin>>n>>k;
  lop1(i,k+1) dp[0][i]=1;
  lop1(i,n)
  {
      ll val;
      cin>>val;
      lop(used,k+1){
          add(dp[i][used+1],dp[i-1][used+1]-dp[i-1][used-min(used,val)]+dp[i][used]);
      }
  }
   cout<<(dp[n][k+1]-dp[n][k]+M1)%M1<<endl;
}

signed main()
{
    IOS;
    #ifdef MODULO
        initialize();
    #endif
    #ifdef SIEVE
        sieve();
    #endif
    int testcase=1;
   // cin>>testcase;
    while(testcase--) solve();
    return 0;
}

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

int main() {
  vector<int> sequence_s;
  int sequence_s_count;
  cin >> sequence_s_count;
  for (int i = 0; i < sequence_s_count; i++) {
    int value;
    cin >> value;
    sequence_s.push_back(value);
  }

  int t_count;
  cin >> t_count;

  int ans_count = 0;
  for (int i = 0; i < t_count; i++) {
    int value;
    cin >> value;
    int min_index = 0;
    int max_index = sequence_s_count - 1;
    while (min_index <= max_index) {
      int middle_index = (min_index + max_index) / 2;
      int middle = sequence_s.at(middle_index);
      if (middle == value) {
        ans_count++;
        break;
      } else if (middle < value) {
        min_index = middle_index + 1;
      } else if (middle > value) {
        max_index = middle_index - 1;
      }
    }
  }
  cout << ans_count << endl;
  return 0;
}


Measured memory_bytes: 3448
#include<bits/stdc++.h>
    #define ll long long
    using namespace std;
    int main()
    {
        ll a;
        int b;
        char c;
        int d;
        cin>>a>>b>>c>>d;
        int B = 100*b + d;
        ll res = a*B;
        cout<<res/100;
    }


Measured memory_bytes: 3640
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
using namespace std;
 
int main()
{
  int n, h, w;
  cin >> n >> h >> w;
  int a[1010], b[1010];
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> a[i] >> b[i];
    if (h <= a[i] && w <= b[i])
    {
      ans++;
    }
  }
  cout << ans << "\n";
}

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
// template starts
typedef long long int ll;
ll fact(ll n, ll p){
	ll ans = 1;
	for(ll i = 1; i <= n; i++){
		ans *= i;
		ans %= p;
	}
	return ans;
}
ll power(ll x, ll n, ll p){
	ll res = 1;
	if(n == 1) return x%p;
	if(n%2 == 1) res = x%p;

	ll temp = power(x,n/2,p);
	return res*((temp*temp)%p)%p;
}
ll inv(ll a, ll p){
	return power(a,p-2,p);
}
ll nCr(ll n, ll r, ll p){
	if(r > n) return 0;
	ll t1 = fact(n,p);
	ll t2 = inv(fact(r,p),p);
	ll t3 = inv(fact(n-r,p),p);

	return (((t1*t2)%p)*t3)%p;
}
vector<vector<ll> > multiply(vector<vector<ll> > &a, vector<vector<ll> > &b, ll p){
	int r1,c1,r2,c2;
	r1 = a.size(); c1 = a[0].size();
	r2 = b.size(); c2 = b[0].size();

	vector<vector<ll> > result(r1,vector<ll>(c2,0));

	if(c1 != r2) return result;

	for(int i = 0; i < r1; i++){
		for(int j = 0; j < c2; j++){
			for(int k = 0; k < c1; k++){
				result[i][j] += a[i][k]*b[k][j];
				result[i][j] %= p;
			}
		}
	}
	return result;
}

vector<vector<ll> > power(vector<vector<ll> >&a,ll n, ll p){
	int r = a.size();
	vector<vector<ll> > result(r,vector<ll>(r,0));
	for(int i = 0; i < r; i++) result[i][i] = 1;

	while(n > 0){
		if(n%2 == 1){
			result = multiply(result,a,p);
		}
		n /= 2;
		a = multiply(a,a,p);
	}
	return result;
}
// template ends here

void solve(){
	// code starts from here
	double r;
	cin >> r;
	r = 2.0*3.14159265*r;
	cout << setprecision(10) << r << endl;
}

int main(){
 	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	int T;
	T = 1;
	while(T--){
		solve();
	}

	return 0;
}


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

for($i = 0; $i < min($k, $b-$a+1); $i++){
    $map[$a + $i] = true;
    $map[$b - $i] = true;
}
$keys = array_keys($map);
sort($keys);
foreach($keys as $key){
    echo $key."\n";
}


Measured memory_bytes: 4728
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 
int n ; 
int fix(int x){
	return (x%n+n)%n ; 
}
int main(){
    fastio
    cin >> n ; 
    vector<int> d(n) ; 
    for(int i=0;i<n;i++){
    	cin >> d[i] ; 
    }
    int L = 0 , R = min(d[n-1],d[0]);
    while(L<=R){
    	int mid = L + (R-L) / 2 ; 
    	debug() << imie(mid) ;
    	int x = d[n-1] - mid ; 
    	int y = d[0] - mid ; 
    	debug() << imie(x) imie(y) ; 
    	for(int i=1;i<n;i++){
    		if ( i == n - 1 ){
    			y = x - y ; 
    			continue;
    		}
    		y = d[i] - y;
    	}
    	debug() << imie(x) imie(y) ; 
    	if ( y == 0 ){
    		cout << mid*2 ;
    		int c = d[0] - mid ; 
    		for(int i=1;i<n;i++){
    			cout << ' ' << c * 2 ;
    			c = d[i] - c ; 
    		}
    		return 0 ; 
    	}
    	if ( y < 0 ){
    		R = mid - 1; 
    	}
    	else L = mid + 1 ; 
    }
    return 0 ;
}


Measured memory_bytes: 1792
n = int(input())
if n == 1:
    print(0)
    exit()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

x = factorization(n)
ans = 0

for i, j in x:
    cnt = 1
    while j >= 1:
        if j == 1:
            ans += 1
            j -= 1
        elif j > 1:
            ans += 1
            j -= cnt
        cnt += 1
        if cnt > j:
            break

print(ans)


Measured memory_bytes: 9496
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int,int> P;//cost,to
typedef vector<P> vertex;

#define MAX_E 100000
#define MAX_V 10000


int main(){
    int nv,ne;
    cin>>nv>>ne;
    vertex V[MAX_V];

    for(int i=0;i<ne;i++){
        int s,t,w;
        cin>>s>>t>>w;
        V[s].emplace_back(w,t);
        V[t].emplace_back(w,s);
    }
    bool isUsed[nv];
    fill(isUsed,isUsed+nv,false);

    priority_queue<P,vector<P>,greater<P>> que;
    que.emplace(0,0);
    int ans=0;
    while(!que.empty()){
        P p = que.top();que.pop();
        int from=p.second;
        if(isUsed[from])continue;
        isUsed[from]=true;
        ans+=p.first;
        for(auto& e:V[from]){
            int to=e.second, weight=e.first;
            if(!isUsed[to]) que.emplace(weight,to);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6780
cnt = 1
while True:
    W = int(input())
    if W == 0:
        break
    N = int(input())
    dp = [0] * (W+1)
    for i in range(N):
        v, w = map(int, input().split(','))
        for j in range(W, w-1, -1):
            dp[j] = max(dp[j], dp[j-w] + v)
    
    av = 0
    aw = 0
    for i in range(W+1):
        if av < dp[i]:
            av = dp[i]
            aw = i

    print("Case {}:".format(cnt))
    print(av)
    print(aw)
    cnt += 1


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

int main() {
    int n,k;
    cin >> n >> k;
    vector<int> v(n);
    rep(i,n){
        cin >> v[i];
    }
    sort(v.begin(),v.end());

    int minnum=(int)1e9;
    for(int i= 0; i<=(n-k); i++){
        minnum = min(minnum,(v[i+k-1]-v[i]));
    }
    cout << minnum << endl;
    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
int main(void)
{
int x,y;
while(1){
scanf("%d %d",&x,&y);
if(x==0&& y==0) break;
if(x<y){
printf("%d %d\n",x,y);
}
else{
printf("%d %d\n",y,x);
}
}
return 0;
}

Measured memory_bytes: 600
using System;
using System.Numerics;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            BigInteger power = 1;
            for(var i = 1; i <= n; i++){
                power = (power * i) % 1000000007;
            }
            Console.WriteLine(power);
        }
    }
}


Measured memory_bytes: 15572