akhauriyash/Code-Regression huggingface dataset:
fun main(args: Array<String>) {
    val (L, R) = readLine()!!.split(" ").map(String::toLong)

    if (2019 <= R - L) {
        println(0)
        return
    }

    var min = Long.MAX_VALUE
    for (i in L until R) {
        for (l in L + 1..R) {
            min = Math.min(i * l % 2019, min)
            if (min == 0L) {
                println(0)
                return
            }
        }
    }
    println(min)
}




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

int main(){
	ll n,m;
	cin>>n>>m;
	ll a[m],b[m];
	//pair<ll,ll>ab[m];
	int t[n+1];
	for(ll i=0;i<n+1;i++)t[i]=0;
	for(ll i=0;i<m;i++){
		cin>>a[i]>>b[i];
		//ab[i] = make_pair(a[i],b[i]);
		if(a[i]==1)t[b[i]]=1;
		//cout<<"aaa"<<endl;
	}
	//sort(ab,ab+m);
	for(ll i=0;i<m;i++){
		if(b[i]!=n)continue;
		if(t[a[i]]==1){
			cout<<"POSSIBLE"<<endl;
			return 0;
		}
	}
	cout<<"IMPOSSIBLE"<<endl;
	return 0;

}


Measured memory_bytes: 4096
from collections import deque
n, m = map(int, input().split())
p = list(map(int, input().split()))
graph = [[] for _ in range(n+1)]
for _ in range(m):
    x, y = map(int, input().split())
    graph[x].append(y)
    graph[y].append(x)
seen = [False]*(n+1)
ans = 0
for i in range(1, n+1):
    if seen[i] or len(graph[i])==0:
        continue
    queue = deque([i])
    seen[i] = True
    inds = {i}
    ps = {p[i-1]}
    while len(queue)>0:
        node = queue.popleft()
        for c_node in graph[node]:
            if seen[c_node]:
                continue
            seen[c_node] = True
            inds.add(c_node)
            ps.add(p[c_node-1])
            queue.append(c_node)
    ans += len(inds&ps)
for ind, i in enumerate(p):
    if seen[ind+1]:
        continue
    if ind+1==i:
        ans += 1
print(ans)

Measured memory_bytes: 41180
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[] a = new int[N];
		for(int i = 0; i < N; i++){
			a[i] = scanner.nextInt();
		}
		int count = 0;
		for(int i = 0; i < N; i++){
			int v = a[i];
			int j = i - 1;
			while(j >= 0 && v < a[j]){
				a[j+1] = a[j];
				j--;
				a[j+1] = v;
				count++;
			}
			for(int k = 0; k < N; k++){
				if(k != N-1){
					System.out.print(a[k] + " ");
				}else if(k == N-1){
					System.out.print(a[k]);
				}
			}
			System.out.println();
		}
	}
}



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

int main()
{
  ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
  int n;
  cin >> n;
  
  if(n < 1200)
    cout << "ABC" << endl;
  else
    cout << "ARC" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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, k;
	cin >> a >> b >> k;
	if(a > k) a -= k;
	else{
		k -= a;
		a = 0;
		b = max(0LL, b-k);
	}
	cout << a << " " << b << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int A,B,C;
int main()
{
	int f=2,s=1;
	cin>>A;f-=A==5;s-=A==7;
	cin>>B;f-=B==5;s-=B==7;
	cin>>C;f-=C==5;s-=C==7;
	if(f==0 && s==0)cout<<"YES";
	else cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 2000001

int a[N],c[N],b[N];

int main(){
  int i,j,n,k=0;
   
  scanf("%d",&n);

  for(i = 1; i < n+1; i++){
    scanf("%d",&a[i]);
    if(a[i] >k){
      k = a[i];
    }
  }
  for(i = 0; i < k+1; i++){
    c[i] = 0;
  }
  for(j = 1; j < n+1; j++){
    c[a[j]]++;
  }

  for(i = 1; i <= k; i++){
    c[i] = c[i-1] + c[i];
  }
 
  for(j = n; j > 0; j--){
    b[c[a[j]]] = a[j];
    c[a[j]]--;
  }

  for(i = 1; i < n; i++){
    printf("%d ",b[i]);
  }
  printf("%d\n",b[n]);

  return 0;
}

Measured memory_bytes: 17892
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <queue>
#include <assert.h>
using namespace std;
#define LL long long
#define pii pair < int , int >
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int n,q;
vector < int > E[200005];
LL ft[200005];
int idx = 0, L[200005], R[200005];

void upd( int x, LL v ){
	while ( x <= idx ){
		ft[x] += v;
		x += x & (-x);
	}
}

LL query( LL x ){
	LL ans = 0;
	while ( x ){
		ans += ft[x];
		x -= x & (-x);
	}
	return ans;
}

void dfs( int u , int p ){
	L[u] = ++idx;
	for ( int v : E[u] ){
		if ( v == p ) continue;
		dfs(v,u);
	}
	R[u] = idx;
}

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	// scanf("%d",&n);
	cin >> n >> q;
	for ( int i = 0; i < n-1; i++ ){
		int u ,v;
		cin >> u >> v;
		E[u].pb(v);
		E[v].pb(u);
	}
	dfs(1,-1);

	for ( int i = 0; i < q; i++ ){
		LL p,x;
		cin >> p >> x;
		upd(L[p], x);
		upd(R[p]+1, - x);
	}

	for ( int i = 1; i <= n; i++ ){
		cout << query(L[i]);
		if ( i < n ) cout << " ";
		else cout << endl;
	}
	return 0;
}

Measured memory_bytes: 25600
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <iomanip>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    string s;
    int k;
    cin>>s>>k;
    for(int i=0;i<k;i++){
        if(s[i]=='1')continue;
        else{
            cout<<s[i];
            return 0;
        }
    }
    cout<<1;
}

Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i)
x = 1
if a.count(0) > 0
    puts 0
    exit
elsif a.count{|j| j>10**18} > 0
    puts -1
    exit
end
a.each do |i|
  x *= i
  if x > 10**18
    x = nil
    break
  end
end
if x == nil
  puts -1
else
  puts x
end

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

int main()
{
	int minj, n, a[100], tmp, count = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n - 1; i++)
	{
		minj = i;
		for (int j = i; j < n; j++)
			if (a[j] < a[minj])
				minj = j;
		if (minj != i)
		{
			tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;
			count++;
		}
	}
	for (int i = 0; i < n; i++)
	{
		if (i)
			cout << " ";
		cout << a[i];
	}
	cout << endl << count << endl;

	return 0;
}


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

using namespace std;

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64; // 9e18
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

//const double PI = 3.141592653589793238463;
//const int MAXN = 1000500;
//const int MAXVALUE = 1000000500;
//const long double EPS = 1e-7;
const i64 INF = 1e18;
//i64 mod = 1e9 + 7;


i64 T, n, m, k;
//vector <vector<i64>> a;
//vector <i64> a;
//vector <i64> b;
//vector <i64> dp;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(16);


    //cin >> T;
    T = 1;

    for (i64 tt = 0; tt < T; ++tt) {

        //cin >> n;

        string s;
        cin >> s;

        i64 res = 0;

        if (s[0] == 'R') {
            if (s[1] == 'R') {
                if (s[2] == 'R') {
                    res = 3;
                }
                else {
                    res = 2;
                }
            }
            else {
                res = 1;
            }
        }
        else {
            if (s[1] == 'R') {
                if (s[2] == 'R') {
                    res = 2;
                }
                else {
                    res = 1;
                }
            }
            else {
                if (s[2] == 'R') {
                    res = 1;
                }
            }
        }

        cout << res << endl;

    }
    return 0;
}

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

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

int main(){
  ll a, b;
  cin >> a >> b;

  if((a+b)%2==0) cout << (a+b)/2;
  else cout << "IMPOSSIBLE";
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void)
{
	// Your code here!
	int a,b,c;
	cin >> a>>b>>c;
	bool decision = false;
	for (int i = a; i <= a * b; i += a)
	{
		if (i % b == c)
		{
			decision = true;
		}
	}
	if (decision == true)
	{
		cout << "YES "<< endl;
	}
	else
	{
		cout << "NO" << endl;
	}
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
#define pb push_back
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 1e5+6;
int a[N];
ll b[N];
int n; 
ll k;
bool ch(ll x){
	ll ret = 0;
	for(int i=0;i<n;i++){
		if(a[i]<=x)ret+=b[i];
		if(ret>=k)return true;
	}
	return false;
}
void solve(){
	cin>>n>>k; 
	for(int i=0;i<n;i++)cin>>a[i]>>b[i];
	ll st = 1;
	ll en = 1e5+1;
	while(st<=en){
		ll mid = (st+en)/2;
		if(ch(mid)){
			en = mid-1;
		}
		else{
			st = mid+1;
		}
	}
	cout<<st<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


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

int main(){
  int H,W;
  cin >> H >> W;
  
  while(H!=0){
      int i,j;
  for (  i = 0; i < H; i++ ){
    for (  j = 0; j < W; j++ ){
        if(i==0||i==H-1||j==0||j==W-1)
	  cout << "#";
	else cout << ".";
    }
        cout << endl;
    }
   cout << endl;
   cin >> H >> W;
}
return 0;
}





Measured memory_bytes: 3096
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s = s.trim_right().to_string();
    let mut t = String::new();
    std::io::stdin().read_line(&mut t).unwrap();
    t = t.trim_right().to_string();

    let mut flag = false;

    for _ in 0..s.len() {
        let new_s: char = s.pop().unwrap();
        s.insert(0, new_s);
        if s == t {
            flag = true;
            break;
        }
    }
    if flag {
        println!("Yes");
    } else {
        println!("No");
    }
}



Measured memory_bytes: 4476
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> ii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector <ii> vii;
typedef vector <vii> vvii;
#define endl '\n'
#define PB push_back
#define MP make_pair
#define fr first
#define sc second
#define OO (1000000000)         // ToDo
#define EPS (1e-9)              // ToDo
#define MOD (1000000007)        // ToDo
#define all(v) ((v).begin()),((v).end())
#define WT(x) cout<< #x <<" = "<<"\""<< (x) <<"\""<<endl
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
void read_file(bool outToFile = true){
#ifdef LOCAL_TEST
    freopen("in", "rt", stdin);
    if(outToFile)
    freopen("out", "wt", stdout);
#endif
}
//
int main()
{
    read_file();
    int a, b;
    cin>>a>>b;
    string ans;
    if(a%3 == 0 || b%3 == 0 || (a+b)%3 == 0)
        ans = "Possible";
    else
        ans = "Impossible";
    cout<< ans <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<31)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define vii vector<int>
#define vll vector<long long>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
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; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, x;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n >> x;
    vii a(n);
    rep(i, 0, n) cin >> a[i];
    sort(all(a));
    int ans = 0;
    rep(i, 0, n) {
        if (x >= a[i]) ans++;
        x -= a[i];
        if (x <= 0) break;
    }
    if (x > 0) ans--;
    cout << ans << endl;
    return 0;
}


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

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

	if (d == 25)
	{
		cout << "Christmas" << endl;
	}
	else if (d == 24)
	{
		cout << "Christmas Eve" << endl;
	}
	else if (d == 23)
	{
		cout << "Christmas Eve Eve" << endl;
	}
	else
	{
		cout << "Christmas Eve Eve Eve" << endl;
	}
}


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

int main() {
    int r, c;
    cin >> r >> c;
    int a[r+1][c+1];
    
    for (int i = 0;i < r+1;i++){
        for (int j = 0;j < c+1;j++){
            a[i][j] = 0;
        }
    }
    
    for (int i = 0;i < r;i++){
        for (int j = 0;j < c;j++){
            cin >> a[i][j];
        }
    }
    
    for (int i = 0;i < r+1;i++){
        for (int j = 0;j < c;j++){
            a[i][c] += a[i][j];
        }
    }
    for (int i = 0;i < c+1;i++){
        for (int j = 0;j < r;j++){
            a[r][i] += a[j][i];
        }
    }
    
    for (int i = 0;i < r+1;i++){
        for (int j = 0;j < c+1;j++){
            if (j != 0) cout << " ";
            cout << a[i][j];
        }
        cout << endl;
    }

    
    return 0;
}

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

int main() {
  long long a,b,c;
  cin>>a>>b>>c;
  vector<vector<char>> vec(a, vector<char>(b, 'x')); 
  long long d = max(a,b);
  long long ans=c/d;
  if(c%d==0){
    cout <<ans<<endl;
  }
  else {
    cout << ans+1<< endl;
  }
}
  
  

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

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
  
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define ll long long
#define fill fill_n
#define pf push_front
#define pb push_back
#define FOR(i,l,r) for(int i=l;i<r;i++)
#define ROF(i,r,l) for(int i=r;i>=l;i--)
#define comp(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define infile freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
typedef vector<int> vi;
typedef vector<ll> vli;
typedef vector<pair<int,int>> vpi;

const int M = 1e9+7;
const int N = 2e5;
ll po(int,int);


void solve(){
    ll d,t,s;
    cin>>d>>t>>s;
    if(s*t<d) cout<<"No\n";
    else cout<<"Yes\n";
    
}





int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int t=1;
    //cin>>t;
    FOR(i,1,t+1){
        //cout<<"Case #"<<i<<": "; 
        solve();
    }
    
	return 0;
	
	
}


ll po(int a,int b){
    if(b==0) return 1;
    ll ans=1;
    if(b%2==0){
        ans = po(a,b/2)%M;
        ans=(ans%M * ans%M)%M;
    }
    else{
        ans = po(a,(b-1)/2)%M;
        ans = (ans%M * ans%M * a)%M;
    }
    return ans%M;
}


Measured memory_bytes: 3636
import Text.Printf
putTuple :: (Int,Int,Double) -> IO ()
putTuple (a,b,c)=printf("%d %d %f\n") a b c

main=getLine>>=putTuple.(\[a,b]->(a`div`b,a`mod`b,(fromIntegral a)/(fromIntegral b))).map (read ::String->Int).words

Measured memory_bytes: 4072
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		double a;
		double b;
		double c;
		double d;
		double e;
		double f;
		double X;
		double Y;
		while(scan.hasNext()){
			a = scan.nextInt();
			b = scan.nextInt();
			c = scan.nextInt();
			d = scan.nextInt();
			e = scan.nextInt();
			f = scan.nextInt();
			X = (1/(a*e-b*d))*(e*c-b*f);
			Y = (1/(a*e-b*d))*(-d*c+a*f);
			if(Math.abs(X) < 0.0005) X = 0;
			if(Math.abs(Y) < 0.0005) Y = 0;
			System.out.printf("%.3f %.3f",X,Y);
			System.out.println("");
		}
	}
}

Measured memory_bytes: 18208
data = []
while True:
    try:
        data.append(tuple(map(int, input().split(','))))
    except:
        break
print(sum(data[i][0] * data[i][1] for i in range(len(data))))
print(int(sum(data[i][1] for i in range(len(data))) / len(data) + 0.5))

Measured memory_bytes: 7624
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
int main() {
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    h=h+m/60;
    double pi=3.141592653589793238;
    double t=2*pi*((h/12)-(m/60));
    double ans;
    ans=sqrt(a*a+b*b-2*a*b*cos(t));
    cout<< fixed << setprecision(15) << ans << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int things[N-1];
  for (int i=0; i<N; ++i) cin >> things[i];

  sort(things, things + N, greater<int>());
  things[0] /= 2;
  int sum;
  for (int i=0; i<N; ++i) {
    sum += things[i];
  }

  cout << sum << endl;
}

Measured memory_bytes: 256
//
//  AtCoder124.cpp
//  playground
//
//  Created by Yang Ruiguo on 25/4/19.
//  Copyright © 2019 Yang Ruiguo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cstring>

using namespace std;

int GetMostHands(int k, vector<int>& dir, vector<int>& num) {
    int mostHands = 0;
    int currentHands = 0;

    for(int i = 0; i <= 2 * k; ++i) {
        currentHands += num[i];
    }

    mostHands = currentHands;
    for(int i = 2; i < dir.size(); i += 2) {
        currentHands -= num[i - 1] + num[i - 2];
        if(i + 2 * k - 1 < dir.size()) {
            currentHands += num[i + 2 * k - 1];
        }
        if(i + 2 * k < dir.size()) {
            currentHands += num[i + 2 * k];
        }
        mostHands = max(mostHands, currentHands);
    }

    return mostHands;
}

int main() {
    int n = 5, k = 1;
    string str("00010");
    cin >> n >> k;
    cin >> str;
    vector<int> dir;
    vector<int> num;

    if(str[0] == '0') {
        dir.push_back(1);
        num.push_back(0);
    }

    int sdir = str[0] - '0';
    int snum = 1;
    for(int i = 1; i < str.size(); ++i) {
        if(str[i] - '0' == sdir) {
            snum += 1;
        } else {
            dir.push_back(sdir);
            num.push_back(snum);
            sdir = str[i] - '0';
            snum = 1;
        }
    }
    dir.push_back(sdir);
    num.push_back(snum);

    if(dir.size() <= k * 2 + 1) {
        cout << n << endl;
    } else {
        int mostHands = GetMostHands(k, dir, num);
        cout << mostHands << endl;
    }

    return 0;
}


Measured memory_bytes: 1404
#include <iostream>
#include <stdint.h>
#include <vector>
#include <string>
#include <sstream>

using namespace std;

vector<string> answers;

void print(short h0, short w0, short h1, short w1)
{
  ostringstream ss;
  ss << h0+1 << ' ' << w0+1 << ' ' << h1+1 << ' ' << w1+1;
  answers.push_back(ss.str());
}

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

  short A[500][500];
  
  for (short h=0; h<H; ++h)
    for (short w=0; w<W; ++w)
      cin >> A[h][w];

  int count=0;

  for (short h=0; h<H; ++h) {
    if (h%2==0) {
      short w=0;
      for (; w<W-1; ++w) {
	if (A[h][w]%2==1) {
	  --A[h][w];
	  ++A[h][w+1];
	  print(h,w,h,w+1);
	}
      }
      // w == W-1
      if (A[h][w]%2==1 && h<H-1) {
	--A[h][w];
	++A[h+1][w];
	print(h,w,h+1,w);
      }
    } else {
      short w=W-1;
      for (; w>0; --w) {
	if (A[h][w]%2==1) {
	  --A[h][w];
	  ++A[h][w-1];
	  print(h,w,h,w-1);
	} 
      }
      // w == 0
      if (A[h][w]%2==1 && h<H-1) {
	--A[h][w];
	++A[h+1][w];
	print(h,w,h+1,w);
      }
    }	     
  }

  cout << answers.size() << endl;
  for (auto& str : answers) {
    cout << str << endl;
  }
    
  return 0;
}


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

int main()
{
	int h, a, i=0;
	cin >> h >> a;
	
	while(1)
	{
		if(h<=0)
			break;
		i++;
		h=h-a;
	}
	
	
	cout << i << endl;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

pll A[100005];
int main()
{
    ll N;
    cin>>N;
    
    REP(i, N)
    {
        cin >> A[i].first;
        A[i].second = i;
    }
    sort(A, A + N, [](pll a, pll b) { return a.first < b.first; });
    REP(i, N)
    {
        cout << A[i].second + 1 << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <map>
#include <bitset>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+" ";
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
constexpr const ll INF = 1e15;
constexpr const ll MOD = 1000000007;
constexpr const ll MAX = 15;
constexpr int nx[4] = {1,0,-1,0};
constexpr int ny[4] = {0,1,0,-1};
typedef pair<ll,ll> P;
vector<vector<ll>> Next(string &s){
    int n = s.size();
    vector<vector<ll>> res(n+1, vector<ll>(26, n));
    for (int i = n-1; i >= 0; --i) {
        rep(j,26) res[i][j] = res[i+1][j];
        res[i][s[i]-'a'] = i;
    }
    return res;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    ll n = s.size();
    vector<vector<ll>> next = Next(s);
    vector<ll> dp(n+1,INF);
    vector<char> re(n+1,'a');
    dp[n] = 1;
    for(ll i = n-1;i >= 0;i--){
        rep(j,26){
            if (next[i][j] >= n){
                if (dp[i] > 1){
                    dp[i] = 1;
                    re[i] = 'a'+j;
                }
            }
            else if(chmin(dp[i],dp[next[i][j]+1]+1)){
                re[i] = 'a'+j;
            }
        }
    }

    string ans = "";
    ll index = 0;
    while(index <= n){
        ans += re[index];
        index = next[index][re[index]-'a']+1;
    }

    PRINT(ans);
}


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

#define rev(v) reverse(v.begin(), v.end());
#define mx(v) max_element(v.begin(), v.end());
#define mn(v) min_element(v.begin(), v.end()); 
#define fastio() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL));

//ffs = lsb, clz = l0's, ctz = r0's, popcount = 1's 
 //++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
 //++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++

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

int main(){
    fastio();
    int a,x; cin >> a >> x;
    vector<int> v(a);
    int ans = 0;
    int cnt = 1;
    for(int i = 0; i < a ; ++i){
        cin >> v[i];
        ans += v[i];
        if(ans <= x){
            ++cnt;
        }
    }
    cout << cnt << '\n';
}

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;



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

	int n;cin>>n;

	if(n%2){
		writeln(0);
		return 0;
	}

	vector<int> p(n);

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

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

	writeln(p[n/2]-p[n/2-1]);


}




Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<set>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<cstdio>
#include<cstring>
#include<string>
#include<cstdlib>
#include<cmath>
using namespace std;

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

typedef long long ll;

int n,m;
int sumT,sumS;
int t[102],s[102];

void solve(){
  sort(t,t+n);
  sort(s,s+m);

  int ti = 0, si = 0;

  while(ti < n && si < m){
    int st = sumT - t[ti] + s[si];
    int ss = sumS - s[si] + t[ti];
    if(st == ss){
      cout<<t[ti]<<" "<<s[si]<<endl;
      return;
    }

    if(si + 1 >= m || ss < st && ti + 1 < n){//if(si + 1 >= m || (ti + 1 < n && t[ti] < s[si])){
      ti++;
    }
    else{
      si++;
    }
  }

  cout<<-1<<endl;
}

int main(){
  while(cin>>n>>m,n||m){
    sumT = sumS = 0;
    rep(i,n){
      cin>>t[i];
      sumT += t[i];
    }
    rep(i,m){
      cin>>s[i];
      sumS += s[i];
    }
    solve();
  }
}

Measured memory_bytes: 0
// KOI NI YAAR SAB SAHI HOEGA  BAS  CHORRO MAT
// ENJOR KARO YAAR
// HAAR MAT MAANO
// // APNA TIME AAYEGA
// BEILIEVE IN GOD
#include<bits/stdc++.h>
using namespace std;
#define lli int
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define loopb(i,a,b) for (lli i=a;i>=b;i--)
#define pb push_back
#define mod 1000000007
#define fast() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define gcd(a,b) (__gcd((a),(b)))
#define lcm(a,b)(((a)*(b))/gcd((a),(b)))
#define ma 1e18
#define bc __builtin_popcountll
#define vi vector<lli>
#define pr pair<lli,lli>
#define vp vector<pr>
#define F  first
#define S   second
#define lld  double
#define PI  3.14159265358979
#define pri  priority_queue<ll>
#define prim  priority_queue<ll,vector<ll>,greater<ll>>
#define flush  cout<<flush

const lli  N=3e3+10;
 
vector<vector<lld>> dp(N,vector<lld>(N,-1)); 
lli n;
vector<lld>a;



lld solve(lli index , lli tails)
{if(index == n)
{if(tails<=n/2)
{return 1;
}
else
{return 0;
}
}
if(dp[index][tails]!=-1)
{return dp[index][tails];
}
return dp[index][tails] = (a[index] *1.0 * solve(index+1,tails)) + (1-a[index])  * 1.0 * solve(index+1,tails+1);
}

int main()
{lli num;
fast();
cin>>n;
a.resize(n);
loop(i,0,n)
{cin>>a[i];
}

cout<<fixed<<setprecision(10)<<solve(0,0)<<"\n";
}


Measured memory_bytes: 74960
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

unsigned long  gcd(unsigned long x, unsigned long y)
{
        if (y == 0) {
                return x;
        } else {
                return gcd(y, x % y);
        }
}

long long kaijou(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}


int main(void){
    int n;
    unsigned long long y;
    int a, b;
    scanf("%d %lld", &n, &y);
    for (a = 0; a <= n; a++){
        for (b = 0; b <= n-a; b++){
            if (10000*a+5000*b+1000*(n-a-b) == y && a+b+(n-a-b) == n){
                printf("%d %d %d\n", a, b, n-a-b);
                return 0;
            }
        }
    }

    printf("-1 -1 -1\n");


    return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC093.A
{
    class Program
    {
        static void Main ()
        {
            var s = new string (Console.ReadLine ().OrderBy (elem => elem).ToArray ());
            Console.Error.WriteLine (s);
            Console.WriteLine (s == "abc" ? "Yes" : "No");
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner ()
        {
            s = new string[0];
            i = 0;
        }

        public string Next ()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine ();
            while (st == "") st = Console.ReadLine ();
            s = st.Split (cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next ();
            i = 0;
            return s[i++];
        }

        public int NextInt ()
        {
            return int.Parse (Next ());
        }
        public int[] ArrayInt (int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextInt () + add;
            }
            return Array;
        }

        public long NextLong ()
        {
            return long.Parse (Next ());
        }

        public long[] ArrayLong (int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextLong () + add;
            }
            return Array;
        }

        public double NextDouble ()
        {
            return double.Parse (Next ());
        }

        public double[] ArrayDouble (int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDouble () + add;
            }
            return Array;
        }

        public decimal NextDecimal ()
        {
            return decimal.Parse (Next ());
        }

        public decimal[] ArrayDecimal (int N, decimal add = 0)
        {
            decimal[] Array = new decimal[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDecimal ();
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s=="Sunny"){
		cout<<"Cloudy"<<endl;
	}
	else if(s=="Cloudy"){
		cout<<"Rainy"<<endl;
	}
	else{
		cout<<"Sunny"<<endl;
	}
}

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

using namespace std;

int main(){
  map<int,long long int> m;
  int N;
  long long int idx;
  cin >> N >> idx;
  for(int i = 0; i < N; i++){
    int a, b;
    cin >> a >> b;
    m[a] += b;
  }
  
  long long int c = 0LL;
  for(auto iter = m.begin(); iter != m.end(); iter++){
    c += iter->second;
    if(c >= idx){
      cout << iter->first;
      break;
    }
  }
}


Measured memory_bytes: 4224
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
	int a,b,y;
	cin>>a>>b>>y;
	if(a==5&&b==5&&y==7)
	cout<<"YES"<<endl;
	else if(a==5&&b==7&&y==5)
	 cout<<"YES"<<endl;
	 else if(a==7&&b==5&&y==5)
	 cout<<"YES"<<endl;
	 else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)

	ans := 0
	for i := a; i <= b; i++ {
		if c % i == 0 {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1108
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pp pair<ll,ll>
#define vi vector<pair<pp,pp> >
#define pq_min priority_queue<ll,vector<ll>,greater<ll>>
#define pq_max priority_queue<ll>
#define f(i,a,b) for(ll i=a;i<b;i++)
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define ld long double
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef pair<pp,pp> ppll;
const ll mod=1e9+7;
ll lookup[101][501];

ll power(ll a,ll b)
{
    ll res=1;
    a%=mod;
    while(b>0)
    {
        if(b%2==1)
        {
            res = (res * a)%mod;
        }
        b/=2;
        a = (a*a)%mod;
    }
    return res;
}

vector<ll> ans;
pq_min p;



int main()
{
    fast;
    ll n;
    cin>>n;
    ans.pb(0);
    for(ll i=1;i<=9;i++)
    {
        ans.pb(i);
        p.push(i);
    }
    while(ans.size()<(1e5+10))
    {
        ll x=p.top();
        p.pop();
        ll g=x%10;
        for(ll i=0;i<=9;i++)
        {
            if(g==i)
            {
                if(g==0)
                {
                    ans.pb(x*10);
                    ans.pb(x*10 + 1);
                    p.push(x*10);
                    p.push(x*10 + 1);
                }
                else if(g==9)
                {  
                    ans.pb(x*10 + 8);
                    ans.pb(x*10 + 9);
                    p.push(x*10 + 8);
                    p.push(x*10 + 9);
                }
                else
                {
                    ans.pb(x*10 + (g-1));
                    ans.pb(x*10 + g);
                    ans.pb(x*10 + g+1);
                    p.push(x*10 + (g-1));
                    p.push(x*10 + g);
                    p.push(x*10 + g+1);
                }
            }
        }
    }
    sort(ans.begin(),ans.end());
    cout<<ans[n];
}

Measured memory_bytes: 2288
#include <iostream>
#include <string>
#include <vector>

#define MAX_N 100

int N;
std::vector<std::string> s;

void solve(void) {
    bool flag = true;
    for (int i=0; i< N-1; i++) {
        for (int j=i-1; j >= 0; j--) {
            if (s[i] == s[j]) flag = false;
        }
        if (s[i].back() != s[i+1].front()) flag = false;
    }
    
    for (int i=0; i<N-1; i++) {
        if (s[i] == s[N-1]) flag = false;
    }

    if (flag) std::cout << "Yes" << std::endl;
    else      std::cout << "No"  << std::endl;
}

int main(void) {
    std::cin >> N;
    for (int i=0; i<N; i++) {
        std::string t;
        std::cin >> t;
        s.push_back(t);
    }
    solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793


int main(){
    int n; cin >> n;
    ll ans = 1;
    for(int i = 1; i <= n; i++){
        ans = (ans * i) % MOD;
    }
    cout << ans << endl;
}


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

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

	int				n;
	double			newv;	

	cin >> n;
	vector<double>	V(n);
	rep(i, n)
		cin >> V.at(i);
	sort(V.begin(), V.end());
	newv = V.at(0);
	for (int i = 1; i < n; i++)
		newv = (V.at(i) + newv) / 2.0;
	cout << newv << endl;
}


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

  int n,q,b,e,t;
  int a[1010];

  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  
  cin >> q;
  while(q--){
    cin >> b >> e >> t;
    swap_ranges(a+b,a+e,a+t);
  }
  
  for(int i=0;i<n;i++){
    cout << a[i];
    if(i == n-1) cout << endl;
    else cout << " ";
  }
  
  return(0);
}



Measured memory_bytes: 3048
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>
typedef long long ll;

using namespace std;

bool inc(string &cnt) {
    if(cnt[2] == '9') {
        if(cnt[1] == '9') {
            if(cnt[0] == '9') {
                return false;
            }
            else {
                cnt[0]++;
            }
            cnt[1] = '0';
        }
        else {
            cnt[1]++;
        }
        
        cnt[2] = '0';
    }
    else {
        cnt[2]++;
    }
    
    return true;
}

int main() {
    int n;
    cin >> n;
    
    string s;
    cin >> s;
    
    string cnt = "000";
    int ans = 0;
    do {
        bool flag[2] = {false};
        for(int i = 0; i < n; i++) {
            if(!flag[0] && s[i] == cnt[0]) {
                flag[0] = true;
                continue;
            }
            
            if(!flag[1] && flag[0] && s[i] == cnt[1]) {
                flag[1] = true;
                continue;
            }
            
            if(flag[1] && s[i] == cnt[2]) {
                ans++;
                break;
            }
        }
    } while(inc(cnt));
    
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int main(void){
	int x, a;
	int i;
	scanf("%d",&x);
	for(i=0;i<=19;i++){
		if(105*i < x && x< 100*(i+1)){
			printf("0\n");
			return 0;
		}
	}
	printf("1\n");
    return 0; 
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
const int N=200005;
struct node
{
	int h,d;
}tp;
bool operator <(node a,node b)
{
	return a.d>b.d;
}
priority_queue<node> Q;
int n,m,q,lste[N],nxte[N],lstw[N],nxtw[N],lstn[N],nxtn[N],lsts[N],nxts[N],p1[N],p2[N],cnt1,cnt2,px[N],py[N],num,wx[N],wy[N],dis[N],head[N],adj[N],nxt[N],len[N],i,j,k,l,x[2],y[2];
bool v[N];
char s[N],t[N];
int Abs(int a)
{
	return a>0?a:-a;
}
void addedge(int u,int v,int w)
{
	adj[++l]=v;
	nxt[l]=head[u];
	head[u]=l;
	len[l]=w;
}
int main()
{
	scanf("%d%d%d",&n,&m,&q);
	scanf("%s%s",s+1,t+1);
	for(i=1;i<=n;++i)
		if(s[i]=='E')
		{
			lste[i]=i;
			lstw[i]=lstw[i-1];
		}
		else
		{
			lste[i]=lste[i-1];
			lstw[i]=i;
		}
	for(i=n;i>=1;--i)
		if(s[i]=='E')
		{
			nxte[i]=i;
			nxtw[i]=nxtw[i+1];
		}
		else
		{
			nxte[i]=nxte[i+1];
			nxtw[i]=i;
		}
	for(i=1;i<=m;++i)
		if(t[i]=='N')
		{
			lstn[i]=i;
			lsts[i]=lsts[i-1];
		}
		else
		{
			lstn[i]=lstn[i-1];
			lsts[i]=i;
		}
	for(i=m;i>=1;--i)
		if(t[i]=='N')
		{
			nxtn[i]=i;
			nxts[i]=nxts[i+1];
		}
		else
		{
			nxtn[i]=nxtn[i+1];
			nxts[i]=i;
		}
	while(q--)
	{
		scanf("%d%d%d%d",&x[0],&y[0],&x[1],&y[1]);
		cnt1=cnt2=0;
		for(j=0;j<=1;++j)
		{
			if(lste[x[j]])
				p1[++cnt1]=lste[x[j]];
			if(lstw[x[j]])
				p1[++cnt1]=lstw[x[j]];
			if(nxte[x[j]])
				p1[++cnt1]=nxte[x[j]];
			if(nxtw[x[j]])
				p1[++cnt1]=nxtw[x[j]];
			if(lstn[y[j]])
				p2[++cnt2]=lstn[y[j]];
			if(lsts[y[j]])
				p2[++cnt2]=lsts[y[j]];
			if(nxtn[y[j]])
				p2[++cnt2]=nxtn[y[j]];
			if(nxts[y[j]])
				p2[++cnt2]=nxts[y[j]];
		}
		num=0;
		for(i=1;i<=cnt1;++i)
			for(j=1;j<=cnt2;++j)
			{
				++num;
				wx[num]=p1[i],wy[num]=p2[j];
			}
		for(i=1;i<=num;++i)
			head[i]=0;
		l=0;
		for(i=1;i<=num;++i)
			for(j=i+1;j<=num;++j)
				if(wx[i]==wx[j])
				{
					if((wy[i]<wy[j])==(s[wx[i]]=='E'))
						addedge(i,j,Abs(wy[i]-wy[j]));
					else
						addedge(j,i,Abs(wy[i]-wy[j]));
				}
				else if(wy[i]==wy[j])
				{
					if((wx[i]<wx[j])==(t[wy[i]]=='S'))
						addedge(i,j,Abs(wx[i]-wx[j]));
					else
						addedge(j,i,Abs(wx[i]-wx[j]));
				}
		for(i=1;i<=num;++i)
			if(wx[i]==x[0]&&wy[i]==y[0])
				break;
		for(j=1;j<=num;++j)
			dis[j]=1<<30,v[j]=false;
		dis[i]=0;
		Q.push((node){i,0});
		while(!Q.empty())
		{
			tp=Q.top();
			Q.pop();
			for(j=head[tp.h];j;j=nxt[j])
				if(tp.d+len[j]<dis[adj[j]])
				{
					dis[adj[j]]=tp.d+len[j];
					Q.push((node){adj[j],dis[adj[j]]});
				}
		}
		for(i=1;i<=num;++i)
			if(wx[i]==x[1]&&wy[i]==y[1])
			{
				printf("%d\n",dis[i]<(1<<30)?dis[i]:-1);
				break;
			}
	}
	return 0;
}


Measured memory_bytes: 14336
#include <iostream>
#include <vector>
using namespace std;
long long const mod = 1000000007;

long long mod_pow(long long a, long long b){
    long long res = 1;
    a %= mod;
    while(b > 0){
        if(b%2 == 1) res = (res * a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return res;
}

long long mod_div(long long a){
    return mod_pow(a, mod-2);
}

int main(void){
    long long n, a, b, c, ab, an, ak, bn, bk, kcn, ans = 0;
    cin >> n >> a >> b >> c;
    ab = mod_div(a+b);
    a = a*ab % mod;
    b = b*ab % mod;
    an = mod_pow(a, n);
    bn = mod_pow(b, n);
    ak = bk = kcn = 1;
    for(long long k = n; k < n*2; k++){
        ans += (an * bk + bn * ak) % mod * kcn % mod * k % mod;
        ak = ak*a % mod;
        bk = bk*b % mod;
        kcn = kcn*k % mod * mod_div(k-n+1) % mod;
    }
    ans = ans * 100 % mod * mod_div(100-c) % mod;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
int main(void)
{
  
  for(;;){
    int n;
    cin >> n;
    if(!n) return 0;
    char dic[256];
    REP(i,256) dic[i]=(char)i;
    REP(i,n){
      char a,b;
      cin >> a >> b;
      dic[a]=b;
    }
    int m;
    cin >> m;
    REP(i,m){
      char tmp;
      cin >> tmp;
      cout << dic[tmp];
    }
    cout << endl;
      
  }
}

Measured memory_bytes: 3072
mathlist=list(map(str,input().split()))
resultlist = []
for ope in mathlist:
    if ope == "+":
        number1 = int(resultlist.pop(-1))
        number2 = int(resultlist.pop(-1))
        result = number1 + number2
        resultlist.append(result)
    elif ope =="*":
        number1 = int(resultlist.pop(-1))
        number2 = int(resultlist.pop(-1))
        result = number1 * number2
        resultlist.append(result)
    elif ope =="-":
        number1 = int(resultlist.pop(-1))
        number2 = int(resultlist.pop(-1))
        result = number2 - number1
        resultlist.append(result)
    else:
        result = ope
        resultlist.append(result)
print(*resultlist)



Measured memory_bytes: 5596
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>

#define range(i, n) for (i = 0; i < n; i++) 
#define rrange(i, n) for(i = n-1; i>=0; i--)

typedef long long int ll;


using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
inline ll max(ll a, ll b) { if (a < b) return b; else return a; }


int main() {
	int i, k, l;
	string S;
	int N;

	cin >> S;

	bool flg = true;
	int ret = 0;
	int End = S.size() - 1;
	while (flg) {
		flg = false;
		range(i, End) {
			if (S[i] != S[i + 1]) {
				ret+=2;
				S.erase(S.begin() + i);
				S.erase(S.begin() + i);
				if (i == 0)i--;
				else i -= 2;
				flg = true;
				End -= 2;
			}
		}
	}


	cout << dec << ret;

	return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        int a = rint();
        WriteLine(a*a*a);
    
    }
    //各種読取
    static string rstr(){
        return ReadLine();
    }
    static int rint(){
        return int.Parse(ReadLine());
    }
    static long rlong(){
        return long.Parse(ReadLine());
    }
    static string[] stra(){
        return ReadLine().Split(' ');
    }
    static int[] inta(){
        string[] read_str_array = ReadLine().Split(' ');
        int[] return_int_array = new int[read_str_array.Length];
        for(int countup_i=0;countup_i<read_str_array.Length;countup_i++){
            return_int_array[countup_i] = int.Parse(read_str_array[countup_i]);
        }
        return return_int_array;
    }
    static int[,] inta2(int num_array,int in_array){
        int[,] int_array2 = new int[num_array,in_array];
        for(int i=0;i<num_array;i++){
            int[] temp_array = inta();
            for(int j=0;j<in_array;j++){
                int_array2[i,j] = temp_array[j];
            }
        }
        return int_array2;
    }
    static long[] longa(){
        string[] read_str_array = ReadLine().Split(' ');
        long[] return_long_array = new long[read_str_array.Length];
        for(long countup_i=0;countup_i<read_str_array.Length;countup_i++){
            return_long_array[countup_i] = long.Parse(read_str_array[countup_i]);
        }
        return return_long_array;
    }
    static double[] doublea(){
        string[] read_str_array = ReadLine().Split(' ');
        double[] return_double_array = new double[read_str_array.Length];
        for(long countup_i=0;countup_i<read_str_array.Length;countup_i++){
            return_double_array[countup_i] = long.Parse(read_str_array[countup_i]);
        }
        return return_double_array;
    }
    // A/B小数点以下切上
    static long divideup(long divided,long divid){
        long temp_divide = divided/divid;
        if(divided % divid > 0){
            temp_divide++;
        }
        return temp_divide;
    }
    static long GCD(long a,long b){
        if(a < b){
            long temp = a;
            a = b;
            b = temp;
        }
        if(a % b == 0){ return b; }
        else{
            long temp = b;
            b = a%b;
            a = temp;
            return GCD(a,b);
        }
    }
    static long LCM(long a,long b){
        return a * b / GCD(a,b);
    }
}
//知見
// (string) hogestr -> (char[]) hoge
    // char hoge = hogestr.ToCharArray();
// (char[]) hoge -> (string) hogestr
    // string hoge = new string(hoge);
// Hashtable ×  Dictionary ○
// Dictionary hoge<string,int>
    // hoge.ContainsKey(string) -> return boolean
    // hoge[string] -> return int
    // hoge[int] -> CE
// Dictionary hoge<int1,int2>
    // hoge<int1,int2>: hoge[int1] -> return int2
    // KeyValuePair<int,int> k <-> k.Key == int1 / k.Value == int2
// SortedDictionary() > SortedList() ???
// キュー　-> 幅優先 ???
// スタック -> 深さ優先 ???


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main() {
  int a, b;
  cin >> a >> b;

  int count = a - 1;
  if (b >= a) count++;

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
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() {
  int h, w, m;
  cin >> h >> w >> m;
  map<int, int> hm, wm;
  set<P> st;
  rep(i, m){
    int a, b;
    cin >> a >> b;
    hm[a]++;
    wm[b]++;
    st.insert({a, b});
  }
  int hmax = 0, wmax = 0;
  vector<int> hm_candidate, wm_candidate;
  for(auto k : hm){
    if(k.second > hmax) hmax = k.second;
  }
  for(auto k : wm){
    if(k.second > wmax) wmax = k.second;
  }
  for(auto k : hm){
    if(k.second == hmax) hm_candidate.emplace_back(k.first);
  }
  for(auto k : wm){
    if(k.second == wmax) wm_candidate.emplace_back(k.first);
  }
  rep(i, hm_candidate.size()){
    rep(j, wm_candidate.size()){
      if(st.find({hm_candidate[i], wm_candidate[j]}) == st.end()){
        cout << hmax + wmax << "\n";
        return 0;
      }
    }
  }
  cout << hmax + wmax - 1<< "\n";
}

Measured memory_bytes: 49576