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


// =========================== DEBUGGER =================================

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ((it == d.b) ? "" : ", ") << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define tag(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// =====================================================================







#define ll long long
const ll int INF = 1e15;

int dp[3005][3005];
string s1, s2;


int kil(int idx1, int idx2)
{
  if(idx1 == s1.length() || idx2 == s2.length())
    return 0;
  if(dp[idx1][idx2] != -1)
    return dp[idx1][idx2];

  if(s1[idx1] == s2[idx2])
      dp[idx1][idx2] = max(dp[idx1][idx2], kil(idx1+1, idx2+1) + 1);
  else
  {
    dp[idx1][idx2] = max(dp[idx1][idx2], kil(idx1, idx2+1));
    dp[idx1][idx2] = max(dp[idx1][idx2], kil(idx1+1, idx2));
  }
  return dp[idx1][idx2];
}

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

  cin>>s1>>s2;
  string res;
  int ans;
  memset(dp, -1, sizeof dp);

  ans = kil(0, 0);

  int idx1=0, idx2=0;
  while(idx1 != s1.length() && idx2 != s2.length())
  {
    if(s1[idx1] == s2[idx2])
    {
        res += s1[idx1];
        idx1 += 1;
        idx2 += 1;
    }
    else
    {
      if(dp[idx1][idx2] == dp[idx1+1][idx2] && dp[idx1][idx2] != -1)
        idx1 += 1;
      else
        idx2 += 1;
    }
  }

  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 35840
#include<stdio.h>
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

int main(){
    int a[4][4];
    scanf("%d%d%d",&a[1][1],&a[1][2],&a[1][3]);
    scanf("%d%d%d",&a[2][1],&a[2][2],&a[2][3]);
    scanf("%d%d%d",&a[3][1],&a[3][2],&a[3][3]);
    if(pow(a[1][2]+a[2][1]-a[1][1]-a[2][2],2)+pow(a[1][3]+a[3][1]-a[1][1]-a[3][3],2)+pow(a[1][2]+a[3][1]-a[1][1]-a[3][2],2)+pow(a[1][3]+a[2][1]-a[1][1]-a[2][3],2)==0){printf("Yes\n");}else{printf("No\n");}
    return 0;
}


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

int main() {
    int a;cin >> a;
    string op; cin >> op;
    int b;cin >> b;

    if (op == "+"){
        cout << a + b << endl;
    } else {
        cout << a - b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
from functools import reduce
import math
from collections import deque
from collections import defaultdict

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    a = []
    b = []
    d = defaultdict(list)
    
    for i in range(N-1):
        s1,s2 = list(int(_) for _ in input().split())
        d[s1].append(s2)
        d[s2].append(s1)
        
    bw = defaultdict(str)
    bw[1] = 'b'
    bw[N] = 'w'
    f= 0
    s= 0
    q = deque()
    q.append(1)
    q.append(N)
    while q:
        next_node = q.popleft()
        if(bw[next_node] == 'b'):
            f+=1
        elif(bw[next_node] == 'w'):
            s+=1
        for succ in d[next_node]:
            if bw[succ] == '':
                bw[succ] = bw[next_node]
                q.append(succ)
    if(f>s):
        print('Fennec')
    else:
        print('Snuke')
if __name__ == '__main__':
    main()


Measured memory_bytes: 45592
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 1000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int n,ans;
signed main(){
	string s;
	cin>>n>>s;
    rep(i,s.size()){
        if(s[i]+n>'Z')s[i]='A'+s[i]+n-'Z'-1;
        else s[i]+=n;
    }
    cout<<s<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#define N 200005
int n, m, c, i, j, k, ans, a[N];
long long x[N], y[N];
int main(){
	scanf("%d%d%d", &n, &m, &c);
	for(i=1; i<=n; i++){
		scanf("%d", &a[i]);
		x[i] = x[i-1] + a[i];
	}
	for(i=1; i<=m; i++){
		scanf("%d", &a[i]);
		y[i] = y[i-1] + a[i];
	}
	for(i=0; i<=n; i++){
		if(c-x[i] < 0) break;
		k = std::upper_bound(y+1, y+m+1, c-x[i]) - y;
		if(i+k > ans) ans = i + k-1;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 5600
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int N,A[200010],Q[200010];

int main(){
	int count=0,max=0;
	cin>>N;
	REP(i,N){
		cin>>A[i];
		Q[A[i]-1]=i;
	}
	for(int i=1;i<N;i++){
		if(Q[i-1]<Q[i]){
			count++;
			if(count>max)max=count;
		}
		else{
			count=0;
		}
		DEB(count)END
	}
	cout<<N-max-1<<endl;
	return 0;
}

Measured memory_bytes: 1920
s = input()
n = len(s)
ans = [0] * n
i = 0
while i < n:
    i0 = i
    while s[i] == 'R':
        i += 1
    diff = i - i0
    ans[i-1] += (diff + 1) // 2
    ans[i] += (diff) // 2
    while i < n and s[i] == 'L':
        i += 1
i = n - 1
while i >= 0:
    i0 = i
    while s[i] == 'L':
        i -= 1
    diff = i0 - i
    ans[i+1] += (diff + 1) // 2
    ans[i] += (diff) // 2
    while i < n and s[i] == 'R':
        i -= 1
print(' '.join(map(str, ans)))

    

Measured memory_bytes: 84640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		scan.close();
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < S.length(); i++) {
			String t = S.substring(i, i + 1);
			if(t.matches("[a-z]")) {
				sb.append(t.toUpperCase());
			}else if(t.matches("[A-Z]")) {
				sb.append(t.toLowerCase());
			}else {
				sb.append(t);
			}
		}
		System.out.println(sb.toString());
	}
}


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

using namespace std;

const int MAXN=100100;

int A[MAXN],n,k;

bool check(int P)
{
	int t=0,tot=0;
	for(int i=0;i<n;i++)
	{
		if(t+A[i]>P)
		{
			tot++;
			t=A[i];
		}
		else t+=A[i];
	}
	tot++;
	if(tot>k) return false;
	return true;
}

int main()
{
	scanf("%d%d",&n,&k);
	int ul=0,ur=INT_MAX;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&A[i]);
		ul=max(ul,A[i]);
	}
	ul--;
	ur-=ul;
	while(ur-ul>1)
	{
		int mid=(ur+ul)>>1;
		if(check(mid)) ur=mid;
		else ul=mid;
	}
	printf("%d\n",ur);
	return 0;
}

Measured memory_bytes: 3556
#include <iostream>
#include <math.h>
using namespace std;
int main(){
    int a, i1, i2, i3;
    double i4;
    while(1){
    cin >> a;
    i1 = a;
        i3 = 0;
        if(a==0){break;}
    while(1){
        i1++;
        if(i1 > 2*a){break;}
    
    i2 = 2;
    while(1){
    if(i1 % i2==0){break;}
    i2++;
        i4 = sqrt(i1);
    if(i4<i2){i3++; break;}
    }
    }
        if(a == 1){i3++;}
        cout << i3 << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

const int N = 4e3+4;
int n,pref[N][3];
long long ans;
char s[N],x[]={'R','G','B'};

int main(){
    scanf("%d %s", &n,s+1);
    for(int i = 1;i<=n;i++){
        for(int c = 0;c<3;c++){
            pref[i][c] = pref[i-1][c];
            if(x[c] == s[i]) pref[i][c]++;
        }
    }
    for(int i = 1;i<=n;i++){
        for(int d=1;i+d<=n;d++){
            if(s[i]==s[i+d]) continue;
            for(int c = 0;c<3;c++){
                if(s[i]!=x[c] and s[i+d]!=x[c]){
                    ans+=(pref[n][c]-pref[i+d][c]);
                    if(i+2*d <= n){
                        if(s[i+2*d] == x[c]) ans--;
                    }
                }
            }
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 1744
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
struct node
{
    int ip;
    char name[20];
    int fen;
}a[105];
int cmp(node x,node y)
{
    int n=strcmp(x.name,y.name);
    if(n==0)
    return x.fen>y.fen;
    if(n<0)
        return 1;
    return 0;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        a[i].ip=i;
        scanf("%s%d",a[i].name,&a[i].fen);
    }
    sort(a+1,a+1+n,cmp);
    for(int i=1;i<=n;i++)
        printf("%d\n",a[i].ip);

    return 0;
}


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

using namespace std;

#define FOR(i,f,t) for(int i=(int)f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=(int)f; i>(int)t; i--)
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define pb push_back
#define SYNC ios_base::sync_with_stdio(false)
#define st(v) sort(v.begin(),v.end());
#define F first
#define S second
#define ri(x) scanf("%d",&x)
#define rii(x,y) scanf("%d %d",&x,&y)
#define riii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define lri(x) scanf("%lld",&x)
#define lrii(x,y) scanf("%lld %lld",&x,&y)
#define lriii(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)

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

const int MAXN = 5e5; //AREGLAAAAAAAAR!!!!
int a[4];
int cnt = 0;
int check(){
	if(a[0]==a[1] && a[1]==a[2]) return 1;
	else if(a[0]==a[1] && a[2]==a[0]+1){
		cnt++;
		return 1;
	}
	return 0; 
}
int main(){
	FOR(i,0,3) ri(a[i]);
	sort(a,a+3);
	while(!check()){
		cnt++;
		a[0]+=2;
		sort(a,a+3);
	}
	printf("%d\n",cnt);
}


Measured memory_bytes: 256
import math
a,b,x=map(int,input().split())
if (a**2)*b<=2*x:
    ans=2*(((a**2)*b)-x)
    print(math.degrees(math.atan(ans/a**3)))
else:
    ans=2*x
    q=math.degrees(math.atan(ans/(a*(b**2))))
    print(90-q)


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

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

using namespace std;

typedef long long ll;

int n;
vector<int> a, b, c;

void read(vector<int>& v){
    v.resize(n);
    rep(i, n){
        cin >> v[i];
    }
    sort(v.begin(), v.end());
}

int main(){
    cin >> n;
    read(a);
    read(b);
    read(c);
    ll ans = 0;
    rep(i, b.size()){
        ll x = upper_bound(a.begin(), a.end(), b[i] - 1) - a.begin();
        ll y = c.end() - lower_bound(c.begin(), c.end(), b[i] + 1);
        ans += x * y;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1916
s = gets.chomp.split("").map(&:to_s);
sl=s.length

ans = "Yes"


ck1 = s.slice(0..(sl/2)-1)
ck2 = s.slice(((sl/2)+1)..sl-1).reverse

if (ck1!=ck2) then
	ans = "No"
end

#check2
s2 = s.slice(0..(sl/2)-1)
s2l=s2.length

if s2l%2==0 then
	ck3 = s2.slice(0..(s2l/2))
	ck4 = s2.reverse.slice(0..(s2l/2))
	if ck3 != ck4 then
		ans ="No"
	end

else
	ck3 = s2.slice(0..(s2l/2)-1)
	ck4 = s2.reverse.slice(0..(s2l/2)-1)
	if ck3 != ck4 then
		ans ="No"
	end
end

puts ans

	

Measured memory_bytes: 14376
def main():
    N=int(input())
    L=[0]*(N+1)
    A=[int(_) for _ in input().split()]
    P=[0]*(N+1)
    ans=[0]*(N+1)

    for i in A:
        L[i]+=1

    a=set(A)

    for i in a:
        P[i]=L[i]*(L[i]-1)//2

    sums=sum(P)

    for i in a:
        if L[i]>=2:
            ans[i]=sums-P[i]+(L[i]-1)*(L[i]-2)//2
        else:
            ans[i]=sums

    for i in A:
        print(ans[i])

if __name__ == '__main__':
    main()

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main(void){
	string s;
	cin >> s;

	const int n = s.size();
	string ex = "";
	rep(i,n) if(s[i]!='x') ex += s[i];

	bool ok = true;
	const int m = ex.size();
	rep(i,m) if(ex[i]!=ex[m-1-i]) ok = false;

	if(ok==false){
		cout << -1 << endl;
		return 0;
	}

	int prv = -1;
	vector<int> ary;
	rep(i,n){
		if(s[i]=='x') continue;
		ary.push_back(i-prv-1);
		prv = i;
	}

	ary.push_back(n-prv-1);
	//for(auto &it:ary) cout << it << endl;
	int ans = 0;

	const int half = ary.size()/2;
	const int all = ary.size();
	rep(i,half) ans += max(ary[i],ary[all-1-i]) - min(ary[i],ary[all-1-i]);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
// #include <cassert>
#include <vector>
#include <algorithm>
#include <climits>
#include <bitset>

#include <stack>
#include <queue>
// #include <deque>
#include <set>
#include <map>
// #include <string>
// #include <unordered_set>
// #include <unordered_map>

#include <tuple>
// #include <cmath>
// #include <numeric>

using namespace std;


typedef long long ll;
typedef pair<long,long> pll;
typedef pair<int,int> pii;
typedef pair<int,long> pil;
typedef pair<long,int> pli;
typedef pair<long long, long long> pllll;
typedef pair<long long, int> plli;
typedef pair<int,long long> pill;
typedef vector<vector<long long>> vvll;
typedef vector<vector<long>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<long long> vll;

#define emplace_back pb
const char el = '\n';

/*
Edge cases:


*/

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

    int k; cin>>k;

    ll ret = 0;
    for (int a=1; a<=k; ++a) {
        for (int b=1; b<=k; ++b) {
            for (int c=1; c<=k; ++c) {
                int x = __gcd(a,b);
                x = __gcd(x,c);
                ret += (ll) x;
            }
        }
    }

    cout<<ret<<el;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    string a, s, c;
    cin>>a>>s>>c;
    cout<<a[0]<<s[0]<<c[0];   
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        if (n < 1000) System.out.println("ABC");
        else System.out.println("ABD");
    }
}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
int main(void){
    bool a1=true,a2=true,a3=true;
    string S;
    cin>>S;
    int N = S.size();
    for(int i=0;i<N/2-1;i++){
        if(S.at(i)!=S.at(N-i-1)){
            a1 = false;
        }
    }
    for(int i=0;i<(N-1)/4-1;i++){
        if(S.at(i)!=S.at((N-1)/2-i-1)){
            a2 = false;
        }
    }
    for(int i=(N+3)/2-1,j=0;i<N-1;i++,j++){
        if(S.at(i)!=S.at((N-j-1))){
            a3 = false;
        }
    }
    if(a1&&a2&&a3){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

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

	public void run() {
		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();
		Long p[] = new Long[a];
		Long q[] = new Long[b];
		Long r[] = new Long[c];
		for(int i=0; i<a; i++) p[i]=sc.nextLong();
		for(int i=0; i<b; i++) q[i]=sc.nextLong();
		for(int i=0; i<c; i++) r[i]=sc.nextLong();
		Arrays.sort(p, Collections.reverseOrder());
		Arrays.sort(q, Collections.reverseOrder());
		ArrayList<Long> list = new ArrayList<Long>();
		for(int i=0; i<x; i++) list.add(p[i]);
		for(int i=0; i<y; i++) list.add(q[i]);
		for(int i=0; i<c; i++) list.add(r[i]);
		Collections.sort(list, Collections.reverseOrder());
		long sum = 0;
		for(int i=0; i<x+y; i++) {
			sum += list.get(i);
		}
		System.out.println(sum);
		sc.close();
	}
}


Measured memory_bytes: 103148
/* ccw.cpp
    3点の位置関係を求める

    verified:
        AOJ Course CGL_1_C Points/Vectors - Counter-Clockwise
        http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C&lang=jp
*/
#include <bits/stdc++.h>
using namespace std;

using D = double;

// P: 点,座標
using P = std::complex<D>;
namespace std {
bool operator<(const P& a, const P& b) { return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b); }
bool operator>(const P& a, const P& b) { return real(a) != real(b) ? real(a) > real(b) : imag(a) > imag(b); }
}  // namespace std
D dot(const P& a, const P& b) { return real(conj(a) * b); }    // 内積
D cross(const P& a, const P& b) { return imag(conj(a) * b); }  // 外積
D norm(const P& a) { return dot(a, a); }

const D PI = std::acos(-1);
const D EPS = 1e-10;
const D INF = 1e12;

int sgn(D a) { return (a < -EPS) ? -1 : (a > EPS) ? 1 : 0; }  // 比較

/* ccw(a,b,c)
    出力:
    1: a-bから見てcは反時計, -1: a-bから見てcは時計
    2: c-a-bで直線, -2: a-b-cで直線, 0: a-c-bで直線
*/
int ccw(const P& a, const P& b, const P& c) {
    if (sgn(cross(b - a, c - a)) == 1) return 1;         // 1: a-bから見てcは反時計
    if (sgn(cross(b - a, c - a)) == -1) return -1;       //-1: a-bから見てcは時計
    if (sgn(dot(b - a, c - a)) == -1) return 2;          // 2: c-a-bで直線
    if (sgn(norm(c - a) - norm(b - a)) == 1) return -2;  //-2: a-b-cで直線
    return 0;                                            // 0: a-c-bで直線
}

int main() {
    double px, py;
    cin >> px >> py;
    P a(px, py);
    cin >> px >> py;
    P b(px, py);
    int q;
    cin >> q;
    vector<P> cs(q);
    for (int i = 0; i < q; i++) {
        cin >> px >> py;
        P c(px, py);
        cs[i] = c;
    }
    for (int i = 0; i < q; i++) {
        P c = cs[i];
        if (ccw(a, b, c) == 1) {
            cout << "COUNTER_CLOCKWISE" << endl;
        } else if (ccw(a, b, c) == -1) {
            cout << "CLOCKWISE" << endl;
        } else if (ccw(a, b, c) == 2) {
            cout << "ONLINE_BACK" << endl;
        } else if (ccw(a, b, c) == -2) {
            cout << "ONLINE_FRONT" << endl;
        } else if (ccw(a, b, c) == 0) {
            cout << "ON_SEGMENT" << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3240
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    long[] h = new long[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(h);

    long ans = 0;
    for (int i = 0; i < n - k; i++) {
      ans += h[i];
    }

    System.out.println(ans);

  }
}


Measured memory_bytes: 60676
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n, k = LI()
a = LI()
a.sort(key = lambda x:abs(x), reverse = True)
ans = 1
p = 0
m = 0
plus = []
minus = []
use = []
f = 0
for i in range(n):
    if a[i] >= 0:
        p += 1
        if i < k:
            plus.append(a[i])
            use.append(a[i])
            ans *= a[i]
            ans %= mod
    else:
        m += 1
        if i < k:
            minus.append(a[i])
            f ^= 1
            use.append(a[i])
            ans *= -a[i]
            ans %= mod
if f:
    ans = -ans
if ans < 0:
    if k == n:
        print(ans % mod)
    elif p == 0:
        a.sort(key = lambda x:abs(x))
        ans = 1
        for i in range(k):
            ans *= -a[i]
            ans %= mod
        if k % 2:
            ans = -ans
        print(ans % mod)
    else:
        for i in range(k, n):
            if a[i] < 0:
                break
        else:
            ans = -ans
            ans *= pow(-minus[-1], mod-2, mod)
            ans *= max(a[k:])
            print(ans % mod)
            quit()
        if plus:
            ans = -ans
            ans *= pow(plus[-1], mod-2, mod)
            ans %= mod
            ans *= pow(-minus[-1], mod-2, mod)
            ans %= mod
            ans1 = plus[-1] * max(a[k:])
            ans2 = minus[-1] * min(a[k:])
            print(max(ans1, ans2) * ans % mod)
        else:
            ans = -ans
            ans *= pow(-minus[-1], mod-2, mod)
            ans %= mod
            ans *= max(a[k:])
            print(ans % mod)
else:
    print(ans)

Measured memory_bytes: 131456
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
int a,b,c,d[1002],e=0;
  scanf("%d %d",&a,&b);
  for(c=0;c<a;c++){
    scanf("%d",&d[c]);
  }
  sort(d,d+a);
  for(c=0;c<b;c++) e=e+d[c];
  printf("%d",e);
    return 0;
}

Measured memory_bytes: 1700
using System;

namespace A___Traveling_Budget
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = int.Parse(Console.ReadLine());
            var b = int.Parse(Console.ReadLine());
            var c = int.Parse(Console.ReadLine());
            var d = int.Parse(Console.ReadLine());
            Console.WriteLine(Math.Min(a, b) + Math.Min(c, d));
        }
    }
}

Measured memory_bytes: 13140
n, m = map(int, input().split())
list_edge = []
for _ in range(m):
  a, b, c = map(int, input().split())
  list_edge.append((a-1, b-1, -c))

list_point = [float("inf") if i != 0 else 0 for i in range(n)]
for i in range(n+1):
  for a, b, c in list_edge:
    if list_point[a] != float("Inf") and list_point[b] > list_point[a] + c:
      list_point[b] = list_point[a] + c
      if i == n and b == n-1:
        print("inf")
        exit()
print(-1 * list_point[-1])

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int inf=1e9;
const ll Inf=1e18;
const int N=3e3+10;
const int mod=0;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };
template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };
int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }
int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }
void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }
void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }
struct edge { int to,nxt; } e[N<<1];
int tot=1,h[N];
void adde(int u,int v) {
    e[++tot]=(edge){v,h[u]};h[u]=tot;
    e[++tot]=(edge){u,h[v]};h[v]=tot;
}
int n,a[N];
bool dfs(int u,int fa) {
    for(int i=h[u];i;i=e[i].nxt) if(e[i].to!=fa&&a[u]>a[e[i].to]&&!dfs(e[i].to,u)) return 1;
    return 0;
}
int main() {
    cin>>n;
    for(int i=1;i<=n;i++) a[i]=gi();
    for(int i=1,u,v;i<n;i++) u=gi(),v=gi(),adde(u,v);
    for(int i=1;i<=n;i++) if(dfs(i,0)) printf("%d ",i);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
using ll = long long;

int main(void){
    int N, M;
    cin >> N >> M;
    // vector<ll> A(N);
    priority_queue<long long, vector<long long>, greater<long long>> A;
    vector<pair<ll, ll>> vp(M);
    for (int i=0; i<N; i++){
        ll a; cin >> a;
        A.push(a);
    }
    for (int i=0; i<M; i++){
        ll b, c;
        cin >> b >> c;
        vp.emplace_back(c, b);
    }
    sort(vp.rbegin(), vp.rend());
    
    int change_num = 0;
    for (int i=0; i<M;i++){
        ll b = vp[i].second;
        ll c = vp[i].first;
        
        for (int j=0; j<b; j++){
            ll a = A.top();
            if(a < c){
                change_num++;
                A.pop();
                A.push(c);
            }else{
                ll ans = 0;
                while(!A.empty()){
                    ans += A.top();
                    A.pop();
                }
                cout << ans << endl;
                return 0;
            }
            if(change_num >= N){
                ll ans = 0;
                while(!A.empty()){
                    ans += A.top();
                    A.pop();
                }
                cout << ans << endl;
                return 0;
            }
        }
    }
    ll ans = 0;
    while(!A.empty()){
        ans += A.top();
        A.pop();
    }
    cout << ans << endl;
}


Measured memory_bytes: 7168
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while ( sc.hasNext() ) {
			int i = 0;
			double in = sc.nextDouble();
			double t = in / 9.8;
			double y = 4.9 * (t*t);
			for ( i = 0; (5*i-5) < y; i++ );
			System.out.println(i);
		}
	}
}

Measured memory_bytes: 0
//In the name of Allah
//In the name of the compassionate of the merciful
//Ya Ali!
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<typename Type>
using ordered_multiset = tree<Type, null_type, less_equal<Type>, rb_tree_tag, tree_order_statistics_node_update> ;

typedef long long ll ;
typedef long double ld ;

const ll maxn = 1000 * 1000 ;
const ll INF = 3e18 ;

#define f first
#define s second
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define endll "\n"
#define sortt(v) sort(v.begin() , v.end())
#define reversee(v) reverse(v.begin() , v.end())

// for sqrt on interval and array , always sq = maxn/80 ;
// cout << *ss.find_by_order(index) ; -> return the value that indexed in index position
// cout << ss.order_of_key(value) ; -> lower_bound in ordered_set
//ifstream fin("input.txt");
//ofstream fout("output.txt");

ll mod = 1e9 + 7 , p1 = 999999929 , p2 = 999999937 ;

ll n , a , b ;

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

cin >> n >> a >> b ;
if(a%2 == b%2)return cout << abs(a-b)/2 , 0 ;

ll ans1 = 0 , ans2 = 0 ;

ll x1 = a , y1 = b ;
ans1 += x1-1 ;
y1 -= (x1-1) ;
x1 = 1 ;

ans1 ++ ;
y1 -- ;
ans1 += (y1-x1)/2 ;

ll x2 = a , y2 = b ;
ans2 += n-y2 ;
x2 += (n-y2) ;
y2 = n ;

ans2 ++ ;
x2 ++ ;
ans2 += (y2-x2)/2 ;

//cout << ans1 << " " << ans2 << endl ;

cout << min(ans1 , ans2) ;

 return 0;
}
/*
                  _     _   __
            /_\  (_    (_)  __)
           /   \  _) . (_) (__
*/


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	int a[55];
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	int count = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i] != i) {
			count++;
		}
	}
	if (count > 2) {
		cout << "NO" << endl;
	}
	else {
		cout << "YES" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fastio() ios_base::sync_with_stdio(false);
#define rmod(x, y) ((((x)%(y))+(y))%(y))
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
template<typename T, typename R = null_type, typename C = less<T>>
tree<T, R, C, rb_tree_tag, tree_order_statistics_node_update> ordered_set(){
	return tree<T, R, C, rb_tree_tag, tree_order_statistics_node_update>();
}


int main(){
	string s; cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) puts("Yes");
	else puts("No");
	

	return 0;
}


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

#define endl "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first 
#define ss second 
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vii vector<pii>
#define vvi vector<vi>
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

//#define int int64_t
//int a[N+2];

int32_t  main(){
	IOS;
  int n;cin>>n;
  cout<<n*(n+1)/2<<endl;

  return 0;
}



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

Ans = 0

lis = []

for i in range(N + 1):
	X = str(i)
	Y = 0
	for j in range(len(X)):
		Y += int(X[j])
		
	if A <= Y and Y <= B:
		lis.append(int(X))
	
print(sum(lis))
	 

Measured memory_bytes: 3316
#include<stdio.h>
int main()
{
    int i,x;
    for(i=1; i>0; i++)
    {
        scanf("%d",&x);
        if(x==0)
        {
            break;
        }
        printf("Case %d: %d\n",i,x);

    }


    return 0;
}




Measured memory_bytes: 2124
#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
using namespace std;

// _________コーディングはここから！！___________

int n, m, k, i;
constexpr int N = 200010;
int a[N], b[N];
constexpr int sz = 4500000;
char reader[sz];
char *pos = reader;
int nn, now, ans;
int kk;
main() {
    reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
    while('0' <= *pos) n = n * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) m = m * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) k = k * 10 + *pos++ - '0';
    nn = n;
    pos++;
    rep(i, n) {
        while('0' <= *pos) a[i + 1] = a[i + 1] * 10 + *pos++ - '0';
        pos++;
        a[i + 1] += a[i];
        if(a[i + 1] > k) {
            nn = i;
            ++i;
            for(; i < n; ++i) {
                while('0' <= *pos) pos++;
                pos++;
            }
            break;
        }
    }
    while(*pos and *pos <= 32) pos++;
    rep(i, m) {
        while('0' <= *pos) b[i + 1] = b[i + 1] * 10 + *pos++ - '0';
        pos++;
        b[i + 1] += b[i];
        if(b[i + 1] > k) {
            m = i;
            break;
        }
    }
    now = ans = nn;
    for(i = 1; i <= m; i++) {
        kk = k - b[i];
        while(a[now] > kk) now--;
        ans = max(ans, i + now);
    }
    pos = reader;
    i = 0;
    do {
        *pos++ = ans % 10 + '0';
        ans /= 10;
        i++;
    } while(ans);
    reverse(reader, reader + i);
    fwrite(reader, sizeof(char), sizeof(char) * i, stdout);
}


Measured memory_bytes: 7832
#include<bits/stdc++.h>
using namespace std;
long long a[100000],n,dp[100000];
int main()
{
	cin>>n;
	for (long long i=0;i<n;i++)
	  scanf("%I64d",a+i);
	dp[1]=abs(a[1]-a[0]);
	for (long long i=2;i<n;i++)
	  dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	cout<<dp[n-1]<<endl;
	return 0;
}

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

int main() {
  int x, y;
  cin >> x >> y;
  string answer = "No";
  int c = 0, t = 0;//c鶴、t亀
  for (c = 0; c <= x; c++) {
    t = x - c;
    if (2 * c + 4 * t == y) {
      answer = "Yes";
      break;
    }
  }
  cout << answer << endl;
}

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

int main(void){

    int h, n;
    cin >> h >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    
    for(int i=0; i<n; i++) {
        h -= a[i];
    }
    
    if(h > 0) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main (){
  int n,k,y,x;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>x;
    if (x<k-x){
      y+=2*x;}
    else if (x<k) {
    y+=2*(k-x);
    }
    else{
    y+=2*(x-k);
    }
  }
  cout<<y<<endl;
}


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

using namespace std;

int main() {
    long int n;
    cin >> n;
    long int p[n];
    for(int i = 0; i < n; i++) {
        cin >> p[i];
    }
    long int count = 0;
  /*  int flag;
    for(int i = 0; i < n; i++) {
        flag = 1;
        for(int j = 0; j <= i; j++) {
            if(p[i] > p[j])
                flag = 0;
        }
        if(flag == 1)
            count++;
    }
    cout << count;
}
   */
    long int min = p[0];
    for(int i = 0; i < n; i++) {
        if(min >= p[i]) {
            count++;
            min = p[i];
        }
    }
    cout << count;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<cstdlib>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#include<bitset>
#define lmid l,mid,rt<<1
#define rmid mid+1,r,rt<<1|1
#define ll long long
using namespace std;
int main() {
     int a, b, c, d;
     scanf("%d%d%d%d", &a, &b, &c, &d);
     a += b, c += d;
     if (a > c)printf("Left\n");
     if (c > a) printf("Right\n");
     if (c == a) printf("Balanced\n");
     return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    double a, b, c, d, e, f;

    scanf("%lf %lf", &a, &b);
    c= a*3;
    d = (c + b)/2;
    e =(int)d;
    printf("%.0lf\n", e);

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long
using pi=pair<int,int>;
signed main(){
    string s,t="hi";
    cin>>s;
    for(int i=0;i<5;++i){
        if(t==s)return cout<<"Yes",0;
        t += "hi";
    }
    cout << "No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,h,w;
int ans;
int main(){
	cin>>n>>h>>w;
	for(int i=1;i<=n;i++){
		int x,y; cin>>x>>y;
		if(x>=h&&y>=w) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
  string A,B,C;
  cin >> A >> B >> C;
  if (A.at(A.size() - 1) == B.at(0) && B.at(B.size() - 1) == C.at(0)){
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String s = sc.next();
    
    if (s.equals("a") || s.equals("e") || s.equals("i") || s.equals("o") || s.equals("u")) {
      System.out.println("vowel");
    } else {
      System.out.println("consonant");
    }
  }
}

Measured memory_bytes: 22228
#include <iostream>
using namespace std;
constexpr int ans[] = {11, 31, 41, 61, 71, 101, 131, 151, 181, 191, 211, 241, 251, 271, 281, 311, 331, 401, 421, 431, 461, 491, 521, 541, 571, 601, 631, 641, 661, 691, 701, 751, 761, 811, 821, 881, 911, 941, 971, 991, 1021, 1031, 1051, 1061, 1091, 1151, 1171, 1181, 1201, 1231, 1291, 1301, 1321, 1361, 1381};
int main()
{
    int N;cin >> N;
    for (int i = 0; i < N; i++){cout << ans[i] << " ";}
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int a,b;
 cin>>a>>b;
 if(a!=b&&(a==1||a==2||a==3)&&(b==1||b==2||b==3)){
 if((a==1&&b==2)||(a==2&&b==1))
    cout<<3<<endl;
 else if((a==1&&b==3)||(a==3&&b==1))
    cout<<2<<endl;
 else if((a==2&&b==3)||(a==3&&b==2))
    cout<<1<<endl;}
return 0;}


Measured memory_bytes: 3592
import java.util.*;
class Main {
  public static void main(String[] args) {
    
   Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int T = scan.nextInt();
    int arr[] = new int[N];
    int arr2[] = new int[N];
    
    for(int i = 0 ; i< N ;i++){
      arr[i] = scan.nextInt();
      arr2[i] = scan.nextInt();
    }
    
    int min = 999999;
    for(int i = 0 ; i<N ; i++){
      if(arr[i]<min && arr2[i]<=T){
        min = arr[i];
      }
    }
    
    if(min == 999999){
      System.out.println("TLE");
    }else{
      System.out.println(min);
    }
    
  }
}


Measured memory_bytes: 22868
// https://atcoder.jp/contests/abc127/tasks/abc127_d
#include <bits/stdc++.h>
using namespace std;

int main(void){
  int N, M;
  cin >> N >> M;
  vector<pair<long long, long long>> A(N+M);
  for (int i = 0; i < N; i++){
    long long t;
    cin >> t;
    A.push_back(make_pair(t, 1));
  }
  for (int i = 0; i < M; i++){
    long long B, C;
    cin >> B >> C;
    A.push_back(make_pair(C, B));
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());

  long long ans = 0;
  int count = 0;
  while (N>0){
    if (A[count].second <= N)  ans += A[count].first * A[count].second;
    else  ans += A[count].first * N;
    N -= A[count].second;
    count++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 8192
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp14
{
    class Class34
    {
        static void Main()
        {
            long N = long.Parse(Console.ReadLine());
            var mul = new long[2];
            mul[0] = 1;mul[1] = N;
            for(int i = 2; i < (int)Math.Sqrt(N) + 1; i++)
            {
                if (N % i == 0)
                {
                    if ((i + N / i) < mul[0] + mul[1])
                    {
                        mul[0] = i;
                        mul[1] = N / i;
                    }
                }
            }
            Console.WriteLine(mul[0] + mul[1] - 2);
        }
        
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  string S;
  
  cin>>N>>K;
  
  cin>>S;
  
  char c;
  
  c=S.at(K-1);
  S.at(K-1)=c+32;
  
  cout<<S<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++)
  {
    s[i] += n;
    if (s[i] > 'Z')
      s[i] -= 26;
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#n  = int(input())
#a = list(map(int,input().split()))
s = input()
ans = 0
if s == "SUN":
    ans = 7
if s == "MON":
    ans = 6
if s == "TUE":
    ans = 5
if s == "WED":
    ans = 4
if s == "THU":
    ans = 3
if s == "FRI":
    ans = 2
if s == "SAT":
    ans = 1

print(ans)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		boolean flag = true;
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a >= b) {flag = false;}
		int c = sc.nextInt();
		if (b >= c) {flag = false;}
		System.out.println(flag==true?"Yes":"No");
		
	}
}



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

const int N = 100005;

int n;
int a[N];

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int mn = a[0], mx = a[0];
	for (int i = 1; i < n; i++) {
		mn = min(mn, a[i]);
		mx = max(mx, a[i]);
	}
	int cntmn = 0, cntmx = 0;
	for (int i = 0; i < n; i++) {
		cntmn += a[i] == mn;
		cntmx += a[i] == mx;
	}
	if (mx - mn > 1) {
		cout << "No\n";
		return 0;
	}
	if (mn == mx) {
		if (mn == n - 1) {
			cout << "Yes\n";
//			for (int i = 1; i <= n; i++)
//				cout << i << " \n"[i == n];
		} else {
			if (n >= mn * 2) {
				cout << "Yes\n";
//				for (int i = 1; i <= mn; i++)
//					cout << i << " " << i << " \n"[i * 2 == n];
//				for (int i = 2 * mn + 1; i <= n; i++)
//					cout << 1 << " \n"[i == n];
			} else {
				cout << "No\n";
			}
		}
	} else {
		if (mx >= cntmn + 1 && cntmx >= 2 * (mx - cntmn)) {
			cout << "Yes\n";
//			for (int i = 1; i <= cntmn; i++)
//				cout << i << " \n"[i == n];
//			for (int i = 1; i <= mx - cntmn; i++)
//				cout << cntmn + i << " " << cntmn + i << " \n"[2 * i == n];
//			for (int i = cntmn + 2 * (mx - cntmn) + 1; i <= n; i++)
//				cout << cntmn + 1 << " \n"[i == n];
		} else {
			cout << "No\n";
		}
	}
	return 0;
}


Measured memory_bytes: 640
K, S = (int(x) for x in input().split())
if S <= K:
    print((S+1)*(S+2)//2)
elif 2*K <= S:
    print((3*K-S+2)*(3*K-S+1)//2)
else:
    print((3*K-S+2)*(S-K+1)//2+(2*K-S)*(S+1)//2)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define el "\n"
const ll mod=1000000007;
const ll MAX=1e6+5;
#define all(v) v.begin(),v.end()




 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc=1,i,j;
    //cin >> tc;
    while(tc--)
    {
        int a,b;
        cin >> a >> b;
        cout << a*b << el;
    }
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
int main(void){
    int a[10000],min,max,n,i;
    long long sum = 0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        sum += a[i];
    }
    max = min = a[0];
    for(i=1;i<n;i++){
        if(a[i]> max)max=a[i];
        if(a[i]<min)min=a[i];
    }
    printf("%d %d %lld\n",min,max,sum);
    
    return 0;
}



Measured memory_bytes: 2140
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
using namespace std;
const int N=100005;
int n,k,a[N],b[N],c[N];
int main(){
	scanf("%d%d",&n,&k);
	int l1=n/2,l2=n-n/2;
	For(i,0,l2-1) a[i]=k+i,b[i]=k+2*n-1-i*2,c[i]=k+3*n-l1-i-1;
	For(i,0,l1-1) a[i+l2]=k+l2+i,b[i+l2]=k+2*n-2-i*2,c[i+l2]=k+3*n-i-1;
	For(i,0,n-1) if (a[i]+b[i]>c[i]) return puts("-1"),0;
	For(i,0,n-1) printf("%d %d %d\n",a[i],b[i],c[i]);
}
/*
K+L,K+4N-2L  K+4N-L K+6N-L
K+N+L,K+4N-2L-1 K+5N-L

*/

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

using namespace std;

#define FastIO ios_base :: sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define read(in) freopen("Input.txt","r",stdin)
#define write(out) freopen("Ouput.txt","w",stdout)
#define pf printf
#define sf scanf
#define fr(i,n) for(i=1 ; i<=n ; i++)
#define fr1(i,x,n) for(i=x ; i<=n ; i++)
#define sf1(val) scanf("%lld",&val)
#define sf2(val1,val2) scanf("%lld %lld",&val1,&val2)
#define INF 999999999999999999
#define Pi 2*acos(0.0)
#define len 200000

typedef long long int lli;

lli a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,sum=0,total=0,res=0,ans=0;

int main()
{
    //FastIO;

    //read(in);
  
  	char ch;	sf("%c",&ch);
  
  	if(ch>='A' && ch<='Z') pf("A\n");
  	else pf("a\n");
}


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


int main() {
	//code

	    int n;
	    cin>>n;
	    int a[n];
	    for(int i=0;i<n;i++)
	    {
	        cin>>a[i];
	    }
	    int dp[n+1];
	    dp[0]=0;
	    dp[2]= abs(a[1]-a[0]);
	    dp[1]=0;
	    for(int i=3;i<n+1;i++)
	    {
	        dp[i]=min(dp[i-1]+abs(a[i-1]-a[i-2]),dp[i-2]+abs(a[i-1]-a[i-3]));
	    }
        cout<<dp[n];
	return 0;
}

Measured memory_bytes: 1024
import Control.Applicative( (<$>))
main = do
    [n_, m_] <- map read . words <$> getLine
    let
	(qc,rc) = m_ `quotRem` 4::(Integer,Integer)
	(n', additionalScc1, rc') = case  rc of
			0		-> (n_	,0, 0)
			1		-> (n_	,0, 1)
			2		-> (n_-1,1, 0)
			3		-> (n_-1,1, 1)
	sum1 = qc+additionalScc1
	decompo = min (n'`quot`2) sum1
	additionalScc2 = 2*decompo
	sum2 = sum1-decompo+additionalScc2
    print sum2

Measured memory_bytes: 508
class UnionFind:
    def __init__(self,n):
        super().__init__()
        self.par = [-1]*n
        self.rank = [0]*n
        self.tsize = [1]*n
    
    def root(self,x):
        if self.par[x] == -1:
            return x 
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x_r = self.root(x)
        y_r = self.root(y)
        
        if self.rank[x_r]>self.rank[y_r]:
            self.par[y_r] = x_r

        elif self.rank[x_r]<self.rank[y_r]:
            self.par[x_r] = y_r

        elif x_r != y_r:
            self.par[y_r] = x_r
            self.rank[x_r] += 1

        if x_r != y_r:
            size = self.tsize[x_r]+self.tsize[y_r]
            self.tsize[x_r] = size
            self.tsize[y_r] = size

    def isSame(self,x,y):
        return self.root(x) == self.root(y)

    def size(self,x):
        return self.tsize[self.root(x)]

def main():

    n= int(input())
    edge = []
    for i in range(n):
      x,y = list(map(int,input().split()))
      edge.append((x,y,i))
    
    xs = sorted(edge,key=lambda a:a[0])
    ys = sorted(edge,key=lambda a:a[1])

    edge = []
    
    for i in range(n-1):
      x1,y1,p1 = xs[i]
      x2,y2,p2 = xs[i+1]
      edge.append((p1,p2,min(x2-x1,abs(y2-y1))))
      
      x1,y1,p1 = ys[i]
      x2,y2,p2 = ys[i+1]
      edge.append((p1,p2,min(abs(x2-x1),y2-y1)))
    edge.sort(key = lambda a:a[2])  
    uf = UnionFind(n)
    
    ans = 0
    for x,y,w in edge:
      if uf.isSame(x,y):continue
      uf.unite(x,y)
      ans+=w
    print(ans)
      
if __name__ == "__main__":
    main()


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

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

  int A[N], B[N];
  for(int i = 0; i < N; i++){
    cin >> A[i];
    B[A[i]] = i+1;
  }
    
  for(int i = 1; i <= N; i++){
    cout << B[i] << " ";
  }
 
  return 0;
}

Measured memory_bytes: 1536