akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define forn(x, n)              for (int x = 0; x < n; x++)
#define forr(x, n)              for (int x = n; x >= 0; x--)
#define fore(x, a, b, c)        for (int x = a; x <= b; x += c)
#define forre(x, a, b, c)       for (int x = a; x >= b; x -= c)
#define clr                     cin.ignore(numeric_limits<streamsize>::max(), '\n')
#define all(container)          (container).begin(), (container).end()
#define rall(container)         (container).rbegin(), (container).rend()
#define tracev(v)               for (auto& x: v) cerr << x << " "; cerr << '\n';
#define trace2v(v)              for (auto& x: v) cerr << x.fi << " - " << x.se << '\n'; cerr << '\n';
#define FILL(x, val)            memset(x, val, sizeof(x))
#define pb                      push_back
#define eb                      emplace_back
#define fi                      first
#define se                      second
#define mod                     (int)1000000007
#define INF                     (int)0x3f3f3f3f

using namespace std;

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

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }  

typedef long long ll; 
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifndef ONLINE_JUDGE
    freopen("errlog", "w", stderr);
#endif
    int h, n, temp; cin >> h >> n;
    int ans = 0;
    forn(i, n) {
        cin >> temp;
        ans += temp;
    }
    if (ans >= h) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  private static final Scanner in = new Scanner(System.in);

  public static void main(String[] args) {
    int n = in.nextInt();
    int l = in.nextInt();
    String[] arr = new String[n];
    for (int i = 0; i < n; i++) {
      arr[i] = in.next();
    }
    solve(arr);
  }

  private static void solve(String[] arr) {
    StringBuilder res = new StringBuilder();
    Arrays.sort(arr);
    for (String s : arr) {
      res.append(s);
    }
    System.out.println(res);
  }


}


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amin(T& a,T b){ a=min(a,b);}
template <class T> void amax(T& a,T b){ a=max(a,b);}

int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, m;
	cin >>n >>m;
	VI x(m),y(m);
	rep(i,m) cin >>x[i];
	
	if(n >= m){ puts("0"); return 0;}
	sort(all(x));
	int cp=  x[0];
	rep(i,m) y[i] = x[i] - cp;
	//for(auto x :y) printf("%d, ",x); puts("");
	vector<pii> cm(m-1);
	rep(i,m-1) cm[i] = pii(y[i+1] - y[i], i+1);
	sort(cm.rbegin(), cm.rend());
	VI ct;
	rep(i, n-1){
		ct.push_back(cm[i].second);
	}
	sort(all(ct));
	int lf=0;
	ll ans =0;
	ct.push_back(m);
	//for(auto x :ct) printf("%d, ",x); puts("");
	rep2(i, 0, sz(ct)){
		int cr=ct[i];
		ans += y[cr-1] - y[lf];
		lf = cr;
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 2428
import math
import numpy as np

#line = input().split()
#N = int(line[0])
N = int(input())
line = input().split()
A = [int(a) for a in line]


min_ = 1e9
max_ = 1

for a in A:
    max_ = max(max_, a)
    min_ = min(min_, a)

print(max_-min_)


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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}

int main(void){
    lli w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << fixed << setprecision(10) << w*h/2.0 << endl;
    if(2*x == w && 2*y == h) cout << "1" << endl;
    else cout << "0" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	string t;
	cin>>t;
	int n=s.length();
	string a="Yes";
	for(int i=0;i<n;i++)
	{
		if(s[i]!=t[i])
		{
			a="No";
			break;
		}
	}
	cout<<a;
	
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a[4]={},cnt1=0,cnt2=0;
  for(int i=0;i<6;i++){
    int b;
    cin >> b;
    a[b-1]++;
  }
  for(int i=0;i<6;i++){
    if(a[i]==1) cnt1++;
    if(a[i]==2) cnt2++;
  }
  if(cnt1==2&&cnt2==2) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <set>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>
void println(T x)
{
	std::cout << x << "\n";
}
signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	int d = c - a - b;
	if (d > 0 && (d*d- 4 * a*b) > 0)print("Yes");
	else print("No");
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstring>
const int MaxN = 200000;
int K, N;
int A[MaxN + 5];
int main() {
  scanf("%d %d", &K, &N);
  for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
  int mx = 0;
  for (int i = 2; i <= N; ++i) mx = std::max(mx, A[i] - A[i - 1]);
  mx = std::max(mx, A[1] + K - A[N]);
  printf("%d\n", K - mx);
  return 0;
}

Measured memory_bytes: 1024
S = input().split('LR')
S[0] = S[0][1:]
S[-1] = S[-1][:-1]

ans = []
for s in S:
    s = 'R'+s+'L'
    l = [0]*len(s)
    c = s.find('RL')
    if len(s) % 2 == 0:
        l[c] = len(s)//2
        l[c+1] = len(s)//2
        ans.extend(l)
    else:
        l[c] = len(s)//2+(1-c % 2)
        l[c+1] = len(s)//2+(c % 2)
        ans.extend(l)

print(*ans)


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

int main(){
    int N, A, B; cin >> N >> A >> B;
    vector<int> P(N);
    for (auto& p : P) cin >> p;
    vector<int> a;
    vector<int> b;
    vector<int> c;
    for (int i = 0; i < N; i++) {
        if (P[i] <= A) a.push_back(P[i]);
        else if (P[i] <= B) b.push_back(P[i]);
        else c.push_back(P[i]);
    }
    int w = a.size(), e = b.size(), r = c.size();
    int ans = min(min(w, e), r);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
const int mod=1e9+7;
ll fun(ll x, ll y){
    if(y==0) return 1;
    ll g=fun(x,y/2);
    g*=g;
    g%=mod;
    if(y&1) g*=x;
    return g%mod;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n;
    cin>>n;
    unordered_map<string,bool> m;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        m[s]=true;
    }
    cout<<m.size()<<'\n';
}

Measured memory_bytes: 17700
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo LLONG_MAX
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

2e5*2e5
*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  ll N; cin >> N;
  vector<ll> A(N, 0);
  vector<ll> use(1e6+10, 0);
  rep(i, N) cin >> A[i];
  sort(all(A));
  rep(i, N){
    ll j = 1;
    if (use[A[i]]){
      use[A[i]]++;
      continue;
    }
    while (A[i] * j <= 1e6){
      use[A[i]*j]++;
      j++;
    }
  }
  ll ans = 0;
  rep(i, N){
   if (use[A[i]] == 1)
     ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 12676
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	int a;
	cin >> a;
	cout << (a == 3 || a == 5 || a == 7 ? "YES" : "NO") << endl;

	return 0;
}

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

int N,M,Q;
const int maxQ = 50;
vector<int> A(maxQ),B(maxQ),C(maxQ),D(maxQ);

void solve(vector<int> &V, int &ans, int i){
  for(int j=V[i-1];j<=M;j++){
    V[i] = j;
    if(i!=N-1) solve(V,ans,i+1);
    else{
      int score=0;
      for(int k=0;k<Q;k++){
        if(V[B[k]-1] - V[A[k]-1] == C[k]) score += D[k];
      }
      ans = max(ans,score);
    }
  }
}

int main(){
  cin >> N >> M >> Q;
  for(int i=0;i<Q;i++) cin >> A[i] >> B[i] >> C[i] >> D[i];
  
  vector<int> V(N,1);
  int ans=0;
  for(int i=1;i<=N;i++){
    V[0] = i;
    solve(V,ans,1);
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		int c = saori.saori_hayami();
		String ans = "NO";
		for (int i = 1; i <= b; i++) {
			if ((a * i) % b == c) {
				ans = "YES";
				break;
			}
		}
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if ( A == B && A != C ) {
    cout << "Yes" << endl;
  }
  else if ( A == C && A != B ) {
    cout << "Yes" << endl;
  }
  else if ( C == B && A != C ) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long;
const ll MOD=1000000007,MOD2=998244353;



int main() {
    string S;
    cin>>S;
    vector<string> wea={"Sunny","Cloudy","Rainy","Sunny"};
    rep(i,3){
        if(S==wea.at(i)){
            cout<<wea.at(i+1)<<endl;
        }
    }
}

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

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

  double a, b, c, d, e, f;

  while (cin >> a, cin >> b, cin >> c, cin >> d, cin >> e, cin >> f) {
    printf("%.3f %.3f\n", (c * e - f * b) / (a * e - d * b) + 0, (c * d - f * a) / (b * d - e * a) + 0);
  }

  return 0;
}

Measured memory_bytes: 1260
#include<stdio.h>

int main(){
  int a,b,c,d,e,k;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &e);
  scanf("%d", &k);

  if(b-a>k||c-a>k||d-a>k||e-a>k||c-b>k||d-b>k||e-b>k||d-c>k||e-c>k||e-d>k){
    printf(":(");
  }else{
    printf("Yay!");
  }
  return 0;
}

Measured memory_bytes: 128
n = int(input())
s = [int(input()) for _ in range(n)]
ans = sum(s)
if ans % 10 == 0:
    s.sort(reverse=True)
    while s:
        a = s.pop()
        if a % 10 != 0:
            ans -= a
            break
    else:
        ans = 0
print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<cmath>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int N, W;
    cin >> N >> W;
    ll w[N], v[N];
    rep(i,N) cin >> w[i] >> v[i];

    ll dp[N+1][W+1];
    rep(i,N+1)rep(j,W+1) dp[i][j] = 0;
    
    // dp[i][j] = i番目までの品物から重さの総和がj以下になるように選んだときの価値の最大値
    rep(i,N)rep(j,W+1) {
        if (w[i] > j) dp[i+1][j] = dp[i][j];
        else dp[i+1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
    }
    
    cout << dp[N][W] << endl;
    return 0;
}

Measured memory_bytes: 79104
#[allow(unused_imports)]
use {
    proconio::{fastout, input, marker::*},
    rand::Rng,
    std::cmp::*,
    std::collections::*,
    std::ops::*,
};

const K: usize = 40;

fn main() {
    input! {
        n: usize,
        k: usize,
        a: [usize; n]
    }
    let mut nums = vec![0; K];
    for &a in a.iter() {
        for i in 0..K {
            if (a >> i) & 1 == 1 {
                nums[i] += 1;
            }
        }
    }
    let mut at = vec![0; K + 1];
    let mut bt = vec![0; K + 1];
    for i in 0..K {
        at[i + 1] = at[i] + max(nums[i], n - nums[i]) * (1 << i);
        if k >> i & 1 == 0 {
            bt[i + 1] = bt[i] + nums[i] * (1 << i);
        } else {
            bt[i + 1] = bt[i] + (n - nums[i]) * (1 << i);
        }
    }
    let mut ans = bt[K];
    for i in 0..K {
        if ( k >> i ) & 1 == 1 {
            let score = at[i] + nums[i] * (1 << i) + bt[K] - bt[i + 1];
            ans = max(ans, score);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 3968
class segmentTreeOR():
    initValue = 0
    dat = []
    lenTreeList = -1
    depthTreeList = 0
    lenOriginalList = -1

    def __init__(self):
        pass

    def load(self, l):
        # len(l)個よりも大きい2の二乗を得る
        self.lenOriginalList = len(l)
        self.lenTreeList = 2 ** (len(l) - 1).bit_length()  # len 5 なら 2^3 = 8
        self.depthTreeList = (len(l) - 1).bit_length()  # 木の段数(0 origin)
        self.dat = [self.initValue] * (self.lenTreeList * 2)
        # 値のロード
        for i in range(len(l)):
            self.dat[self.lenTreeList - 1 + i] = l[i]
        self.build()

    def build(self):
        for i in range(self.lenTreeList - 2, -1, -1):
            self.dat[i] = self.dat[2 * i + 1] | self.dat[2 * i + 2]

    def setValue(self, i, a):
        """
        set a to list[i]
        """
        # print("setValue: {0}, {1}".format(i, a))
        nodeId = (self.lenTreeList - 1) + i
        # print(" first nodeId: {0}".format(nodeId))
        self.dat[nodeId] = a
        while nodeId != 0:
            nodeId = (nodeId - 1) // 2
            # print(" next nodeId: {0}".format(nodeId))
            self.dat[nodeId] = self.dat[nodeId * 2 + 1] | self.dat[nodeId * 2 + 2]

    def querySub(self, a, b, nodeId, l, r):
        """
        [a,b) 区間の親クエリに対するノードnodeへ[l, r)の探索をデリゲート
        区間については、dataの添え字は0,1,2,3,4としたときに、
        [0,3)なら0,1,2の結果を返す
        """
        # print("querySub: a={0}, b={1}, nodeId={2}, l={3}, r={4}".format(a, b, nodeId, l, r))
        if (r <= a or b <= l):
            return self.initValue
        if a <= l and r <= b:
            return self.dat[nodeId]
        resLeft = self.querySub(a, b, 2 * nodeId + 1, l, (l + r) // 2)
        resRight = self.querySub(a, b, 2 * nodeId + 2, (l + r) // 2, r)
        return resLeft | resRight

    def query(self, a, b):
        return self.querySub(a, b, 0, 0, self.lenTreeList)

### ここまでライブラリ ###

n = int(input())
s = input()
sl = list(s)
sl = list(map(lambda x: ord(x) - ord("a"), sl))
l = list(map(lambda x: 1 << x, sl))
st = segmentTreeOR()
st.load(l)

q = int(input())
for _ in range(q):
    ty, x, y = input().split()
    x = int(x)
    if ty == "1":
        nind = ord(y[0]) - ord("a") # 置き換える文字のaからの距離
        st.setValue(x-1, 1 << nind)
    elif ty == "2":
        x = int(x) - 1 # 1 origin -> 0 origin
        y = int(y)  # こっちは開区間なのでこのまま
        res = 0
        cnt = st.query(x, y)
        print(bin(cnt).count("1")) # popcount()
    else:
        print("error")

Measured memory_bytes: 120064
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;

bool ps1(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first昇順
	return forall_a_in_P.first < forall_b_in_P.first;
}
bool ps2(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first降順
	return forall_a_in_P.first > forall_b_in_P.first;
}
bool ps3(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second昇順
	return forall_a_in_P.second < forall_b_in_P.second;
}
bool ps4(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second降順
	return forall_a_in_P.second > forall_b_in_P.second;
}
int main(){
	int n;
    cin>>n;
    vector<pair<int,int>>a(n);
    rep(i,n){
        cin>>a[i].first;
        a[i].second=i;
    }
    sort(all(a),ps1);
    rep(i,n){
        cout<<a[i].second+1;
        if(i==n-1){
            cout<<endl;
        }else{
            cout<<" ";
        }
    }
}



Measured memory_bytes: 1664
#include<iostream>
#include<string>
using namespace std;
int sum[100010];
int main()
{
	string a;
	cin >> a;
	int t = a.size();
	for (int i = 0; i < t; i++)
	{
		if (a[i] == '1')
			sum[i]++;
		if (i)
			sum[i] += sum[i - 1];
	}
	if (sum[t - 1] == t || sum[t - 1] == 0)
	{
		printf("%d", t);
		return 0;
	}
	for (int i = 1; i < t; i++)
	{
		if (sum[t - i-1] - sum[i - 1] == t - i * 2 || sum[t - i-1] - sum[i - 1] == 0)
		{
			printf("%d", t - i);
			return 0;
		}
	}
}

Measured memory_bytes: 896
#include<stdio.h>
#include<string>
#include<string.h>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>
#include <cmath>
#include <limits>
#include <numeric>
#include <cmath>
#include <limits>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    int done[100005]={};
    int was[100005]={};
    char s[5];
    int p;
    int ac=0;
    int wa=0;
    REP(i,m){
        scanf("%d%s",&p,s);
        if(done[p]==0){
            if(s[0]=='A'){
                done[p]=1;
                ac++;
            }
            else if(s[0]=='W'){
                was[p]++;
            }
        }
    }
    REP(i,n+1)wa+=was[i]*done[i];
    printf("%d %d\n",ac,wa);
    return 0;
}

Measured memory_bytes: 1024
N,Y = map(int,input().split())
Y //= 1000
t = Y-N
for i in range(t+1):
    if i % 4 == 0 and (t-i)%9 == 0:
        a,b = (t-i)//9,i//4
        c = N-a-b
        if c >= 0:
            print(a,b,c)
            exit()
print(-1,-1,-1)

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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

ll solve(ll N) {
    ll ans = 0;
    ll sq = sqrt(N);
    for (ll x=1; x <= sq+3; ++x) {
        if (N % x) continue;
        ll m = N / x - 1;
        if (x >= m) {
            break;
        }
        ans += m;
    }
    return ans;
}

int main() {
    ll N; cin >> N;
    cout << solve(N) << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

int dp[1010][3010];
signed main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  while(true) {
    int n;
    cin >> n;
    if(!n) break;
    VI r(n), w(n);
    int sumr = 0, sumw = 0;
    int ma=0, idx=-1;
    REP(i, n) {
      cin >> r[i] >> w[i];
      if(ma < r[i]) {
        ma = r[i];
        idx = i;
      }
      sumr += r[i];
      sumw += w[i];
    }

    if(ma <= sumr - ma) {
      cout << sumr + sumw << endl;
    } else {
      // r.back() - (sumr - r.back()) = 2*r.back() - sumr にできるだけ近づける
      memset(dp, 0, sizeof(dp));
      dp[0][0] = 1;
      REP(i, n) REP(j, 2*ma-sumr+1) {
        dp[i+1][j] |= dp[i][j];
        if(j+w[i] <= 2*ma-sumr && i != idx) dp[i+1][j+w[i]] |= dp[i][j];
      }

      int tmp = -1;
      REP(i, 2*ma-sumr+1) if(dp[n][i]==1) chmax(tmp, i);

      cout << ma*2 + sumw - tmp << endl;
    }
  }

  return 0;
}



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

int main(void)
{
    int a,b;
    cin >> a >> b;
    int x = b - a;
    int sum=0;
    for(int i=1; i<x; i++){
        sum += i;
    }
    sum -= a;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

#include<stdio.h>

using namespace std;

int main() {

   double a, b, c, d, e, f, x, y;

   while (cin >> a >> b >> c >> d >> e >> f) {

       x = (b*f - e * c) / (b*d - a * e);

       y = (a*f - d * c) / (a*e - b * d);

       x = int(1000 * x + 2 * (1000 * x - int(1000 * x))) / 1000.0;

       y = int(1000 * y + 2 * (1000 * y - int(1000 * y))) / 1000.0;

       printf("%.3lf %.3lf\n", x, y);

   }

}


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

int main()
{
    ll N;
    cin >> N;
    vector<ll> C(N);
    vector<ll> S(N);
    vector<ll> F(N);

    for(ll i = 0; i < N-1; i++)
    {
        cin >> C.at(i) >> S.at(i) >> F.at(i);
    }

    
    for(ll i = 0; i < N-1; i++)
    {
        ll time = 0;
        for(ll j = i; j < N-1; j++)
        {
            while(time < S[j] || time % F[j] != 0)
            {
                time++;
            }
            time += C[j];
        }
        cout << time << endl;
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b;cin>>a>>b;
  long long x,y;
  if(a%4==0)x=a;
  if(a%4==1)x=1;
  if(a%4==2)x=a+1;
  if(a%4==3)x=0;
  if(b%4==0)y=b;
  if(b%4==1)y=1;
  if(b%4==2)y=b+1;
  if(b%4==3)y=0;
  long long u=x^y;
  u=u^a;
  cout<<u<<endl;
}

Measured memory_bytes: 256
from itertools import permutations
from math import sqrt, pow, factorial
 
# 座標 a から b の距離を求める
def calc(a, b):
    x1, y1 = a
    x2, y2 = b
    return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2))
 
 
n = int(input())
xy = []
for i in range(n):
    xy.append(list(map(int, input().split())))
 
ans = 0
for order in permutations(range(n)):
    tmp = 0
    for i in range(1, n):
        tmp += calc(xy[order[i]], xy[order[i - 1]])
    ans += tmp
ans /= factorial(n)
 
print(ans)

Measured memory_bytes: 41068
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    string s;
    int k;
    cin >> s >> k;
    int n = s.size();

    vector<string> sub;

    for(int i = 0; i <= 5; i++){
        rep(j, n-i) sub.push_back(s.substr(j, i+1));
    }
    sort(sub.begin(), sub.end());
    unique(sub.begin(), sub.end());

    cout << sub[k-1] << endl;

    return 0;
}


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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 1 << 20;
int dp[N][2];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	string s;
	cin >> s;
	s = "0" + s;
	for(auto& i: s) i -= '0';
	
	FOR(i, 0, N) FOR(j, 0, 2) dp[i][j] = INF;
	
	dp[0][0] = 0;
	dp[0][1] = 1;
	
	FOR(i, 0, SZ(s) - 1)
		FOR(j, 0, 2)
		{
			int cost = s[i + 1];
			if (j) cost = 9 - cost;
			setmin(dp[i + 1][j], dp[i][j] + cost);
			setmin(dp[i + 1][j ^ 1], dp[i][j] + cost + 1);
		}
	
	cout << min(dp[SZ(s) - 1][0], dp[SZ(s) - 1][1] + 1) << endl;
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 9672
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>

int N;
int64_t T;
int S, E;

struct edge_t {
	int to;
	int64_t w;
};

int edgeCounts[114514];
struct edge_t* edges[114514];
int parents[114514];
int parentEdges[114514];

int hasimotokannna(const void* x, const void* y) {
	struct edge_t a = *(const struct edge_t*)x, b = *(const struct edge_t*)y;
	int64_t aa = a.w - T * (edgeCounts[a.to] - 1);
	int64_t bb = b.w - T * (edgeCounts[b.to] - 1);
	return aa < bb ? -1 : aa > bb;
}

void addEdge(int from, int to, int64_t w) {
	int* c = &edgeCounts[from];
	struct edge_t** e = &edges[from];
	struct edge_t* ne = realloc(*e, sizeof(**e) * (*c + 1));
	if (ne == NULL) exit(2);
	ne[*c].to = to;
	ne[*c].w = w;
	(*c)++;
	*e = ne;
}

void dfs(int node, int parent) {
	int i;
	parents[node] = parent;
	for (i = 0; i < edgeCounts[node]; i++) {
		int next = edges[node][i].to;
		if (next != parent) dfs(next, node);
	}
}

int damage[114514];
int got[114514];
int gotCount = 0;

int ikeru(int from, const struct edge_t* edge) {
	return edge->w - T * (damage[from] + damage[edge->to]) > 0;
}

int edgeSinchoku[114514];

int main(void) {
	int i;
	int current;
	if (scanf("%d%" SCNd64 "%d%d", &N, &T, &S, &E) != 4) return 1;
	for (i = 1; i < N; i++) {
		int a, b;
		int64_t w;
		if (scanf("%d%d%" SCNd64, &a, &b, &w) != 3) return 1;
		addEdge(a, b, w);
		addEdge(b, a, w);
	}
	for (i = 1; i <= N; i++) {
		qsort(edges[i], edgeCounts[i], sizeof(edges[i][0]), hasimotokannna);
	}
	dfs(E, 0);
	for (i = 1; i <= N; i++) {
		int j;
		parentEdges[i] = -1;
		for (j = 0; j < edgeCounts[i]; j++) {
			if (edges[i][j].to == parents[i]) parentEdges[i] = j;
		}
	}
	current = S;
	damage[S] = -1;
	for (;;) {
		if (!got[current]) {
			got[current] = 1;
			gotCount++;
		}
		damage[current]++;
		if (gotCount < N) {
			for (;;) {
				if (edgeSinchoku[current] == parentEdges[current]) {
					edgeSinchoku[current]++;
				} else if (edgeSinchoku[current] < edgeCounts[current]) {
					int next = edges[current][edgeSinchoku[current]].to;
					if (got[next]) {
						edgeSinchoku[current]++;
					} else if (ikeru(current, &edges[current][edgeSinchoku[current]])) {
						edgeSinchoku[current]++;
						current = next;
						break;
					} else {
						puts("No");
						return 0;
					}
				} else {
					if (ikeru(current, &edges[current][parentEdges[current]])) {
						current = edges[current][parentEdges[current]].to;
						break;
					} else {
						puts("No");
						return 0;
					}
				}
			}
		} else {
			if (current == E) {
				puts("Yes");
				return 0;
			} else {
				if (ikeru(current, &edges[current][parentEdges[current]])) {
					current = edges[current][parentEdges[current]].to;
				} else {
					puts("No");
					return 0;
				}
			}
		}
	}
}

/*

5 1 1 2
1 3 9999
1 4 2
1 5 9999
1 2 9999

*/

/*

6 1 1 2
1 2 9999
1 3 3
1 4 4
4 5 9999
4 6 9999

*/



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

struct Edge {int a, b, c, d;};
int N, M, Q;
vector<vector<Edge>> G;

int score(auto& A) {
  int res = 0;
  for(auto& E: G) for(auto& e: E) if(A[e.b] - A[e.a] == e.c) res += e.d;
  return res;
}
int dfs(auto i, auto A) {
  if(i == N) return score(A);
  auto res = 0;
  for(auto j=A[i-1]; j<=M; ++j) {
    A[i] = j;
    res = max(res, dfs(i+1, A));
  }
  return res;
}
int main() {
  cin >> N >> M >> Q;
  G.resize(N);
  for(auto i=0; i<Q; ++i) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    --a; --b;
    G[b].push_back({a, b, c, d});
  }
  cout << dfs(1, vector<int>(N,1)) << endl;
}


Measured memory_bytes: 3596
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;

#define mp make_pair
#define pb push_back
#define x first
#define y second

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

char s[110],t[110];

int main()
{
	int n;scanf("%d",&n);
	scanf("%s",s);scanf("%s",t);
	int ans=n;
	for (int i=0;i<n;i++)
	{
		bool ok=1;
		for (int j=0;j<n-i;j++) if (t[j]!=s[i+j]) ok=0;
		if (ok) {ans=i;break;}
	}
	printf("%d\n",ans+n);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>

#define ll long long
#define ull unsigned long long
#define mod 1000000007

using namespace std;

struct node{
    ll count;
    vector<int> cNodes;
};

node nodes[200000];

void countIncrease(int t, ll x){
    nodes[t].count += x;
    for(int i = 0; i < nodes[t].cNodes.size(); i++){
        countIncrease(nodes[t].cNodes[i] - 1, nodes[t].count);
    }
}

int main() {
    unsigned int n, q;
    cin >> n >> q;
    for(int i = 0; i < n-1; i++){
        nodes[i].count = 0;
        int a, b;
        cin >> a >> b;
        nodes[a-1].cNodes.push_back(b);
    }

    for(int i = 0; i < q; i++){
        int p;
        ll x;
        cin >> p >> x;

        nodes[p-1].count += x;
    }

    countIncrease(0, 0);

    cout << nodes[0].count;
    for(int i = 1; i < n; i++){
        cout << " " << nodes[i].count;
    }

    cout << endl;
}

Measured memory_bytes: 21120
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n=gi

require 'prime'

ar=[]
np=n.prime_division
# np.each do |a,b|
#   temp=[1]
#   b.times do |i|
#     temp<<a*(i+1)
#   end
#   ar<<temp
# end

def div(pr,k=0)
  Enumerator.new do |en|
    if pr.size == k
      en << 1
    else
      p,e = pr[k]
      div(pr,k+1).each do |d|
        (e+1).times do |e1|
          en << (p**e1) * d
        end
      end
    end
  end
end

divs=div(np).to_a.sort

#puts divs.to_s

sq=Math.sqrt(n).to_i
res=1
divs.each do |d|
  if d<=sq
    res=d
  else
    break
  end
end

puts res+(n/res)-2

Measured memory_bytes: 4476
n,k = (int(i) for i in input().split())
x = list(int(i) for i in input().split())
res = 1000000000
for i in range(n-k+1):
    xl = x[i]
    xr = x[i+k-1]
    tmp = min(abs(xl)+abs(xr-xl), abs(xr)+abs(xr-xl))
    res = min(res,tmp)
print(res)

Measured memory_bytes: 14224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define LIMIT 1000000007 //10^9+7
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()

namespace /* debug */{
  #define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
  #define ldebug(...) do{cout<<"["<<setw(3)<<__LINE__<<"] ";debug(__VA_ARGS__);}while(0) //行数
  #define lDEBUG(...) do{cout<<"["<<setw(3)<<__LINE__<<"] "<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数, 行数
  template<class T>void show(T&x){cout<<x<<" ";} //出力
  template<class T>void showendl(T&x){cout<<x<<endl;} //出力改行
  template<class P,class Q>void show(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<") ";} //pair出力
  template<class P,class Q>void showendl(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<")"<<endl;} //pair出力改行
  template<class H>void debug(H&&h){showendl(h);} //引数1つ
  template<class H,class...Ts>void debug(H&&h,Ts&&...ts){show(h);debug(forward<Ts>(ts)...);} //可変引数
  template<class T>void debug(vector<T>&vt){int i=0;for(auto x:vt)++i!=vt.size()?show(x):showendl(x);} //vector出力
  template<class T>void debug(initializer_list<T>init){int i=0;for(auto x:init)++i!=init.size()?show(x):showendl(x);} //初期化子リスト出力
}

int main(){
	string S;cin>>S;
  vi z(S.size());

  z[0] = (S[0]=='A'||S[0]=='T'||S[0]=='G'||S[0]=='C')?1:0;
  for(int i=1; i<S.size(); i++){
    z[i] = (S[i]=='A'||S[i]=='T'||S[i]=='G'||S[i]=='C')?z[i-1]+1:0;
  }

  cout<<*max_element(all(z))<<endl;
}

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

int main(int argc, char *argv[]) {
  int h, w;
  std::cin >> h >> w;
  std::vector<std::vector<char>> a(h + 2, std::vector<char>(w + 2));
  for (int i = 0; i <= h + 1; ++i)
    for (int j = 0; j <= w + 1; ++j) {
      if (i == 0 || j == 0 || i == h + 1 || j == w + 1) {
        a.at(i).at(j) = '#';
        continue;
      }
      char c;
      std::cin >> c;
      a.at(i).at(j) = c;
    }

  for (int i = 0; i <= h + 1; ++i) {
    for (int j = 0; j <= w + 1; ++j) {
      std::cout << a.at(i).at(j);
      if (j == w + 1)
        std::cout << std::endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	lli n,m;
	cin>>n>>m;

	if(n==m){
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;

	return 0;
}

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

signed main(){
	int n, ans = 0; cin>>n;
	string s; cin>>s;
	int i = 0, j = n-1;
	while(i <= j){
		while(s[i] == 'R')
			i++;
		while(s[j] == 'W')
			j--;
		if(i < j && s[i] == 'W' && s[j] == 'R'){
			swap(s[i], s[j]);
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3756
def q(a, N):
    if 2 not in a:
        return -1
    count = 0
    i = 0
    while count < N:
        m = a[i]
        count += 1
        if m == 2:
            return count
        i = m - 1
    return -1

N = int(input())

a = []

for _ in range(N):
    a.append(int(input()))

print(q(a, N))    

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

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
using ll = long long;
using P = pair<int,int>;

// code starts
int main()
{
  int r,c,k;
  cin >> r >> c >> k;
  vector<int> h(k);
  vector<int> w(k);
  vector<int> v(k);
  int i,j,l;
  rep(i,k) cin >> h[i] >> w[i] >> v[i];
  vector<vector<int>> val(r,vector<int>(c,0));
  rep(i,k)
  {
    val[h[i]-1][w[i]-1] = v[i];
  }
  vector<vector<vector<ll>>> dp(r,vector<vector<ll>>(c,vector<ll>(4,0)));
  rep(i,r)rep(j,c)rep(l,4)
  {
    if(l+1 < 4)
    {
      if(j+1 < c) dp[i][j+1][l+1] = max(dp[i][j+1][l+1],dp[i][j][l]+val[i][j]);
      if(i+1 < r) dp[i+1][j][0] = max(dp[i+1][j][0],dp[i][j][l]+val[i][j]);
    }
    if(j+1 < c) dp[i][j+1][l] = max(dp[i][j+1][l],dp[i][j][l]);
    if(i+1 < r) dp[i+1][j][0] = max(dp[i+1][j][0],dp[i][j][l]);
  }
  ll ans = 0;
  rep(l,4)
  {
    if(l<3) ans = max(ans,dp[r-1][c-1][l]+val[r-1][c-1]);
    else ans = max(ans,dp[r-1][c-1][l]);
  }
  /*rep(i,r)
  {
    rep(j,c)
    {
      cout << '(';
      rep(l,3)
      {
        cout << dp[i][j][l] << ' ';
      }
      cout << ") ";
    }
    cout << endl;
  }*/
  cout << ans << endl;
}


Measured memory_bytes: 673956
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,a,b,c,d;
cin>>n;
a=n/1000,b=n%1000/100,c=n%100/10,d=n%10;
if(a+b+c+d==7) cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
else if(a+b+c-d==7) cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
else if(a+b-c+d==7) cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
else if(a+b-c-d==7) cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
else if(a-b+c+d==7) cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
else if(a-b+c-d==7) cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
else if(a-b-c+d==7) cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
else if(a-b-c-d==7) cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
	return 0;
}

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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T> constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()

template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& a) { return is >> a.first >> a.second; }
template<typename T> istream& operator>>(istream& is, vector<T>& a) { for (T& x : a) is >> x; return is; }

void LOG(const int& x) { cerr << x << "\n"; }
void LOG(const vector<int>& a) { for (int x : a) cerr << x << " "; cerr << "\n"; }
template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }
template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }

i64 ceil(i64 a, i64 b) { return (a - 1) / b + 1; }
i64 gcd(i64 a, i64 b) { while (b != 0) { i64 t = b; b = a % b; a = t; } return a; }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
i64 gcd(const vector<i64>& v) { return accumulate(ALL(v), 1LL, static_cast<i64(*)(i64, i64)>(gcd)); }
i64 lcm(const vector<i64>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<i64(*)(i64, i64)>(lcm)); }
i64 pow(i64 x, i64 y, i64 z) { i64 a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
i64 inv(i64 x, i64 m) { return pow(x, m - 2, m); }

#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

signed main() {
  while (true) {
    i32 n;
    cin >> n;
    if (n == 0) break;
    vector<i32> s(n);
    cin >> s;
    sort(ALL(s));
    i64 sum = 0;
    FOR(i, 1, n - 1) {
      sum += s[i];
    }
    i64 ans = sum / (n - 2);
    cout << ans << endl;
  }
}



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

int main(){
	
	int X = 0 ;	
	scanf("%d" , &X);

if(1<=X<=3000)
{
	if(X < 1200)
    printf("ABC");
    else
    printf("ARC");
}
    
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
int a,b;
char op;
while(1){

scanf("%d %c %d",&a,&op,&b);
if(op=='?'){break;}
else if(op=='+'){printf("%d\n",a+b);}
else if(op=='-'){printf("%d\n",a-b);}
else if(op=='*'){printf("%d\n",a*b);}
else{printf("%d\n",a/b);}
}
return 0;
}

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

#define N 128
#define MAX(A,B) \
  ( (A) > (B) ? (A) : (B) )

int d[ N ][ N ];
int n;
int k_operafan[ N ][ N ];

int dpFSA (
  int v,
  int h
  )
{
  if ( ~k_operafan[ v ][ h ] ) ;
  else if ( v >= n )
  {
    k_operafan[ v ][ h ] = 0;
  }
  else
  {
    int l, r;

    if ( v < n / 2 )  l = dpFSA ( v + 1, h );
    else if ( h > 0 ) l = dpFSA ( v + 1, h - 1 );
    else              l = 0;

    if ( v < n / 2 )      r = dpFSA ( v + 1, h + 1 );
    else if ( h < n - v ) r = dpFSA ( v + 1, h );
    else                  r = 0;

    k_operafan[ v ][ h ] = MAX( l, r ) + d[ v ][ h ];
  }

  return ( k_operafan[ v ][ h ] );
}

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  char buffer[ 1024 ];
  int i;

  for ( n = 0
      ; fgets ( buffer, sizeof ( buffer ), stdin ) != NULL
      ; ++n )
  {
    char *p;

    *( strchr ( buffer, '\n' ) ) = '\0';

    for ( p = strtok ( buffer, "," ), i = 0
        ; p != NULL
        ; p = strtok ( NULL, "," ), ++i )
    {
      d[ n ][ i ] = atoi ( p );
    }
  }

  memset ( k_operafan, -1, sizeof ( k_operafan ) );
  printf ( "%d\n", dpFSA ( 0, 0 ) );

  return ( 0 );
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {

	static Main main = new Main();
	static HashMap<String, Item> itemTable = new HashMap<String, Item>();

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while (!(line = br.readLine()).equals("0")) {
			int m = 0, n = 0;
			String target;

			n = Integer.parseInt(line);
			for (int i = 0; i < n; i++) {
				Item item = getItemInstance(br.readLine());
				itemTable.put(item.name, item);
			}

			m = Integer.parseInt(br.readLine());
			for (int i = 0; i < m; i++) {
				setRecipe(br.readLine());
			}

			target = br.readLine();
			System.out.println(itemTable.get(target).getPriceMin());
		}
	}

	class Item {
		String name;
		int price;
		int priceMin;
		int recipeCount;
		ArrayList<Item> recipe;

		Item(String name, int price) {
			this.name = name;
			this.price = price;
			priceMin = -1;
			recipeCount = 0;
		}

		int getPriceMin() {
			int min = 0;
			if (priceMin > -1) {
				return priceMin;
			} else if (recipeCount == 0) {
				return price;
			} else {
				for (Item i : recipe) {
					if (i != null)
						min += i.getPriceMin();
				}
			}
			priceMin = (min < price ? min : price);
			return priceMin;
		}
	}

	static Item getItemInstance(String info) {
		int n = info.indexOf(' ');
		String name = info.substring(0, n);
		int price = Integer.parseInt(info.substring(n + 1));
		return main.new Item(name, price);
	}

	static void setRecipe(String info) {
		StringTokenizer st = new StringTokenizer(info);
		Item item = itemTable.get(st.nextToken());
		item.recipeCount = Integer.parseInt(st.nextToken());
		item.recipe = new ArrayList<Item>();
		while (st.countTokens() > 0) {
			item.recipe.add(itemTable.get(st.nextToken()));
		}
	}
}

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

int main(){
	int n, q, query, x, t;
	
	cin>>n>>q;
	
	priority_queue<int> hoge[n];
	
	for(int i = 0; i < q; i++){
		cin>>query>>t;
		
		if(query == 0){
			cin>>x;
			hoge[t].push(x);
		} else if(query == 1){
			if(!hoge[t].empty())cout<<hoge[t].top()<<endl;
		} else {
			if(!hoge[t].empty())hoge[t].pop();
		}
	}
	
	return 0;
}


Measured memory_bytes: 4068
#include<stdio.h>
int main(){
int a,b,p;
scanf("%d %d",&a,&b);
p=(a+b);
if(a%3==0)
{
    printf("Possible\n");
}
else if(b%3==0)
{
    printf("Possible\n");
}
else if(p%3==0)
{
    printf("Possible\n");
}
else{
     printf("Impossible\n");
}
return 0;
}






Measured memory_bytes: 1612