akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
 
typedef struct{
  char m;
  int v;
} c;
 
#define MAX 36
 
int N;
int isStable(c *in, c*out){
  int i;
 
  for(i=0;i<N;i++){
    if(in[i].m!=out[i].m){
      return 0;
    }
  }
 
  return 1;
}
 
int main(){
  int i,j,min,is;
  c c1[MAX],c2[MAX],t;
 
  scanf("%d",&N);
  if(N<1 || N>MAX){
    exit(1);
  }
  for(i=0;i<N;i++){
    scanf(" %c%d",&c1[i].m,&c1[i].v);
  }
 
  for(i=0;i<N;i++){
    c2[i]=c1[i];
  }
 
  for(i=0;i<N;i++){
    for(j=N-1;j>=i+1;j--){
      if(c1[j].v<c1[j-1].v){
    t=c1[j];
    c1[j]=c1[j-1];
    c1[j-1]=t;
      }
    }
  }
 
  for(i=0;i<N;i++){
    min=i;
    for(j=i;j<N;j++){
      if(c2[j].v<c2[min].v){
    min=j;
      }
    }
    t=c2[i];
    c2[i]=c2[min];
    c2[min]=t;
  }
 
  for(i=0;i<N-1;i++){
    printf("%c%d ",c1[i].m,c1[i].v);
  }
  printf("%c%d\n",c1[N-1].m,c1[N-1].v);
  printf("Stable\n");
 
  is=isStable(c1,c2);
 
  for(i=0;i<N-1;i++){
    printf("%c%d ",c2[i].m,c2[i].v);
  }
  printf("%c%d\n",c2[N-1].m,c2[N-1].v);
  if(is==1){
    printf("Stable\n");
  }else{
    printf("Not stable\n");
  }
 
  return 0;
}

Measured memory_bytes: 608
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define MEMSET(a, n, x) REP(i, n) a[i]=x;
#define ARRIN(a, n) REP(i, n) cin>>a[i];
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int n;
  cin>>n;
  int a[n];
  ARRIN(a, n);

  if(a[0]!=0){
    cout<<-1<<endl;
    return 0;
  }
  LL ans=a[n-1];
  for(int i=n-2; i>0; --i){
    if(a[i]<a[i+1]-1){
      cout<<-1<<endl;
      return 0;
    }
    if(a[i]==a[i+1]-1) continue;
    if(a[i]>=a[i+1]) ans += a[i];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<queue>
#include<list>
#include<map>
using namespace std;
#define mod 1000000007
#define add(x) (x>=mod?x-mod:x)
int n,dp[300005][3][3],ans;
char s[300005];
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	dp[0][0][0]=1;
	for(int i=1;i<=n;i++){
		for(int t=0;t<=2;t++){
			for(int j=0;j<=2;j++){
				if(s[i]=='0'||s[i]=='?'){
					if(j==2) dp[i][t][1]=add(dp[i][t][1]+dp[i-1][t][j]);
					else dp[i][t][j+1]=add(dp[i][t][j+1]+dp[i-1][t][j]);
				}
				if(s[i]=='1'||s[i]=='?'){
					if(j) dp[i][t][j-1]=add(dp[i][t][j-1]+dp[i-1][t][j]);
					else dp[i][min(2,t+1)][j]=add(dp[i][min(2,t+1)][j]+dp[i-1][t][j]);
				}
			}
		}
	}
	for(int i=0;i<=2;i++){
		for(int t=0;t<=i;t++){
			ans=add(ans+dp[n][i][t]);
		}
	}
	printf("%d",ans);
}

Measured memory_bytes: 14660
n = int(input())
a = list(map(int,input().split()))
#逆数を足すようの変数を用意して
v = 0.0
for i in a:
    #あとは逆数足していって
    v += 1.0 / i
#最後に逆数取るだけ
print(1.0 / v)


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

void push(int);
int pop(void);

int S[101];
int j=0;

int main(void){
  char s[400];
  int x,m,n,i=0,count=0;
  
  while(1){
    scanf("%c",&s[i]);
    if(s[i] == '\n'){
      s[i]='\0';
      break;
    }    
    i++;
  }
  for(i = 0 ; i < strlen(s) ; i++){
    for(count=i ; s[count] != ' ' ; count++);
    
    if(s[i] >= '0' && '9' >= s[i]){
      x = atoi(s+i);
      i = count;
      push(x);
    }
    else if(s[i] == '+'){
      m = pop();
      n = pop(); 
      push(n+m);
      
    }
    else if(s[i] == '-'){
      m = pop();
      n = pop(); 
      push(n-m);
      
    }
    else if(s[i] == '*'){
      m = pop();
      n = pop(); 
      push(n*m);
      
    }  
  }
  printf("%d\n",S[0]);
  return 0;
}

void push(int x)
{
  S[j++] = x; 
}

int pop(void)
{
  return S[--j];
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 10000;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

int a[81][81];
int b[81][81];
bool dp[81][81][SIZE];

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

    int H, W;
    cin >> H >> W;

    for(int i = 1; i <= H; ++i) {
        for(int j = 1; j <= W; ++j) {
            cin >> a[i][j];
        }
    }

    for(int i = 1; i <= H; ++i) {
        for(int j = 1; j <= W; ++j) {
            cin >> b[i][j];
        }
    }

    dp[1][1][0] = true;
    for(int i = 1; i <= H; ++i) {
        for(int j = 1; j <= W; ++j) {
            int dif = abs(a[i][j] - b[i][j]);
            for(int k = 0; k < SIZE; ++k) {
                if(!dp[i][j][k]) continue;
                if(i + 1 <= H) {
                    if(k + dif < SIZE) {
                        dp[i + 1][j][k + dif] = true;
                    }
                    dp[i + 1][j][abs(k - dif)] = true;
                    /*
                    if(k - dif >= 0) {
                        dp[i + 1][j][k - dif] = true;
                    }
                    */
                }
                if(j + 1 <= W) {
                    if(k + dif < SIZE) {
                        dp[i][j + 1][k + dif] = true;
                    }
                    dp[i][j + 1][abs(k - dif)] = true;
                    /*
                    if(k - dif >= 0) {
                        dp[i][j + 1][k - dif] = true;
                    }
                    */
                }
            }
        }
    }

    int res = INF;
    int dif = abs(a[H][W] - b[H][W]);
    for(int i = 0; i < SIZE; ++i) {
        if(dp[H][W][i]) {
            if(i + dif < SIZE) {
                res = min(res, i + dif);
            }
            res = min(res, abs(i - dif));
            /*
            if(i - dif >= 0) {
                res = min(res, i - dif);
            }*/
        }
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 60828
#include <bits/stdc++.h>
#define int long long
using namespace std;
char a,b,c,d,e,f;
signed main(){
  cin >> a >> b >> c >> d >> e >> f;
  if(a==f && b==e && c==d) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
int main() {
	int N;
	cin >> N;
	vector<int>V;
	V.push_back(0);
	for (int i = 0; i < N; ++i) {
		int a;
		cin >> a;
		V.push_back(a);
	}
	V.push_back(0);
	int S = 0;
	for (int i = 0; i < V.size(); ++i) {
		S += abs(V[i] - V[i + 1]);
	}
	for (int i = 1; i < V.size()-1; ++i) {
		cout << S - abs(V[i - 1] - V[i]) - abs(V[i + 1] - V[i]) + abs(V[i + 1] - V[i - 1]) << endl;
	}
	return 0;
}


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

int main() {
  string S,T;
  cin >> S;
  int A=S.size();
  long long sum=0;
  for(int bit=0;bit<(1<<(A-1));bit++){
    long long sumB=0;
    for(int i=0;i<A-1;i++){
      sumB*=10;
      sumB+=S.at(i)-'0';
      if(bit &(1<<i)){
        sum+=sumB;
        sumB=0;
      }
    }
    sumB*=10;
    sumB+=S.at(A-1)-'0';
    sum+=sumB;
  }
  cout << sum << endl;
}

Measured memory_bytes: 3612
#!/usr/bin/env python3
import sys

def solve(N: int, A: "List[int]"):
    val = len(set(A))

    if val%2 == 0:
        print(val-1)
    else:
        print(val)

        
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 20136
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func inputIntSlice(size int) []int {
	slice := make([]int, size)
	for i := range slice {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := inputIntSlice(n)
	balls := make([]int, n)

	ans := make([]int, 0)
	for i := n; i > 0; i-- {
		need := a[i-1]
		for j := i + i; j <= n; j += i {
			need = need ^ balls[j-1]
		}
		balls[i-1] = need
		if need == 1 {
			ans = append(ans, i)
		}
	}

	fmt.Println(len(ans))
	for i := range ans {
		if i < n-1 {
			fmt.Printf("%d ", ans[i])
		} else {
			fmt.Printf("%d", ans[i])
		}
	}
	if len(ans) > 0 {
		fmt.Printf("\n")
	}
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<iomanip>
#include <cmath>
using namespace std;

using std::cout;
using std::cin;
using std::endl;

int main(void){
  int N;
  int cnt = 0;
  string str1;
  cin >> N;
  cin >> str1;
  if (N % 2 == 1){
    cout << "No";
  }
  else{
    for(int i = 0; i < N / 2; i++){
      if (str1.at(i) == str1.at(i + N / 2)){
        cnt++;
      }
    }
    if(cnt == N / 2){
      cout << "Yes";
    }
    else{
      cout << "No";
    }
  }
  
  
}
  

Measured memory_bytes: 256
x, y = map(int, input().split())

g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]

if (x in g1 and y in g1) or (x in g2 and y in g2) or (x in g3 and y in g3):
  print('Yes')
else:
  print('No')

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

int main(){
  string s,t;
  cin >> s >> t;
  
  bool hantei = true;
  for(int i=0; i < s.size(); i++){
    if(s[i] != t[i]) hantei = false;
  }
  if(hantei) cout << "Yes" << endl;
  else cout << "No" << endl;
}

    

Measured memory_bytes: 3624
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;

int main(){
	LL T,n,k,ans = 0,t;
	cin >> T;
	while(T --){
		cin >> n >> k;
		while(1){
			if(n % k == 0){
				ans ^= (n / k);
				break;
			}
			t = n / k;
			n = n - ((n - k * t + t) / (t + 1)) * (t + 1);
		}
	}
	cout << (ans ? "Takahashi" : "Aoki") << '\n';
	return 0;
}

Measured memory_bytes: 256
// B - Two Colors Card Game
// https://atcoder.jp/contests/abc091/tasks/abc091_b
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
#define pb push_back
#define eb emplace_back
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using P = pair<string, lli>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, m, n, ans = 0, count = 1;
  cin >> n;
  vs s(n);
  map<string, lli> mp;
  rep(i, 0, n)
  {
    cin >> s[i];
    mp[s[i]]++;
  }
  cin >> m;
  vs t(m);
  rep(i, 0, m)
  {
    cin >> t[i];
    mp[t[i]]--;
  }
  for (auto it : mp)
  {
    ans = max(ans, it.second);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdbool.h>
#define MAX 1000100

int main(void){
	bool prime[MAX];
	int i,j,n,count;
	for(i=0;i<MAX;i++){
		prime[i]=1;
	}
	prime[0]=prime[1]=0;
	
	for(i=2;i<MAX;i++){
		for(j=2;i*j<MAX;j++){
			prime[i*j]=0;
		}
	}

	while((scanf("%d",&n))!=EOF){
		count=0; 
		for(i=0;i<n+1;i++){
			if(prime[i]==1){
				count++;
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 1572
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

const ll MOD = 1e9 + 7;

// 最大公約数
ll gcd(ll a, ll b)
{
   if (a%b == 0) {
       return(b);
   } else {
       return(gcd(b, a%b));
   }
}

// 最小公倍数
ll lcm(ll a, ll b){
   return a / gcd(a, b) * b;
}

//素数判定
bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された
    if(n % 2 == 0 || n % 3 == 0) return false;
    for(unsigned i = 5; i * i <= n; i += 6) {
        if(n % i     == 0) return false; // (6の倍数)-1
        if(n % (i+2) == 0) return false; // (6の倍数)+1
    }
    return true;
}

void solve() {
    double pie = acos(-1.0);
    double r; cin >> r;
    cout << fixed << setprecision(10) << 2.0*r*pie << endl;
}

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

    solve();
    return 0;
}


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

const int MOD = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    vector<long long> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    long long ans = 0;
    for (int i = 0; i < 60; ++i) {
        long long cnt = 0;
        for (int j = 0; j < n; ++j) {
            if (A[j]>>i&1) ++cnt;
        }
        long long tmp = cnt*(n-cnt)%MOD;
        for (int j = 0; j < i; ++j) {
            tmp = tmp*2%MOD;
        }
        ans = (ans+tmp)%MOD;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int A, B, C;
  int a=0;
  cin >> A >> B >> C;
  for (int i = 1; i <= A * B; i++) {
    for (int j = 0; j <= A; j++) {
      if ( i * A == (j * B + C)) {
        cout << "YES" << endl;
        a++;
        break;
      }
      if ( a > 0 ) {
        break;
      }
    }
  }
  if ( a == 0 ) {
    cout << "NO" << endl;
  }
}

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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
#define curtime chrono::steady_clock::now().time_since_epoch().count
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m) {
  int ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}

int gcd(int a, int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}

int PA(int n) { return (n * (n + 1)) / 2; }

void solution() {
  int n;
  cin >> n;
  vector<int> primes;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {
      int cnt = 0;
      while (n % i == 0) {
        cnt++;
        n /= i;
      }
      primes.pb(cnt);
    }
  }
  if (n != 1) primes.pb(1);
  int ans = 0;
  for (int x : primes) {
    int cur = 0;
    while (PA(cur + 1) <= x) {
      cur++;
    }
    ans += cur;
  }
  cout << ans << endl;
}

int32_t main() {
  DESYNC;
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  solution();
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
using namespace std;
const int M = 3e5 + 10;
typedef long long ll;
int a[M];
struct cmp1 {
    int x;
    cmp1(int x):x(x) {}
    bool operator < (const cmp1 &a) const {
        return x > a.x;
    }
};
struct cmp2 {
    int x;
    cmp2(int x):x(x) {}
    bool operator < (const cmp2 &a) const {
        return x < a.x;
    }
};
ll dpf[M] , dpe[M];
int main() {
    int n;
    scanf("%d" , &n);
    for(int i = 1 ; i <= 3 * n ; i++) {
        scanf("%d" , &a[i]);
    }
    priority_queue<cmp1> st;
    memset(dpf , 0 , sizeof(dpf));
    memset(dpe , 0 , sizeof(dpe));
    for(int i = 1 ; i <= n ; i++) {
        st.push(cmp1(a[i]));
        dpf[n] += (ll)a[i];
    }
    for(int i = n + 1 ; i <= 2 * n ; i++) {
        int gg = st.top().x;
        if(gg < a[i]) {st.pop() , st.push(cmp1(a[i])) , dpf[i] = dpf[i - 1] - (ll)gg + (ll)a[i];}
        else dpf[i] = dpf[i - 1];
    }
    priority_queue<cmp2> ed;
    for(int i = 2 * n + 1 ; i <= 3 * n ; i++) {
        ed.push(cmp2(a[i]));
        dpe[2 * n + 1] += (ll)a[i];
    }
    for(int i = 2 * n ; i >= n ; i--) {
        int gg = ed.top().x;
        if(gg > a[i]) {ed.pop() , ed.push(cmp2(a[i])) , dpe[i] = dpe[i + 1] - (ll)gg + (ll)a[i];}
        else dpe[i] = dpe[i + 1];
    }
    ll ans = -10000000000000000;
    for(int i = n ; i <= 2 * n ; i++) {
        ans = max(ans , dpf[i] - dpe[i + 1]);
    }
    printf("%lld\n" , ans);
    return 0;
}

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

using namespace std;

int main() {
    int N, K;
    string S;
    cin >> N, cin >> S, cin >> K;
    char k = S[K - 1];
    for (int i = 0; i < N; ++i) cout << (S[i] == k ? S[i] : '*');
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  long long int x[n],ans=1000000000,l,r,tmp1,tmp2;
  for(int i=0;i<n;i++){
     cin >> x[i];
  }
  for(int i=0;i<(n-k+1);i++){
     l=i;
     r=i+k-1;
     tmp1=abs(x[l])+abs(x[r]-x[l]);
     tmp2=abs(x[r])+abs(x[r]-x[l]);
     ans=min(ans,tmp1);
     ans=min(ans,tmp2);
  }
  cout << ans <<endl;
}


Measured memory_bytes: 1024
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    a, b, n = map(int, input().split())

    ans = 0

    x = min(b - 1, n)
    ans = max(int(a * x / b) - a * int(x / b), ans)

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


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

using namespace std;
#define ll long long
#define ld long double

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << " " << b << " " << c << endl;
}


Measured memory_bytes: 256
import sys
import numpy as np
import numba

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


@numba.njit("(i8, i2[:], i4[:,:], i8[:])", cache=True)
def optimize(D, C, S, sol):
    def calc_score(sol):
        last = -np.ones((26, D + 1))
        score = 0
        for d in range(D):
            ct = sol[d]
            score += S[d, ct]
            for i in range(26):
                last[i, d + 1] = last[i, d]
            last[ct, d + 1] = d
            for i in range(26):
                score -= C[i] * (d - last[i, d + 1])
        return score, last

    sol_bak = sol.copy()
    max_score, last = calc_score(sol)
    last_bak = last.copy()

    def update(d, before, after):
        score = max_score
        score -= S[d, before]
        score += S[d, after]
        lb = last[before, d]
        la = last[after, d]
        da = db = 0
        for x in range(d, D):
            if x > d and sol[x] == before:
                break
            last[before, x + 1] = lb
            db += 1
        score -= C[before] * (d - lb) * db
        for x in range(d, D):
            if x > d and sol[x] == after:
                break
            last[after, x + 1] = d
            da += 1
        score += C[after] * (d - la) * da
        sol[d] = after
        return score

    tried = numba.typed.Dict.empty(
        key_type=numba.types.int64, value_type=numba.types.boolean
    )
    for i in range(20000):
        new_d = np.random.randint(0, D)
        c_before = sol[new_d]
        c_after = np.random.randint(0, 26)
        if c_before == c_after:
            continue
        candidate = new_d * 26 + c_after
        if candidate in tried:
            continue
        tried[candidate] = True
        new_score = update(new_d, c_before, c_after)
        if max_score < new_score:
            max_score = new_score
            sol_bak = sol.copy()
            last_bak[c_before, :] = last[c_before, :].copy()
            last_bak[c_after, :] = last[c_after, :].copy()
            tried.clear()
        else:
            sol = sol_bak.copy()
            last[c_before, :] = last_bak[c_before, :].copy()
            last[c_after, :] = last_bak[c_after, :].copy()


def main():
    D = ini()
    C = np.array(inl(), dtype="int16")
    assert len(C) == 26
    S = np.zeros((D, 26), dtype="int32")
    for i in range(D):
        S[i, :] = inl()

    sol = np.random.randint(0, 26, D)
    optimize(D, C, S, sol)

    print(*(sol + 1), sep="\n")


main()


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


int main()
{
	while (1)
	{
		int x, y;
		cin >> x >> y;
		if (x == 0 && y == 0) break;
			if (x > y)
			{
				cout << y << " " << x<< endl;
			}
			else { cout << x << " " << y << endl;
			}
}
    return 0;
}




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

int main(){
	int a, b;
  	cin >> a >> b;
  
  	if(a == b){
      cout << "Draw" << endl;
    } else if(a > b){
      if(b != 1){
        cout << "Alice" << endl;
      } else {
        cout << "Bob" << endl;
      }
    } else {
      if(a != 1){
        cout << "Bob" << endl;
      } else {
        cout << "Alice" << endl;
      }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

ll N,M;
ll g[1024][1024];
ll a[1024],b[1024],c[1024];

int main(){
    cin >> N >> M;
    debug2(N,M);

    rep(i,N)rep(j,N) g[i][j] = LINF;
    rep(i,N) g[i][i] = 0;

    rep(i,M){
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;
        b[i]--;
        g[a[i]][b[i]] = g[b[i]][a[i]] = c[i];
    }

    rep(k,N) rep(i,N) rep(j,N) g[i][j] = min(g[i][j] , g[i][k] + g[k][j]);

    ll cnt = 0;

    rep(i,M){
        if(g[a[i]][b[i]] < c[i]) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int INF=2147483647;
int ANS=INF,N=1,seg[1<<18];
void init(int N_){
	while(N<N_) N*=2;
	N*=2;
	for(int i=1;i<N;i++) seg[i]=INF;
}
void update(int Num,int value){
	int num=Num;
	seg[num]=value;
	num/=2;
	while(num>0){
		seg[num]=min(seg[num*2],seg[num*2+1]);
		num/=2;
	}
}
void query(int left,int right,int tree_num,int tree_left,int tree_right){
	if(left>tree_right||right<tree_left) return;
	if(right>=tree_right&&left<=tree_left){
		ANS=min(ANS,seg[tree_num]);
		return;
	}
	query(left,right,tree_num*2,tree_left,(tree_left+tree_right)/2);
	query(left,right,tree_num*2+1,(tree_left+tree_right)/2+1,tree_right);
}
int main(){
	int N_,C;
	/*puts("?????\???????????????????????????\n");
	puts("????????´??°:0 num value\n");
	puts("RMQ??\??¢:1 L R\n");*/
	scanf("%d%d",&N_,&C);
	N_++;
	init(N_);
	for(int i=0;i<C;i++){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		switch(a){
			case 0:
				b++;
				update(N/2-1+b,c);
				break;
			case 1:
				b++;
				c++;
				ANS=INF;
				query(b,c,1,1,N/2-1);
				printf("%d\n",ANS);
				break;
		}
	}
	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;


#define rep(i, a, b) for (size_t i = a; i < (size_t)b; i++)

int main(){

	int n;
	cin >> n;

	int pesos[n];
	int suma_parcial[n];
	int suma_total = 0;
	int temp;

	cin >> temp;
	suma_total += temp;
	pesos[0] = temp;
	suma_parcial[0] = temp;

	rep(k, 1 , n){
		cin >> temp;
		suma_total += temp;
		pesos[k] = temp;
		suma_parcial[k] = suma_parcial[k-1] + temp; 
	}

	int abs_dif = 100000;

	rep(k, 1, n-1){
		abs_dif = min(abs(suma_total - 2*suma_parcial[k]), abs_dif);
	}

	cout << abs_dif << endl;


	return 0;
}

Measured memory_bytes: 256
r, g, b, n = map(int, input().split())

ans = 0

for i in range(3001):
    if i*r > n:
        break
    for j in range(3001):
        value = r*i + g*j
        if (n - value) < 0:
            break
        elif (n - value) % b == 0:
            ans += 1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    string s; cin>>s;
    int a,z;
    for(int i=0;i<s.size();i++){
        if(s[i]=='Z') z=i;
    }
    for(int i=s.size()-1;i>=0;i--){
        if(s[i]=='A') a=i;
    }
    cout<<z-a+1<<endl;
    
}


Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e9
const int mod = 1000000007;
typedef long long ll;
//------------------------------------------------------------------------



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

  ll cnt2=0, cnt5=0;
  ll n;
  cin >> n;
  if(n%2!=0 || n<10){
    cout << 0 << endl;
    return 0;
  }
  
  
  ll num = 10;
  while(num<=n){
    cnt5 += n / num;
    num *= 5;
  }
  
  cout << cnt5 << endl;
  
  return 0;
}





Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
using ll=long long;
const ll MOD=1e9+7;
const int INF=1<<30;

int main(){
  double N;
  cin >> N;
  int a=N/1.08;
  int b=a+1;
  double c=N/1.08;
  double d=(N+1)/1.08;
  if(c<=a&&a<d)
    cout << a << endl;
  else if(c<=b&&b<d)
    cout << b << endl;
  else
    cout << ":(" << endl;
  
  
  
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#define maxn 100050
using namespace std;
typedef long long ll;
ll a[maxn],b[maxn],c[maxn],n,i,ans=0ll,l,r,L,mid;
int main()
{
	scanf("%lld",&n);
	for (i=1;i<=n;i++) scanf("%lld",&a[i]);
	for (i=1;i<=n;i++) scanf("%lld",&b[i]);
	for (i=1;i<=n;i++) scanf("%lld",&c[i]);
	sort(a+1,a+n+1),sort(b+1,b+n+1),sort(c+1,c+n+1);
	for (i=1;i<=n;i++)
	{
		l=0,r=n;
		while (l!=r)
		{
			mid=(l+r+1)/2;
			if (a[mid]<b[i]) l=mid;else r=mid-1;
		}
		L=l;
		l=1,r=n+1;
		while (l!=r)
		{
			mid=(l+r)/2;
			if (c[mid]>b[i]) r=mid;else l=mid+1;
		}
		ans+=L*(n-r+1);
	}
	printf("%lld",ans);
} 

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
using namespace std;
int arr[1000000],arr1[1000000];
long long v = 0;
int main(){
    int a,b,c,i,n;
    //cin>>n>>a;
    cin>>n;
    for(i = 0;i <= n;i++){
        cin>>arr[i];
    }//城市
    for(i = 0;i < n;i++){
        cin>>arr1[i];
    }//英雄

    for(i = 0;i < n;i++){
        if(arr[i]>=arr1[i]){
            v = v+arr1[i];
            //cout<<v<<" 11111"<<endl;
        }
        else{
            v = v+arr[i];
           // cout<<v<<" 2222"<<endl;
            arr1[i] = arr1[i]-arr[i];
            if(arr1[i] >= arr[i+1]){
                v = v+arr[i+1];
                arr[i+1] = 0;
                //cout<<v<<" 3333"<<endl;
            }
            else{
                v = v+arr1[i];
                arr[i+1] = arr[i+1]-arr1[i];
                //cout<<v<<" 4444"<<endl;
            }
        }
    }
    cout<<v;
}


Measured memory_bytes: 4736
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <cstdio>

int main() {

    int n; scanf("%d", &n);

    int ans[512] = {};
    for (int j = 1, j_end = n-1; j <= j_end; ++j) {
        for (int l = j & -j; l; ++ans[j-1]) l >>= 1;
    }
    for (int i = 0, i_end = n-2; i <= i_end; ++i) {
        for (int j = 0, j_end = n-2-i; j <= j_end; ++j) {
            printf("%d%c", ans[j], j == j_end ? '\n' : ' ');
        }
    }
    
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#define N 100005
using namespace std;

int n, ans = 1, c[N];
int M = 1e9 + 7;
int main()
{
	int i, t;
	cin >> n;
	for (i = 0; i < n; i++) {
		scanf("%d", &t);
		if (++c[t] > 2) ans = 0;
	}
	if (c[0] > 1) ans = 0;
	for (i = 0; i < n / 2; i++) ans = ans * 2 % M;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(){
    int n , x ;
    cin >> n ;
    for(int i = 1 ; i <= n ; i++){
        x = i ;
        if(x % 3 == 0){
            cout << " " << i ;
        }else{
            while(x){
                if(x % 10 == 3){
                    cout << " " << i ;
                    break ;
                }
                x /= 10 ;
            }
        }
    }
    cout << endl ;
}



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

#define int long long
#define double long double 
#define PI 3.141592653589793
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

const int INF = 1e9;
const int MAXN = 200000;
const int LOGN = 19;
const int mod = 1e9+7;
const double eps = 1e-7;

	int a[MAXN];
signed main() {
	FAST
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];

	int x = 0;
	for (int i = 0; i < n; i += 2) {
		x = x ^ (a[i] ^ a[i + 1]);
	}

	for (int i = 0; i < n; i++) {
		cout << (a[i] ^ x) << ' ';
	}
}

Measured memory_bytes: 5212
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

const ll INF = 1e+17;

struct edge{
    long from;
    long to;
    long cost;
};

vector<int> G_inv[1000];
bool reach[1000];
ll dist[1000];

//return
//true:if nagetive loop does not exist
//false:if negative loop exists
//d:result
bool bellmanford(vector<edge> es, ll d[], int s, int num_v){
    for(long i = 0; i < num_v; i++){
        d[i] = INF;
    }
    d[s] = 0;
    int cnt_loop = 0;
    while(true){
        cnt_loop++;
        bool update = false;
        bool update_end = false;
        for(int i = 0; i < es.size(); i++){
            edge e = es[i];
            if(d[e.from] != INF && d[e.from]+e.cost < d[e.to]){
                d[e.to] = d[e.from]+e.cost;
                update = true;
                if(cnt_loop >= num_v && reach[e.to]) update_end = true;
            }
        }
        if(!update) return true;
        else if(cnt_loop >= num_v) return !update_end;
    }
}


void dfs(int v){
    reach[v] = true;
    for(int i = 0; i < G_inv[v].size(); i++){
        if(!reach[G_inv[v][i]]) dfs(G_inv[v][i]);
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N, M;
    cin >> N >> M;
    vector<edge> es;
    for(int i = 0; i < M; i++){
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        G_inv[b].push_back(a);
        es.push_back((edge){a, b, -c});
    }
    dfs(N-1);
    if(!bellmanford(es, dist, 0, N)){
        cout << "inf" << endl;
    }else{
        cout << -dist[N-1] << endl;
    }
}

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

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

    vector<long long> a;
    vector<long long> b(n);
    
    for(long long i = 0;i<n;i++)
    {
        cin >> b[i];
    }
    
    
    while(b.empty() == false)
    {
        long long s = b.size();
        
        for(long long i = b.size()-1;i>=0;i--)
        {
            if(b[i] == i+1)
            {   
                a.push_back(b[i]);
                b.erase(b.begin()+i);
                break;
            }

        }
        if(s == b.size())
        {
            break;    
        }
    }

    if(a.size() == n)
    {
        for(long long i = n-1;i>=0;i--)
        {
            cout << a[i] << endl;
        }
    }
    else
    {
        cout << -1 << endl;
    }

    return 0;    
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code

int main(int argc, char const* argv[])
{
	LL n,k;
	cin >> n >> k;
	VL a(n);
	cin >> a;
	VL bi(n,0);
	VL ball(n,0);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (a[i] >a[j]) {
				ball[i]++;
				if (j > i) {
					bi[i]++;
				}
			}
		}
	}
	LL ans = 0;
	for (int i = 0; i < n; i++) {
		ans += bi[i]*k;
		ans %= MOD;
		LL mul = (k*(k-1)/2)%MOD;
		ans += ball[i]*mul;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}


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

#define M 1000001//task
#define NIL (-1)
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
    if ( ch == 'A') return 1;
    else if ( ch == 'C') return 2;
    else if ( ch == 'G') return 3;
    else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
    long long sum = 0, p = 1, i;
    for ( i = 0; i < strlen(str); i++ ){
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key){ return key%M; }//task
int h2(int key){ return 1+key%(M-1); }//task

int find(char str[]){//task
    int i=0,j;
    while(1){
        j=(h1(getKey(str))+i*h2(getKey(str)))%M;
        if(H[j][0]!=NULL){
            if(strcmp(H[j],str)==0){
                return 1;
            }
            else i++;
        }
        else{
            return 0;
        }
    }
}

int insert(char str[]){//task
    int i=0,j;
    while(1){
        j=(h1(getKey(str))+i*h2(getKey(str)))%M;
        if(H[j][0]==NULL){
            strcpy(H[j],str);
            break;
        }
        else i++;
    }
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
        scanf("%s %s", com, str);
        
        if ( com[0] == 'i' ){
            insert(str);
        } else {
            if (find(str)){
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 14280
#include <iostream>
#include <map>
#include <utility>

using namespace std;

int main(){


	long long H,W,N;
	cin>>H>>W>>N;

	std::map<pair<int, int>, long> m;

	long x,y;
	for(long i=0 ; i<N ; i++){
		cin>>x>>y;
		for(int x_offset = -1 ; x_offset<=1 ; x_offset++){
			for(int y_offset = -1 ; y_offset<=1 ; y_offset++){
				if(x+x_offset<2 || y+y_offset<2 || x+x_offset>H-1 || y+y_offset>W-1)continue;
				m[make_pair(x+x_offset, y+y_offset)]+=1;
	
			}		
		}
	}

	long count[10] = {0};
	count[0]=(H-2)*(W-2);

	for(auto elem:m){
		count[elem.second]++;
		count[0]--;
	}

	for(int i=0; i<10;i++){
		cout << count[i] << endl;
	}
}


Measured memory_bytes: 56448
#include<stdio.h>

int main() {
	int n,i,j,rank;
	char c,mark[4] = "SHCD";
	
	int card[4][13] = {0};
	scanf("%d", &n);
	for(i = 0; i < n; i++) {
		scanf(" %c %d", &c, &rank);
		for(j = 0; j < 4; j++) {
			if(c == mark[j]) {
				card[j][rank-1] = 1;
			}
		}
	}
	for(i = 0; i < 4; i++) {
		for(j = 0; j < 13; j++) {
			if(card[i][j] == 0) {
				printf("%c %d\n", mark[i], j + 1);
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 596
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

const ll MOD = 1e9+7;
template<class Type>
Type solve(Type res = Type()){
    int N; string S; cin >> N >> S;
    vector<vector<ll>> cnt(N+1,vector<ll>(26));
    for(int i = N-1; i >= 0; i--){
        for(int j = 0; j < 26;j++){
            cnt[i][j] = cnt[i+1][j];
        }
        cnt[i][S[i]-'a']++;
    }
    for(int i = 0; i < N;i++){
        ll T = 1;
        for(int j = 0; j < 26;j++){
            if(S[i]-'a' == j) continue;
            (T *= (cnt[i+1][j]+1))%=MOD;
        }
        (res += T)%=MOD;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}


bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;


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

    vector<vector<int>> v(n, vector<int>(m));
    rep(i, n) rep(j, m) cin >> v[i][j], v[i][j]--;

//    rep(i, n) reverse(v[i].begin(), v[i].end());

    vector<bool> exclude(m, false);

    int ans = INT_MAX;

    while (count(exclude.begin(), exclude.end(), false) > 0) {
        vector<int> join(m);

        rep(i, n) {
            rep(j, m) {
                int t = v[i][j];
                if (!exclude[t]) {
                    join[t]++;
                    break;
                }
            }
        }

        int now = *max_element(join.begin(), join.end());
//        cout << now << endl;
        cmin(ans, now);
        rep(i, m) {
            if (join[i] == now) {
                exclude[i] = true;
            }
        }

    }
    cout << ans << endl;

}

Measured memory_bytes: 3960
import java.util.*;
class Main{
	public static void main(String args[]){
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	double d = 0;
      	for(int i=0;i<n;i++){
        	int a = sc.nextInt();
          	d += (double)1/a;
        }
      	System.out.println(1/d);
    }
}

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

int Selection(int arr[], int n)
{
    int i, j, cnt = 0;
    for(i = 0; i < n; i++)
    {
        int mini = i;
        for(j = i; j < n; j++)
        {
            if(arr[j] < arr[mini])
                mini = j;
        }
        swap(arr[i], arr[mini]);
        if(i != mini) cnt++;
    }
    return cnt;
}
int main()
{
    int n;
    cin >> n;
    int arr[n];
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    int ans = Selection(arr, n);
    for(int i = 0; i < n; i++)
        cout << arr[i] << (i == n-1 ? '\n' : ' ');
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3104
n = int(input())
l = list(map(int, input().split(' ')))
absl = [abs(i) for i in l]
mmm = len([True for i in l if i < 0])
if mmm % 2 == 0:
  print(sum(absl))
else:
  print(sum(absl) - min(absl)*2)

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

int main(){
    int n;
    int d[100];
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> d[i];
    }

    ll sum = 0;
    for (int i = 1; i <= n-1; i++){
        for (int j = i + 1; j <= n; j++){
            sum += d[i]*d[j];
        }
    }
    cout << sum << "\n";
    
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
  val sc = java.util.Scanner(System.`in`)
  val N = sc.nextInt()
  val D = sc.nextInt()
  val X = sc.nextInt()
  val A = Array(N) { sc.nextInt() }
  val sum = A.map {
    (D - 1)  / it + 1
  }
  println(sum.sum() + X)
}


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

typedef long long ll;

#define rep(i,n) for(int i = 0; i < n; i++)
#define debug(x) cerr << #x << ": " << x << "\n";

using namespace std;
 
const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;

int main(){
  int X, a, b;
  cin >> X;
  for(int i=-120; i<=120; i++){
    for(int j=-120; j<=120; j++){
      if((pow(i,5) - pow(j,5)) == X){
	a = i;
	b = j;
      }
    }
  }
  cout << a << " " << b << endl;
}


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

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++) {
        char t = s.at(i);
        if (i % 2 == 0) {
            if (t != 'R' && t != 'U' && t != 'D') {
                cout << "No" << endl;
                return 0;
            }
        } else {
            if (t != 'L' && t != 'U' && t != 'D') {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}


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

typedef pair<string,int> P;

int main(){
  int N;
  cin >> N;
  queue<P> prev;
  char al[10]={'a','b','c','d','e','f','g','h','i','j'};
  for(int i=0; i<N; i++){
    if(i==0){
      prev.push(P("a",0));
      continue;
    }
    queue<P> que;
    while(!prev.empty()){
      P p = prev.front(); prev.pop();
      for(int j=0; j<=p.second+1; j++){
        if(p.second<j){
          que.push(P(p.first+al[j],j));
        }else{
          que.push(P(p.first+al[j],p.second));
        }
      }
    }
    while(!que.empty()){
      P p = que.front(); que.pop();
      prev.push(p);
    }
  }
  while(!prev.empty()){
    P p = prev.front(); prev.pop();
    cout << p.first;
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 8960