akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;
const int mod = 1000000007;

struct UnionFind
{
    vector<int> par;
    vector<int> s;
    
    UnionFind(int N) : par(N), s(N){
        rep(i, N) par[i] = i;
        rep(i, N) s[i] = 1;
    }
    
    int root(int x){
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    
    void unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        par[rx] = ry;
        s[rx] += s[ry];
        s[ry] = s[rx];
    }
    
    bool same(int x, int y){
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    
    int size(int x){
        int rx = root(x);
        return s[rx];
    }
};

int main(){
    int N, M; cin >> N >> M;
    UnionFind tree(N);
    rep(i, M){
        int a, b; cin >> a >> b;
        a--;b--;
        tree.unite(a, b);
    }
    int ans = 0;
    rep(i, N){
        // cout << tree.size(i) << endl;
        ans = max(ans, tree.size(i));
    }
    // cout << tree.same(0, 2) << endl;
    cout << ans << endl;
}

Measured memory_bytes: 10928
import copy
 
N=int(input())
A=[]
for _ in range(N):
    A.append(int(input()))
 
A_max=max(A)
#ind_max=A.index(A_max)
B=copy.copy(A)
B.remove(A_max)
B_max=max(B)
 
for i in range(N):
    if A[i]!=A_max:
        print(A_max)
    else:
        print(B_max)

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 1010

signed main()
{
    int N;
    double T, A;

    cin >> N >> T >> A;
    double min_sub = DINF;
    int min_ind = -1;
    REP(i, N) {
        double h;
        cin >> h;
        double cand = abs(A - (T - h * 0.006));
        if(cand < min_sub) {
            min_sub = cand;
            min_ind = i + 1;
        }
    }
    printf("%lld\n", min_ind);

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 500050
using namespace std;

int n;
char s[N];
int a[N];

bool check(int x){
	int len = n;
	for(int i = 1; i <= n; i++) a[i] = (s[i] - '0') * 9;
	a[1] += 9 * x;
	for(int i = 1; i <= len; i++){
		a[i + 1] += a[i] / 10;
		a[i] %= 10;
		if(a[i + 1] && i == len) len++;
	}
	int sum = 0;
	for(int i = 1; i <= len; i++) sum += a[i], a[i] = 0;
	return sum <= 9 * x;
}

int main(){
	scanf("%s", s + 1);
	n = strlen(s + 1);
	reverse(s + 1, s + n + 1);
	int l = 1, r = n;
	while(l < r){
		int mid = l + r >> 1;
		if(check(mid)) r = mid;
		else l = mid + 1;
	}
	printf("%d\n", l);
}


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

int main()
{
	int n, m;
	cin >> n >> m;
	map<int, string>m1;
	map<int, int>m2;
	int pen = 0, corr = 0;
	for (int i = 0; i < m; i++)
	{
		int a;
		string s;
			cin >> a >> s;
		if (s == "WA" && m1.find(a) == m1.end())
			m2[a]++;
		else if(s=="AC" && m1.find(a) == m1.end())
		{
			m1[a] = s;
			corr++;
			pen += m2[a];
		}
	}


	cout << m1.size() << " " << pen << endl;
}

Measured memory_bytes: 15872
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor.hpp>
#include <boost/algorithm/string.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;

using ll = long long;
namespace bst = boost;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<int> K,N;
  invec<ll> A(N);
  
  ll sum = 0;
  REP(i, N-1)
    sum += A[i+1] - A[i];
  sum += A[0] + K - A[N-1];
  
  ll r = sum;
  REP(i, N-1) {
    r = min(r, sum - (A[i+1] - A[i]));
  }
  r = min(r, sum - (A[0] + K - A[N-1]));


  return r;
}

template<typename T> void plot(const T& func) { cout << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }
template<> void plot<double()>(double(&func)()) { cout << setprecision(9) << func() << endl; }

int main() {
  plot(solve);

  return 0;
}



Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	int H,W;
	while(1){
		cin >> H >> W;
		if(H==0&W==0) break;
		REP(i,H){
			REP(j,W){
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
}

Measured memory_bytes: 1152
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
#include <array>
// ===============================================================
//using系
#pragma region header
using namespace std;
using lint = long long;
using ld = long double;
using ulint = unsigned long long;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr lint mod = 1000000007;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#define INF (lint)10000000000000000;
#define mod (int)1000000007
#pragma region header
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
#pragma endregion
#pragma endregion



int main(void) {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n; cin >> n;
	vector<pair<int, int>> d(n);
	for (int i = 0; i < n; i++) cin >> d[i].first >> d[i].second;
	for (int i = 0; i < n - 2; i++) {
		if (d[i].first == d[i].second && d[i + 1].first == d[i + 1].second && d[i + 2].first == d[i + 2].second) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3648
# -*- coding: utf-8 -*-
import sys
from operator import itemgetter
# gcd
from fractions import gcd
# 切り上げ，切り捨て
from math import ceil, floor
# リストの真のコピー（変更が伝播しない）
from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l)  # カウンタークラスが作られる。S=Counter({'b': 5, 'c': 4, 'a': 3})
# print(S.most_common(2))  # [('b', 5), ('c', 4)]
# print(S.keys())  # dict_keys(['a', 'b', 'c'])
# print(S.values())  # dict_values([3, 5, 4])
# print(S.items())  # dict_items([('a', 3), ('b', 5), ('c', 4)])
from collections import Counter
import math
from functools import reduce
sys.setrecursionlimit(200000)
# input関係の定義
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
# template

# local only
if not __debug__:
    fin = open('in_3.txt', 'r')
    sys.stdin = fin
# local only



def iterate_tokens():
    for line in sys.stdin:
        for word in line.split():
            yield word


if __name__ == '__main__':
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int

    if (A - B) % 2 == 0:
        print('Alice')
    else:
        print('Borys')


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

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b)

res = [0] * N
l = [0] * (N+1)
r = [0] * (N+1)

for i in range(N):
    l[i+1] = gcd(l[i],A[i])

for i in range(N,0,-1):
    r[i-1] = gcd(r[i],A[i-1])

for i in range(N):
    res[i] = gcd(l[i],r[i+1])

print(max(res))

Measured memory_bytes: 14436
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  ll a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  ll ans  = a * x + b * y;
  ll comb = 0;

  comb = 2 * x * c;
  if (x < y) {
    comb += (y - x) * b;
  }
  ans = min(ans, comb);

  comb = 0;
  comb = 2 * y * c;
  if (y < x) {
    comb += (x - y) * a;
  }
  ans = min(ans, comb);

  P(min(ans, max(x, y) * 2 * c));
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=2e5+5;
int a[maxn];
int ans[maxn];
int d[maxn];
vector<int>E[maxn];
int n;
int len;
void dfs(int son,int fa)
{
    int blen,be=0;
    int p;
    for(auto &v:E[son])
    {
        if(v==fa)
            continue;
        blen=len;
        if(d[len]<a[v])
        {
            d[++len]=a[v];
        }
        else
        {
            p=lower_bound(d+1,d+1+len,a[v])-d;
            be=d[p];
            d[p]=a[v];
        }
        ans[v]=len;
        dfs(v,son);
        if(be)d[p]=be;
        len=blen;
    }

}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<n;i++)
    {
        int u,v;
        cin>>u>>v;
        E[u].push_back(v);
        E[v].push_back(u);
    }
    d[1]=a[1];
    len=1;
    dfs(1,0);
    ans[1]=1;
    for(int i=1;i<=n;i++)
    {
        cout<<ans[i]<<'\n';
    }
}


Measured memory_bytes: 30428
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define peintD(a) cout << setprecision(10) << ans << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n,m;

signed main(){
    cin >> n;
    print(n*n*n)
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}



Measured memory_bytes: 3080
while 1:
    val = input().split()
    h = int(val[0])
    w = int(val[1])
    if h == 0 and w == 0:
        break
    for cnt in range(h):
        if cnt == 0 or cnt == h - 1:
            for i in range(w):
                print('#', end='')
            print()
        else:
            print('#', end='')
            for i in range(w - 2):
                print('.', end='')
            print('#', end='')
            print()
    print()


Measured memory_bytes: 7008
#include<bits/stdc++.h>
using namespace std; 
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=2e5+10,M2=1e6+10,mod=1e9+7,mod2=1e9+9,inf=1e18+30;
int mn[M],cnt[M];
string x[M];
int32_t main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x[i];
	}
	for(int i=0;i<26;i++)mn[i]=inf;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<26;j++)cnt[j]=0;
		for(int j=0;j<x[i].size();j++)cnt[x[i][j]-'a']++;
		for(int j=0;j<26;j++)mn[j]=min(mn[j],cnt[j]);
	}
	for(int i=0;i<26;i++)for(int j=0;j<mn[i];j++)cout<<char(i+'a');
}	

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

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

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

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

  ll ans = 1000;
  int i = 0, s = 0;
  while (i < n - 1) {
    while (i + 1 < n && a[i] >= a[i + 1]) ++i;
    s = a[i];
    while (i + 1 < n && a[i] <= a[i + 1]) ++i;

    ll x = ans / s;
    ans += (ll)(a[i] - s) * x;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;



int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for (int i = 0; i < n - 1; i++){
        string a = "", b = "";
        vector<bool> d(26, false);
        for (int j = 0; j <= i; j++) a += s[j];
        for (int j = i + 1; j <= n - 1; j++) b += s[j];
        
        for (int j = 0; j < a.size(); j++){
            for (int k = 0; k < b.size(); k++){
                int x = (int)a[j] - 97;
                if (a[j] == b[k] && !d[x]){
                    d[x] = true;
                }
            }
        }
        int count = 0;
        rep(j, 26) if (d[j]) count++;
        ans = max(count, ans);
    }
    
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	string str; cin >> str;
	stack<char> s;

	for (auto &e : str)
	{
		if (s.empty() && e == 'B')
			continue;
		else if (e == 'B')
			s.pop();
		else
			s.push(e);
	}

	string res;
	while (!s.empty())
	{
		res += s.top();
		s.pop();
	}
	reverse(res.begin(), res.end());

	std::cout << res << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1000000000

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
	
	ll n;
	cin>>n;
	VI a(n);
	REP(i,n)cin>>a[i];
	ll co=0,coo=0;
	ll sum=0,summ=0;
	REP(i,n){
		if(i%2==0){
			if(sum+a[i]>0)
				sum+=a[i];
			else{
				co+=abs(sum+a[i])+1;
				sum=1;
			}
		}
		else{
			if(sum+a[i]<0) sum+=a[i];
			else{
				co+=sum+a[i]+1;
				sum=-1;
			}
		}
	}
	REP(i,n){
		if(i%2==1){
			if(summ+a[i]>0)
				summ+=a[i];
			else{
				coo+=abs(summ+a[i])+1;
				summ	=1;
			}
		}
		else{
			if(summ+a[i]<0) summ+=a[i];
			else{
				coo+=summ+a[i]+1;
				summ=-1;
			}
		}
	}
	cout<<min(co,coo)<<endl;
	
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
const int mod = 998244353;

using namespace std;

int s, n;

void knapsackSubset()		//coeff x^s du polynome Pi(2+x^ai)
{	
	scanf("%d%d", &n, &s);
	int x;
	vector<long long> coeff(s+1, 0);
	cin >> x;
	coeff[0] = 2;
	if (x <= s)
	 coeff[x] = 1;
	for(int i = 1; i < n; i++)
	{
		scanf("%d", &x);
		vector<long long>oldCo = coeff; //ancient coordonnes, (ne pas oublier qu'on mulitplie par 2, on doit se rappeler des ancierts coo, quitte a diviser par 2 aussi)
		for (int j = 0; j <= s; j++)
		{
			coeff[j] = (2*coeff[j])%mod;
			if (j >= x)
				coeff[j] += oldCo[j-x];
			coeff[j] %= mod;
		}
	} 
	cout << coeff[s] << endl;	
}

int main()
{
	#ifdef ME
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	knapsackSubset();
	return 0;
}




Measured memory_bytes: 3712
#include <string.h>
#include <stdio.h>
 
void print(char str[1000], int a, int b){
    int i;
     
    for(i=a; i<=b; i++){
        printf("%c",str[i]);
    }
    printf("\n");
}
 
void reverse(char str[1000], int a, int b){
    int i;
    char copy[1000];
     
    strcpy(copy,str);
    for(i=0; i<=b-a; i++){
        str[a+i]=copy[b-i];
    }
}
 
void replace(char str[1000],int a, int b){
    int i;
    char p[1000];
     
    scanf("%s",p);
    for(i=0; i<=b-a; i++){
        str[a+i]=p[i];
    }
}
 
 
int main(void){
    char str[1000];
    char order[10];
    int n,i,a,b;
     
    scanf("%s",str);
    scanf("%d",&n);
     
    for(i=0; i<n; i++){
        scanf("%s %d %d",order,&a,&b);
         
        if(strcmp(order,"print") == 0){
            print(str,a,b);
        }
         
        else if(strcmp(order,"reverse") == 0){
            reverse(str,a,b);
        }
         
        else if(strcmp(order,"replace") == 0){
            replace(str,a,b);
        }
    }
    return 0;
}
 

Measured memory_bytes: 584
#include <stdio.h>
#define N 10000
#define Q 500

int main(){
  int n,q,i,j,count=0;
  int S[N],T[Q];

  scanf("%d",&n); 
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }

  for(i=0;i<q;i++){
    for(j=0;j<n;j++){
      if(T[i] == S[j]){
	count++;
	j = n;
      }
    }
  }
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2104
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int ct[4];

int main() {
	string str;
	cin >> str;
	for (int i = 0; i < str.size(); i++) {
		if (str[i] == 'K')ct[0]++;
		if (str[i] == 'U')ct[1]++;
		if (str[i] == 'P')ct[2]++;
		if (str[i] == 'C')ct[3]++;
	}
	int ans = 10000000;
	for (int i = 0; i < 4; i++) {
		ans = std::min(ans,ct[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1188
// A.

#include <iostream>
#include <sstream>

using namespace std;

int main(int argc, char *argv[])
{
	string a, b, c;
	cin >> a >> b >> c;
	string ans = string(1, toupper(a[0])) + string(1, toupper(b[0])) + string(1, toupper(c[0]));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int getsum(int num)
{
	int sum=0;
	while(num>0)
	{
		sum+=num%10;
		num/=10;
	}
	return sum;
}
int main()
{
	int n,minsum=0x3f3f3f3f;
	cin >> n;
	for(int i=1;i<=n/2;i++)
	{
		int sum=getsum(i)+getsum(n-i);
		if(sum<minsum) minsum=sum;
	}
	cout << minsum << endl;
	return 0;
}


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

typedef int keytype;

//quicksort(<#keytype *a#>, <#int first#>, <#int last#>)
//long long ;
void quicksort(keytype a[], int first, int last){
    int i, j;
    keytype x, t;
    
    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int gcd(int x, int y){
    if (y == 0) return x;
    else        return gcd(y, x % y);
}

int main() {
    long long int a,b,m,n,k,ans,x,y,z;
    scanf("%lld %lld %lld",&x,&y,&z);
    printf("%lld %lld %lld",z,x,y);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define sz(x) (int)(x.size())
using namespace std;

const int N = 2e5 + 5, inf = 1e18, mod = 1e9 + 7;


int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);  

    int n;
    cin >> n;
    int ans[n + 1] = {0};
    for(int i = 2; i <= n; i++){
        int u;
        cin >> u;
        ans[u]++;
    }
    for(int i = 1; i <= n; i++)
        cout << ans[i] << '\n';
}

Measured memory_bytes: 5184
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

int n, a, b;
vector<int> h;

bool calc(int m){
    int cnt = 0;
    rep(i, 0, n){
        int tmp = h[i] - m * b;
        if(tmp > 0){
            cnt += (tmp + a - b - 1) / (a - b);
        }
    }
    return cnt <= m;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> n >> a >> b;
    h.resize(n);
    rep(i, 0, n){
        cin >> h[i];
    }
    int ng = 0, ok = 1e9;
    while(ok - ng > 1){
        int mid = (ok + ng) / 2;
        if(calc(mid)) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}

Measured memory_bytes: 1024
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// 最大公約数取得
long long
fGetGcd(
	long long llVal1			// <I> 値１
	, long long llVal2			// <I> 値２
)
{
	long long llWork;

	// ユークリッドの互除法
	if (llVal1 < llVal2) {
		llWork = llVal1;
		llVal1 = llVal2;
		llVal2 = llWork;
	}
	while (llVal2 > 0) {
		llWork = llVal1 % llVal2;
		llVal1 = llVal2;
		llVal2 = llWork;
	}

	return llVal1;
}

// 最小公倍数取得
long long
fGetLcm(
	long long llVal1			// <I> 値１
	, long long llVal2			// <I> 値２
)
{
	// 最大公約数取得
	long long llGcd = fGetGcd(llVal1, llVal2);

	// 最小公倍数取得
	return llVal1 / llGcd * llVal2;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i;
	char lc1Buf[1024], lc1Out[1024];

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 時計数取得
	int liCCnt;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d", &liCCnt);

	// １台目取得
	long long llSec;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%lld", &llSec);

	// ２台目以降取得
	for (i = 1; i < liCCnt; i++) {
		long long llSec2;
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
		fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
		sscanf(lc1Buf, "%lld", &llSec2);

		// 最小公倍数取得
		llSec = fGetLcm(llSec, llSec2);
	}

	// 結果セット
	sprintf(lc1Out, "%lld\n", llSec);

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 128
n = int(input())
s = [input() for i in range(n)]
dic = {'M':0,'A':1,'R':2,'C':3,'H':4}
ar = [0, 0, 0, 0, 0]
for i in s:
    if i[0] not in dic:
        continue
    ar[dic[i[0]]]+=1
dp = [[0 for i in range(6)] for j in range(6)]
dp[0][0] = 1
for i in range(1, 6):
    for j in range(6):
        dp[i][j] = dp[i-1][j]
        if j==0:
            continue
        dp[i][j] += dp[i-1][j-1]*ar[i-1]
print(dp[5][3])


Measured memory_bytes: 9752
#include<iostream>
using namespace std;
bool arr[1000000000];
int main()
{
    unsigned int num,temp;
    cin>>num;
    bool f=0;
    for(int i=0;i<num;i++){
        cin>>temp;
        if(arr[temp]) f=1;

        arr[temp]=1;
    }if(f) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
    return 0;
}


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

using namespace std;

int n;
typedef long long ll;
ll t[100001];
ll a[100001];
ll dt[100001];
ll da[100001];
const ll mod = 1e9 + 7;

int main() {
  cin >> n;

  ll pre;
  for(int i = 0; i < n; i++) cin >> t[i];
  for(int i = 0; i < n; i++) cin >> a[i];

    if(t[n-1] != a[0]) {
    cout << "0" << endl;
    return 0;
    }

  dt[0] = 1;
  da[n-1] = 1;
  for(int i = 1; i < n; i++) {
    if(t[i] == t[i-1]) dt[i] = t[i];
    else {
      dt[i] = 1;
      if(a[i] < t[i]) {
	cout << "0" << endl;
	return 0;
      }
    }
    
  }
  
  for(int i = n-2; i >= 0; i--) {
    if(a[i] == a[i+1]) da[i] = a[i];
    else {
      da[i] = 1;
      if(a[i] > t[i]) {
	cout << "0" << endl;
	return 0;
      }
    }
  }

  ll ans = 1;

  for(int i = 0; i < n; i++) {
    ans = ans * min(dt[i],da[i]) % mod;
    
  }

  cout << ans << endl;
}
  

    

  
  


Measured memory_bytes: 3328
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX*/

using namespace std;

using ll = long long;

#define mp make_pair

const int p = 998244353;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

/*const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);

    ll I, O, T, J, L, S, Z;
    cin>>I>>O>>T>>J>>L>>S>>Z;

    ll maxx = 2*(I/2 + J/2 + L/2);
    if (I>0 && J>0 && L>0)
    {
        I--; J--; L--;
        maxx = max(maxx, 3 + 2*(I/2 + J/2 + L/2));
    }
    cout<<maxx + O;

}




Measured memory_bytes: 256
#include <stdio.h>


int main(){
  char i1[4], i2[4], i3[4];

  scanf("%s", i1);
  scanf("%s", i2);
  scanf("%s", i3);

  //printf("%s, %s, %s\n", i1, i2, i3);
  printf("%c%c%c", i1[0], i2[1], i3[2]);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int N;
    cin >>N;
    vector<int> P(N);
  
    for(int i = 0;i < N;i++){
    cin>>P[i];
    }
    int ans = 0;
    for(int i = 0;i < N;i++){
        ans += P[i];
    }
   sort(P.begin(),P.end());
   cout << ans - P[N-1]/2 << endl;
}

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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define R(i,n) for(int i = 0; i < (n); i++)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}

template<class T> ostream &operator<<(ostream& os, set<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}

template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> PP) {
  return os << "(" << PP.FI << "," << PP.SE << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int MAX = 101;
const int P = 1e9 + 7;
int t[MAX];
int pot(int a,int w){
  int r = 1;
  while(w){
    if(w & 1){
      r = r * a % P;
    }
    w/=2;
    a = a * a % P;
  }
  return r;
}
int mul(int a,int b){
  return a * b % P;
}
void sub(int &a,int b){
  a -= b;
  if(a < 0)
    a+=P;
}
void add(int &a,int b){
  a += b;
  if(a >= P)
    a -= P;
}
PII licz(int po,int ko,int flo){
  int poo = po;
  int ma = 2e9;
  for(int i = po; i < ko; i++){
    mini(ma,t[i]);
  }
  PII res = {2,1};
  int ilema = -1;
  for(int i = po; i <= ko; i++){
    if(i == ko || t[i] == ma){
      ilema++;
      if(i > po){
        PII pom = licz(po, i, ma);
        res.FI = mul(res.FI, pom.FI);
        res.SE = mul(res.SE, (pom.SE + pom.FI)%P);
      }
      po = i + 1;
    }
  }
  debug(res);
  res.SE = mul(res.SE, pot(2, ilema));
  debug(res);
  sub(res.SE, res.FI);
  
  res.FI = mul(res.FI, pot(2, ma - flo - 1));
  add(res.SE,res.FI);
  debug(poo,ko,res);
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int n;
  cin >> n;
  R(i,n){
    cin >> t[i];
  }
  PII res = licz(0,n,0);
  cout << res.SE << "\n";
}




Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
#define typeof(x) __typeof__(x)
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#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) (c).begin(),(c).end()
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) UB(c,x)-LB(c,x)
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define PB push_back
#define MP make_pair
#define vec vector

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

using namespace std;

typedef pair<int,int> P;
struct edge {
  int to, cost;
};

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

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

class BIT
{
  private:
    vector<int> bit;
    int len;
  public:
    BIT(int n) {
      len = n+1;
      bit = vector<int>(len);
    }
    void add(int i, int x) {
      i += 1;
      while (i < len) {
        bit[i] += x;
        i += i & -i;
      }
    }
    int sum(int i) {
      i += 1;
      int s = 0;
      while (i > 0) {
        s += bit[i];
        i -= i & -i;
      }
      return s;
    }
};

signed main()
{
  int N, K; cin >> N >> K;
  vec<int> a(N);
  rep(i, 0, N) {
    cin >> a[i];
    a[i] -= K;
  }

  vec<int> s(N+1);
  s[0] = 0;
  rep(i, 0, N) {
    s[i+1] = s[i] + a[i];
  }
  vec<int> s_copy(N+1);
  COPY(s, s_copy);
  UNIQUE(s_copy);

  vec<int> t(N+1);
  rep(i, 0, N+1) {
    t[i] = LB(s_copy, s[i]);
  }

  BIT bit(SZ(s_copy));
  int ans = 0;
  rep(i, 0, N+1) {
    ans += bit.sum(t[i]);
    bit.add(t[i], 1);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8064
import java.util.Scanner;

public class Main {
	Scanner scan = new Scanner(System.in);
	
	
	void compute() {
		int r = scan.nextInt();
		int m = 3 * r * r;
		System.out.println(m);
	}

	public static void main(String[] args) {
		new Main().compute();
	}

}


Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main (void) {
	ll N, K;
	cin >> N>> K;
  	vector<pair<int ,int>> vec(N);
	for(int i=0; i < N; i++){
      	int a,b;
      	cin >> a >> b;
      	vec[i] = make_pair(a, b);
    }
  	sort(vec.begin(), vec.end());
  	ll index = 0;
  	for(auto v: vec){
      	if (index+v.second >= K){
          cout << v.first << endl;
          return 0;
        }
      	index += v.second;
    }
	return 0; 
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  int n, y;  scanf("%d %d", &n, &y);
  y /= 1000;

  for(int i=0; i<=n; i++){
    for(int j=0; j<=n-i; j++){
      int sum = i*10 + j*5 + (n-i-j)*1;
      if(sum == y){
	printf("%d %d %d\n", i, j, n-i-j);
	return 0;
      }
    }
  }
  printf("-1 -1 -1\n");
  return 0;
}
  


Measured memory_bytes: 128
//NOT A FSKY CODE
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
int n,m;
int a[200004],b[200004];
bool check(int x){
	for (int i=1;i<=m;i++){
		if (a[i]<x) b[i]=0;
		else b[i]=1;
	}
	int l,r;
	for (l=n-1;l>0 && b[l]^b[l+1];l--);
	for (r=n+1;r<=m && b[r]^b[r-1];r++);
	if (l==0 && r==m+1) return b[1];
	return r-n>n-l?b[l]:b[r];
}
int main(){
	cin>>n;
	m=n*2-1;
	for (int i=1;i<=m;i++) scanf ("%d",&a[i]);
	int l=-1,r=m+1;
	while (r>l+1){
		int mid=(l+r)/2;
		if (check(mid)) l=mid;
		else r=mid;
	}
	cout<<l;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int A, B, C;
    cin >> A >> B >> C;
 
    int cost = 0;
    int a = abs(B-A);
    int b = abs(C-B);
    int c = abs(C-A);
    
    cout << a + b + c - max(a, max(b, c)) << endl;
}

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

typedef char String[1024];

int main(void)
{
    String str_a, str_b;
    scanf("%s %s", str_a, str_b);
    
    int a = atoi(str_a);
    int b = atoi(str_b);
    int x, y = 0;
    double z = 0;
    
    x = a / b;
    y = a % b;
    z = (double)a / (double)b;
    
    printf("%d %d %f\n", x, y, z);
    return (0);
}


Measured memory_bytes: 2084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
 
int main(){
  int sum = 700;
  string x;
  cin >> x;
  rep(i, 3){
    if(x[i] == 'o'){
      sum += 100;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(x) (((long long)x)%modulo)



int main(){
	int X;
	cin>>X;
	int k = 0;
	for(int i=1;;i++){
		k+=i;
		if(k>=X){
			cout<<i<<endl;
			return 0;
		}
	}
	
	
	
	return 0;
}


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

using namespace std;

const char OPEN = '(';
const char CLOSE = ')';

string compress(string s) {
    int pos = 0;
    while ((pos = s.find("()", pos)) != string::npos) {
        s.replace(pos, 2, "");
        pos += 0;
    }
    return s;
}

void Main() {
    int N;
    cin >> N;
    string S;
    cin >> S;

    vector<string> operation;
    string s = S;
    while (s.size() > compress(s).size()) {
        s = compress(s);
    }
    s = compress(s);
    while (s != "") {
        if (compress("(" + s).size() < s.size()) {
            operation.push_back("(");
            s = compress("(" + s);
        }
        else {
            operation.push_back(")");
            s = compress(s + ")");
        }
    }

    string ans = S;
    for (int i = 0; i < operation.size(); ++i) {
        if (operation[i] == "(") {
            ans = "(" + ans;
        }
        else {
            ans = ans + ")";
        }
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3476
#include <bits/stdc++.h>
using namespace std;
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; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


int main() {
  long long N;
  cin >> N;
  cout << N * (N - 1) / 2 << endl;
}

Measured memory_bytes: 256
import datetime

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result


arr_data = getinputdata()

x = int(arr_data[0][0])
y = int(arr_data[0][1])


cnt = 1
#
#if x // y>=1 and x % y==0:
#    
#    print(-1)
#
#else:
#    while cnt<10**18:
#
#        if cnt%x==0 and cnt%y!=0:
#
#            print(cnt)
#            break
#
#        else:
#            cnt+=1
#            
##print(-1)
#

if x // y >= 1 and x % y == 0:
    
    print(-1)
else:
    for i in range(x, 10 ** 18, x):

        if i % y != 0:

            print(i)
            break

    else:

        print(-1)
        

Measured memory_bytes: 3312
<?php
// 整数の入力
fscanf(STDIN, "%d", $n);

if ($n == 1) {
 echo "Hello World";
} elseif ($n == 2) {
 // スペース区切りの整数の入力
 fscanf(STDIN, "%d", $a);
 fscanf(STDIN, "%d", $b);
 echo $a + $b;
}
?>

Measured memory_bytes: 3576
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int X,Y,Z;
ll A[100010],B[100010],C[100010];
vector<pair<ll,int>> v;

int main(){
	cin >> X >> Y >> Z;
	for(int i=0;i<X+Y+Z;i++){
		cin >> A[i] >> B[i] >> C[i];
		v.push_back({A[i]-B[i],i});
	}
	sort(v.begin(),v.end());
	for(int i=0;i<X+Y+Z;i++){
	}
	ll lans[X+Y+Z] = {0},rans[X+Y+Z] = {0},now = 0;
	priority_queue<ll> Q,S;
	for(int i=0;i<X+Y+Z;i++){
		if(Q.size()<Y){
			Q.push(-B[v[i].second]+C[v[i].second]);
			now += B[v[i].second];
			lans[i] = now;
		}else{
			Q.push(-B[v[i].second]+C[v[i].second]);
			now += B[v[i].second];
			ll p = Q.top(); Q.pop();
			now += p;
			lans[i] = now;
		}
	}
	now = 0;
	for(int i=X+Y+Z-1;i>=0;i--){
		if(S.size()<X){
			S.push(-A[v[i].second]+C[v[i].second]);
			now += A[v[i].second];
			rans[i] = now;
		}else{
			S.push(-A[v[i].second]+C[v[i].second]);
			now += A[v[i].second];
			ll p = S.top(); S.pop();
			now += p;
			rans[i] = now;
		}
	}
	ll ans = 0;
/*	for(int i=0;i<X+Y+Z;i++){
		cout << lans[i] << (i!=X+Y+Z-1? " ":"\n");
	}
	for(int i=0;i<X+Y+Z;i++){
		cout << rans[i] << (i!=X+Y+Z-1? " ":"\n");
	}
*/	for(int i=Y-1;i<Y+Z;i++){
		ans = max(lans[i] + rans[i+1],ans);
	}
	cout << ans << endl;
}

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

int main() {
    string s;
    cin >> s;
    int x = s.size();
    rep(i,x) printf("x");
    cout << endl;
    return 0;
}

Measured memory_bytes: 3560
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)










int main(){
    ll l, r;
    cin >> l >> r;
    if(r - l <= 5000){
        ll ans = INF;
        for(ll i = l; i < r; i++){
            for(ll j = i + 1; j <= r; j++){
                ans = min(ans, (i * j) % 2019);
            }
        }
        cout << ans << endl;
    }
    else{
        cout << 0 << endl;
    }
}


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

#define MAXN 200010
#define ll long long
#define mod 1000000007

using namespace std;

int n, m, k, ans, tot;

string s;

int a[MAXN];

int main(){
	int t;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

const int MAXN = 1000;
const int MAXM = 200000;

vector<int>G[MAXN + 5]; int to[MAXM + 5];
void addedge(int u, int i) {G[u].push_back(i);}

int tag[MAXN + 5], que[2*MAXN + 5];
bool ans1[MAXM + 5], ans2[MAXM + 5];

int n, m;
int main() {
	scanf("%d%d", &n, &m);
	for(int i=1;i<=m;i++) {
		int a; scanf("%d%d", &a, &to[i]);
		addedge(a, i);
	}
	for(int i=1;i<=n;i++) {
		for(int j=1;j<=n;j++) tag[j] = 0;
		int s = 1, t = 0;
		for(int p=0;p<G[i].size();p++)
			tag[que[++t] = to[G[i][p]]] = G[i][p];
		while( s <= t ) {
			int x = que[s++], y = tag[x];
			for(int p=0;p<G[x].size();p++) {
				int q = to[G[x][p]];
				if( q != i ) {
					if( tag[q] != -1 ) {
						if( tag[q] == 0 )
							tag[que[++t] = q] = y;
						else if( tag[q] != y )
							tag[que[++t] = q] = -1;
					}
				}
				else ans1[G[x][p]] = 1;
			}
		}
		for(int p=0;p<G[i].size();p++)
			if( tag[to[G[i][p]]] == -1 ) ans2[G[i][p]] = 1;
	}
	for(int i=1;i<=m;i++)
		puts(ans1[i] ^ ans2[i] ? "diff" : "same");
}

Measured memory_bytes: 5888
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const long long INF=1e18,MOD=1e9+7;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int>x(n);
  for(int i=0;i<n;i++)cin>>x[i];
  ll ans=INF,comp;
  for(int i=0;i<n-k+1;i++){
    comp=abs(x[i])+abs(x[i]-x[i+k-1]);
    comp=min(comp,(ll)abs(x[i+k-1])+abs(x[i]-x[i+k-1]));
    ans=min(ans,comp);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int a = sc.nextInt();
		int ans = (h+a-1)/a;
		System.out.println(ans);
	}
}

Measured memory_bytes: 21972
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, ma, mb; cin >> n >> ma >> mb;
    V<int> a(n), b(n), c(n);
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];

    V<vvll> dp(n + 1, vvll(401, vll(401, HIGHINF)));
    dp[0][0][0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 401; j++) {
            for (int k = 0; k < 401; k++) {
                chmin(dp[i + 1][j][k], dp[i][j][k]);
                if (j + a[i] < 401 && k + b[i] < 401) chmin(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
            }
        }
    }

    ll ans = HIGHINF;
    for (int i = 1; i < 400 / max(ma, mb); i++) {
        chmin(ans, dp[n][i * ma][i * mb]);
    }
    if (ans == HIGHINF) ans = -1;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 53504
#include<stdio.h>
int main()
{
	int a,b,c,d,i,h1=0,h2=0;
	scanf("%d",&a);
	while(a!=0){
	for(i=0;i<a;i++){
		scanf("%d %d %d",&b,&c,&d);
	    h1=b+c;
		h1/=2;
		h2=b+c+d;
		h2/=3;
		if(b==100||c==100||d==100)
			printf("A\n");
		else if(h1>=90)
			printf("A\n");
		
		
		
		
		else if(h2>=80)
		      printf("A\n");
		
		else if(h2>=70&&h2<80)
			printf("B\n");
	
		
		else if(h2>=50&&(b>=80||c>=80))

			printf("B\n");
		
		
		else 
			printf("C\n");
		
	}
scanf("%d",&a);
	}
	return 0;
}
	

Measured memory_bytes: 584
#include <iostream>
#include <algorithm>

using ll = long long;
const int maxn = 5000+7;
ll n, m, ans, dp[maxn];

int main(int argc, char *argv[]) {  
	std::ios::sync_with_stdio(false);
	std::cin.tie(0); 
	std::cin >> n >> m;
	dp[0] = 1;
	for (ll i = 1; i < n; i++) {
		ll k = std::min(i, n-i+1);
		for (ll j = k; j < n; j++) {
			dp[j] = (dp[j] + dp[j-k]) % m;
		}
	}
	for (ll i = 0; i < n; i++) {
		ans += (n-i) * dp[i] % m;
		ans %= m;
	}
	std::cout << ans << '\n';
}

Measured memory_bytes: 256