akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<int> L(N);
    for(int i = 0; i < N; ++i)
        cin >> L[i];
    sort(L.begin(), L.end());
    ll ans = 0;

    for(int i = 0; i < N; ++i) {
        for(int j = 1; i + j < N; ++j) {
            int tmp1 = L[i] + L[i + j];
            int tmp2 = L[i + j] - L[i];
            auto itr1 = lower_bound(L.begin(), L.end(), tmp1);
            auto itr2 = upper_bound(L.begin(), L.end(), tmp2);
            int tmp = itr1 - itr2;
            if(binary_search(itr2, itr1, L[i]))
                tmp--;
            if(binary_search(itr2, itr1, L[i + j]))
                tmp--;
            ans += max(tmp, 0);
        }
    }
    cout << ans / 3 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
const int N = 15;
int main()
{
	int n, s[N] = {0}, h[N] = {0}, c[N] = {0}, d[N] = {0};
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
	{
		char k;
		int p;
		scanf(" %c %d", &k, &p);
		if(k == 'S')
		{
			s[p]++;
		}
		else if(k == 'H')
		{
			h[p]++;
		}
		else if(k == 'C')
		{
			c[p]++;
		}
		else
		{
			d[p]++;
		}
	}
	for(int i = 1; i <= 13; i++)
	{
		if(s[i] == 0)
		{
			printf("S %d\n", i);
		}
    }
    for(int i = 1; i <= 13; i++)
	{
		if(h[i] == 0)
		{
			printf("H %d\n", i);
		}
    }
	for(int i = 1; i <= 13; i++)
	{
		if(c[i] == 0)
		{
			printf("C %d\n", i);
		}
	}	
	for(int i = 1; i <= 13; i++)
	{
		if(d[i] == 0)
		{
			printf("D %d\n", i);
		}
	}	
		
	return 0;
 } 


Measured memory_bytes: 2680
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin >> n >>m;
int a[m];
int sum=0;
for(int i=0;i<m;i++){
cin >>a[i];
sum+=a[i];
}
if(sum>n)
cout << -1;
else cout << n-sum;
}

	



Measured memory_bytes: 3656
#include <iostream>

using namespace std;

void solve()
{
	int n;
	cin>>n;
	long dp[n][n],arr[n];
	for(int i=0;i<n;i++) {cin>>arr[i];}
	int l,r;
	for(r=0;r<n;r++)
	{
		for(l=r;l>=0;l--)
		{
			if(l==r) dp[l][l]=arr[l];
			else
			    dp[l][r]=max(arr[l]-dp[l+1][r],arr[r]-dp[l][r-1]);
		}
	}
	cout<<dp[0][n-1]<<'\n';
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	// int t;
	// cin>>t;
	// while(t--)
		solve();
	return 0;
}


Measured memory_bytes: 70528
from heapq import heappush, heappop

if __name__ == "__main__":
	h = []
	while True:
		command = input().split()
		if command[0] == "insert":
			heappush(h, int(command[1]) * -1)
		elif command[0] == "extract":
			print(heappop(h) * -1)
		else:
			break


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

using namespace std;

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

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

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

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


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

    string w; cin >> w;
    vi c(26);
    REP(i, (int)w.length()) c[w[i]-'a']++;
    bool ok = true;
    REP(i, (int)c.size()) if(c[i] % 2 == 1) ok = false;
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cstdlib>
using namespace std;
int main() {
	char a[52][52];
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
			
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '.') {
				int b = 0;
				if (a[i - 1][j - 1] == '#'&&i > 0 && j > 0) {
					b += 1;
				}
				if (a[i][j - 1] == '#'&&j > 0) {
					b += 1;
				}
				if (a[i + 1][j - 1] == '#'&&j > 0) {
					b += 1;
				}
				if (a[i - 1][j] == '#'&&i > 0) {
					b += 1;
				}
				if (a[i + 1][j] == '#') {
					b += 1;
				}
				if (a[i - 1][j + 1] == '#'&&i > 0) {
					b += 1;
				}
				if (a[i][j + 1] == '#') {
					b += 1;
				}
				if (a[i + 1][j + 1] == '#') {
					b += 1;
				}
				
				cout << b << flush;
				b = 0;
			}
			else {
				cout << "#" << flush;
			}
			
		}
		cout << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long

ll fun(ll n,ll m){
    if(n==1||m==1){
        if(n*m>=2) return n*m-2;
        return 1;
    }
    return (n-2)*(m-2);
}


int main(){
    ll n,m;
    cin >> n >> m;
    cout << fun(n,m) << endl;
    return 0;
}


Measured memory_bytes: 256
N, T = map(int, input().split())

min_cost = 10000000

for n in range(N):
  cost, time = map(int, input().split())
  if time <= T:
    if cost < min_cost:
      min_cost = cost
if min_cost == 10000000:
  print("TLE")
else:
  print(min_cost)

Measured memory_bytes: 38384
def digits_to_number(digits):
    res = 0
    for d in reversed(digits):
        res *= 10
        res += d
    return res


def next_lunlun(n):
    digits = []
    x = n
    while x > 0:
        digits.append(x % 10)
        x //= 10
    for i in range(0, len(digits)-1):
        if digits[i] <= digits[i+1] and digits[i] != 9:
            digits[i] += 1
            for j in range(i-1, -1, -1):
                digits[j] = max(digits[j+1] - 1, 0)
            return digits_to_number(digits)
    if digits[-1] == 9:
        digits = [0] * len(digits)
        digits.append(1)
        return digits_to_number(digits)
    digits[-1] += 1
    for j in range(len(digits)-2, -1, -1):
        digits[j] = max(digits[j+1] - 1, 0)
    return digits_to_number(digits)


def kth_lunlun(k):
    lunlun = 1
    for i in range(0, k-1):
        lunlun = next_lunlun(lunlun)
    return lunlun

if __name__ == '__main__':
    k = int(input())
    print(kth_lunlun(k))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int MOD = 1000000007;

//↓combination(ll a, ll b) でaCr計算。
//------------------------------------------------------------------------------------------
ll mpow(ll x, ll n){
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n >> 1;
    }
    return ans;
}
ll kj(ll x){
    ll s = 1;
    for(ll i = 1; i <= x; i++){
        s = s * i % MOD;
    }
    return s;
}
ll combination(ll a, ll b){
    if(a == 0 && b == 0) return 1;
    if(a < b || a < 0) return 0;
    return (kj(a) * mpow(kj(b), MOD-2) % MOD) * mpow(kj(a-b), MOD-2) % MOD;
}
//---------------------------------------------------------------------------------------------
//↑combination(ll a, ll b) でaCr計算。

int main(){
    string N;
    cin >> N;
    if(N.at(0)=='7' or N.at(1)=='7' or N.at(2)=='7' ){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

Measured memory_bytes: 3632
///Bismillahirrahmanirrahim
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    if(a == 1)
    {
        if(b==2)
            puts("3");
        else puts("2");
    }
    else if(a==2){
        if(b==1)
            puts("3");
        else puts("1");
    }
    else{
        if(b==1)
            puts("2");
        else puts("1");
    }
}


Measured memory_bytes: 256
from bisect import bisect_left as bisect

s, t = input(), input()
lens, sets = len(s), set(s)

if not all(i in sets for i in t):
    print(-1)
    exit()

alp = [[] for i in range(26)]
for i, si in enumerate(s):
    alp[ord(si) - 97].append(i)

ans, cnt = 1 - lens, 0
for i in t:
    li = alp[ord(i) - 97]
    ans += lens * (cnt == 0)
    num = bisect(li, cnt)
    ans += lens * (num == len(li))
    cnt = (li[num % len(li)] + 1) % lens
print(ans + (cnt - 1) % lens)


Measured memory_bytes: 79748
sx,sy,tx,ty = gets.split.map(&:to_i)
for i in 1..ty-sy do
    print "U"
end
for i in 1..tx-sx do
    print "R"
end
for i in 1..ty-sy do
    print "D"
end
for i in 1..tx-sx do
    print "L"
end
print "L"
for i in 0..ty-sy do
    print "U"
end
for i in 0..tx-sx do
    print "R"
end
print "DR"
for i in 0..ty-sy do
    print "D"
end
for i in 0..tx-sx do
    print "L"
end
print "U"
puts


Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(j, m) for (int j = 0; i < (int)(n); j++)
using ll = long long;
using namespace std;

int main()
{
    int a;
    string s;
    cin >> a;
    cin >> s;
    if (a >= 3200)
    {
        cout << s << endl;
    }
    else
    {
        cout << "red" << endl;
    }
}

Measured memory_bytes: 256
n = int(input())
data = list(map(int, input().split()))
ans = [0]
for idx, a in enumerate(data):
    if idx%2 == 0:
        ans[0] += a
    else:
        ans[0] -= a

for i in range(n-1):
    dam = data[i]
    score = 2*dam - ans[-1]
    ans.append(score)

print(*ans)

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

using namespace std;

int main(){
	int N, RES = 1e9;
	vector < int > W(101), DP(102);
	cin >> N;
	for (int& w: W) {
		cin >> w;
	}
	DP[1] = W[0];
	for (int i = 2; i <= N; ++i) {
		DP[i] = DP[i - 1] + W[i - 1];
	}
	for (int T = 1; T <= N; ++T) {
		RES = min(RES, abs(2 * DP[T] - DP[N]));
	}
	cout << RES;
  	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iterator>
#include <iomanip>
#include <cmath>
#include <vector>
#include <numeric>
#include <cstdio>
#include <bitset>
#include <map>
#include <string>
#include <valarray>
#include <queue>
#include <utility>

using namespace std;

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

    vector<int> sequence(n+1);

    for (int i = 1; i <= n; i++)
        cin >> sequence[i];

    //verify the input
    // for (auto x: sequence)
    //     cout << x << ' ' << (x==sequence.back()? "\n": "");


    //misunderstand the question, the following algorithm deals with the longest succesive subsequence 
    // int length = 1, max_length = 1;
    // for (int i = 1; i < n; i++)
    // {
    //     if (sequence[i] > sequence[i-1])
    //         ++length;
    //     else
    //     {
    //         max_length = max(max_length, length);
    //         length = 1;
    //     }
    // }

    // cout << max_length << endl;

    //dynamic programming, with time complexity of O(n^2)
    // vector<int> longest_length(n+1);
    // int length = 0;
    // for (int i = 1; i <= n; i++)
    // {
    //     for (int j = i-1; j >= 0; j--)
    //         if (sequence[j] < sequence[i])
    //         {
    //             longest_length[i] = max(longest_length[i], longest_length[j]+1);
    //             length = max(length, longest_length[i]);
    //         }
        
    // }

    // cout << length << endl;

    //method 2 
    vector<int> D(n+1, -1);
    int length = 0;
    for (int i = 1; i <= n; i++)
    {
        if (D[length] < sequence[i])
            D[++length] = sequence[i];
        else 
        {
            for (int j = length-1; j >=0; j--)
            {
                if (D[j] < sequence[i])
                {
                    D[j+1] = sequence[i];
                    break;
                }
            }
        }
    }

    cout << length << endl;
}




Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)

#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define bash push_back
#define alles(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define WF(d,v) FOR(k,v){ FOR(i,v){ FOR(j,v) d[i][j]=min(d[i][j],d[[i][k]+d[k][j]) } }
int dx[]={1,0,-1,0,1,1,-1,-1};
int dy[]={0,-1,0,1,-1,1,-1,1};
const int INF=1 << 30;
bool inside(int x,int y,int w,int h){
  return (x>=0 && y>=0 && x<w && y<h);}
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vit;
typedef map<string,int> mstit;
typedef priority_queue<int> pqit;
 
 
int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n;
  cin >>n;
  cout <<"Christmas ";
  if(n<25) cout <<"Eve ";
  if(n<24) cout <<"Eve ";
  if(n<23) cout <<"Eve";
  cout << "\n";


  return 0;
}



Measured memory_bytes: 256
N=int(input())
Xin=input().split( )
X=[int(Xin[i]) for i in range(N)]

X.append(2020)
M=int(input())
Ain=input().split( )
A=[int(Ain[i]) for i in range(M)]

for t in range(M):
    j=A[t]-1
    if X[j]<X[j+1]-1:
        X[j]+=1
for i in range(N):
    print(X[i])



Measured memory_bytes: 5616
import java.util.Arrays;
import java.util.Scanner;

public class Main{

	static int n, m;
	static int[][] swi;

	static int[] p = new int[10];//m個
	static long count = 0;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = Integer.parseInt(sc.next());
		m = Integer.parseInt(sc.next());
		swi = new int[m][n + 1];
		for (int i = 0; i < m; i++) {
			int k = Integer.parseInt(sc.next());
			swi[i][0] = k;
			for (int j = 1; j < k + 1; j++) {
				swi[i][j] = Integer.parseInt(sc.next());
			}
		}
		for (int i = 0; i < m; i++) {
			p[i] = Integer.parseInt(sc.next());
		}

		dfs(0, new int[n]);
		System.out.println(count);

	}

	static void dfs(int i, int[] onOff) {
		if (i == n) {
			if (isLightAll(onOff))
				count++;
			return;
		}

		dfs(i + 1, rtnArr(onOff, i, true));
		dfs(i + 1, rtnArr(onOff, i, false));
	}

	static int[] rtnArr(int[] a1, int i, boolean b) {
		int[] a2 = Arrays.copyOf(a1, n);
		a2[i] = b ? 1 : 0;
		return a2;
	}

	static boolean isLightAll(int[] onOff) {
		int sum;
		for (int i = 0; i < m; i++) {
			sum = 0;
			for (int j = 1; j < swi[i][0] + 1; j++) {
				sum += onOff[swi[i][j] - 1];
			}
			if (sum % 2 != p[i])
				return false;
		}
		return true;
	}

}


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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SORT(v, n) sort(v, v+n);
#define SSORT(v, n) sort(v, v+n, greater<int>())

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

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define N 500000
#define INFTY 1000000000

void merge(int,int,int);
void mergeSort(int,int);

int A[N];
int n,cnt=0;

int main(){
  int i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  mergeSort(0,n);
  for(j=0;j<n-1;j++){
    printf("%d ",A[j]);
  }
  printf("%d\n",A[n-1]);
  printf("%d\n",cnt);
  return 0;
}
 void merge(int left,int mid,int right){
   int n1,n2,L[N],R[N],i,j,k;
   n1 = mid-left;
   n2 = right-mid;
   for(i=0;i<n1;i++){
     L[i]=A[left+i];
   }
   for(i=0;i<n2;i++){
     R[i]=A[mid+i];
   }
   L[n1] = INFTY;
   R[n2] = INFTY;
   i = 0;
   j = 0;
    for(k=left;k<right;k++){
     if(L[i]<=R[j]){
       A[k] = L[i];
       i++;
     }
     else {
       A[k] = R[j];
       j++;
     }
     cnt++;
   }
 }
void mergeSort(int left,int right){
  int mid;
  if(left+1<right){
     mid = (left+right)/2;
    mergeSort(left,mid);
    mergeSort(mid,right);
    merge(left,mid,right);
  }
}



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

int n, m;
int pre[101];
bool used[101];
int d[101];
int cost[101][101];
bool paths[101][101];
// set<int> vertex;

void dijkstra(int s) {
    fill(d, d + 101, 1000 * 100);
    fill(used, used + 101, false);
    fill(pre, pre + 101, -1);
    d[s] = 0;

    while (true) {
        int v = -1;
        for (int u = 1; u <= n; ++u) {
            if (!used[u] && (v == -1 || d[u] < d[v])) v = u;
        }
        if (v == -1) break;
        used[v] = true;
        for (int u = 1; u <= n; ++u) {
            if (cost[v][u] > 0 && d[u] > d[v] + cost[v][u]) {
                d[u] = d[v] + cost[v][u];
                pre[u] = v;
            }
        }
    }
}

void erase_path(int t) {
    for (int i = 1; i <= n; ++i) {
        int end = i;
        if (end != t) {
            int start;
            while ((start = pre[end]) != -1) {
                paths[start][end] = paths[end][start] = false;
                end = start;
            }
        }
    }
}

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

    memset(cost, -1, sizeof(cost));
    memset(paths, false, sizeof(paths));
    cin >> n >> m;
    int a[m + 1], b[m + 1], c;
    for (int i = 1; i <= m; ++i) {
        cin >> a[i] >> b[i] >> c;
        cost[b[i]][a[i]] = cost[a[i]][b[i]] = c;
        paths[a[i]][b[i]] = paths[b[i]][a[i]] = true;
    }

    for (int i = 1; i <= n; ++i) {
        dijkstra(i);
        erase_path(i);
    }

    int rem = 0;
    for (int i = 1; i <= m; ++i) {
        rem += paths[a[i]][b[i]];
    }
    cout << rem << '\n';

    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int N, K;
int p[10001];
int main(void){
    cin >> N >> K;
    REP(i,N) cin >> p[i];
    sort(p, p+N);
    int res = 0;
    REP(i,K) res += p[i];
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF =1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define trep(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int cc = 100 * a + 10 * b + c;
    if(cc%4==0){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
void main()
{
    long n = rdElem;
    long[] a = rdRow;

    long[] b;
    foreach_reverse (i, x; a)
    {
        if (x)
        {
            b ~= i + 1;
            long[] f = factors(i+1);
            foreach (y; f)
            {
                a[y-1] = !a[y-1];
            }
        }
    }

    long len = b.length;
    len.writeln;
    if (len)
    {
        foreach (i, x; b)
        {
            x.write;
            if (i == len - 1) writeln;
            else " ".write;
        }
    }
}

long[] factors(long x)
{
    long[] result;
    for (long i = 1; i * i <= x; ++i)
    {
        if (x % i == 0)
        {
            result ~= i;
            if (i != x / i) result ~= x / i;
        }
    }
    return result;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 9716
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define repB(i, z, n) for(int i = n - 1; i >= z; i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979
//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
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; }
using namespace std;
//#define P pair<int, int>
typedef pair<int, int> P;

int main(){
    int A, B;
    cin >> A >> B;
    cout << A * B << endl;
}


Measured memory_bytes: 3592
#coding:UTF-8
class Node:
    def __init__(self,point):
        self.n=point
        self.p=None
        self.left=None
        self.right=None

def CBT(A,n):
    nlist=[]
    for i in range(n+1):
        if i==0:
            nlist.append(Node(0))
        else:
            nlist.append(Node(A[i-1]))
    for i in range(n+1):
        if i==0:
            continue
        if i/2>=1:
            nlist[i].p=nlist[int(i/2)].n
        if 2*i<=n:
            nlist[i].left=nlist[2*i].n
        if 2*i+1<=n:
            nlist[i].right=nlist[2*i+1].n
    for i in range(n+1):
        if i==0:
            continue
        ans="node "+str(i)+": key = "+nlist[i].n+", "
        if i != 1:
            ans+="parent key = "+nlist[i].p+", "
        if nlist[i].left!=None:
            ans+="left key = "+nlist[i].left+", "
        if nlist[i].right!=None:
            ans+="right key = "+nlist[i].right+", "
        print(ans)
        
        
            
if __name__=="__main__":
    n=int(input())
    A=input().split(" ")
    CBT(A,n)

Measured memory_bytes: 7748
#include"bits/stdc++.h"
using namespace std;

/**
 * Copyright (c)
 * author        :   Sujeet Kumar 
 * question name :   
 * link          :   
 */

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define repA(i,v) for(auto i:v)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define vi vector<int>
#define vll vector<ll>
#define vi2(n,m) vector<vector<int> > v(n,vector<int>(m));

void solve(){
	string s,t;cin>>s>>t;
	int n = s.size(),m = t.size(),k = n-m,ans = 1e7;
	for (int i = 0; i < n-m + 1; i++) { 
    int minRemovedChar = 0; 
        for (int j = 0; j < m; j++) { 
            if (t[j] != s[i + j]) { 
                minRemovedChar++; 
            } 
        }
        ans = min(minRemovedChar, ans); 
    }
	cout<<ans;
	return ;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    clock_t start=clock();

	ll test = 1;
	// cin>>test;
	while(test--)	solve();

	clock_t end=clock();
	cerr<<fixed<<setprecision(15)<<((double)(end-start))/CLOCKS_PER_SEC<<endl;
	return 0;
}
/**
 * Test Cases:-
 */


Measured memory_bytes: 3780
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
int main(){
  //入力準備
  string s;
  cin>>s;
  vector<int>a(4);
  int sumplus=0;
  int summinus=0;
  int bitans;
  
  for(int i=0;i<4;i++){a[i]=s[i]-'0';}
  for(int bit=0;bit<(1<<4);bit++){
    //ビット演算お決まり
    bitset<4>tm(bit);
    bitset<4>xo("1111");
    xo=xo^tm;
    sumplus=0;
    summinus=0;
    for(int i=0;i<4;i++){
      if(tm.test(i)){
	sumplus+=a[i];
      }
      if(xo.test(i)){
	summinus+=a[i];
      }//実際にはelse文でsumplusから引くという操作をするだけで十分であるが、ビット操作に慣れるためやや回りくどいことをした。
    }
    if(sumplus-summinus==7){bitans=bit;break;}
  }

  //出力準備
  bitset<4>bitman(bitans);
    string ans="";
    for(int i=0;i<4;i++){
      if(i!=0&&bitman.test(i))ans+="+";
      else if(i==0)ans+="";
      else ans+="-";
      ans+=s[i];
    }
    ans+="=7";
    cout<<ans<<endl;
    
    
  return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define INF 1000000001
class E{
public:
	int rel, cost;
	E(int rel, int cost){
		this->rel = rel;
		this->cost = cost;
	}
};

vector <E> G[100000];
int main(){	
	int v = 0;//num of vertices
	int e = 0;//num of edges
	int r = 0;//source node
	cin >> v >> e >> r;

	int src, tar, cost;
	for (int i = 0; i < e; i++){
		cin >> src >> tar >> cost;
		G[src].push_back(*(new E(tar, cost)));
	}

	priority_queue < pair<int, int> > PQ;
	int sum = 0;
	int d[100000];//results
	for (int i = 0; i < v; i++){
		d[i] = INF; 
	}
	d[r] = 0;
	PQ.push(make_pair(0, r));

	int s, f;
	while (!PQ.empty()) {

		f = PQ.top().first;//first is the distance 
		s = PQ.top().second;//second is the target node
		PQ.pop();

		for (int i = 0; i < G[s].size(); i++) {
			E e = G[s][i];
			if (d[e.rel] > e.cost - f) {
				d[e.rel] = e.cost - f;
				PQ.push(make_pair(-d[e.rel], e.rel));
			}
		}

	}

	for (int i = 0; i < v; i++) {
		if (d[i] == INF){ 
			cout << "INF" << endl; 
		}else{ 
			cout << d[i] << endl; 
		}

	}

	return 0;
}

Measured memory_bytes: 26596
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<set>
#include<tuple>
using namespace std;
#define INF 11000000000
#define MAX 5100
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

//http://kurkur.hatenablog.com/entry/2018/01/22/212930

int N,K,C[MAX][MAX],S[MAX][MAX];

int query(int i1,int j1,int i2,int j2){
    if(i1<=0) i1=1;
    if(j1<=0) j1=1;
    return S[i2][j2]-S[i1-1][j2]-S[i2][j1-1]+S[i1-1][j1-1];
}

int main(){
    cin>>N>>K;
    for(int i=0;i<N;i++){
        ll x,y; char c;
        cin>>x>>y>>c;
        if(c=='B') x+=K;
        x%=(2*K); y%=(2*K);
        C[x+1][y+1]++;
        //cout<<x+1<<" "<<y+1<<endl;
    }
    for(int i=1;i<=3*K+2;i++){
        for(int j=1;j<=3*K+2;j++){
            S[i][j]=C[i][j]+S[i-1][j]+S[i][j-1]-S[i-1][j-1];
            
        }
    }
    int ans=-1;
    for(int i=1;i<=K;i++){
        for(int j=1;j<=K;j++){
            int temp=query(i-K+1,j-K+1,i,j)+query(i+1,j+1,i+K,j+K)
                    +query(i+K+1,j+K+1,i+2*K,j+2*K)+query(i-K+1,j+K+1,i,j+2*K)
                    +query(i+K+1,j-K+1,i+2*K,j);
            ans=max(ans,max(temp,N-temp));
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 104192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll md = 1000000007;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
vl p, fac, ifac;

ll add(ll a, ll b, ll mod = md) {
    return (a%mod + b%mod + mod) % mod;
}

ll mul(ll a, ll b, ll mod = md) {
    return ( (a%mod) * (b%mod) ) % mod;
}

ll power(ll x, ll n, ll mod = md) {
    ll res = 1;
    x %= mod;
    while (n) {
        if (n & 1)  res = ((res%mod) * (x%mod))%mod;
        n = (n >> 1);
        x = ((x%mod) * (x%mod))%mod;
    }
    return res;
}

void cachefact(ll lim, ll mod = md) {
    for(int i = 2; i <= lim; i++) {
        ifac.push_back((ifac[mod%i] * (mod - mod/i) % mod)%mod);
    }
    for(ll i = 2; i <= lim; i++) {
        fac.push_back((fac[i-1] * i)%mod);
        ifac[i] = (ifac[i-1] * ifac[i])%mod;
    }
}

ll C(ll n, ll r, ll mod = md) {
    if(n < r) return 0;
    return mul(fac[n], mul(ifac[r], ifac[n-r], mod), mod);
}

void sieve(ll n) {
	vector<bool> prime(n+1, true);
    for(int i = 2; i*i <= n; i++) {
        if(prime[i]) {
            for(int j = 2*i; j <= n; j += i) {
                prime[j] = false;
            }
        }
    }
    p.push_back(2);
    for(int i = 3; i <= n; i += 2) {
        if(prime[i]) {
            p.push_back(i);
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    sieve(101);
    int pn = p.size();
   	int n, c = 0, res = 0;
   	vector<pair<ll,ll>> d(100);
   	cin >> n;
   	for(int i = 0; i < pn; i++) {
   		int nn = n, cnt = 0;
   		while(nn) {
   			cnt += nn / p[i];
   			nn /= p[i];
   		}
   		if(cnt) d[c++] = {p[i], cnt};
   	}
   	ll cnt[80] = {0};
   	for(int i = 0; i < c; i++) {
   		if(d[i].second >= 74) cnt[74]++;
   		if(d[i].second >= 24) cnt[24]++;
   		if(d[i].second >= 2) cnt[2]++;
   		if(d[i].second >= 14) cnt[14]++;
   		if(d[i].second >= 4) cnt[4]++;
   	}
   	res += cnt[74];
   	res += cnt[24]*(cnt[2] - 1) + cnt[14]*(cnt[4] - 1);
   	res += (cnt[2] - cnt[4])*((cnt[4]*(cnt[4]-1))/2) + cnt[4]*(((cnt[4]-1)*(cnt[4]-2))/2);
   	cout << res << "\n";
    return 0;
}


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

using namespace std;

long long gcd(long long a, long long b) {
	return (b == 0 ? a : (gcd(b, a % b)));
}




int main () {
	long long res = 1;
	int n; cin >> n;
	while (n--) {
		long long c; cin >> c;
		c /= gcd(res, c);
		res *= c;
	}
	
	cout << res << endl;
	return 0;
}

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

int main()
{
  string s;
  cin >> s;
  int p = 700;
  
  if (s.at(0) == 'o') p += 100;
  if (s.at(1) == 'o') p += 100;
  if (s.at(2) == 'o') p += 100;
  
  cout << p << 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;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<ll> A(N);
  REP(i, N) cin >> A[i];
  REP(i, N) A[i] -= i + 1;
  sort(A.begin(), A.end());
  ll ans = 0;
  REP(i, N) ans += abs(A[i] - A[(N - 1) / 2]);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N;
  string S;
  cin >> N >> S;

  ll cntR=0;
  ll cntG=0;
  ll cntB=0;
  for(int i=0;i<N;i++){
    if(S.at(i)=='R')  cntR++;
    if(S.at(i)=='G')  cntG++;
    if(S.at(i)=='B')  cntB++;
  }
  ll ans=cntR*cntG*cntB;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      int k=2*j-i;
      if(k<=j || k>=N)  continue;
      if(S.at(i)!=S.at(j) && S.at(i)!=S.at(k) && S.at(j)!=S.at(k))  ans--;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;
using P = pair<int, int>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

int n, m;

// UnionFind
struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}

  // ある要素がどの集合に属しているかを返す
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }

  // 集合をマージする、すでに同じ集合ならfalseが返る
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }

  // 2つの要素が同じ集合か判定する
  bool same(int x, int y) { return find(x) == find(y);}
  
  // ある集合の大きさを答える
  int size(int x) { return -d[find(x)];}
};

int main() {
    cin >> n >> m;
    vector<int> P(n, 0);
    for(int i = 0; i < n; ++i) {
        cin >> P.at(i); P.at(i)--;
    }
    UnionFind tree(n);
    for(int i = 0; i < m; ++i) {
        int xx, yy; cin >> xx >> yy;
        xx--; yy--;
        tree.unite(xx, yy);
    }

    int ans = 0;
    for(int i = 0; i < n; ++i) {
        if(tree.same(i, P.at(i)))ans++;
    }
    cout << ans << endl;
}

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

/*int main() {
    int n;
    scanf("%d", &n);
    int ans = 0;
    while (n >= 3) {
        n -= 3;
        ans++;
    }
    printf("%d\n", ans);
    return 0;
}*/

int main() {
    int n;
    scanf("%d", &n);
    bool three = 1;
    for (int i = 0 ; i < n; i++) {
        char c;
        scanf("%*c%c", &c);
        if (c == 'Y') three = 0;
    }
    if (three) printf("Three\n");
    else printf("Four\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
inline int readInt() {int x; cin >> x; return x;}
inline char readChar() {char c; cin >> c; return c;}
inline string readString() {string s; cin >> s; return s;}

int32_t main()
{
	//freopen("input.txt", "r", stdin);
	IOS;
	
	int x = readInt();
	if(x >= 30) cout << "Yes";
	else cout << "No";	
	return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"

using namespace std;

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

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int data[200];

int main(){
    rep(i,200)data[i]=0;
    int n;
    cin>>n;
    rep(i,n*(n-1)/2){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        if(c==d){
            data[a]++;
            data[b]++;
        }
        else if(c>d){
            data[a]+=3;
        }
        else if(c<d){
            data[b]+=3;
        }
    }
    vi s;
    rep(i,n){
        s.pb(data[i+1]);
    }
    sort(all(s),greater<int>());
    
    int rank[200];
    rep(i,200)rank[i]=-1;
    rep(i,n){
        for(int j=1;j<=n;j++){
            if(s[i]==data[j]&&rank[j]==-1){
                rank[j]=i+1;
            }
        }
    }
    for(int i=1;i<=n;i++){
        cout<<rank[i]<<endl;
    }
}

Measured memory_bytes: 1220
import sys
sys.setrecursionlimit(10**6)

N = int(input())
h = list(map(int, input().split()))
dp = [-1] * (N+1)

def rec(i):
    if i == 0:
        return 0
    if dp[i] != -1:
        return dp[i]
    dp[i] = 2**60 # 十分大きな値
    if i - 1 >= 0:
        dp[i] = min(dp[i], rec(i - 1) + abs(h[i - 1] - h[i]))
    if i - 2 >= 0:
        dp[i] = min(dp[i], rec(i - 2) + abs(h[i - 2] - h[i]))
    return dp[i]

print(rec(N-1))


Measured memory_bytes: 95376
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
*/public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
static class TaskD   {
public void solve(int testNumber, Scanner in, PrintWriter out) {

        int A = in.nextInt();
        int B = in.nextInt();
        int Q = in.nextInt();
        long s[] = new long[A];
        long t[] = new long[B];
        long x[] = new long[Q];
        for (int i = 0; i < A; i++) {
            s[i] = in.nextLong();
        }
        for (int i = 0; i < B; i++) {
            t[i] = in.nextLong();
        }
        for (int i = 0; i < Q; i++) {
            x[i] = in.nextLong();
        }

        for (int i = 0; i < Q; i++) {
            long ans = 1_000_000_000_000L;
            int jm = binary_search(x[i], 0, s);
            int ju = binary_search(x[i], 1, s);
            int tm = binary_search(x[i], 0, t);
            int tu = binary_search(x[i], 1, t);

            if (jm != A && tm != B && jm != -1 && tm != -1) {
                ans = min(ans, max(s[jm]-x[i], t[tm]-x[i]));
            }
            if (ju != A && tu != B && ju != -1 && tu != -1) {
                ans = min(ans, max(x[i]-s[ju], x[i]-t[tu]));
            }
            if (jm != A && tu != B && jm != -1 && tu != -1) {
                ans = min(ans, 2 * (s[jm] - x[i]) + (x[i] - t[tu]));
                ans = min(ans, (s[jm] - x[i]) + 2 * (x[i] - t[tu]));
            }
            if (ju != A && tm != B && ju != -1 && tm != -1) {
                ans = min(ans, 2 * (x[i]-s[ju]) + (t[tm] - x[i]));
                ans = min(ans, (x[i]-s[ju]) + 2 * (t[tm] - x[i]));
            }
            out.println(ans);
        }
    }

boolean isOK(int index, long key, long[] a) {
        if (a[index] >= key) return true;
        else return false;
    }

boolean isOK2(int index, long key, long[] a) {
        if (a[index] <= key) return true;
        else return false;
    }

int binary_search(long key, int ver, long[] a) {
        int ng = -1;
        int ok = (int)a.length;
        if(ver == 1){
            ok = -1;
            ng = (int)a.length;
        }
        while (Math.abs(ok - ng) > 1) {
            int mid = (ok + ng) / 2;
            if(ver == 1){
                if (isOK2(mid, key, a)) ok = mid;
                else ng = mid;
            } else {
                if (isOK(mid, key, a)) ok = mid;
                else ng = mid;
            }
        }
        return ok;
    }

long min(long a1, long a2) {
        if(a1 <= a2) return a1;
        return a2;
    }

long max(long a1, long a2) {
        if(a1 >= a2) return a1;
        return a2;
    }

}
}



Measured memory_bytes: 98628
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define pb push_back
#define f first
#define s second
#define pi 3.141592653589793238
using namespace std;

ll gcd( ll a, ll b )
{
	if(b==0)
	{
		return a;
	}
	else
	{
		return gcd( b, a%b );
	}
}
ll lcm (ll a, ll b)
{
	return (a*b)/gcd(a,b);
}

ll power(ll a, ll b)	//a is base, b is exponent
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	if(b%2 == 1)
		return (power(a,b-1)*a)%mod;
	ll q = power(a,b/2);
	return (q*q)%mod;
}
ll dp[1004][1004];
int main()
{
	std::ios::sync_with_stdio(false);
	ll n,m;
	cin >>n >> m;
	char grid[n+2][m+2];
	for(int i =0;i<n;i++) for(int j =0;j<m;j++) cin>> grid[i][j];
	dp[0][0]=1;
	for(int i =1;i<n;i++) if(grid[i][0]=='.')	dp[i][0] = dp[i-1][0];
	for(int i=1;i<m;i++) if(grid[0][i]=='.')	dp[0][i] = dp[0][i-1];

	for(int i = 1;i<n;i++)
	{
		for(int j =1;j<m;j++)
		{
			if(grid[i][j]=='.')
				dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
		}
	}	
	cout << (dp[n-1][m-1])%mod << endl;



	return 0;
}


//Hello, this is a snippet.


Measured memory_bytes: 9088
import java.util.Scanner;

public class Main {

    private static final String FORMAT = "%d:%d:%d";

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int targetSec = scanner.nextInt();

        int sec = targetSec % 60;
        int min = (targetSec / 60) % 60;
        int hour = (targetSec / (60 * 60));
        System.out.println(String.format(FORMAT, hour, min, sec));
    }
}

Measured memory_bytes: 26216
#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long int llint;
using namespace std;


int main() {
	llint n,sp;
	cin >> n;
	sp = n/2;
    llint a[n];
  	rep(i,n){
		cin >> a[i];
    }
    sort(a, a+n);
    llint ans=a[n/2]-a[n/2-1];
	cout << ans;   
	return 0;
}

Measured memory_bytes: 1024
/* ****TCIITB**** */

#include<bits/stdc++.h>
#define io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

#define N  100005

int main()
{
	
	io
	ll n;
	cin>>n;
	cout<<pow(n,3);	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   /* int n,i,j,k;
    cin>>n;
    vector<int>a,b;
    for(i=0;i<n;i++)
        {
           cin>>k;
            if(i%2==0){a.push_back(k);}
            else b.push_back(k);
        }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
        if(a[0]==b[0])
        {
            cout<<"NO\n";
            return 0;
        }

    for(i=0;i<a.size()-1;i++)
    {
        if(a[i]==a[i+1]){
            cout<<"NO\n";
            return 0;
        }
    }
    for(i=0;i<b.size()-1;i++)
    {
        if(b[i]==b[i+1]){
            cout<<"NO\n";
            return 0;
        }
    }

    cout<<"YES\n";
    return 0;*/
    set<int>s;
    int n,i,x;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>x;
        s.insert(x);
    }
    if(s.size()==n) cout<<"YES\n";
        else cout<<"NO\n";
}


Measured memory_bytes: 9600
<?php
// D
fscanf(STDIN, '%d', $x);
$a = 0;
while (true) {
    $a5 = $a ** 5;
    $arr[$a] = $a5;
    foreach ($arr as $i => $v) {
        if ($a5 + $v === $x) {
            $b = -$i;
            break 2;
        } elseif ($a5 - $v === $x) {
            $b = $i;
            break 2;
        }
    }
    $a++;
}
echo $a . ' ' . $b;

Measured memory_bytes: 16136
N = gets.to_i
as = (1<<N).times.map{gets.to_i}

while as.size > 1
    as2 = []
    (as.size/2).times do |i|
        a, b = as[2*i, 2]
        if a == b
            as2.push(a)
        else
            as2.push((a-b).abs)
        end
    end
    as = as2
end
puts as[0]

Measured memory_bytes: 6196
'''
Created on 2020/09/10

@author: harurun
'''
def main():
  import heapq
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
#   dl=[]

  X,Y,A,B,C=map(int,pin().split())
  p=list(map(int,pin().split()))
  q=list(map(int,pin().split()))
  r=list(map(int,pin().split()))

  p.sort(reverse=True)
  q.sort(reverse=True)
  r.sort(reverse=True)

  p=p[:X]
  q=q[:Y]
  
  Q=[]
  for i in p:
    Q.append([i,0])
  for j in q:
    Q.append([j,1])

  heapq.heapify(Q)
  cntp=0
  cntq=0
  ans=0
  for k in r:
    t=heapq.heappop(Q)
    if t[1]==0 and t[0]<k and cntp<=X:
      ans+=k 
      cntp+=1
#       dl.append(k)
    elif t[1]==1 and t[0]<k and cntq<=Y:
      ans+=k 
      cntq+=1
#       dl.append(k)
    else:
      ans+=t[0]
      break
  while True:
    try:
      s=heapq.heappop(Q)
      ans+=s[0] 
#       dl.append(s[0])
    except:
      break
  print(ans)
#   print(dl)
#   print(p)
#   print(q)
  
  return 

main()


Measured memory_bytes: 39336
from collections import deque, Counter, defaultdict
from itertools import chain, combinations
import json
# import numpy as np
import bisect
import sys
import math
import bisect
from functools import lru_cache
import itertools

sys.setrecursionlimit(10 ** 8)

M = 10 ** 9 + 7
INF = 10 ** 17


def main():
    # N = int(input())
    A, B, N = [int(a) for a in input().split()]

    def f(x):
        return math.floor(A * x / B) - A * math.floor(x / B)

    if N < B:
        print(f(N))
        return

    print(f(B-1))




if __name__ == "__main__":
    main()


Measured memory_bytes: 10120
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
void solve() {
	int  a, b, c, d;
	cin >> a >> b >> c >> d;
	int f = 1;
	while (a>0&&c>0) {
		if (f)c -= b, f = 0;
		else a -= d, f = 1;
	}
	cout << (a>0 ? "Yes" : "No");
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T_ = 1;
	//cin >> T_;
	for (int i = 0; i < T_; i++)solve();
	return 0;
}






Measured memory_bytes: 3652
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using static System.Math;

class P
{
  static int[] Input(){
    return Console.ReadLine().Split().Select(int.Parse).ToArray();
  }
  static int[][] Input2(int n){
    int[][] X = new int[n][];
    for(int i = 0; i < n; i++){
      X[i] = Input();
    }
    return X;
  }
  static void Main()
  {
    int[] NK = Input();
    int[] XS = Input();
    bool[][] dp = new bool[NK[0]+1][];
    int S = 0;
    dp[0] = new bool[NK[1]];
    dp[0][0] = true;
    for (int i=0; i<NK[0]; i++){
      dp[i+1] = new bool[NK[1]];
      for (int j=0; j<NK[1]; j++){
        dp[i+1][j] = (j-XS[i]>=0 ? dp[i][j-XS[i]] : false) | dp[i][j];
      }
    }
    //for (int i=0; i<NK[0]; i++){
    //  for (int j=0; j<NK[1]; j++){
    //    Console.Write($"{dp[i+1][j]} ");
    //  }
    //  Console.WriteLine("");
    //}
    bool[][] dp2 = new bool[NK[0]+1][];
    dp2[NK[0]] = new bool[NK[1]];
    dp2[NK[0]][0] = true;
    for (int i=NK[0]-1; i>=0; i--){
      bool flag = false;
      for (int j=0; j<NK[1]; j++){
        if (dp2[i+1][j]){
          for(int l=1; l<XS[i]+1; l++){
            if (NK[1]-j-l<0) continue;
            if (dp[i][NK[1]-j-l]){
              flag = true; break;
            }
          }
          if (flag)break;
        }
      }
      if(!flag) {
        //Console.WriteLine(XS[i]);
        //Console.WriteLine(string.Join(" ", dp[i]));
        //Console.WriteLine(string.Join(" ", dp2[i+1]));
        S += 1;
      }
      dp2[i] = new bool[NK[1]];
      for (int j=0; j<NK[1]; j++){
        dp2[i][j] = (j-XS[i] >= 0 ? dp2[i+1][j-XS[i]] : false) | dp2[i+1][j];
      }
    }

    var sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
    Console.SetOut(sw);
    Console.WriteLine(S);
    Console.Out.Flush();
  }
}


Measured memory_bytes: 72620
#include<stdio.h>
struct card {
    char s;
    int n;
};
int main(void) {
    struct card a[100], b[100], c[100], Key;
    int i = 0, j, k, n, m, l, key, minj;
    scanf("%d", &n);
    key = n;
    while ( key-- ) {
        scanf(" %c%d", &a[i].s, &a[i].n);
        b[i].s = a[i].s;
        c[i].s = a[i].s;
        b[i].n = a[i].n;
        c[i].n = a[i].n;
        i++;
    }
    /*BubbleSort*/
    for ( i = 0; i < n; i++ ) {
        for ( j = n - 1; j > i; j-- ) {
            if ( b[j].n < b[j - 1].n ) {
                Key = b[j];
                b[j] = b[j - 1];
                b[j - 1] = Key;
            }
        }
    }
    /*SelectionSort*/
    for ( i = 0; i < n; i++ ) {
        minj = i;
        for ( j = i; j < n; j++ ) {
            if ( c[j].n < c[minj].n ) minj = j;
        }
        Key = c[i];
        c[i] = c[minj];
        c[minj] = Key;
    }
 
    key = n; i = 0;
    /*while ( key-- ) {
        if ( b[i].s != c[i].s ) break; 
        i++;
    }*/
    printf("%c%d", b[0].s, b[0].n);
    for (i = 1; i < n; i++ ) {
        printf(" %c%d", b[i].s, b[i].n);        
    }
    printf("\n");
    printf("Stable\n");
    printf("%c%d", c[0].s, c[0].n);
    for (i = 1; i < n; i++ ) {
        printf(" %c%d", c[i].s, c[i].n);        
    }
    printf("\n");
    for ( i = 0; i < n; i++ ) {
        if ( b[i].s != c[i].s) { printf("Not stable\n"); break; }
    }
    if ( i == n ) printf("Stable\n");
}

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

int main(){
    int n, i;
    double x, t = 0;
    string u;
    cin >> n;
    for(i=0; i<n; i++){
        cin >> x >> u;
        if(u == "JPY"){
            t += x;
        }else{
            t += x*380000.0;
        }
    }
    cout << t;
    return 0;
}

Measured memory_bytes: 256