akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define reg register
using namespace std;
string x,y;
int main()
{
	cin>>x>>y;
	for(reg int i=0;i<=max(x.size(),y.size())-1;i++)
    {
        putchar(x[i]);
        if(y[i]!=0)putchar(y[i]);
    }
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;

const int MAXN = 1e5 + 5;

int last[MAXN + 5], other[MAXN * 10 + 5], pre[MAXN * 10 + 5];
int val[MAXN * 10 + 5], dis[MAXN + 5];
bool vis[MAXN + 5];
queue<int>seq;
int K, all = -1;

void build(int u, int v, int w)
{
	pre[++all] = last[u];
	last[u] = all;
	other[all] = v;
	val[all] = w;
}

void Add(int ans)
{
	for(int i = 0; i <= 9; i++)
		build(ans, (ans * 10 + i) % K, i);
}

void spfa()
{
	while(seq.size()){
		int tot = seq.front();
		int dt = last[tot];
		while(dt != -1){
			int dr = other[dt];
			if(dis[dr] > dis[tot] + val[dt]){
				dis[dr] = dis[tot] + val[dt];
				if(!vis[dr]) seq.push(dr), vis[dr] = true;
			}
			dt = pre[dt];
		}
		seq.pop(), vis[tot] = false;
	}
}

int main()
{
	memset(last, -1, sizeof(last));
	memset(vis, false, sizeof(vis));
	scanf("%d", &K);
	for(int i = 0; i <= K - 1; i++) Add(i);
	for(int i = 0; i <= K - 1; i++) dis[i] = 1 << 30;
	for(int i = 1; i <= 9; i++) dis[i] = i;
	for(int i = 1; i <= 9; i++) seq.push(i), vis[i] = true;
	spfa();
	printf("%d\n", dis[0]);
}

Measured memory_bytes: 13184
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

cnt = 0
memory = [None] * k

# r なら p　をだす、 s なら r　をだす, p なら s　をだす
for i in range(len(t)):
    if t[i] == 'r':
        if memory[i%k] != 'p':
            memory[i%k] = 'p'
            cnt += p
        elif i == len(t)-1: break
        else:
            if i+k < len(t):
                if t[i+k] == 's':
                    memory[i%k] = 's'
                else:
                    memory[i%k] = 'r'

    elif t[i] == 's':
        if memory[i%k] != 'r':
            memory[i%k] = 'r'
            cnt += r
        elif i == len(t)-1: break
        else:
            if i+k < len(t):
                if t[i+k] == 'p':
                    memory[i%k] = 'p'
                else:
                    memory[i%k] = 's'



    elif t[i] == 'p':
        if memory[i%k] != 's':
            memory[i%k] = 's'
            cnt += s
        elif i == len(t)-1: break
        else:
            if i+k < len(t):
                if t[i+k] == 'r':
                    memory[i%k] = 'r'
                else:
                    memory[i%k] = 'p'

print(cnt)

Measured memory_bytes: 3956
n = gets.to_i

a = gets.split(' ').map(&:to_i)

b = Hash.new(0)

a.each do |i|
 b[i] += 1 
end

total = 0
b.each_key do |k|
 total += b[k]*(b[k]-1)/ 2
end

a.each do |k| 
 puts total - b[k] + 1
end

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a,b,c,d,cmp[ohara],cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>cmp[0]>>cmp[1]>>cmp[2];
      sort(cmp,cmp+3);
      rrep(i,1,3){
        ans+=cmp[i]-cmp[i-1];
      }
      Cout(ans);
     

       
return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] v = new int[n];
        long sum = 0;
        for (int i = 0; i < n; ++i) {
            v[i] = in.nextInt();
            sum += v[i];
        }
        long res = Long.MAX_VALUE, x = 0;
        for (int i = 0; i < n - 1; ++i) {
            x += v[i];
            long y = sum - x;
            res = Math.min(Math.abs(x - y), res);
        }
        System.out.println(res);
    }

}


Measured memory_bytes: 64036
N = int(input())
ROB = [list(map(int, input().split())) for _ in range(N)]
ROB = sorted(ROB, key=lambda x:x[0])
right = ROB[0][0] + ROB[0][1]
ans = 1
for i in range(N-1):
  if(right <= ROB[i+1][0] - ROB[i+1][1]):
    ans += 1
    right = ROB[i+1][0] + ROB[i+1][1]
  else:
    right = min(right, ROB[i+1][0] + ROB[i+1][1])
print(ans)

Measured memory_bytes: 29864
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c; cin >> a >> b >> c;
	if ((a * 100 + b * 10 + c) % 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

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

const int mod = 1000000000 + 7;
int main(){
  int n;
  cin >> n;

  string s;
  cin >> s;

  vector<int> p(26, 0);
  for (int i = 0; i < n; i++){
    p.at(s.at(i) - 'a')++;
  }

  long long ans = 1;
  for (int i = 0; i < 26; i++){
    ans *= p.at(i) + 1;
    ans %= mod;
  }
  if (ans){
    ans--;
  }else{
    ans = mod - 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    map<string,int> mp;
    int mx = 0;
    REP(i,n) {
        string s; cin >> s;
        mp[s]++;
        mx = max(mx,mp[s]);
    }
    
    vector<string> v;
    for(auto p:mp) {
        if (p.second == mx) v.push_back(p.first);
    }
    sort(ALL(v));

    for(auto s:v) cout << s << '\n';

    return 0;
}

Measured memory_bytes: 27632
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	long long x;
	cin >> x;
	cout << (x/11) * 2 + (x % 11 > 0 ? (x % 11 > 6 ? 2 : 1) : 0) << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
template<typename T>
T gcd(T a, T b)
{
	return b ? gcd(b, a%b) : a;
}
 
int main()
{
	long long int n, k;
	cin >> n >> k;
	cout << min(n % k, k - (n % k)) << endl;
	return 0;
}

Measured memory_bytes: 3636
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

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

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(0, 1); \
                 auto rnd = bind(__dis, __gen);

const int INF = 1E18;
const int mod = 1E9 + 7;

bool app[256];

int32_t main() {
    fastIO();
    
    int sz, fl = 0;
    string s;
    cin >> s, sz = s.size();
    
    if (s[0] != '1') fl = 1;
    for (int i = 1; i < sz and !fl; ++i) {
        if (s[i] != '0') fl = 1;
    }
    
    if (!fl) cout << 10 << "\n";
    else {
        int sum = 0;
        for (auto ch : s) sum += ch^'0';
        cout << sum << "\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
//============================================================================
// Name        : hoba.cpp :)
// Author      : (O_O Diab) (Why_not) (el 3AQ)
// Version     :
// Copyright   : please, Don't touch me :(
// Description : problem in C++
// MAIN IDEA   : combinatorics NCR
//============================================================================
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define rw freopen("graphs_as_a_service.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define rep(i,a) lp(i,0,a-1)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace __gnu_pbds;
using namespace std;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int N = 1e5 + 5, mod = (int) 1e9 + 7, INF = 0x3f3f3f3f;
vi v;
int mx;
inline int can(int h) {
	int cnt = 0;
	for (auto u : v) {
		h -= u;
		cnt++;
		if (h <= 0)
			break;
	}
	h = max(h, 0);
	cnt += ((h + (mx - 1)) / mx);
	return cnt;
}
int main() {
#ifdef ONLINE_JUDGE
	FAST
#endif
	int n, h;
	cin >> n >> h;
	lp(i,1,n)
	{
		int x, y;
		cin >> x >> y;
		v.pb(y);
		mx = max(mx, x);
	}
	sort(allr(v));
	while (!v.empty() && v.back() <= mx)
		v.pop_back();
	f(can(h));
	return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define int long long
#define P pair<long,long>
#define all(a) a.begin(),a.end()
using namespace std;

signed main(){
    int h,w; cin>>h>>w;
    vector<string> grid(h);
    rep(i,h) cin>>grid.at(i);
    int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
    rep(i,h){
        rep(j,w){
            if(grid.at(i).at(j)=='#'){
                bool able=false;
                rep(k,4){
                    int nx=i+dx[k],ny=j+dy[k];
                    if(nx>=0 and nx<h and ny>=0 and ny<w){
                        if(grid.at(nx).at(ny)=='#'){
                            able=true;
                            break;
                        }
                    }
                }
                if(!able){
                    cout<<"No"<<endl; return 0;
                }
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    cin>>a>>b>>c;
    int d=0;
    for(int x=a; x<=b; x++){
        if(c%x==0){
            d++;
        }
    }
    cout<<d<<endl;
}



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

void Solve() {
    int x;
    cin >> x;
    cout << 1 - x << endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
   // cin >> t;
    while(t--) {
        Solve();
    }
    return 0;
}


Measured memory_bytes: 3636
# include <iostream>
# include <string>
using namespace std;
 
int main()
{
	string s;
	cin >> s;
	string ans = "No";
	for(int i = 0;i < int(s.size());i++)
		if(s[i] == '7')
			ans = "Yes";
	cout << ans << endl;
	return 0;
 } 

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

typedef long long ll;
const int MOD = 1000000007;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  if(n % 2 == 0){
    for(int i = n-1; i >= 0; i = i - 2){
      cout << a[i] << " ";
    }
    for(int i = 0; i < n-1; i = i + 2){
      cout << a[i] << " ";
    }
  }else{
    for(int i = n-1; i >=0; i = i - 2){
      cout << a[i] << " ";
    }
    for(int i = 1; i < n-1; i = i + 2){
      cout << a[i] << " ";
    }
  }
  cout << endl;
}


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

#define cn count
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;
using ll = long long;
const ll inf = 1e9+7; 
const double PI =  3.141592653589793;

int main(){
	IO;
	ll n,a,maxi=0,maxi2=0,maxid=0;
	cin>>n;
	forn(i,n){
		cin>>a;
		if(a>maxi){ maxi=a; maxid=i;}
		else if(a>maxi2) maxi2= a;
	}
	forn(i,n){
		(i==maxid)?cout<<maxi2:cout<<maxi;
		cout<<"\n";
	}
	return 0;
}

// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
struct node
{
    int d;
    int num;
} N[200000];
bool dmp(node a,node b)
{
    return a.d>b.d;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d",&N[i].d);
        N[i].num=i+1;
    }
    sort(N,N+n,dmp);
    for(int i=0; i<n; i++)
    {
        if(i+1!=N[0].num)printf("%d\n",N[0].d);
        else printf("%d\n",N[1].d);
    }
    return 0;
}



Measured memory_bytes: 3200
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
   int C = A +B;

   String msg = "Impossible";

   if(A % 3 == 0 || B % 3 == 0 || C % 3 == 0) msg = "Possible";

    System.out.println(msg);

}
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll left, right;
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    left = A + B;
    right = C + D;
    if(left < right) cout << "Right";
    else if(left > right) cout << "Left";
    else cout << "Balanced";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */


#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());



struct DisjointSet {
    vector<int> par;
    vector<int> rak; // number of the vertices

    void init(int n) {
      par.resize(n);
      rak.resize(n);
      for(int i=0; i<n; i++) {
        par[i] = i;
        rak[i] = 1;
      }
    }

    int find(int x) {
      if (par[x] == x) {
        return x;
      } else {
        return par[x] = find(par[x]);
      }
    }

    void unite(int x, int y) {
      x = find(x);
      y = find(y);
      if (x==y) return;
      if (rak[x] < rak[y]) {
        rak[y] += rak[x];
        par[x] = y;
      } else {
        rak[x] += rak[y];
        par[y] = x;
      }
    }

    bool same(int x, int y) {
      return find(x) == find(y);
    }
};


class CConnectCities {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n, m; cin >> n >> m;
      DisjointSet dsu;
      dsu.init(n);
      int ret = n-1;
      rep(i, m) {
        int a, b; cin >> a >> b;
        a--; b--;
        if (!dsu.same(a, b)) {
          ret--;
          dsu.unite(a, b);
        }
      }
      cout << ret << endl;
    }
};

signed main() {
  CConnectCities solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 4032
import scala.io.StdIn

object Main extends App {

  val lst = StdIn.readLine().trim.split(' ').toList
  val enzan = Map("+" -> 1, "-" -> 1, "*" -> 2)
  
  val r = lst.foldLeft(List.empty[Int]){ (stack, e) =>
    val o = enzan.getOrElse(e, 0)
    if(o != 0){
      val ope1 = stack.head
      val ope2 = stack.tail.head
      e match {
        case "+" => (ope1 + ope2) :: stack.drop(2)
        case "-" => (ope2 - ope1) :: stack.drop(2)
        case "*" => (ope1 * ope2) :: stack.drop(2)
      }
      
    } else {
      e.toInt :: stack
    }
  }
  
  println(r.head)

}



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

int main() {
	int num;
	string input;
	int check = 0;
	
	cin >> num;
	
	for (int j = 0; j < num; j++) {
		cin >> input;
		if (input == "Y") {
			cout << "Four" << endl;
			check = 1;
			break;
		}
		
	}
	if (check == 0) {
		cout << "Three" << endl;
	}
}

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

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

	int cnt = 0;
	rep(i, N.size()) {
		cnt += N[i] - '0';
	}

	if(cnt % 9 == 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

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

int main(){
  int N ;
  cin >> N ; 
  vector<string> S(N) ; 
  int cnt = 0 ; 
  int cnt_M = 0 , cnt_A = 0 , cnt_C = 0 , cnt_R = 0 , cnt_H = 0 ;
  for(int i = 0 ; i < N ; i++){
    cin >> S.at(i) ; 
    if(S.at(i).at(0) == 'M'){
      cnt_M++ ; 
    }
    else if(S.at(i).at(0) == 'A'){
      cnt_A++ ; 
    }
    else if(S.at(i).at(0) == 'R'){
      cnt_R++ ; 
    }
    else if(S.at(i).at(0) == 'C'){
      cnt_C++ ; 
    }
    else if(S.at(i).at(0) == 'H'){
      cnt_H++ ;  
    }
  }
  int P[10]={0,0,0,0,0,0,1,1,1,2};
  int Q[10]={1,1,1,2,2,3,2,2,3,3};
  int R[10]={2,3,4,3,4,4,3,4,4,4};  
  
  vector<long long> T(5) ;
  T.at(0) = cnt_M ; 
  T.at(1) = cnt_A ; 
  T.at(2) = cnt_R ; 
  T.at(3) = cnt_C ; 
  T.at(4) = cnt_H ;  
  
  long long ans = 0 ; 
  for(int i = 0 ; i < 10 ; i++){
    ans += T.at(P[i])*T.at(Q[i])*T.at(R[i]) ;
  }
  cout << ans << endl;
}

Measured memory_bytes: 6320
#include <stdio.h>
#include <math.h>

int main(void) {
	
	for(;;){
		int i;
		int sum = 0;
		double avg,sd;
		int n;
		int s[1000] = {0};
	
		scanf("%d",&n);
		if(n == 0)break;
		else {}
		
		for(i=0;i<n;i++){
			scanf("%d",&s[i]);
			sum = sum +s[i];
		}
	
		avg = 1.0000 * sum/n;
	
		//printf("%d %lf\n",sum,avg);
	
		sd = 0;
		for(i = 0;i<n;i++){
			sd = sd+(s[i]-avg)*(s[i]-avg);
		}
    	sd = sqrt(sd / n);
	
		printf("%lf\n",sd);
	}	
	return 0;
}

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

if __name__ == "__main__":
    N, M = list(map(int, input().split()))
    # 各マスにおいて、隣接するマス（自分含む）が奇数のマスが裏になる
    if N == 1 and M == 1:
        print("1")
    elif N <= 2 and M <= 2:
        print("0")
    elif N == 1 and M >= 3:
        print(M-2)
    elif N >= 3 and M == 1:
        print(N-2)
    else:
        print((N-2)*(M-2))


Measured memory_bytes: 2940
#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define FOR(i, a, b, s)     for(ll i = (a); ((s)>0 ? i<(b) : i>(b)); i += (s))
#define FOR1(b)             FOR(i, 0, b, 1)
#define FOR2(i, b)          FOR(i, 0, b, 1)
#define FOR3(i, a, b)       FOR(i, a, b, (a) <= (b) ? 1 :-1)
#define FOR4(i, a, b, s)    FOR(i, a, b, s)
#define GET5(a, b, c, d, e, ...) e
#define FORC(...)           GET5(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)
#define loop(...)           FORC(__VA_ARGS__)(__VA_ARGS__)
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename... T> 
inline void inp(T&... args) {
    ((cin>>args), ...);
}
// scan vector
template <typename T> 
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second; 
    return in;
}

// Solve --------------------------------------------------------------------

void solve(int &T)
{
    ll n;
    cin>>n;
    n = (1000 - n % 1000) % 1000;
    cout<<n;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    for(int i=1; i<=t; i++)
    {
        cerr<<"Case #"<<i<<"\n";
        solve(i);
    }
    return 0;
}

Measured memory_bytes: 3664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AGC013SortedArrays
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] A = new int[N];
            string[] vals = Console.ReadLine().Split(' ');
            for(int i=0; i < N; i++)
            {
                A[i] = int.Parse(vals[i]);
            }
            int num = 1;
            int m = 0;
            if(N == 1)
            {
                Console.WriteLine(1);
                return;
            }
            for(int i=1; i < N; i++)
            {
                if(m == 0)
                {
                    if(A[i] > A[i-1])
                    {
                        m = 1;
                    }
                    else if(A[i] < A[i-1])
                    {
                        m = -1;
                    }
                }
                else if(m == 1)
                {
                    if(A[i] < A[i-1])
                    {
                        num++;
                        m = 0;
                    }
                }
                else if(m == -1)
                {
                    if(A[i] > A[i-1])
                    {
                        num++;
                        m = 0;
                    }
                }
            }
            Console.WriteLine(num);
        }
    }
}


Measured memory_bytes: 18528
a,b,c = map(int,input().split())
n = int(input())
for i in range(3 ** n):
    l = [a,b,c]
    for j in range(n):
        l[i % 3] *= 2
        i //= 3
    if l[0] < l[1] and l[1] < l[2]:
        print('Yes')
        exit(0)
print('No')

Measured memory_bytes: 64888
#include <bits/stdc++.h>
 
using namespace std;
 
int C, D, W, X;
int E[16][31], F[16][31];
int memo[31][51][6];
const int dx[] = {-1, 1};
 
int solve(int d, int w, int x)
{
    if (d == D) return 0;
 
    int &res = memo[d][w][x];
    if (res != -1) return res;
   
    res = solve(d+1, w, x);
 
    for (int i = 0; i < C; i++) {
        if (w + F[i][d] <= W && E[i][d] != 0) {
            res = max(res, solve(d+1, w + F[i][d], x) + E[i][d]);      
        }    
        if (x + 1 > X) continue;
        for (int j = 0; j < 2; j++) {
            int nx = i, cost = 0, f = 0;
            while (1) {
                if (nx < 0 || nx >= C || E[nx][d] == 0) break;
                f += F[nx][d];
                cost += E[nx][d];
                if (w + f <= W) {
                    res = max(res, solve(d+1, w + f, x+1) + cost);
                }
                nx += dx[j];
            }
        }   
    }
    return res;
}
 
int main()
{
    while (cin >> C >> D >> W >> X, C) {
        for (int i = 0; i < C; i++) {
            for (int j = 0; j < D; j++) {
                cin >> E[i][j];
            }
        }
 
        for (int i = 0; i < C; i++) {
            for (int j = 0; j < D; j++) {
                cin >> F[i][j];
            }
        }
 
        memset(memo, -1, sizeof(memo));
     
        int res = solve(0, 0, 0);
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int n;
int main(){
 	cin>>n;
 	int ans = INF;
 	for(int i=1;i<n;i++){
 		int a = i,b = n-i,c = 0;
 		while(a){
 			c += a%10;
 			a/=10;
 		}
 		while(b){
 			c += b%10;
 			b/=10;
 		}
 		ans = min(ans,c);
 	}
 	cout<<ans<<endl;
 }

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int m;
  cin >>m;
  while(m--){
    long long int money;
    vector<long long int> ans;
    int year,n;
    cin >>money>>year;
    cin >>n;
    while(n--){
      int f,x;
      double a;
      long long int b = money;
      cin >>f>>a>>x;
      if(f == 0){
	long long int c = 0;
	for(int i=0; i<year; i++){
	  c+=b*a;
	  b-=x;
	}
	ans.push_back(b+c);
      }
      else{
	for(int i=0; i<year; i++) b+=b*a-x;
	ans.push_back(b);
      }
    }
    sort(ans.begin(),ans.end());
    cout <<ans[ans.size()-1]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1260
use std::str::FromStr;
use std::collections::{HashMap,HashSet,VecDeque,BinaryHeap};
use std::cmp::{max,min,Ordering};
use std::io::Read;

fn main() {

    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let N = buf_it.next().unwrap().parse::<usize>().unwrap();
    let mut A = (0..N).map(|_| buf_it.next().unwrap().chars().collect::<Vec<_>>()).collect::<Vec<_>>();
    let mut B = A.clone();

    BubbleSort(&mut A, N);
    SelectionSort(&mut B, N);

    println!("{}",A.iter().map(|a| format!("{}{}",a[0],a[1])).collect::<Vec<_>>().join(" "));
    println!("Stable");
    println!("{}",B.iter().map(|a| format!("{}{}",a[0],a[1])).collect::<Vec<_>>().join(" "));
    println!("{}",if A==B {"Stable"} else {"Not stable"});

}

fn BubbleSort(A:&mut Vec<Vec<char>>,N:usize){
    let mut flag = true;
    while flag{
        flag = false;
        for j in 1..N{
            let j = N-j;
            if A[j][1] < A[j-1][1]{
                let tmp = A[j].clone();
                A[j] = A[j-1].clone();
                A[j-1] = tmp;
                flag = true;
            }
        }
    }
}

fn SelectionSort(A:&mut Vec<Vec<char>>,N:usize){
    for i in 0..N{
        let mut minj = i;
        for j in i..N{
            if A[j][1] < A[minj][1]{
                minj = j;
            }
        }
        if i != minj {
            let tmp = A[i].clone();
            A[i] = A[minj].clone();
            A[minj] = tmp;
        }
    }
}


Measured memory_bytes: 5040
#include<stdio.h>
char s[1010][1010];
int r;
int f(int j){
  int o=s[r][j]-'*'?0:1,ans=o,n;
  while(s[r+1][j]=='.'){
    r++;
    if(s[r][j+1]=='+'||s[r][j+1]=='*')n=f(j+1);
    else      n=s[r][j+1]-'0';//printf("%d %d ",r,n);
    if(o)ans*=n;
    else ans+=n;//printf("%d\n",ans);
  }
  return ans;
}
int main(){
  int n,i;
  while(scanf("%d",&n),n){
    for(i=r=0;i<1000*1000;i++)s[i/1000][i%1000]=0;
    for(i=0;i<n;i++)scanf("%s",s[i]);
    printf("%d\n",n-1?f(0):s[0][0]-'0');
  }
  return 0;
}

Measured memory_bytes: 2676
import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
N = int(input())
Nlist = make_divisors(N)
L = len(Nlist)
if L%2==0:
    print(Nlist[int(L/2)]+Nlist[int(L/2)-1]-2)
else:
    print(int(math.sqrt(N)*2-2))

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

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

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

int main(){
    int k; cin >> k;
    for(int i=0;i<k;i++){
        cout << "ACL";
    }
    cout << endl;
}

Measured memory_bytes: 3636
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll N, A, B, C, D;
map <ll, ll> MP;

ll Solve(ll num){
  if (num <= 0) return 0;
  if (num == 1) return MP[num] = D;
  if (MP[num] > 0) return MP[num];

  ll ans = INF;
  for (ll i = -3; i < 5; i++){
    ll now = num - i;
    if (now < 0) continue;
    if (now % 2 == 0 && now / 2 < num){
      ans = min(ans, Solve(now / 2) + A + abs(i) * D);
      ll Lim = (INF - Solve(now / 2)) / D;
      ll deg = abs(now / 2 - num);
      if (deg <= Lim){
        ans = min(ans, Solve(now / 2) + deg * D);
      }
    }
    if (now % 3 == 0 && now / 3 < num){
      ans = min(ans, Solve(now / 3) + B + abs(i) * D);
      ll Lim = (INF - Solve(now / 3)) / D;
      ll deg = abs(now / 3 - num);
      if (deg <= Lim){
        ans = min(ans, Solve(now / 3) + deg * D);
      }
    }
    if (now % 5 == 0 && now / 5 < num){
      ans = min(ans, Solve(now / 5) + C + abs(i) * D);
      ll Lim = (INF - Solve(now / 5)) / D;
      ll deg = abs(now / 5 - num);
      if (deg <= Lim){
        ans = min(ans, Solve(now / 5) + deg * D);
      }
    }
    if (MP[now] > 0) ans = min(ans, MP[now] + abs(i) * D);
  }
  return MP[num] = ans;
}

int Ans(){
  MP = {};
  cin >> N >> A >> B >> C >> D;
  MP[1] = D;
  cout << Solve(N) << endl;
  return 0;
}

int main(){
  int T; cin >> T;
  for (int i = 0; i < T; i++) Ans();
  return 0;
}


Measured memory_bytes: 8644
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,q = map(int,ipt().split())
    way = [[] for i in range(n+1)]
    for i in range(n-1):
        a,b = map(int,ipt().split())
        way[a].append(b)
        way[b].append(a)
    pl = [0]*(n+1)
    for i in range(q):
        p,x = map(int,ipt().split())
        pl[p] += x
    ans = [-1]*(n+1)
    ans[0] = 0
    ans[1] = pl[1]
    q = [(1,0)]

    while q:
        qi,qp = q.pop()
        qa = ans[qi]
        for j in way[qi]:
            if j == qp:
                continue
            ans[j] = qa+pl[j]
            q.append((j,qi))

    print(" ".join(map(str,ans[1::])))

    return None

if __name__ == '__main__':
    main()


Measured memory_bytes: 142364
// https://atcoder.jp/contests/abc051/tasks/abc051_d

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N, M;
  cin >> N >> M;

  struct Edge {
    ll from, to, cost;
  };

  V<Edge> edges(M);

  VVL ds(N, VL(N, INF));
  rep(i, N) ds[i][i] = 0;

  rep(i, M) {
    ll a, b, c;
    cin >> a >> b >> c;
    a--, b--;

    edges[i] = {a, b, c};

    chmin(ds[a][b], c);
    chmin(ds[b][a], c);
  }

  rep(k, N) rep(i, N) rep(j, N) {
    ds[i][j] = min(ds[i][j], ds[i][k] + ds[k][j]);
  }

  ll necessary_path_ct = 0;

  rep(i, M) {
    bool necessary = false;

    rep(s, N) rep(t, N) {
      Edge e = edges[i];
      if (ds[s][e.from] + e.cost + ds[e.to][t] == ds[s][t]) {
        necessary = true;
      }
    }

    if (necessary) necessary_path_ct++;
  }

  ll res = M - necessary_path_ct;
  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 384
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

fn main() {
    input! {
        n: usize,
        a: [i64; n]
    }

    let max = a.iter().fold(0, |acc, &x| std::cmp::max(x, acc));
    let near_half = a.iter().fold(0, |acc, &x| if (x - max/2).abs() < (acc - max/2).abs() {x} else {acc});

    println!("{} {}", max, near_half);
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;
#define REP(i, n) for (int i = 0; (i) < (n); ++i)

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int sum = 0;
    if (a > k)
    {
        sum = k;
    }
    else
    {
        sum = a;
    }
    k -= a + b;
    if (k > 0)
        sum -= k;
    cout << sum;

    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  if(n == 1)
    cout << "Hello World" << endl;
  else{
    int a,b;
    cin >> a >> b;
    
    cout << a+b << endl;
  }
  
  return 0;
}


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

int main(){
  long long l,r;
  cin>>l>>r;
  if(r-l>=2019){
    cout<<0<<endl;
    return 0;
  }else{
    long long amari=2018;
    for(long long i=l;i<r;i++){
      for(long long j=i+1;j<=r;j++){
        long long tmp=(i*j)%2019;
        if(tmp<0)tmp+=2019;
        amari=min(amari,tmp);
      }
    }
    cout<<amari<<endl;
    return 0;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int a, b;
    char op;
    do
    {
        scanf("%d %c %d", &a, &op, &b);
        if (op != 63)
        {
            if ((int)op == 43)
            {
                printf("%d\n", a + b);
            }
            else if ((int)op == 45)
            {
                printf("%d\n", a - b);
            }
            else if ((int)op == 42)
            {
                printf("%d\n", a * b);
            }
            else if ((int)op == 47)
            {
                printf("%d\n", a / b);
            }
        }
    }
    while (op != 63);
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s;
	int ans=0;
bool can=false;
int half=s.size()/2;
	cin >>s;
	for(int i=s.size()-2;!can;i-=2){
		can=true;
		ans=i;
		half=i/2;
		rep(j,half){
			can&=(s[j]==s[half+j]);
	//		clog<<s[j]<<" "<<s[half+j]<<endl;
		}//clog<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3596
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math


N = int(input())

ans = 1
cnt_ans = 0
for i in range(1,N+1):
    tmp = i
    cnt = 0
    while tmp % 2 == 0:
        tmp //= 2
        cnt += 1
    if cnt > cnt_ans:
        ans = i
        cnt_ans = cnt

print(ans)


Measured memory_bytes: 5456
package main

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

func Compare(a []int, b []int) int {
	la, lb := len(a), len(b)
	for i := 0; i < lb; i++ {
		if la <= i {
			return 1
		}
		switch {
		case a[i] < b[i]:
			return 1
		case a[i] > b[i]:
			return 0
		}
	}
	return 0
}

func NextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}

func ReadArray(sc *bufio.Scanner) []int {
	n, _ := NextInt(sc)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i], _ = NextInt(sc)
	}
	return a
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	a := ReadArray(sc)
	b := ReadArray(sc)

	fmt.Println(Compare(a, b))
}



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

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    string S; cin >> S;
    int idx = 0;
    int ans = 0;
    while(S[idx++] != '*');
    while(idx < S.length()){
        if(S[idx] == '(') ans--;
        else ans++;
        idx++;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    int ans = 0;
    ans += min(k,a);
    if(k > a+b) ans -= (k-a-b);
    cout << ans << endl;

    return 0;
}

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

using ll=long long;
const ll MOD=1000000007;

int main() {
  int x=700;
  string s;
  cin >> s;
  for(int i=0;i<3;i++){
    if(s[i]=='o')
      x +=100;
  }
  cout << x << endl;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
const int N=100005;
const int mod=1000000007;
int n,i,j,l,r;
int f[N],p[N];
long long s[N],a,b;
int main()
{
	scanf("%d",&n);
	scanf("%lld%lld",&a,&b);
	for (i=1;i<=n;i++)
		scanf("%lld",&s[i]);
	if (a>b)
		a^=b^=a^=b;
	for (i=3;i<=n;i++)
		if (s[i]-s[i-2]<a)
		{
			printf("%d\n",0);
			return 0;
		}
	f[0]=1;
	p[0]=1;
	for (i=1;i<=n;i++)
	{
		while (r<i-1&&s[i]-s[r+1]>=b)
			r++;
		if (l<=r)
			f[i]=(p[r]+mod-(l?p[l-1]:0))%mod;
		p[i]=(p[i-1]+f[i])%mod;
		if (i>1&&s[i]-s[i-1]<a)
			l=i-1;
	}
	for (i=n;i>=1;i--)
		if (i<n&&s[i+1]-s[i]<a)
			break;
	printf("%d\n",(p[n]+mod-(i?p[i-1]:0))%mod);
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i = 0; i < (n); ++i )
#define rep_rev(n,i) for(ll i = n; i >= 0; --i )
using namespace std;
using P = pair<int, int>;
const long long INF = 1LL << 60;

int main(){
  int N; cin >> N;
  vector<int> a(N);
  vector<int> c(100010,0);
  rep(i,N){
    cin >> a[i];
    if(a[i]-1 >= 0) c[a[i]-1]++;
    c[a[i]]++;
    c[a[i]+1]++;
  }
  int ans = 0;
  rep(i,c.size()){
    if(ans < c[i]) ans = c[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5+50;
int k,n;
int a[maxn];
int main()
{
    cin>>k>>n;

    if(k%2==0)
    {
        a[1]=k/2;
        for(int i=2; i<=n; i++)
        {
            a[i]=k;
        }
    }
    else
    {
        for(int i=1; i<=n; i++)
        {
            a[i]=(k+1)/2;
        }
        int pre=n;
        for(int j=1; j<=n/2; j++)
        {
            if(a[pre]==1)
                pre--;
            else
            {
                a[pre]--;
                for(int q=pre+1; q<=n; q++)
                {
                    a[q]=k;
                }
                pre=n;
            }
        }
        for(int i=1; i<=pre; i++)
        {
            if(i!=1)
                printf(" ");
            printf("%d",a[i]);
        }
        printf("\n");
        return 0;
    }
    for(int i=1; i<=n; i++)
    {
        if(i!=1)
            printf(" ");
        printf("%d",a[i]);
    }
    printf("\n");
    //cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 3456
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());//long.Parseはstringをlongに変換。
    long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    Array.Sort(nums);
    long memo = 0;

    for(int i = 1; i < n; i++)
    {
      if(nums[i] == nums[i-1]) memo++;
    }
    if(memo % 2 == 1) memo++;
    
		Console.WriteLine(n-memo);//WriteLineをWriteとすると、改行なしで出力。
	}
}

Measured memory_bytes: 19424