akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <valarray>
#include <cmath>
using namespace std;

#define EPS 1e-8

typedef valarray<double> P;

void assign(P &p, double x, double y, double z){
	p.resize(3);
	p[0] = x;
	p[1] = y;
	p[2] = z;
}

double dot(const P &a, const P &b){
	return (a * b).sum();
}

P cross(const P &a, const P &b){
	return a.cshift(-1) * b.cshift(1) - a.cshift(1) * b.cshift(-1);
}

P c[2], v[2][2];

bool check(double th){
	P p = c[1] + v[1][0] * cos(th) + v[1][1] * sin(th);
	return dot(p, p) <= 1.0;
}

int main(){
	double x, y, z;
	for(int i = 0; i < 2; ++i){
		cin >> x >> y >> z;
		assign(c[i], x, y, z);
		
		for(int j = 0; j < 2; ++j){
			cin >> x >> y >> z;
			assign(v[i][j], x, y, z);
		}
	}
	
	c[1] -= c[0];
	P nr = cross(v[0][0], v[0][1]);
	
	bool ok = false;
	x = dot(nr, v[1][1]);
	y = dot(nr, v[1][0]);
	if(max(abs(x), abs(y)) > EPS){
		double s = -dot(nr, c[1]) / sqrt(x * x + y * y);
		if(abs(s) < 1.0 + EPS){
			if(s > 1.0){ s = 1.0; }
			if(s < -1.0){ s = -1.0; }
			
			double t = asin(s);
			double dlt = atan2(y, x);
			double pi = acos(-1.0);
			
			ok = check(t - dlt) ^ check(pi - t - dlt);
		}
	}
	
	puts(ok ? "YES" : "NO");
}

Measured memory_bytes: 1252
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main(){
    ll n;
    cin >> n;
    while(n!=0){
        vector<ll> vec(n);
        for(ll i=0;i<n;i++){
            cin >> vec.at(i);
        }
        vector<ll> rsw(n+1);
        rsw.at(0) = 0;
        for(int i=1;i<n+1;i++){
            rsw.at(i) = rsw.at(i-1) + vec.at(i-1);
        }
        ll ans = vec.at(0);
        for(int i=0;i<n;i++){
            for(int j=i;j<n;j++){
                if(ans < rsw.at(j+1)-rsw.at(i)){
                    ans = rsw.at(j+1) - rsw.at(i);
                }
            }
        }
        cout << ans << endl;
        cin >> n;

    }
}


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

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1 << 30;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a * (b / gcd(a, b));
}

int n;
ll t[110];

int main(void){
	cin>>n;
	for (int i = 0; i < n; i++) cin>>t[i];

	ll res = t[0];
	for (int i = 0; i < n - 1; i++) {
		res = lcm(res, t[i + 1]);
	}

	cout<< res <<endl;
	
	return 0;
}

Measured memory_bytes: 256
import numpy as np
N, K = map(int, input().split())
h = [int(input()) for i in range(N)]

h = np.array(h)
h_sort = np.sort(h)
h_shift = np.roll(h_sort, -K+1)
dif = (h_shift - h_sort)[:-K+1]
ans = np.min(dif[dif>=0])
print(int(ans))

Measured memory_bytes: 17124
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int[] p = new int[N];
		int idx;
		int wrongCnt = 0;
		int wrongIdx1 = 0;
		int wrongIdx2 = 0;
		for (idx = 0; idx < N; idx++) {
			p[idx] = Integer.parseInt(sc.next());
			if (p[idx] != (idx + 1)) {
				++wrongCnt;
				if (wrongCnt == 1) {
					wrongIdx1 = idx;
				} else if (wrongCnt == 2) {
					wrongIdx2 = idx;
				} else {
					break;
				}
			}
		}

		boolean flag = false;
		if (wrongCnt == 0) {
			flag = true;
		} else if (wrongCnt == 2) {
			if ((wrongIdx1 + 1) == p[wrongIdx2] && (wrongIdx2 + 1) == p[wrongIdx1]) {
				flag = true;
			}
		}

		if (flag) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}

}


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


void solve(long long X, long long Y, long long Z){

    long long A, B, C;
    long long tmp;
    A = X;
    B = Y;
    C = Z;
    tmp = A;
    A = B;
    B = tmp;

    tmp = A;
    A = C;
    C = tmp;

    cout << A << " " << B << " " << C << endl;

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    long long Z;
    scanf("%lld",&Z);
    solve(X, Y, Z);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int> > S(M);
  REP(i, M) {
    int k;
    cin >> k;
    S[i].resize(k);
    REP(j, k) cin >> S[i][j];
  }
  vector<int> p(M);
  REP(i, M) cin >> p[i];

  int ans = 0, cnt = 0;
  REP(bit, 1 << N) {
    int sum = 0;
    REP(i, M) {
      cnt = 0;
      REP(j, S[i].size()) {
        if (1 << (S[i][j] - 1) & bit) cnt++;
      }
      if (cnt % 2 == p[i]) sum++;
    }
    if (sum == M) ans++;
  }

  cout << ans << endl;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<string> vec(n);
  for (auto &v : vec)
    cin >> v;

  sort(vec.begin(), vec.end());
  auto last = unique(vec.begin(), vec.end());

  cout << last - vec.begin() << endl;
}

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

using namespace std;

int main()
{
    int n,a,b,c,i,j;
    cin>>n;

    int dp[2][3];
    cin>>a>>b>>c;
    dp[0][0] = max(b,c);
    dp[0][1] = max(a,c);
    dp[0][2] = max(b,a);

    for(i=1;i<n;i++)
    {
        cin>>a>>b>>c;
        dp[i%2][0] = max(dp[(i-1)%2][1],dp[(i-1)%2][2])+a;
        dp[i%2][1] = max(dp[(i-1)%2][0],dp[(i-1)%2][2])+b;
        dp[i%2][2] = max(dp[(i-1)%2][1],dp[(i-1)%2][0])+c;
    }

    cout<<max(dp[(n-1)%2][0],max(dp[(n-1)%2][1],dp[(n-1)%2][2]));

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

const int MAX = 510000;
const int MOD = 1e9+7;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll cnt[200020][3];

int main(){
  COMinit();
  int n;
  cin >> n;
  ll a[n];
  rep(i,n)cin >> a[i];
  ll ans=1;
  rep(i,n){
    ll c=0;
    bool flag=false;
    rep(j,3){
      if(i-1>=0)cnt[i][j]=cnt[i-1][j];
      if(cnt[i][j]==a[i]){
        c++;
        if(!flag)cnt[i][j]++;
        flag=true;
      }
    }
    ans*=c;
    ans%=mod;
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 17664
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mx=1e5+10;
uli a[mx];
int main(){
  int n;
  uli x;
  scanf("%d %lld",&n,&x);
  for(int i=0;i<n;i++){
    scanf("%lld",a+i);
  }
  uli ans=0;
  for(int i=1;i<n;i++){
    if(a[i]+a[i-1]<=x)continue;
    uli dx=(a[i]+a[i-1]-x);
    ans+=dx;
    uli z=min(a[i],dx);
    a[i]-=z;
  }
  printf("%lld\n",ans);
  return 0;

}


Measured memory_bytes: 1024
n=int(input())
d,x=map(int,input().split())
a=[]
for i in range(n):
    a.append(int(input()))

b=[]
for i in range(len(a)):
    for j in range(1,d):
        if j*a[i]+1<=d:
            b.append(j*a[i]+1)

print(len(b)+n+x)

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

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

  string ans;

  if (R < 1200) {
    ans = "ABC";
  } else if (R < 2800) {
    ans = "ARC";
  } else {
    ans = "AGC";
  } 

  cout << ans << endl;
}


Measured memory_bytes: 256
from collections import deque
import bisect


N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

d = deque()

for a in A:
    p = bisect.bisect_left(d, a)
    if p == 0:
        d.appendleft(a)
        continue
    d[p-1] = a

print(len(d))


Measured memory_bytes: 8060
#include<stdio.h>

int main(){

int turn_01=0,turn_10=0;
char S[100000];
scanf("%s",S);

int i = 0;
while(S[i] != '\0'){
  if (i%2==0)
  {
    S[i]=='1' ? turn_01++ : turn_10++;
  }else
  {
    S[i]=='0' ? turn_01++ : turn_10++;
  }
  i++;
}

printf("%d",turn_01 > turn_10 ? turn_10 : turn_01 );

return 0;

}

Measured memory_bytes: 1784
#include "stdio.h"
int main(void) {
  int x, a, b;
  scanf("%d %d %d", &x, &a, &b );
  if (a - b >= 0) printf("delicious\n" );
  else if (b - a <= x) printf("safe\n" );
  else printf("dangerous\n" );
  return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;
    vector<ll> W(N);
    REP(i, N) cin >> W[i];
    ll mi = (1ll << 60);
    for(int i=1;i<N;i++){
    	ll s1=0, s2=0;
    	for(int j=1;j<=i;j++){
    		s1 += W[j-1];
    	}
    	for(int j=i+1;j<=N;j++){
    		s2 += W[j-1];
    	}
    	mi = min(mi, abs(s1-s2));
    }
    cout << mi << endl;
    return 0;
}

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

using namespace std;

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;i++)
#define FORVEC(i, v) for(int i = 0;i < v.size();i++)

#define INF 1000000000
#define pb(a) push_back(a)
#define llong long long
#define vi vector<int>
#define P pair<int,int>
#define all(vec) (vec.begin()),(vec.end())

int main(){
	int a=0,buf;
	REP(i,5){
		cin>>buf;
		if(buf<40)buf=40;
		a+=buf;
	}
	cout<<a/5<<"\n";
	
	return 0;
}

Measured memory_bytes: 3104
from itertools import accumulate

N = int(input())
A = list(map(int, input().split()))

sum_a = list(accumulate(A))
lft = 0
rgt = 2
t = sum_a[-1]
ans = t
for i in range(1,N-2):
    while sum_a[i] - sum_a[lft+1] > sum_a[lft]:
        lft += 1

    while t - sum_a[rgt+1] > sum_a[rgt] - sum_a[i]:
        rgt += 1
    p = sum_a[lft]
    q = sum_a[i] - p
    r = sum_a[rgt] - q - p
    s = t - r - q - p

    ans = min(ans, max(p,q,r,s) - min(p,q,r,s))

print(ans)


Measured memory_bytes: 24176
import java.math.*;
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int[] p = new int[A];
    int[] q = new int[B];
    int[] r = new int[C];
    for (int i = 0; i < A; i++) p[i] = sc.nextInt();
    for (int i = 0; i < B; i++) q[i] = sc.nextInt();
    for (int i = 0; i < C; i++) r[i] = sc.nextInt();
    sc.close();

    Arrays.sort(p);
    Arrays.sort(q);
    Arrays.sort(r);

    int[] xy = new int[X + Y];
    for (int i = 0; i < X; i++) xy[i] = p[A - i - 1];
    for (int i = 0; i < Y; i++) xy[X + i] = q[B - i - 1];
    Arrays.sort(xy);

    long ans = 0;
    for (int i = 0; i < X + Y; i++)
      ans += Integer.max(xy[i],
          - 1 < (C - 1 - i) ? r[C - 1 - i] : 0);

    System.out.println(ans);
  }
}


Measured memory_bytes: 96232
import string

n = int(input())
lis = [input() for _ in range(n)]

alp = list(string.ascii_lowercase)
cnt = [100] * 26

for i in lis:
    tmp = [0] * 26
    for j in i:
        t = alp.index(j)
        tmp[t] += 1
    
    for i in range(26):
        cnt[i] = min(cnt[i], tmp[i])

ans = ""
for k in range(26):
    ans += alp[k]*cnt[k]

print(ans)


Measured memory_bytes: 9912
public class Main {

    public static void main(String[] args) {
        final String line = readLine();
        System.out.println(calc(line));
    }

    protected static String calc(String input) {
        final int[] ints = split(input);

        final int compare = Integer.valueOf(ints[0]).compareTo(ints[1]);

        switch (compare) {
            case -1:
                return "a < b";
            case 1:
                return "a > b";
            default:
                return "a == b";
        }
    }

    private static int[] split(String s) {
        final String[] s0 = s.split(" ");
        int[] ints = new int[s0.length];

        for (int i = 0; i < s0.length; i++) {
            ints[i] = Integer.parseInt(s0[i]);
        }

        return ints;
    }

    private static String readLine() {
        java.util.Scanner s = null;
        try {
            s = new java.util.Scanner(System.in);
            return s.nextLine();
        } finally {
            if (s != null) {
                s.close();
            }
        }
    }
}

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

int n,q;    //n个节点，q个操作 
int par[100010];

int find(int a)
{
	if(a == par[a])
	{
		return a;
	}
	else
	{
		return find(par[a]);
	}
}

int main()
{
	while(cin>>n>>q)
	{
		if(n==0&&q==0)
		{
			return 0;
		}
		for(int i = 1;i <= n;i++)   //每个节点的初始父节点都是1 
		    par[i] = 1;
		for(int i = 2;i <= n;i++)
		{
			cin>>par[i];
		}
		long long int ans = 0;
		for(int i = 1;i <= q;i++)
		{
			int a; 
			char op;
			cin>>op>>a;
			if(op == 'M')    //标记 
			{
				par[a] = a;
			}
			else             //查询 
			{
				ans = ans + find(a);
			}
		}
		cout<<ans<<endl;
	}
} 


Measured memory_bytes: 3496
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
long gcd(long m,long n);
int main(){
  int N;
  cin>>N;
  vector<long> v(N);
  int i=0;
  while(i<N){
   	cin>>v[i];
    i++;
  }
  int tmp=1000000000;
  for(int j=0;j<N-1;j++){
    long g=gcd(v[j],v[j+1]);
  	if(g<tmp){
      tmp=g;
    }
  }
  //cout<<tmp<<endl;
  double d=log(tmp)/log(2);
  int n=(int)d;
  cout<<n<<endl;
  return 0;
}

long gcd(long m,long n){
  //cout<<m<<endl;
  //cout<<n<<endl;
  if(m%n==0){
    //cout<<"hit"<<endl;
    return n;
  }
  else{
    return gcd(n,m%n);
  }
}

Measured memory_bytes: 640
using System;

class C
{
    static void Main()
    {
        Console.ReadLine();
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int max = a[0];
        long ans = 0;
        for (int i = 0; i < a.Length; i++)
        {
            max = Math.Max(max, a[i]);
            if (a[i] < max) ans += max - a[i];
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 46120
(let* ((n (read))
       (l (loop repeat n
                collect (read))))

  (defun divisible (p)
    (zerop (mod p 2)))

  (defun divided (q)
    (/ q 2))

  (defun recursive-d (lst &optional (cnt 0))
    (if (not (every #'identity (mapcar #'divisible lst)))
        cnt
        (recursive-d (mapcar #'divided lst) (1+ cnt))))

  (format t "~A~%"
          (recursive-d l)))


Measured memory_bytes: 24708
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1 << 21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

// 0108c
int main(){
    ll n, k;
    cin >> n >> k;
    if (k%2){
        ll tmp = n/k;
        cout << tmp*tmp*tmp << endl;
    }else{
        ll htmp = 2 * n/k;
        ll tmp = n/k;
        cout << tmp*tmp*tmp + (htmp-tmp)*(htmp-tmp)*(htmp-tmp) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def s(x, y): 
	if (x == 0): 
		return y 
	return s(y%x, x) 

def result(monstar, n): 
	new = s(monstar[0], monstar[1]) 
	for i in range(2, n): 
		new = s(new,monstar[i]) 
	return new

n = int(input())
monstar = list(map(int, input().split()))
print(result(monstar, n)) 


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

int main(){

    int N;
    cin >> N;

    vector<double> v(N); // 価値
    for(int i = 0; i < N; i++){
        cin >> v[i]; 
    }

    sort(v.begin(), v.end());
    
    double ans = 0.0;
    for(int i = 1; i <= N - 1; i++){
        if(i == 1){
            ans = (v[0] + v[1]) / 2;
        }else{
            ans = (ans + v[i]) / 2;
        }
    }

    cout << setprecision(10) <<  ans << endl;

    return 0;
}

Measured memory_bytes: 256
Pt = 0
Ph = 0

n = int(input())

for i in range(n):
    I = input().split()
    Taro = I[0]
    Hanako = I[1]
    if Taro > Hanako:
        Pt += 3
    if Taro < Hanako:
        Ph += 3
    if Taro == Hanako:
        Pt += 1
        Ph += 1

print(str(Pt) + ' ' + str(Ph))

Measured memory_bytes: 7720
import math
N, D = (int(x) for x in input().split())
P = [list(map(int,input().split())) for i in range(N)]
c = 0

for i in range(N-1, 0):
    if P[i][0] < D or P[i][1] < D:
        del P[i]

for i in range(0, len(P)):
    ans = math.sqrt((P[i][0])**2 + (P[i][1])**2)
    if ans <= D:
        c += 1
    else:
        c = c
print(c)

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

using namespace std;

typedef long long ll;

#define newline cout<<"\n"
#define deb(x) cout<<#x<<" "<<x<<endl;

template<typename... T>
void read(T&... args){
    ((cin>>args), ...);
}

template<typename... T>
void write(T... args){
    ((cout<<args<<" "), ...);
}

void printarr(vector<ll> &v){
    for(ll x: v){
        cout<<x<<" ";
    }
    newline;
}

const ll MOD = 1e9+7;
const ll nax = 1e7+7;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    
    string s; cin>>s;
    ll k; cin>>k;
    k--;

    ll nt = 0;

    while(nt<s.length() && s[nt]=='1'){
        nt++;
    }

    if(nt==s.length()){
        cout<<1<<endl;
        return 0;
    }

    if(k>=nt){
        cout<<s[nt]<<endl;
    }
    else{
        cout<<1<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <map>

int main(int argc, char *argv[]){
    int M, D;
    std::cin >> M >> D;

    std::map<int,int> prod;
    int d1,d10;
    for(int i=1; i<=D; i++){
        d10 = i/10;
        d1 = i%10;
        if(d10 < 2 || d1 < 2){
            continue;
        }
        ++prod[d1*d10];
    }
    int sum = 0;
    for(int i=1; i<=M; ++i){
        sum += prod[i];
    }
    std::cout << sum << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  int n = 0;
  cin >> n;
  int res = 0;
  vector<int> m(n);
  for(int i = 0;i < n;i++){
    cin >> m[i];
    m[i]--;
  }
  vector<int> a(n);
  for(int i = 0;i < n;i++){
    a[m[i]] = i;
  }
  int now = 0;
  now = 1;
  for(int i = 0;i < n - 1;i++){
    if(a[i] < a[i + 1]){
      now++;
    }
    else{
      now = 1;
    }
    res = max(res,now);
  }
  res = max(res,now);
  cout << n - res << endl;
}

Measured memory_bytes: 1792
s = input()
head = int(s[0:2])
back = int(s[2:4])

if 1 <= head and head <= 12:
    if 1 <= back and back <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= back and back <= 12:
        print('YYMM')
    else:
        print('NA')

Measured memory_bytes: 3060
def BubbleSort(A, N):
    if N == 1:
        print(str(A[0]) + "\n" + str(0))
    else:
        count = 0
        for i in range(N): #このiは使わない
            for j in range(N - i - 1):
                if A[N - j - 1] < A[N - j - 2]: #わかりにくくなってしまった
                    count += 1
                    A[N - j - 1], A[N - j - 2] = A[N - j - 2], A[N - j - 1] 
        str_A = map(str, A)
        print(" ".join(str_A) +  "\n" + str(count))

n = int(input())
a = list(map(int, input().split()))

BubbleSort(a, n)


Measured memory_bytes: 5608
#include <iostream>

using namespace std;


int main() {
    int a[10],n=5,poz=1,s=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n-1;i++){
        for(int j=i+1;j<=n;j++){
            if(a[i]%10<a[j]%10) swap(a[i],a[j]);
        }
    }
    if(a[1]%10==0){
        for(int i=1;i<=n;i++){
            s+=a[i];
        }
        cout<<s;
        return 0;
    }
    /**for(int i=1;i<=n;i++){
        cout<<a[i]<< " ";
       cout<<endl;
    }*/

    for(int i=n;i>=1;i--){
        if(a[i]%10!=0){
            poz=i;
            break;
        }
    }
    ///cout<<poz<<endl;
    s=a[1];
    if(a[1]%10!=0){
        s += 10-a[1]%10;
    }
    for(int i=2;i<poz;i++){
        s+=a[i] + (10-a[i]%10);        
    }
    for(int i=poz+1;i<=n;i++){
        s+=a[i];
    }
    s+=a[poz];
    cout<<s;
    return 0;
}

Measured memory_bytes: 256
s = input()
w = int(input())
ans = []
if len(s)%w == 0:
  for i in range(len(s)//w):
    ans.append(s[w*i])
else:
  for i in range(len(s)//w+1):
    ans.append(s[w*i])
print("".join(ans))

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

int main(){
    int N=0,M=0,i=0,j=0,ans=0,tmp=0;
    cin >> N;
    int t[N]={};
    for(i=0;i<N;i++){
        cin >> t[i];
    }
    cin >> M;
    int p[M]={},x[M]={};
    for(i=0;i<M;i++){
        cin >> p[i] >> x[i];
    }
    for(i=0;i<M;i++){
        tmp=t[p[i]-1];
        t[p[i]-1]=x[i];
        for(j=0;j<N;j++){
            ans += t[j];
        }
        cout << ans << endl;
        ans=0;
        t[p[i]-1]=tmp;
    }

    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

int[][10^^5*2] T;
bool[10^^5*2] FS;

void main()
{
    auto N = readln.chomp.to!int;
    foreach (i; 0..N-1) {
        auto ab = readln.split.to!(int[]);
        auto a = ab[0]-1;
        auto b = ab[1]-1;
        T[a] ~= b;
        T[b] ~= a;
    }

    alias EL = Tuple!(int, "e", int, "l");
    EL view(int i, int l) {
        auto el = EL(i, l+1);
        FS[i] = true;
        foreach (n; T[i]) {
            if (FS[n]) continue;
            auto nn = view(n, l+1);
            el = el.l > nn.l ? el : nn;
        }
        return el;
    }
    auto p1 = view(0, 0);
    FS[] = false;
    auto p2 = view(p1.e, 0);
    writeln(p2.l > 1 && (p2.l-2)%3 == 0 ? "Second" : "First");
}

Measured memory_bytes: 31228
#include<bits/stdc++.h>
using namespace std;
int main(){
  int W , H , N;
  cin>>W>>H>>N;
  int maxx=0 , maxy=0 , minx=W , miny=H ;
  for(int i=0;i<N;i++){
    int x , y , a;
    cin>>x>>y>>a;
    if(a==1) maxx=max(x,maxx);
    if(a==2) minx=min(x,minx);
    if(a==3) maxy=max(y,maxy);
    if(a==4) miny=min(y,miny);
  }
  if(minx-maxx>0 && miny-maxy>0){
    cout<<(minx-maxx)*(miny-maxy)<<endl;
  }
  else cout<<0<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)); //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl;}
const LL MOD = 1e9 + 7;
const LL INF = 1LL << 60;

int main(void){
    LL N;
    cin >> N;

    vector<string> S(N);
    rep(i, N){
        cin >> S[i];
        sort(ALL(S[i]));
    }

    map<string, LL> anagram;
    rep(i, N)
    {
        anagram[S[i]]++;
    }

    LL ans = 0;
    for(auto &kv:anagram){
        ans += kv.second * (kv.second - 1) / 2;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 18176
#include<iostream>

using namespace std;

int main(){
    int X, Y;
    cin >> X >> Y;
    int a, b;
    a = 4*X-Y;
    b = -2*X+Y;
    if(a>=0 && b >=0 && a%2==0 && b%2 ==0){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}

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

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

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

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

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

vector<vector<pair<int, int> > > edge;//edge[i][j] firstがiからj番目のノード、secondがその重み
vector<int> d(100005,INF);

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
	cin >> a >> b;
	int ans = 0;
	if(a>b) {
		ans += a;
		a--;
	}else{
		ans += b;
		b--;
	}
	if(a>b){
		ans += a;
	}else{
		ans += b;
	}
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <stdio.h>

int card[4][13];//0:exist 1:non-exist
char mark[]={'S', 'H', 'C', 'D'};

int main(){
  int i,j,n;
  char suit;
  int card_num;

  /*scan exiting card*/
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf(" %c %d", &suit, &card_num);
    if(suit=='S') card[0][card_num-1]=1;
    else if(suit=='H') card[1][card_num-1]=1;
    else if(suit=='C') card[2][card_num-1]=1;
    else if(suit=='D') card[3][card_num-1]=1;
  }

  /*print non existing cards*/
  for(i=0; i<4; i++)
    for(j=0; j<13; j++)
      if(card[i][j]==0)
	printf("%c %d\n", mark[i], j+1);
    
  return 0;
}

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

double calc(int A[],int B[],int N,int P){
	int x=0;
	double D=0;

	for(int i=0;i<N;i++){
		x=abs(A[i]-B[i]);
		for(int j=1;j<P;j++){
			x*=abs(A[i]-B[i]);
		}
		D+=x;
	}

	return D;
}

double chevishef(int A[],int B[],int N){
	int x=abs(A[0]-B[0]);
	for(int i=1;i<N;i++){
		if(x < (abs(A[i]-B[i]))){
			x=(abs(A[i]-B[i]));
		}
	}
	return x;
}

int main(){
    int N;
	int *A,*B;

	scanf("%d",&N);
	A=(int*)malloc(sizeof(int)*N);
	B=(int*)malloc(sizeof(int)*N);

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

	printf("%f\n",calc(A,B,N,1));
	printf("%f\n",sqrt(calc(A,B,N,2)));
	printf("%f\n",pow(calc(A,B,N,3),1.0/3.0));
	printf("%f\n",chevishef(A,B,N));

	return 0;
}


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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }

struct Edge {
  int t;
  ll cost;
};

int dp[20][200001];
ll depth[200001];

void dfs(int v, int p, vector<vector<Edge>> &G, ll d) {
  depth[v] = d;
  for(int i = 0; i < G[v].size(); i++) {
    if (G[v][i].t == p) continue;
    dp[0][G[v][i].t] = v;
    dfs(G[v][i].t, v, G, d + G[v][i].cost);
  }
}

int lcp(int a, int b) {
  for(int i = 19; i >= 0; i--) {
    if (dp[i][a] != dp[i][b]) {
      a = dp[i][a];
      b = dp[i][b];
    }
  }
  return dp[0][a];
}

void solve() {
  int N;
  cin >> N;
  vector<vector<Edge>> G(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    G[a].push_back({b, c});
    G[b].push_back({a, c});
  }

  int Q, K;
  cin >> Q >> K;
  K--;

  dp[0][K] = -1;
  dfs(K, -1, G, 0);
  for(int i = 0; i < 19; i++) {
    for(int j = 0; j < N; j++) {
      dp[i + 1][j] = dp[i][dp[i][j]];
    }
  }

  for (int i = 0; i < Q; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    //int c = lcp(x, y);
    cout << depth[x] + depth[y] << endl;
  }
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}

Measured memory_bytes: 30976
#include<bits/stdc++.h>
using namespace std; typedef long long  ll;
#define all(a) a.begin() , a.end()
#define print(x)   cout<<x<<"\n";
const ll M = ll(1e9 + 7);
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; if (i != v.size() - 1) os << ", "; } os << "]\n"; return os;}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v)
{os << "["; for (auto it : v) {os << it; if (it != *v.rbegin())os << ", ";} os << "]\n"; return os;}
template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v)
{for (auto it : v)os << it.first << " : " << it.second << "\n"; return os;}
template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v)
{os << "("; os << v.first << ", " << v.second << ")"; return os;}
/***********************************************************************/
int x, y;
string a, b;
int dp[3005][3005];
int solve(int i, int j)
{
    if (dp[i][j] != -1)
        return dp[i][j];
    if (i == x or j == y)
        return dp[i][j] = 0;
    if (a[i] == b[j])
    {
        return dp[i][j] = 1 + solve(i + 1, j + 1);
    }
    return dp[i][j] = max(solve(i, j + 1), solve(i + 1, j));
}
int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    for (int i = 0; i < 3005; i++)
        for (int j = 0; j < 3005; j++)
            dp[i][j] = -1;
    cin >> a >> b;
    x = a.size(); y = b.size();
    solve(0, 0);
    int i = 0, j = 0;
    while (i < x and j < y)
    {
        if (a[i] == b[j])
        {
            cout << a[i];
            i++; j++;
        }
        else if (dp[i + 1][j] > dp[i][j + 1])
            i++;
        else
            j++;
    }
}

Measured memory_bytes: 35840
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <cmath>
#include <string>
#include <iomanip>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <unordered_map>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define inf 1013161010
#define ninf -1013161010
#define mod 1000000007
#define ll long long
#define lf long double
#define in(x) scanf("%d",&x);
#define sz(x) ((int)x.size())
#define lld l64d
#define rep(i,n) for(i=0;i<n;i++)
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep1(i,a,b) for(i=a;i<=b;i++)
#define rrep1(i,a,b) for(i=a;i>=b;i--)
#define stlfor(i,t) for(auto i =t.begin();i!=t.end();i++)
#define fr freopen("x.txt","r",stdin)
#define frc freopen("y.txt","w",stdout)
#define all(x) x.begin(),x.end()
#define set0(x) memset(x,0,sizeof(x))
#define dbg cout<<"yo "<<endl;
#define pset(n) fixed<<showpoint<<setprecision(n)

#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<ll,ll> >
#define si set<int>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define vi vector<int>
#define pb push_back
#define ff first
#define ss second
#define mp make_pair

typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> OST;

ll toint(const string &s) { stringstream ss; ss << s; ll x; ss >> x; return x; }
string tostring ( ll number ){  stringstream ss; ss<< number; return ss.str();}

const lf pi = 2*acos(0);
const int nn = 2000006;
const lf EPS = 0.000000001;

ll gcd(ll a,ll b){return (b==0)? a:gcd(b,a%b); }
void nope(int num = 0){ if(num==0) cout<<"NO"; else cout<<"-1"; exit(0); }

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll i,j,n,tt;
    tt=1;
    //cin>>tt;
    while(tt--)
    {
        int x, k;
        cin>>n;
        cin>>x;

        for(i=0;i<=n;i++)
        {
            for(j=0;j<=n;j++)
            {
                int k = n-i-j;
                if(k>=0 and (10000*i+5000*j+1000*k)==x)
                {
                    cout<<i<<" "<<j<<" "<<k<<endl;
                    return 0;
                }
            }
        }

        cout<<"-1 -1 -1"<<endl;


    }
    return 0;
}



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

int main()
{
	int age;
	string ans;
	
	cin>>age;
	
	if(age==5 || age==7 || age==3) 
		ans="YES\n";
	
	else 
		ans="NO\n";
	
	
	cout<<ans;
	
	return 0;
}

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

int main() {
		int A, B, C, D;
		cin >> A >> B >> C >> D;
		
		int left_sum = A + B;
		int right_sum = C + D;

		string result;
		if (left_sum > right_sum) {
				result = "Left";
		} else if (left_sum == right_sum) {
				result = "Balanced";
		} else {
				result = "Right";
		}

		cout << result << endl;

		return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std ;
int main ()
{
int a ,b ;
cin >>a>> b ;
int sum =a+b;
int z = sum -24 ;
if (sum <24 )
   cout << sum ;
else if (sum==24) 
    cout<< z ;
else if (sum>24) 
    cout << z ;


return 0; 
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

public class Program
{
	static public void Main(string[] args)
	{
		string str = Console.ReadLine();
		int[] data = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

		int num = 0;
		int min = data[0];
		for (int i = 0; i < data.Length; i++)
		{
			if(data[i] <= min )
			{
				num++;
			}
			min = Math.Min(min, data[i]);
		}
		Console.WriteLine(num);
	}
}

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

int main() {
    int n;
    cin >> n;
    const int m = 1000000007;

    long long n10 = 1, n9 = 1, n8 = 1;
    for (int i = 0; i < n; i++) {
        n10 = n10 * 10 % m;
        n9 = n9 * 9 % m;
        n8 = n8 * 8 % m;
    }

    long long ans = n10 - (n9 * 2 - n8);
    while (ans < 0) ans += m;
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <iostream>
using namespace std;
int main (){
  int a,b,c;
  cin >> a >> b >> c;
  if (a<b && b<c) cout << "Yes" <<endl;
  if ((a>=b && b<=c) || (a<=b && b>=c) || (a==b && b==c)) cout << "No" <<endl;
 return 0;
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

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

    std::string S;
    std::cin >> S;

    int n = S.size();
    std::cout << S.substr(0, n - 8) << std::endl;
}


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

constexpr int64_t mod = 1e9 + 7;

int main() {
    int64_t n, k;
    cin >> n >> k;

    int64_t ans = 0;
    for(int64_t i = k; i <= n + 1; i++) {
        int64_t num = ((2*n*i + i - i*i)/2%mod - i*(i - 1)/2%mod + 1 + mod)%mod;
        ans += num;
        ans %= mod;
        // cout << "i: " << i << ", num: " << num << endl;
    }

    cout << ans << endl;
}

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

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector < int >d(N);
	for (int i = 0; i < N; i++) {
		cin >> d[i];
	}

	int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			ans += d[i] * d[j];
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
/////////////////////////////////TEST CASES////////////////////////////////////
/*
*/
/////////////////////////////////////CODE//////////////////////////////////////		
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = a ; i > b ; i--)
#define fastio ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define PI 3.14159265
typedef long long ll;
#define vl vector<ll> 
#define IN(inp) ll inp;cin>>inp;
#define pb push_back
#define all(a) a.begin(),a.end()
#define FR(i,a) for(auto i:a)
#define what(A) cout<<#A<<" is "<<A<<endl;
ll dp[100010];
void solve()
{
	IN(n)IN(k);
	vl v;
	FOR(i, 0, n)
	{
		IN(in);
		v.pb(in);
	}
	dp[0] = 0;
	FOR(i, 1, k+1)
	{
		FOR(j, 0, n)
		{
			if(i-v[j]>=0 and dp[i - v[j]] == 0)
				dp[i] = 1;
		}
	}
	if (dp[k] == 1)
		cout << "First";
	else
		cout << "Second";
}
int main()
{
	fastio
		//freopen("input.txt", "rt", stdin);
		//freopen("output.txt", "wt", stdout);
		ll test = 1;
	//cin >> test;
	while (test--)
	{
		solve();
	}
}

Measured memory_bytes: 4440
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
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; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	ll a, b, c; char d;
	cin >> a >> b >> d >> c;
	b *= 100;
	cout << a * (b + c) / 100 << endl;
	return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int d = b - a;
        System.out.println((d + 1) * d / 2 - b);
    }
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	std::cin >> a;
}
template<class _T> static void getint(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void A();

int main()
{
	A();
	fflush(stdout);
	return 0;
}

static void A()
{
	int N;
	getint(N);

	std::vector<int> hi(N, 0);
	for (int i = 0; i < N; i++) {
		getint(hi[i]);
	}

	int maxm = 0;
	int mov = 0;
	for (int i = N - 1; i > 0; i--) {
		if (hi[i] <= hi[i - 1]) {
			mov++;
		}
		else {
			mov = 0;
		}
		maxm = std::max(maxm, mov);
	}
	printf("%d\n", maxm);
}


Measured memory_bytes: 3764
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <math.h>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
#pragma GCC optimize ("-O3")
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL);
#define tolower(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define toupper(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define ll long long int
ll max(ll a, ll b) {  return a > b ? a : b; }
ll gcd(ll a, ll b) { if (a == 0) return b; return b == 0 ? a : gcd(b, a % b);}
#define case(i) cout<<"Case #"<<i<<": ";
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << '\n'; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) { cerr << "[ " << *it << " = " << a << " ]"; err(++it, args...);}
#define pii pair <ll , ll >
#define pb push_back
#define PRECISION 10
const ll inf = 1e16;
const int MAXN = 100001;
const int LOGN = 22;
const int MAXBIT = 61;
const int DIGITSIZE = 19;
ll mod = 1e9 + 7;
ll MOD = 998244353;
int x4[] = {1, -1, 0, 0};
int y4[] = {0, 0, 1, -1};
bool take_test_cases = 0;
bool print_case_no = 0;

void getac(int T) {
    ll a,b,c;
    cin>>a>>b>>c;
    ll k;
    cin>>k;
    ll ans=0;
    ll temp=min(k,a);
    k-=temp;
    ans+=temp;
    temp=min(k,b);
    k-=temp;
    temp=min(k,c);
    ans-=temp;
    cout<<ans<<'\n';

}
int  main()
{

    fastio;
    int t = 1;
    if (take_test_cases) cin >> t;
    int t_t = 1;
    while (t--) {
        if (print_case_no)
        case (t_t);
        getac(t_t);
        t_t++;
    }
    return 0;
}

Measured memory_bytes: 3636
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		PrintWriter pw=new PrintWriter(System.out);
		int X=sc.nextInt();
		int A=sc.nextInt();
		pw.println(X<A?0:10);
		pw.close();
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public int nextInt() {
    	return Integer.parseInt(next());
    }
    
    public long nextLong() {
    	return Long.parseLong(next());
    }
}

Measured memory_bytes: 21204
#include <stdio.h>
#include <stdlib.h>

#define VMAX 10000

int main()
{
    unsigned short *A, *B;
    int C[VMAX + 1];
    int n, i, j;

    scanf("%d", &n);

    A = (unsigned short *)malloc(sizeof(short) * n + 1);
    B = (unsigned short *)malloc(sizeof(short) * n + 1);

    for (i = 0; i <= VMAX; i++) C[i] = 0;

    for (i = 0; i < n; i++) {
        scanf("%hu", &A[i + 1]);
        C[A[i + 1]]++;
    }

    for (i = 1; i <= VMAX; i++) C[i] = C[i] + C[i - 1];

    for (j = 1; j <= n; j++) {
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }

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

    return 0;
}


Measured memory_bytes: 10564
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pint;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int inf=1e9+10;

int N;
ull T[100010];
int b[100010];
map<int,int>mp;

ull gcd(ull a,ull b){
	if(b%a==0) return a;
	else if(a>b) return gcd(b,a);
	else return gcd(b%a,a);
}

ull lcm(ull a,ull b){
	return (b/gcd(a,b))*a;
}

int main() {
	
	cin>>N;
	Rep(i,N) cin>>T[i];
	ull ans=T[0];
	Rep(i,N) ans = lcm(ans,T[i]);
	cout<<ans<<endl;

	return 0;
}


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

vector<int> tsort(const vector<vector<int>> &g){
  int N = (int)g.size();
  vector<int> ret;
  vector<bool> is_temp(N, false);
  vector<bool> is_perm(N, false);
  function<void(int)> visit = [&](int n){
    if(is_temp[n])
      assert(false);
    else if(!is_perm[n]){
      for(int to:g[n]){
        visit(to); 
      }
      is_perm[n] = true;
      is_temp[n] = false;
      ret.emplace_back(n);
    }
  };
  for(int i=0;i<N;i++){
    if(!is_perm[i]&&!is_temp[i]){
      visit(i);
      // assert(t != 1);
    }
  }
  reverse(ret.begin(), ret.end());
  return ret;
}

int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<int>> g(N);
  for(int i=0;i<N+M-1;i++){
    int a,b;
    cin >> a >> b;
    a--;b--;
    g[a].emplace_back(b);
  }
  vector<int> tsorted = tsort(g);
  vector<int> ans(N, -1);
  for(auto&& u:tsorted)
    for(auto&& v:g[u])
      ans[v] = u; 
  for(auto&& x:ans)cout << x+1 << endl;
}

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

int main(int argc, const char * argv[]) {
    
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    
    sort(a,a+3);
    
    cout << a[0] << " " << a[1] << " " << a[2] << endl;
    
    return 0;
}

Measured memory_bytes: 1184
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll n ; cin >> n ;
	ll cnt = 0 ;
	while(n>0){
		cnt++ ;
		n /= 2 ;
	}
	ll ans = 1 ;
	for(int i=0;i<cnt-1;i++) ans *= 2 ;
	cout << ans << endl ;
}



Measured memory_bytes: 3128