akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int INF=1e9;
const int MOD=1e9+7;
const double pi=acos(-1);

int main(){
  ll a,b,k;
  cin >> a >> b >> k;
  rep(i,k){
    if(i%2==0){
      if(a%2==1)a--;
    
      b+=a/2;
      a/=2;
    }
    if(i%2==1){
      if(b%2==1)b--;
    
      a+=b/2;
      b/=2;
    }
  }
  cout << a << " "  << b << endl;
}


Measured memory_bytes: 256
//https://www.geeksforgeeks.org/find-number-of-triangles-possible/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl 	"\n"

typedef vector< ll > 	vi;
typedef vector< vi > 	vvi;
typedef pair< ll,ll > 	ii;
#define pb 		push_back
#define all(c) 		(c).begin(),(c).end()
#define tr(c,i) 	for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) 	((c).find(x) != (c).end())

#define MOD 	1000000007
#define INF 	(int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))

int main()
{	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	
	ll n,x;
	cin>>n;
	std::vector<ll> v;
	for(ll i=0; i<n; i++)
		{	cin>>x; v.push_back(x); }

	sort(all(v));
	ll ans=0;

	for(ll i=n-1; i>0; i--)
	{
		ll l=0, r=i-1;
		while(l<r)
		{
			if(v[l]+v[r] > v[i] )
				{ ans+= r-l;
				r--; }
			else l++;
		}
	}
	cout<<ans;

	return 0;
}

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

namespace WelcomeAtcordet
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] input_T = Console.ReadLine().Split(' ');
            int M = int.Parse(Console.ReadLine());
            for(int i = 0; i < M; i++)
            {
                int[] T = Array.ConvertAll(input_T, int.Parse);
                string[] input = Console.ReadLine().Split(' ');
                int P = int.Parse(input[0]);
                int X = int.Parse(input[1]);
                T[P-1] = X;
                int ans = 0;

                foreach(int time in T)
                {
                    ans += time;
                }

                Console.WriteLine(ans);

            }
        }
    }
}


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

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	
	if (a == b)
	{
		cout << c;
	}
	else if (a == c)
	{
		cout << b;
	}
	else
	{
		cout << a;
	}
	cout << endl;
}

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

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 100000000;
double PI = 3.1415926535;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<pair<ll,ll>>>;

int main(){
  ll X,Y;
  cin >> X >> Y;
  if(X % Y == 0){
    cout << -1 << endl;
    return 0;
  }else{
    cout << X << endl;
    
  }
}

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

using namespace std;

int main() {
	string str;

	cin >> str;

	if (str.find('a') != -1 && str.find('b') != -1 && str.find('c') != -1)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
// O O O O O O O O O O O O O O O OO O OO O OO O O O TTCH O TTTCH O TTTCH O O O O
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
// #include <random>
#include <iomanip>
#include <bitset>
#include <cassert>
 
using namespace std;

#define y1 y11
#define less less228
#define left left228
#define right right228
#define list list228
#define all(v) v.begin(), v.end()
#define tm tm228
 
 
 
template<typename T> void uin(T &a, T b) {
    if (b < a) a = b;
}
template<typename T> void uax(T &a, T b) {
    if (b > a) a = b;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int a = 0;
    int b = 0;
    int c
     = 0;
    for (char C : s) {
        if (C == 'a') ++a;
        if (C == 'b') ++b;
        if (C == 'c') ++c;
    }
    if (a >= b - 1 && a >= c - 1 && b >= a - 1 && b >= c - 1 && c >= a - 1 && c >= b - 1) {
        cout << "YES\n";
    } else cout << "NO\n";
    return 0;
}
// RU_023
 
/*
6 3
2 1
3 5
6 2
3 4
2 3
1
3
1
2
3
2
-----
1
 
 
 
8 4
4 1
1 3
3 6
6 7
7 2
2 5
5 8
2
4
3
1
1
2
3
4
 
 
12 4
7 9
1 3
4 6
2 4
10 12
1 2
2 10
11 1
2 8
5 3
6 7
3
1
1
2
4
3
3
2
2
3
4
4
 
 
8 3
1 2
2 3
3 4
4 5
5 6
6 7
7 8
1
3
1
1
3
2
3
2
 
 
 
 
 
*/

Measured memory_bytes: 512
#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 <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <cmath>         // sqrt
#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 <bitset>        // bitset
#include <bits/stdc++.h> // isupper, islower, isdigit, toupper, tolower
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, n) for (int i = (a); i < (n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pl;
typedef pair<int, int> P;
typedef tuple<ll, ll, string> Tlls;

// Greatest Common Divisor (最大公約数)
ll gcd(ll a, ll b)
{
  // Eucledean algorithm
  while (a)
  {
    if (a < b)
    {
      std::swap(a, b);
    }
    a %= b;
  }
  return b;
}

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

// key: value of prime factor素因数分解
// value: number of prime factor
map<ll, ll> prime_factorization(ll n)
{
  map<ll, ll> prime_factors;
  for (ll i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      prime_factors[i]++;
      n /= i;
    }
  }
  if (n != 1)
    prime_factors[n] = 1;
  return prime_factors;
}

// 約数リスト約数の列挙
vector<ll> get_divisors(const ll n)
{
  vector<ll> divs;
  for (ll i = 1; i < (ll)sqrt((ld)n) + 1; i++)
  {
    if (n % i == 0)
    {
      divs.push_back(i);
      if (i != n / i)
      {
        divs.push_back(n / i);
      }
    }
  }

  // 必要に応じてソート
  // sort(divs.begin(), divs.end());

  return divs;
}

int main()
{

  string S;
  cin >> S;

  if (S == "ABC")
  {
    cout << "ARC" << endl;
  }
  else
  {
    cout << "ABC" << endl;
  }
  return 0;
}


Measured memory_bytes: 3608
#include<cstdio>
#include<set>


using namespace std;


int main(void)
{
	int n;

	while(scanf("%d", &n)==1)
	{
		set<int> s;

		for(int i=0;i<n;i++)
		{
			int a;
			scanf("%d", &a);
			if(s.find(a)==s.end())
			{
				s.insert(a);
			}
			else
			{
				s.erase(a);
			}
		}
		printf("%d\n", s.size());
	}
	return 0;
}


Measured memory_bytes: 4864
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        if(a < 1200){
            System.out.println("ABC");
        }else{
        System.out.println("ARC");
        }

        }        
    }



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

int main(){
	int n, tmp;
	int count = 0;
	int A[100001] = {0};
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> tmp;
		A[tmp]++;
	}
	for(int i = 1; i < 100001; i++)
		if(A[i]>0) count += A[i]-1; 
	if(count % 2 == 1) count++;
	cout << n - count << endl;
	return 0;	
}


Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
l1 = 0
l2 = 0
l4 = 0
for i in range(len(A)):
  if(A[i] % 4 == 0):
    l4 += 1
  elif(A[i] % 2 == 0):
    l2 += 1
  else:
    l1 += 1
if(l2 == 0 and l4 + 1 == l1):
  print('Yes')
elif(l4 < l1):
  print('No')
else:
  print('Yes')



Measured memory_bytes: 15020
#include <iostream>
#define REP(i, n) for(int i = 0; i < (n); i++)

using namespace std;
typedef long long ll;

ll pow(ll a, ll n)
{
  ll ret = 1;
  REP(i, n) ret *= a;
  return ret;
}

int main()
{
  int N, P;
  cin >> N >> P;
  ll o = 0;
  REP(i, N) {
    int A;
    cin >> A;
    if (A % 2 == 1) o++;
  }

  if (o >= 1) cout << pow(2, N - 1) << endl;
  else cout << (P == 0 ? pow(2, N) : 0) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    while(n>0)
    {
        int rem=n%10;
        if(rem==7)
        {
            cout<<"Yes"<<endl;
            break;
        }
        n=n/10;
    }
    if(n<=0)
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3612
#include<stdio.h>

int main(){
  int n;
  int i, j, k;
  int b, f, r, v;
  int box[4][3][10];

  for(i = 0; i < 4; i++){
    for(j = 0; j < 3; j++){
      for(k = 0; k < 10; k++){
	box[i][j][k] = 0;
      }
    }
  }

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d %d %d %d", &b, &f, &r, &v);
    box[b - 1][f - 1][r - 1] += v;
  }

  for(i = 0; i < 4; i++){
    for(j = 0; j < 3; j++){
      for(k = 0; k < 10; k++){
	printf(" %d", box[i][j][k]);
      }
      printf("\n");
    }
    if(i != 3){
      printf("####################\n");
    }
  }

  return 0;
}


Measured memory_bytes: 2088
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int x = scanner.nextInt(), a = scanner.nextInt(), b = scanner.nextInt();
			System.out.println((Math.abs(a - x) > Math.abs(b - x)) ? "B" : "A");
		}
	}
}


Measured memory_bytes: 35372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

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

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i,j;
    int n;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    map<ll,ll> ma;
    ll ans=0;
    for(i=0;i<n;i++){
        ans += ma[i-a[i]];
        ma[a[i]+i]++;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 27892
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int X, happiness;

    scanf("%d", &X);
    happiness = X / 500 * 1000;
    X %= 500;
    happiness += X / 5 * 5;
    printf("%d", happiness);

    return 0;
}


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

#define testcases ll t;cin>>t;while(t--)
#define queries ll q;cin>>q;while(q--)
#define ll long long 
#define loop(i,x,n) for(ll i=x;i<n;i++)
#define ff first
#define ss second
#define elif else if
#define flush cout<<endl;
#define pb push_back;
#define mod 1000000007



#define PI 3.14159265 

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//testcases{
		long n,y,z,k,p,q,r,ct=0,sum=0,e=0;
		double a,x,V,h,theta,x1,a1;
		
		cin>>a>>x>>V;

		if(V>=a*x*a/2){
			V = a*a*x - V;
			x1  = (2*V)/(a*a);

			h = (a*x1)/sqrt(a*a + x1*x1);

			theta = asin(h/a);

			theta = (theta*180)/PI;
			cout<<setprecision(10)<<theta;
		}
		else{
			a1  = (2*V)/(x*a);

			h = (a1*x)/sqrt(a1*a1 + x*x);

			theta = asin(h/x);

			theta = (theta*180)/PI;
			cout<<setprecision(10)<<90-theta;;
		}

		

				
	
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n";
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define double long double
#define M_PI 3.14159265358979323846 
const int mod = 1e9 + 7;

int32_t main()
{
    fastio;

    int n; cin >> n;
    bool flag = true, zero = false;
    int ans = 1, maxi = 1e18;
    for(int i=0; i<n; i++){
    	int x; cin >> x;
    	if(ans != 0 && x > maxi/ans){
    		flag = false;
    	}else{
    		ans *= x;
    	}

    	if(x == 0) zero = true;
    }

    if(zero) flag = true;
    cout << (flag?ans:-1) << endl;
    return 0;
}

/*

*/

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

typedef long long LL;
// a^5-b^5=x
// (a-b)(a^4+a^3b+a^2b^2+ab^3+b^4)=x 

LL f5(LL x)
{
	return x*x*x*x*x;
}

int main()
{
	LL x;
	cin>>x;
	LL a,b;
	for(a=-120;a<=120;a++)
		for(b=-120;b<=120;b++)
			if(f5(a)-f5(b)==x)
			{
				cout<<a<<" "<<b<<endl;
				return 0;
			}
	//cout<<a<<" "<<b<<endl;
	return 0;
}

Measured memory_bytes: 3616
N, M = map(int, input().split())
H = list(map(int, input().split()))

result = [1] * N

for i in range(M):
    A, B = list(map(int, input().split()))
    if H[A-1] <= H[B-1]:
        result[A-1] = 0
    if H[B-1] <= H[A-1]:
        result[B-1] = 0

print(sum(result))



Measured memory_bytes: 20112
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main()
{
  ll n,k,r,s,p;
  cin>>n>>k>>r>>s>>p;
  string sp;
  cin>>sp;

  string q="";
  ll pro=0;

  for(int i=0;i<n;i++)
  {
      if(i-k<0)
      {
          if(sp[i]=='r')
          {
              q+="p";
              pro+=p;
          }
          else if(sp[i]=='s')
          {
              q+="r";
              pro+=r;
          }
          else
          {
              q+="s";
              pro+=s;
          }
      }
      else
      {
           if(sp[i]=='r')
          {
             if(q[i-k]!='p')
             {
                 q+="p";
                 pro+=p;
             }
             else
             {
                 if(i+k<n)
                 {
                     if(sp[i+k]=='s')
                        q+="s";
                     else
                        q+="r";
                 }
                 else
                    q+="p";
             }
          }
          else if(sp[i]=='s')
          {
             if(q[i-k]!='r')
             {
              q+="r";
              pro+=r;
             }
             else
             {
                 if(i+k<n)
                 {
                     if(sp[i+k]=='r')
                        q+="s";
                    else
                        q+="p";
                 }
                 else
                    q+="p";
             }
          }
          else
          {
             if(q[i-k]!='s')
             {
              q+="s";
              pro+=s;
             }
             else
             {
                 if(i+k<n)
                 {
                     if(sp[i+k]=='s')
                        q+="p";
                     else
                         q+="r";
                 }
                 else
                    q+="r";
             }
          }
      }
  }
  cout<<pro<<"\n";
return 0;
}


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

#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    int n;
    cin >> n;
    vi a(n);

    fo(i, n) {
        int l;
        cin >> l;
        a[l - 1] = i + 1;
    }

    fo(i, n) cout << a[i] << " ";
    cout << endl;

    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const int INF = pow(2,29);
const int MOD = 1000000007;
const int N_MAX = 110;

vector<vector<int>> g(N_MAX, vector<int>(N_MAX,10));

void init_g() {
  rep(i, N_MAX) rep(j, N_MAX) {
    if (i==j) g[i][j] = 0;
    else g[i][j] = INF;
  }
}

void wf() {
  rep(k, N_MAX) rep(i, N_MAX) rep(j, N_MAX) {
    g[i][j] = min(g[i][j], g[i][k]+g[k][j]);
  }
}

int main() {
  int N, M; cin >> N >> M;
  int a[M], b[M], c[M];
  rep(i, M) { cin >> a[i] >> b[i] >> c[i]; a[i]--; b[i]--; }

  init_g();
  rep(i, M) { g[a[i]][b[i]] = c[i]; g[b[i]][a[i]] = c[i]; }
  wf();

  int result = 0;
  rep(i, M) if(g[a[i]][b[i]] != c[i]) result++;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
// Problem : B - Count Balls
// Contest : AtCoder Beginner Contest 158
// URL : https://atcoder.jp/contests/abc158/tasks/abc158_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

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

#ifdef LOCAL
#define DEBUG(...) cerr << #__VA_ARGS__ << ": ", debug(__VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator << (ostream &os, const vector<T> &v) {os << "["; for (int i=0; i<(int)v.size(); i++) {if (i) os << ", "; os << v[i];} return os << "]";}
void debug() {cerr << "\n";} template<typename T, typename... Args> void debug(T x, Args... args) {cerr << x << "; "; debug(args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
    long long n, a, b;
    cin >> n >> a >> b;
    
    cout << n / (a + b) * a + min(n % (a + b), a) << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

vector<long long> calc_divisor(long long n) {
    vector<long long> res;
    for (long long i = 1LL; i * i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            long long j = n / i;
            if (j != i) res.push_back(j);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

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

    ll ans = 0;
    FOR(i, 1, N+1) {
        if (i % 2 == 0) continue;
        vector<ll> div = calc_divisor(i);
        debug(i, div);
        if (div.size() == 8) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 764
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <list>
#include <map>
#include <string>
#include <functional>
#include <math.h>
#include <utility>
#define INF 100000000
using namespace std;
typedef pair<int,int> P;
int W[10],K[10];
int main()
{
	for(int i=0;i<10;i++)cin>>W[i];
	for(int i=0;i<10;i++)cin>>K[i];
	sort(W,W+10,greater<int>());
	sort(K,K+10,greater<int>());
	int aW=W[0]+W[1]+W[2];
	int aK=K[0]+K[1]+K[2];
	printf("%d %d\n",aW,aK);
	return 0;
}

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


int main() {
  int N, L;
  cin >> N >> L;
  string S[N];
  rep(i, N) cin >> S[i];
  sort(S, S + N);
  string answer;
  rep(i, N) answer += S[i];
  cout << answer << endl;
}

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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

    // 入力
    string s, tmp;
    cin >> s;

    // 処理
    int top, tail;
    top  = s.find_first_of('A');
    tail = s.find_last_of('Z');

    // 出力
    cout << tail - top + 1 << endl;

    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include <string> 
#include <vector>  
#include<math.h>
#include <algorithm>
#include<iomanip>
#include<map>
#define INF 1000000000
#define LM 55555
#define LL long long
using namespace::std;


long long now, num, N, K, M, ans,sosu[100000];
string S, T;
bool h,w[10], k[100],con[300];
char cc;

int main() {

	cin >> N>> M>>K;
	cout << (N-M)%K << endl;
	return 0;

}

Measured memory_bytes: 256
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
 
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,x;
	int cnt = 0;
	cin >> a >> b >> c >> x;
	rep(i,a+1){
		rep(j,b+1){
			rep(k,c+1){
				if(i * 500 + j * 100 + k * 50 == x) ++cnt;
			}
		}
	}
	cout << cnt << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
#define N 10000

bool isPrime(int n){
  int i;

  if(n == 2) return true;

  if(n < 2 || n%2 == 0) return false;

  i = 3;
  while(i <= sqrt(n)){
    if(n%i == 0) return false;
    i = i+2;
  }

  return true;
}

int main(){
  int num[N];
  int i,n,p=0;

  scanf("%d",&n);

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

  for(i = 0; i < n; i++){
    if(isPrime(num[i]) == true) p++;
    else continue;
  }

  printf("%d\n",p);

  return 0;
}




Measured memory_bytes: 2740
N=int(input())
S=input()
tmp=1
L=[]
ans=10**6
black=0
white=0
for i in range(1,len(S)):
    if S[i]==S[i-1]:
        tmp+=1
    else:
        L.append(tmp)
        tmp=1
    if i ==len(S)-1:
        L.append(tmp)

    if S[i]=='#':
        black+=1
    else:
        white+=1

cul=[0]*(len(L)+2)
for i in range(len(L)):
    cul[i+2]=L[i]+cul[i]


if S[0]=='.':
    white+=1
    for i in range(2,len(cul)):
        if i%2==0:
            ans=min(ans,cul[i-1]+white-cul[i])
        else:
            ans=min(ans,cul[i]+white-cul[i-1])
else:
    black+=1
    for i in range(2,len(cul)):
        if i % 2 == 0:
            ans = min(ans,cul[i]+white-cul[i-1])
        else:
            ans = min(ans,cul[i-1]+white-cul[i])


if len(L)==1:
    ans=0
else:
    ans=min(ans,sum(L[0::2]),sum(L[1::2]))

print(ans)

Measured memory_bytes: 13708
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
// r#"3"# => "2",
r#"1 5 3"# => "54",
 // r#"11"# => "30",
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        a: usize,
        b: usize,
        c: usize,
    }
    let mut x = [a,b,c];
    x.sort();
    x.reverse();
    (x[0] * 10 + x[1] + x[2]).to_string()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s, t;
	cin >> s >> t;
	int s1 = s.size();
	int t1 = t.size();
	if((s1 + 1) == t1){
		for(int i = 0;i < s1;i++){
			if(s[i] != t[i]){
				cout << "No" << endl;
				return 0;
			}
		}
	}else{
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 3624
N = int(input())
SET = set()
table = list(map(int,input().split()))
 
for i in range(len(table)):
    SET.add(table[i])
 
ans = 0
 
num_query = int(input())
num_array = list(map(int,input().split()))
 
for i in range(len(num_array)):
    if num_array[i] in SET:
        ans += 1
 
print("%d"%ans)


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

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1e9;
using namespace std;
typedef long long ll;

int main(){
  int d;
  std::cin >> d;
  if(d==25)std::cout << "Christmas" << '\n';
  else if(d==24)std::cout << "Christmas Eve" << '\n';
  else if(d==23)std::cout << "Christmas Eve Eve" << '\n';
  else if(d==22)std::cout << "Christmas Eve Eve Eve" << '\n';
}


Measured memory_bytes: 256
#include <stdio.h>

int A[1000000], n;

/* ????????¢?´¢ */
int binarySearch(int key) {
	int left = 0;
	int right = n;
	int mid;
	while(left < right) {
		mid = (left + right) / 2;
		if(key == A[mid]) return 1; /* key ????????? */
		if(key > A[mid]) left = mid + 1; /* ???????????¢?´¢ */
		else if(key < A[mid]) right = mid; /* ???????????¢?´¢ */
	}
	return 0;
}

int main(void) {
	int i, q, k, sum = 0;
	scanf("%d",&n);
	for(i=0; i<n; i++) {
		scanf("%d",&A[i]);
	}
	
	scanf("%d",&q);
	for(i=0;i<q;i++) {
		scanf("%d",&k);
		if(binarySearch(k)) sum++;
	}
	printf("%d\n",sum);
	
	return 0;
}

Measured memory_bytes: 980
N=int(input())
p=0
for i in range(1,N):
  if i**2<=N:
    p=p+1
  else:
    break
    
q=p   
for i in reversed(range(p+1)):
  if N%i!=0:
    q=q-1
  else:
    break
    
print((q+(N//q))-2)

Measured memory_bytes: 3060
#include <stdio.h>
int main(){
  int n,i;
  int a[1000];
 
  scanf("%d",&n);
  
  for(i=1;i<=n;i++) scanf("%d",&a[i]);
  
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,a[i]);
    if(i/2 != 0) printf("parent key = %d, ",a[i/2]);   
    if(2*i <= n) printf("left key = %d, ",a[2*i]);    
    if(2*i+1 <= n) printf("right key = %d, ",a[2*i+1]);
    printf("\n");
  }
  
return 0;
}

Measured memory_bytes: 604
#include <iostream>
#define int long long
using namespace std;
signed main(){
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int arr[n];
	for (int i = 0; i < n; ++i){
		cin>>arr[i];
	}
	int max = arr[0];
	int ans = 0;
	for (int i = 1; i < n; ++i){
		if(arr[i]>max){
			max = arr[i];
		}else{
			ans += max-arr[i];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 5168
S=int(input())
DP=[0]*(S+11)
mod=10**9+7
DP[0]=1
DP[1]=0
DP[2]=0
DP[3]=1
C=2
for i in range(4,S+1):
  DP[i]=(C-DP[i-1]-DP[i-2])%mod
  C=(C+DP[i])%mod
print(DP[S])


Measured memory_bytes: 9088
n=int(input(''))
x=input('')
x=x.split(' ')
for a in range(n):
    x[a]=int(x[a])

ave=float(0)
for a in x:
    ave=ave+a
ave=ave/n

disa=0
disb=0

for a in x:
    disa=disa+(int(ave)-a)**2
    disb=disb+(int(ave+1)-a)**2

if disa<=disb:
    print(disa)
else:
    print(disb)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
using namespace std;
int main(){
        string s;
        cin >> s;
        int alpha['z'-'a'+1] = {};
        int len = s.length();
        for (size_t i = 0; i < len; i++) {
                alpha[s[i]-'a']++;
        }
        for (size_t i = 0; i < 'z'-'a'+1; i++) {
                if (alpha[i] > 1) {
                        cout << "no" << endl;
                        return 0;
                }
        }
        cout << "yes" << endl;

        return 0;
}

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

int main(void){
    ll n, d, a;
    cin >> n >> d >> a;
    vector<pair<ll, ll>> xh(n);
    rep(i, n) {
        ll x, h;
        cin >> x >> h;
        xh[i] = make_pair(x, h);
    }
    sort(xh.begin(), xh.end());
    queue<pair<ll, ll>> d_count;
    ll count = 0;
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        while(!d_count.empty() && d_count.front().first < xh[i].first) {
            count -= d_count.front().second;
            d_count.pop();
        }
        if (xh[i].second-count > 0) {
            ll attack_num;
            if (xh[i].second % a == 0)
                attack_num = (xh[i].second-count) / a;
            else
                attack_num = (xh[i].second-count) / a + 1;
            ans += attack_num;
            
            count += a * attack_num;
            d_count.push(make_pair(xh[i].first+2*d, a*attack_num));
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 4992
import math
import sys
N = input()
i = list(map(int, input().split()))
result = 1
if 0 in i:
  print(0)
else:
  for x in i:
    result *= x
    if(result >= 10**18):
      break
  if(result > 10**18):
    print(-1)
  else:
    print(result)


Measured memory_bytes: 22452
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,x;
    cin>>n>>x;
    cout<<n-x+1;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int A,B;
	cin >> A >> B;
	cout << max(A + B,max(A - B,A * B)) <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
const ll LLINF = 1LL << 50;
using namespace std;

int main() {
    string s;
    cin >> s;
    int ans, right, left;
    char check;
    if (s.length() % 2 == 0) ans = s.length() / 2, right = s.length() / 2, left = s.length() / 2 - 1, check = s[s.length() / 2];
    else ans = s.length() / 2 + 1, right = s.length() / 2 + 1, left = s.length() / 2 - 1, check = s[s.length() / 2];

    while (1) {
        if (left == -1 || right == s.length()) break;

        if (s[left] == check && s[right] == check) ans++, left--, right++;
        else break;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    string S, T;
    cin >> S >> T;
    T.pop_back();
    if (S == T) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}

Measured memory_bytes: 3636
#include <vector>
#include <iostream>
using namespace std;
int n, m, q, x, y, t; int group[111111]; vector<int> f[111111];
int main() {
	scanf("%d%d", &n, &m);
	for(int i = 0; i < n; i++) group[i] = i, f[i].push_back(i);
	for(int i = 0; i < m; i++) {
		scanf("%d%d", &x, &y);
		if(group[x] == group[y]) continue;
		x = group[x], y = group[y];
		if(f[y].size() > f[x].size()) swap(x, y);
		t = f[y].size();
		for(int j = 0; j < t; j++) {
			group[f[y].back()] = group[x];
			f[x].push_back(f[y].back());
			f[y].pop_back();
		}
	}
	scanf("%d", &q);
	for(int i = 0; i < q; i++) {
		scanf("%d%d", &x, &y);
		printf("%s\n", group[x] == group[y] ? "yes" : "no");
	}
	return 0;
}

Measured memory_bytes: 9836
#include <iostream>

using namespace std;

int gcd2(int a, int b){
    if(a == 0) return b;
    if(a > b) return gcd2(a - b, b);
    return gcd2(b - a, a);
}
int gcd(int a, int b, int c){
   return gcd2(gcd2(a, b), c);
}

int main(){
    int k;
    long sum = 0;
    cin >> k;
    for(int i = 1;i <= k;i++){
        for(int j = 1;j <= k;j++){
            for(int l = 1;l <= k;l++){
                sum += gcd(i, j, l);
            }
        }
    }
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n; i++)
#define ll long long
const ll MOD=1000000007;
using namespace std;
ll n;
ll a[100000];
ll modpow(ll x,ll y){
    if (y==0){
        return 1;
    }else if (y==1){
        return x%MOD;
    }else if (y%2==0){
        ll z=modpow(x,y/2);
        return z*z%MOD;
    }else{
        ll z=modpow(x,y/2);
        return (z*z%MOD)*x%MOD;
    }
}
int main(){
    cin>>n;
    rep(i,n) cin>>a[i];
    sort(a,a+n);
    if (n%2==0){
        rep(i,n/2){
            if (a[i*2]!=i*2+1 || a[i*2+1]!=i*2+1){
                cout<<0<<endl;
                return 0;
            }
        }
    }else{
        if (a[0]!=0){
            cout<<0<<endl;
            return 0;
        }
        rep(i,n/2){
            if (a[i*2+1]!=(i+1)*2 || a[i*2+2]!=(i+1)*2){
                cout<<0<<endl;
                return 0;
            }
        }
    }
    cout<<modpow(2,n/2)%MOD<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N;cin>>N;long long A=1,B=1,C=1;
  for(int X=0;X<N;X++){
    A*=10;A%=1000000007;
  }
  for(int X=0;X<N;X++){
    B*=9;B%=1000000007;
  }
  for(int X=0;X<N;X++){
    C*=8;C%=1000000007;
  }
  A-=B*2-C;
  if(A<0){
    long long X;
    for(X=0;X<=abs(A);X+=1000000007){
    }
    A+=X;
  }
  cout<<A<<endl;
}

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

int main() {

  int n;
  cin >> n;
  
  for (int i = 0; i < n ; i++) {
    string c;
    cin >> c;
      
      if (c == "Y") {
        cout << "Four" << endl;
        break;
      }
      if (i == n-1) {
      cout << "Three" << endl;
      }
      
        

  }
}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define base 950527
#define base2 1777771
using namespace std;
typedef unsigned long long ull;
ull a[1001][1001],b[1001][1001],A[1001][1001],tmp[1001][1001],ans;


void Reverse(int p){for(int i=0;i<p;i++)reverse(b[i],b[i]+p);}

void rol_90(int p){
  for(int i=0;i<p;i++)
    for(int j=0;j<p;j++) tmp[p-j-1][i]=b[i][j];
  
  for(int i=0;i<p;i++)
    for(int j=0;j<p;j++) b[i][j]=tmp[i][j];
}

ull ctoi(char ch){
  if('A'<=ch&&ch<='Z') return ch-'A';
  if('a'<=ch&&ch<='z') return 26+ch-'a';
  if(isdigit(ch)) return 52+ch-'0';
  if(ch=='+') return 62;
  return 63;
}

void in(int w,int h,ull tmp[1001][1001]){
  string str[1001];
  for(int i=0;i<h;i++) cin>>str[i];
  
  for(int i=0;i<h;i++)
    for(int j=0;j<(int)str[i].size();j++){
      int num=ctoi(str[i][j]);
      for(int k=0;k<6;k++)tmp[i][6*j+5-k]=num&1,num/=2;
    }
}

set <ull> S;
void roll_hs(int w,int h,int p){
  ull target=0;
  for(int i=0;i<p;i++){
    ull k=0;
    for(int j=0;j<p;j++)k=k*base+b[i][j];
    target=target*base2+k; 
  }
  
  if(S.count(target))return;
  S.insert(target);
  
  memset(A,0,sizeof(0));
  for(int i=0;i<h;i++){
    ull k=0,l=1;
    for(int j=0;j<w;j++){
      k=k*base+a[i][j];
      if(j-p>=0) k-=l*a[i][j-p];
      else l*=base;
      A[i][j]=k;
    }
  }

  for(int j=p-1;j<w;j++){
    ull k=0,l=1;
    for(int i=0;i<h;i++){
      k=k*base2+A[i][j];
      if(i-p>=0) k-=l*A[i-p][j];
      else l*=base2;
      if(target==k&&i>=p-1)ans++;
    }
  }
}

int main(){
  while(1){
    int w,h,p;
    cin>>w>>h>>p;
    if(!w&&!h&&!p)break;
    in(w,h,a),in(p,p,b);

    
    ans=0,S.clear();
    for(int i=0;i<4;i++){
      rol_90(p),roll_hs(w,h,p); 
      Reverse(p),roll_hs(w,h,p),Reverse(p);
    }
    cout <<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 23052
N = int(input())
S = input()
import string
alist = list(string.ascii_uppercase)
adict = {"A":0, "B":1, "C":2, "D":3, "E":4, "F":5, "G":6, "H":7, "I":8, "J":9,
     "K":10, "L":11, "M":12, "N":13,"O":14, "P":15, "Q":16, "R":17, "S":18, "T":19, 
     "U":20, "V":21, "W":22, "X":23, "Y":24, "Z":25}
ans = []
for s in S:
  i = adict[s]
  r = ""
  if i + N > 25:
    r = alist[i + N - 26]
  else:
    r = alist[i + N]
  ans.append(r)
print("".join(ans))


Measured memory_bytes: 3828
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int a, b;
  while (cin >> a >> b) cout << a - b << endl;
}

Measured memory_bytes: 3084
n = int(input())
p = list(map(int, input().split()))

q = list(range(1, n+1))

c = 0

for i in range(n):
    if p[i] != q[i]:
        c += 1
if c == 2 or c == 0:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
public class Hello{
    public static void Main(){

        int A = int.Parse(System.Console.ReadLine());
        int B = int.Parse(System.Console.ReadLine());
        int C = int.Parse(System.Console.ReadLine());
        int X = int.Parse(System.Console.ReadLine());
        int count = 0;

        for(int i = 0; i <= A; i++){
            for(int j = 0; j <= B; j++){
                for(int k = 0; k <= C; k++){
                    int ans = X - i * 500 - j * 100 - k * 50;
                    if(ans == 0) count++;
                }
            }
        }
        System.Console.WriteLine(count);
    }
}


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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int 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(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H=in();
    int N=in();
    int A=0;
    int a;
    REP(i,N){
        cin>>a;
        A=A+a;
    }
    if(A>=H){
        cout<<"Yes"<<endl;   
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
const int N = 1e5 + 5;
bool b[N];
char s[N];
///sheep - 1, wolf - 0

int main() {
    int n;
    scanf("%d", &n);
    scanf("%s", s);

    for (int k = 0; k < 8; ++k) {

        for (int j = 0; j < 3; ++j) {
            if ((k >> j) & 1) b[j] = 1;
            else b[j] = 0;
        }

        if (b[1] == 1) { // it's a sheep
            if (s[1] == 'o' and b[0] != b[2]) continue;
            if (s[1] == 'x' and b[0] == b[2]) continue;
        } else { // wolf
            if (s[1] == 'o' and b[0] == b[2]) continue;
            if (s[1] == 'x' and b[0] != b[2]) continue;
        }

        for(int i = 2; i < n; ++i) {
            if(b[i]) {
                if(s[i] == 'o') b[i + 1] = b[i - 1];
                else b[i + 1] = b[i - 1] ^ 1;
            } else {
                if(s[i] == 'o') b[i + 1] = b[i - 1] ^ 1;
                else b[i + 1] = b[i - 1];
            }
        }
        if(b[n] != b[0]) continue;

        if (b[0] == 1) {
            if (s[0] == 'o' and b[1] != b[n - 1]) continue;
            if (s[0] == 'x' and b[1] == b[n - 1]) continue;
        } else {
            if (s[0] == 'o' and b[1] == b[n - 1]) continue;
            if (s[0] == 'x' and b[1] != b[n - 1]) continue;
        }
 
        for(int i = 0; i < n; ++i) putchar(b[i]? 'S' : 'W');
        return 0;
    }
    puts("-1");
}

Measured memory_bytes: 512
#include<stdio.h>

int main()
{
    int n, num[10] = {0};
    unsigned int i, t, sum;

    ///*lgg*/freopen("data.in", "r", stdin);
    scanf("%d", &n);

    t = n;
    for(i = 0; i < 10; i++)
    {
        num[i] = t % 10;
        t = t / 10;
        ///*lgg*/printf("%d", num[i]);
    }

    sum = 0;
    for(i = 0; i < 10; i++)
    {
        sum += num[i];
    }
    ///*lgg*/printf(" = %d\n", sum);
    if(n % sum == 0)
        printf("Yes");
    else
        printf("No");
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>  // istringstream
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main()
{   
    int X, N; 
    cin >> X >> N;

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

    // 一番Xに近いものを出力

    int dis, ans;
    int dis_min = 500;
    for (int i = -200; i < 200; ++ i) {
        dis = abs(X - i);
        // i が p に含まれない
        bool include = false;
        for (int j = 0; j < N; ++j) {
            if (i == p[j]) {
                include = true;
            }
        }
        if (dis < dis_min && !include) {
            dis_min = dis;
            ans = i;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <deque>
#define pb push_back
#define mod 1000000007
#define all(x) x.begin(),x.end()
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> pll;

int main(void){
  int n;
  cin>>n;
  cout<<(n*800)-((n/15)*200)<<endl;
  return 0;
}

Measured memory_bytes: 256