akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <memory>
#include <cstring>
#include <cassert>
#include <numeric>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define REP2(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(S) (S).begin(), (S).end()
typedef long long ll;

class UnionFind{
  int num_components;
  std::vector<int> parent;
  std::vector<int> weight;
  std::vector<int> rank;
public:
  UnionFind(int N) : num_components(N),
                     parent(std::vector<int>(N)),
                     weight(std::vector<int>(N, 1)),
                     rank(std::vector<int>(N, 0)){
    for(int i = 0; i < N; i++) parent[i] = i;
  }
  
  int find(int x){
    if(x == parent[x]) return x;
    else return parent[x] = find(parent[x]);
  }
  
  int size(int x){
    return weight[find(x)];
  }
  
  
  bool same(int x, int y){
    return find(x) == find(y);
  }
    
  void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;
    
    num_components--;
    if(rank[x] < rank[y]){
      weight[y] += weight[x];
      parent[x] = y;
    }else{
      weight[x] += weight[y];
      parent[y] = x;
      if(rank[x] == rank[y]) rank[y]++;
    }
  }
  
  int count(){
    return num_components;
  }
};

int main(){
  ios::sync_with_stdio(false);

  int n, m;
  while (cin >> n >> m && n + m){
    UnionFind  union_find(n);
    vector<ll> diff(n);
    vector<vector<pair<int, int> > > G(n);
    
    REP(i, m){
      char op;
      int a, b, w;
      cin >> op >> a >> b; a--, b--;

      if (op == '?'){
        if (union_find.same(a, b)){
          cout << diff[b] - diff[a] << endl;
        } else {
          cout << "UNKNOWN" << endl;
        }
        
      } else {
        cin >> w;
        if (union_find.same(a, b)) {
          continue;
        }

        int start_vertex = union_find.size(a) > union_find.size(b) ? b : a;
        int start_weight = start_vertex == a ? diff[b] - w : diff[a] + w;

        diff[start_vertex] = start_weight;
        queue<int> que;
        que.push(start_vertex);
        while (!que.empty()){
          int v = que.front(); que.pop();
          for (const auto &p : G[v]){
            int w = p.first;
            int c = diff[v] + p.second;
            if (diff[w] != c){
              diff[w] = c;
              que.push(w);
            }
          }
        }
        
        G[a].push_back(make_pair(b, w));
        G[b].push_back(make_pair(a, -w));
        union_find.unite(a, b);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 8132
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define pb push_back
#define mp make_pair
#define INF9 1000000000 //10^9
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pii=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vb=vector<bool>;
int n,q,m,k,l,ans;
vi a,b;
ll llans;
vll lla,llb;
string s;

int main() {
    cin >> n >> s;
    a.resize(3);
    for(auto &v:s) a[v%3]++;
    llans = 1;
    rep(i,3) llans *= a[i];

    rep(j,n)rep(i,j){
            int k = j+j-i;
            if(k<n) {
                if(s[i]==s[j]) continue;
                if(s[j]==s[k]) continue;
                if(s[k]==s[i]) continue;
                llans--;
            }
    }
    cout << llans << endl;
    return 0;
}

Measured memory_bytes: 3644
use proconio::input;

fn main() {
    input! {
        mut a: isize,
        b: isize,
        mut c: isize,
        d: isize,
    }

    while a > 0 && c > 0 {
        c -= b;
        if c <= 0 {
            println!("Yes");
            return;
        }

        a -= d;
        if a <= 0 {
            println!("No");
            return;
        }
    }
}


Measured memory_bytes: 2116
// ABC063B - 

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;

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

	map<char, int> d;
	for (int i = 0; i < S.size(); i++) {
		d[S[i]]++;
	}

	for (map<char, int>::iterator it = d.begin(); it != d.end(); it++) {
		pair<char, int> t = *it;
		if (t.second >= 2) {
			cout << "no" << endl;
			return 0;
		}
	}

	cout << "yes" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 998244353;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL N;
	cin >> N;
	VLL A(N), B(N);
	for (LL n = 0; n < N; n++)cin >> A[n] >> B[n];
	sort(A.begin(), A.end(), [](LL a, LL b) {
		return a < b;
	});
	LL ma;
	if (N & 1)ma = A[N / 2];
	else ma = (A[N / 2 - 1] + A[N / 2]);
	sort(B.begin(), B.end(), [](LL a, LL b) {
		return a < b;
	});
	LL mb;
	if (N & 1)mb = B[N / 2];
	else mb = (B[N / 2 - 1] + B[N / 2]);
	LL ans = mb - ma + 1;
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 6376
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n,m;
  cin>>n>>m;
  cout<<(n-1)*(m-1)<<endl;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
asum=[]
s=sum(a)
for i in range(n):
    s=s-a[i]
    asum.append(s)
ans=1
x=2**n
p=1
if n==0:
    if a[0]==1:
        print(1)
    else:
        print(-1)
    sys.exit()
for i in range(n):
    x//=2
    p-=a[i]
    if 2*p<asum[i]/x or asum[i]<p:
        print(-1)
        sys.exit()
    p=min(2*p,asum[i])
    ans+=p
print(ans)




Measured memory_bytes: 96784
from itertools import combinations_with_replacement as c_w_r
N,M,Q=map(int,input().split())
s=[list(map(int,input().split()))for _ in range(Q)]
ans=0
for i in c_w_r([i for i in range(1,M+1)],N):
  e=0
  for a,b,c,d in s:
    if i[b-1]-i[a-1]==c:
      e+=d
  ans=max(ans,e)
print(ans)


Measured memory_bytes: 9192
#include <iostream>
#include <cstdio>

using namespace std;

void swap(long *a, long *b){
	long tmp= *a;
	*a = *b;
	*b = tmp;
}

long gcd(long x, long y){
	while(y!=0){	
		long r=x%y;
		x=y;
		y=r;	
	}
	return x;
}

long lcm(long x, long y){
	return (x*y/gcd(x,y));
}

int main(){
	long a, b;
	while( scanf(" %ld %ld", &a, &b) != EOF ){
		printf("%ld %ld\n", gcd(a,b), lcm(a,b));		
	}

	return 0;
}

Measured memory_bytes: 1188
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;

  if( abs(a-c) <= d ) printf("Yes\n");
  else if( (abs(a-b) <= d) && (abs(b-c) <= d)) printf("Yes\n");
  else printf("No\n");

  return 0;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(50) << setiosflags(ios::fixed);
  int q;
  cin >> q;
  multiset<int> st;
  rep(qi, q)
  {
    int type;
    cin >> type;
    if (type == 0)
    {
      int x;
      cin >> x;
      st.insert(x);
      cout << st.size() << endl;
    }
    else if (type == 1)
    {
      int x;
      cin >> x;
      cout << st.count(x) << endl;
    }
    else if (type == 2)
    {
      int x;
      cin >> x;
      st.erase(x);
    }
    else
    {
      int l, r;
      cin >> l >> r;
      auto itr = st.lower_bound(l);
      while (itr != st.end() && *itr <= r)
      {
        cout << *itr << endl;
        itr++;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 12416
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b;
    cin >> a >> b;
    if(a == 1 && b == 1){
        cout << "Draw" << endl;
        exit(0);
    }else if(b == 1){
        cout << "Bob" << endl;
        exit(0);
    }else if(a == 1){
        cout << "Alice" << endl;
        exit(0);
    }
    
    if(a > b){
        cout << "Alice" << endl;
    }else if(a < b){
        cout << "Bob" << endl;
    }else{
        cout << "Draw" << endl;
    }
}


Measured memory_bytes: 256
// Who_Says_a_Pun? 
// https://atcoder.jp/contests/abc141/tasks/abc141_e
// date: 2020-08-11T20:47:18.409724

// #配列の初期化 #0埋め #memsetではなく{0}

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

#define REP(i, n) for(ll i=0;i<ll(n);i++)
#define REPD(i, n) for(ll i=n-1;i>=0;i--)
#define FOR(i, a, b) for(ll i=a;i<=ll(b);i++)
#define FORD(i, a, b) for(ll i=a;i>=ll(b);i--)

#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())

#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

template<typename T, typename ...Args>
void IN(T& first, Args&... args) {
    ((cin >> first), ..., (cin >> args)); //C++17
}

template<char Sep, typename T, typename ...Args>
void print_sep(const T& first, const Args&... args) {
    ((cout << first), ..., (cout << Sep << args)); //C++17
}

template<typename... Words>
void OUT(Words... words) {
    print_sep<' '>(words...);
    cout << endl;
    return;
}

#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 5000 //10^5:配列の最大のrange

int main(void){
    //入力の高速化用のコード
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    ll N;
    string s;
    IN(N);
    IN(s);

    // https://qiita.com/Ki4mTaria/items/b6ab0bcbe9c87d4dc071#%E9%85%8D%E5%88%97%E6%A7%8B%E9%80%A0%E4%BD%93%E3%81%AE%E4%B8%AD%E8%BA%AB
    static bool arr[MAXR][MAXR]= {false};
    REP(i,N) FOR(j,i,N) {
            arr[i][j] = s[i] == s[j];
        }

    ll max_len=0;
    FOR(i, 1, N-1) {
        ll buf_len=0;
        FOR(j, 0, N - i - 1) {
            if (arr[j][i+j]) {
                buf_len++;
            } else{
                buf_len=0;
            }
            max_len = max(max_len, buf_len);
            if (buf_len==i) {
                break;
            }
        }
    }
    OUT(max_len);
    return 0;

}


Measured memory_bytes: 27604
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>

#define INF 1e12
#define DIV 1000000007
using namespace std;
using ll = long long;

int main() {
    string N;
    cin >> N;

    bool flag = false;
    for (int i = 0; i < 3; i++) {
        if (N[i] == '7')
            flag = true;

    }

    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

}


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

typedef long long LL;
const LL mod = 1e9+7;
LL x[100003], y[100003];
int main()
{
    int n, m;
    scanf("%d%d",&n,&m);
    for(int i=0; i<n; ++i)
        scanf("%lld",&x[i]);
    for(int i=0; i<m; ++i)
        scanf("%lld",&y[i]);
    LL ans = 0, w = 0;
    for(int l=0, r=n-1; l<r; ++l,--r)
        w = (w + (x[r]-x[l])*(LL)(r-l))%mod;
    for(int l=0, r=m-1; l<r; ++l,--r)
        ans = (ans + (y[r]-y[l])*(LL)(r-l))%mod;
    printf("%lld\n",(ans*w)%mod);
    return 0;
}


Measured memory_bytes: 1792
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
L = [int(input()) for _ in range(N)]

f = False
t = defaultdict(int)
for i in range(N):
    if t[L[i] - 1] != 0:
        t[L[i]] = t[L[i] - 1] + 1
        t[L[i] - 1] = 0
    else:
        t[L[i]] = 1

print(N - max(t.values()))

Measured memory_bytes: 35312
H, W, D = map(int,input().split())
A = []
L = [None for _ in range(H * W)]
for _ in range(H):
    A.append(list(map(int,input().split())))
for i in range(H):
    for j in range(W):
        L[A[i][j]-1] = [i, j]
Q = int(input())
cnt = [[0] for _ in range(D)]
for i in range(D):
    j = i
    while j + D <= H * W - 1:
        cnt[i].append(cnt[i][-1] + abs(L[j + D][0] - L[j][0]) + abs(L[j + D][1] - L[j][1]))
        j += D
for _ in range(Q):
    L, R = map(int,input().split())
    i = (L - 1) % D
    print(cnt[i][(R-1)//D] - cnt[i][(L-1)//D])

Measured memory_bytes: 25516
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll mod = 1000000007;
int main(){
  ll X;
  cin >> X;
  ll ans = 0;
  ll s = 100;

  while(s < X){
    ll tmp = s/100;
    s += tmp;
    ans++;
  }

  cout << ans <<endl;

  return 0;
}


Measured memory_bytes: 3676
///age yekam bekeshi beham is no problem ._.
#include<bits/stdc++.h>
#define size(a) (int)a.size()
#define ld long double
#define int long long
#define F first
#define S second
#define pb push_back
using namespace std;
void null(){return ;}
const int maxn=1e5+7,INF=3e18+9237,mod=1e9+7;
int cnt[maxn];
bool red[maxn];

int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n,m;cin>>n>>m;
	for(int i=0;i<=n;i++)cnt[i]=1;
	red[1]=true;
	for(int i=0,x,y;i<m;i++){
		cin>>x>>y;
		cnt[x]--;cnt[y]++;
		red[y]|=red[x];
		if(cnt[x]==0)red[x]=false;
	}
	int ans=0;
	for(int i=1;i<=n;i++)ans+=(red[i]==true);
	cout<<ans;
}


Measured memory_bytes: 1152
import sys

def main():
    N, M = map(int, input().split())
    H_list = list(map(int, input().split()))
    AB_list = [[int(_) for _ in input().split()] for i in range(M)]

    tree = [[] for _ in range(N)]

    for a, b in AB_list:
        tree[a-1].append(b-1)
        tree[b-1].append(a-1)

    good_observatory = 0

    for i_obs in range(N):
        if len(tree[i_obs]) == 0:
            good_observatory += 1
            continue

        now_height = H_list[i_obs]
        good_flag = True
        for i_tree in tree[i_obs]:
            if now_height <= H_list[i_tree]:
                good_flag = False
        if good_flag:
            good_observatory += 1

    print(good_observatory)
    return


    if a:
        print('Yes')
    else:
        print('No')

    return

if __name__ == '__main__':
    main()
    sys.exit(0)

Measured memory_bytes: 106412
#include <iostream>
using namespace std;
int main() {
  int N;
  cin >> N;
  unsigned long long max = 0;
  cin >> max;
  unsigned long long sum = 0ull;
  for (int i=1; i<N; i++) {
	unsigned long long x;
    cin >> x;
    if (max <= x) {
      max = x;
      continue;
    }
    sum += max - x;
  }
  cout << sum;
  return 0;
}

Measured memory_bytes: 3532
#include<bits/stdc++.h>
using namespace std;
int s(int a) {
	int x=0;
	while(a) x+=a%10,a/=10;
	return x;
}
int n,a,b;
int main() {
	scanf("%d",&n);
	int ans=100000;
	for(a=1;a<n;a++) {
		b=n-a;
		int cur=s(a)+s(b);
		if (cur<ans) ans=cur;
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<ld> vld;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); ++i)
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define endl "\n"

ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------

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

  ll n;
  cin >> n;
  vector<tuple<ll,ll,char,ll,string>> vec(n);
  REP(i,n){
    ll a, b, c;
    char d;
    string e;
    cin >> a >> b >> d >> c >> e;
    vec[i] = make_tuple(a,b,d,c,e);
  }
  sort(ALL(vec));
  REP(i,n) cout << get<0>(vec[i]) << " " << get<1>(vec[i]) << " " << get<2>(vec[i])<< " " << get<3>(vec[i])<< " " << get<4>(vec[i])<<endl;


  return 0;
}




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

int main()
{
    int a,b,j,P,count=0;
    scanf("%d %d",&a,&b);

    for(int i=a;i<=b;i++)
    {
        P=0;
        j=i;

       while(j!=0)
        {
            P=P*10+j%10;
            j=j/10;
        }

        if(P==i)
            count++;
    }
    printf("%d\n",count);


}


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

#define read(num) scanf("%d", &num)
#define readll(num) scanf("%lld", &num)
#define read2(num1, num2) scanf("%d%d", &num1, &num2)
#define read3(num1, num2, num3) scanf("%d%d%d", &num1, &num2, &num3)
#define reads(str) scanf("%s", str)
#define readc(ch) scanf("%c", &ch)

#define M 1000000007
#define pb push_back
#define mp make_pair

#define pii pair<int, int>
#define vi vector<int>
#define ll long long

#define con 998244353

int main()
{
  int n;
  cin>>n;
  double a[n];
  double sum=0;
  for(int i=0;i<n;i++){
      cin>>a[i];
      sum+=1/a[i];
  }
  sum=1/sum;
  cout<<fixed<<setprecision(7)<<sum;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		int[] v=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
			v[i]=sc.nextInt();
		}
		for(int i=0;i<n-1;i++){
			for(int j=n-1;j>i;j--){
				if(a[j-1]>a[j]){
					int box=v[j-1];
					v[j-1]=v[j];
					v[j]=box;
					box=a[j];
					a[j]=a[j-1];
					a[j-1]=box;
				}
			}
		}
		int max=v[0];
		int maxPtr=a[0];
		for(int i=1;i<n;i++){
			if(v[i]>max){
				max=v[i];
				maxPtr=a[i];
			}
		}
		System.out.println(maxPtr+" "+max);
	}
}

Measured memory_bytes: 17380
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main()
{
    ll n;
    cin >> n;
    ll a[3 * n];
    rep(i, 3 * n) cin >> a[i];
    sort(a, a + 3 * n, greater<>());
    ll ans = 0;
    rep(i, n)
    {
        ans += a[2 * i + 1];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<tuple>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;


template<typename T>
void dump(T *arr, int h, int w){
	rep(i,h){
		rep(j,w) cout << arr[i][j] << "\t";
		cout << "\n";
	}
}

template<typename T>
void dump(T *arr, int a){
	rep(i,a) cout << arr[i] << "\t";
	cout << "\n";
}

template<typename T>
void dump(vector<T> arr, int a){
	rep(i,a) cout << arr[i] << "\t";
	cout << "\n";
}

const int INF = 1e9;
const int MOD = 1e9+7;

bool compare(P a, P b){
	if(a.second != b.second) return a.second > b.second;
	else	return a.first > b.first;
}

int digits(ll num){
	ll d=0;
	while(num >= 1){
		num/= 10;
		d++;
	}
	return d;
}

ll pow_kai(ll a, int n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a;
    }
    a = a*a;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<int> num_node; //そのノードの所属するグループのノード数

    UnionFind(int N) : par(N), num_node(N){ //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) {
			par[i] = i;
			num_node[i] = 1;
		}
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		num_node[ry] += num_node[rx];
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

	int nodes(int x) {
		return num_node[root(x)];
	}
};

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

	int n;
	cin >> n;

	cout << n/2 + (n%2) << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

long long mod=1000000007;
long long modp(long long d,long long p){
    if (p==0){
        return 1 ;
    } else if (p==1){
        return d%mod ;
    } else if (p%2==0){
        return ((modp(d,p/2)%mod)*(modp(d,p/2))%mod)%mod;
    } else {
        return ((modp(d,p/2)%mod)*(modp(d,p/2))%mod)*d%mod;
    }
}

int main(void){
    int h,w,a,b;
    scanf("%d%d%d%d",&h,&w,&a,&b);
    
    long long p[h+w],q[h+w],ans=0,tmp;
    p[0]=1;
    for (int i=1; i<h+w; i++){
        p[i]=(i*p[i-1])%mod;
    }
    q[h+w-1]=modp(p[h+w-1],mod-2);
    for (int i=h+w-2; i>=0; i--){
        q[i]=q[i+1]*(i+1)%mod;
    }
    
    for (int i=b+1; i<=w; i++){
        tmp=p[h-a-1+i-1]%mod;
        tmp=(tmp*q[i-1])%mod;
        tmp=(tmp*q[h-a-1])%mod;
        tmp=(tmp*p[a-1+w-i])%mod;
        tmp=(tmp*q[w-i])%mod;
        tmp=(tmp*q[a-1])%mod;
        ans=(ans+tmp)%mod;
    }
        printf("%lld\n",ans%mod);
	return 0 ;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using piii = pair<int, pair<int, int>>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;

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

    int X, Y, Z;
    cin >> X >> Y >> Z;
    swap(X, Y);
    swap(X, Z);
    cout << X << " " << Y << " " << Z << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+9, INF = 0x3f3f3f3f;

int main( void ) {
    ios::sync_with_stdio( false );
    stack< int > st;
    vector< string > vt;
    string s;
    while( cin >> s ) vt.push_back( s );
    int len = vt.size();
    for( int i = 0; i < len; ++i ) {
        int n = vt[i].size();
        if( isdigit(vt[i][0]) ) {
            int num = 0;
            for( int j = 0; j < n; ++j ) {
                num *= 10;
                num += vt[i][j] - '0';
            }
            st.push( num );
        }
        else {
            int b = st.top(); st.pop();
            int a = st.top(); st.pop();
            switch( vt[i][0] ) {
                case '+': st.push( a + b ); break;
                case '-': st.push( a - b ); break;
                case '*': st.push( a * b ); break;
            }
        }
    }
    cout << st.top() << '\n';
    return 0;
}



Measured memory_bytes: 3240
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)

if n == 1:
    while m > 0:
        a[0] //= 2
        m -= 1
    print(a[0])
    exit()

while m > 0:
    a.sort(reverse = True)
    mid = a[0] // 2
    i = 0
    while a[i] >= mid:
        if m > 0:
            a[i] //= 2
            m -= 1
            i += 1
        else:
            break
        if i == len(a):
            break
print(sum(a))


Measured memory_bytes: 14224
#include <iostream>

using namespace std;

int main() {
	int n, x;
	while (true) {
		cin >> n >> x;
		if (n == 0 && x == 0) break;
		int count = 0;
		for (int i = 1; i <= n - 2; i++) {
			for (int j = i + 1; j <= n - 1; j++) {
				for (int k = j + 1; k <= n; k++) {
					if (i + j + k == x) count++;
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}



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

int main(void)
{
	int i;
	int j, k;
	char str[2048];
	char stra[2048];
	
	fgets(str, 1024, stdin);
	
	stra[0] = '\0';
	k = 0;
	i = 0;
	while (str[i] != '\0'){
		if (str[i] == ' ' || str[i] == '.' || str[i] == ','){
			if (i - k > 2 && i - k < 7){
				if (strlen(stra) == 0){
					strncat(stra, &str[k], i - k);
				}
				else {
					strcat(stra, " ");
					strncat(stra, &str[k], i - k);
				}
			}
			k = i + 1;
		}
		i++;
	}
	printf("%s\n", stra);
	
	return (0);
}

Measured memory_bytes: 932
#include <stdio.h> 
 

 
 int main(){ 
    double x1, y1, x2, y2, distance; 
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2); 
     distance=sqrt((pow(x2-x1, 2)+pow(y2-y1, 2))); 
     printf("%f\n", distance); 

 
     return 0; 
} 



Measured memory_bytes: 2104
#include <cstdio>
#include <cmath>
int main(){
	int a,d=0,di;
	float x=0,y=0;
	scanf("%d,%d",&a,&d);
	if(a==0 && d==0){
		printf("0\n0\n");
	}
	else{
		y+=a;
		while(1){
			scanf("%d,%d",&a,&di);
			if(a==0 && di==0)
				break;
			y+=a*cos(M_PI*d/180);
			x+=a*sin(M_PI*d/180);
			d+=di;
		}
		printf("%d\n%d\n",(int)x, (int)y);
	}
	return 0;
}


Measured memory_bytes: 3000
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAX = 10000000;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

//テーブルを作る前処理

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i%MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

//二項計数計算
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0)return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
	COMinit();
	ll H, W, A, B;
	cin >> H >> W >> A >> B;
	ll sum = 0;
	for (ll i = B + 1; i <= W; i++) {
		sum += COM(H - A + i - 2, i - 1)*COM(A + W - i - 1, W - i);
		sum %= MOD;
	}
	cout << sum << endl;
}

Measured memory_bytes: 234752
//
//  main.cpp
//  CppTest
//
//  Created by Ryu on 2017/02/08.
//  Copyright ?? 2017??´ Ryu. All rights reserved.
//

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

int main(int argc, const char * argv[]) {
    // insert code here...
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    long n = 0;
    cin >> n;
    
    long rest = 100000;
    for (int i = 0; i < n; i++) {
        rest *= 1.05;
        if(rest % 1000 != 0){
            rest = rest + 1000 -  rest % 1000;
        }
    }
    
    
    
    printf("%ld\n", rest);
    
    return 0;
}

Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+5;
const int mod = 1e9+7;
ll qpow(ll a,ll b){ll res=1;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int cnt[2020];
int cnt2[2020];
char s[maxn];
int main()
{
    int n;
    scanf("%s",s+1);
    n = strlen(s+1);
    ll ans = 0;
    int hs = 0;
    cnt[0]=1;
    for(int i = 1;i <= n;++i){
        hs=hs*10+s[i]-'0';
        hs%=2019;
        for(int j = 0;j < 2019;++j){
            cnt2[j*10%2019]+=cnt[j];
        }
        for(int j = 0;j < 2019;++j)cnt[j]=cnt2[j],cnt2[j]=0;
        ans+=cnt[hs];
        cnt[hs]++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3872
#define ONLINE_JUDGE
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;
const string YES = "Yes";
const string NO = "No";

ll N;
vl A;
vl B;
ll K;
vl V;
vl P;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> N;
    A = vl(N-1);
    B = vl(N-1);
    for(int i = 0; i < N-1; ++i){
        cin >> A[i];
        cin >> B[i];
    }
    cin >> K;
    V = vl(K);
    P = vl(K);
    for(int i = 0; i < K; ++i){
        cin >> V[i];
        cin >> P[i];
    }
    solve();
}

// 1 ≦ N ≦ 10^5
// 1 ≦ K ≦ N
// 1 ≦ A_i, B_i ≦ N (1 ≦ i ≦ N - 1)
// 1 ≦ V_j ≦ N (1 ≦ j ≦ K) (21:18, 制約の誤記を修正)
// 0 ≦ P_j ≦ 10^6 (1 ≦ j ≦ K)
// 与えられるグラフは木になることが保証される
// V_j はすべて相異なる

vvl g;
vl a,mx,mi,ans;

void dfs2(ll x=0,ll p=0){
    for(ll to:g[x]){
        if(to==p)continue;
        if(ans[to]!=-1){
            if(abs(ans[x]-ans[to])!=1){
                cout<<NO<<endl;
                exit(0);
            }
            continue;
        }
        if(mi[to]<=ans[x]+1&&ans[x]+1<=mx[to])ans[to]=ans[x]+1;
        else if(mi[to]<=ans[x]-1&&ans[x]-1<=mx[to])ans[to]=ans[x]-1;
        else {
            cout<<NO<<endl;
            exit(0);
        }
        dfs2(to,x);
    }
}

void dfs(ll x=0,ll p=-1){
    for(ll to:g[x]){
        if(to==p)continue;
        dfs(to,x);
        chmin(mx[x],mx[to]+1);
        chmax(mi[x],mi[to]-1);
    }
    if(a[x]==-1&&x!=0)return;
    if(a[x]!=-1){
        ans[x]=a[x];
        mx[x]=mi[x]=a[x];
    }else{
        ans[x]=mx[x];
    }
    dfs2(x,p);
}

// ll N, vl A, vl B, ll K, vl V, vl P
// 残りのすべての頂点に書き込む整数を工夫することで木が条件を満たすようにできるならば Yes を、できないならば No を出力せよ。
// 条件を満たせる場合、追加で N 行出力せよ。このうちの v (1 ≦ v ≦ N) 行目には、頂点 v に書かれる整数を出力せよ。条件を満たすような整数の書き込み方が複数ある場合、そのうちいずれかひとつを出力すればよい。
void solve(){
    g.resize(N);
    rep(i,N-1){
        g[A[i]-1].push_back(B[i]-1);
        g[B[i]-1].push_back(A[i]-1);
    }

    mx.resize(N,INF);
    mi.resize(N,0);
    a.resize(N,-1);
    ans.resize(N,-1);
    rep(i,K)a[V[i]-1]=P[i];
    dfs();

    cout<<YES<<endl;
    rep(i,N)cout<<ans[i]<<endl;
}


Measured memory_bytes: 17664
#include<stdio.h>
int main(void)
{
	int a,b,c,n;
	scanf("%d",&n);
	a=n/100;
	n=n%100;
	b=n/10;
	c=n%10;
	if(a==7||b==7||c==7) {
	printf("Yes\n");                            
	}
	else {
	printf("No\n");  
	}
	return 0;
}
	

Measured memory_bytes: 1592
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		int sL = S.length();

		double sD = sL/2;

		int result = 0;

		for(int i = 0 ;i< Math.floor(sD);i++) {

			String A  = S.substring(i,i+1);
			String B = S.substring(sL-(i+1),sL-i);

			if(!A.equals(B)) {
				result++;
			}

		}

		System.out.println(result);
}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int d[100005],mx,n,a[100005],b[100005];
vector<int> edge[100005];
map<pair<int,int>,int> col;
void dfs(int u){
    map<int,int> p;int c=1;
    for(int i=0;i<edge[u].size();i++){
        int v=edge[u][i];
        if(col[{u,v}]) p[col[{u,v}]]=1;
    }
    for(int i=0;i<edge[u].size();i++){
        int v=edge[u][i];
        if(col[{u,v}]) continue;
        while(p[c]) c++;
        col[{u,v}]=col[{v,u}]=c;
        p[c]=1;dfs(v);
    }
}
int main(){
    int start;cin>>n;
    for(int i=1;i<n;i++){
        cin>>a[i]>>b[i];
        edge[a[i]].push_back(b[i]);
        edge[b[i]].push_back(a[i]);
        d[b[i]]++;d[a[i]]++;
    }
    for(int i=1;i<=n;i++){
        if(d[i]==1) start=i;
        mx=max(d[i],mx);
    }
    cout<<mx<<endl;
    dfs(start);
    for(int i=1;i<n;i++){
        cout<<col[{a[i],b[i]}]<<endl;
    }
}

Measured memory_bytes: 32512
#a.py
N = int(input())
b = list(map(int,input().split()))

def next(b,l):
	for i in range(len(b)-1,-1,-1): # i = N-1,N-2,...,0
		if b[i] == i+1:
			b.pop(i) # remove i-th elem.
			l.append(i+1) # add i+1
			return b, l
	return -1,-1

# main
l = []
while b != []:
	b,l = next(b,l)
	if b == -1:
		print(-1)
		exit()
l.reverse()

for i in range(N):
	print(l[i])


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

int main(void){
	int n, k;
	cin >> n >> k;
	int l;
	for(int i=0; i<n; i++){
		int a;
		cin >> a;
		if(a==1) l==i;
	}
	int ans = 0;
	ans += (l+k-2)/(k-1);
	ans += (n+k-l-3)/(k-1);
	cout << ans << endl;
}

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

int main(){
  int A,B,C,D;
  cin >> A>>B>>C>>D;
  
  bool vic;
  
  while(1){
    C -= B;
    if(C<=0){
      vic = true;
      break;
    }
    A -= D;
    if(A<=0){
      vic = false;
      break;
    }
  }
  
  if(vic){
    cout <<"Yes"<<endl;
  }else{
    cout <<"No"<<endl;
  }
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()

int main() {
    int N, M;
    cin >> N >> M;
    if (N == M) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define INF 999999999999999997;
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.
	int A, B, C;
	cin >> A >> B >> C;
	VI abc(3,0);
	abc[0] = A;
	abc[1] = B;
	abc[2] = C;
	sort(abc.begin(), abc.end());
	if (abc[0] != abc[1])
		cout << abc[0];
	else
		cout << abc[2];
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    ll n, p;
    cin>>n>>p;
    if(n==1)
    {
        cout<<p;
        return 0;
    }
    map<ll, ll> primes;
    ll b = sqrt(p);
    ll a = p;
    ll i;
    FOR(i, 2, b+1)
    {
        ll cur = 0;
        while(p%i==0)
        {
            cur++;
            if(primes.find(p/i)==primes.end())
                primes[p/i] = 1;
            else primes[p/i]++;
            p /= i;
        }
        if(cur)
        {
            if(primes.find(i)==primes.end())
                primes[i] = cur;
            else primes[i] += cur;
        }
    }
    map<ll, ll>::iterator it;
    ll ans = 1;
    int j ;
    it = primes.begin();
    while(it!=primes.end())
    {
        ll cur = (it->ss/n);
        FOR0(j, cur) ans *= it->ff;
        it++;
    }
    cout<<ans;
}

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

int main() {
  int a[100], n, i, j, m, t, c, f;

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

  c = 0;
  for (i = 0; i < n; i++) {
    m = i;
    f = 0;
    for (j = i; j < n; j++) {
      if (a[m] > a[j]) {
        m = j;
        f = 1;
      }
    }

    t = a[i];
    a[i] = a[m];
    a[m] = t;

    if (f) {
      c++;
    }
  }

  for (i = 0; i < n; i++) {
    cout << a[i];
    if (i != n - 1) {
      cout << ' ';
    }
  }

  cout << endl << c << endl;

  return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include<string.h>
int main()
{
    char s[3],str[3];
    scanf("%s",s);
    if(strcmp(s,"AAA")==0 || strcmp(s,"BBB")==0)
    {
        printf("No");
        // str = "No";
    }
    if(strcmp(s,"ABA")==0 || strcmp(s,"BAB")==0)
    {
        printf("Yes");
    }
    if(strcmp(s,"BBA")==0 || strcmp(s,"AAB")==0)
    {
        printf("Yes");
        // str = "Yes";
    }
    if(strcmp(s,"ABB")==0 || strcmp(s,"BAA")==0)
    {
        printf("Yes");
        // str = "Yes";
    }
    // printf("%s",str);
    return 0;
}


Measured memory_bytes: 128
import * as fs from 'fs';

// main
function main(input: string[]) {
    // param
    var k: number = 0;
    var n: number = 0;
    var an: number[] = [];
    var ans: number = 0;
    // init
    [k, n] = input.shift().split(" ").map(x => Number(x));
    an = input.shift().split(" ").map(x => Number(x));
    // solve
    var max = 0;
    for (var nx = 0; nx < n; nx++) {
        if (nx < n - 1) {
            max = Math.max(max, an[nx + 1] - an[nx]);
        } else {
            max = Math.max(max, k + an[0] - an[nx]);
        }
    }
    ans = k - max;
    // answer
    console.log(ans);
}

// entrypoint
function entrypoint() {
    try {
        // linux
        var input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            input = lines;
            main(input);
        });
    }
}
entrypoint();


Measured memory_bytes: 43512
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    char c;
    cin >> c;
    cout << (char)(c + 1) << endl;
}

Measured memory_bytes: 256
#include <iostream>
     
    using namespace std;
    typedef long long ll;
    #define min(a, b) ((a) < (b)? (a):(b))
    #define abs(a) ((a) < (0)? -(a):(a))
    #define rep(i, n) REP(i, 0, (n))
    #define REP(i, a, n) for(typeof(n) i=(a); i<(n); i++)
     
    int N;
    int a[100010];
     
    int main() {
    	cin >> N;
    	ll total = 0;
    	REP(i, 1, N+1) {
    	    cin >> a[i];
    	    total += abs(a[i-1]-a[i]);
    	}
        total += abs(a[N]);
        REP(i, 1, N+1) {
            cout << total - (abs(a[i-1]-a[i]) + abs(a[i]-a[i+1]) - abs(a[i-1]-a[i+1])) << endl;
        }
    }

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
using namespace std;
const int inf = 1e18 + 7;
const int N = 1e6 + 7;
const int md = 1e9 + 7;
int vis[N], pen[N], cor[N];
void sol() {
  int n, m;
  int a1 = 0, a2 = 0;
  int pnum;
  string s;
  cin >> n >> m;
  for(int i=0; i<m; i++) {
    cin >> pnum >> s;
    if(!vis[pnum]) {
      if(s == "WA") {
        pen[pnum]++;
      }
      else {
        cor[pnum] = 1;
        vis[pnum] = 1;
      }
    }
  }
  for(int i=1; i<=n; i++) {
    a1 += cor[i];
    if(cor[i])
      a2 += pen[i];
  }
  cout << a1 << " " << a2;
}

int32_t main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  //cin >> T; while(T--) 
  sol();
  return 0;
}


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

void maxHeapify(vector<int>& A, int i){
    int largest = i;
    int left = i * 2;
    if (left < A.size() && A[left] > A[i]) {
        largest = left;
    }
    int right = left + 1;
    if (right < A.size() && A[right] > A[largest]) {
        largest = right;
    }
    if (i != largest) {
        swap(A[i], A[largest]);
        maxHeapify(A, largest);
    }
}

void buildHeap(vector<int>& A){
    int H = A.size() - 1;
    for (int i = H / 2; i >= 1; i--) {
        maxHeapify(A, i);
    }
}

int main(){
    int H;
    cin >> H;
    vector<int> A(H + 1);
    for (int i = 1; i <= H; i++) {
        cin >> A[i];
    }
    buildHeap(A);
    for (int i = 1; i <= H; i++){
        cout << " " << A[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 4612
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;

const lint mod = 1e9 + 7;

int main(){
    int n, K;
    scanf("%d%d", &n, &K);
    lint x[n], y[n];
    rep(i, n) scanf("%lld%lld", &x[i], &y[i]);
    
    lint ans = LLONG_MAX;
    rep(i, n)rep(j, n)rep(k, n)rep(l, n){
        lint L = min({x[i], x[j], x[k], x[l]});
        lint R = max({x[i], x[j], x[k], x[l]});
        lint U = max({y[i], y[j], y[k], y[l]});
        lint D = min({y[i], y[j], y[k], y[l]});
        if(L==R || U==D) continue;
        int cnt = 0;
        rep(m, n)if(L<=x[m] && x[m]<=R && D<=y[m] && y[m]<=U){
            ++cnt;
        }
        if(cnt >= K) ans = min(ans, (R-L)*(U-D));
    }
    
    printf("%lld\n", ans);
}

Measured memory_bytes: 384