akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    int balls[N];
    fill(balls, balls + N, 0);
    for(int i = 0; i < N; i++){
        int num;
        cin >> num;
        balls[num - 1]++;
    }
    sort(balls, balls + N);
    int ans = 0;
    for(int i = 0; i < N - K; i++){
        ans += balls[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
#define maxn 100010
const int inf = 0x3f3f3f3f;
int temp[maxn], sum[maxn], arr[maxn];
long long t1, t2;int n;
void mergesort(int left, int right)
{
	if (left == right)return;
	int mid = (left + right) / 2;
	mergesort(left, mid);
	mergesort(mid + 1, right);
	int p = left, r = left, q = mid + 1;
	while (p <= mid && q <= right)
	{
		if (sum[p] < sum[q])
			temp[r++] = sum[p++];
		else
		{
			t1 += p - left;
			temp[r++] = sum[q++];
		}
	}
	while (p <= mid)
		temp[r++] = sum[p++];
	while (q <= right)
	{
		t1 += p - left;
		temp[r++] = sum[q++];
	}
	for (int i = left; i <= right; i++)
		sum[i] = temp[i];
}
int check_t(int x)
{
	t1 = 0;
	int i, j;
	for (i = 1; i <= n; i++)
		sum[i] = (arr[i] <= x ? 1 : -1);
	for (i = 1; i <= n; i++)
		sum[i] += sum[i - 1];
	mergesort(0, n);
	return t1 >= (t2 / 2 + 1) ? 1 : 0;
}
int main()
{
	int i, j;
	int l, r, mid;
	l = inf, r = -inf;
	scanf("%d", &n);
	for (i = 1; i <= n; i++)
	{
		scanf("%d", &arr[i]);
		l = (l <= arr[i]) ? l : arr[i];
		r = (r >=arr[i] ) ? r : arr[i];
		t2 += i;
	}
	while (l < r)
	{
		mid = (l + r) / 2;
		if (check_t(mid))r = mid;
		else l = mid + 1;
	}
	printf("%d", r);
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fast_input() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int imos[4][2005][2005];
char field[2005][2005];

int main(void) {
    int H, W; cin >> H >> W;
    for (int i = 0; i < 2005; i++) {
        for (int j = 0; j < 2005; j++) {
            field[i][j] = '#';
        }
    }
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            cin >> field[i][j];
        }
    }

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            if (field[i][j] == '.') {
                imos[0][i][j] = imos[0][i][j-1] + 1;
            }
        }
    }
    for (int i = 1; i <= H; i++) {
        for (int j = W; j >= 1; j--) {
            if (field[i][j] == '.') {
                imos[1][i][j] = imos[1][i][j+1] + 1;
            }
        }
    }
    for (int i = 1; i <= H; i++) {
        for (int j = W; j >= 1; j--) {
            if (field[i][j] == '.') {
                imos[2][i][j] = imos[2][i-1][j] + 1;
            }
        }
    }    
    for (int i = H; i >= 0; i--) {
        for (int j = W; j >= 0; j--) {
            if (field[i][j] == '.') {
                imos[3][i][j] = imos[3][i+1][j] + 1;
            }
        }
    }

    int ans = 0;
    for (int i = 1; i <= H; i++) {
        for (int j = W; j >= 0; j--) {
            if (field[i][j] == '.') {
                ans = max(ans, imos[0][i][j-1] + imos[1][i][j+1] + imos[2][i-1][j] + imos[3][i+1][j] + 1);
            }
        }
    }
    cout << ans << endl;
}   


Measured memory_bytes: 66944
#include<stdio.h>
#define N 20
#define Q 200
int solve(int,int,int);
int A[N];
int main(){
  int i,n,m,q;

  scanf("%d",&n);
  for(i = 0; i < n; i++)
    scanf("%d",&A[i]);

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

  return 0;
}

int solve(int i,int m,int n){
  int res;
  if (m == 0) return 1;
  if (i >= n) return 0;

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

Measured memory_bytes: 580
from sys import stdin

n = int(input())
t = list(map(int, input().split()))
m = int(input())

sum_t = sum(t)

ans = []
for _ in range(m):
    p, x = map(int, stdin.readline().strip().split())
    ans.append(sum_t - t[p-1] + x)

for i in ans:
    print(i)

Measured memory_bytes: 62296
#include <iostream>
#include<vector>
#include<cmath>
#include<iomanip>
#define ll long long
using namespace std;
#define rep2(i,a,n) for(int i=a;i<=n;i++)
int main(void){
    // Your code here!
int n,k,count=0;
cin>>n>>k;
for(int i=0;i<n;i++){
    int a;
    cin>>a;
    if(a>=k)
    count++;
}
cout<<count;
}


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

public class Main {

    int[] inputArray;
    Set<String> set = new HashSet<>();
    int K;

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

    void run() {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        K = sc.nextInt();
        substring(s, s.length());

        List<String> array = new ArrayList<>(set);

        Collections.sort(array);

        System.out.println(array.get(K-1));
    }

    void substring(String s, int num){
        for(int i=1; i<=num; i++){
            if(i > K){
                break;
            }
            for(int j=0; j<num; j++){
                if(j + i-1 < num){
//                    System.out.println(s.substring(j, j+i));
                    set.add(s.substring(j, j+i));
                } else {
                    break;
                }
            }
        }
    }

    void permutation(String s, String ans){
        if(s.length() <= 1){
            System.out.println(ans + s);
        } else {
            for(int i=0; i<s.length(); i++){
                permutation(s.substring(0, i) + s.substring(i + 1), ans + s.charAt(i));
            }
        }
    }
}

Measured memory_bytes: 24912
def dfs(i, b, c):
    if i == 11:
        return (b == sorted(b) and c == sorted(c))

    if dfs(i + 1, b + [balls[i - 1]], c):
        return True

    if dfs(i + 1, b, c + [balls[i - 1]]):
        return True

    return False


if __name__ == '__main__':
    N = int(input())
    for i in range(N):
        balls = list(map(int, input().split()))
        if dfs(1, [], []):
            print("YES")
        else:
            print("NO")

Measured memory_bytes: 7608
#include<bits/stdc++.h>
using namespace std;
long int n=100,c=100000;
long int solve(long int i,long int cap,vector<vector<long int>> &dp,vector<long int> &w,vector<long int> &v){
	if(i==n)
		return 0;
	if(dp[i][cap]!=-1)
		return dp[i][cap];
	if(cap>=w[i])
		dp[i][cap]=v[i]+solve(i+1,cap-w[i],dp,w,v);
	dp[i][cap]=max(solve(i+1,cap,dp,w,v),dp[i][cap]);
	return dp[i][cap];	
}

int main(){
	cin>>n>>c;
	vector<long int> w(n);
	vector<long int> v(n);
	for(long int i=0;i<n;i++){
		cin>>w[i]>>v[i];
	}
	vector<vector<long int>> dp(n);
	vector<long int> z(c+1);
	for(long int i=0;i<c+1;i++)
		z[i]=-1;
	for(long int i=0;i<n;i++)
		dp[i]=z;
	cout<<solve(0,c,dp ,w,v);
	return 0;
}


Measured memory_bytes: 79488
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

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

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
// clang-format on

template<ll MOD = 1000000007>
class ModInt {
    ll n;
    static constexpr ModInt pow(const ModInt x, ll p) {
        ModInt<MOD> ans = 1;
        for (ModInt<MOD> m = x; p > 0; p /= 2, m *= m) {
            if (p % 2) ans *= m;
        }
        return ans;
    }
    ModInt constexpr inverse() const {
        return ModInt::pow(*this, MOD - 2);
    }

public:
    ModInt()
        : n(0) {}
    ModInt(ll _n)
        : n(((_n % MOD) + MOD) % MOD) {}
    ModInt operator+=(const ModInt &m) {
        n += m.n;
        if (n >= MOD) n -= MOD;
        return *this;
    }
    ModInt operator-=(const ModInt &m) {
        n -= m.n;
        if (n < 0) n += MOD;
        return *this;
    }
    ModInt operator*=(const ModInt &m) {
        n *= m.n;
        if (n >= MOD) n %= MOD;
        return *this;
    }
    ModInt operator/=(const ModInt &m) {
        (*this) *= m.inverse();
        return *this;
    }
    ModInt operator+(const ModInt &m) {
        auto t = *this;
        return t += m;
    }
    ModInt operator-(const ModInt &m) {
        auto t = *this;
        return t -= m;
    }
    ModInt operator*(const ModInt &m) {
        auto t = *this;
        return t *= m;
    }
    ModInt operator/(const ModInt &m) {
        auto t = *this;
        return t /= m;
    }
    ModInt operator=(const ll l) {
        n = l % MOD;
        if (n < 0) n += MOD;
        return *this;
    }
    friend ostream &operator<<(ostream &out, const ModInt &m) {
        out << m.n;
        return out;
    }
    friend istream &operator>>(istream &in, ModInt &m) {
        ll l;
        in >> l;
        m = l;
        return in;
    }
};
using mint = ModInt<>;
mint operator"" _m(unsigned long long m) {
    return mint(m);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    auto dp = make_v(n + 1, 13, 0_m);
    dp[0][0] = 1;
    REP(i, 0, n) {
        REP(j, 0, 13) {
            if (s[i] == '?') {
                REP(k, 0, 10) {
                    int nxt = (10 * j + k) % 13;
                    dp[i + 1][nxt] += dp[i][j];
                }
            } else {
                int nxt = (10 * j + s[i] - '0') % 13;
                dp[i + 1][nxt] += dp[i][j];
            }
        }
    }
    cout << dp[n][5] << endl;
    REP (i, 0, 13) {
        dump(dp[n][i]);
    }
    return 0;
}


Measured memory_bytes: 13648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,k;
  cin >> n >> k;
  set<int> s;
  for(int i=0;i<k;i++){
    int d;
    cin >> d;
    vector<int> a(d);
    for(int j=0;j<d;j++){
      cin >> a.at(j);
      s.insert(a.at(j));
    }
  }
  int p=0;
  for(int i=1;i<=n;i++){
    if(s.count(i)==false)
      p++;
  }
  cout << p << endl;
}

Measured memory_bytes: 3612
D = int(input())
A = [[0]*26]*D
S = 0
C = list(map(int,input().split()))
P = 0
ld =[0]*26#最後に行った日の格納
l = [0]*26#損失の計算
sp = 0#一時格納
t = [0]*D
for i in range(D):
  A[i] = list(map(int,input().split()))
for j in range(D):
  maxvalue = max(A[j])
  index = A[j].index(maxvalue)
  for n in range(26):
    ld[n] = ld[n]+1
  sp = ld[index]
  ld[index] = 0 
  for k in range(26):
    l[k] = C[k]*ld[k]
  lmax =max(l)
  if 13*lmax > maxvalue:
    lindex = l.index(lmax)
    ld[index] = sp
    ld[lindex] = 0
    for m in range(26):
      l[m] = C[m]*ld[m]
  S = S+maxvalue-sum(l)
  t[j] = index+1
for num in range(D):
  print(str(t[num]))

Measured memory_bytes: 9392
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	string s;
	cin >> s;
	ll ans=0, wpos=0;
	for(int i=0; i<s.length(); i++){
		if(s[i]=='B') continue;
		ans+=i-wpos;
		wpos++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cerr<<#x<<"="<<x<<"\n"
typedef long long ll;
using namespace std;
//const ll MOD=(ll)1e9+7;
const int inf=(int)1e9;
const int dy[]={1,0,-1};
const int dx[]={1,0,-1};

vector<vector<pair<int,int> > > v;
bool past[801];
bool leaf[801];

void dfs(int now){
  bool flag=1;
  for(int i=0;i<(int)v[now].size();i++){
    if(past[v[now][i].fi])continue;
    flag=0;
    past[v[now][i].fi]=1;
    dfs(v[now][i].fi);
  }
  if(flag)leaf[now]=1;
}

int bfs(int s){
  int d[801];
  for(int i=0;i<801;i++){
    d[i]=0;
  }
  queue<pair<int,int> > q;
  q.push({s,0});
  bool p[801];
  for(int i=0;i<801;i++)p[i]=0;
  p[s]=1;
  while(!q.empty()){
    int now=q.front().fi;
    int nowcost=q.front().se;
    q.pop();
    for(int i=0;i<(int)v[now].size();i++){
      if(leaf[v[now][i].fi])continue;
      if(p[v[now][i].fi])continue;
      p[v[now][i].fi]=1;
      d[v[now][i].fi]=v[now][i].se+nowcost;
      q.push({v[now][i].fi,v[now][i].se+nowcost});
    }
  }
  int res=0;
  for(int i=0;i<801;i++){
    res=max(res,d[i]);
  }
  return res;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1=freopen("in","r",stdin);
  //stream2=freopen("out","w",stdout);
  if(stream1==NULL)return 0;
  //if(stream2==NULL)return 0;
#endif
  int n;
  while(cin>>n,n){
    v.resize(n);
    for(int i=0;i<n;i++)v.resize(0);
    for(int i=0;i<n;i++){
      past[i]=0;
      leaf[i]=0;
    }
    int tmp[801];
    for(int i=0;i<n-1;i++){
      cin>>tmp[i];tmp[i]--;
    }
    ll ans=0;
    for(int i=0;i<n-1;i++){
      int cost;cin>>cost;
      ans+=cost*3;
      v[i+1].push_back({tmp[i],cost});
      v[tmp[i]].push_back({i+1,cost});
    }
    past[0]=1;
    dfs(0);
    for(int i=0;i<n;i++){
      past[i]=0;
    }
    for(int i=0;i<n;i++){
      if(leaf[i]){
        past[i]=1;
        dfs(i);
        break;
      }
    }
    for(int i=0;i<n;i++){
      if(leaf[i])ans-=2*v[i][0].se;
    }
    ll ans2=ans;
    //show(ans);
    for(int i=0;i<n;i++){
      if(leaf[i])continue;
      int maxedge=bfs(i);
      ans2=min(ans2,ans-maxedge);
      //show(maxedge);
    }
    cout<<ans2<<endl;
  }
#ifdef LOCAL_DEFINE
  cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}







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

int n, s, D, a[30], b[400][30], la[400];
int main()
{
	int i, j, t;
	cin >> D;
	for (i = 0; i < 26; i++) {
		scanf ("%d", &a[i]);
	}
	for (i = 1; i <= D; i++) {
		for (j = 0; j < 26; j++) {
			scanf ("%d", &b[i][j]);
		}
	}
	for (i = 1; i <= D; i++){
		scanf ("%d", &t);
		t--;
		s += b[i][t];
		la[t] = i;
		for (j = 0; j < 26;j++) {
			s -= a[j] * (i - la[j]);
		}
		printf("%d\n", s);
	}
    return 0;
}


Measured memory_bytes: 3872
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb emplace_back
#define x first
#define y second
#define sz(a) ((int)(a).size())
#define rep(i,a,b) for(auto i=(a); i<(b); i++)
#define dec(i,n,a) for(auto i=(n); i>=(a); i--)
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end()
#define EPS 3e-11
#define fcin ios_base::sync_with_stdio(false)
#define db(x) cerr << #x << " == " << x << endl
#define _ << " " <<
#define MAXN 202020
#define LOGN 29
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;

int n;
ll ans, menor = 1e18;

int main(){
	scanf("%d", &n);
	rep(i,0,n){
		int a, b;
		scanf("%d%d", &a, &b);
		if(a > b) menor = min(menor, (ll)b);
		ans += a;
	}
	ans -= menor;
	if(menor > 1e10) ans = 0;
	printf("%lld\n", ans);
}

Measured memory_bytes: 764
#include <bits/stdc++.h>//..1..2..3:Correct:Solved by F2tekkz:)
#define ll long long
#define str string
#define sonic ios_base::sync_with_stdio(0)
using namespace std;
ll n , m , k , i , j , t , q , cnt , cnt1 , cnt2 , cnt3;
ll cnt4 , cnt5 , ans , ans1 , ans2 , ans3 , sum , sum1 , sum2;
ll mini = 1e9 , maxi = -999;
int main(){
	sonic;
	cin >> n;
	cnt = 0;
	ll a[n];
	for(i = 0 ; i < n ; i ++){
		cin >> a[i];
	}
	for(i = 0 ; i < n ; i ++){
		if(a[i] % 2 == 0){
			if(a[i] % 3 == 0 || a[i] % 5 == 0){
				cnt = 0;
			}
			else{
				cnt = 1;
				break;
			}
		}
	}
	if(cnt == 0){
		cout << "APPROVED";
	}
	else{
		cout << "DENIED";
	}
}
//     *    *  *  ****    *    *   *
//    *	*   * *   *      * *   *   *
//   *****  **    ****  *****  *****
//   *   *  * *      *  *   *      *
//   *   *  *  *  ****  *   *  *****

//   *  *  *****  *
//   * *     *    *
//   **      *    *
//   * *     *    *
//   *  *    *    ****

//   ****  ****  *       *
//   *      **   *      * *
//   ****   **   *     *****
//      *   **   *     *   *
//   ****  ****  ****  *   *


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int a = sc.nextInt();
			String op = sc.next();
			int b = sc.nextInt();
			if (op.equals("?")) {
				break;
			} else if (op.equals("+")) {
				System.out.println(a + b);
			} else if (op.equals("-")) {
				System.out.println(a - b);
			} else if (op.equals("*")) {
				System.out.println(a * b);
			} else if (op.equals("/")) {
				System.out.println(a / b);
			} else {
			}
		}
	}
}


Measured memory_bytes: 26164
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {
    int A,B,C;

    private void solve() {
        A = nextInt();
        B = nextInt();
        C = nextInt();

        int ans = Math.min(B / A, C);
        out.println(ans);
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 21460
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <list>
#define rep(i,n) for(int i=0; i<n; ++i)
using namespace std;

int main() {
    int k, s;
    cin >> k >> s;
    int ans = 0;
    rep(x, k + 1) {
        rep(y, k + 1) {
            int z = s - x - y;
            if (z >= 0 && z <= k) ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    string S, T;
    cin >> S >> T;

    bool flag = true;
    char map_S[26] = {}, map_T[26] = {};
    for (char c = 'a'; c <= 'z'; c++) {
        int index = c - 'a';
        for (int i = 0; i < S.length(); i++) {
            if (S[i] == c) {
                if (!map_S[index]) map_S[index] = T[i];
                if (map_S[index] != T[i]) flag = false;
            }
            if (T[i] == c) {
                if (!map_T[index]) map_T[index] = S[i];
                if (map_T[index] != S[i]) flag = false;
            }
        }
    }

    cout << (flag ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1020
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
    int c[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>c[i][j];
        }
    }
    bool jud=true;
    int a=c[0][1]-c[0][0];
    int b=c[0][2]-c[0][0];
    for(int p=0;p<3;p++){
        for(int q=0;q<3;q++){
            if(q==1){
                c[p][q]=c[p][q]-a;
            }
            if(q==2){
                c[p][q]=c[p][q]-b;
            }
        }
    }
    for(int k=0;k<3;k++){
        if((c[k][0]==c[k][1])&&(c[k][1]==c[k][2])){
            jud=jud;
        }else{
            jud=false;
        }
    }
    if(jud==true){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}

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

int main(int argc, const char * argv[]) {
    // insert code here...
    int K;
    cin >> K;
    
    /*cout << K / 2 << endl;
    cout << K / 2 + 1 << endl;*/
    
    if (K % 2 == 0) cout << (K / 2) * (K / 2) << endl;
    else cout << (K / 2 + 1) * (K / 2) << endl;
        
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        var ST = ReadLine().Split();
        var dic = new Dictionary<string, int>();
        var AB = ReadLine().Split().Select(int.Parse).ToArray();
        dic.Add(ST[0], AB[0]);
        dic.Add(ST[1], AB[1]);
        var U = ReadLine();
        dic[U]--;
        WriteLine($"{dic[ST[0]]} {dic[ST[1]]}");
    }
}


Measured memory_bytes: 28072
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a = int(input())
    print(a + a ** 2 + a ** 3)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9088
#include<bits/stdc++.h>
    #define ll long long
    using namespace std;
    int main()
    {
        int n,i,te,ans=0;
        vector<int> a,b,c;
        cin>>n;
        for(i=0;i<n;i++)
        {   cin>>te;
            a.push_back(te);
        }
        for(i=0;i<n;i++)
        {
            cin>>te;
            b.push_back(te);
        }
        for(i=0;i<n-1;i++)
        {
            cin>>te;
            c.push_back(te);
        }
        for(i=0;i<n;i++)
        {   if(a[i]!=n)
        { if(a[i]+1==a[i+1])
        {
            ans+=b[a[i]-1]+c[a[i]-1];
        }
        else
        {
            ans+=b[a[i]-1];
        }

        }
        if(a[i]==n)
        {
            ans+=b[n-1];
        }
        }
        cout<<ans<<endl;



    }


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


int main() {
  int N;
  cin >> N;
  
  int f = N%10, tmp = N;
  for (int i=0; i<N; i++) {
    tmp /= 10;
    f += tmp%10;
  }
  
  if (N%f==0) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3628
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 1e5 + 10;
int n , a[N];

int main(){
  scanf("%d",&n);
  rep(i,0,n) scanf("%d",a+i);
  int bf=0,ans=1;
  rep(i,1,n) {
    int cur=a[i]==a[i-1]?0:(a[i]<a[i-1]?1:2);
    if(cur&&bf&&cur!=bf) ans++,bf=0;
    else if(cur) bf=cur;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 640
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, P):
    a = [x - y for x, y in P]
    b = [x + y for x, y in P]
    c = max(max(a) - min(a), max(b) - min(b))
    print(c)

if __name__ == '__main__':
    input = sys.stdin.readline
    N = int(input())
    P = [tuple(map(int, input().split())) for _ in range(N)]
    main(N, P)


Measured memory_bytes: 51704
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<queue>
#include<utility>
#include<cmath>
#include<sstream>
#include<istream>

using namespace std;


int main()
{
  string S;

  cin >> S;

if(S[2]==S[3] && S[4]==S[5])  cout << "Yes" << endl;
else  cout << "No" << endl;

return 0;
}


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

public class Solution
{
    public static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var all = A.Aggregate(0, (a, b) => a ^ b);
        var sunukes = A.Select(a => a ^ all).ToArray();
        Console.WriteLine(string.Join(" ", sunukes));
    }
}

Measured memory_bytes: 66592
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
CD = [list(map(int,input().split()))+[i] for i in range(M)]
INF = 10**10

for pos in AB:
    dist = INF
    res = 0
    ai = pos[0]
    bi = pos[1]
    for check in CD:
        ci = check[0]
        di = check[1]
        t = abs(ai-ci)+abs(bi-di)
        if t < dist:
            dist = t
            res = check[2]+1
    print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define M 200010

using namespace std;

int H[M], N[M], G[M], F[M], S[M], Cnt = 0, n, depn = 0;

void DFS(int x, int dep = 0)
{
	S[x] = 1;
	if(x == n) depn = dep;
	for(int T = H[x]; T; T = N[T]) if(G[T] != F[x]) F[G[T]] = x, DFS(G[T], dep + 1), S[x] += S[G[T]];
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i < n; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		G[++Cnt] = b, N[Cnt] = H[a], H[a] = Cnt;
		G[++Cnt] = a, N[Cnt] = H[b], H[b] = Cnt;
	}
	DFS(1);
	int tmp = n;
	for(int i = 1; i <= (depn - 1) / 2; i++) tmp = F[tmp];
	puts(S[tmp] * 2 >= n ? "Snuke" : "Fennec");
	return 0;
}

Measured memory_bytes: 7680
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define mp make_pair
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pii pair<ll,ll>
#define pb push_back
#define F first
#define S second
#define mi map<ll,ll>
#define mii map<pii,ll>
const ll N=(1e7+1);//mod=998244353;
ll n,m,k;//
ll a[N],dp[N];
string s;
ll l=(1e7+2);
int main(){
	int n;cin>>n;
	int a[n],c=0,mn=INT_MAX;
	ll sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];if(a[i]<0)c++;
		mn=min(mn,abs(a[i]));
		sum+=abs(a[i]);
	}
	if(c%2==1){
		sum-=2*mn;
	}
	cout<<sum<<endl;
}
/*
2
5 2
3 6 4 7 2
5 3
3 -5 6 3 10


*/


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  vector<bool> b(3,false);
  rep(i,2){
    int a;
    cin>>a;
    a--;
    b[a]=true;
  }

  rep(i,3){
    if(!b[i]) cout<<i+1<<endl;
  }


}

Measured memory_bytes: 764
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def main():
    S = input()
    T = input()
    for i in range(len(S) + 1):
        s = S[i:] + S[:i]
        if s == T:
            print(Yes)
            return
    print(No)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3960
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int N, M;
int K;
int main(void) {
	cin >> N >> M >> K;
	bool f = false;
	rep(i, N + 1)rep(j, M + 1) {
		int black1 = M * i;
		int white = i * j;
		int black2 = j * (N - i);
		int cnt = black1 + black2 - white;
		if(cnt == K) f = true;
	}
	if(f) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <assert.h>
#include <numeric>
#include <iomanip>
#define rep(i, a, b) for (int(i) = (a); i < (b); i++)
using namespace std;

using ll = long long;

typedef pair<int, int> P;

const int INF = 100000000;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;

ll pow_mod(ll x, ll y, ll mod)
{
	ll ans=1;
	for(;y>0;y>>=1){
		if(y&1)(ans*=x)%=mod;
		(x*=x)%=mod;
	}
	return ans;
}

int n;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	//問題文中の添え字が0-indexか1-indexか確認!
	cin>>n;
	vector<P> a(1<<n);
	rep(i,0,1<<n){
		int b;
		cin>>b;
		a[i]=P(b,0);
	}
	vector<int> temp(4);
	rep(i,0,n){
		rep(j,0,1<<n){
			if((j>>i&1)){
				temp[0]=a[j].first;
				temp[1]=a[j].second;
				temp[2]=a[j^1<<i].first;
				temp[3]=a[j^1<<i].second;
				sort(temp.begin(),temp.end(),greater<int>());
				a[j]=P(temp[0],temp[1]);
			}
		}
	}
	vector<ll> maxa(1<<n);
	maxa[0]=a[0].first+a[0].second;
	rep(i,1,1<<n){
		maxa[i]=max(maxa[i-1],(ll)a[i].first+a[i].second);
		cout<<maxa[i]<<"\n";
	}
	return 0;
}

Measured memory_bytes: 7168
# -*- coding:utf-8 -*-

def solve():
    N, A = list(map(int, input().split()))
    X = list(map(int, input().split()))

    # dp[i][j][k] := 左からi+1枚目までに、j枚を選んで、選んだカードの総和がkになる場合の数
    dp = [[[0 for _ in range(50*50+1)] for __ in range(N+1)] for ___ in range(N)]
    dp[0][0][0] = 1
    dp[0][1][X[0]] = 1

    for i in range(1, N):
        for j in range(0, N):
            for k in range(0, 50*50+1):
                dp[i][j][k] += dp[i-1][j][k]  # カードを選ばない
                if k+X[i] < 50*50+1:
                    dp[i][j+1][k+X[i]] += dp[i-1][j][k] # カードを選ぶ
    
    ans = 0
    for j in range(1, N+1):
        ans += dp[N-1][j][A*j]

    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 93788
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  int n;
  cin>>n;
  vector<int> a1(n),a2(n);
  REP(i,n) cin>>a1[i];
  REP(i,n) cin>>a2[i];

  vector<int> ac1(n),ac2(n);
  REP(i,n){
    if(i==0){
      ac1[0]=a1[0];
      ac2[n-1]=a2[n-1];
      continue;
    }
    ac1[i]=ac1[i-1]+a1[i];
    ac2[n-1-i]=ac2[n-i]+a2[n-1-i];
  }
  int ans=0;
  REP(i,n) ans=max(ans,ac1[i]+ac2[i]);
  cout<<ans<<endl;
  
	return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.abs

fun main() {

    fun PrintWriter.solve() {
        var (x,k,d) = List(3){nextLong()}
            if(x < 0){
                x = -x
            }
            
            val q = x/d
            if (q >= k ) {
                println("${x - k * d}")
            } else {
                val nk = x / d
                k -= nk
                x %= d

                if (k%2 == 0L)println("${x}")
                else println("${d-x}")
            }

//        else{
//            if (x + k*d <= 0){
//                println("${abs(x+k*d)}")
//            }
//            else{
//                val nk = (-x)/d
//                k -= nk
//                if (k%2 == 0L){
//                    println("${abs(x)}")
//                }
//                else{
//                    println("${abs(x+d)}")
//                }
//            }
//        }


    }

    writer.solve()
    writer.flush()


}


private val reader = System.`in`.bufferedReader()
private val writer = PrintWriter(System.out, false)

private var tokenizer: StringTokenizer = StringTokenizer("")

private fun next(): String {
    while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(reader.readLine())
    return tokenizer.nextToken()
}

private fun nextInt() = next().toInt()
private fun nextLong() = next().toLong()
private fun nextDouble() = next().toDouble()
private fun nextLine() = reader.readLine()



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

int main()
{
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;

    int i=0;
    int j=0;

    int ans = 0;

    while(j<n)
    {
        while(j<n && s[j]=='1')
        {
            j++;
        }
        ans = max(ans,j-i);
        while(j<n && s[j]=='0')
        {
            j++;
        }
        k--;
        if(k<0)
        {
            while(i<n && s[i]=='1')
            {
                i++;
            }
            while(i<n && s[i]=='0')
            {
                i++;
            }
        }
        ans = max(ans,j-i);
    }
    cout << ans << endl;
}

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

const int MAX_N = 200000;

int main(){
   int N, K;
   std::cin >> N >> K;
   int A;
   int kind = 0;
   std::vector<int> count(MAX_N,0);
   for(int i=0; i<N; ++i){
      std::cin >> A;
      if(count[A-1]==0) ++kind; 
      ++count[A-1];
   }
   std::sort(count.begin(),count.end());

   int ans = 0;
   for(int i=0; i<MAX_N; ++i){
      if(kind<=K) break;
      ans += count[i]; 
      if(count[i]>0) --kind;
   }

   std::cout << ans << std::endl;
   return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main() {
    
    // U: 上方向
    // D: 下方向
    // L: 左方向
    // R: 右方向

    int sx,sy,tx,ty;
    char U = 'U';
    char D = 'D';
    char L = 'L';
    char R = 'R';

    cin >> sx >> sy >> tx >> ty;

    int p = tx - sx;
    int q = ty - sy;
    string str;
    //1 
    for(int i =0;i < q;i++){
        str.push_back(U);
    }
    
    for(int i =0;i < p;i++){
        str.push_back(R);
    }
    //2
    for(int i =0;i < q;i++){
        str.push_back(D);
    }
    
    for(int i =0;i < p;i++){
        str.push_back(L);
    }
    //外側へ
    str.push_back(L);
    //3
    for(int i =0;i < q + 1;i++){
        str.push_back(U);
    }
    
    for(int i =0;i < p + 1;i++){
        str.push_back(R);
    }
    //内側へ
    str.push_back(D);
    //外側へ
    str.push_back(R);
    //4
    for(int i =0;i < q + 1;i++){
        str.push_back(D);
    }
    
    for(int i =0;i < p + 1;i++){
        str.push_back(L);
    }

    //内側へ
    str.push_back(U);

    cout << str << endl;

    return 0;
}



Measured memory_bytes: 256
package main
import (
  "fmt"
)
func main() {
  var n int
  fmt.Scan(&n)
  var result float64
  if n == 1 {
    result = 1
  } else if n%2 == 0 {
    result = 0.5
  } else {
    result = float64((n+1)/2) / float64(n)
  }
  fmt.Println(result)
}

Measured memory_bytes: 512
#include <stdio.h>
typedef struct {
  char c;
  int i;
} Point;
void X(Point*,int);
void Y(Point*,int);  
int main ()
{
  int i,n,judge=0;
  char hi[3];
  Point data[36],data2[36];
  scanf ("%d",&n);
  for(i=0;i<n;i++){
    scanf ("%s",hi);
    data[i].c=hi[0];
    data[i].i=hi[1]-'0';
    data2[i]=data[i];
  }
  X(data,n);
  for (i=0;i<n;i++){
    printf ("%c%d",data[i].c,data[i].i);
    if (i==n-1)break;
    printf (" ");
  }
  printf ("\n");
  printf ("Stable\n");

  Y(data2,n);

  for (i=0;i<n;i++){
    printf ("%c%d",data2[i].c,data2[i].i);
    if (data2[i].c!=data[i].c)
      judge=1;
    if (i==n-1)break; 
    printf(" ");
  }
  printf ("\n");
  if (judge==1)
    printf("Not stable\n");
  else  printf("Stable\n");
  return 0;
}
void X (Point* A,int N){
  int j;
  Point p;
  int flag;
  flag=1;
  while (flag==1){
    flag=0;
    for (j=N-1;j>=1;j--){
      if (A[j].i<A[j-1].i){
	/*交換*/
	p=A[j];
	A[j]=A[j-1];
	A[j-1]=p;
	flag=1;
      }   
    }
  } 
}


void  Y (Point* A,int N){
  int i,j,minj;
  Point p;
  for (i=0;i<=N-1;i++){
    minj=i;
    for (j=i;j<=N-1;j++){
      if (A[j].i<A[minj].i){
	minj=j;
      }
    }
    /*交換*/
    if(i!=minj){
      p=A[i];
      A[i]=A[minj];
      A[minj]=p; 
    }
  }
 
}



Measured memory_bytes: 2108
//#define _GLIBCXX_DEBUG
//#pragma GCC optimize "trapv"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
// #pragma optimization_level 3
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


#define pb push_back 
#define f first
#define s second
#define min3(a, b, c) min(min(a, b), c)
#define max3(a, b, c) max(max(a, b), c)
#define all(v) v.begin(), v.end()

typedef long long ll;
typedef double ld;
typedef long double lld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

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

const ll mod = 1000000007;
const int INF = 1e9;
void solve(int tc){
    string s;
    cin >> s;
    int n = s.size();
    if((char)s[n-1] == 's'){
        s += "es";
    }
    else s += 's';

    cout << s << "\n";
}

int main(){
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    
    int tc = 1;
    //cin >> tc;
    for (int t = 0; t < tc; t++) solve(t);

    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(void)
{
	int n,m,i,j,q,a[5000],b[5000],c[5000],d[5000],s[500],z[500];
	scanf("%d",&n);
	m=n*(n-1)/2;
	for(i=1;i<=m;i++){
		scanf("%d %d %d %d",&a[i],&b[i],&c[i],&d[i]);
	}
	for(j=1;j<=n;j++){
		s[j]=0;
		z[j]=1;
	}
	for(i=1;i<=m;i++){
		for(j=1;j<=n;j++){
			if(j==a[i]){
				if(c[i]>d[i]){
					s[j]+=3;
				}
				else if(c[i]==d[i]){
					s[j]+=1;
				}
			}
			if(j==b[i]){
				if(c[i]<d[i]){
					s[j]+=3;
				}
				else if(c[i]==d[i]){
					s[j]+=1;
				}
			}
		}
	}
	for(j=1;j<=n;j++){
		for(q=1;q<=n;q++){
			if(s[j]<s[q]){
				z[j]++;
			}
		}
		printf("%d\n",z[j]);
	}
	return 0;
}
			

Measured memory_bytes: 1108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PokerPlaying {
    class Class2 {
        static void Main(string[] args) {
            while (true) {
                string input = Console.ReadLine();
                if (input == "0") {
                    return;
                }
                int massSoba = int.Parse(input);
                Optimizer o = new Optimizer();
                Console.WriteLine(o.executeOpt(massSoba));
            }
        }
    }

    class Optimizer {//?????¬???????????¶?´????????????°??????????????¨??¨??????????????£???????????????
        const int massX = 200;
        const int massY = 300;
        const int massZ = 500;
        const int priceX = 380;
        const int priceY = 550;
        const int priceZ = 850;

        public int executeOpt(int mass) {
            int solution = int.MaxValue;
            List<int[]> allCandidates = new List<int[]>();

            int maxIter = (int)Math.Floor((double)mass/massX);
            for (int x = 0; x <= maxIter; x++) {//????????????????£??????????????????¨???
                for (int y = 0; y <= (Math.Floor((double)(mass-massX*x)/massY)); y++) {
                    for (int z = 0; z <= (Math.Floor((double)(mass-massX*x-massY*y)/massZ)); z++) {
                        if (200 * x + 300 * y + 500 * z == mass) {
                            int[] candidate = new int[3];
                            candidate[0] = x;
                            candidate[1] = y;
                            candidate[2] = z;
                            allCandidates.Add(candidate);
                        }
                    }
                }
            }
            for (int i = 0; i < allCandidates.Count; i++) {
                int[] testData = allCandidates[i];
                double price = 0;
                if (testData[0] < 5) {
                    price += 380 * testData[0];
                } else {
                    price += 304 * (testData[0] - testData[0] % 5) +  380 * (testData[0] % 5);
                }
                if (testData[1] < 4) {
                    price += 550 * testData[1];
                } else {
                    price += 467.5 * (testData[1] - testData[1] % 4) + 550 * (testData[1] % 4);
                }
                if (testData[2] < 3) {
                    price += 850 * testData[2];
                } else {
                    price += 748 * (testData[2] - testData[2] % 3) + 850 * (testData[2] % 3);
                }
                int intPrice = (int)price;
                if (intPrice < solution) {
                    solution = intPrice;
                }
            }
            return solution;
        }
    }
}

Measured memory_bytes: 9212
#include<bits/stdc++.h>
using namespace std;
const int maxn=3e5+10;
int n;
char s[maxn];
vector<int> pos;
vector<pair<int,int>> a;

int main(){
    scanf("%s",s+1);
    n=strlen(s+1);
    bool ok=true;
    ok&=(s[1]=='1');
    ok&=(s[n]=='0');
    for(int i=1;i<n;i++){
        ok&=(s[i]==s[n-i]);
        if(s[i]=='1')pos.push_back(i);
    }
    if(!ok)return !printf("-1");
    for(int i=1;i<pos.size();i++){
        for(int j=pos[i-1]+1;j<=pos[i]-1;j++)
        a.push_back(make_pair(j,pos[i]));
        a.push_back(make_pair(pos[i],pos[i-1]));
    }
    for(int j=pos.back()+1;j<=n;j++)
        a.push_back(make_pair(pos.back(),j));
    assert((int)a.size()==n-1);
    for(auto i:a){
        printf("%d %d\n",i.first,i.second);
    }
}


Measured memory_bytes: 2804
void main()
{
    long n = rdElem;
    long[] a = rdRow;

    long q = rdElem;
    foreach (i; 0 .. q)
    {
        long p = rdElem;
        long r = a.binSrch!"a < b"(p);
        writeln(r + 1);
    }
}

long binSrch(alias pred = "a < b")(long[] arr, long val)
{
    alias predFun = binaryFun!pred;
    long l = -1, r = arr.length;
    if (!predFun(l, r)) swap(l, r);
    while (abs(r - l) > 1)
    {
        long m = (l + r) / 2;
        if (predFun(arr[m], val)) l = m;
        else r = m;
    }
    return l;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;


Measured memory_bytes: 6660
n = int(input())
b = list(map(int,input().split()))
ans = []
flag = 0
if b[0] != 1:
  flag = 1
i = n
key = 0
if flag == 0:
  while(i != 1):
    key = 0
    for j in range(0,i):
      if b[j] == j+1:
        key = j+1
      elif j == i-1 and key == 0:
        flag = 1
        break
    ans.append(key)
    b.pop(key-1)
    i -= 1
ans.reverse()
if b[0] != 1:
  flag = 1
ans.insert(0,b[0])
if flag == 0:
  for k in range(n):
    print(ans[k])
else:
  print(-1)

Measured memory_bytes: 38640
#include<stdio.h>
  
int main(void){
  
    int a,b;
  
    scanf("%d %d",&a,&b);
  
    if(a>b)
        puts("a > b");
    if(a<b)
        puts("a < b");
    if(a==b)
        puts("a == b");
 
    return 0;
  }


Measured memory_bytes: 2044