akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF INT_MAX/3
#define mod 1000000007

struct state{
  int i,j,d;
};
int di[]={-1,0,+1,0};
int dj[]={0,-1,0,+1};

bool used[505][505];
bool vis[505][505][505];
int dist[505][505];

int main(){

  int N;
  cin>>N;
  vector<int> A(N*N);
  rep(i,N*N){
    scanf("%d",&A[i]);
    A[i]--;
  }

  rep(i,N)rep(j,N){
    vis[i][j][min({i,j,N-1-i,N-1-j})+1]=true;
    used[i][j]=true;
    dist[i][j]=min({i,j,N-1-i,N-1-j})+1;
  }

  int res=0;
  rep(k,A.size()){
    int ni=A[k]/N,nj=A[k]%N;
    int ans=dist[ni][nj];
    ans--;
    res+=ans;
    used[ni][nj]=false;

    queue<state> que;
    que.push((state){ni,nj,ans});
    vis[ni][nj][ans]=true;
    while(que.size()){
      state s=que.front(); que.pop();
      if(s.d>dist[s.i][s.j])continue;
      rep(dir,4){
        int ci=s.i+di[dir],cj=s.j+dj[dir];
        if(ci<0||ci>=N||cj<0||cj>=N)continue;
        int cost=(used[ci][cj]?1:0);
        if(s.d+cost<=N&&!vis[ci][cj][s.d+cost]){
          if(s.d+cost>=dist[ci][cj])continue;
          que.push((state){ci,cj,s.d+cost});
          vis[ci][cj][s.d+cost]=true;
          minch(dist[ci][cj],s.d+cost);
        }
      }
    }
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 129948
#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#define ll long long int
#define hell 1000000007LL
using namespace std;
ll power(ll x, ll y){ 
    if(y==0)
     return 1;
    else
    {
        ll p=power(x,y/2);
        if(y%2==0)
         return (p*p)%hell;
        else
        return (x*((p*p)%hell))%hell;
    }}
ll gcd(ll x,ll y)
{
    if(y==0)
     return x;
    else
    return gcd(y,x%y);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    ll x,n;
    cin>>x>>n;
    ll a[n];
    map<ll,ll>mp;
    for(int i=0;i<n;i++)
    {cin>>a[i];
    mp[a[i]]=1;}
    if(mp[x]==0)
    cout<<x;
    else
    {
        for(int i=1;i<=100;i++)
        {
            if(mp[x-i]+mp[x+i]<2)
            {
                if(mp[x-i]==0)
                cout<<x-i;
                else
                cout<<x+i;
                break;
            }
        }
    }}
    
    
    
    
    

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

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int, int>
#define all(x) x.begin(), x.end()
#define Matrix vector<vector<int>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = ((int64_t)2e18);
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 2e5 + 3;

signed main() {

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int t;

  // cin >> t;
  t = 1;

  while (t--) {
    int n;
    cin >> n;
    set<int> s;
    for (int i = 1; i <= n; ++i) {
      s.insert(i);
    }

    int k;
    cin >> k;

    while (k--) {
      int d;
      cin >> d;
      while (d--) {
        int x;
        cin >> x;
        if (s.count(x))
          s.erase(x);
      }
    }

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

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef vector<int> vi;
typedef pair<int, int> pi;
#define SQ(a) (a) * (a)
#define deb(x) cout << #x << " = " << x << '\n'
#define deb2(x, y) cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
 
 
int main(int argc, char const *argv[])
{
 
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int h,w;
    cin>>h>>w;
    char a[h][w];
    for(int i=0;i<h;i++){
    	for(int j=0;j<w;j++){
    		cin>>a[i][j];
    	}
    }
    ll int dp[h+1][w+1];
    memset(dp,0,sizeof dp);
    dp[1][1]=1;
    for(int i=2;i<=h;i++){
    	if(a[i-1][0]=='#'){
    		dp[i][1]=0;
    	}
    	else{
    		dp[i][1]=dp[i-1][1];
    	}
    }
    for(int i=2;i<=w;i++){
    	if(a[0][i-1]=='#'){
    		dp[1][i]=0;
    	}
    	else{
    		dp[1][i]=dp[1][i-1];
    	}
    }
    for(int i=2;i<=h;i++){
    	for(int j=2;j<=w;j++){
    		if(a[i-1][j-1]=='#'){
    			dp[i][j]=0;
    		}
    		else{
    			dp[i][j] = (dp[i-1][j]+dp[i][j-1])%1000000007;
    		}
    	}
    }
    // for(int i=0;i<=h;i++){
    // 	for(int j=0;j<=w;j++){
    // 		cout<<dp[i][j]<<" ";
    // 	}
    // 	cout<<"\n";
    // }
    cout<<dp[h][w];

    return 0;
}

Measured memory_bytes: 12420
n = int(input())
a,b = map(int, input().split())
res = [0,0,0]
arr = list(map(int, input().split()))
for i in range(n):
  if arr[i] <= a:
    res[0] += 1
  elif arr[i] <= b:
    res[1] += 1
  else:
    res[2] += 1
print(min(res))


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int cnt = 0;
		int ans = 0;
		for(int i = 0 ; i < 3 ;i++) {
			if(s.charAt(i) == 'R') {
				cnt++;
			}
			else {
				cnt = 0;
			}
			ans = Math.max(ans, cnt);
		}
		
		System.out.println(ans);

	}

}


Measured memory_bytes: 35564
import Control.Applicative

hours :: Int -> Int 
hours x = div x 3600

minute :: Int -> Int
minute y = div (mod y 3600) 60

second :: Int -> Int
second z = mod (mod z 3600) 60

main = do
	a <- read <$> getLine
	putStrLn $ show (hours a) ++ ":" ++ show (minute a) ++ ":" ++ show (second a)


Measured memory_bytes: 3608
A = int(input())
B = int(input())
C = int(input())
X = int(input())
res=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i + 100*j + 50*k == X:
                res += 1
print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int sum;
int main() {
	int x;
	cin>>x;
	for(int i=1;i<x+1;i*=10){
		int xi=x/i-x/(i*10)*10;
		sum+=xi;
		//cout<<sum<<endl;
	}
	if(x%sum==0){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {
        static void Main(string[] args)
        {
            int r = int.Parse(ReadLine());
            WriteLine(r*2 * Math.PI);
        }
    }
}

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

using namespace std;

int main(){
  int X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  
  vector<unsigned long int> A(X);
  vector<unsigned long int> B(Y);
  vector<unsigned long int> C(Z);

  for (int i=0; i < X; i++){
  	cin >> A[i];
  }
  
  for (int i=0; i < Y; i++){
  	cin >> B[i];
  }
  
  for (int i=0; i < Z; i++){
  	cin >> C[i];
  }

  vector<unsigned long int> output_vals;
  unsigned long int output_val=0;
  
  for (int idx_A=0; idx_A < X; idx_A++){
  	for (int idx_B=0; idx_B < Y; idx_B++){
        output_val = A[idx_A] + B[idx_B];
        output_vals.push_back(output_val);
    }
  }
  
  sort(output_vals.begin(), output_vals.end(), greater<unsigned long int>());
  
  if (output_vals.size() < K){
	for (int i=0; i < K; i++){
    	output_vals.push_back(0);
    }
  }
  
  vector<unsigned long int> output_vals_topK;
  output_vals_topK = vector<unsigned long int>(output_vals.begin(), output_vals.begin() + K);

  output_vals.clear();
  
  for (int k=0; k < K; k++){
    for (int idx_C=0; idx_C < Z; idx_C++){
      output_val = output_vals_topK[k] + C[idx_C];
      output_vals.push_back(output_val);
    }
  }
  
  sort(output_vals.begin(), output_vals.end(), greater<unsigned long int>());

  for (int i=0; i < K; i++){
  	cout << output_vals[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 35176
from pprint import pprint
from collections import deque

import sys

n, q = map(int, sys.stdin.readline().strip().split(" "))
edges = [[] for _ in range(n)]
for _ in range(n-1):
    a_i, b_i = map(int, sys.stdin.readline().strip().split(" "))
    edges[a_i-1].append(b_i-1)
    edges[b_i-1].append(a_i-1)

counter = [0] * n
p = [0] * n
for _ in range(q):
    p_i, x_i = map(int, sys.stdin.readline().strip().split(" "))
    counter[p_i-1] += x_i


parents = deque()
parents.append(0)
visited = set()
while parents:
    parent = parents.popleft()
    if parent in visited:
        continue
    visited.add(parent)
    for child in edges[parent]:
        if child in visited:
            continue
        counter[child] += counter[parent]
        parents.append(child)

print(" ".join(list(map(str, counter))))

Measured memory_bytes: 121416
n,m = map(int,input().split())
ans = 1
for i in range(1,int(m**0.5)+1):
    if m%i==0:
        x = m//i
        if x>=n:
            ans = max(ans,i)
        if i>=n:
            ans = max(ans,x)
        
print(ans)


Measured memory_bytes: 38640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,t;
  cin >> n;
  t = n%10;
  if (t == 2 || t == 4 || t == 5 || t == 7 || t == 9 ) cout << "hon" << endl;
  else if (t == 0 || t == 1 || t == 6 || t == 8) cout << "pon" << endl;
  else cout << "bon" << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define pback push_back
#define mpair make_pair
#define MODN 1000000007

using namespace std;

int main(){

    int a,b;
    cin >> a >> b;

    if((max(a,b) - min(a,b)) % 2 == 0){
        cout << max(a,b) - (max(a,b) - min(a,b)) / 2 << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define inf 1000000000000000000
const double pi = acos(-1);
const int sz = 200002;
int n, m, k;
vector<ll>a;
int main() {
	io
	cin>>n;
	a.resize(n);
	ll ans = 1;
	for(int i = 0; i<n; i++) cin>>a[i];
	sort(a.begin(), a.end());
	for(int i = 0; i<n; i++) {
		if(((ans%inf * a[i]%inf)%inf == 0 &&  ((ans*a[i]<ans) || ans*a[i] > inf)) || ((ans%inf * a[i]%inf)%inf != 0 && (ans%inf * a[i]%inf)%inf < ans)) {
			ans = -1;
			if(ans == 0 || a[i] == 0) ans = 0;
			break;
		}
		ans *= a[i];
		if(ans > inf) {
			ans = -1;
			break;
		}
		//cout<<ans<<endl;
	}
	//ans = (ll)(10000000000000*10000000);
	cout<<ans;
}



Measured memory_bytes: 3920
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
typedef pair<int,int> pii;
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T &a, T b){if(a < b){a = b;return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a > b){a = b;return true;}return false;}
/*----------------------------------------------------------------*/
// const int MOD = 998244353;
const int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){

	
	string s;
	cin >> s;
	int q;
	cin >> q;
	deque<char> d;
	for(auto c:s)d.push_back(c);
	int z = 1;
	int n = s.size();
	rep(i,q){
		int t;
		cin >> t;
		if(t == 1){
			z *= -1;
		}else{
			int f;
			char c;
			cin >> f >> c;
			if((z == 1 && f == 1) || (z == -1 && f == 2)){
				d.push_front(c);
			}else{
				d.push_back(c);
			}
			n++;
		}
	}
	if(z == 1){
		rep(i,n){
			cout << d.front();
			d.pop_front();
		}
	}
	if(z == -1){
		rep(i,n){
			cout << d.back();
			d.pop_back();
		}
	}
	cout << endl;

	

	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=gnu++17 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2017-qualb.contest.atcoder.jp/tasks/code_festival_2017_qualb_b
// rm -r -f test;oj dl https://abc158.contest.atcoder.jp/tasks/abc158_d

Measured memory_bytes: 4040
#include <stdio.h>

int main(void)
{
	int h;
	int w;
	int a;
	int b;
	int c;
	int d;
	
	while (1){
		scanf("%d %d", &h, &w);
		if ((h == 0) && (w == 0)){
			break;
		}
		for (a = 1; a <= w; a++){
			printf("#");
		}
		printf("\n");
		for (b = 1; b <= h - 2; b++){
			printf("#");
			for (c = 1; c <= w - 2; c++){
				printf(".");
			}
			printf("#");
			printf("\n");
		}
		for (d = 1; d <= w; d++){
			printf("#");
		}
		printf("\n");
		printf("\n");
	}
	
	
	return (0);
}

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

using namespace std;
int d[3001][3001];
string a;
string b;
int n,m;
string kq;
void d__p()
{
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(a[i]==b[j])
            {
                d[i][j]=d[i-1][j-1]+1;
            }
            else
                d[i][j]=max(d[i-1][j],d[i][j-1]);
        }
    }
}
int main()
{
    cin>>a>>b;
    n=a.length();
    m=b.length();
    a='.'+a;
    b='.'+b;
    d__p();
    int i=n;
    int j=m;
    while(i>0&&j>0)
    {
        if(a[i]==b[j])
        {
            kq=a[i]+kq;
            i--;
            j--;
        }
        else if(d[i][j]==d[i-1][j])
            i--;
        else
            j--;
    }
    cout<<kq;
    return 0;
}


Measured memory_bytes: 35456
<?php

$maxNumber = preg_replace('/(\\r|\\n|\\r\\n)/', '',fgets(STDIN));

$classification = [];
for($i = 1; $i <= $maxNumber; $i ++) {
    $topNumber = substr($i, 0, 1);
    $bottomNumber = $i % 10;
    
    if(empty($classification[$topNumber])){
        $classification[$topNumber] = [];
    }
    if(empty($classification[$topNumber][$bottomNumber])){
        $classification[$topNumber][$bottomNumber] = 1;
    } else {
        $classification[$topNumber][$bottomNumber] ++;
    }
}

$result = 0;
for($i = 1; $i <= 9; $i++) {
    for($j = 1; $j <= 9; $j++) {
        if(empty($classification[$i][$j]) || empty($classification[$j][$i])){
            continue;
        }
        $result += $classification[$i][$j] * $classification[$j][$i];
    }
}

echo $result.PHP_EOL;

Measured memory_bytes: 3700
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <string>
#include <numeric>
#include <vector>

using namespace std;
using ll = long long;

int main()
{
    int n;
    vector<ll> a;

    cin >> n;

    a.resize(n);

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

    sort(a.begin(), a.end());

    ll l = a[n - 1];
    ll r = a[0];

    ll m = l / 2;

    for (int i = 0; i < n - 1; i++)
    {
        if(a[i] > m)
        {
            if(abs(a[i] - m) <= abs(r - m))
            {
                r = a[i];
            }
            break;
        }
        else
        {
            r = a[i];
        }
    }

    cout << l << " " << r << endl;

    return 0;
}

Measured memory_bytes: 1400
#include <iostream>

using namespace std;

void solve(int N)
{
    // S conterá a soma dos dígitos de N
    int S = 0, n = N;

    while (n)
    {
        // Soma o dígito das unidades
        S += (n % 10);

        // Excluí o dígito das unidades
        n /= 10;
    }

    // Verifica se S divide N ou não
    cout << (N % S ? "No" : "Yes") << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    solve(N);

    return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i < n; i ++)
#define rep1(i, n) for (int i=1; i <= n; i ++)
#define _min(x, y) x = min(x, y)
#define _max(x, y) x = max(x, y)
using namespace std;

// 0 <= Cx <= 100
// 0 <= Cy <= 100
// 1 <= H


vector<vector<int> > points;

int main() {
  int n; cin >> n;
  rep (i, n) {
    int x, y, h;
    cin >> x >> y >> h;
    vector<int> point;
    point.push_back(h);
    point.push_back(x);
    point.push_back(y);
    points.push_back(point);
  }
  sort(points.begin(), points.end());
  reverse(points.begin(), points.end());
  rep(i, 101) {
    rep(j, 101) {
      int prev_h = -1;
      bool flag = true;
      rep (k, n) {
        int x, y, h;
        x = points[k][1];
        y = points[k][2];
        h = points[k][0];
        if (h == 0) {
          if (max(prev_h - abs(x - i) - abs(y - j), 0) == 0) {
            continue;
          } else {
            flag = false;
            break;
          }
        }

        int H = h + abs(x - i) + abs(y - j);
        if (prev_h == -1) {
          prev_h = H;
        } else if (prev_h != H) {
          flag = false;
          break;
        }
      }
      if (flag) {
        cout << i << " " << j << " " << prev_h << endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

a,b,c,d = map(int,readline().split())

for i in range(200):
    if even(i):
        c -= b
        if c <= 0:
            print("Yes")
            exit()
    else:
        a -= d
        if a <= 0:
            print("No")
            exit()

Measured memory_bytes: 80116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ll x;
    cin >> x;
    ll a = 0, b = 0;
    for(ll i = 0; i < 1000; i++){
        for(ll j = -1000; j < 1000; j++){
            if((ll)pow(i,5)+(ll)pow(j,5)==x){
                a = i;
                b = j;
                break;
            }
        }
    }
    cout << a << " " << -b << endl;
}

Measured memory_bytes: 4100
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int N;
int K;
vector<int> stones;
vector<int> dp;

int calcCost(int i, int j) {
    return abs(stones[i] - stones[j]);
}

int solve(int currStone) {
    if (dp[currStone] != -1) {
        return dp[currStone];
    }

    if (currStone == N) {
        return 0;
    }

    int prev_max = 0x3f3f3f3f;
    for (int i = 1; i <= K; i++) {
        if (currStone <= N-i) {
            prev_max = min(prev_max, solve(currStone + i) + calcCost(currStone, currStone + i));
        }
    }

    return dp[currStone] = prev_max;
}

int main() {
    cin >> N;
    cin >> K;

    stones = vector<int>(N+1);
    dp = vector<int>(N+1, -1);
    for (int i = 1; i <= N; i++) {
        cin >> stones[i];
    }

    cout << solve(1) << endl;

    return 0;
}


Measured memory_bytes: 5760
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

ll v(string s){
    ll tmp = s[0] - '0';
    tmp *= 10;
    tmp += s[2] - '0';
    tmp *= 10;
    tmp += s[3] - '0';
    return tmp;
}

int main(void){
    ll A; cin >> A;
    string B; cin >> B;
    // cout << v(B);
    ll b = v(B);
    cout << (A * b / 100) << endl;
    return 0;
}

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

using namespace std;

int main() 
{
    int n, x, y, i;
    scanf("%d", &n);
    
    set<int> s;
    
    for(i = 0; i < n; i++)
    {
        scanf("%d %d", &x, &y);
        
        if(x == 0)
        {
            s.insert(y);
            printf("%d\n", (int)s.size());
        }
        else if(x == 1)
        {
            printf("%d\n", s.find(y) != s.end() ? 1 : 0);
        }
    }
    
    return 0;
}


Measured memory_bytes: 12540
#include<bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forN(i, n) for(int i = 0; i <n ; ++i)
#define endl "\n"
#define noob (main)
typedef long long ll;
using namespace  std;
typedef vector<ll> vi;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const int N = 1e7 +100 ;
bool prime[N];
vector<ll>v;

int noob(){
    fastIO;
    int n ;
    cin>>n;
    string s;
    cin>>s;
    if(n%2){
        cout<<"No";
        return 0;
    }
    string s1 = s.substr(0,n/2);
    string s2 = s.substr(((n/2)));
//    cout<<s1<<" "<<s2;
    if(s1==s2){
        cout<<"Yes";
    }
    else cout<<"No";
}

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

using namespace std;

int main(){
    string str;
    int k;
    cin >> str;
    cin >> k;
    for(int i = 0;i < str.length();i++){
        int c = str[i] - 'a';
        if(c){
            if(k >= 26-c){
                str[i] = 'a';
                k -= 26-c;
            }
        }
    }
    str[str.length()-1] += k%26;
    cout << str << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define INF 100000000
typedef long long ll;

int main(){
    ll K;
    cin>>K;
    ll gu=K/2;
    ll ki=K-gu;
    cout<<gu*ki;
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

ll compute(vector<ll> &a, ll x){
	ll ret = 0;
	for(auto y : a){
		ret += abs(x - y);
	}
	return ret;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n; cin>>n;
	vector<ll> a(n);
	for(int i = 0; i < n; i++){
		cin>>a[i]; a[i] -= i;
	}
	sort(a.begin(), a.end());
	ll ans = compute(a, a[n/2]);
	if(n%2 == 0)ans = min(ans, compute(a, a[n/2 - 1]));
	cout<<ans<<endl;

	return 0;
}

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

using namespace std;

int main() {
    int x, y, z;
    int k;
    cin >> x >> y >> z;
    cin >> k;

    vector<long long> a(x), b(y), c(z);
    for (int i = 0; i < x; ++i) cin >> a[i];
    for (int i = 0; i < y; ++i) cin >> b[i];
    for (int i = 0; i < z; ++i) cin >> c[i];

    vector<long long> ab;
    for (int i = 0; i < x; ++i) {
        for (int j = 0; j < y; ++j) {
            ab.push_back(a[i] + b[j]);
        }
    }
    sort(ab.begin(), ab.end());
    reverse(ab.begin(), ab.end());

    vector<long long> abc;
    for (int i = 0; i < min(k, (int)ab.size()); ++i) {
        for (int j = 0; j < z; ++j) {
            abc.push_back(ab[i] + c[j]);
        }
    }
    sort(abc.begin(), abc.end());
    reverse(abc.begin(), abc.end());

    for (int i = 0; i < k; ++i) {
        cout << abc[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 42856
import bisect
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans = 0

for b in B:
    ok_a = bisect.bisect_left(A,b)
    ok_c = bisect.bisect_right(C,b)
    ans += ok_a*(N-ok_c)
print(ans)

Measured memory_bytes: 23360
using System;
using System.Collections.Generic;
class Program{
	static void Main(){
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		List<long[]>[] li=new List<long[]>[s[0]+1];
		long[] hy=new long[s[0]+1],hs=new long[s[0]+1],ans=new long[s[0]];
		for(int i=1;i<=s[0];i++){
			li[i]=new List<long[]>();
			hy[i]=-1;
			hs[i]=-1;
		}
		for(int i=0;i<s[1];i++){
			long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
			li[q[0]].Add(new long[]{q[1],q[2],q[3]});
			li[q[1]].Add(new long[]{q[0],q[2],q[3]});
		}
		int m=1;
		heap uy=new heap();
		for(int i=0;i<li[s[2]].Count;i++){uy.ha(li[s[2]][i][1],li[s[2]][i][0]);}
		hy[s[2]]=0;
		while(m<s[0]){
			if(hy[uy.he[0][1]]==-1){
				hy[uy.he[0][1]]=uy.he[0][0];
				for(int i=0;i<li[uy.he[0][1]].Count;i++){
					if(hy[li[uy.he[0][1]][i][0]]==-1){
						uy.ha(li[uy.he[0][1]][i][1]+uy.he[0][0],li[uy.he[0][1]][i][0]);
					}
				}
				m++;
			}
			uy.hr();
		}
		m=1;
		heap us=new heap();
		for(int i=0;i<li[s[3]].Count;i++){us.ha(li[s[3]][i][2],li[s[3]][i][0]);}
		hs[s[3]]=0;
		while(m<s[0]){
			if(hs[us.he[0][1]]==-1){
				hs[us.he[0][1]]=us.he[0][0];
				for(int i=0;i<li[us.he[0][1]].Count;i++){
					if(hs[li[us.he[0][1]][i][0]]==-1){
						us.ha(li[us.he[0][1]][i][2]+us.he[0][0],li[us.he[0][1]][i][0]);
					}
				}
				m++;
			}
			us.hr();
		}
		ans[s[0]-1]=1000000000000000-hy[s[0]]-hs[s[0]];
		for(int i=s[0]-1;i>0;i--){ans[i-1]=Math.Max(1000000000000000-hy[i]-hs[i],ans[i]);}
		Console.WriteLine(String.Join("\n",ans));
	}
}
public class heap{
	public List<long[]> he=new List<long[]>();
	public void ha(long a,long b){
		he.Add(new long[]{a,b});
		int j=he.Count-1;
		while(he[j][0]<he[(j-1)/2][0]){
			long v=he[j][0];
			he[j][0]=he[(j-1)/2][0];
			he[(j-1)/2][0]=v;
			v=he[j][1];
			he[j][1]=he[(j-1)/2][1];
			he[(j-1)/2][1]=v;
			j=(j-1)/2;
		}
	}
	public void hr(){
		he[0][0]=he[he.Count-1][0];
		he[0][1]=he[he.Count-1][1];
		he.RemoveAt(he.Count-1);
		int j=0;
		while(true){
			if(j*2+2<he.Count){
				if(he[j*2+1][0]<he[j*2+2][0]){j=j*2+1;}
				else{j=j*2+2;}
			}
			else if(j*2+1<he.Count){j=j*2+1;}
			else{break;}
			if(he[j][0]>=he[(j-1)/2][0]){break;}
			long v=he[j][0];
			he[j][0]=he[(j-1)/2][0];
			he[(j-1)/2][0]=v;
			v=he[j][1];
			he[j][1]=he[(j-1)/2][1];
			he[(j-1)/2][1]=v;
		}
	}
}

Measured memory_bytes: 56224
#include <stdio.h>

int main(void) {
	const char okList[9][9]={
	    /*       A B C D E F G H I */
		/* A */ {0,1,0,1,0,0,0,0,0},
		/* B */ {1,0,1,0,1,0,0,0,0},
		/* C */ {0,1,0,0,0,1,0,0,0},
		/* D */ {1,0,0,0,1,0,1,0,0},
		/* E */ {0,1,0,1,0,1,0,1,0},
		/* F */ {0,0,1,0,1,0,0,0,1},
		/* G */ {0,0,0,1,0,0,0,1,0},
		/* H */ {0,0,0,0,1,0,1,0,1},
		/* I */ {0,0,0,0,0,1,0,1,0}
	};
	int i,j;
	char input[16];
	for(i=0;i<1000;i++) {
		int okFlag=1;
		scanf("%s",input);
		for(j=1;input[j];j++) {
			if(!okList[input[j-1]-'A'][input[j]-'A']) {
				okFlag=0;
				break;
			}
		}
		if(okFlag)puts(input);
	}
	return 0;
}

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

int sz;
long long x;
int a[100];
int b[100];
int c[100];

int main(){
	scanf("%lld",&x);
	while(x){
		a[++sz] = x%10;
		x/=10;
	}

	for(int i=1; i<=sz; ++i) b[i] = b[i-1] + a[sz-i+1];
	for(int i=sz; i>=1; --i) c[i] = c[i+1] + a[i];
	
	long long ans = b[sz], ret = 0;
	for(int i=sz; i>=1; --i){	
		ret = a[i] - 1;
		ret += (i-1) * 9 + c[i+1];
		ans = max(ans,ret);
	}

	printf("%lld\n",ans);
}













Measured memory_bytes: 256
import java.util.*;

class Main {
	Scanner sc;

	void calc() {
		sc = new Scanner(System.in);
		String d = sc.next();
		switch (d) {
		case "SUN":
			System.out.println(7);
			break;
		case "MON":
			System.out.println(6);
			break;
		case "TUE":
			System.out.println(5);
			break;
		case "WED":
			System.out.println(4);
			break;
		case "THU":
			System.out.println(3);
			break;
		case "FRI":
			System.out.println(2);
			break;
		case "SAT":
			System.out.println(1);
			break;
		default:
			System.out.println(-1);
		}
	}

	public static void main(String[] args) {
		new Main().calc();
	}
}

Measured memory_bytes: 22996
#include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>
 
#define repd(i,a,b); for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define ll long long int
 
 
using namespace std;
int main() {
 int n; cin >> n;
 string w[n]; 
  rep(i,n){
   cin >> w[i];
  }
  string beg[n];
  string las[n];
  int len[n];
  rep(p,n){
    len[p] = w[p].length();
    beg[p] = w[p].substr(0,1);
    las[p] = w[p].substr(len[p]-1, 1);
  }
  
  
 
  rep(j,n){
   rep(k,n){
    if(w[j] == w[k] && j != k){
      cout << "No";
      exit(0);
    }
       }
       }
   rep(l,n-1){
     if(las[l] != beg[l+1]){
       cout << "No";
       exit(0);
     }
   }
cout << "Yes";  
 return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
using namespace std;


#define MAX 3020

int n;

vector<int> v[MAX];
int a[MAX];

inline bool dfs(int b) {
	bool w = false;
	for (int i = 0; i < v[b].size(); i++) {
		int go = v[b][i];
		if (a[b] > a[go]) {
			w |= dfs(go) ^ true;
		}
	}
	return w;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = 1; i < n; i++) {
		int c, b;
		scanf("%d%d", &c, &b);
		c--;
		b--;
		v[c].push_back(b);
		v[b].push_back(c);
	}
	bool outt = false;
	for (int i = 0; i < n; i++) {
		if (dfs(i)) {
			if (outt) {
				printf(" ");
			}
			outt = true;
			printf("%d", i + 1);
		}
	}
	puts("");
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <cmath>
#include <iostream>
#include <string>
#include <set>
#include <map>
#define SIZE 100005

using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

int A[SIZE], B[SIZE];

int main()
{
	int n, k; cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> A[i] >> B[i];
	ll ret = 0;

	//そのままのkを対象にして計算した結果
	for (int i = 0; i < n; i++) if ((k | A[i]) == k) ret += B[i];

	//kの各ビットに対して
	for (int i = 0; i <= 30; i++)
	{
		//kのうちビットが立ってない桁は無視
		if (!(k >> i & 1)) continue;

		ll now = 0;
		//注目してるkのビットより下を1で埋める
		for (int j = 0; j < i; j++) now |= 1 << j;

		//iより上位をkと一緒にする
		for (int j = i + 1; j <= 30; j++) if (k >> j & 1) now |= 1 << j;

		//集計開始
		ll sum = 0;

		//すべてのA[i]に対して Krに含まれるものを集計する
		for (int j = 0; j < n; j++) if ((now | A[j]) == now) sum += B[j];

		//このKrの結果を使って更新
		ret = max(ret, sum);
	}
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

const int N = 123456;

VI edges[N];

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  REP(i, 0, n - 1) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  queue<PI> que;
  que.push(PI(0, 1));
  que.push(PI(n - 1, 2));
  VI col(n, 0);
  while (not que.empty()) {
    PI t = que.front(); que.pop();
    int v = t.first;
    int c = t.second;
    if (col[v] != 0) { continue; }
    col[v] = c;
    REP(i, 0, edges[v].size()) {
      int w = edges[v][i];
      que.push(PI(w, c));
    }
  }
  int diff = 0;
  REP(i, 0, n) {
    if (col[i] == 1) {
      diff += 1;
    } else {
      diff -= 1;
    }
  }
  cout << (diff > 0 ? "Fennec" : "Snuke") << endl;
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

  bool odd = true;
  int keta = 10;
  ll cnt   = 0;
  for (int i = 1; i <= n; i++) {
    if (i >= keta) {
      odd = !odd;
      keta *= 10;
    }
    if (odd) { cnt++; }
  }
  cout << cnt << endl;
}

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

#define REP(i,n) for(int i = 0; i < n; i++)
#define ll long long
#define PI 3.141592653589

using namespace std;

ll saidaikouyakusuu(int x, int y){
    ll r;
    while(1){
        if(x >= y){
            r = x % y;
            if(r == 0) return y;
            else{
                x = y;
                y = r;
            }
        } else{
            r = y % x;
            if(r == 0) return x;
            else{
                y = x;
                x = r;
            }
        }
    }
    
}

int main(void){
    ll A, B;
    cin >> A >> B;

    cout << A * B / saidaikouyakusuu(A, B);
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Integer N = input.nextInt();
        String[] a = new String[N+1];
        long sum = 0;

        for (int i = 0; i <= N; i++) {
            if ((i % 3 == 0) && (i % 5 == 0)) {
                a[i] = "FizzBuzz";
            } else if (i % 3 == 0) {
                a[i] = "Fizz";
            } else if (i % 5 == 0) {
                a[i] = "Buzz";
            } else {
                a[i] = Integer.toString(i);
                sum += i;
            }
        }

        System.out.println(sum);
    }
}

Measured memory_bytes: 78008
import sys
def input(): return sys.stdin.readline().rstrip()
from itertools import accumulate
def main():
    n,k=map(int,input().split())
    P=[int(_) for _ in input().split()]
    PP=[0]*n
    for i in range(n):
        PP[i]=(P[i]+1)/2
    PP_ac=list(accumulate(PP))
    ans=PP_ac[k-1]
    for i in range(1,n-k+1):
        ans=max(ans,PP_ac[i+k-1]-PP_ac[i-1])
    print(ans)

if __name__=='__main__':
    main()

Measured memory_bytes: 80708
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll k,n,x,y,f,mx,dis,i,j;
	scanf("%lld %lld",&k,&n);
	ll d[n];
	for(i=0;i<n;i++)
	{
		scanf("%lld",&d[i]);
	}
	d[n]=d[0]+k;
	mx=-10;
	for(i=1;i<=n;i++)
	{
		dis=d[i]-d[i-1];
		mx=max(mx,dis);
	//	cout<<mx<<endl;
	}
	ll ans = d[n]-d[0]-mx;
	printf("%lld\n",ans);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll n;
    cin>>n;
    ll ans=1,a[n];
    rep(0,i,n){
        cin>>a[i];
        if(a[i]==0){
            cout<<0;
            return 0;
        }
    }
    rep(0,i,n){
        if(ans>(ll)1e18/a[i]){
            cout<<-1;
            return 0;
        }
        ans*=a[i];
    }
    cout<<ans;
}

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

#define range 100005
#define mod 1000000007
#define eps 1e18
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<
#define int long long 
using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;


int n,w;
ii a[200000];
int dp[200][200000];

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("test.txt","r",stdin);
    cin>>n>>w;
    for(int i=0;i<n;i++)
    {
    	cin>>a[i].fi>>a[i].se;
    }
    for(int i=0;i<=n;i++)
    	for(int j=0;j<=100000;j++)
    		dp[i][j] = eps;
    dp[0][0] = 0;
    dp[0][a[0].se] = a[0].fi;
    for(int i=1;i<n;i++)
    {
    	for(int j=0;j<=100000;j++)
    	{
    		dp[i][j] = dp[i-1][j];
    		if(j-a[i].se>=0)
    		  dp[i][j] = min(dp[i][j],dp[i-1][j - a[i].se]+a[i].fi);
    	}
    }
    int output = 0;
    for(int i=0;i<=100000;i++)
    {
        if(dp[n-1][i]<=w)
        	output = i;
    }
    /*for(int i=0;i<n;i++)
    {
    	cout<<"i = "<<i<<endl;
    	for(int j=0;j<200;j++)
    	{
    		cout<<" j = "<<j<<"  "<<dp[i][j]<<"  ";
    	}
    	cout<<endl;
    }*/
    cout<<output;
	return 0;
}

Measured memory_bytes: 159232
#include <stdio.h>
#include <string.h>
#include <ctype.h>



int main(void)
{
	int i;
	int length;
	char str[5000+1];

	fgets(str, sizeof(str), stdin);
	length = strlen(str);
//	if(str[length - 1] == '\n'){
//		str[length - 1] = '\0';
//	}
	
	for(i = 0; i < length; i++){
		str[i] = toupper(str[i]);
	}
	printf("%s",str);
	
	return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;
 
int main(){

	int w, n;
	cin >> w >> n;
	vector<int> ans(w);
	rep(i, w)  ans[i] = i+1;
	rep(i, n){
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(ans[--a], ans[--b]);
	}
 
 	rep(i, w) cout << ans[i] << endl;
 
	return 0;
}

Measured memory_bytes: 3156
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i) 
const long long INF = 10e9 + 7;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	/
	/
	/
	*/
	ll a, b;
	cin >> a >> b;
	ll temp = 0;
	ll ans = 0;
	ll n = 0;
	rep0(i, a) {
		cin >> temp;
		ans += min(temp - n, b);
		n = temp;
	}
	cout << ans + b << endl;
	return 0;
}


Measured memory_bytes: 256
from collections import deque
import sys
input = sys.stdin.readline

def main():
    S = list(input().strip())
    Q = int(input())

    d = deque(S)
    mode = True

    for _ in range(Q):
        query = input().split()

        if query[0] == "1":
            mode = not mode
        elif query[0] == "2":
            F, C = query[1], query[2]
            if F == "1":
                if mode:
                    d.appendleft(C)
                else:
                    d.append(C)
            elif F == "2":
                if mode:
                    d.append(C)
                else:
                    d.appendleft(C)

    s = list(d)
    if not mode:
        s = s[::-1]

    print(''.join(s))

if __name__ == "__main__":
    main()


Measured memory_bytes: 10996
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\n'
#define INF 1e18
#define PI 3.14159265358979323846
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    
    freopen("output.txt", "w", stdout);
    #endif

    ll l,r,d;
    cin>>l>>r>>d;
    ll i;
    ll ans=0;
    for(i=l;i<=r;i++)
    {
        if(i%d==0)
        {
            ans++;
        }
    }
    cout<<ans;
}

   

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int H, W, M;
int cntH[int(3e5+5)], cntW[int(3e5+5)];
Pii PH[int(3e5+5)], PW[int(3e5+5)];
map <Pii, bool> mp;

int main(){
  cin >> H >> W >> M;
  for (int i = 0; i < M; i++){
    int h, w; cin >> h >> w;
    cntH[h]++; cntW[w]++;
    mp[{h, w}] = true;
  }

  for (int i = 0; i <= H; i++) PH[i] = {cntH[i], i};
  sort(PH, PH + H + 1, greater<Pii>()); 
  for (int i = 0; i <= W; i++) PW[i] = {cntW[i], i};
  sort(PW, PW + W + 1, greater<Pii>());


  int ans = PH[0].fi + PW[0].fi;
  for (int i = 0; i <= H; i++){
    if (PH[0].fi > PH[i].fi) break;
    for (int j = 0; j <= W; j++){
      if (PW[0].fi > PW[j].fi) break;
      if (!mp[{PH[i].se, PW[j].se}]){
        cout << ans << endl;
        return 0;
      }
    }
  }
  cout << ans - 1 << endl;

  return 0;
}


Measured memory_bytes: 29364
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>

using namespace std;

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

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repi(i, j, n) for(int i = j;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define F first
#define S second

ll inv[2<<20]; // ith index will store (1/i)%mod
ll finv[2<<20]; // ith index will store (1/i!)%mod
ll fact[2<<20]; // ith index will store (i!)%mod

void populate(int n) {
    fact[0] = fact[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;

    for(int i = 2;i <= n;i++) {
        fact[i] = (i*fact[i-1])%mod;
        inv[i] = mod-((inv[mod%i]*(mod/i))%mod);
        finv[i] = (finv[i-1]*inv[i])%mod;
    }
}

ll nCr(int n, int r) {
  return fact[n]*finv[n-r]%mod*finv[r]%mod;
}

int sz, k;
string s;

const int NN = 2000005;
ll p25[NN], p26[NN];

int main() {

// freopen("input.in","r",stdin);
// freopen("output.out","w",stdout);

 cin>>k>>s;sz = (int) s.size();
 populate(NN);

 p25[0] = p26[0] = 1;
 for(int i = 1;i < NN;i++) {
   p25[i] = 25LL*p25[i-1]%mod;
   p26[i] = 26LL*p26[i-1]%mod;
 }

 ll ans = 0;
 for(int j = 0;j <= k;j++) {
   (ans += nCr(sz+k-1-j, sz-1)*p25[k-j]%mod*p26[j]%mod)%=mod;
 }

 cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 82420
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = a; i < (int)b; i++)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  int a, b, k ;
  cin >> a >> b >> k ;
  vector<int> vec ;
  
  FOR(i,1,max(a,b)+1){
    if(a%i==0 && b%i==0){
      vec.push_back(i) ;
    }
  }
  
  int n = vec.size() ;
  
  cout << vec.at(n-k)<<endl ;
  

  return 0 ;
}





Measured memory_bytes: 256
function main(lines) {
  const [A, B, H, M] = splitN(lines[0]);

  const
    hR =( H / 12 + M / 60 / 12) * 2 * Math.PI,
    mR = M / 60 * 2 * Math.PI,
    r = Math.max(hR, mR) - Math.min(hR, mR),
    res = Math.sqrt( (A ** 2) + (B ** 2) - (2*A*B*Math.cos(r)) );
  
  console.log(res);
}


main( require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n") );



function splitN(s) {
  return s.split(' ').map(Number);
}

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

int main(){
  double t,x;
  cin>>t>>x;
  
  printf("%.10lf",t/x);
  return 0;
}



Measured memory_bytes: 256
# AGC021A - Digit Sum 2
def main():
    N = input().rstrip()
    l = len(N)
    if l == 1:
        print(N)
        return
    f = int(N[0])  # first digit
    ans = f + 9 * (l - 1)
    flg = set(N[1:]) == {"9"}
    print(ans if flg else ans - 1)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
<?php
// From https://qiita.com/yoshikyoto/items/6924478283dbdd549e4b
class Scanner {
    private $arr = [];
    private $count = 0;
    private $pointer = 0;
    public function next() {
        if($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }
    public function hasNext() {
        return $this->pointer < $this->count;
    }
    public function nextInt() {
        return (int)$this->next();
    }
    public function nextDouble() {
        return (double)$this->next();
    }
}
// From https://qiita.com/yoshikyoto/items/6924478283dbdd549e4b
list($N)=sscanf(trim(fgets(STDIN)),"%d");
$sc = new Scanner();
$A=array();
for($i=0;$i<$N;$i++){
    $A[$i] = $sc->nextInt();
}
$sc = new Scanner();
$B=array();
for($i=0;$i<$N;$i++){
    $B[$i] = $sc->nextInt();
}
$sc = new Scanner();
$C=array();
for($i=0;$i<$N-1;$i++){
    $C[$i] = $sc->nextInt();
}
$sum=0;
$pre=11111111;
for($i=0;$i<$N;$i++){
    $sum += $B[$A[$i]-1];
    if($pre == $A[$i]-1-1){
        $sum += $C[$pre];
    }
    $pre = $A[$i]-1;
}
printf($sum);
//

Measured memory_bytes: 4604
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n,g,x,t,h,k=0,f,l=0;
    cin>>n;
    if(n < 10)
    {
        cout<<n<<endl;
    }
    else if(n < 100)
    {
        cout<<"9"<<endl;
    }
    else if(n < 1000)
    {
        cout<<n-90<<endl;
    }
    else if(n < 10000)
    {
        cout<<"909"<<endl;
    }
    else if(n >= 10000 && n < 100000)
    {
        cout<<n-9090<<endl;
    }
    else if(n == 100000)
    {
        cout<<n-9091<<endl;
    }

}


Measured memory_bytes: 256
n,t=map(int,input().split())
p=list(map(int,input().split()))
ans=t
temp=0
for i in range(1,n):
  if p[i]-(p[i-1]+t)>=0:
    ans=ans+t
  else:
    ans=ans+p[i]-p[i-1]
print(ans)

Measured memory_bytes: 26836
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <set>
#include <iostream>
#include <map>
#include <algorithm>
const double PI = acos(-1.0);
const double EPS = 1e-9;
using namespace std;

const int maxn = 1e5 + 5;
const int INF = 0x3f3f3f3f;
#define LL long long

int a[maxn];

int main()
{
	int n;
	while (scanf("%d", &n) != EOF)
	{
		int cnt = 0;
		for (int i = 0; i < n; i++)
		{
			int u;
			scanf("%d", &u);
			if (u & 1)
				cnt++;
		}
		if (cnt & 1)
			puts("NO");
		else
			puts("YES");
	}
	return 0;
}

Measured memory_bytes: 256