akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}
template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    ll x, k, d;
    cin >> x >> k >> d;

    x = abs(x);
    ll ans;
    
    if(x/d > k) {
        ans = x - d * k;           
    } else {
        ll cnt = x/d;
        k -= cnt;
        x -= d*cnt;
        if(k%2 == 1) {
            x -= d;
        } 
        ans = x;
    }
    cout << abs(ans) << endl;
    return 0;
} /*atcoder*/




Measured memory_bytes: 3588
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007
    #define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
    #define GCD(m,n) __gcd(m,n)
    #define LCM(m,n) m*(n/GCD(m,n))
    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    #define pii pair<int,int>
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
     	int a,b;
     	cin>>a>>b;
     	int sum=a+b;
     	if(sum%2) return cout<<"IMPOSSIBLE",0;
     	cout<<sum/2;
         
     }
    signed main()
    {   
        asdf
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

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

using namespace std;

int n;
string s;

long long ans;
map<pair<string,string>,long long> f,r;

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

	cin >> n >> s;

	string rs,fs;

	fs = s.substr(0,n);
	rs = s.substr(n,n);

	for (int i = 0;i < (1<<n);i++){
		string s1="",s2="",s3="",s4="";
		for (int j = 0;j < n;j++){
			if(i&(1<<j))s1+=fs[j];
			else s2+=fs[j];
			if(i&(1<<j))s3+=rs[j];
			else s4+=rs[j];	
		}
		reverse(s2.begin(),s2.end());
		reverse(s4.begin(),s4.end());
		f[make_pair(s1,s2)]++;
		r[make_pair(s4,s3)]++;
	}

	for (auto x : f){
		ans += x.second*r[x.first];
	}

	cout << ans << endl;
	
	return 0;

}

Measured memory_bytes: 103424
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	if(a%2==0||b%2==0) cout<<"Even"<<endl;
	else cout<<"Odd"<<endl;
	return 0;
}

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

#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << "["<< *it << " = " << a << "]"<< endl;
    err(++it, args...);
}
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    int n,k,d,cnt = 0;
    cin >> n >> k;

    for (int i = 0; i< n; i++) {
        cin >> d;
        if (d >= k) cnt++;
    }
    cout << cnt;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int a, b, c;
	cin >> a >> b >> c;
	int number = 101, counter = 0;
	while (number > 0 && counter != c)
	{
		number--;
		if (a % number == 0 && b % number == 0) {
			counter++;
		}
		
	}
	cout << number << endl;
    return 0;
}

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

using namespace std;

#define int long long

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

int n, m;
int A[100010], B[100010], C[100010];
int imos[100010];

signed main()
{
	cin >> n >> m;
	
	vector<int> p(m);
	
	rep(i, m) {
		cin >> p[i];
		--p[i];
	}
	
	rep(i, m - 1) {
		if (p[i] < p[i+1]) {
			imos[p[i]]++;
			imos[p[i+1]]--;
		} else {
			imos[p[i+1]]++;
			imos[p[i]]--;
		}
	}
	
	rep(i, n) {
		imos[i+1] += imos[i];
	}
	
	int ans = 0;
	
	rep(i, n - 1) {
		cin >> A[i] >> B[i] >> C[i];
		
		ans += min(imos[i] * A[i], imos[i] * B[i] + C[i]);
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 6716
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

func main() {
	a, b := readInt(), readInt()
	g := gcd(a, b)
	divisors := listDivisors(g)

	sort.Ints(divisors)

	ok := make([]bool, len(divisors))
	for i := range ok {
		ok[i] = true
	}

	for i := 1; i < len(divisors); i++ {
		end := true
		for j := i + 1; j < len(divisors); j++ {
			if !ok[j] {
				continue
			}
			if divisors[j]%divisors[i] == 0 {
				ok[j] = false
			}
			end = false
		}
		if end {
			break
		}
	}

	ans := 0
	for i := range ok {
		if ok[i] {
			ans++
		}
	}

	fmt.Println(ans)
}

func listDivisors(n int) []int {
	ret := make([]int, 0)
	for i := 1; i <= int(math.Sqrt(float64(n))); i++ {
		if n%i != 0 {
			continue
		}
		ret = append(ret, i)
		if n/i != i {
			ret = append(ret, n/i)
		}
	}
	return ret
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 896
#include<stdio.h>
#include<algorithm>
using namespace std;
int s[15];
int m[10][10];
int ans[10][10];
int now[10][10];
int used[15];
int row[15];
int col[15];
int ret;
int a,b,c;
void solve(int x,int y){
	//printf("%d %d\n",x,y);
	if(ret>1)return;
	if(y==a){
		solve(x+1,0);
		return;
	}
	if(x==b){
		ret++;
		for(int i=0;i<b;i++)
			for(int j=0;j<a;j++)
				ans[i][j]=now[i][j];
		return ;
	}
	if(~now[x][y]&&used[now[x][y]]){
		solve(x,y+1);
		return;
	}
	for(int i=0;i<c;i++){
		if(!used[i]&&row[i]>=x&&col[i]>=y){
			for(int j=row[i]-x+1;j*(col[i]-y+1)<=s[i];j++){
				if(s[i]%j==0){
					bool ok=true;
					for(int k=0;k<j;k++){
						for(int l=0;l<s[i]/j;l++){
							if(now[x+k][y+l]!=m[x+k][y+l])ok=false;
						}
					}
					if(ok){
						for(int k=0;k<j;k++){
							for(int l=0;l<s[i]/j;l++){
								now[x+k][y+l]=i;
							}
						}
						used[i]=1;
						solve(x,y+1);
						used[i]=0;
						for(int k=0;k<j;k++){
							for(int l=0;l<s[i]/j;l++){
								now[x+k][y+l]=m[x+k][y+l];
							}
						}
					}
				}
			}
		}
	}
}
int main(){
	while(scanf("%d%d%d",&a,&b,&c),a){
		for(int i=0;i<c;i++){
			int d,e;
			scanf("%d%d",&d,&e);
			s[d-1]=e;
			used[i]=0;
		}
		for(int i=0;i<b;i++)
			for(int j=0;j<a;j++){
				scanf("%d",&m[i][j]);
				m[i][j]--;
				now[i][j]=m[i][j];
				if(m[i][j]>=0){
					row[m[i][j]]=i;
					col[m[i][j]]=j;
				}
			}
		ret=0;
		solve(0,0);
		if(ret==1){
			for(int i=0;i<b;i++){
				for(int j=0;j<a;j++){
					if(j)printf(" ");
					printf("%d",ans[i][j]+1);
				}
				printf("\n");
			}
		}else printf("NA\n");
	}
}

Measured memory_bytes: 1044
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

//#define int long long
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>void put_double(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
template<class T>void print(T a){cout << a << endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    char c; cin >> c;
    cout  << (char)(c + 1) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   int n,d,c,temp=0,cnt=0;
   cin>>n>>d;

   while(1)
   {
       temp+=d*2+1;
       cnt++;
       if(temp>=n) break;
   }
   cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n;
	int i, j;
	int time[10000];
	int tmp;
	long long sum_time;
	long long wait;

	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}

		for (i = 0; i < n; i++){
			scanf("%d", &time[i]);
		}
		
		for (i = 0; i < n; i++){
			for (j = 0; j < n - i - 1; j++){
				if (time[j] > time[j + 1]){
					tmp = time[j];
					time[j] = time[j + 1];
					time[j + 1] = tmp;
				}
			}
		}
		
		wait = sum_time = 0;
		for (i = 0; i < n - 1; i++){
			wait += time[i];
			sum_time += wait;
		}
		
	
		printf("%lld\n", sum_time);
	}
	
	return (0);
}

Measured memory_bytes: 448
#include <iostream>

using namespace std;

int dp[100000+9], h[100000+9], n, k;
unsigned int OO = 2e9;
int solve(int cur=0){
    if(cur == n-1) return 0;
    int &ret=dp[cur];
    if(ret!=-1) return ret;
    ret=OO;

    int last=min(cur+k, n-1);
    for(int i=cur+1;i<=last;i++){
        ret=min(ret, solve(i)+abs(h[cur]-h[i]));
    }

    return ret;

}

//int main(){
//    scanf("%d %d",&n,&k);
//    for(int i=0;i<n;i++) dp[i]=-1;
//    for(int i=0;i<n;i++) scanf("%d",&h[i]);
//    printf("%d",solve());
//    return 0;
//}

int main(){

    scanf("%d %d",&n,&k);
    for(int i=0;i<n;i++) dp[i]=OO;
    for(int i=0;i<n;i++) scanf("%d",&h[i]);

    dp[n-1]=0;
    for(int i=n-1;i>=0;i--){
        for(int j=i-1;j>=0;j--){
            if(i-j > k) break;
            dp[j]=min(dp[j], abs(h[i]-h[j])+dp[i]);
        }
    }

    printf("%d", dp[0]);

    return 0;
}


Measured memory_bytes: 1024
main :: IO ()
main = do
    line <- getLine
    let nums = map (\n -> read n :: Int) $ words line
    putStrLn $ branchOnCondition nums

branchOnCondition :: [Int] -> String
branchOnCondition [a, b, c]
  | and [a < b, b < c] = "Yes"
  | otherwise          = "No"


Measured memory_bytes: 3576
from sys import stdin
from collections import defaultdict

N, K = [int(x) for x in stdin.readline().rstrip().split()]

S = stdin.readline().rstrip()


if K == 1:
    S3 = list(S[0].lower())
else:
    S3 = list(S[0])
for i in range(1,N):
  if i+1 == K:
    S3.append(S[i].lower())
  else:
    S3.append(S[i])

S4 = ''.join(S3)
print(S4)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef long long ll;
#define mp make_pair
#define pb push_back
void solve();
void read_input(){

}
void solve(){

}
vector<PII> edges[100005];

vector<int> order;
bool visited[100005];
ll pos[100005];
void dfs(int i){
	if (visited[i])
		return ;
	visited[i] = true;
	for(PII p:edges[i]){
		if (!visited[p.fi])
			dfs(p.fi);
	}
	order.pb(i);
}
int main(){
	memset(pos,-1,sizeof(pos));
	for(int i=0;i<100005;i++){
		edges[i] = vector<PII>();
	}	
	int N,M;
	scanf("%d %d",&N,&M);
	for(int i=0;i<M;i++){
		int a,b,c;
		scanf("%d %d %d",&a,&b,&c);
		edges[a].pb({b,c});
	}
	for(int i=1;i<=N;i++){
		if (!visited[i]){
			dfs(i);
		}
	} 
	reverse(order.begin(),order.end());
	for(int i:order){
		if (pos[i] == -1){
			pos[i] = 0;
		}
		for(PII p:edges[i]){
			if (pos[p.fi] == -1){
				pos[p.fi] = pos[i]+p.se;
			}else{
				if (pos[p.fi] != pos[i]+p.se){
					cout<<"No"<<endl;
					return 0;
				}
			}
		}
	}
	for(int i=0;i<N;i++){
		if (pos[i]>1000000000){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

int main(void)
{
    const int M = 30000;
    int N;
    cin >> N;
    if (N == 3) {
        cout << "2 5 63" << endl;
    } else if (N == 4) {
        cout << "2 5 20 63" << endl;
    } else {
        printf("2 4 3 9");
        N -= 4;
        for (int i = 12; N >= 2 && i + 9 <= M; i += 12) {
            printf(" %d %d", i + 3, i + 9);
            N -= 2;
        }
        for (int i = 6; N >= 2 && i + 4 <= M; i += 6) {
            printf(" %d %d", i + 2, i + 4);
            N -= 2;
        }
        for (int i = 6; N > 0 && i <= M; i += 6) {
            printf(" %d", i);
            N--;
        }
        assert(N == 0);
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<(n);i++)
#define REP1(i,n) for(long long i=1;i<=(n);i++)
#define REP2D(i,j,h,w) for(long long i=0;i<(h);i++) for(long long j=0;j<(w);j++)
#define REP2D1(i,j,h,w) for(long long i=1;i<=(h);i++) for(long long j=1;j<=(w);j++)
#define PER(i,n) for(long long i=((n)-1);i>=0;i--)
#define PER1(i,n) for(long long i=(n);i>0;i--)
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define FORE(i,a,b) for(long long i=(a);i<=(b);i++)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();++ite)
#define ALL(a) ((a).begin()),((a).end())
#define RANGE(a) (a),((a)+sizeof(a))
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define YNPRT(b) cout<<((b)?"Yes":"No")<<endl
#define ENTER printf("\n")
#define REV(arr) reverse(ALL(arr))
#define PRT(a) cout<<(a)<<endl

#ifdef DEBUG
#define DBPRT(a) cout << "[Debug] - " << #a << " : " << (a) << endl
#define DBSTART if(1){
#define DBEND }
#define PRTLST(arr,num) REP(_i,num) cout<<_i<<" - "<<arr[_i]<<endl;
#define PRTLST2(arr2,d1,d2) REP(_i,d1) REP(_j,d2) cout<<_i<<","<<_j<<" : "<<arr2[_i][_j]<<endl;
#define PRTLST2D(arr2,d1,d2) do{cout<<"L\t";REP(_i,d2) cout<<_i<<"\t"; cout<<endl; REP(_i,d1){cout<<_i<<"\t";REP(_j,d2){cout<<arr2[_i][_j]<<"\t";}cout<<endl;}}while(0);
#else
#define DBPRT(a) if(0){}
#define DBSTART if(0){
#define DBEND }
#define PRTLST(arr,num) if(0){}
#define PRTLST2(arr2,d1,d2) if(0){}
#define PRTLST2D(arr2,d1,d2) if(0){}
#endif

#define TOSUM(arr,sum,n) {sum[0]=arr[0];REP1(i,n-1) sum[i]=sum[i-1]+arr[i];}

#define MIN(target,v1) (target)=min(target,v1)
#define MAX(target,v1) (target)=max(target,v1) 
#define P1 first
#define P2 second
#define PB push_back
#define UB upper_bound
#define LB lower_bound
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;
const int Move[4][2] = {-1,0,0,1,1,0,0,-1};
const int Move_[8][2] = {-1,0,-1,-1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p) {os<<"( "<<p.P1<<" , "<<p.P2<<" )";return os;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {ITE(v) os << (ite-v.begin()) << " : " << *ite <<endl;return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v) {os<<" { ";ITE(v) {os<<*ite;if(ite!=--v.end()){os<<" , ";}} os<<" } ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& m) {ITE(m) {os<<ite->P1<<"\t\t|->\t\t"<<ite->P2<<endl;} return os;}

//---------------------
#define MAXN 200005
//---------------------

ll n,p[MAXN];

int main(){
	cin >> n;ZERO(p);
	REP1(i,n) cin >> p[i];
	ll m = p[1];
	ll ct = 0;
	REP1(i,n){
		if(p[i]<=m) ct++;
		MIN(m,p[i]);
	}
	PRT(ct);
	return 0;
}









Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {

    string s; cin >> s;
    int n = s.size();
    vector<int> v(n);
    rep(i,n) v[i] = stoi(s.substr(i, 1));
    
    long long total = 0;

    rep (bit, 1<<(n-1)){

        long long tmp = 0, sum = 0;

        rep(i, n){

            if (i == n-1) {
                sum += tmp + v[i];
                continue;
            }

            if (bit & 1<<i){
                sum += tmp + v[i];
                tmp = 0;
            }
            else {
                tmp += v[i];
                tmp *= 10;
            }
        }

        total += sum;
    }

    cout << total << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define cinf(n,x) for(int i=0;i<(n);I++) cin >> x[i];

int main(){
  string s;
  cin >> s;
  cout << s[0] << s.size() -2 << s[s.size() -1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi   = vec<int>;
using vvi  = vec<vi>;
using vvvi = vec<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int x[5];
  rep(i,5) cin>>x[i];
  int iopt;
  rep(i,5){
    if(x[i]==0) iopt = i;
  }
  cout << iopt+1 << endl;
  return 0;
}


Measured memory_bytes: 3608
import std.stdio;
import std.algorithm;
import std.string;
import std.conv;

void main() {
	int n, x;
	scanf("%d %d\n", &n, &x);
	auto ls = readln.chomp.split.to!(int[]);
	int d, cnt;
	foreach(l; ls) {
		d += l;
		++cnt;
		if (d > x) {
			cnt.write;
			return;
		}
	}
	write(n+1);
}


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

int main()
{
  string red, green, down, ans;
  while (cin >> red) {
    if (red == "-")
      break;
    cin >> green >> down;
    ans = "";

    bool left = true;
    unsigned int rr = 0, gg = 0, dd = 0;

    while (rr < red.size() || gg < green.size() || dd < down.size()) {
      if (left) {
	if (green[gg] == down[dd]) {
	  ++gg;
	  ++dd;
	  left = false;
	} else {
	  ans += green[gg];
	  ++gg;
	}
      } else {
	if (red[rr] == down[dd]) {
	  ++rr;
	  ++dd;
	} else {
	  ans += red[rr];
	  ++rr;
	  left = true;
	}
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
import heapq


class ShortestPath:
    """Dijkstra's algorithm : find the shortest path from a vertex
       Complexity: O(E + log(V))
       used in GRL1A(AOJ)
    """

    def __init__(self, V, E, start, INF=10**9):
        """ V: the number of vertexes
            E: adjacency list (all edge in E must be 0 or positive)
            start: start vertex
            INF: Infinity distance
        """
        self.V = V
        self.E = E
        self.dijkstra(start, INF)

    def dijkstra(self, start, INF):
        que = list()
        self.distance = [INF] * self.V  # distance from start
        self.prev = [-1] * self.V  # prev vertex of shortest path
        self.distance[start] = 0
        heapq.heappush(que, (0, start))

        while len(que) > 0:
            dist, fr = heapq.heappop(que)
            if self.distance[fr] < dist:
                continue
            for to, cost in self.E[fr]:
                if self.distance[fr] + cost < self.distance[to]:
                    self.distance[to] = self.distance[fr] + cost
                    heapq.heappush(que, (self.distance[to], to))
                    self.prev[to] = fr

    def getPath(self, end):
        path = [end]
        while self.prev[end] != -1:
            end = self.prev[end]
        return path[::-1]
V = int(input())
edge = [[] for _ in range(V)]
for _ in range(V):
    u, _, *e = map(int, input().split())
    for t, d in zip(e[::2], e[1::2]):
        edge[u].append((t, d))

sp = ShortestPath(V, edge, 0)
for i, d in enumerate(sp.distance):
    print(i, d)

Measured memory_bytes: 70976
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
using Graph = vector<vector<int>>;

int main(){
    string s,t;
    cin>>s>>t;
    bool ok = true;
    if(s.length() + 1 == t.length()){
        for(int i = 0; i < s.length(); i++){
            if(s[i] != t[i]) ok = false;
        }
        if(ok) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3624
#include <iostream>
#include <utility>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>

std::pair<int, int> road[101][101]; //first?????¢ second???
int dp[101][101];//[??????][??´???] = ??¢????\????????????°

struct Node {
	int pos, money, attacked;
	bool operator > (const Node& rhs) const {
		return attacked > rhs.attacked;
	}
	bool operator < (const Node& rhs) const {
		return attacked < rhs.attacked;
	}
};

int main() {
	int n, m, l;
	while (std::cin >> n >> m >> l && (n || m || l)) {
		std::memset(dp, -1, sizeof(dp));
		for (int i = 0; i < 101; i++) for (int j = 0; j < 101; j++) road[i][j] = std::make_pair(0, 0);
		for (int i = 0; i < m; i++) {
			int x, y, d, e;
			std::cin >> x >> y >> d >> e;
			road[x][y] = std::make_pair(d, e);
			road[y][x] = std::make_pair(d, e);
		}

		std::stack<Node> s;
		//std::priority_queue<Node> s;
		s.push({1, l, 0});

		int min = 1919810;
		while (!s.empty()) {
			auto node = s.top(); s.pop();

			for (int i = 1; i <= n; i++) {
				if (!road[node.pos][i].first) continue;
				auto next = node;
				next.pos = i;

				//????????????
				{
					auto n2 = next;
					n2.attacked += road[node.pos][i].second;
					if (dp[n2.money][i] == -1 || dp[n2.money][i] > n2.attacked) {
						dp[n2.money][i] = n2.attacked;
						if (i == n) min = std::min(min, n2.attacked); //????????????
						else {
							//????????????????????????????????\???????\????????????????
							bool isOk = true;
							for (int j = n2.money + 1; j <= l; j++) {
								if (dp[j][i] >= 0 && dp[j][i] <= n2.attacked) {
									isOk = false;
									break;
								}
							}
							if (isOk) {
								s.push(n2);
							}
						}
					}
				}
				//??????
				if (next.money >= road[node.pos][i].first) {
					next.money -= road[node.pos][i].first;
					if (dp[next.money][i] == -1 || dp[next.money][i] > next.attacked) {
						dp[next.money][i] = next.attacked;
						if (i == n) min = std::min(min, next.attacked); //????????????
						else {
							//????????????????????????????????\???????\????????????????
							bool isOk = true;
							for (int j = next.money + 1; j <= l; j++) {
								if (dp[j][i] >= 0 && dp[j][i] <= next.attacked) {
									isOk = false;
									break;
								}
							}
							if (isOk) {
								s.push(next);
							}
						}
					}
				}
			}
		}
		std::cout << min << std::endl;
	}

	return 0;
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) cin >> a[i];
  ll m = 1000, k = 0;
  rep(i, n - 1) {
    if(a[i] < a[i + 1]) {
      k += m / a[i];
      m %= a[i];
    } else {
      m += k * a[i];
      k = 0;
    }
  }
  m += k * a[n - 1];
  cout << m << endl;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int h,w;
int main () {
    scanf("%d%d",&h,&w);
    int cnt=0;
    for (int i=1;i<=h;i++) {
        getchar();
        for (int j=1;j<=w;j++) {
            char c=getchar();
            if (c=='#') ++cnt;
        }
    }
    if(cnt==h+w-1) cout<<"Possible"<<endl;
    else cout<<"Impossible"<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000)


def rootedTree(node,parent,root,num):
    A.append([node,parent,root,num])
    for root_num,num in root:
            rootedTree(root_num,node,tree[root_num],num)


n=int(input())
AB=[list(map(int,input().split()))+[i+1] for i in range(n-1)]
A=[]
tree=[[] for i in range(n+1)]
for a,b,c in AB:
    tree[a] +=[[b,c]]

rootedTree(1,0,tree[1],0)
ans=[0]*n
for node,parent,root,num in A:
    flag=0
    for i,j in enumerate(root):
        if ans[num]==i+1:flag=1
        if flag:
            ans[j[1]]=i+2
            continue
        ans[j[1]]=i+1

print(max(ans))
for i in range(1,n):print(ans[i])


Measured memory_bytes: 86772
#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 n,k,s;
    cin>>n>>k>>s;
    rep(i,n){
        if(i<k)cout<<s<<" ";
        else{
            if(s!=1e9)cout<<1000000000<<" ";
            else cout<<1<<" ";
        }
    }
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int n;
#define N 200000
int ai[N], rb[N], dt[N];
int ans = 1;
#define MOD 1000000007
int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++ i) cin >> ai[i];
    for (int i = 1, d = 0, p = 0; i <= n; ++ i)
    {
        d = max(d, i - 1 - (ai[i - 1] + 1) / 2);
        ans = 1ll * ans  * (i - d) % MOD;
    }
    cout << ans;
}


Measured memory_bytes: 640
use proconio::input;

fn culc(a: usize, b:usize) -> usize {
  if a % b == 0 {
    a / b
  } else {
    a / b + 1
  }
}

fn main() {
  input! {
    n: usize,
    a: usize,
    b: usize,
    c: usize,
    d: usize,
    e: usize,
  }

  let mut memo: Vec<usize> = vec![a,b,c,d,e];
  let mut min = usize::max_value();
  for (i, v) in memo.iter().enumerate() {
    min = std::cmp::min(min, *v);
  }
  let total = culc(n, min) + 4;
  
  println!("{}", total);
}

Measured memory_bytes: 2184
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

int mat[501][501];

int construct(int left, int right) {
    if(right - left == 1) return 0;
    if(right - left == 2) {
        mat[left][right - 1] = mat[right - 1][left] = 1;
        return 1;
    }
    int mid = (left + right) / 2;
    int lev = 0;
    chmax(lev, construct(left, mid));
    chmax(lev, construct(mid, right));
    for(int i = left; i < mid; i++) {
        for(int j = mid; j < right; j++) {
            mat[i][j] = mat[j][i] = lev + 1;
        }
    }
    return lev + 1;
}

int main() {
    ll N;
    cin >> N;
    construct(0, N);
    for(int i = 0; i < N - 1; i++) {
        for(int j = i + 1; j < N; j++) cout << mat[i][j] << ' ';
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n,m,a,b,t;
  cin>>n>>m>>a>>b;
  vector<int>d;
  r(i,n){
    cin>>t;
    if(t<a)break;
    else d.push_back(t);
  }
  if(n-(int)d.size()<m)
    while(d.size()&&d[d.size()-1]<=b)d.erase(d.end()-1);
  cout<<d.size()<<endl;
}

Measured memory_bytes: 3164
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int l, r;
	cin >> l >> r;
	if(r - l >= 2019 || l%2019 >= r%2019) {
		cout << 0;
		exit(0);
	}
	l %= 2019;
	r %= 2019;
	int ans = INT_MAX;
	for(int i=l; i<=r; i++) {
		for(int j=i+1; j<=r; j++) {
			ans = min(ans, (i*j)%2019);
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
import sys

n=int(input())
if n==1:
	print(1)
	sys.exit()
elif n==0:
	sys.exit()
book=[]
for i in range(n):
	s,p=map(str,input().split())
	book.append([s,int(p),i+1])
book.sort(key=lambda book:book[0])
tmp=[]
for i in range(n):
	if i==0:
		tmp.append(book[i])
	elif tmp[0][0]!=book[i][0]:
		tmp.sort(key=lambda tmp:tmp[1],reverse=True)
		for j in range(len(tmp)):
			print(tmp[j][2])
		tmp.clear()
		if i!=n-1:
			tmp.append(book[i])
		if i==n-1:
			print(book[i][2])
	elif i==n-1:
		tmp.append(book[i])
		tmp.sort(key=lambda tmp:tmp[1],reverse=True)
		for j in range(len(tmp)):
			print(tmp[j][2])
	else:
		tmp.append(book[i])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep_1(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define rep_2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main(){
    ll a,b;cin>>a>>b;
    for(ll i = 1;i <= 1000;i++){
        ll tmpA = i * 0.08;
        ll tmpB = i * 0.1;
        if(tmpA == a && tmpB == b){
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 <<endl;

    return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int n,x,y,t,sum,ans=0;
int main() {
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>t;
		cin>>x>>y;
		if(t<x+y)
			break;
		sum=t-x-y;
		if(sum%2==0)
			ans++;
	}
	if(ans==n)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
typedef unsigned long long ull;
int x, n, k, cnt[1050000];
int main() {
	cin >> n >> k >> x; k--;
	if (x == 0) {
		cout << 0 << endl;
		return 0;
	}
	ull z1 = x;
	for (int i = 0; i < n; i++) {
		long long w = z1;
		cnt[(w >> 44) + 524288]++;
		z1 ^= (z1 << 13);
		z1 ^= (z1 >> 7);
		z1 ^= (z1 << 17);
	}
	int sum = 0, r = 0;
	for (int i = 0; i < 1048576; i++) {
		sum += cnt[i];
		if (sum > k) { r = i; break; }
	}
	int c = k - (sum - cnt[r]);
	ull z2 = x;
	vector<long long> v;
	for (int i = 0; i < n; i++) {
		long long w = z2;
		if ((w >> 44) + 524288 == r) v.push_back(z2);
		z2 ^= (z2 << 13);
		z2 ^= (z2 >> 7);
		z2 ^= (z2 << 17);
	}
	sort(v.begin(), v.end());
	cout << v[c] << endl;
	return 0;
}

Measured memory_bytes: 7212
#include <bits/stdc++.h> 
using namespace std;
int main()
{
    int a[5],i,k;
    for(i=0;i<5;i++)
    scanf("%d",&a[i]);
    scanf("%d",&k);
    if(a[4]-a[0]>k)
    printf(":(");
    else
    printf("Yay!");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstring>
typedef long long LL;
using namespace std;

bool is_ok(LL N,LL A,LL B){
	if(N == 1 && A == B)
		return true;
	else if(N > 1 && A <= B)
		return true;
	return false;
}


int main(){
	LL N,A,B;
	cin >> N >> A >> B;
	
	if(is_ok(N,A,B)){
		if(N == 1 || A == B)
			cout << 1 << endl;
		else{
			LL diff = B-A;
			cout << diff*(N-2)+1 << endl;
		}
			
	}
	else
		cout << 0 << endl;
	return 0;
} 

Measured memory_bytes: 888
#include<stdio.h>

int main()
{
  int n,i=0,j,A[200000],res,res1,mini,a,max=-1000000000;

  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&A[i]);
  }
  mini = A[0];
  for(i=1; i<n; i++){
       a = A[i]-mini;
       if(a > max) max = a;
      if(A[i] <mini) mini = A[i];
    }
    
  printf("%d\n",max);
  return 0;
}



Measured memory_bytes: 2632
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def solve():
    s = input()
    if s == "ABC":
        print("ARC")
    else:
        print("ABC")

    return 0

if __name__ == "__main__":# {{{
    solve()

# vim: set foldmethod=marker: }}}


Measured memory_bytes: 79716
// Crt. 2020-01-11  08:43:39
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#define PII pair<int, int>
#define mk make_pair
#define fi first
#define se second
#define N 2004
using namespace std;

template <typename T> inline T abs(const T &x) {
    return x < 0 ? -x : x;
}

int n, m, up[N][N], l[N], r[N];
char s[N];
bool a[N][N];
int stk[N];

int main(){
#ifdef LOCAL_JUDGE
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif
    
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        scanf("%s", s + 1);
        for (int j = 1; j <= m; ++j)
            if (s[j] == '#') a[i][j] = 1;
            else a[i][j] = 0;
    }

    for (int j = 1; j < m; ++j) {
        up[1][j] = (a[1][j] xor a[1][j + 1]) ? +1 : 1;
        for (int i = 2; i <= n; ++i)
            if (a[i][j] ^ a[i][j + 1])
                up[i][j] = (a[i - 1][j] ^ a[i - 1][j + 1]) ? up[i - 1][j] + 1 : 1;
            else 
                up[i][j] = (a[i - 1][j] ^ a[i - 1][j + 1]) ? 1 : up[i - 1][j] + 1;
    }

    //for (int i = 1; i <= n; ++i) {
    //    for (int j = 1; j < m; ++j)
    //        cout << abs(up[i][j]) << " ";
    //    cout << endl;
    //}

    int ans = 0;
    for (int i = 1, top; i <= n; ++i) {
        stk[top = 1] = 0; 
        for (int j = 1; j < m; ++j) {
            while (top && up[i][j] <= up[i][stk[top]])
                --top;
            l[j] = stk[top], stk[++top] = j;
        }
        stk[top = 1] = m;
        for (int j = m - 1; j; --j) {
            while (top && up[i][j] <= up[i][stk[top]])
                --top;
            r[j] = stk[top], stk[++top] = j;
        }
        for (int j = 1; j < m; ++j)
            ans = max(ans, up[i][j] * (r[j] - l[j]));
    }

    cout << max(ans, max(n, m)) << endl;

    return 0;
}


Measured memory_bytes: 19840
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define INF 1000000000

int main() {
	
	vector<int> a(3);
	FOR(i, 3)cin >> a[i];
	SORT(a);
	cout << a[0] + a[1] + a[2] * 10 << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque, defaultdict
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush
sys.setrecursionlimit(10000000)

def Attack(L):
    if L == 1: return 1
    else:
        return 1 + 2 * Attack(L//2)

def solve():
    H = int(input())
    print(Attack(H))

    return 0

if __name__ == "__main__":
    solve()

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

#define int long long
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
const int N=1e5+5;
const int INF = 1e9;
 

 
int32_t main()
{
	IOS;
	int n,sum=0;
	cin>>n;
	vector<int> b(n-1),a(n);
	for(int i=0; i<n-1; i++) cin>>b[i];
        //for(int x=0; x<n-1; x++) cout<<b[x];
        a[0] = min(INF,b[0]);
        a[n-1] = b[n-2];
        for(int i=1; i<n-1; i++) a[i] = min(b[i],b[i-1]);
	for(int i=0; i<n; i++) sum += a[i];
	cout<<sum<<endl;
	return 0;
}



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

int main() {
    int N;
    cin >>N;
    int a[N];
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    sort(a,a+N,greater<int>());
    int Alice =0;
    int Bob =0 ;
    for (int i = 0; i < N; i++)
    {
        if (i%2==0)
        {
            Alice+=a[i];
        }
        else
        {
            Bob+=a[i];
        }
        
    }
    int dif = Alice-Bob;
    cout << dif<<endl;
    
    
    
    
    
}

Measured memory_bytes: 256
#!/usr/bin/env python
import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import (
    accumulate, combinations, combinations_with_replacement, groupby,
    permutations, product)
from math import (
    acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians,
    sin, sqrt, tan)
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits


def inp():
    return(int(input()))


def inlist():
    return(list(map(int, input().split())))


def instr():
    s = input()
    return(list(s[:len(s)]))


def invr():
    return(map(int, input().split()))


def main():
    n = inp()
    count = defaultdict(lambda: 0)
    for _ in range(n):
        t = input()
        count[t] += 1
    for i in ['AC', 'WA', 'TLE', 'RE']:
        print(i, "x", count[i])


# region fastio
BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")

# endregion


if __name__ == "__main__":
    main()


Measured memory_bytes: 11200
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <map>
const int MOD = 1e9+7;
using namespace std;


int main(){
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++){
		cout << "x";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
// {{{ include and macros
#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i, a, b) for(int i=a; i < b;i++)
#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <deque>
using namespace std;
// }}}

// {{{ io
void newline() {cout << endl;}
template <typename T>
void display(T input){cout << input;}
template <typename T>
void put(T input){display(input); newline();}
  // }}}

deque<string> v;

int solve(){
  int cnt=0;
  bool r=false, l=false;
  string prev=v.front();
  v.pop_front();
  while(!v.empty()){
    string now=v.front();
    v.pop_front();
    if(prev=="lu" && now=="ru" || prev=="ru" && now=="lu"){cnt++;}
    if(prev=="ld" && now=="rd" || prev=="rd" && now=="ld"){cnt++;}
    prev=now;
  }
  return cnt;
}

int main() {
  int n;
  while(cin >> n && n){
    rep(i, 0, n){
      string s; cin >> s;
      v.push_back(s);
    }
    put(solve());
  }
}

Measured memory_bytes: 3016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s;
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5]){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 256