akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(void) {
	int n, i, j;
	int t = 0, h = 0;
	char at[100], ah[100];
	
	
	scanf("%d", &n);
	
	for(i = 0; i < n; i++) {
		scanf("%s %s", at, ah);
		
		for(j = 0; at[j] != '\0'; j++) {
			
			if(at[j] > ah[j]) {
				t+=3;
				break;
			} else if(at[j] < ah[j]) {
				h+=3;
				break;
			} else if(at[j+1] == '\0') {
				if(ah[j+1] == '\0') {
					t++;
					h++;
				} else {
					h+=3;
				}
				break;
			} else if(ah[j+1] == '\0') {
				t+=3;
				break;
			}
		}
	}
	
	printf("%d %d\n", t, h);
	
	return 0;
}

Measured memory_bytes: 596
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  int h[N];
  for (int i = 0; i < N; ++i)
    cin >> h[i];

  int c = 0;
  while (true) {
    int max_start = 0;
    int max_end = 0;
    int max_len = 0;
    int cur_start = 0;
    int searching = true;
    for (int i = 0; i < N; ++i) {
      if (searching && h[i] == 0) {
        searching = false;
        if (i - cur_start > max_len) {
          max_start = cur_start;
          max_end = i - 1;
          max_len = i - cur_start;
        }
      } else if (!searching && h[i] != 0) {
        searching = true;
        cur_start = i;
      }
    }

    if (searching && N - cur_start > max_len) {
      max_start = cur_start;
      max_end = N - 1;
      max_len = N - cur_start;
    }

    if (max_len == 0)
      break;

    for (int i = max_start; i <= max_end; ++i)
      --h[i];

    ++c;
  }

  cout << c << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=(k);i<int(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;

pair<int, size_t> indent(const string& s, size_t i) {
  int cnt = 0;
  while (i < s.size() && s[i] == ' ') {
    ++i; ++cnt;
  }
  return make_pair(cnt, i);
}

pair<string, size_t> get_str(const string& s, size_t i) {
  string res;
  while (isalnum(s[i]) || s[i] == ' ') {
    res += s[i];
    ++i;
  }
  return make_pair(res, i);
}

struct Item {
  int depth;
  string key;
  int type;
  string obj_str;
  vector<Item> obj_map;
};

pair<vector<Item>, size_t> mapping(const string& s, size_t i, int old_depth = -1);

pair<Item, size_t> mapping_item(const string& s, size_t i, int front_depth) {
  int depth;
  tie(depth, i) = indent(s, i);
  if (front_depth != -1 && depth != front_depth) throw "fail";
  string key;
  tie(key, i) = get_str(s, i);
  ++i;
  if (s[i] == '\n') { // mapping
    vector<Item> mapping_child;
    tie(mapping_child, i) = mapping(s, i+1, depth);
    return make_pair((Item){depth, key, 1, "", std::move(mapping_child)}, i);
  } else { // string
    string obj;
    tie(obj, i) = get_str(s, i+1);
    return make_pair((Item){depth, key, 0, obj, vector<Item>()}, i+1);
  }
}

pair<vector<Item>, size_t> mapping(const string& s, size_t i, int old_depth) {
  vector<Item> res;
  Item front;
  tie(front, i) = mapping_item(s, i, -1);
  if (front.depth < old_depth) throw "fail";
  res.push_back(front);
  while(i < s.size()) {
    Item next;
    size_t next_i;
    try {
      tie(next, next_i) = mapping_item(s, i, front.depth);
    } catch (...) {
      break;
    }
    res.push_back(std::move(next));
    i = next_i;
  }
  return make_pair(std::move(res), i);
}

string query(const vector<Item>& obj, const string& s, size_t i) {
  string key_name;
  tie(key_name, i) = get_str(s, i+1);
  for (auto& item : obj) {
    if (item.key == key_name) {
      if (item.type == 0) {
        if (i == s.size()) {
          return "string \"" + item.obj_str + "\"";
        } else {
          return "no such property";
        }
      } else {
        if (i == s.size()) {
          return "object";
        } else {
          return query(item.obj_map, s, i);
        }
      }
    }
  }
  return "no such property";
}

int main() {
  string q;
  getline(cin, q);
  string yaml;
  string line;
  while (getline(cin, line)) yaml += line + "\n";
  auto res = mapping(yaml, 0).first;
  cout << query(res, q, 0) << endl;
  return 0;
}

Measured memory_bytes: 3404
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
int main()
{
	sync;
	ll a,b;
	cin>>a>>b;
	a=__gcd(a,b);
	ll ans=1;
	for(ll i=2;i*i<=a;i++)
	{
		if(a%i==0)
		{
			ans++;
			while(a%i==0)
			a/=i;
		}
	}
	if(a>1)
	ans++;
	cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
ll n, par[100005], ans;
pair<pair<ll,ll>, ll> a[100005];
vector<pair<ll,pair<ll,ll> > > v;

ll Find (ll X) {
	if(par[X] == X) return X;
	return par[X] = Find(par[X]);
}

int main() {
	scanf("%lld",&n);
	for(int i=1;i<=n;i++) {
		scanf("%lld%lld",&a[i].X.X,&a[i].X.Y);
		a[i].Y = i;
	}
	sort(a+1, a+1+n);
	for(int i=2;i<=n;i++) {
		v.push_back({a[i].X.X - a[i-1].X.X, {a[i].Y, a[i-1].Y}});
	}
	for(int i=1;i<=n;i++) {
		swap(a[i].X.X, a[i].X.Y);
	}
	sort(a+1, a+1+n);
	for(int i=2;i<=n;i++) {
		v.push_back({a[i].X.X - a[i-1].X.X, {a[i].Y, a[i-1].Y}});
	}
	sort(v.begin(), v.end());
	for(int i=1;i<=n;i++) par[i] = i;
	for(auto T : v) {
		ll V = T.X, A = T.Y.X, B = T.Y.Y;
		A = Find(A); B = Find(B);
		if(A != B) {ans += V; par[A] = B;}
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 10864
#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
void solve(long long n, long long m, vector<long long> x, vector<long long> y){
	long long xans = 0, yans = 0;
	
	vector<long long> X,Y;
	
	{
		long long sum = 0;
		for(int i = 0 ; i < x.size() ; i++){
			
			xans += x[i] * i - sum;
			sum += x[i];
			sum %= mod;
			xans %= mod;
		}
	}
	{
		long long sum = 0;
		for(int i = 0 ; i < y.size() ; i++){
			
			yans += y[i] * i - sum;
			sum += y[i];
			sum %= mod;
			yans %= mod;
		}
		
	}
	//cout << xans << " " << yans << endl;
	cout << (xans * yans % mod + mod ) % mod << endl;


}

int main(){	
	long long n;
	long long m;
	scanf("%lld",&n);
	vector<long long> x(n-1+1);
	scanf("%lld",&m);
	vector<long long> y(m-1+1);
	for(int i = 0 ; i <= n-1 ; i++){
		scanf("%lld",&x[i]);
	}
	for(int i = 0 ; i <= m-1 ; i++){
		scanf("%lld",&y[i]);
	}
	solve(n, m, x, y);
	return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
#define l long long
using namespace std;main(){l n,m,a,r,c,h,i;string s;map<char,l>d;cin>>n;while(n--)cin>>s,d[s[0]]++;m=d['M'],a=d['A'],r=d['R'],c=d['C'],h=d['H'];cout<<m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h;}

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

using namespace std;

int main(void)
{
    int x, y, n, m; cin >> n >> m;

    int adj[n + 1][n + 1] = {};

    for(int i = 1; i <= m; i++)
    {
        cin >> x >> y;
        adj[x][y] = adj[y][x] = 1;
    }
    vector<int> v(n);
    iota(v.begin(), v.end(), 1);

    int ans = 0;

    do
    {
        // for(auto u : v) cout << u << " "; cout << endl;
        if(v[0] != 1) break;

        bool f = true;

        for(int i = 0; i < n - 1; i++)
        {
            if(!adj[v[i]][v[i + 1]])
            {
                f = false;
                break;
            }
        }
        if(f) ans++;
    }
    while(next_permutation(v.begin(), v.end()));
    cout << ans << endl;
}


Measured memory_bytes: 256
use std::io;
use std::io::{BufRead, Write};

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut buf = String::new();
    input.read_line(&mut buf).unwrap();
    let (n, m): (usize, usize) = {
        let mut split = buf.split_whitespace();
        (
            split.next().unwrap().parse().unwrap(),
            split.next().unwrap().parse().unwrap(),
        )
    };
    let xyz: Vec<(i64, i64, i64)> = (0..n)
        .map(|_| {
            buf.clear();
            input.read_line(&mut buf).unwrap();
            let mut split = buf.split_whitespace();
            (
                split.next().unwrap().parse().unwrap(),
                split.next().unwrap().parse().unwrap(),
                split.next().unwrap().parse().unwrap(),
            )
        })
        .collect();
    let target = [-1, 1];
    let target = &target;
    let max: i64 = target
        .iter()
        .cloned()
        .flat_map(|x_mul| {
            let xyz = &xyz;
            target.iter().cloned().flat_map(move |y_mul| {
                target.iter().cloned().map(move |z_mul| {
                    let mut sums: Vec<i64> = xyz
                        .iter()
                        .cloned()
                        .map(|(x, y, z)| x * x_mul + y * y_mul + z * z_mul)
                        .collect();
                    sums.sort();
                    sums.into_iter().rev().take(m).sum()
                })
            })
        })
        .max()
        .unwrap();
    writeln!(output, "{}", max).unwrap();
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    fn test(input: &str, output: &str) {
        let mut v: Vec<u8> = Vec::new();
        ::solve(input.as_bytes(), &mut v);
        assert_eq!(String::from_utf8(v).unwrap(), output);
    }

    #[test]
    fn case1() {
        test(
            "5 3
3 1 4
1 5 9
2 6 5
3 5 8
9 7 9
", "56\n",
        );
    }

    #[test]
    fn case2() {
        test(
            "5 3
1 -2 3
-4 5 -6
7 -8 -9
-10 11 -12
13 -14 15
", "54\n",
        );
    }

    #[test]
    fn case3() {
        test(
            "10 5
10 -80 21
23 8 38
-94 28 11
-26 -2 18
-69 72 79
-26 -86 -54
-72 -50 59
21 65 -32
40 -94 87
-62 18 82
", "638\n",
        );
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

vector<vector<int>> g;
vector<int> dp;
vector<vector<int>> len;

void predfs(int now,int par){
    int res=0;
    for(auto nex:g[now]) if(nex!=par){
        predfs(nex,now);
        chmax(res,dp[nex]+1);
        len[now].push_back(dp[nex]+1);
    }
    dp[now]=res;
}

void dfs(int now,int par,int pval){
    if(par!=-1) len[now].push_back(pval);
    sort(len[now].rbegin(),len[now].rend());

    for(auto nex:g[now]) if(nex!=par){
        int neco=len[now][0];
        if(neco==dp[nex]+1){
            if(len[now].size()>1) neco=len[now][1];
            else neco=0;
        }
        dfs(nex,now,neco+1);
    }
}

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

  int N;
  cin>>N;
  g.resize(N);
  rep(i,N-1){
      int a,b;
      cin>>a>>b;
      a--;b--;
      g[a].push_back(b);
      g[b].push_back(a);
  }

  dp.resize(N,0);
  len.resize(N);
  predfs(0,-1);

  dfs(0,-1,-1);

  int lim=0;
  for(int i=0;i<N;i++){
      if(len[i].size()<=2) continue;
      int fir=len[i][0];
      int sec=len[i][2];
      if(fir==sec) sec--;
      chmax(lim,fir+sec);
  }

  string ans(N,'1');
  rep(i,lim) ans[i]='0';
  ans[0]='1';ans[1]='1';
  cout<<ans<<endl;


  return 0;
}



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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
typedef long long ll;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 300 + 5;
const int MAX_N = 1e5 + 5;

int main() {
    int n;
    vector<ll> a;
    bool allZero = true;
    cin >> n;
    for (int i = 0; i < n; i++) {
        ll temp;
        cin >> temp;
        if (temp != 0) allZero = false;
        a.push_back(temp);
    }
    if (allZero) {
        cout << "Yes" << endl;
        return 0;
    }
    if (!(n % 3 == 0)) {
        cout << "No" << endl;
        return 0;
    }
    sort(a.begin(), a.end());
    if (n == 3) {
        if (a[0] ^ a[1] ^ a[2] == 0) {
            cout << "Yes" << endl;
            return 0;
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    for (int i = 1; i < n / 3; i++) {
        if (a[i - 1] != a[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    for (int i = n / 3 + 1; i < 2 * n / 3; i++) {
        if (a[i - 1] != a[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    for (int i = 2 * n / 3 + 1; i < n; i++) {
        if (a[i - 1] != a[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    int x = a[0] ^ a[n / 3] ^ a[2 * n / 3];
    if (x) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 1400
//C.cpp
#include <iostream>
#include <string>
using namespace std;

int main(){
  int N,K;
  cin >> N >> K;
  int x[N];
  for(int i = 0; i < N; i++){
    cin >> x[i];
  }
  int Amin = 1000000000;
  for(int i = 0; i <= N-K; i++){
    if(x[i]<=0&&0<=x[K+i-1]){
      Amin = min(Amin,min(x[K+i-1] - 2*x[i],2*x[K+i-1] - x[i]));
    }else if(x[i]>0){
      Amin = min(Amin,x[K+i-1]);
    }else{
      Amin = min(Amin,-x[i]);
    }
    // printf("%d\n",Amin );
  }
  printf("%d\n",Amin);
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;

bool full[100010]={false};
int tsugi[100000]={0};

int dfs(int date){
    if(date<0) return -1;
    if(!full[date]){
        full[date]=true;
        return date;
    }else{
        return tsugi[date]=dfs(tsugi[date]);
    }
}

int main(){
    int N,M; cin>>N>>M;
    vector<pair<int,int>> work(N);
    int a,b;
    for (int i = 0; i < N; ++i) {
        cin>>a>>b;
        work[i]={b,a};
    }

    for (int i = 0; i < 100000; ++i) {
        tsugi[i]=i-1;
    }

    sort(work.rbegin(),work.rend());
    int itr=0,maxi=M;
    ll ans=0ll;

    while(itr<N){
        //cout<<itr<<endl;
        if(work[itr].second>M){
            itr++;
            continue;
        }
        int date=M-work[itr].second;
        if(dfs(date)>=0) {
            ans+=(ll)work[itr].first;
        }
        itr++;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1536
MOD,L,pat1,pat2 = 1000000007,input(),1,0
for i in range(0,len(L)): pat1,pat2 = (pat1*2%MOD,(pat1+pat2*3)%MOD) if L[i] == '1' else (pat1,pat2*3%MOD)
print((pat1+pat2)%MOD)


Measured memory_bytes: 3188
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	double a = kbd.nextDouble();
	double b = kbd.nextDouble();
	double t = 3.305785;
	double ans = a*b/t;
	System.out.println(ans);
    }
}

Measured memory_bytes: 18336
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long k = sc.nextLong();
		long q = k/50;
		long r = k%50;
		System.out.println("50");
		for (int i=0;i<49;i++) {
			if(i<r) {
				System.out.print(q+100-r);
			}
			else {
				System.out.print(q+50-r-1);
			}
			System.out.print(" ");
		}
		System.out.println(q+50-r-1);
	}

}


Measured memory_bytes: 23636
#include <stdio.h>
int main(void)
{
	int n,i;
	long long int a=1;
	scanf("%d",&n);
	for(i=1; i<=n; i++){
		a=a*i;
		a=a%1000000007;
	}
	printf("%lld\n",a);
	return 0;
}

Measured memory_bytes: 128
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
count = 0

for i in range(N):
    sum = 0
    for j in range(M):
        sum += A[i][j] * B[j]
    if sum + C > 0:
        count += 1

print(count)


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    string s;
    cin >> s;

    int cnt[3];
    rep (i, 3) cnt[i] = 0;

    bool ans;
    int n = s.size();

    rep (i, n)
    {
        ++cnt[s[i] - 'a'];
    }

    int cM = MAX(cnt[0], MAX(cnt[1], cnt[2]));
    int cm = MIN(cnt[0], MIN(cnt[1], cnt[2]));
    ans = (cM - cm) <= 1;

    cout << (ans ? "YES\n" : "NO\n");
    return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
  string s;
  cin >> s;
  int n=s.size();
  int i=0;
  bool ex=false;
  rep2(j,i,n){
    if(s.at(j)=='K'){
      if(j-i<=1){
        ex=true;
      }
      i=j+1;
      break;
    }
    else{
      if(s.at(j)!='A'){
        ex=false;
        break;
      }
    }
  }
  if(ex){
    ex=false;
    rep2(j,i,n){
      if(s.at(j)=='I'){
        if(j-i<=0){
          ex=true;
        }
        i=j+1;
        break;
      }
      else{
        if(s.at(j)!='A'){
          ex=false;
          break;
        }
      }
    }
  }
  if(ex){
    ex=false;
    rep2(j,i,n){
      if(s.at(j)=='H'){
        if(j-i<=0){
          ex=true;
        }
        i=j+1;
        break;
      }
      else{
        if(s.at(j)!='A'){
          ex=false;
          break;
        }
      }
    }
  }
  if(ex){
    ex=false;
    rep2(j,i,n){
      if(s.at(j)=='B'){
        if(j-i<=1){
          ex=true;
        }
        i=j+1;
        break;
      }
      else{
        if(s.at(j)!='A'){
          ex=false;
          break;
        }
      }
    }
  }
  if(ex){
    ex=false;
    rep2(j,i,n){
      if(s.at(j)=='R'){
        if(j-i<=1){
          ex=true;
        }
        i=j+1;
        break;
      }
      else{
        if(s.at(j)!='A'){
          ex=false;
          break;
        }
      }
    }
  }
  if(ex){
    rep2(j,i,n){
      if(s.at(j)!='A'){
        ex=false;
      }
    }
  }
  if(ex){
    if(n-i>1){
      ex=false;
    }
  }
  if(ex){
    cout<<"YES"<<endl;
  }
  
  else{
    cout<<"NO"<<endl;  
  }
  
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define gcd __gcd
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
#define pr(n) printf("%d ",n)
#define out(n) printf("%d\n",n)
#define llin(a) cin >> a
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
#define DEBUG(x) cout << #x << " : " << x << endl;
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define ck printf("continue\n")
#define all(vec) vec.begin(),vec.end()
#define asc(vec) sort(vec.begin(),vec.end())
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define M 1000000007
//check the limits, man
// read the constraint properly (ll vs int)
const int N = 1e5+5;
typedef long long int ll;
int main()
{
    int i,n,k,a,x;
    in2(n,k);
    a=0;
    rep(i,n)
    {
        in(x);
        if(x>=k)
            a++;
    }
    out(a);
}





Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<utility>
#include<cmath>
using namespace std;

double area(pair<double,double> a, pair<double,double> b, pair<double,double> c){
	double d1 = sqrt( pow(a.first-b.first,2) + pow(a.second-b.second,2) );
	double d2 = sqrt( pow(c.first-b.first,2) + pow(c.second-b.second,2) );
	double d3 = sqrt( pow(a.first-c.first,2) + pow(a.second-c.second,2) );
	double s = (d1+d2+d3)/2.0;
	return sqrt( s*(s-d1)*(s-d2)*(s-d3) );
}

int main(){
	double x,y;
	vector<pair<double,double> > vec;
	while(scanf("%lf,%lf",&x,&y) != EOF){
		vec.push_back(make_pair(x,y));
	}
	double rta = 0;
	for(int x=1;x<vec.size()-1;++x){
		rta += area(vec[0],vec[x],vec[x+1]);
	}
	
	printf("%.8lf\n",rta);
}

Measured memory_bytes: 1088
n = int(input())
l = list(map(int,input().split()))
l.sort()
cnt = 0
if n<=2:
    print(0)
    exit()
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i]!=l[j] and l[j]!=l[k]:
                if l[i]+l[j]>l[k]:
                    cnt+=1
print(cnt)

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, M, Q;
  cin >> N >> M >> Q;
  vint L(N), R(N);
  rep(i, N) {
    L[i] = (i+1)%N;
    R[i] = (i-1+N)%N;
  }
  vint alive(N, 1);
  int now = 0;
  rep(i, M) {
    int a;
    cin >> a;
    rep(j, a) {
      if(a&1) now = R[now];
      else now = L[now];
    }
    alive[now] = 0;
    L[R[now]] = L[now];
    R[L[now]] = R[now];
    now = L[now];
  }
  rep(i, Q) {
    int q;
    cin >> q;
    cout << alive[q] << endl;
  }


  return 0;
}



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

int main(){
  int n;
  while(1){

    cin >> n;
    if(n==0) break;
    int ans[10]={};
    for(int i=0;i<n;i++){
      int tmp;
      cin >> tmp;
      ans[tmp]++;
    }
    for(int i=0;i<10;i++){
      if(ans[i] == 0){
	cout <<"-\n";
	continue;
      }
      else{
	for(int j=0;j<ans[i];j++){
	  cout <<"*";
	}
	cout << "\n";
      }
    }

  }
}

Measured memory_bytes: 1116
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  double l;
  cin >> l;
  double a = l / 3;
  l -= a * 2;
  cout << setprecision(20) << fixed << a * a * l << endl;
  return 0;
}

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

#define ll long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

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

ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        return a.first > b.first;
    }
}
int main() {
    //COMint();
    int N=in();
    int M=in();
    vector<ll> A;
    ll temp;
    REP(i,N){
        cin>>temp;
        A.push_back(temp);
    }
    sort(A.begin(),A.end());
    int B;int C;
    vector<pair<ll,ll>> BC; 
    REP(i,M){
        cin>>B>>C;
        BC.push_back(make_pair(B,C));
    }
    sort(BC.begin(),BC.end(),compare_by_b);
    int j=0;
    int k=0;
    REP(i,N){
        k++;
        if(k>BC[j].first){
            j++;k=1;
        }
        if(A[i]<BC[j].second){
            //debug(A[i]);debug(BC[j].second);
            A[i]=BC[j].second;
        }else{
            break;
        }
    }
    ll ans;ans=0;
    REP(i,N){
        ans+=A[i];
    }
    print(ans);
}

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

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

    string s;
    cin >> s >> s;
    int result = 0;
    size_t pos = s.find("ABC");
    while (pos != string::npos) {
        result++;
        pos = s.find("ABC", pos + 1);
    }
    cout << result << endl;
}

Measured memory_bytes: 256
#include<iostream>
#define size 1000001
using namespace std;
int p[size];
int n,a,b,cnt;
void prime();
int main(){
  prime();
  while(1){
    cin>>n;
    if(n==0)break;
    cnt=0;
    for(int i=2;i<=n/2;i++){
      if(p[i]==1&&p[n-i]==1){
	//	cout<<i<<' '<<n-i<<endl;
	cnt++;
      }
    }
    cout<<cnt<<endl;
  }
  return 0;
}

void prime(){
  for(int i=0;i<size;i++)p[i]=1;
  p[0]=p[1]=0;
  for(int i=4;i<size;i+=2)p[i]=0;
  for(int i=3;i*i<=size;i+=2){
    if(p[i]==0)continue;
    for(int j=i*2;j<size;j+=i)p[j]=0;
  }
}

Measured memory_bytes: 5064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>
using namespace std;

int n, m, k;
map<int, int> M;

void rec(int nn, int sum) {
  if(nn == n) {
    ++M[sum];
    return;
  }

  for(int i = 1; i <= m; ++i) {
    rec(nn+1, sum+i);
  }
}

double solve() {
  double ans;
  M.clear();
  rec(0, 0);
  ans = 0;
  for(int i = n; i <= n*m; ++i) {
    int a = i-k;
    if(a <= 0) a = 1;
    ans += a * M[i] / pow(double(m), double(n));
  }
  return ans;
}

main() {
  while((cin >> n >> m >> k) && (n || m || k)) {
    printf("%.8f\n", solve());
  }
}

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

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

	int n = S.length();
	if (S[n - 1] == 's')
		S = S + "es";
	else
		S += 's';

	cout << S << '\n';
	return 0;
}


Measured memory_bytes: 3620
def main():
    width, height = map(int, input().split(" "))
    if width * height == 1:
        print(1)
    elif width == 1:
        print(height - 2)
    elif height == 1:
        print(width - 2)
    else:
        print((height - 2) * (width - 2))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define s second
#define f first
long long const mod = pow(2,32);
#define inf 1000000000000000
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod)+mod)%mod;}
inline ll mul(ll a, ll b){ return (((a%mod)*(b%mod))%mod+mod)%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

ll power(ll x,ll y,ll m)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2, m) % m;
    p = (p * p) % m;
    return (y%2 == 0)? p : (x * p) % m;
}

ll modInv(ll x)
{
    return power(x,mod-2,mod)%mod;
}


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

    ld l;
    cin>>l;
    l=l/3;
    cout<<fixed<<l*l*l<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,m;
	char a[100],b[100],c[100001];
	while(true){
	cin>>n;
	if(n==0)
		break;
	for(int i=0;i<n;i++)
		cin>>a[i]>>b[i];
	cin>>m;
	for(int i=0;i<m;i++){
		cin>>c[i];
		int j=0;
		while(true){
			if(a[j]==c[i]){
				c[i]=b[j];
				break;
			}
			j++;
			if(j==n)
				break;
		}
	}
	for(int i=0;i<m;i++)
		cout<<c[i];
	cout<<endl;
	}
    return 0;
}
 

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

int main() {
	int n,k;cin>>n>>k;
	string s;cin>>s;
	int ans=0;
	for(int i=0;i<s.size()-1;i++){
		if(s[i]==s[i+1])ans++;
	}
	cout<<min(ans+2*k,n-1)<<endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;

string s;
int memo[310][310][310];

int calc(int l, int r, int k){
    if(k < 0) return -INF;
    if(l > r) return 0;
    if(memo[l][r][k]) return memo[l][r][k];
    if(l == r) return memo[l][r][k] = 1;
    int res = 0;
    if(s[l] == s[r]) res = max(res, calc(l + 1, r - 1, k) + 2);
    else res = max({res, calc(l + 1, r, k), calc(l, r - 1, k), calc(l + 1, r - 1, k - 1) + 2});
    return memo[l][r][k] = res;
}

int main(){
    int k;
    cin >> s >> k;
    cout << calc(0, s.size() - 1, k) << endl;    
}

Measured memory_bytes: 112768
#include <iostream>
#include <vector>
#include<stdio.h>

using namespace std;

int main() {
	int w, h, x, y;
	cin >> w >> h >> x >> y;
	double ans = (double)w*h / 2;
	int num = (w == x * 2 && h == y * 2) ? 1 : 0;
	printf("%.10f %d\n", ans, num);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int n;
    while (cin >> n && n) {
        vector<int> v(n+1);
        for (int i=0; i<n+1; ++i) cin >> v[i];

        for (int i=0; i<n+1; ++i) {
            vector<int> vv = v;
            vv.erase(vv.begin() + i);
            bool ok = true;
            int d = vv[1] - vv[0];
            for (int k=1; k<n; ++k) {
                if (d != vv[k] - vv[k-1]) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                cout << v[i] << endl;
                break;
            }
        }
    }
    return 0;
}

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

using namespace std;


int main()
{

    int n, m, counter=0;
    cin >> n >> m;
    for(int i=0; i<n; i++){
        m+=3;
    }

    while(m>=2){
        m-=2;
        counter++;
    }

    cout << counter;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)


void solve(long long N, long long M, std::vector<long long> X){
    if(N >= M){
        cout << 0 << endl;
        return;
    }
    sort(X.begin(), X.end());
    vll diff(M-1);
    rep(i, M-1){
        diff[i] = X[i+1]-X[i];
    }
    sort(diff.begin(),diff.end());
    ll ans = 0;
    rep(i, M-N){
        ans += diff[i];
    }
    cout << ans << endl;

}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> X(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&X[i]);
    }
    solve(N, M, std::move(X));
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  string ans;
  if(a==b){
    ans="Draw";
  }
  else if(a==1){
    ans="Alice";
  }
  else if(b==1){
    ans="Bob";
  }
  else if(a<b){
    ans="Bob";
  }
  else{
    ans="Alice";
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(){
	int x, t;
	cin >> x >> t;
 
	cout << max(x-t, 0) << endl;
 
	return 0;
}

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

using namespace std;
const long double PI = acos(-1);
const int maxn = 2e5 + 7;

int n, m, a[maxn];

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen("test.inp", "r")) freopen("test.inp", "r", stdin);
    cout << fixed << setprecision(3);
    cin >> n >> m;
    int ans = 0;
    for(int i = 1; i <= m; i++)
    {
        int x;
        cin >> x;
        ans += x;
    }
    cout << max(n - ans, -1ll) << '\n';
}

Measured memory_bytes: 3664
#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;

VI memo;
int dfs(int i, VVI& vertex) {
    if(memo[i] != -1) return memo[i];
    if(vertex[i].size() == 0) return memo[i] = 0;
    int res = 0;
    for(auto adj : vertex[i]) res = max(res, dfs(adj, vertex));
    return memo[i] = res + 1;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    VVI vertex(n);
    memo.resize(n, -1);
    REP(i, m) {
        int x, y;
        cin >> x >> y;
        vertex[x - 1].push_back(y - 1);
    }

    int ans = 0;
    REP(i, n) ans = max(ans, dfs(i, vertex));
    cout << ans << ln;
    return 0;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
 
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
    return power((a*a)%mod,n/2)%mod;
}
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
}   

void solve(){
    int c0 = 0,c1 = 0,c2 = 0,c3 = 0,n;
    cin >> n;
    FOR(i,1,n+1){
        string a;
        cin >> a;
        if(a == "AC")c0++;
        else if(a == "WA")c1++;
        else if(a == "TLE")c2++;
        else c3++;
    }
    cout << "AC x " << c0 << "\n";
    cout << "WA x " << c1 << "\n";
    cout << "TLE x " << c2 << "\n";
    cout << "RE x " << c3 << "\n";
}

signed main()
{
    showoff;
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...#include <bits/stdc++.h>
 


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

using namespace std;

const string yes = "War";
const string no = "No War";
const int MAX_N = 100;

int main(void) {
  int n, m, x, y;
  int xs[MAX_N], ys[MAX_N];

  cin >> n;
  cin >> m;
  cin >> x;
  cin >> y;

  int x_max = x;
  int y_min = y;

  for (int i = 0; i < n; i++) {
    cin >> xs[i];
    x_max = max(xs[i], x_max);
  }

  for (int i = 0; i < m; i++) {
    cin >> ys[i];
    y_min = min(ys[i], y_min);
  }

  if (x_max < y_min) {
    cout << no << endl;
  }
  else {
    cout << yes << endl;
  }
  return 0;

  
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main() {
int N;
cin >> N;
int a[N];
int max, min;
for (int i=0; i<N; i++) {
cin >> a[i];
if (i == 0){max = min = a[0];continue;}
if (max < a[i]) max = a[i];
if (min > a[i]) min = a[i];
}
cout << max - min << endl;
return 0;
}



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

using namespace std;

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    long long x1 = a;
    long long y1 = c;
    long long x2 = b;
    long long y2 = d;
    cout << max({ x1 * y1, x2 * y2, x1 * y2, x2 * y1 });

    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define N 500

int solve(int,int);
int n,A[N];

int main(){
  int i,m,q;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m);
    if(solve(0,m)){
      printf("yes\n");
    }
    else{
      printf("no\n");
    }
  }
  return 0;
}


int solve(int i,int m){
  if(m==0){
    return 1;
  }
  if(i>=n){
    return 0;
  }
  return solve(i+1,m) || solve(i+1,m-A[i]);
}
    



Measured memory_bytes: 2108
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {
	double n, t; cin >> n >> t;
	double ans = 0.;
	rep(i, n) {
		double x, h; cin >> x >> h;
		ans = max(ans, h / x * t);
	}
	printf("%.20f\n", ans);
}


Measured memory_bytes: 3272
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

using namespace std;

#define int long long
#define str string
#define rtn return
#define pb push_back
#define db long double
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()

const int N = 1e5 + 7;

int dp[N];
int h[N];
int n, k;

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

	cin >> n >> k;
	for (int i = 1; i < n; i++) dp[i] = 1e9;
	for (int i = 0; i < n; i++)
		cin >> h[i];
	for (int i = 1; i < n; i++) {
		for (int j = 1; j <= k; j++) {
			if (i - j >= 0) {
				dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
			}
		}
		//cout << dp[i] << endl;
	}
	cout << dp[n - 1] << "\n";
	return 0; 
}

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

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

  int n;
  cin >> n;
  int x[n];
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  int a[n] = {0};
  for (int i = 0; i < n; i++) {
    a[x[i] - 1] = i + 1;
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << '\n';
  }
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(){
    cout << "Yes" << endl;
}

void no (){
    cout << "No" << endl;
}

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

int main() {
    int n; cin >> n;
    ll a = 1LL; ll b = 1LL; ll c = 1LL;
    rep(i,n){
        a *= 10LL; a %= mod;
        b *= 9LL; b %= mod;
        c *= 8LL; c %= mod;
    }
    ll ans = a - b + mod; ans %= mod;
    ans += mod - b; ans %= mod;
    ans += c; ans %= mod;
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define LL long long

using namespace std;
const int maxn = 1e5+100;
LL ans,a[maxn],cnt[maxn];

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

    int i,n,t;
    cin >> n;
    for (int i = 1;i<=n;i++){
        cin >> a[i];
        ans +=a[i];
        cnt[a[i]]++;
    }
    cin >> t;

    while(t--){
        int x,y;
        cin >> x >> y;
        ans -= cnt[x] * x;
        ans+= cnt[x] * y;
        cnt[y]+=cnt[x], cnt[x]=0;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 5144
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        String ans = "";
        for (int i = 0; i < Math.max(a, b); i++) {
            ans += Math.min(a, b);
        }
        System.out.println(ans);
        sc.close();
    }
}

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

#define ll long long
vector< pair<long, long> > arr;
long calc(long, long, bool);
int s,n;
long dp[3002][3002][2];

int main()
{
    for(int i=0; i<=3001; i++)
    {
        for(int j=0; j<= 3001; j++)
            dp[i][j][0] = dp[i][j][1] = -1;
    }
    
    cin>>n>>s;
    s--;
    long x,y;

    for(int i=0; i<n; i++)
    {
        cin>>x>>y;
        arr.push_back( make_pair(x,y));
    }
    
    long l1 = calc(1,s, 0);
    long l2 = -1, l3 = -1;
    if(s >= arr[0].first)
       l2 = calc(1, s - arr[0].first, 0);
    l2 += arr[0].second;
    
    l3 = calc(1,s, 1);
    l3 += arr[0].second;
    
    long ans = max(l1, max(l2, l3));
    cout<<ans<<endl;
    
    return 0;
}

long calc(long pos, long c, bool t)
{
    if(pos == n) return 0;

    if(dp[pos][c][t] != -1)
        return dp[pos][c][t];
        
    long l1 = calc(pos+1, c, t);
    long n_c = (c - arr[pos].first);
    long l2 = -1, l3 = -1;
    if(n_c >= 0)
    {
        l2 = calc(pos+1, n_c, t);
        l2 += arr[pos].second;
    }
    if(!t)
    {
        l3 = calc(pos+1,c, 1);
        l3 += arr[pos].second;
    }
    dp[pos][c][t] = max(l1, max(l2, l3));
    return dp[pos][c][t];
}


Measured memory_bytes: 141440
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	int N;
	cin >> N;
	int cnt = 0;
	for(int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		if(a == b)
			cnt++;
		else
			cnt = 0;
		if(cnt == 3) {
			cout << "Yes\n";
			return 0;
		}
	}

	cout << "No\n";
	return 0;
}

Measured memory_bytes: 3628
/*
 * Author : Andrew J
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
using ll = long long;
typedef pair <ll , ll> ii;
void in(ll &x);
const ll N = 2e5 + 10;
const ll inf = 1e16;
ll n;
ll a[N],dp1[N][2],dp2[N][2];

ll fltor(ll cur , bool lr) {
   // lr = 0, terakhir ambil kiri otherwise kanan
   if (cur > n) return 0;
   ll &sol = dp1[cur][lr];
   if (sol != -1) return sol;
   if (lr) {
      sol = fltor(cur + 2 , 1) + a[cur + 1];
   } else {
      sol = max(fltor(cur + 2 , 0) + a[cur] , fltor(cur + 2 , 1) + a[cur + 1]);
   }
   return sol;
}

ll frtol(ll cur , bool lr) {
   // lr = 0, trakhir ambil kiri
   // lr = 1, trakhir ambil kanan
   if (cur <= 0) return 0;
   ll &sol = dp2[cur][lr];
   if (sol != -1) return sol;
   if (lr) {
      sol = max(frtol(cur - 2 , 0) + a[cur - 1] , frtol(cur - 2 , 1) + a[cur]);
   } else {
      sol = frtol(cur - 2 , 0) + a[cur - 1];
   }
   return sol;
}

int main() {
   memset (dp1 , -1 , sizeof dp1);
   memset (dp2 , -1 , sizeof dp2);
   in(n);
   for (ll i = 1 ; i <= n ; i++) {
      in(a[i]);
   }
   if (n & 1) {
      ll sol = LLONG_MIN;
      for (ll i = 1 ; i <= n ; i += 2) {
         ll cur = fltor(i + 1 , 0);
         cur += frtol(i - 1 , 1);
         sol = max(sol , cur);
      }
      printf("%lld\n" , sol);
   } else {
      printf("%lld\n" , fltor(1 , 0));
   }
   return 0;
}

void in(ll &x) {
	bool neg = false;
	register ll c;
	x = 0;
	c = getchar();
	if(c == '-') {
		neg = true;
		c = getchar();
	}
	for (; c > 47 && c < 58; c = getchar())
   	x = (x << 1) + (x << 3) + c - 48;
	if (neg) x *= -1;
}


Measured memory_bytes: 17804
//標準関数をすべてインクルードする。
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

const int_least64_t INF = 10000000;

int main(){
    //cin coutを高速化
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);

    int n;
    cin >> n;
    vector<int> x(n, 0);
    rep(i, n) cin >> x[i];
    sort(x.begin(), x.end());
    int res = 0;
    int y = INF;
    for(int i =0; i <= 100; ++i){
        for(int j = 0; j < n; ++j){
            res += (x[j] - i) * (x[j] - i);
        }
        y = min(y, res);
        res = 0;
    }

    cout << y << endl;

    return 0;
}



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

using namespace std;

template <int MD>
struct ModInt {
    typedef ModInt M;
    int v;
    ModInt(int _v = 0) : v(_v) {}
    M& operator += (const M &r) {
        if ((v += r.v) >= MD) v -= MD;
        return *this;
    }
    M& operator -= (const M &r) {
        if ((v -= r.v) < 0) v += MD;
        return *this;
    }
    M operator + (const M &r) const { return M(*this) += r; }
    M operator - (const M &r) const { return M(*this) -= r; }
};
typedef ModInt<1000000007> Mint;

const int MN = 10010;
const int MR = 110;
string s;
int m;
Mint dp[MN][MR][10];

Mint f(int p, int acc) {
    if (p == 0) return (acc == 0);
    int cur = s[p - 1] - '0';
    Mint res = 0;
    for (int d = 0; d < cur; d++) {
        int r = (m - acc) % m;
        res += dp[p][r][d];
    }
    return res + f(p - 1, (acc + cur) % m);
}

int main() {
    cin >> s >> m;
    reverse(s.begin(), s.end());
    dp[0][0][0] = 1;
    for (int i = 0; i < MN - 1; i++) {
        for (int r = 0; r < m; r++) {
            Mint sm = 0;
            for (int d = 0; d < 10; d++) sm += dp[i][r][d];
            if (i == 0) assert(sm.v == (r == 0));
            for (int d = 0; d < 10; d++) {
                dp[i + 1][(r + d) % m][d] += sm;
            }
        }
    }
    Mint ans = f(int(s.size()), 0) - Mint(1);
    cout << ans.v << endl;
    return 0;
}

Measured memory_bytes: 43904