akhauriyash/Code-Regression huggingface dataset:
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
#include <array>
// ===============================================================
//using系
#pragma region header
using namespace std;
using lint = long long;
using ld = long double;
using ulint = unsigned long long;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr lint mod = 1000000007;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#define INF (lint)10000000000000000;
#define mod (int)1000000007
#pragma region header
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
#pragma endregion
#pragma endregion



int main(void) {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	vector<int> d(n, 0);
	for (int i = 0; i < n; i++) cin >> d[i];
	vector<int> data(1000010);
	for (int i = 0; i < n; i++) {
		if (data[d[i]] <= 1) {
			for (lint j = 1; d[i] * j < 1000010; j++) {
				data[d[i] * j]++;
			}
		}
	}
	lint ans = 0;
	for (int i = 0; i < n; i++) {
		if (data[d[i]] <= 1) ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 7956
def main():
    p = [0] + list(map(int, input().split()))
    cnt = 0
    for _ in range(m):
        x, y = map(int, input().split())
        unite(x, y)
    for i in range(1, n+1):
        if same(i, p[i]):
            cnt += 1
    print(cnt)

def root(x):
    if par[x] == x:
        return x
    par[x] = root(par[x])
    return par[x]

def unite(x, y):
    root_x = root(x)
    if root_x != root(y):
        par[root_x] = y

def same(x, y):
    return root(x) == root(y)

if __name__ == "__main__":
    n, m = map(int, input().split())
    par = list(range(n+1))
    main()

Measured memory_bytes: 130228
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i = 2; i < 10000; i++){
			if(gcm(26,i)==1){
				list.add(i);
			}
		}
		String NN =br.readLine(); 
		int N = Integer.parseInt(NN);
		while(N--!=0){
			String str = br.readLine();
			label:for(int i = 0; i < list.size(); i++){
				for(int j = 0; j < 26; j++){
					String nstr = "";
					for(int k = 0; k < str.length(); k++){
						if(Character.isLetter(str.charAt(k))){
							nstr += (char)(((list.get(i)*(str.charAt(k)-'a') + j)%26) + 'a');
						}
						else{
							nstr += " " ;
						}
					}
					if(nstr.contains("that") || nstr.contains("this")){
						System.out.println(nstr);
						break label;
					}
				}
			}
		}
	}
	static int gcm(int p, int q){
		if(p < q){
			int tmp=p;
			p=q;
			q=tmp;
		}
		if(q==0){
			return p;
		}
		else{
			return gcm(q, p%q);
		}
	}
}

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

#define ll long long
#define print(x) cout << "[" << #x << ":" << x << "] "; 
#define println(x) cout << "[" << #x << ":" << x << "]\n";

ll n, k;

int main(){
    cin >> n >> k;
    ll a[n];
    for(int i=0; i<n; i++)
	cin >> a[i];
    for(int i=k; i<n; i++){
	if(a[i] > a[i-k])
	    cout << "Yes\n";
	else
	    cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 5188
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<ll,ll> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll devc(ll x, ll y){return 1 + (x-1)/y;}

ll solve(ll H,ll W){
    ll ans = 1e12;

    ll j = H/2;
    rep1(i,W-1){
        ll mx = max({H*i,j*(W-i),(H-j)*(W-i)});
        ll mn = min({H*i,j*(W-i),(H-j)*(W-i)});
        ans = min({ans,mx-mn});
    }
    
    rep1(i,W-2){
        ll k = (W-i)/2;
        ll mx = max({H*i,H*k,H*(W-i-k)});
        ll mn = min({H*i,H*k,H*(W-i-k)});
        ans = min({ans,mx-mn});
    }
    return ans;
}


int main(){
    ll H,W; cin >> H >> W;
    pr(min({solve(H,W),solve(W,H)}));
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int n,h,w;
  std::cin>>n>>h>>w;
  vector <int> a;
  vector <int> b;
  int i,count=0;
  int input;
  for(i=0;i<n;i++)
  {
    std::cin>>input;
    a.push_back(input);
    std::cin>>input;
    b.push_back(input);
    if(a[i]>=h&&b[i]>=w)
      count+=1;
  }
  std::cout<<count;
  return 0;
}

Measured memory_bytes: 256
//Δ_C
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 111111;
int n,s,a[N];
vector<int> v1,v2;
void go(int&x,int&y){
	v1.push_back(x);
	v2.push_back(y);
	x-=y;
}
int main()
{
	int i,o;
	scanf("%d",&n);
	for(i=1;i<=n;i=i+1)
		scanf("%d",a+i);
	sort(a+1,a+n+1);
	if(a[1]>=0){
		for(i=2;i<n;i=i+1)
			go(a[1],a[i]);
		go(a[n],a[1]);
		printf("%d\n",a[n]);
		for(i=0;i<n-1;i=i+1)
			printf("%d %d\n",v1[i],v2[i]);
		return 0;
	}
	if(a[n]<=0){
		for(i=1;i<n;i=i+1)
			go(a[n],a[i]);
		printf("%d\n",a[n]);
		for(i=0;i<n-1;i=i+1)
			printf("%d %d\n",v1[i],v2[i]);
		return 0;
	}
	for(i=2;i<n;i=i+1){
		if(a[i]>=0)
			go(a[1],a[i]);
		else
			go(a[n],a[i]);
	}
	go(a[n],a[1]);
	printf("%d\n",a[n]);
	for(i=0;i<n-1;i=i+1)
		printf("%d %d\n",v1[i],v2[i]);
	return 0;
}

Measured memory_bytes: 3316
# include <iostream>
# include <string>
# include <algorithm>
# include <vector>
# include <cstring>
# include <stdio.h>
# include <map>
# include <queue>

# define ll long long
# define pii pair<int,int>
# define FOR(a,b) for(int a=1; a<=b; a++)
# define REP(a,b) for(int a=0; a<b; a++)
# define FORU(a,b,c) for(int a=b; a<=c; a++)
# define FORD(a,b,c) for(int a=b; a>=c; a--)

using namespace std;

int N;
ll a[300005];
priority_queue<ll, vector<ll>, greater<ll> > q;
priority_queue<ll> q2;
ll mx[300005], mn[300005];

int main(){

    ios :: sync_with_stdio(false);
    cin >> N;
    FOR(i,3*N) cin >> a[i];

    ll cur = 0;
    FOR(i,3*N){
        q.push(a[i]);
        cur += a[i];

        if(i > N){
            cur -= q.top();
            q.pop();
        }

        if(i >= N){
            mx[i] = cur;
        }
    }

    cur = 0;
    FORD(i,3*N,1){
        q2.push(a[i]);
        cur += a[i];
        if(i <= 2*N){
            cur -= q2.top();
            q2.pop();
        }

        if(i <= 2*N+1){
            mn[i] = cur;
        }
    }

    ll ans = -(1ll << 62);
    FORU(k, N, 2*N){
        ans = max(ans, mx[k] - mn[k+1]);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8564
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 int n;
 string s;
 cin >> n >> s;
 if(s.length()>n)
 {
  s=s.substr(0,n);
  s.append("...");
 }
 cout << s;
 return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int m = 1e9+7;

int main() {
	int n; cin>>n;
	vector<map<string,int>> dp(101);
	vector<string> disallowed = {"AGC","GAC","ACG","AGGC","AGTC","ATGC"};
	string s = "ACGT";

	dp[0]["XXXX"] = 1;
	for (int i=0; i<100; i++) {
		for (pair<string,int> p: dp[i]) {
			for (char c : s) {
				string last4 = p.first.substr(1,3) + c;
				string last3 = last4.substr(1,3);
				bool skip = false;
				for (string x : disallowed) {
					if (x==last4 or x==last3) {
						skip = true;
						break;
					}
				}
				if (skip) continue;
				dp[i+1][last4] = (dp[i+1][last4]%m + p.second%m)%m;
			}
		}
	}

	int ans=0;
	for (pair<string, int> p : dp[n])
		ans = (ans%m + p.second%m)%m;
	cout << ans << endl;
	
	return 0;
}


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

int main()
{
	int a, b;
	cin >> a >> b;
	if ((a+b)%2==0)
	{
		cout << (a + b) / 2 << endl;
	}
	else
	{
		cout << "IMPOSSIBLE" << endl;
	}
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#include <iomanip>
#include <functional>
#define FOR(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
using namespace std;

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

	vector<int> Apple;
	int N, L, min_A = 100000, sum = 0;

	cin >> N >> L;

	REP(i, N)
	{
		Apple.push_back(L + i);
		sum += L + i;
		if (abs(L + i) < abs(min_A))
		{
			min_A = L + i;
		}
	}

	cout << sum - min_A << endl;

	return 0;
}

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

int main()
{
    int numa, numb, numc;
    cin >> numa >> numb >> numc;
    if(((numa>numc)&&(numc>numb))||((numa<numc)&&(numc<numb))){
        cout << "Yes" <<endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

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

	int ret;
	if (b == 1) {
		ret = 0;
	}
	else {
		ret = 1;
		b = b - a;
		while (0 < b) {
			++ret;
			b = b - a + 1;
		}
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    char suit[4]={'S','H','C','D'};
    int card[4][13];
    int num;
    char card_suit;
    int card_num;
    cin >> num;
    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            card[i][j]=0;
        }
    }

    for(int i=0;i<num;i++){
        cin>>card_suit>>card_num;
        for(int j=0;j<4;j++){
            if(card_suit==suit[j]){
                card[j][card_num-1]=1;
                break;
            }
        }   
    }

    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            if(card[i][j]==0){
                cout<<suit[i]<<" "<<j+1<<endl;
            }
        }
    }


    return 0;

}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a;
    for(int i=0;i<n;i++){
        int tmp;
        cin>>tmp;
        a.push_back(tmp);
    }

    int ans=0,k=1;
    int j=0;
    bool flag=true;
    for(int i=0;i<n;i++){
        if(a[i]==k){
            if(flag){
                flag = false;
            }
            ans += i-j;
            j=i+1;
            k++;
        }
    }
    if(flag){
        ans = -1;
    }else{
        ans += a.size()-j;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1400
N = int(input())
H = list(map(int,input().split()))

dp = [0,abs(H[1]-H[0])]

for i in range(2,N):
  h = H[i]
  dp.append(min(dp[-2]+abs(H[i-2]-h), dp[-1]+abs(H[i-1]-h)))

print(dp[-1])

Measured memory_bytes: 55144
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) ((x).begin()),((x).end())
#define int ll
using pii = pair <int, int>;

string s, t;
int32_t main()
{
	usecppio
	int a, b;
	cin >> a >> b;
	cout << a*b/(__gcd(a, b));
}

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

const int N = 4005;
const int mod = 998244353;

void add(int &x,int y) {
	x += y; if (x >= mod) x -= mod;
}

int mul(int x,int y) {
	return (long long) x * y % mod;
}

int pw(int x,int y) {
	int ret = 1;
	while (y) {
		if (y & 1) ret = mul(ret, x);
		x = mul(x, x);
		y >>= 1;
	}
	return ret;
}

int n, k;
int fac[N], ifac[N];

int C(int n,int k) {
	if (n < k || k < 0) return 0;
	return mul(fac[n], mul(ifac[k], ifac[n - k]));
}

int candy(int n,int k) {
	return C(n + k - 1, k - 1);
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> k >> n;
	fac[0] = 1;
	for (int i = 1; i <= n + k; ++i) fac[i] = mul(fac[i - 1], i);
	ifac[n + k] = pw(fac[n + k], mod - 2);
	for (int i = n + k - 1; i >= 0; --i) ifac[i] = mul(ifac[i + 1], i + 1);
	for (int i = 2; i <= k + k; ++i) {
		int f = 0, g = 0;
		for (int j = 1; j <= k; ++j) {
			int l = i - j;
			if (l < 1 || l > k) f++;
			else if (j < l) f++, g++;
		}
		int ans = 0;
		for (int j = 0; j <= g; ++j) {
			int coef = candy(n - j, f - g + j);
			if (i % 2 == 0) add(coef, candy(n - j - 1, f - g + j));
			coef = mul(coef, mul(pw(2, j), C(g, j)));
			add(ans, coef);
		}
		cout << ans << '\n';
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
#define INF __INT32_MAX__
#define LINF __LONG_LONG_MAX__

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

    ll fmin = LINF;
    for (int i = 1; i <= sqrt(N); i++) {
        if (N % i == 0) {
            ll x = i;
            ll y = N / i;
            ll dx = 0;
            while (x > 0) {
                dx++;
                x /= 10;
            }
            ll dy = 0;
            while (y > 0) {
                dy++;
                y /= 10;
            }

            fmin = min(fmin, max(dx, dy));
        }
    }
    cout << fmin << endl;
}

Measured memory_bytes: 3680
// Created by Nandu Vinodan
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN
#define TC 0
using namespace std;
using ll = long long;

void testcase() {
    int x; cin >> x;
    if (x <= 599) cout << "8";
    else if (x <= 799) cout << "7";
    else if (x <= 999) cout << "6";
    else if  (x <= 1199) cout << "5";
    else if  (x <= 1399) cout << "4";
    else if  (x <= 1599) cout << "3";
    else if  (x <= 1799) cout << "2";
    else if  (x <= 1999) cout << "1";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    if (TC)
        cin>>t;
    while(t--) {
        testcase();
    }
    return 0;
}

Measured memory_bytes: 3652
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

N = int(input())
while True:
    n_str = sorted(str(N))
    if n_str[0] == n_str[-1]:
        break
    N += 1
print(N)


Measured memory_bytes: 7880
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N >> K;
	int ans;
	if (N >= 10) {
		ans = K;
	} else {
		ans = K + 100 * (10 - N);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 9223372036854775807
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=1e7+2 ;
int main()
{
    fast ;
    ll n ; cin>>n ;

    ll ans=0 ;

    ll s[N] ;
    for(ll i=0;i<N;i++) s[i]=i ;

    for(ll i=2;i*i<N;i++)
    {
        for(ll j=i*i;j<N;j+=i)
        {
            if(s[j]==j) s[j]=i ;
        }
    }

    for(ll i=1;i<=n;i++)
    {
        ll x=i ;

        ll cur=1 ;

        while(x!=1)
        {
            ll c=0 ;
            ll u=s[x] ;
            while(x%u==0)
            {
                x/=u ;
                c++ ;
            }
            //cout<<i<<" "<<u<<" "<<c<<endl ;
            cur*=(c+1) ;
        }

        ans+=i*cur ;
    }

    cout<<ans ;



}




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

#define rep(i,n)  for(int i=0;i<n;++i)
#define per(i,n)  for(int i=n-1;i>=0;--i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)
#define sc3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define sl1(a)  scanf("%lld",&a)
#define sl2(a,b)  scanf("%lld %lld",&a,&b)
#define sl3(a,b,c)  scanf("%lld %lld %lld",&a,&b,&c)
#define PI 3.1415926535897932

int main(){
    int n,x=0,y=0;
    sc1(n);
    rep(i,n) {
        char a[101],b[101];
        scanf("%s %s",a,b);
        if (strcmp(a,b)>0)  x+=3;
        else if (strcmp(a,b)<0) y+=3;
        else { x++; y++; }
    }
    printf("%d %d\n",x,y);
    return 0;
}



Measured memory_bytes: 3228
#include<cstdio>
#include<algorithm>

typedef long long int lli;

int main(void) {
    lli n;
    scanf("%lld",&n);
    lli tnow=0,anow=0;
    for(lli i=0; i<n; i++) {
        lli t,a;
        scanf("%lld%lld",&t,&a);
        if(tnow==0) tnow = t, anow = a;
        lli k=std::max((tnow+t-1)/t, (anow+a-1)/a);
        tnow = t*k, anow = a*k;
    }
    printf("%lld\n",tnow+anow);
    return 0;
}

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

int main(void) {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if(e - a <= k) {
  	cout << "Yay!" << endl;
  }
  else {
  	cout << ":(" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
n, m = map(int,input().split())

h = list(map(int,input().split()))

cnt = [0] * n

for i in range(m):
    a,b = map(int,input().split())
    cnt[a-1] = max(cnt[a-1], h[b-1])
    cnt[b-1] = max(cnt[b-1], h[a-1])


    
res = sum([h[i] > cnt[i] for i in range(n)])


print(res)
            

Measured memory_bytes: 20144
N,M,X,Y = map(int,input().split())
x = list(input().split())
y = list(input().split())
x = [int(i) for i in x]
y = [int(i) for i in y]
res = 0
for Z in range(X+1,Y+1):
    res1 = 0
    res2 = 0
    for k in x:
        if k >= Z:
            res1 += 1
            break
    for l in y:
        if l < Z:
            res2 +=1
            break
    if res1 ==0 and res2 ==0:
        res =1
if res==0:
    print("War")
else:
    print("No War")

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

int main() {
	int S,h,m,s;
	cin >> S;

	h = S / (60*60);
	m = (S / 60)%60;
	s = S %60;

	printf("%d:%d:%d\n",h,m,s);
	return 0;
}



Measured memory_bytes: 3176
fun main(args: Array<String>) {
    fun solve(cnt: Int, a: Int, b: Int): Int {
        return if (b <= 1) cnt else solve(cnt + 1, a, b - a + 1)
    }
    val (a, b) =
        readLine()!!
            .split(" ")
            .map { it.toInt() }
    print(solve(0, a, b))
}

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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;

ll xor_sum(ll n) {
    if(n % 2 == 1) return (n + 1) / 2 % 2 == 1 ? 1LL : 0LL;
    else return n ^ (n / 2 % 2 == 1 ? 1LL : 0LL);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b;
    cin >> a >> b;
    if(a == 0) cout << xor_sum(b) << ln;
    else cout << (xor_sum(a - 1) ^ xor_sum(b)) << ln;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main()
{
    int a,d[9],i,sum=0,hoge;
    scanf("%d",&a);
    hoge = a;
    for(i=0;i <= 8;i++){
        d[i]= a/pow(10,9 - i);
        a = a % (int)pow(10,9 - i);
        sum = sum + d[i];
    }
    sum = sum + a;
    if(hoge%sum == 0){
        printf("Yes");
    }else{
        printf("No");
    }
    
    return 0;
}


Measured memory_bytes: 128
N = int(input())
count = 0
xulist = []
for i in range(N):
    x, u = map(str,input().split())
    x = float(x)
    xulist.append([x,u])

for i in range(N):
    if xulist[i][1] == 'BTC':
        count += xulist[i][0] * 380000.0
    elif xulist[i][1] == 'JPY':
        count += xulist[i][0]

print(count)

Measured memory_bytes: 3064
type sTot = record flag:boolean;
                     third:array[0..9] of boolean;
                     end;
     fTos = record flag:boolean;
                   second:array[0..9] of sTot;
                    end;
var n,i,j,k,l,t,sum:int64;
    s:string;
    first:array[0..9] of fTos;
begin
readln(n);
read(s);
sum:=0;
for i := 0 to 9 do first[i].flag:=false;
for i := 1 to n do
 begin
  t:=ord(s[i])-48;
  for j :=0 to 9 do 
   if first[j].flag then
    begin
     for k :=0 to 9 do 
      if first[j].second[k].flag then 
       begin
        for l := 0 to 9 do
         if not(first[j].second[k].third[t]) then
          begin
           first[j].second[k].third[t]:=true;
           inc(sum)
          end;      
       end;
     if not(first[j].second[t].flag) then 
      begin
       first[j].second[t].flag:=true;
       for k := 0 to 9 do first[j].second[t].third[k]:=false
      end;
    end;
  if not(first[t].flag) then 
   begin
    first[t].flag:=true;
    for j := 0 to 9 do first[t].second[j].flag:=false
   end;
 end;
 
 write(sum);
end.

Measured memory_bytes: 128
import java.lang.Math

fun main(args: Array<String>) {
    val k = readInputLine().toInt()

    var cnt = 0
    val arr = LongArray(k)

    fun dfs(lastDig: Long, current: Long, base: Long, remDigits: Int) {
        if (cnt >= k) {
            return
        }
        if (remDigits == 0) {
            arr[cnt] = current
            cnt++
            return
        }
        for (i in LongRange(Math.max(lastDig - 1L, 0L), Math.min(lastDig + 1L, 9L))) {
            dfs(i, current * 10L + i, base * 10L, remDigits - 1)
        }
    }

    for (dig in 0..20) {
        for (i in LongRange(1L, 9L)) {
            dfs(i, i, 10L, dig)
        }
        if (cnt >= k) {
            println(arr[k - 1])
            return
        }
    }
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 33872
#include<bits/stdc++.h>
#define l(i,n) for (int i= 1;i <=n;i++)
using namespace std;

int main(){
	int n,k,x,y;
	cin>>n>>k>>x>>y;
	int count=0;
	
	l(i,n){
		if(i<=k)count+=x;
		else count+=y;
	}
	cout<<count<<endl;
}



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

int main() {
	long long N, arr[100200], dptable[100200], K;
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> arr[i];
		dptable[i] = LONG_LONG_MAX;
	}

	dptable[0] = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 1; j <= K; j++){
			dptable[i + j] = min(dptable[i + j], dptable[i] + abs(arr[i] - arr[i + j]));
		}
		// cout << dptable[i] << " ";
	}
	// cout << endl;

	cout << dptable[N - 1] << endl;
}

Measured memory_bytes: 1792
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n, li = ri(), rl()
min_ = inf
for i in range(1, n):
  min_ = min(abs(sum(li[0:i]) - sum(li[i:])), min_)
print(min_)






Measured memory_bytes: 27160
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
using namespace std;
int main() {
	int n = 0;
	string s;
	cin >> s;
	for (int i = 0; i < 4; i++) {
		if (s[i] == '+')n++;
		else n--;
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n;
	cin >> n;
	int h[n];
	for(int i = 0; i < n; i++) {
		cin >> h[i];
	}
	int dp[n];
	memset(dp, 63, sizeof(dp));
	dp[0] = 0;
	for(int i = 0; i < n; i++) {
		if(i + 1 < n) {
			dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
		}
		if(i + 2 < n) {
			dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
		}
	}
	cout << dp[n - 1];

	return 0;
}

Measured memory_bytes: 5216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll ksm(ll x,ll y){
    ll res=1;
    while(y){
        if(y&1) res=res*x%mod;
        x=x*x%mod;
        y>>=1;
    }
    return res%mod;
}
int main(){
    ll x,y;
    cin>>x>>y;
    ll mi=min(x,y);
    ll mx=max(x,y);
    ll a2=mi/(ll)2,a1;
    bool flag=0;
    for(ll i=a2;i>=0;i--){
        a1=mi-2*i;
        if(2*a1+i==mx) {
            flag=1;
            a2=i;
            break;
        }
    }
    if(!flag) cout<<0<<endl;
    else {
        ll sum1=1;
        for(ll i=1;i<=a1;i++)  sum1=sum1*i%mod;
        ll sum2=1;
        for(ll i=a1+a2;i>=a2+1;i--)    sum2=sum2*i%mod;
        cout<<(sum2%mod*ksm(sum1,mod-2)%mod)%mod<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pr pair<int,int>
#define mp make_pair
#define fi first
#define se second
using namespace std;
const int N=1e6+6;
bool vis[N],ans[N];
vector< pr > G[N];
int b[N];
pr a[N];
int dfs(int u){
    vis[u]=true; int c=b[u];
    for (int i=0;i<G[u].size();++i){
        int v=G[u][i].fi;
        if (!vis[v]&&dfs(v)) ans[G[u][i].se]=true,c^=1;
    }
    return c;
}
int main(){
    int n,m; cin>>n>>m;
    for (int i=1;i<=n;++i) scanf("%d%d",&a[i].fi,&a[i].se);
    sort(a+1,a+1+n);
    for (int i=1;i<=n+1;++i) b[i]=a[i].se^a[i-1].se;
    for (int i=1;i<=m;++i){
        int l,r; scanf("%d%d",&l,&r);
        l=lower_bound(a+1,a+1+n,mp(l,0))-a;
        r=upper_bound(a+1,a+1+n,mp(r,1))-a-1;
        if (l<=r) G[l].push_back(mp(r+1,i)),G[r+1].push_back(mp(l,i));
    }
    for (int i=1,t=0;i<=n+1;++i)
        if (!vis[i]&&dfs(i)){ cout<<-1<<endl; return 0; }
    int c=0;
    for (int i=1;i<=m;++i) if (ans[i]) ++c;
    cout<<c<<endl;
    for (int i=1;i<=m;++i) if (ans[i]) printf("%d ",i);
}


Measured memory_bytes: 41728
#include<iostream>

using namespace std;

int main()
{
	unsigned int S = 0;
	int h = 0, m = 0, s = 0;
	
	cin >> S;
	
	m = S / 60;
	s = S % 60;
	h = m / 60;
	m = m % 60;
	
	cout << h << ":" << m << ":" << s << endl;	
	
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#define N 100000
#define NIL -1

struct Node{
  int parent;
  int left;
  int right;
};
struct Node T[25];
int C[25];
int H[25];

void getDepth(int, int);
int getHeight(int);

int main()
{
  int n, i, j, k, x, y, id, left, right, root;


  scanf("%d",&n);
  for( i=0 ; i<n ; i++ ){
    T[i].parent = NIL;
  }
  for( i=0 ; i<n ; i++ ){
    scanf("%d %d %d",&id,&left,&right);
    T[id].left = left;
    T[id].right = right;   
    if(left!=NIL)
      T[left].parent = id;
    if(right!=NIL)
      T[right].parent = id;
  }

  for( i=0 ; i<n ; i++ )
    if(T[i].parent==NIL) root = i;

  getDepth(root,0);
  getHeight(root);

  for( i=0 ; i<n ; i++ ){
    printf("node %d: parent = %d, sibling = ",i,T[i].parent);
    
    j=i;
    while(1){
      if(T[i].parent==NIL) {
	printf("%d",T[i].parent);
	break;
      }
      if(T[T[i].parent].left==j) {
	printf("%d",T[T[i].parent].right);
	break;
      }
      if(T[T[i].parent].right==j){
	printf("%d",T[T[i].parent].left);
	break;
      }
      j++;
    }
        
    printf(", degree = ");
    if(T[i].left==NIL && T[i].right==NIL) printf("0");
    else if(T[i].left==NIL && T[i].right!=NIL)printf("1");
    else if(T[i].left!=NIL && T[i].right==NIL)printf("1");
    else printf("2");

    printf(", depth = %d,",C[i]);

    printf(" height = %d,",H[i]);
    
    if(T[i].parent==NIL)
      printf(" root\n");
    else if(T[i].left==NIL && T[i].right==NIL)
      printf(" leaf\n");
    else
      printf(" internal node\n");
  }

  return 0;
}
void getDepth(int r, int d)
{
  if(r==NIL) return;
  C[r] = d;


  getDepth(T[r].right,d+1);

  getDepth(T[r].left,d+1);
}

int getHeight(int r)
{
  int x=0, y=0;

  if(T[r].right!=NIL)
    x = getHeight(T[r].right)+1;
  if(T[r].left!=NIL)
    y = getHeight(T[r].left)+1;
  if(x>y) H[r] = x;
  else H[r] = y;
  return H[r];
}

Measured memory_bytes: 616
// Create: 2018-03-24 08:32:53
#include <bits/stdc++.h>

using namespace std;

int main()
{
	int x, y;
	cin >> x >> y;
	if(x % y == 0) cout << -1 << endl;
	else
	{
		cout << x << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef vector<int> vi;
typedef pair<int, int> pi;
#define SQ(a) (a) * (a)
#define deb(x) cout << #x << " = " << x << '\n'
#define deb2(x, y) cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
 

 
int main(int argc, char const *argv[])
{
 
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
    	cin>>a[i];

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

    }
    cout<<dp[n];
    return 0;
}

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

namespace ABC117 {
	class ABC117_A {
		static void Main(string[] args) {
			var input = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
			var T = input[0];
			var X = input[1];
			Console.WriteLine(T/X);
		}
	}
}


Measured memory_bytes: 13396
s = input()
l = ''
n = int(input())
alp = [chr(ord('a')+i) for i in range(26)]
for i in range(len(s)):
  if i != len(s)-1:
    if s[i] != 'a':
      if 97+26-ord(s[i]) <= n:
        n -= (123-ord(s[i]))
        l += 'a'
      else:
        l += s[i]
    else:
      l += 'a'
  else:
    t = ord(s[i])
    if t+n <= 122:
      l += chr(t+n)
    else:
      n = n%26
      if t+n <= 122:
        l += chr(t+n)
      else:
        l += chr(t+n-26)
print(l)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < s.size()/2; i++)
    {
        if(s[i]!=s[s.size()-1-i]){
            cnt++;
        }
    }
    
    cout << cnt << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
Ans,G,C=[],[],[]
for i in range(n):
  a,b=map(int,input().split())
  G.append([a,b])
for i in range(m):
  c,d=map(int,input().split())
  C.append([c,d])
for i in range(n):
  dis=float("inf")
  ct=0
  for j in range(m):
    a,b=G[i][0],G[i][1]
    c,d=C[j][0],C[j][1]
    dis_c=abs(a-c)+abs(b-d)
    if dis_c<dis:
      ct=j
      dis=dis_c
  Ans.append(ct+1)
print(*Ans,sep="\n")

Measured memory_bytes: 3064
def depth_search(i, adj, d, f, t):
    if d[i-1]:
        return t
    d[i-1] = t
    t += 1                                          
    for v in adj[i-1]:
        t = depth_search(v, adj, d, f, t)
    f[i-1] = t                                      
    t += 1
    return t

n = int(input())
adj = [list(map(int, input().split()))[2:] for _ in range(n)] 

d = [0] * n
f = [0] * n

t = 1
for i in range(n):
    if d[i] == 0:
        t = depth_search(i+1, adj, d, f, t)

for i, df in enumerate(zip(d, f)):
    print(i + 1, *df)


Measured memory_bytes: 5716
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        return;
    }

    public static string Solve()
    {
        int[] input = ReadInts();
        int N = input[0], K = input[1];
        double sum = 0;
        for (int i = 1; i <= N; i++)
        {
            double p = 1f / N;
            if (i>=K)
            {
                sum += p;
            }
            else
            {
                p *= Math.Pow(1f/2f,Math.Ceiling(Math.Log((double)K / i,2)));
                sum += p;
            }
        }
        return sum.ToString();
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


Measured memory_bytes: 11220
// https://atcoder.jp/contests/abc068/tasks/abc068_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, t = 1;
    cin >> n;
    while (t <= 100) {
        if (t >= n)
            break;
        t *= 2;
    }
    if (t == n) {
        cout << n << endl;
    } else {
        cout << t / 2 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
using namespace std;

int main() {
	int a, b, ans;
	ans = 0;
	cin >> a >> b;
	REP(i, 2) {
		if (a >= b) {
			ans += a;
			a--;
		}
		else {
			ans += b;
			b--;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {
    /**
     * Iterate through each line of input.
     */
    long allSum = 0;
    char[] array;

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

    void run(){
        Scanner sc = new Scanner(System.in);
        array = sc.next().toCharArray();
        solve();
    }

    void solve(){
        dfs(0, 0, 0);
        System.out.println(allSum);
    }

    void dfs(int pointer, long sum, long rem) {
        if (pointer == array.length - 1) {
            allSum += sum + Character.getNumericValue(array[pointer]) + rem * 10;
            return;
        }
        int num = Character.getNumericValue(array[pointer]);
        dfs(pointer + 1, sum + rem * 10 + num, 0);
        dfs(pointer + 1, sum, rem * 10 + num);
    }
}

class Dfs {
    long allSum = 0;
    char[] array;

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

    void run(){
        Scanner sc = new Scanner(System.in);
        array = sc.next().toCharArray();
        solve();
    }

    void solve(){
        dfs(0, 0, 0);
        System.out.println(allSum);
    }

    void dfs(int pointer, long sum, long rem) {
        System.out.println(rem);
        if (pointer == array.length - 1) {
            allSum += sum + Character.getNumericValue(array[pointer]) + rem * 10;
            return;
        }
        int num = Character.getNumericValue(array[pointer]);
        dfs(pointer + 1, sum + rem * 10 + num, 0);
        dfs(pointer + 1, sum, rem * 10 + num);
    }
}

Measured memory_bytes: 21972
# -*- coding: utf-8 -*-
"""
Created on Wed Sep  9 02:37:37 2020

@author: liang
"""
"""
key = lambda x:x[1]
"""
N = int(input())
A = [int(i) for i in input().split()]
B = [(i+1,A[i]) for i in range(N)]
B.sort(key=lambda x: x[1])
#print(B)
res = [str(b[0]) for b in B]
#print(res)
print(' '.join(res))

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

static const ll INF = -1;
vector<ll> abc168d(ll n, ll m, vector<vector<ll>> edge) {
  vector<ll> d(n, INF);

  queue<ll> que;
  que.push(0);
  d[0] = 0;

  vector<ll> ans(n-1);
  while(!que.empty()) {
    ll v = que.front();
    que.pop();
    for(auto nv: edge[v]) {
      if(d[nv] == INF) {
	d[nv] = d[v] + 1;
	ans[nv-1] = v + 1;
	que.push(nv);
      }
    }
  }
  return ans;
}

int main() {
  ll n, m;
  cin >> n >> m;
  /*
  ll a[m], b[m];
  for(ll i=0;i<m;i++) {
    cin >> a[i] >> b[i];
  }
  */

  vector<vector<ll>> edge;
  edge.assign(n, vector<ll>());

  for(ll i=0;i<m; i++) {
    ll a, b;
    cin >> a >> b; 
    edge[a-1].push_back(b-1);
    edge[b-1].push_back(a-1);
  }

  vector<ll> ans = abc168d(n, m, edge);
  cout << "Yes" << endl;
  for(ll i=0; i < n-1; i++) {
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 16288
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int sdkys(int a,int b){
    if(b==0) return a;
    return sdkys(b,a%b);
}
int sskbs(int a,int b){
    return a*b/sdkys(a,b);
}
int sosu(int a){
    if(a==2){
        return 1;
    }
    for(int i=2;i<sqrt(a)+1;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}
vector<int> v;
int n,m,cnt=0,ans=0,aa[220000],ab[220000];
pair<int,int> pp[220000];
string s,ss[220000],sa;
char ch[110][110];
queue<int> que;
signed main(){
    cin>>n>>m;
    rep(i,n){
        cin>>pp[i].first>>pp[i].second;
        if(pp[i].first*pp[i].first+pp[i].second*pp[i].second<=m*m){
            cnt++;
        }
    }
    cout<<cnt;
}

Measured memory_bytes: 13608
A, B, C, X, Y = map(int,input().split())

if A + B < 2 * C:
    print(A * X + B * Y)
elif min(X, Y) * 2 * C + abs(X - Y)*( A if X > Y  else B) > (max(X , Y) * 2 * C):
    print(max(X , Y) * 2 * C)
else:
    print(min(X, Y) * 2 * C + abs(X - Y)*( A if X > Y  else B) )

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  vi rgb(3); rep(i,3) cin >> rgb[i];
  int n; cin >> n;
  int ans = 0;
  rep(i,3001){
    rep(j,3001){
      if(0 <= n-(i*rgb[0]+j*rgb[1]) && (n-(i*rgb[0]+j*rgb[1]))%rgb[2] == 0) ans++;
    }
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3588
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

int n,a[200][200] = {};

int main(){

    cin >> n;
    rep(i,0,2)rep(j,0,n)cin >> a[i][j];

    ll ans = 0;

    rep(i,0,n){
        ll t = 0;
        int y = 0;
        rep(j,0,n){
            if(i == j){
                t += a[y][j];
                y++;
            }
            t += a[y][j];
        }
        ans = max(ans,t);
    }
	
	P(ans);
	return  0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 2000009
#define MOD 1000000007
#define endl '\n'
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(15);
#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
#endif
    ll n;
    cin >> n;
    ll a[n];
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a, a + n);
    ll ans = a[n - 1];
    ll elem = n - 2;
    ll ind = n - 2;
    while (elem > 0)
    {
        if (elem >= 2)
        {
            ans += 2 * a[ind];
            ind--;
            elem -= 2;
        }
        else
        {
            ans += a[ind];
            ind--;
            elem--;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
 	ll cost;
 };
using Graph = vector<vector<Edge>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = LLONG_MAX;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ll MAX = 10000000;
/****** define constant end ********/
/****** define variable start ******/
ll k;
string s;
/******* define variable end *******/
int solve() {
	cin >> k >> s;
	if(s.size() <= k){
		cout << s << endl;
	}else{
		cout << s.substr(0, k) << "..." << endl;
	}
	return 0;
}

int main() {
	//clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}

Measured memory_bytes: 3676