akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;

int main(void) {
    i64 n, ans = 0;
    cin >> n;
    for (i64 i = 1; i * i < n; i++) {
        if (n % i == 0) {
            i64 x = n / i - 1;
            if (n / x > x) continue;
            ans += n / i - 1;
        }
    }
    cout << ans << endl;
}

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

#define FOR(i,a,b)  for(ll (i)=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll (i)=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define SZ(v)       (ll)(v).size()
#define ALL(v)      v.begin(), v.end()
#define UNIQ(v)     sort(ALL(v)); v.erase(unique(ALL(v)), v.end())
#define BIT(n)      (1LL<<(n))
#define PQ(T)       priority_queue<T, vector<T>, greater<T>>
#define SHOW(x)     cout << #x << " = " << x << endl

template<typename T>string join(const vector<T>& v, string d=" ")
{stringstream s;REP(i,SZ(v))s<<d<<v[i];return s.str().substr(d.length());}

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v)
{if(SZ(v))s<<join(v,", ");return s;}

const ll inf = 1e15;
const ll mod = 1e9+7;
const double eps = 1e-10;

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

double dp[105][105];

int main() {
    ll N; cin >> N;
    vector<ll> T(N); REP(i, N) cin >> T[i];
    vector<ll> V(N); REP(i, N) cin >> V[i];
    
    fill((double *)dp, (double *)dp + 105 * 105, 0.0);
    dp[0][0] = 1;
    REP(i, N) REP(v, 105) if (dp[i][v] and v <= V[i]) {
        REP(vv, 105) if (vv <= V[i]) {
            ll a = V[i] - v;
            ll b = V[i] - vv;
            if (a + b <= T[i]) {
                double up = 1.0 * (v + V[i]) * a / 2;
                double stay = V[i] * (T[i] - a - b);
                double down = 1.0 * (vv + V[i]) * b / 2;
                double c = up + stay + down;
                dp[i+1][vv] = max(dp[i+1][vv], dp[i][v] + c);
            } else if (T[i] < abs(vv - v)) {
                
            } else {
                double x = 1.0 * (vv - v + T[i]) / 2;
                double y = 1.0 * (T[i] - vv + v) / 2;
                double vvv = v + x;
                
                double up = 1.0 * (v + vvv) * x / 2;
                double down = 1.0 * (vv + vvv) * y / 2;
                
                double c = up + down;
                dp[i+1][vv] = max(dp[i+1][vv], dp[i][v] + c);
            }
        }
    }
    cout << fixed << setprecision(9);
    cout << dp[N][0] - 1 << endl;;
    
    return 0;
}


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

int main() {
	int D,N;
	cin >> D >> N;
	cout << (int)pow(100,D)*((N==100) ? N+1 : N) << endl;
}

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

import sys
import os


W, a, b = map(int, input().split())

if a <= b:
    if a + W <= b:
        diff = b - (a + W)
        print(diff)
    else:
        print(0)
else:
    if b + W <= a:
        diff = a - (b + W)
        print(diff)
    else:
        print(0)




Measured memory_bytes: 2940
#葉の総和-1=分岐の数

n=int(input())
a=list(map(int,input().split()))
s=sum(a)-1
ans,x=0,1

for i in range(n):
  if a[i]>x-1:
    print(-1)
    exit()
  ans+=x
  x-=a[i]
  if i<n-1 and x<=0:
    print(-1)
    exit()
  if s>=0:
    if s>=x:
      s-=x
      x=x*2
    else:
      x=(x-s)+s*2
      s=0
if x!=a[-1] or x<=0:
  print(-1)
  exit()
ans+=x
print(ans)

Measured memory_bytes: 20004
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	const initialBufSize = 4096
	const maxBufSize = 1000000
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	scanner.Split(bufio.ScanWords)
	var N int64
	scanner.Scan()
	N, _ = strconv.ParseInt(scanner.Text(), 10, 64)
	var K int64
	scanner.Scan()
	K, _ = strconv.ParseInt(scanner.Text(), 10, 64)
	var S string
	scanner.Scan()
	S = scanner.Text()
	fmt.Println(solve(N, K, S))
}
func solve(N int64, K int64, S string) string {
	m := map[rune]rune{'A': 'a', 'B': 'b', 'C': 'c'}
	s := []rune(S)
	s[K-1] = m[s[K-1]]
	return string(s)
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <string>
#include <sstream>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define rep2(i, n) for(int i = 1; i <= (int)n; ++i)
#define repit(it, t) for(__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++)

#define pb push_back
#define lb lower_bound
#define mp make_pair
#define ite iterator
#define ul unsigned long
#define ull unsigned long long
#define INF 1000000007
#define MOD 1000000007
#define EPS 1.0e-6
#define fs first
#define sd second

template<typename T>
bool elem(set<T> st, T val){
	return (st.find(val) != st.end());
}

template<typename T>
void printv(vector<T> vt){
    if(vt.size() == 0) return;
    rep(i, vt.size() - 1)
        cout << vt[i] << " ";
    cout << vt[vt.size() - 1] << endl;
}

typedef vector<int> vint;
typedef vector<ul> vul;
typedef vector<ull> vull;
typedef pair<int, int> pii;

int main(void){
    ios::sync_with_stdio(false);
    string s;
    int ret = 0;
    while(cin >> s){
        string s0 = s;
        reverse(s.begin(), s.end());
        if(s == s0) ret++;
    }
    cout << ret << endl;
    return 0;
}

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

int main(){
    int a,b;
    cin>>a>>b;
    
    for(int i = 1; i < 2000; i++){
        int aa = i*8/100; int bb = i*10/100;
        if(aa==a && bb == b){
          cout<<i;
          return 0;
        }
    }
    cout<<-1;

}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int max=0,x=0,n,i;
  char str[1000];
  scanf("%d",&n);
  scanf("%s",str);
  for(i=0;i<n;i++){
    if(str[i]=='I') x++;
    if(str[i]=='D') x--;
    if(max<x) max=x;
  }
  printf("%d",max);
  return 0;
}

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

int main(){
    int N;
    int remainder;
    bool lucky = false;

    cin >> N;
    rep(i, 3){
        remainder = N % 10;
        if (remainder == 7){
            lucky = true;
            break;
        }
        N /= 10;
    }

    if (lucky){
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    string a, b, c;
    cin >> a >> b >> c;
    cout << a[0] << b[1] << c[2];
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    Integer A[] = new Integer[N];
    for(int i=0; i<N; i++) A[i] = sc.nextInt();
    Arrays.sort(A);
    int count = 1;
    int ans = 0;
    for(int i=1; i<N; i++){
      if(A[i].equals(A[i-1])){
        count++;
      }else{
        ans += count % 2;
        count = 1;
      }
    }
    ans += count % 2;
    out.println(ans);
  }

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

Measured memory_bytes: 62724
#include <bits/stdc++.h>
#include <map>
#include <cmath>
typedef long long int ll;
using namespace std; 
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	ll h;cin>>h;
	ll n=0;
	while(h>0){
		n++;
		h = h/2;
	}
	ll ans = pow(2,n) -1;
	cout<<ans<<endl;
}


Measured memory_bytes: 512
N = int(input())

aa = [0] + list(map(int, input().split())) + [0]


dd = [0] * (N + 1)
for i in range(1, N + 2):
    dd[i - 1] = abs(aa[i] - aa[i - 1])

S = sum(dd)

for i in range(1, N + 1):
    print(S - dd[i] - dd[i - 1] + abs(aa[i + 1] - aa[i - 1]))


Measured memory_bytes: 13920
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define MXN 300000
int f1[500005],f2[500005];
void KMP(char *c,int *f){
    f[0]=-1;
    int j=-1;
    for(int i=1;c[i]!=0;i++){
        while(j!=-1&&c[j+1]!=c[i])j=f[j];
        if(c[j+1]==c[i])j++;
        f[i]=j;
    }
}
int main(){
    char c[500005];
    scanf("%s",c);
    int same=1;
    for(int i = 1;c[i]!=0;i++){
        if(c[i]!=c[0]){
            same=0;
            break;
        }
    }
    if(same){
        printf("%d\n1\n",strlen(c));
    }
    else{
        KMP(c,f1);
        int len=strlen(c);
        if(f1[len-1]!=-1&&len%(len-f1[len-1]-1)==0){
            reverse(c,c+len);
            KMP(c,f2);
            int ans=1;
            for(int i =2;c[i]!=0;i++){
               // printf("%d %d\n",i,f1[i-1]);
                if(c[i+1]==0)
                ans++;
                else if(f1[i-1]==-1||i%(i-f1[i-1]-1)!=0){
                   // printf("%d\n",i);
                    int k=len-i;
                    int ll=k;
                  //  printf("%d %d\n",ll,f2[k-1]);
                    if(f2[k-1]==-1||ll%(ll-f2[k-1]-1)!=0){
                      //  printf("%d\n",i);
                        ans++;
                    }
                }
            }
            printf("2\n%d\n",ans);
        }
        else{
            printf("1\n1\n");
        }
    }
}
/*
5 4
8 1 0 3 0
0 0 1 3 8
1
*/

Measured memory_bytes: 4608
require 'prime'
def _divisors(primes, k)
  Enumerator.new do |y|
    if primes.size == k
      y << 1
    else
      p, e = primes[k]
      _divisors(primes, k + 1).each {|d|
        (e + 1).times {|e1|
          y << p ** e1 * d
        }
      }
    end
  end
end

def divisors(n)
  _divisors(Prime.prime_division(n), 0).to_a.sort
end

N = gets.to_i
ls=divisors(N)
L=ls.length
x=L.div(2)
if L.modulo(2)==1
  p ls[x]+ls[x]-2
else
  p ls[x]+ls[x-1]-2
end
  

Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define pb push_back
#define show(x) cout << (#x) << " : " << x << endl;
#define ll long long
#define ld long double

#define mp make_pair
#define ff first
#define ss second
#define pii pair<ll, ll>
#define sq(x) ((x) * (x))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
const ll MOD = 1000 * 1000 * 1000 + 7;
using namespace std;



ll N;



ll p[100005];


ll dp[100005];


ll rec(ll idx,ll D)
{
  
if (idx+1>D-1)
return 0;  

if (dp[idx]!=INT_MAX)
return dp[idx];
else if (idx==N-2) 
return dp[idx]=min(abs(p[idx]-p[idx+1])+rec(idx+1,D),LLONG_MAX);
else
return dp[idx]=min(abs(p[idx]-p[idx+1])+rec(idx+1,D),abs(p[idx]-p[idx+2])+rec(idx+2,D));



}



int main()
{


cin>>N;

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

fill(dp,dp+N,INT_MAX);

ll k=rec(0, N);

cout<<k;
    
return 0;
}


Measured memory_bytes: 4096
import math
N = int(input())
A = list(map(int, input().split()))
sumA = sum(A)
halfA = math.ceil(sumA / 2)
bitset = 1
for a in A:
    bitset |= bitset << a
bitset >>= halfA
i = 0
while 1:
    if bitset & 1:
        print(i + halfA)
        exit()
    bitset >>= 1
    i += 1

Measured memory_bytes: 5472
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n; cin>>n;
	string s; cin>>s;
	int cnt=0;
	for(int i=0; i<n; i++){
		if(s[i]=='R') cnt++;
	}
	int s1=0, s2=0;
	for(int i=0; i<cnt; i++){
		if(s[i]=='W') s1++;
	}
	for(int i=cnt; i<n; i++){
		if(s[i]=='R') s2++;
	}
	cout<<min(s1, s2)<<endl;
	return 0;
}

Measured memory_bytes: 3748
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string.h>
#include<math.h>
#include<cstring>
using namespace std;
int semi[51][51],h,w,r[51][51];
int min(int a,int b){
	if(a<b){
		return a;
	}else{
		return b;
	}
}
int min(int a,int b,int c,int d){
	int mini;
	mini=min(a,b);
	mini=min(mini,c);
	mini=min(mini,d);
	return mini;
}
int main(){
	int i,a=0,b=0,c=0,d=0;
	char ch[301];
	cin>>ch;
	for(i=0;i<strlen(ch);i++){
		switch(ch[i]){
		case 'K':
			a++;
			break;
		case 'U':
			b++;
			break;
		case 'P':
			c++;
			break;
		case 'C':
			d++;
			break;
		default:
			break;
		}
	}
	cout<<min(a,b,c,d)<<endl;

	return 0;
}

Measured memory_bytes: 1144
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
int lo[101010], hi[101010], val[101010];
int d[101010];
vector<int> g[101010];
const int INF = 1 << 30;
void dfs (int cur, int par, int depth) {
  d[cur] = depth;
  for (int child : g[cur]) if (child != par) dfs (child, cur, depth + 1);
}
void dfs2 (int cur, int par) {
  for (int child : g[cur]) if (child != par) {
    lo[child] = max(lo[child], lo[cur] - 1);
    hi[child] = min(hi[child], hi[cur] + 1);
    dfs2 (child, cur);
  }
}
void dfs3 (int cur, int par) {
  for (int child : g[cur]) if (child != par) {
    dfs3 (child, cur);
    lo[cur] = max(lo[cur], lo[child] - 1);
    hi[cur] = min(hi[cur], hi[child] + 1);
  }
}
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int k;
  cin >> k;
  fill(lo, lo + n + 1, -INF);
  fill(hi, hi + n + 1, INF);
  fill(val, val + n + 1, INF);
  for (int i = 0; i < k; i++) {
    int v, p;
    cin >> v >> p;
    v--;
    val[v] = lo[v] = hi[v] = p;
  }
  dfs (0, -1, 0);
  dfs2 (0, -1);
  dfs3 (0, -1);
  dfs2 (0, -1);
  dfs3 (0, -1);
  int p = -1;
  for (int i = 0; i < n; i++) {
    if (val[i] != INF) {
      if (p == -1) p = (val[i] % 2) ^ (d[i] % 2);
      if (p != ((val[i] % 2) ^ (d[i] % 2))) {
        cout << "No\n";
        return 0;
      }
    }
    if (lo[i] > hi[i]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  for (int i = 0; i < n; i++) {
    cout << lo[i] << '\n';
  }
  return 0;
}

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

using namespace std;
using ll=long long;

int main() {
  int n; cin >> n;
  vector<int> A(n);
  vector<ll> psum;
  vector<ll> thre;
  ll cur = 0;
  
  for(int &a:A) cin >> a;
  sort(A.begin(), A.end());
  psum.push_back(0);
  for(int a:A) {
    cur += a;
    psum.push_back(cur);
  }
  int l = A.size()-1;
  ll prev = (A[l]%2)?(A[l]+1)/2:A[l]/2;
  thre.push_back(prev);
  for(int i = A.size()-1; i >= 0; i--) {
    ll a = (A[i]%2)?(A[i]+1)/2:A[i]/2;
    prev = max(thre[thre.size()-1] - A[i], a);
    thre.push_back(prev);
  }
  reverse(thre.begin(), thre.end());


  int res=0;
  for(int i = 0; i < psum.size(); i++) {
    if(psum[i] >= thre[i]) res++;
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 2932
from sys import stdin, setrecursionlimit
from decimal import Decimal


def main():
    input = stdin.readline
    a, b = map(str, input().split())
    a = Decimal(a)
    b = Decimal(b)
    print(int(a * b))


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


Measured memory_bytes: 71400
import collections
_q = int(input())
que = collections.deque([])
for _ in range(_q):
    *q, = map(int, input().split())

    if q[0] == 0:
        if q[1] == 0:
            que.appendleft(q[2])
        else:
            que.append(q[2])
    elif q[0] == 1:
        print(que[q[1]])
    elif q[0] == 2:
        if q[1] == 0:
            que.popleft()
        else:
            que.pop()


Measured memory_bytes: 21860
#C
S = list(map(int, list(input())))
S0 = [i%2 for i in range(len(S))]
S1 = [(i+1)%2 for i in range(len(S))]

countS0 = 0
for i, j in enumerate(S):
    if j != S0[i]:
        countS0 += 1
        
countS1= 0
for i, j in enumerate(S):
    if j != S1[i]:
        countS1 += 1
        
print(min(countS0, countS1))

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

int main() {
  long long A, B, K;
  cin >> A >> B >> K;

  long long takahashi = (A - K < 0 ? 0 : A - K);
  long long aoki = ((B + (A - K < 0 ? A - K : 0)) < 0 ? 0 : (B + (A - K < 0 ? A - K : 0)));

  cout << takahashi << " " << aoki << endl;
  return 0;
}


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


int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> arr(n);
  arr[0] = 0;
  int ac = 0;
  for (int i = 0; i < n - 1; ++i) {
    if (s[i] == 'A' && s[i + 1] =='C') ++ac;
    arr[i + 1] = ac;
  }
  for (int i = 0; i < q; ++i) {
    int left, right;
    cin >> left >> right;
    cout << arr[right - 1] - arr[left - 1] << endl;
  }
}


Measured memory_bytes: 1488
n=int(input())
s=str(input())
s=list(s)
ans=0
for i in range(1,n-1):
  temp1=s[:-i]
  temp2=s[-i:]
  temp1=list(set(temp1))
  temp2=list(set(temp2))
  count=0
  for j in range(0,len(temp1)):
    if temp2.count(temp1[j])>=1:
      count=count+1
  ans=max(ans,count)
print(ans)  

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<" ";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll a,b,c;
    cin>>a>>b>>c;
    string ans="";
    if((a == b && a == c) || (a != b && a != c && b != c)){
        ans = "No";
    } else {
        ans = "Yes";
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define FOR(i, n) for (ll i = 0; i < n; i++)

std::vector<long long> prime_vector(long long limit) {
  std::vector<long long> primes = {2};
  for (long long i = 3; i <= limit; i += 2) {
    for (auto itr = primes.begin(); itr != primes.end(); ++itr) {
      if (i % (*itr) == 0) break;
      if (itr == primes.end() - 1) {
        primes.push_back(i);
        break;
      }
    }
  }
  return primes;
}

int main() {
  ll n, m, l;
  // ll a,b,c;
  // string s;
  cin >> n;
  auto primes = prime_vector(n);

  unordered_map<ll, ll> factors;

  for (auto i : primes) {
    factors.emplace(i, 0);
  }

  for (ll i = 2; i <= n; i++) {
    for (ll tmp = i; tmp > 1;) {
      for (ll j : primes) {
        if (j > tmp) break;
        if (tmp % j == 0) {
          tmp /= j;
          factors[j] += 1;
          break;
        }
      }
    }
  }
  ll x2 = 0;
  ll x4 = 0;
  ll x14 = 0;
  ll x24 = 0;
  ll x74 = 0;
  for (ll i : primes) {
    if (factors[i] >= 74) x74++;
    if (factors[i] >= 24) x24++;
    if (factors[i] >= 14) x14++;
    if (factors[i] >= 4) x4++;
    if (factors[i] >= 2) x2++;
  }

  ll ans;
  ans += x74;
  ans += x24 > 0 && x2 > 1 ? x24 * (x2 - 1) : 0;
  ans += x14 > 0 && x4 > 1 ? x14 * (x4 - 1) : 0;
  ans += x4 > 1 && x2 > 2 ? x4 * (x4 - 1) / 2 * (x2 - 2) : 0ll;
  cout << ans << endl;
  return 0;
}


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

int main(void){
int a;
int c;
int i;
int max;
int min;
long sum=0;

  scanf("%d",&c);
for(i=1;i<=c;i++){
  scanf("%d",&a);
  if(c==1){
    max = a;
    min = a;}
  if(max < a){
    max = a;}
  if(min > a){
    min = a;}
  sum = sum + a;
}
printf("%d %d %ld\n",min,max,sum);
return 0;
}


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

#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define dforn(i,n) for(int i=int(n-1);i>=0;i--)
#define forn(i,n) for(int i=0;i<int(n);i++)
#define D(a) cerr << #a << " = " << a << endl
#define all(a) a.begin(),a.end()
#define si(a) int((a).size())
typedef pair<int,int> pii;
typedef long long int ll;
typedef vector<int> vi;
#define pb emplace_back
#define mp make_pair
#define snd second
#define fst first

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    
    int k, q; cin >> k >> q;
    vi d(k), e(k);
    forn(i, k) cin >> d[i];

    while (q--) {
        int n, x, m; cin >> n >> x >> m, n--;
        ll s = 0, z = 0;
        forn(i, k) {
            e[i] = d[i] % m;
            s += e[i];
            if (e[i] == 0) z++;
        }
        ll y = x % m + n/k * s;
        int l = n % k;
        z *= n/k; 
        forn(i, l) {
            y += e[i];
            if (e[i] == 0) z++;
        }
        cout << n - z - y/m << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//CODE
void solve(void)
{
  int N,K;
  cin>>N>>K;
  int R,S,P;
  cin>>R>>S>>P;
  vector<char> vec(N);
  int SUM = 0;
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
    if(vec[i] == 'r')SUM += P;
    if(vec[i] == 's')SUM += R;
    if(vec[i] == 'p')SUM += S;
  }
  
  for (int i = K; i < N; i++)
  {
        // DEBUG(SUM);
    if(vec[i-K] == vec[i])
    {
    if(vec[i] == 'r')SUM -= P,vec[i] = 'q';
    else if(vec[i] == 's')SUM -= R,vec[i] = 'q';
    else if(vec[i] == 'p')SUM -= S,vec[i] = 'q';
    }

  }

  cout<<SUM<<endl;
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 384
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int N;
    cin >> N;
    int count = 0;
    bool check = true;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        if (a % 4 == 0) {
            count += 2;
        }
        else if (a % 4 == 2) {
            count++;
        }
        if (check && a % 4 == 2) {
            check = false;
        }
    }
    if (count >= N || (count >= N - 1 && check)) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
static char str[1200000];
int len;
vector<pair<char, int> > x;
scanf("%s", str);
len = strlen(str);
x.reserve(len);
for(int i = 0; i < len; ++i) {
int it = i + 1;
while(it < len && str[it] == str[i]) ++it;
x.push_back(make_pair(str[i], it - i));
i = it - 1;
}
int ans = 0;
for(int i = 0; i < (int)x.size() - 2; ++i) {
pair<char, int> jjj = x[i], ooo = x[i + 1], iii = x[i + 2];
if(jjj.first != 'J' || ooo.first != 'O' || iii.first != 'I')
continue;
if(ooo.second > jjj.second || ooo.second > iii.second)
continue;
ans = max(ans, min(min(jjj.second, ooo.second), iii.second));
}

printf("%d\n", ans);
return 0;
}

Measured memory_bytes: 9512
#define _USE_MATH_DEFINES
#include <math.h>
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for(int i = 0;i + 2 < s.size();i++)
    {
        if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
        {
            ans++;
        }
    }
    cout << ans << "\n";

    return 0;
}

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
int A[100011];
int B[100011];
int sortedA[100011];
int sortedB[100011];
pair<int, int> P[100011];
bool use[100011];


bool solve() {
    REP (i, N) if (sortedA[i] > P[i].first) return false;
    REP (i, N-1) if (sortedA[i+1] <= P[i].first) return true;

    REP (i, N) P[i] = make_pair(P[i].second, i);
    sort(P, P+N);

    int chain = 0;
    REP (i, N) if (!use[i]) {
	int k = i;
	chain++;
	while (1) {
	    use[k] = true;
	    k = P[k].second;
	    if (k == i) break;
	}
    }

    return chain >= 2;
}

void MAIN() {
    scanf("%d", &N);
    REP (i, N) scanf("%d", &P[i].second);
    REP (i, N) scanf("%d", &P[i].first);
    sort(P, P+N);
    REP (i, N) sortedA[i] = P[i].second;
    sort(sortedA, sortedA+N);

    puts(solve()? "Yes": "No");
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n,k;
  cin>>n>>k;
  int arr[n];
  for(int a=0;a<n;a++)
    cin>>arr[a];
  int memo[n]={0},mc;
  memset(memo,0,sizeof(memo));
  memo[1]=abs(arr[1]-arr[0]);
  for(int a=2;a<n;a++)
  {
  	mc=INT_MAX;
    for(int b=1;b<=min(a,k);b++)
    {
    memo[a]=memo[a-b]+abs(arr[a-b]-arr[a]);
      if(memo[a]<mc)
        mc=memo[a];
    }
    memo[a]=mc;
  }
  cout<<memo[n-1];
}

Measured memory_bytes: 1024
S = input()
if ((int(S[0:2]) <= 12)and(int(S[0:2]) > 0)) :
    if ((int(S[2:4]) <= 12)and(int(S[2:4]) > 0)):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if ((int(S[2:4]) <= 12)and(int(S[2:4]) > 0)):
        print("YYMM")
    else:
        print("NA")


Measured memory_bytes: 3060
N = int(input())
A = list(map(int, input().split()))

sumA = sum(A)
half = sumA / 2

r = 0.0

t1 = 0.0
t2 = 0.0
for a in A:
    t2 = t1
    t1 += a

    if t1 >= half:
        r = min(abs(half - t1), abs(half - t2))
        break

print(int(r * 2))

Measured memory_bytes: 31440
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=100010;
const ll mod=1e9+7;



int main(){
  int n;
  cin >>n;
  int ans=0;
  int mini=inf;
  rep(i,n){
    int p; cin>>p;
    if(mini>p){ans++;}
    mini=min(mini,p);
  }
  cout << ans << endl;
  return 0;
}

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

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

/*==================================================*/

/*==================================================*/

char c[] = {'Y','A','K','I'};

int main() {

    string s;
    cin>>s;
    if(s.size() < 4){
        cout<<"No"<<endl;
        return 0;
    }
    REP(i,0,s.size()){
        if(i < 4){
            if(c[i] != s[i]){
                cout<<"No"<<endl;
                return 0;
            }
            if(i == 3){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
        if(i >= 4){
            cout<<"No"<<endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

h,w = li()

cnt = Counter([])
for _ in range(h):
    tmp = lc()
    for c in tmp:
        cnt[c] += 1

exist = True

if h%2 == 0 and w%2 == 0:
    for key,value in cnt.items():
        if value%4 != 0:
            exist = False
            break
        
elif h%2 == 1 and w%2 == 1:
    odd = 0
    mod4_2 = 0
    for key,value in cnt.items():
        if value % 2 == 1:
            odd += 1
        elif value % 4 == 2:
            mod4_2 += 1
            
    if odd > 1:
        exist = False
    elif mod4_2 > (h+w-2)//2:
        exist = False
        
else:
    odmax = 0
    if h%2 == 0:
        odmax = h//2
    else:
        odmax = w//2
        
    
    mod4_2 = 0
    for key, value in cnt.items():
        if value%2 != 0:
            exist = False
            break
        elif value%4 == 2:
            mod4_2 +=1
            
    if mod4_2 > odmax:
        exist = False
        
        
if exist:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3316
#include<iostream>
#include<fstream>
#include<string>

using namespace std;

int search(int num){
    if(num < 10)return 0;

    auto log = 10;
    auto v = 0;
    while(log < num)
    {
        auto tmp = (num % log) * (num / log);
        v = max(tmp, v);
        log *= 10;
    }

    return 1 + search(v);

}


int main(){
    //ifstream fin("in.txt");

    auto n = 0;
    cin >> n;

    for(auto i = 0; i < n; i++){
        auto num = 0;
        cin >> num;
        cout << search(num) << endl;
    }

    return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)
#define INF 999999999
typedef long long ll;
using namespace std;
int main() {
    int N;
    cin >> N;
    if((N/10 == 9) || (N%10 == 9)) puts("Yes");
    else puts("No");
}

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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int l[4] = {};
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'N') l[0]++;
    if (s[i] == 'W') l[1]++;
    if (s[i] == 'S') l[2]++;
    if (s[i] == 'E') l[3]++;        
  }
  if (l[0]) {
    if (!l[2]) {
      puts("No");
      return 0;
    }
  }
  if (l[1]) {
    if (!l[3]) {
      puts("No");
      return 0;
    }
  }
  if (l[2]) {
    if (!l[0]) {
      puts("No");
      return 0;
    }
  }
  if (l[3]) {
    if (!l[1]) {
      puts("No");
      return 0;
    }
  }  
  puts("Yes");
  return 0;
}

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

using namespace std;

template<class T> inline void coupon(T & a) {
	a /= 2;
}

int main(void) {
	int n, m; cin >> n >> m;
	vector<long long> A(n);
	priority_queue<long long> que;
	for (int i = 0; i < n; i++) {
		scanf("%lld", &A[i]);
		que.push(A[i]);
	}

	int div;
	for (int i = 0; i < m; i++) {
		div = que.top();
		coupon(div);
		que.pop();
		que.push(div);
	}

	long long sum = 0;
	for (int i = 0; i < n; i++) {
		sum = sum + que.top();
		que.pop();
	}
	cout << sum << endl;
}

Measured memory_bytes: 2168
#include <iostream>
#include <climits>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <assert.h>
#include <vector>
#include <utility>
#include <string>
#include <bits/stdc++.h>
#include <fstream>
#include <chrono>
using namespace std;

typedef long long ll;


ll A[10000000];
vector <ll>v;


void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}
ll gcd(ll a,ll b)
{
    while(b!=0)
    {
        ll t=b;
        b=a%b;
        a=t;
    }
    return a;
}
int main()
{
    sieve();
   ll a,b,cnt=0;
   cin>>a>>b;
   ll d=gcd(max(a,b),min(a,b));
   for(ll i=0;v[i]<=sqrt(d);i++)
   {
       if(d%v[i]==0)
       {
           while(d%v[i]==0)
             {
                 d/=v[i];
             }
           cnt++;
       }
   }
   if(d!=1)
   {
       cnt++;
   }
   cout<<cnt+1<<endl;
return 0;
}



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

int main(){
   int n,m;
   cin >> n >> m;
   vector<int> p(m);
   vector<int> s(m);
   string S;
   rep(i,m){
       cin >> p[i];
       cin >> S;
       if(S == "AC"){
           s[i] = 0;
       }else {
           s[i] = 1;
       }
   }
   vector<bool> c(n);
   vector<int> pc(n);
   rep(i,n){
       c[i] = true;
   }
   rep(i,n){
       pc[i] = 0;
   }
   int C=0, P=0;
   rep(i,m){
       if(s[i] == 1){
           if(c[p[i]-1] == true){
               pc[p[i]-1]++;
           }
       }else if(s[i] == 0){
           if(c[p[i]-1] == true){
               C++;
               P += pc[p[i]-1];
               c[p[i]-1] = false;
           }
       }
   }
   cout << C << endl;
   cout << P << endl;

    
    return 0;
}

Measured memory_bytes: 1408
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<cstdlib>
#include<list>
#include<set>
#include<numeric>

#define MOD 1000000007

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int Ball_num[100010];
bool red[100010];

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

	for (int i = 1; i <= N; i++){
		Ball_num[i] = 1;
		red[i] = 0;
	}
	red[1] = 1;

	for (int i = 0; i < M; i++) {
		int x, y;
		cin >> x >> y;
	
		if (Ball_num[x]) {
			Ball_num[x]--;
			Ball_num[y]++;
			if (red[x])
				red[y] = 1;
			if (Ball_num[x] == 0)
				red[x] = 0;
		}
	}

	int ans = 0;
	for (int i = 1; i <= N; i++) {
		if (red[i])ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
    string s, c, head="", tail="";
    int n, t, f;
    bool is_rev = false;
    
    cin >> s >> n;

    for (int i=0; i<n; i++) {
        cin >> t;
        if (t == 1) {
            is_rev = !is_rev;
        } else {
            cin >> f >> c;
            if ((!is_rev && f == 1) || (is_rev && f == 2)) {
                head += c;
            } else {
                tail += c;
            }
        }
    }

    if (!is_rev) {
        reverse(head.begin(), head.end());
        s = head + s + tail;
    } else {
        reverse(s.begin(), s.end());
        reverse(tail.begin(), tail.end());
        s = tail + s + head;
    }

    cout << s << endl;
}

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

using namespace std;

int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, x;
	cin >> n >> x;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	long long res = 0;
	for (int i = 0; i < n - 1; i++) {
		int req = (int) max(((long long) a[i]) + a[i + 1] - x, 0ll);
		res += req;
		int rm = min(a[i + 1], req);
		req -= rm;
		a[i + 1] -= rm;
		if (req) {
			a[i] -= req;
		}
	}
	cout << res << '\n';

	return 0;
}



Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0

typedef struct tag_card {
    char suit_;
    int num_;
} card_t;

void DisplayArray(card_t C[], int N)
{
    int i;
    for (i = 0; i < N; i++) {
        if (i) printf(" ");
        printf("%c%d", C[i].suit_, C[i].num_);
    }
    printf("\n");
}

void BubbleSort(card_t C[], int N)
{
    int i, j;
    card_t tmp;

    for (i = 0; i < N - 1; i++) {
        for (j = N - 1; j >= i; j--) {
            if (C[j].num_ < C[j - 1].num_) {
                tmp = C[j];
                C[j] = C[j - 1];
                C[j - 1] = tmp;
            }
        }
    }
}

void SelectionSort(card_t C[], int N)
{
    int i, j, minj;
    card_t tmp;

    for (i = 0; i < N; i++) {
        minj = i;
        for (j = i; j < N; j++) {
            if (C[j].num_ < C[minj].num_) {
                minj = j;
            }
        }
        tmp = C[i];
        C[i] = C[minj];
        C[minj] = tmp;
    }
}

int IsStable(card_t cBubble[], card_t cSelection[], int N)
{
    int i;

    for (i = 0; i < N; i++) {
        if (cBubble[i].suit_ != cSelection[i].suit_) return FALSE;
    }

    return TRUE;
}

int main(void)
{
    int N, i, numOfExchanges;
    scanf("%d%*c", &N);
    card_t* C = (card_t*)malloc(sizeof(card_t) * N);
    card_t* C1 = (card_t*)malloc(sizeof(card_t) * N);
    card_t* C2 = (card_t*)malloc(sizeof(card_t) * N);

    for (i = 0; i < N; i++) {
        scanf("%c%d%*c", &C[i].suit_, &C[i].num_);
        C1[i].suit_ = C[i].suit_;
        C1[i].num_ = C[i].num_;
        C2[i].suit_ = C[i].suit_;
        C2[i].num_ = C[i].num_;
    }

    BubbleSort(C1, N);
    SelectionSort(C2, N);

    DisplayArray(C1, N);
    printf("Stable\n");
    DisplayArray(C2, N);
    if (IsStable(C1, C2, N)) {
        printf("Stable\n");
    } else {
        printf("Not stable\n");
    }

    return 0;
}

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

namespace AtCoder.ABC044
{
    class ProblemA
    {
        static void Main()
        {
            var n = ReadInt();
            var k = ReadInt();
            var x = ReadInt();
            var y = ReadInt();
            Console.WriteLine($"{Math.Min(n, k) * x + Math.Max(0, n - k) * y }");
        }

        public static string ReadLine() => Console.ReadLine();

        public static int ReadInt() => int.Parse(ReadLine());

        public static int[] ReadIntArray() => ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

int main(){
  int x1,x2,y1,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int vx = x2 - x1;
  int vy = y2 - y1;
  swap(vx,vy);
  vx *= -1;
  x2 += vx;
  y2 += vy;
  cout << x2 << " " << y2 << " ";
  swap(vx,vy);
  vx *= -1;
  x2 += vx;
  y2 += vy;
  cout << x2 << " " << y2 << endl;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
x=input().split(" ")
a=int(x[0])
b=int(x[1])
c=int(x[2])
d=b*c

ans=0
for i in range(d):
    if a*i%b==c:
        ans=1
if ans==1:
    print("YES")
else:
    print("NO")
        

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

Measured memory_bytes: 128
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)

#x = ip()                                     #入力整数1つ
#n,m= (int(i) for i in input().split())       #入力整数横2つ以上
a = [int(i) for i in input().split()]        #入力整数配列
## a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#k = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(h)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
a.sort()
if max(a) == 1:
    print(1)
elif min(a)==1:
    if max(a)==2:
        print(0)
    else: print(a[1]-2)
elif min(a)==2:
    print(0)
else:
    print((a[0]-2)*(a[1]-2))


Measured memory_bytes: 13424
import heapq

K = int(input())
adj = [dict() for i in range(K)]
for i in range(1, K):
  adj[i] = dict()
  adj[i][(i+1)%K] = 1
  adj[i][(i*10)%K] = 0

def dijkstra(adj):
  q = []# p q
  d = dict()# min cost from start
  p = dict()# parent node
  n = len(adj)# num of node

  for i in range(n):
    d[i] = float('inf')

  start_id = 1
  d[start_id] = 0
  heapq.heappush(q, (0, start_id))
  S = set()

  while len(S) != n:
    dist, node_id = heapq.heappop(q)
    S.add(node_id)
    for u, c in adj[node_id].items():
      if c + d[node_id] < d[u]:
        d[u] = c + d[node_id]
        heapq.heappush(q, (d[u], u))

  return d

d = dijkstra(adj)
print(d[0]+1)

Measured memory_bytes: 61664
#include<iostream>
using namespace std;
int main(){
  long long X;
  cin >> X;
  
  for(long long i=-120;i<=120;i++){
    for(long long j=-120;j<=120;j++){
      long long J,K;
      J=i*i*i*i*i;
      K=j*j*j*j*j;
      long long G=J-K;
      if(G==X){cout << i << " " << j << endl; return 0;}
  }
  }
}

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

int main() {
  int N;
  cin >> N;
  vector<int> as(N);
  for(int i = 0; i < N; ++i) {
    cin >> as[i];
  }
  int ans = 0;
  for(auto a : as) {
    ans += a - 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/*bismillah ->                                                                                                         << Suirkhanov Meyirlan >>
  GL HF


                                                                                                                      42

    bless my code =)
                                                                                                            NEVER FOLLOW YOUR RULES :D HAHAHAHA
*/


///scanf ("%d%d", &x, &y);
///printf("%d", &a)

#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define pii pair < int , int >
#define pll pair < ll, ll >
#define pb push_back
#define pf psuh_front
#define mp make_pair
#define fi first
#define se second
#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define eb emplace_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll N = 2 * 1e5 + 7;
const ld pi = 3.14159265359;
const int INF = 1e9 + 7;
const double eps = 1e-9;

const int xi[4] = {-1, 0, +1, 0};
const int yj[4] = {0, +1, 0, -1};
const int xxi[4] = {+1, 0, -1, 0};
const int yyj[4] = {0, -1, 0, +1};

ll n;

map < ll, ll > cnt;

int main(){

  //freopen("bridge.in", "r", stdin);
  //freopen("bridge.out", "w", stdout);

  fast
  randoperation;

  ///           ||
  ///start here \/

  cin >> n;

  for(int i = 2; i <= n; i++){

    int x = i;

    for(int j = 2; j <= x; j++){
      while(x % j == 0){
        cnt[j]++;
        x /= j;
      }
    }

  }

  ll ans = 1;

  for(int i = 1; i <= n; i++){
    //cout << cnt[i] << ' ';
    ans *= (cnt[i] + 1);
    ans %= INF;
  }

  cout << ans;
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N;
  cin>>N;
  double ans=0;
  for(int i=0;i<N;i++){
    double x;
    cin>>x;
    string s;
    cin>>s;
    if(s=="JPY")ans+=x;
    else ans+=380000*x;
  }
  cout<<fixed<<setprecision(10)<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
 char str[20], str2[20];
 int i=0, j=0;
 scanf("%s", str);
 while( str[i] != '\0'){
   i++;
 }

 while( i >= 0){
   str2[j] = str[i-1];
   //printf("%c", str[i]);
   i--;
   j++;
 }
 str[j] = '\0';
 printf("%s\n", str2);

 return 0;
}

Measured memory_bytes: 524