akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return read.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtype!real;
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
void solve(){
	int n = rint;
	long[] bs = rlong(n - 1);
	
	long[] as = new long[](n);
	foreach(i; 0 .. n){
		if(i == 0) as[i] = bs[i];
		else if(i == n - 1) as[i] = bs[i - 1];
		else as[i] = min(bs[i - 1], bs[i]);
	}
	
	long ans = as.sum;
	ans.writeln;
}


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
char s[125252];
typedef unsigned int Hash;
const Hash base = 10007ll;
Hash hsh[125252];
Hash bpow[125252];
typedef short Hash2;
const Hash2 base2 = 29;
const Hash2 mod2 = 251;
Hash2 hsh2[125252];
Hash2 bpow2[125252];
Hash2 mdmp[65536];

int calc(int x){
  typedef pair<Hash,Hash2> yo;
  set<yo> S;
  REP(i,n-x+1){
    // substr
    int l = i;
    int r = l+x;
    Hash h = hsh[r] - hsh[l]*bpow[x];
    Hash hh = mdmp[hsh2[r] - mdmp[hsh2[l]*bpow2[x]] + mod2];
    S.insert(yo(h,hh));
  }
  return S.size();
}

int main(){
  scanf("%s",s);
  n = strlen(s);
  REP(i,65536)mdmp[i] = i%mod2;
  // create hash
  REP(i,n)hsh[i+1] = hsh[i]*base + (Hash)s[i];
  bpow[0] = 1ll;
  REP(i,n)bpow[i+1] = bpow[i]*base;
  // create hash 2
  REP(i,n)hsh2[i+1] = mdmp[ mdmp[hsh2[i]*base2] + (Hash2)(s[i]-'a') ];
  bpow2[0] = 1;
  REP(i,n)bpow2[i+1] = mdmp[ bpow2[i]*base2 ];
  // go
  int low = 1, high = n;
  while(low+2<high){
    int ml = (low*2+high)/3;
    int mh = (low+high*2)/3;
    if(calc(ml)<calc(mh)){
      low = ml;
    }else{
      high = mh;
    }
  }
  int ans = 0;
  FOR(i,low,high+1)CHMAX(ans,calc(i));
  printf("%d\n",ans);
  return 0;
}


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

ll a, b;

ll gcd(ll a, ll b) {
  while (b) {
    ll aux = a;
    a = b;
    b = aux % b;
  }
  return a;
}

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

int main() { // claudio van
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  cin >> a >> b;
  cout << lcm(a, b) << "\n";
  return 0;
}

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

int main()
{
	int a[10],i,j,e;
	char c;

	while(1)
	{
		e=1;
		i=0;
		while(1)
		{
			if(scanf("%c",&c)==EOF)
			{
				e=0;
				break;
			}
			else if(c=='\n')
				break;
			a[i]=(int)(c-48);
			i++;
		}
		if(!e)
			break;
			
		for(i=0;i<9;i++)
		{
			for(j=0;j<9-i;j++)
			{
				a[j]+=a[j+1];
				if(a[j]>9)
					a[j]-=10;
			}
		}
		printf("%d\n",a[0]);
	}
	return 0;
}

Measured memory_bytes: 540
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

void Compute(ll n)
{
	KAKA
	map<ll,ll> mp;
	pragi(1,101)
	{
		pragj(1,101)
		{
			for(ll k = 1;k <= 101;k++)
			{
				ll func = (i * i) + (j * j) + (k * k) + (i * j) + (j * k) + (k * i);
				mp[func]++;
			}
		}
	}
	pragi(1,n + 1)
	{
		cout<<mp[i]<<"\n";
	}
}
int main()
{
	KAKA
	ll n;
	cin>>n;
	Compute(n);
}

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

int main() {
  int N; cin >> N;
  int A[N];
  for (int i=0; i<N; i++) cin >> A[i];
  int first = 0, second = 0;
  for (int i=0; i<N; i++) {
    if (A[i] >= first) {
      second = first;
      first = A[i];
    } else if (A[i] >= second) {
      second = A[i];
    }
  }
  for (int i=0; i<N; i++) {
    if (A[i] == first) cout << second << endl;
    else cout << first << endl;
  }
}

Measured memory_bytes: 2432
dat = []
import collections
for i in range(3):
    a,b = map(int, input().split())
    dat.append(a)
    dat.append(b)
c = collections.Counter(dat)
res = []
for k in c:
    res.append(c[k])
res.sort()
if res == [1,1,2,2]:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
    int n,l;
    cin>>n>>l;
    int ans=0;
    int sum=n*(l+l+n-1)/2;
    int x;
    if(l>=0)x=l;
    else if(l+n-1<=0)x=l+n-1;
    else x=0;
    cout<<sum-x<<endl;
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> v(N);
    int ret = 0;
    for(int i=0; i<N; ++i) {
        int a = 0;
        cin >> a;
        v[i] = a-1;
    }
    for(int i=0; i<N; ++i) {
        if(i == v[v[i]]) {
            ret++;
        }
    }
    cout << ret / 2 << endl;
}


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

using namespace std;



int main(){
    string s;

    cin >> s;

    int index[26];

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



    for (int i = 0; i < s.size(); i++){
        if (s[i] == 'C' && index[s[i] - 'A'] == -1){
            index[s[i] - 'A'] = i;
        }
        else if (s[i] == 'F'){
            index[s[i] - 'A'] = i;
        }
    }

    if (index[2] == -1 || index[5] == -1 || (index[2] > index[5])){
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 760
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(ll i = 0;i < (n); ++i)
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> b(n-1);
    rep(i,n-1) cin >> b[i];
    vector<int> a(n);
    a[0] = b[0];
    for (int i = 1; i <= n-2; i++){
        a[i] = min(b[i],b[i-1]);
    }
    a[n-1] = b[n-2];
    int ans = 0;
    rep(i,n) ans += a[i];
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 256
n = gets.chomp.to_i
spots = {}
n.times do |i|
  s, p = gets.chomp.split(" ")
  key = [s, p.to_i]
  spots[key] = i + 1
end
spots.sort_by {|k, v| [k[0], -k[1]]}.each do |k, v|
  puts v
end


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

long long int A[200001] = {0};
long long int sum[300000] = {0};

int main(){
  int x,y,s;
  cin >>x>>y>>s;

  while(!(x == 0 and y == 0 and s == 0)){
    int ans = 0;

    for(int i = 1; i <= s-1; i++ ){
      for(int j = 1; j <= s-1; j++){
        if((i*(100+x)/100 + j*(100+x)/100) == s){
          int kari = i*(100+y)/100 + j*(100+y)/100;
          ans = max(ans, kari);
        }
      }
    }
    cout <<ans<<endl;
    cin >>x>>y>>s;
  }
  return 0;
}



Measured memory_bytes: 3100
str = gets.split
N,Q = str[0].to_i, str[1].to_i
S = gets.chomp

B = []
B[0] = 0

for x in 0...N-1
  if S[x] == "A" && S[x+1] == "C"
    B[x+1] = B[x] + 1 
  else
    B[x+1] = B[x]
  end
end

for x in 1..Q
  str = gets.split
  l,r = str[0].to_i, str[1].to_i
  puts B[r-1] - B[l-1]
end

Measured memory_bytes: 3452
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string.h>
const int N = 1e5+10;
#define ll long long
inline int read() {
	int r=0; char c=getchar();
	while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9') r=r*10+c-'0', c=getchar();
	return r;
}
int sum[N];
int main() {
	int n = read(); ll ans = 0;
	for (int i=1; i<=n; i++) {
		int x = read(); ++sum[x]; ans += x;
	}
	int m = read();
	for (int i=1; i<=m; i++) {
		int b = read(), c = read();
		sum[c] += sum[b]; ans += 1ll * (c - b) * sum[b]; sum[b] = 0;
		printf("%lld\n", ans);
	}
}

Measured memory_bytes: 1936
sizePrice = list(map(int, input().split()))
N = int(input())
oneLMin = min([sizePrice[0] * 4, sizePrice[1] * 2, sizePrice[2]])
twoLMin = min([oneLMin*2, sizePrice[3]])
ans = 0
if N % 2 == 0:
    ans = twoLMin * (N//2)
else:
    ans = twoLMin * ((N - 1)//2) + oneLMin
print(ans)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
  int k;
  cin>>k;
  cout<<a[k-1]<<endl;
}


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

int main() {
	int n;
	int nums[8];
	
	for (cin >> n; n; --n) {
		unsigned num;
		cin >> num;
		for (int i = 0; i < 8; ++i) {
			nums[i] = num % 10;
			num /= 10;
		}
	
		for (int i = 0; i < 8; ++i) {
			for (int j = i + 1; j; --j) {
				if (nums[j] < nums[j - 1]) {
					swap(nums[j], nums[j - 1]);
				}
			}
		}

		unsigned max = 0;
		unsigned min = 0;
		for (int i = 0; i < 8; ++i) {
			min *= 10;
			min += nums[i];
		}
		for (int i = 7; i >= 0; --i) {
			max *= 10;
			max += nums[i];
		}

		cout << max - min << endl;
	}
	return 0;
}

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

typedef long long ll;

string solve(const string& numbers, string order) {
    if (order.size() == 3) {
		string ret = numbers.substr(0,1);
		int ans = numbers[0]-'0';
		for (int i = 0; i < 3; ++i) {
			if (order[i] == '+') {
				ans += numbers[i+1]-'0';
			} else {
				ans -= numbers[i+1]-'0';
			}
			ret = ret+order[i]+numbers[i+1];
		}
		if (ans == 7) {
			return ret;
		} else {
			return "";
		}
	} else {
		string plus = solve(numbers, order+"+");
		string minus = solve(numbers, order+"-");
		if (plus.size() > 0) {
			return plus;
		} else {
			return minus;
		}
	}
}

int main () {
    string rem; cin >> rem;
    cout << solve(rem,"") << "=7" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>
#include <bitset>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;



struct Data{
  int cost;
  std::bitset<12> bs;
  Data(int c,const std::vector<int>& list){
    cost=c;
    for(int i=0;i<12;i++){
      bs[i]=false;
    }
    for(int i=0;i<list.size();i++){
      bs[list[i]-1]=true;
    }
  }
};

int main(void){
  cout << std::fixed << std::setprecision(16);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int n,m;
  cin>>n>>m;
  std::vector<Data> data;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    std::vector<int> list(b);
    for(int j=0;j<b;j++){
      cin>>list[j];
    }
    data.push_back(Data(a,list));
  }

  const int INF=INT32_MAX/3;
  const int MAX_M=12;

  int dp[1<<MAX_M][1001];
  for(int i=0;i<(1<<MAX_M);i++){
    for(int j=0;j<1001;j++){
      if(i==0) dp[i][j]=0;
      else dp[i][j]=INF;
    }
  }


  for(int i=0;i<(1<<n);i++){
    std::bitset<12> bs(i);

    bool isok=true;
    int count=0;
    for(int j=0;j<12;j++){
      if(data[0].bs[j]){
        if(bs[j]) count++;
      }else{
        if(bs[j]){
          isok=false;
          break;
        }
      }
    }
    if(count==0) isok=false;
    if(isok){
      dp[i][0]=data[0].cost;
    }

  }

  for(int i=1;i<m;i++){
    Data curr_data=data[i];
    for(int j=0;j<(1<<n);j++){
      std::bitset<12> bs(j);
      std::bitset<12> prev_bs(0);
      for(int k=0;k<12;k++){
        if(!curr_data.bs[k]&&bs[k]){
          prev_bs[k]=true;
        }
      }
      if(dp[prev_bs.to_ulong()][i-1]==INF) continue;

      dp[j][i]=std::min(dp[j][i-1], dp[prev_bs.to_ulong()][i-1]+curr_data.cost);
    }
  }

  cout<<(dp[(1<<n)-1][m-1]==INF?-1:dp[(1<<n)-1][m-1])<<endl;





  return 0;
}


Measured memory_bytes: 16384
#include "bits/stdc++.h"
using namespace std;
vector<pair<pair<int, int>, int>> a, b;
bool c[100000];
int main()
{
	int n;
	long long total = 0;
	scanf("%d", &n);
	for(int i = 0, j, k; i < n; ++i)
	{
		scanf("%d%d", &j, &k);
		a.push_back(make_pair(make_pair(j + k, j), i));
		b.push_back(make_pair(make_pair(j + k, k), i));
	}
	sort(a.begin(), a.end(), greater<pair<pair<int, int>, int>>());
	sort(b.begin(), b.end(), greater<pair<pair<int, int>, int>>());
	for(int i = 0, t = 0, o = 0; i < n; ++i)
	{
		if(i % 2)
		{
			for(; c[b[o].second]; ++o){}
			total -= b[o].first.second;
			c[b[o].second] = true;
			++o;
		}
		else
		{
			for(; c[a[t].second]; ++t){}
			total += a[t].first.second;
			c[a[t].second] = true;
			++t;
		}
	}
	printf("%lld\n", total);
}

Measured memory_bytes: 2988
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<list>
#define _USE_MATH_DEFINES

#include<math.h>
#include<map>

#define SENTINEL 1000000001

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

long long int A[2000010];
int itr;

void Insert(long long int key)
{
	itr++;
	A[itr] = key;

	int temp = itr;

	while (temp != 1)
	{
		if (A[temp / 2] < A[temp])
		{
			long long int t = A[temp];
			A[temp] = A[temp / 2];
			A[temp / 2] = t;
		}
		else
		{
			break;
		}
		temp = temp / 2;
	}
}

int ExtractMax()
{
	long long int maxNum = A[1];

	A[1] = A[itr];
	itr--;

	if (itr == 0)
	{
		return maxNum;
	}

	int temp = 1;
	while (true)
	{
		int l = temp * 2;
		int r = temp * 2 + 1;
		long long int tmk = A[temp];
		if (l <= itr)
		{
			tmk = max(tmk, A[l]);
		}
		if (r <= itr)
		{
			tmk = max(tmk, A[r]);
		}
		if (tmk == A[temp])
		{
			break;
		}
		else if (tmk == A[l])
		{
			long long int t = A[l];
			A[l] = A[temp];
			A[temp] = t;
			temp = l;
		}
		else
		{
			long long int t = A[r];
			A[r] = A[temp];
			A[temp] = t;
			temp = r;
		}
	}

	/*for (int i = 1; i <= itr; i++)
	{
		printf(" %d", A[i]);
	}
	printf("\n");
	*/
	return maxNum;
}

int main()
{
	while (true)
	{
		string command;
		long long int key;
		cin >> command;

		switch (command[2])
		{
		case 's':
			cin >> key;
			Insert(key);
			break;
		case 't':
			cout << ExtractMax() << endl;
			break;
		case 'd':
			goto END;
			break;
		}
	}
	END:
	return 0;
}


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

int main()
{
    size_t H, W, M;
    cin >> H >> W >> M;
    vector<size_t> h(M);
    vector<size_t> w(M);

    vector<pair<size_t, size_t>> h_count_with_index(H + 1, make_pair(0, 0));
    for (size_t i = 0; i <= H; i++)
    {
        h_count_with_index[i].second = i;
    }

    vector<pair<size_t, size_t>> w_count_with_index(W + 1, make_pair(0, 0));
    for (size_t i = 0; i <= W; i++)
    {
        w_count_with_index[i].second = i;
    }

    for (size_t i = 0; i < M; i++)
    {
        cin >> h[i] >> w[i];
        h_count_with_index[h[i]].first++;
        w_count_with_index[w[i]].first++;
    }

    sort(h_count_with_index.rbegin(), h_count_with_index.rend());
    set<size_t> candidate_h;
    for (pair<size_t, size_t> p : h_count_with_index)
    {
        if (p.first == h_count_with_index.front().first)
        {
            candidate_h.insert(p.second);
        }
    }

    sort(w_count_with_index.rbegin(), w_count_with_index.rend());
    set<size_t> candidate_w;
    for (pair<size_t, size_t> p : w_count_with_index)
    {
        if (p.first == w_count_with_index.front().first)
        {
            candidate_w.insert(p.second);
        }
    }
    size_t ans = h_count_with_index.front().first + w_count_with_index.front().first - 1;

    size_t flag = candidate_h.size() * candidate_w.size();
    for (size_t i = 0; i < M; i++)
    {
        bool include_h = candidate_h.find(h[i]) != candidate_h.end();
        bool include_w = candidate_w.find(w[i]) != candidate_w.end();
        if (include_h && include_w)
        {
            flag--;
        }
    }
    if (flag > 0)
    {
        ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 45400
#include <stdio.h>
#include <math.h>

int main(){
  int i,j,t,n,m,count=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    t=0;
    scanf("%d",&m);
    for(j=2;j<=sqrt(m);j++){
      if(m%j==0)t=1;
    }
    if(t==0)count++;
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 596
a, b, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

mn = float('inf')
for tkt in range(m):
    x, y, c = map(int, input().split())
    tot = A[x-1] + B[y-1] - c
    mn = min(mn, tot)

mn = min(mn, min(A) + min(B))

print(mn)


Measured memory_bytes: 18608
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define endl "\n"
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
#define MM " "
using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}


main(){
    int a=in(),b=in();
    bool flag=(a==b);
    cout<<(flag?"Yes":"No");
}


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

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int ans;
char S[10];

int main(void) {
    scanf("%s", S);
    REP(i, 0, 4) {
    	if (S[i] == '+') ans++;
    	else ans--;
    }
    printf("%d\n", ans);

	return 0;
}


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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

signed main(){
	while(true){
		int n; cin >> n;
		if(n == 0)break;
		vector<string> strs(n);
		getline(cin, strs[0]);
		for(int i = 0; i < n; i++){
			getline(cin, strs[i]);
		}
		string c;
		cin >> c;
		stringstream ss;
		for(int i = 0; i < n; i++){
			ss << strs[i];
			ss << " ";
		}
		map<string, int> st;
		string tmp;
		while(ss >> tmp){
			if(st.find(tmp) == st.end()) st[tmp] = 0;
			st[tmp]++;
		}
		vector<pair<string, int>> ans;
		for(auto e : st){
			if(e.first[0] == c[0])ans.emplace_back(e);
		}
		if(ans.size() == 0){
			cout << "NA" << endl;
			continue;
		}
		sort(ALL(ans), [](const pair<string, int> a, const pair<string, int> b){
				return a.second != b.second ?  a.second > b.second : a.first < b.first ;
				});
		for(size_t i = 0; i < ans.size(); i++){
			if(i == 5)break;
			if(i != 0)cout << " ";
			cout << ans[i].first;
		}
		cout << endl;
	}


	return 0;
}




Measured memory_bytes: 3220
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main(){
  int a,n;
  cin>>a>>n;
  if(a==n)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100
static const int INFTY = (1<<21);
int n,A[MAX][MAX];

int prim();

int main(){
  int i,j,s;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&s);
      A[i][j]=(s==-1)?INFTY : s;
    }
  }
  printf("%d\n",prim());
  return 0;
}

int prim(){
  int e,min,i,v,sum=0;
  int g[MAX],r[MAX],a[MAX];

  for(i=0;i<n;i++){
    g[i]=INFTY;
    r[i]=-1;
    a[i]=0;
  }
  g[0]=0;

  while(1){
    min=INFTY;
    e=-1;
    for(i=0;i<n;i++){
      if(min>g[i]&&a[i]!=2){
	e=i;
	min=g[i];
      }
    }
    if(e==-1)
      break;
    a[e]=2;
    for(v=0;v<n;v++){
      if(a[v]!=2&&A[e][v]!=INFTY){
	if(g[v]>A[e][v]){
	  g[v]=A[e][v];
	  r[v]=e;
	  a[v]=1;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    if(r[i]!=-1)
      sum+=A[i][r[i]];
  }
  return sum;
}



Measured memory_bytes: 2732
#include <iostream>
#include <iterator>
#include <list>
#include <regex>
#include <string>

using namespace std;

int main(){
    string str;
    cin >> str;
    if(
        regex_match(str, regex(".+keyence")) ||
        regex_match(str, regex("k.+eyence")) ||
        regex_match(str, regex("ke.+yence")) ||
        regex_match(str, regex("key.+ence")) ||
        regex_match(str, regex("keye.+nce")) ||
        regex_match(str, regex("keyen.+ce")) ||
        regex_match(str, regex("keyenc.+e")) ||
        regex_match(str, regex("keyence.+")) ||
        regex_match(str, regex("keyence"))
    ){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define N1 100000
#define N2 10

struct queue{
  char name[N1][N2];
  int time[N1];
  int head;
  int tail;
};
int main(){
  int t,n,q,i;
  struct queue Queue;

  t=0;
  scanf("%d%d",&n,&q);
  Queue.head=0;
  Queue.tail=0;
  for(i=0;i<n;i++){
    scanf("%s%d",Queue.name[i],&Queue.time[i]);
    Queue.tail++;
  }
  i=0;
  
  while(Queue.head!=Queue.tail){
    Queue.time[i]-=q;
    if(Queue.time[i]<=0){
      Queue.head++;
      t=t+q+Queue.time[i];
      printf("%s %d\n",Queue.name[i],t);
    }
    else{
      strcpy(Queue.name[Queue.tail],Queue.name[i]);
      Queue.time[Queue.tail]=Queue.time[i];
      Queue.head++;
      Queue.tail++;
      t+=q;
    }
    i++;
    if(i>=N1){
      i=0;
    }
    if(Queue.head>=N1){
      Queue.head=0;
    }
    if(Queue.tail>=N1){
      Queue.tail=0;
    }
  }

  return 0;
}





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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

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

	ll a[n][n];
	bool f[n][n];

	rep(i,n) rep(j,n) cin >> a[i][j];
	rep(i,n) rep(j,n) f[i][j] = true;
	rep(k,n)rep(i,n)rep(j,n){
		if(chmin(a[i][j], a[i][k] + a[k][j])){
			cout << -1 << endl;
			return 0;
		} else if (a[i][k] + a[k][j] == a[i][j] && i != k && k != j){
			f[i][j] = false;
		}
	}
	ll ans = 0;
	rep(i,n) For(j,i+1,n){
		if(f[i][j]) ans += a[i][j];
	}
	cout << ans << endl;
}


Measured memory_bytes: 4408
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string s;
    cin >> N >> s;
    int cnt = 0;
    REP(i, N) {
        if (s[i] == 'R') {
            cnt++;
        }
    }
    if (cnt > N - cnt) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

#define lli long long int
#define pb push_back
#define in insert
#define pi pair<int, int>
#define pd pair<double, int>
#define pib pair<pi, bool>
#define mp make_pair
#define fir first
#define sec second
#define MAXN 200001
#define MAXL 1000001
#define mod 1000000007

signed main()
{
  // dif dos indices = soma dos carinhas
  // a - b = c + d
  // a = c + d + b
  // a = sum + c
  // sum = a - c
  int n;
  cin >> n;
  vector<lli> v(n);
  vector<lli> sum(n);
  map<lli, lli> freq;
  for (int i = 0; i < n; i++)
  {
    cin >> v[i];
    sum[i] = v[i] + i;
    freq[sum[i]]++;
  }
  lli ans = 0;
  for (int i = 0; i < n; i++)
    ans += freq[i - v[i]];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 29068
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,h,w = LI()
    r = 0
    for _ in range(n):
        a,b = LI()
        if a >= h and b >= w:
            r += 1

    return r


print(main())


Measured memory_bytes: 7364
###
# main
if(__name__ == '__main__'):
    # input
    a, b, n = map(int, input().split(" "))

    mod = n % b
    div = n // b

    x = n
    if div == 0:
        if mod == 0:
            x = n-1
    else:
        if mod == 0:
            x = n-1
        else:
            x = n-mod-1
    
    floor_ax_b = (a * x) // b
    floor_x_b = x // b

    ans = floor_ax_b - a * floor_x_b

    # output
    print(ans)
# else:
    # do nothing


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

Measured memory_bytes: 596
#include<stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main(){
	
	int N;
	scanf("%d",&N);
	char str[N+1];
	scanf("%s",str);
	int max = 0;
	
	for(int i=0;i<N+1;i++){
		int cnt = 0;
		for(int j=0;j<26;j++){
			int flag1 = 0;
			int flag2 =0;
			for(int k=0;k<N;k++){
				if(str[k]=='a'+j){
					if(k<=i)flag1=1;
					else flag2=1;
				}
			}
			if(flag1&&flag2){
				cnt ++;
			}
		}
		if(cnt>max)max=cnt;
	}
	printf("%d",max);
		
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    long long int H;
    cin >> H;

    long long int counter = 0;
    long long int acc = 1;
    while (1) {
        H = H / 2;
        if (H == 0) {
            cout << acc << endl;
            return 0;
        } else {
            counter = counter + 1;
            long long int p = std::pow(2, (counter));
            acc += p;
        }
    }
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;

const int det = -3;

long long C[2000005];

bool ipr[1000005];

vector<int> primelessthanN(int n)
{
	//vector<bool> isprime(n + 1, true);
	vector<int> prime;
	prime.push_back(2);
	int i;
	for (i = 3; i * i <= n; i += 2)
	{
		if (!ipr[i])
		{
			prime.push_back(i);
			for (int j = i * i; j <= n; j += i)
				ipr[j] = true;
		}
	}
	while (i <= n)
	{
		if (!ipr[i])
			prime.push_back(i);
		i += 2;
	}
	return prime;
}
int Cal(int n, int p)
{
	int res = 0;
	long long rec = p;
	while ((long long)n >= rec)
	{
		res += (int)((long long)n / rec);
		rec *= (long long)p;
	}
	return res;
}

const int Mod = 1000000007;
long long PowerMod(int n, int k)
{
	int t(k), n0(n);
	long long res = 1;
	while (t)
	{
		if (t & 1)
			res = (res * (long long)n0) % Mod;
		n0 = (n0 * n0) % Mod;
		t >>= 1;
	}
	return res;
}

long long Cnm(int n, int m)
{
	vector<int> prime = primelessthanN(n);
	long long res = 1;
	for (int i = 0; i < prime.size(); i++)
	{
		res = (res * (PowerMod(prime[i], Cal(n, prime[i]) - Cal(n - m, prime[i]) - Cal(m, prime[i])))) % Mod;
	}
	return res;
}

int main()
{
	int x, y;
	cin >> x >> y;
	int det1 = x - 2 * y;
	int det2 = y - 2 * x;
	if (det1 % det != 0 || det2 % det != 0)
		return cout << 0 << endl, 0;

	int m = det1 / det;
	int n = det2 / det;
	if (m < 0 || n < 0)
		return cout << 0 << endl, 0;
	int s = m + n;
	long long ans = 1LL;
	//C[0] = 1;
	//for (int i = 1; i <= n; i++)
	//	C[i] = (C[i - 1] * (s - i + 1) / i) % (1000000007);
	cout << Cnm(s, (m > n) ? n : m) << endl;
	return 0;
}

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

#define rep(i,N) repv(i,0,N)
#define reps(i,N) repvs(i,0,N)
#define repv(i,a,b) for(int i=a;i<b;i++)
#define repvs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define d(a) if(isDebugMode) cout<<#a<<"="<<a<<","
#define d2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b
#define d3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c
#define d4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d
#define da(arr,N){if(isDebugMode){rep(i,N+1){if(arr[i]==INF)printf("INF ");else cout<<arr[i]<<" ";} cout<<endl;}}
#define da2(arr,N,M){if(isDebugMode)rep(i,N+1){rep(j,M+1){if(arr[i][j]==INF)printf(" INF");else printf(" %3d",arr[i][j]);}cout<<endl;}}
#define pb push_back
#define pob pop_back
#define s(a) cout<<a<<endl;

auto chmax =[](int &a,int b){ a = max(a, b);};
auto chmin =[](int &a,int b){ a = min(a, b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF = 100000000;
const int MOD = 1000000007;
const int dx[4] = { 0, 1, 0,-1};
const int dy[4] = { 1, 0,-1, 0};

bool isDebugMode=1;
//--------------------------------------//
int n;
int z,w,a[2000];

void solve(){
	if(n==1) cout<<abs(a[n-1]-w)<<endl;
	else cout<<max(abs(a[n-1]-a[n-2]),abs(a[n-1]-w))<<endl;
}

int main(){
	cin>>n>>z>>w;
	rep(i,n) {
		cin>>a[i];
	}

	solve();
	return 0;
}


Measured memory_bytes: 256
# 3.2
# input
N = int(input())
#a = [(input()) for i in range(N)]
a = list(map(int, input().split())) # "1 2 3"??¨??\???
print(" ".join(map(str, a)))

for i in range(1, N):
    tmp = a[i]
    j = i - 1
    while j >= 0 and a[j] > tmp:
        a[j + 1] = a[j]
        j -= 1
    
    a[j + 1] = tmp
    print(" ".join(map(str, a)))

Measured memory_bytes: 7640
#include <bits/stdc++.h>
using namespace std;
int a [100001][4];
int pd [100001][4];
int main ()
{
    int n;
    cin>>n;
    for (int i = 1;i<=n;++i)
        for (int j = 1;j<=3;++j)
            cin>>a[i][j];
    pd[1][1] = a[1][1];
    pd[1][2] = a[1][2];
    pd[1][3] = a[1][3];
    for (int i = 2;i<=n;++i)
    {
        for (int j = 1;j<=3;++j)
        {
            int max2 = -1;
            if (j == 1)
                max2 = max (a[i-1][2]+max(pd[i-2][1],pd[i-2][3]),a[i-1][3]+max(pd[i-2][1],pd[i-2][2]));
            if (j == 2)
                max2 = max (a[i-1][1]+max(pd[i-2][2],pd[i-2][3]),a[i-1][3]+max(pd[i-2][1],pd[i-2][2]));
            if (j == 3)
                max2 = max (a[i-1][1]+max(pd[i-2][2],pd[i-2][3]),a[i-1][2]+max(pd[i-2][1],pd[i-2][3]));
            pd[i][j]=a[i][j]+max2;
        }
    }
    int maxfin = -1;
    maxfin = max (pd[n][1],max(pd[n][2],pd[n][3]));
    cout<<maxfin<<'\n';
    return 0;
}


Measured memory_bytes: 3328
h, w = [int(i) for i in input().split()]
grid = []
for _ in range(h):
    grid.append(list(input()))

x = 0
y = 0
while x < h or y < w:
    if x < h - 1 and grid[x + 1][y] == "#":
        grid[x][y] = "."
        x += 1
    elif y < w - 1 and grid[x][y + 1] == "#":
        grid[x][y] = "."
        y += 1
    else:
        break

if x != h - 1 or y != w - 1:
    print("Impossible")
else:
    grid[x][y] = "."
    for line in grid:
        if "#" in line:
            print("Impossible")
            quit()
    print("Possible")


Measured memory_bytes: 62032
import math
n=int(input())
a=list(map(int,input().split()))

l="".join(["o" if i+1==a[i] else "x" for i in range(n)])
sl=l.split("x")
ss=[len(x) for x in sl]
ans=[math.ceil(i/2) for i in ss]
print(sum(ans))

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

int main() {

    int n,x,ite;

    cin >> n >> x;
    int D[n];
    int L[n];


    for (int i = 0; i < n; ++i) {
        cin >> L[i];
    }



    ite = 1;

    D[0] = 0;

    for(int i = 1; i < n+1; i++){
        D[i] = D[i-1] + L[i-1];
        if(D[i] > x)
            break;
        ite += 1;
    }

    cout << ite;


    return 0;
}

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

using namespace std;

#define ll long long

//#define TEST

struct Grid {
private:
	int h, w;
	ll* count; // 3*3のうち、i個塗られたものが何個あるか、を格納
	int dx[3]{ 0,1,2 };
	int dy[3]{ 0,1,2 };
	set<pair<int, int>> b; // 塗りつぶしたマス
	/* 上からy,左からx、を左上に持つ3*3中の黒マス */
	int count_b(int y, int x) {
		if (y > h - 2) return -1;
		if (x > w - 2) return -1;
		if (x <= 0) return -1;
		if (y <= 0) return -1;
		vector<pair<int, int>> sq;
		for (int i = 0; i < 3; ++i)
			for (int j = 0; j < 3; ++j)
				sq.push_back(make_pair(y + dy[i], x + dx[j]));
		int c = 0;
		for (auto sqi : sq) {
			auto iter = b.find(sqi);
			if (iter != b.end())
				++c;
		}
		return c;
	}
	/* 上からy,左からxを塗る */
	void paint(int y, int x) {
		for (int i = 0; i < 3; ++i) {
			for (int j = 0; j < 3; ++j) {
				int c = count_b(y - dy[i], x - dx[j]);
				if (c == -1) continue;
				--count[c];
				++count[c + 1];
			}
		}
		b.insert(make_pair(y, x));
#ifdef TEST
		cout << "----------paint " << y << " " << x << "----------" << endl;
		show();
#endif
	}
	/* countを表示する */
	void show() {
		for (int i = 0; i < 10; ++i)
			cout << count[i] << " ";
		cout << endl;
	}
public:
	Grid(int h, int w) {
		count = new ll[10];
		for (int i = 1; i < 10; ++i)
			count[i] = 0;
		this->h = h;
		this->w = w;
		count[0] = (ll)(h - 2) * (w - 2);
#ifdef TEST
		cout << "----------first----------" << endl;
		show();
#endif
	}
	void solve(vector<pair<int, int>> ab) {
#ifdef TEST
		cout << "----------ans-----------" << endl;
#endif
		for (auto abi : ab)
			paint(abi.first, abi.second);
		for (int i = 0; i < 10; ++i)
			cout << count[i] << endl;
		delete[] count;
	}
};

signed main() {
	int h, w, n;
	cin >> h >> w >> n;

	Grid g(h, w);

	vector<pair<int, int>> ab;
	for (int i = 0; i < n; ++i) {
		int a, b;
		cin >> a >> b;
		ab.push_back(make_pair(a, b));
	}

	g.solve(ab);

	return 0;
}

Measured memory_bytes: 7412
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>

using namespace std;

/// 各桁の和
int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;    
    }
    return sum;
}
/// 最大公約数 
int gcd(int x, int y){
      if(x<y){
          int temp = x;
          x = y;
          y = temp;
      }
      int r = x % y;
       while(r!=0){
           x = y;
           y = r;
           r = x % y;
       }
      return y;
   }



int main(){
int A,B,C;
cin >> A >> B >> C;
int cnt = 0;
for(int i = gcd(A,B); i > 0 ; i-- ){
    if(A % i == 0 && B % i == 0){
        cnt++;
    }
    if(cnt == C){
        cout << i << endl;
        return 0 ;
    }
}

}

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

using namespace std;

int main(){
    int N; cin >> N;
    vector<vector<int>> A(N, vector<int>(2));

    for(int i=0; i<N; i++){
        cin >> A[i][0];
        A[i][1]=i+1;
    }

    sort(A.begin(), A.end());

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

Measured memory_bytes: 6272
#include<bits/stdc++.h>
using namespace std;
int n,tot,k,a[500005],ans[500005],p[500005];
int t[2000005],d[500005],point[1000005],head[500005],nxt[1000005];
priority_queue<int> pq;
void addedge(int x,int y)
{
	d[y]++;
	point[++tot]=y,nxt[tot]=head[x],head[x]=tot;
}
int query(int x,int l,int r,int L,int R)
{
	if(l>R||r<L||L>R||!t[x]) return 0;
	if(l>=L&&r<=R) return t[x];
	int mid=(l+r)>>1;
	return max(query(x<<1,l,mid,L,R),query(x<<1|1,mid+1,r,L,R));
}
void edit(int x,int l,int r,int pos,int val)
{
	t[x]=val;
	if(l==r) return;
	int mid=(l+r)>>1;
	if(pos<=mid) edit(x<<1,l,mid,pos,val);
	else edit(x<<1|1,mid+1,r,pos,val);
}
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		p[x]=i;
	}
	for(int i=1;i<=n;i++)
	{
		int pos=query(1,1,n,max(0,p[i]-k+1),p[i]-1);
		if(pos) addedge(p[i],p[pos]);
		pos=query(1,1,n,p[i]+1,min(p[i]+k-1,n));
		if(pos) addedge(p[i],p[pos]);
		edit(1,1,n,p[i],i);
	}
	for(int i=1;i<=n;i++) if(!d[i]) pq.push(i);
	tot=n;
	while(!pq.empty())
	{
		int x=pq.top();
		pq.pop();
		a[tot--]=x;
		for(int i=head[x];i;i=nxt[i])
		{
			int y=point[i];
			d[y]--;
			if(!d[y]) pq.push(y);
		}
	}
	for(int i=1;i<=n;i++) ans[a[i]]=i;
	for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 27636
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first	
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define INF 1e9
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
ll powe(ll x,ll y){ll res=1;while(y>0){if(y&1)res=res*x;y=y>>1;x=x*x;}return res;}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
void ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mid=(low+high)/2;if(low>high)return;if(ar[mid]>=x){y=mid;ceilsearch(ar,low,mid-1,x,y);}else{ceilsearch(ar,mid+1,high,x,y);}}
int main()
{
	fastio();
	ll N;
	cin>>N;
	ll ar[N];
	cn(ar,N);
	ll m=ar[0];
	ll ans=0;
	for(ll i=0;i<N;i++)
	{
	    if(m>=ar[i])
	        ans++;
	    m=min(ar[i],m);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
//typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;

ll bit[200010];
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

ll sum(ll i)
{
	i += 1;
	ll t = 0;
	while (i > 0)
	{
		t += bit[i];
		i -= i & -i;
	}
	return t;
}

void add(ll i, ll x)
{
	i += 1;
	while (i <= 200005)
	{
		bit[i] += x;
		i += i & -i;
	}
}

/*`ll SAIKI(ll S) {
	for (ll T = S; ; T = (T - 1) & S) {

	}
}*/

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll y) {
	if (y == 0) return 1;
	if (y % 2 == 1) {
		return x * pow_mod(x, y - 1) % mod;
	}
	else {
		ll half = pow_mod(x, y / 2);
		return half * half % mod;
	}
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

/*ll com(ll x, ll y) {
	return kai[x] * div_mod(kai[y] * kai[x - y] % mod) % mod;
	//毎回オーダーlog(n)かかる
}

void kaijo() {
	kai[0] = 1;
	for (ll i = 1; i <= 3004; i++) {
		kai[i] = kai[i - 1] * i % mod;
	}
}*/

ll N, a[200010];
ll ans;

void solve() {
	cin >> N;
	rep(i, N) {
		cin >> a[i];
		add(a[i], 1);
		if (sum(a[i] - 1) == 0) ans++;
	}
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	ll N;
	cin >> N;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL<<60;
using namespace std;
int dp[100001];
vector<vector<int>> vec;
int rec(int k){
    if(dp[k]!=-1){
        return dp[k];
    }else{
        int res=0;
        for(int i=0;i<vec[k].size();i++){
            chmax(res,rec(vec[k][i])+1);
        }
        return dp[k]=res;
    }
}
int main(){
    int n,m;
    cin >> n >> m;
    vec.resize(n);
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        x--;y--;
        vec[x].push_back(y);
    }
    for(int i=0;i<n;i++){
        dp[i]=-1;
    }
    int res=0;
    for(int i=0;i<n;i++){
        chmax(res,rec(i));
       // cout<<rec(i)<<endl;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  string s;
  cin>>s;
  int n=s.size();
  if(n%2==1 && s[0]==s[n-1]) cout<<"Second"<<endl;
  else if(n%2==0 && s[0]!=s[n-1]) cout<<"Second"<<endl;
  else cout<<"First"<<endl;
}

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

using namespace std;
int main(void){
    int H,W,N;
    cin >> W >> H >> N;
    int top=H,bottom=0,left=0,right=W;
    for(int i=0;i<N;++i){
        int x,y,a;
        cin >> x>>y>>a;
        switch(a){
            case 1: left = max(left,x); break;
            case 2: right = min(right,x); break;
            case 3: bottom= max(bottom ,y); break;
            case 4: top = min(top,y); break;
        }
    }
    cout<<max(right-left,0) * max(top-bottom,0);
}

Measured memory_bytes: 256
import math

N, D = [int(i) for i in(input().split(' '))]
in_list = []
for i in range(N):
    l = [int(i) for i in (input().split(' '))]
    in_list.append(l)
count=0
for i in range(N):
    for k in range(i+1,N):
        num = 0
        for j in range(D):
            ab = abs(in_list[i][j]-in_list[k][j])
            num += pow(ab,2)
            if j==D-1:
                if int(math.sqrt(num))==math.sqrt(num):
                    count += 1
print(count)

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

using namespace std;

int main()
{
	string str1, str2, ans;
	int n;

	cin >> n;

	for (int i=0; i<n; i++)
	{
		bool cryflag = false,	//trueのとき繰り上がり
		     overflag = false;	//trueのときoverflow
		ans.clear();
		cin >> str1 >> str2;

		int len1 = str1.size(), len2 = str2.size();

		for (int j=0, k=0; j<len1 || k<len2; j++, k++) {
			int c1 = 0, c2 = 0, c;

			if(j < len1)
				c1 = str1[len1-j-1] - '0';
			if(k < len2)
				c2 = str2[len2-k-1] - '0';

			//cout << len1 << len2;	//Debug

			c = c1 + c2;

			if(cryflag) {
				c++;
				cryflag = false;
			}

			if(c>=10)	cryflag = true;

			ans += c%10 + '0';

			//cout << len1 << len2;	//Debug

			if(ans.size() > 80 || (ans.size() == 80 && cryflag))	{
				overflag = true;
				break;
			}
		}

		if(overflag) {
			cout << "overflow";
		}
		else {
			if(cryflag)	cout << "1";
			for (int i=0; i<(int)ans.size(); i++) {
				cout << ans[ans.size()-i-1];
			}
		}

		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1200
#include<stdio.h>
#include<stdlib.h>
#define true 0
#define false 1

int solve(int, int);
int n, q;
int A[20];

int main(){
  int i;
  int m[200];
  int sol;

  scanf("%d", &n);
  if(20 < n)
    exit(0);
  
  for(i = 0; i < n; i++){
    scanf("%d", &A[i]);
    if(A[i] < 1 || 2000 < A[i])
      exit(1);
  }

  scanf("%d", &q);
  if(200 < q)
    exit(2);
  
  for(i = 0; i < q; i++){
    scanf("%d", &m[i]);
    if(m[i] < 1 || 2000 < m[i])
      exit(3);
  }

  for(i = 0; i < q; i++){
    sol = solve(0, m[i]);
    if(sol == true)
      printf("yes\n");
    else if(sol == false)
      printf("no\n");
  }

  return 0;
}

int solve(int i, int m){
  int res;

  if(m == 0)
    return true;
  if(n <= i)
    return false;

  res = solve(i+1, m);
  if(res == true)
    return res;
  res = solve(i+1, m-A[i]);
  if(res == true)
    return res;
}

Measured memory_bytes: 580
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        double a = scan.nextDouble(), b = scan.nextDouble(), C = scan.nextDouble();
        double rad,s, l, h;

        rad = C * Math.PI / 180 ;

        s = a * b * Math.sin(rad) / 2 ;
        l = a + b + Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(rad));
        h = 2 * s / a ;

        System.out.printf("%8f\n%8f\n%8f",s, l, h);
    }
}

Measured memory_bytes: 28144