akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const int mod = MOD9;
const int max_n = 200005;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}comb(max_n);
mint dp[3010][3010][3];
int main(){
    ll n,s;cin >> n >>s;
    vl a(n);rep(i,n)cin >> a[i];
    dp[0][0][0]=1;
    rep(i,n+1){
        rep(j,s+1){
            rep(k,2){
                dp[i][j][k+1]+=dp[i][j][k];
            }
            rep(k,3){
                if(j+a[i]<=s&&k==1)dp[i+1][j+a[i]][k]+=dp[i][j][k];
                dp[i+1][j][k]+=dp[i][j][k];
            }
        }
    }
    cout << dp[n][s][2] <<endl;
}

Measured memory_bytes: 215680
#include<stdio.h>
int main(void)
{
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	while(1){
		c=c-b;
		if(c<=0){
			printf("Yes\n");
			break;
		}
		a=a-d;
		if(a<=0){
			printf("No\n");
			break;
			}
		}
		return 0;
}		

Measured memory_bytes: 1624
#include<iomanip>
#include <string>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;
int main() {
  nin(n);
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  int ans=1000;
  for(int i=0;i<n;i++){
    int tmp=0;
    while(vec.at(i)%2==0){
      vec.at(i)=vec.at(i)/2;
      tmp++;
    }
    if(tmp<ans){
      ans=tmp;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
<?php
/**
 * ABC131
 * C - Anti-Division
 */

// $s = trim(fgets(STDIN));
// fscanf(STDIN, "%d %d", $a, $b);
// $n = array_map('intval', explode(' ', trim(fgets(STDIN))));

fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $d);

$result = $b + 1;
$result -= intdiv($b, $c);
$result -= intdiv($b, $d);
$result += intdiv($b, lcm($c, $d));

$result2 = $a;
$result2 -= intdiv($a - 1, $c);
$result2 -= intdiv($a - 1, $d);
$result2 += intdiv($a - 1, lcm($c, $d));


echo $result - $result2, PHP_EOL;

function lcm($a, $b) {
    $x = $a * $b;
    if ($a < $b) {
        $tmp = $a;
        $a = $b;
        $b = $tmp;
    }
    $r = $a % $b;
    while ($r != 0) {
        $a = $b;
        $b = $r;
        $r = $a % $b;
    }
    return intdiv($x, $b);
}


Measured memory_bytes: 4856
n = gets.chomp.split("").map(&:to_i)
n = n.reverse
n.push(0)
len = n.length
ans = 0
i = 0
while i <= len-1
  if n[i] <= 4
    ans += n[i]
  elsif n[i] > 5 && n[i] <10
    ans += 10-n[i]
    n[i+1] += 1
  elsif n[i] == 5
    if n[i+1] < 5
      ans += n[i]
    else
      ans += n[i]
      ans += 9 - n[i+1]
      n[i+2] += 1
      i += 1
    end
  else
    n[i+1] += 1
  end
  i += 1
end

puts ans

Measured memory_bytes: 73104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF=1e18,MOD=1e9+7;
int main(){
	int a,b,c,d;
	string s;
	cin>>a>>b;
	cin>>s;
	s[b-1]=(s[b-1]-'A')+'a';
	cout<<s<<endl;
}


Measured memory_bytes: 384
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;


int main(){
	int n;
	int x;
	cin>>n;
	map<int,int> mp1, mp2;
	for(int i=0;i<n;i++){
		cin>>x;
		if(i%2==0){
			mp1[x]++;
		}else{
			mp2[x]++;
		}
	}
	int max1=0;
	int max2=0;
	int max_v1=-1, max_v2=-2;
	int semi1=0;
	int semi2=0;
	for(auto itr = mp1.begin();itr != mp1.end();itr++){
		if(max1<itr->second){
			max_v1=itr->first;
		}
		max1 = max(max1, itr->second);
	}
	for(auto itr = mp1.begin();itr != mp1.end();itr++){
		
		if(itr->first!=max_v1){
			semi1 = max(semi1, itr->second);
		}
	}
	for(auto itr = mp2.begin();itr != mp2.end();itr++){
		if(max2<itr->second){
			max_v2=itr->first;
		}
		max2=max(max2, itr->second);
	}
	for(auto itr = mp2.begin();itr != mp2.end();itr++){
		
		if(itr->first!=max_v2){
			semi2 = max(semi2, itr->second);
		}
	}

//	cout<<max1<<" "<<max2<<endl;
	if(max_v1!=max_v2){
		cout<<n -max1-max2<<endl;
	}else {
		cout<<min(n-max1-semi2,n-max2-semi1)<<endl;
	}

	return 0;
}


Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int a[] = new int[n];

		// 入力を受け取りながら自分より左側の最大値も記録する
		int l_Max[] = new int[n];
		int pMax = 0;

		for ( int i = 0; i < n; i++ ) {
			l_Max[i] = pMax;
			a[i] = in.nextInt();

			if ( pMax < a[i] ) {
				pMax = a[i];
			}
		}

		// 右側最大値のリストを作る
		int r_Max[] = new int[n];
		pMax = 0;

		for ( int i = n - 1; 0 <= i; i-- ) {
			r_Max[i] = pMax;

			if ( pMax < a[i] ) {
				pMax = a[i];
			}
		}

		for ( int i = 0; i < n; i++ ) {
			int Max = l_Max[i] > r_Max[i] ? l_Max[i] : r_Max[i];
			System.out.println(Max);
		}

		in.close();
	}
}

Measured memory_bytes: 93760
l=[list(map(int,input().split())) for i in range(3)]
n=int(input())
H=[0,0,0]
W=[0,0,0]
S=[0,0]

for i in range(n):
    b=int(input())
    for h in range(3):
        for w in range(3):
            if b==l[h][w]:
                H[h]+=1
                W[w]+=1
                if h==w:
                    S[0]+=1
                if h+w==2:
                    S[1]+=1

check=False
for h in H:
    if h==3:
        check=True
for w in W:
    if w==3:
        check=True
for s in S:
    if s==3:
        check=True

if check:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38256
#include <stdio.h>
#include <stdlib.h>
#define MIN(x,y) ((x)<(y))?(x):(y)

int main(void) {
	int N,T,i,j,sa,min,cnt;
	int *a;
	
	scanf("%d %d",&N,&T);
	a = (int*)malloc(sizeof(int)*N);
	
	for (i = 0;i < N;i++) {
		scanf("%d",&a[i]);
	}
	
	sa = 0;
	cnt = 0;
	min = 1000000001;
	for (i = 0;i < N;i++) {
		min = MIN(min,a[i]);
		if (sa < a[i]-min) {
			sa = a[i]-min;
			cnt = 1;
		} else if (sa == a[i]-min) {
			cnt++;
		}
	}
	
	printf("%d\n",cnt);
	
	return 0;
}


Measured memory_bytes: 640
for i in range(input()):
    h, m = map(int, raw_input().split(':'))
    s_h = h*30 + m*0.5
    l_h = m*6
    angle = abs(l_h-s_h)
    if 360-angle < angle:
        angle = 360 - angle
    if 0 <= angle < 30:
        print 'alert'
    elif 30 <= angle < 90:
        print 'warning'
    elif 90 <= angle <= 180:
        print 'safe'

Measured memory_bytes: 4244
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string.h>
using namespace std;

int a[101];
void fun()
{
    for(int i=1;i<=9;i++)
    {
        for(int j=i;j<=9;j++)
            a[i*j]=1;
    }
}
int main()
{
    memset(a,0,sizeof(a));
    fun();
    int n;
    cin>>n;
    if(a[n]) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

	double ms, ml;
	double s[7]={35.50, 37.50, 40.00, 43.00, 50.00, 55.00, 70.00};
	double l[7]={71.00, 77.00, 83.00, 89.00, 105.00, 116.00, 148.00};
	char r[8][4]={"AAA", "AA", "A", "B", "C", "D", "E", "NA"};

	while(cin >> ms >> ml) {
		int ss=7, ll=7;
		for(int i=6; i>=0; i--) {
			if(ms<s[i]) {
				ss=i;
			}
		}
		for(int i=6; i>=0; i--) {
			if(ml<l[i]) {
				ll=i;
			}
		}

		if(ss<ll) {
			ss=ll;
		}

		cout << r[ss] << endl;
	}
	
	return 0;

}

Measured memory_bytes: 0
s = list(raw_input())
Q = input()
for q in range(Q):
    str_order = raw_input().split()
    a = int(str_order[1])
    b = int(str_order[2])
    if str_order[0] == 'print':
        print ''.join(s[a:b+1])
    elif str_order[0] == 'reverse':
        tmp = s[a:b+1]
        tmp.reverse()
        s[a:b+1] = tmp
    elif str_order[0] == 'replace':
        s[a:b+1] = list(str_order[3])

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

void MakeCostMinimum(int p, int q, int r)
{
    int minusone = q - p;

    if (minusone < 0)
    {
        minusone = minusone * (-1);
    }

    int minustwo = r - q;

    if (minustwo < 0)
    {
        minustwo = minustwo * (-1);
    }

    int minimumcost = (q - p) + (r - q);

    printf("%d\n", minimumcost);
}

void Compare3Figures(int a, int b, int c)
{
    if (b < a && a < c)
    {
        int tmp = a;
        a = b;
        b = tmp;
    }

    else if (b < a && c < b)
    {
        int tmptwo = a;
        a = c;
        c = tmptwo;
    }

    else if (a < b && c < b && a < c)
    {
        int tmpthree = b;
        b = c;
        c = tmpthree;
    }

    else if (a <= b && c <= a)
    {
        int tmpfour = a;
        a = c;
        c = b;
        b = tmpfour;
    }

    else if (b <= a && b <= c && c <= a)
    {
        int tmpfive = a;
        a = b;
        b = c;
        c = tmpfive;
    }

    else if (a == c && a < b)
    {
        int tmpsix = b;
        b = c;
        c = tmpsix;
    }

    //printf("%d, %d, %d\n", a, b, c);
    MakeCostMinimum(a, b, c);
}
int main(int argc, char *argv[])
{

    int A = 0;
    int B = 0;
    int C = 0;

    do
    {
        scanf("%d", &A);
    } while (A < 1 || 100 < A);

    do
    {
        scanf("%d", &B);
    } while (B < 1 || 100 < B);

    do
    {
        scanf("%d", &C);
    } while (C < 1 || 100 < C);

    Compare3Figures(A, B, C);
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
	int l,a,b,c,d,x,y;
	scanf("%d",&l);
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	if(a%c==0)	x=a/c;
	else if(a%c>0)	x=a/c+1;
	if(b%d==0)	y=b/d;
	else if(b%c>0)	y=b/d+1;
	if(x>=y)	printf("%d\n",l-x);
	else	printf("%d\n",l-y);
	return 0;
}



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

int main() {
  int N, M; cin >> N >> M;
  int sum = 0;
  int A[N];
  for(int i=0; i<N; i++) {
    cin >> A[i];
    sum+= A[i];
  }

  double border = (double)sum / (4 * M);
  int counter = N;
  for (int i=0; i<N; i++) {
    if((double)A[i] < border) counter--;
  }

  string ans = "Yes";
  if (counter < M) ans = "No";

  cout << ans << endl;

  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<bool> check(100'001, false);
    int cnt = 0;
    int tmp;
    for (int i = 0; i < n; i++){
        cin >> tmp;
        if (check[tmp]) cnt++;
        else check[tmp] = true;
    }
    cout << n - (cnt + 1) / 2 * 2 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<vector>
#include<math.h>
#include<iostream>
#include<map>
using namespace std;
char step[100010];
int feet1,feet2;
int ans1,ans2;
int charge(int now,int before,int feet)
{
    if(feet==1)
    {
        if(now<before)return 0;
    }
    else
    {
        if(now>before)return 0;
    }
    return 1;
}
int main()
{
    int i,j,k;
    int len;
    while(gets(step))
    {
        if(step[0]=='#')break;
        len=strlen(step);
        feet1=1;feet2=0;
        ans1=ans2=0;
        for(i=1;i<len;i++)
        {
            int now,before;
            now=step[i]-'0';
            before=step[i-1]-'0';
            while(now>3)now-=3;
            while(before>3)before-=3;
            if(charge(now,before,feet1)){feet1+=1;feet1%=2;}
            else ans1++;
            if(charge(now,before,feet2)){feet2+=1;feet2%=2;}
            else ans2++;
        }
        printf("%d\n",min(ans1,ans2));
    }
    return 0;
}

Measured memory_bytes: 1208
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>

using namespace std;

typedef long long ll;

ll mod = 1e9 + 7;

ll pow (ll x, ll n) {
  if (n == 0) return 1;
  if (n % 2 == 0) {
    ll d = pow(x, n/2);
    return (d * d) % mod;
  }
  return (x * pow(x, n-1)) % mod;
}

int main(){
  ll n, k;
  cin >> n >> k;

  ll memo[100001];
  ll ans = 0;
  for (int i = k; i >= 1; i--) {
    memo[i] = pow(k / i, n);
    for (int j = 2; i * j <= k; j++) {
      memo[i] = (memo[i] + mod - (memo[i*j]) % mod) % mod;
    }
    ans = (ans + (i * memo[i]) % mod) % mod;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4360
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=2000005;
int ra[N],rb[N],a[N],b[N],p[N],n,m,K,cnt;
set<int> s1,s2;
char s[N];

int main(){
	read(n),read(m),read(K);
	scanf("%s",s+1);
	rep(i,1,n) a[i]=s[n+1-i]-'0';
	scanf("%s",s+1);
	rep(i,1,m) b[i]=s[m+1-i]-'0';
	per(i,max(n,m),1){
		if(a[i]&&b[i]) p[++cnt]=i;
		else if(a[i]) s1.insert(i);
		else if(b[i]) s2.insert(i);
	}
	rep(i,1,cnt){
		int x=p[i],y=0;
		while(x&&y<K){
			auto it1=s1.lower_bound(x);
			auto it2=s2.lower_bound(x);
			int d1=(it1!=s1.end()?*it1-x-1:N);
			int d2=(it2!=s2.end()?*it2-x-1:N);
			int d=min(K-y,min(d1,d2));
			x+=d,y+=d;
			if(y==K) break;
			if(d1<d2){
				assert(*it1==x+1);
				int l=x+1,r=l; auto t=it1;
				while(t!=s1.end()&&*t==r) s1.erase(t++),r++;
				if(it2!=s2.end()&&*it2==r){
					x=r,s2.erase(it2);
				}
				else x=0,s1.insert(r);
				s2.insert(l);
			}
			else{
				assert(*it2==x+1);
				int l=x+1,r=l; auto t=it2;
				while(t!=s2.end()&&*t==r) s2.erase(t++),r++;
				if(it1!=s1.end()&&*it1==r){
					x=r,s1.erase(it1);
				}
				else x=0,s2.insert(r);
				s1.insert(l);
			}
			y++;
		}
		if(x) ra[x]=rb[x]=1;
	}
	for(auto x:s1) ra[x]=1;
	for(auto x:s2) rb[x]=1;
	int la=n+K,lb=n+K;
	while(!ra[la]) la--;
	while(!rb[lb]) lb--;
	per(i,la,1) putchar('0'+ra[i]);
	puts("");
	per(i,lb,1) putchar('0'+rb[i]);
	puts("");
	return 0;
}

Measured memory_bytes: 71552
a, b = map(int, input().split())

count = 0
for i in range(a, b + 1):
    l = list(str(i))
    up = l[:(len(l) // 2)]
    if len(l) % 2 == 0:
        down = l[len(l) // 2:]
        down.reverse()
    else:
        down = l[(len(l) // 2) + 1:]
        down.reverse()
    if up == down:
        count += 1

print(count)

Measured memory_bytes: 3064
n = int(input())
nums = map(int,input().split())
dics = {}
result = []
i = 1

for num in nums:
  dics[num] = i #num番目がi
  i += 1

for x in range(1,n+1):
  result.append(dics[x])
  
for p in result:
  print(p,end=" ")

Measured memory_bytes: 25068
n,m=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
mod=10**9+7
dp=[1]*(m+1)
for i in range(n):
    ndp=[0]*(m+1)
    ndp[0]=1
    for j in range(m):
        if s[i]==t[j]:
            ndp[j+1]=(ndp[j]+dp[j+1])%mod
        else:
            ndp[j+1]=(ndp[j]+dp[j+1]-dp[j])%mod
    dp=ndp
print(dp[-1])

Measured memory_bytes: 9384
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lower_bound lowb
#define upper_bound upb
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a*b/gcd(a,b);};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};

int dp[5050];

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

    int n;
    while(true) {
        cin >> n;
        if(!n) break;
        int a[n];
        rep(i, n) cin >> a[i];

        int ret = INT_MIN, nres = 0;
        rep(i, n) {
            if(nres < 0) nres = a[i];
            else nres += a[i];
            chmax(ret, nres);
        }

        cout << ret << endl;
    }
    return 0;
}


Measured memory_bytes: 3128
#include<stdio.h>
typedef long long ll;
ll solve(ll x,ll n) {
    ll ans;
    if(n%x==0)
        return n*2-x;
    ans=n/x*x*2+solve(n%x,x);
    return ans;
}
int main() {
    ll n,x;
    ll ans;
    scanf("%lld%lld",&n,&x);
    ans=solve(x,n-x)+n;
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h> 
using namespace std; 
int main()
{
	int k,a;
	string s;
	cin>>k>>s;
	a=s.size();
	if(a>k)
	{
		s=s.substr(0,k);
		cout<<s<<"...";
		return 0;
	}
	else
	{
		cout<<s;
		return 0;
	}
}

Measured memory_bytes: 3632
import java.io.*;

import java.math.BigInteger;
import java.util.*;

import java.util.ArrayList;

import java.util.Scanner;


class Main {

    /*static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static final int mod = 1000000007;

    public static int gcd(int a, int b)
    {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }
    public static boolean isPalindrome(String str)
    {

        // Pointers pointing to the beginning
        // and the end of the string
        int i = 0, j = str.length() - 1;

        // While there are characters toc compare
        while (i < j) {

            // If there is a mismatch
            if (str.charAt(i) != str.charAt(j))
                return false;

            // Increment first pointer and
            // decrement the other
            i++;
            j--;
        }

        // Given string is a palindrome
        return true;
    }*/
    public static void main(String[] args)
        {
            Scanner sc=new Scanner(System.in);



           int n=sc.nextInt();
           int a[]=new int[n];
           for(int i=0;i<n;i++)
               a[i]=sc.nextInt();
           int max=Integer.MAX_VALUE;
           int c=0;
           for(int j=0;j<n;j++)
           {
               if(a[j]<max)
               {
                   max=a[j];
                   c++;
               }
           }
               System.out.println(c);

        }
    }



Measured memory_bytes: 84984
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
#define MOD 1000000007

ll C[2019];

int main(){
    // Your code here!
    for(int i=0;i<2019;i++) C[i]=0;
    
    string s;
    cin>>s;
    int N = s.size();
    
    if(N<4){
      cout<<0<<endl;
      return 0;
    }
    
    vector<ll> R(N+1,0);
    ll d=1;
    
    for(int i=N-1; i>=0; i--){
      R[N-i] = (ll)(s[i]-48) * d % 2019;
      d *=10;
      d %= 2019;
    }
    
    //cout<<d<<endl;
    //for(int i=1;i<=N;i++) cout<<R[i]<<endl;
    
    for(int i=0; i<N; i++) {
      R[i+1] += R[i];
      R[i+1] %= 2019;
    }
    
    
    for(int i=0; i<=N; i++) C[R[i]]++;
    
    ll ans=0;
    for(int i=0;i<2019;i++){
      ans += C[i] * (C[i] - 1) /2;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5204
from collections import Counter


class UnionFind:
    def __init__(self, n):
        self.parents = [i for i in range(n + 1)]

    def root(self, i):
        if self.parents[i] == i:
            return i
        else:
            self.parents[i] = self.root(self.parents[i])
            return self.parents[i]

    def unite(self, i, j):
        self.parents[self.root(self.parents[i])] = self.root(j)

    def is_unite(self, i, j):
        return self.root(i) == self.root(j)


def solve(N, K, L, PQs, RSs):
    road_cities = UnionFind(N)
    train_cities = UnionFind(N)

    for p, q in PQs:
        road_cities.unite(p, q)
    for r, s in RSs:
        train_cities.unite(r, s)

    counts = Counter([
        (road_cities.root(i), train_cities.root(i))
        for i in range(1, N + 1)
    ])

    ans = [
        counts[(road_cities.root(i), train_cities.root(i))]
        for i in range(1, N + 1)
    ]

    return " ".join([str(c) for c in ans])


if __name__ == "__main__":
    N, K, L = map(int, input().split(" "))
    PQs = []
    RSs = []
    for _ in range(K):
        PQs.append(tuple(map(int, input().split(" "))))
    for _ in range(L):
        RSs.append(tuple(map(int, input().split(" "))))
    print(solve(N, K, L, PQs, RSs))


Measured memory_bytes: 85960
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
//static const long double pi = 3.1415926535897932;

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

char toSmall(char c) { // 大文字を小文字へ
	return (c + 0x20);
}

char toLarge(char c) { // 小文字を大文字へ
	return (c - 0x20);
}

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

ll combination(ll n, ll r) { // nCr の計算
	if (n < 0 || r < 0 || r > n) return -1;

	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> num(r);
	vector<ll> den(r);

	for (ll i = 0; i < r; i++) {
		num[i] = n - r + i + 1;
		den[i] = i + 1;
	}

	for (ll p = 2; p <= r; p++) {
		ll pivot = den[p - 1];
		if (pivot > 1) {
			ll offset = (n - r) % p;
			for (ll k = p - 1; k < r; k += p) {
				num[k - offset] /= pivot;
				den[k] /= pivot;
			}
		}
	}
	ll result = 1;
	for (ll k = 0; k < r; k++) {
		if (num[k] > 1) result *= num[k];
	}
	return result;
}

vector<string> split(const string& src, const char* delim = ",") { //カンマ区切り
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

bool check_int(string str)
{
	if (all_of(str.cbegin(), str.cend(), [](char ch) { return isdigit(ch);}))
	{
		return true;
	}
	return false;
}

struct rest {
	string s;
	int p;
	int num;

	/* -------------------------------------
	sort関数を使用したときのソートの定義をする。
	まずは文字列sでソートする。
	文字列sが同じだった場合、pでソートする。
	この条件を参考演算子で表現(ifでもOK)
	-------------------------------------*/
	bool operator<(const rest& right) const {
		return s == right.s ? p > right.p : s < right.s;
	}
};

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

Measured memory_bytes: 256
x = int(input())


def isPrime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    m = int(n**0.5)+1
    for p in range(3, m, 2):
        if n % p == 0:
            return False
    return True


while not isPrime(x):
    x += 1
print(x)

Measured memory_bytes: 9276
from sys import stdin
import sys
import math

# A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
# A, B = [int(x) for x in stdin.readline().rstrip().split()]
# U = input().split()
K = int(input())

A, B = [int(x) for x in stdin.readline().rstrip().split()]
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        sys.exit()
print("NG")
# A, B = [str(x) for x in stdin.readline().rstrip().split()]

# print("YES")
# print("NO")


Measured memory_bytes: 9104
class fenwick_tree(object):
    def __init__(self, n):
        self.n = n
        self.data = [0] * n

    def __sum(self, r):
        s = 0
        while r > 0:
            s += self.data[r - 1]
            r -= r & -r
        return s

    def add(self, p, x):
        """ a[p] += xを行う"""
        assert 0 <= p and p < self.n
        p += 1
        while p <= self.n:
            self.data[p - 1] += x
            p += p & -p

    def sum(self, l, r):
        """a[l] + a[l+1] + .. + a[r-1]を返す"""
        assert 0 <= l and l <= r and r <= self.n
        return self.__sum(r) - self.__sum(l)


if __name__ == "__main__":
    import sys
    input = sys.stdin.buffer.readline
    sys.setrecursionlimit(10 ** 7)
    N, Q = map(int, input().split())
    A = list(map(int, input().split()))

    fw = fenwick_tree(N)
    for i, a in enumerate(A):
        fw.add(i, a)

    for _ in range(Q):
        t, u, v = map(int, input().split())
        if t == 0:
            fw.add(u, v)
        else:
            print(fw.sum(u, v))

Measured memory_bytes: 58856
#include <iostream>
#include <string>
#include <vector>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
    int X,Y,Z;
    cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << endl;
}

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

int main() {

	string s; cin >> s;
	string t; cin >> t;
	int c = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i]) c++;
	}
	cout << c << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

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

int main() {
	int h, w;
	cin >> h >> w;
	int cnt = 0;
	vector<vector<char>> mp(h, vector<char>(w));
	rep(i, h) {
		rep(j, w) {
			cin >> mp[i][j];
			if (mp[i][j] == '.') cnt++;
		}
	}
	vector<vector<int>> dis(h, vector<int>(w, INF));
	dis[0][0] = 0;
	queue<pair<int, int>> que;
	que.push({ 0, 0 });
	while (que.size()) {
		int a = que.front().first;
		int b = que.front().second;
        que.pop();
		rep(i, 4) {
			int nx = a + dx[i];
			int ny = b + dy[i];
			if (nx >= 0 && nx < h && ny >= 0 && ny < w && mp[nx][ny] == '.' && dis[nx][ny] == INF) {
				dis[nx][ny] = dis[a][b] + 1;
				que.push({ nx,ny });
			}
		}
	}
	if (dis[h - 1][w - 1] == INF) {
		cout << -1 << endl;
	}
	else {
		cout << cnt - dis[h - 1][w - 1] - 1 << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define sz size()
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)

#define ll long long

int main() {

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

    // freopen("input.in","r",stdin);

	int n,k;
	string s;
	cin>>s;
	n = s.size();
	int r = 0;

	int max1 = 0;
	int i;
	for (i=0;i<n;i++) {
		if (s[i] == 'R') {
			r++;
		} else {
			if (r>max1) {
				max1 = r;
			}
			r = 0;
		}
	}
	if (r>max1) {
		max1 = r;
	}

	cout<<max1<<"\n";

    return 0;
}

Measured memory_bytes: 3644
number = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(number[K-1])

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main() {
    int n;
    int max;
    int min;

    cin>>n;
    cin>>min;
    for(int i = 0; i < n-1; i++){
        int r;
        cin>>r;
        int tmp=r-min;
        if(i == 0 || max<tmp){
            max=tmp;
        }
        if(r<min){
            min=r;
        }
    }
    cout<<max<<endl;
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

int whatKindOf(std::string);

int main()
{
	int n;
	std::string str;
	std::cin >> n;
	for(int i=0; i<n; i++){
		std::cin >> str;
		std::cout << whatKindOf(str) << std::endl;
		for(unsigned int i=0; i<str.length(); i++) str[i] = '\0';
	}
	return 0;
}

int whatKindOf(std::string str)
{
	unsigned int i, len=str.length();
	bool exist = false;
	std::string t1,
		t1_r,
		t2,
		t2_r,
		str2;
	std::vector<std::string> buf;
	std::vector<std::string>::iterator itr, end;
	buf.push_back(str);
	for(i=1; i<len; i++){
		t1 = str.substr(0, i);
		t1_r = t1;
		t2 = str.substr(i, len-i);
		t2_r = t2;
		std::reverse(t1_r.begin(), t1_r.end());
		std::reverse(t2_r.begin(), t2_r.end());

		str2 = t2+t1;
		for(itr = buf.begin(); itr!= buf.end(); itr++)
			if(*itr==str2){
				exist = true;
				break;
			}
		if(exist) exist = false;
		else buf.push_back(str2);

		str2 = t1_r+t2;
		for(itr = buf.begin(); itr!= buf.end(); itr++)
			if(*itr==str2){
				exist = true;
				break;
			}
		if(exist) exist = false;
		else buf.push_back(str2);

		str2 = t2+t1_r;
		for(itr = buf.begin(); itr!= buf.end(); itr++)
			if(*itr==str2){
				exist = true;
				break;
			}
		if(exist) exist = false;
		else buf.push_back(str2);

		str2 = t1+t2_r;
		for(itr = buf.begin(); itr!= buf.end(); itr++)
			if(*itr==str2){
				exist = true;
				break;
			}
		if(exist) exist = false;
		else buf.push_back(str2);

		str2 = t2_r+t1;
		for(itr = buf.begin(); itr!= buf.end(); itr++)
			if(*itr==str2){
				exist = true;
				break;
			}
		if(exist) exist = false;
		else buf.push_back(str2);

		str2 = t1_r+t2_r;
		for(itr = buf.begin(); itr!= buf.end(); itr++)
			if(*itr==str2){
				exist = true;
				break;
			}
		if(exist) exist = false;
		else buf.push_back(str2);

		str2 = t2_r+t1_r;
		for(itr = buf.begin(); itr!= buf.end(); itr++)
			if(*itr==str2){
				exist = true;
				break;
			}
		if(exist) exist = false;
		else buf.push_back(str2);
	}
	return buf.size();
}

Measured memory_bytes: 1284
N,M = map(int,input().split())
A = [0 for _ in range(N+1)]
B = [1 for _ in range(N+1)]
A[1] = 1
B[0] = 0
for _ in range(M):
    x,y = map(int,input().split())
    if A[x]==1:
        A[y]=1
    B[y] += 1
    B[x] -= 1
    if B[x]==0:
        A[x] = 0
print(sum(A))

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

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

    int n;
    cin >> n;
    
    vector<pair<int, int>> as;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        as.emplace_back(a, i);
    }

    sort(as.begin(), as.end());
    for (int i = 0; i < n; i++) {
        cout << as[i].second + 1 << ' ';
    }
}


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

int dfs(int v, vector<set<int>> &g, vector<int> &dp){
    if(v == 0) return 0;
    if(dp[v]) return dp[v];
    int res = dfs(v-1,g,dp);
    for(int to : g[v]){
        res = max(res,v-to + dfs(to,g,dp));
    }
    return dp[v] = res;
}

int main(void){
    int n;
    while(cin>>n, n){
        vector<int> w(n+1);
        rep1(i,n) cin>>w[i];
        w[0] = -1;

        // i番目が消える時に右側に会わせられるブロックのindexの集合
        vector<set<int>> g(n+1);
        rep1(i,n){
            if(abs(w[i]-w[i-1]) <= 1){
                g[i] = g[i-2];
                g[i].insert(i-2);
            }
            for(int l : g[i-1]){
                if(abs(w[i]-w[l]) <= 1){
                    for(int ll : g[l-1]){
                        g[i].insert(ll);
                    }
                    g[i].insert(l-1);
                }
            }
        }
        vector<int> dp(n+1);
        cout<<dfs(n,g,dp)<<endl;
    }
    return 0;
}



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

using namespace std;

int keta(int n){
  int count = 0;
  while(n > 0){
    n = n/10;
    count++;
  }
  return count;
}

int main(){
  int N;
  cin >> N;
  int count = 0;
  for(int i = 1; i <= N; i++){
    int p = keta(i);
    if(p%2 == 1) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define All(v) v.begin(),v.end()
typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

int ok( int x, int y )
{
  if( 0 <= x && 0 <= y && x <= 10 && y <= 10 ) return 1;
  else return 0;
}

main()
{
  int x, y, s;
  int data[11][11] = {{0}};
  while( scanf("%lld,%lld,%lld", &x, &y, &s) != EOF ) {
    //cout << x << " " << y << " " << s << endl;
    if( s == 1 ) {
      if( ok(x, y) )   data[y][x]++;
      if( ok(x, y-1) ) data[y-1][x]++;
      if( ok(x+1, y) ) data[y][x+1]++;
      if( ok(x, y+1) ) data[y+1][x]++;
      if( ok(x-1, y) ) data[y][x-1]++;
    }

    if( s == 2 ) {
      if( ok(x, y) )     data[y][x]++;
      if( ok(x, y-1) )   data[y-1][x]++;
      if( ok(x+1, y-1) ) data[y-1][x+1]++;
      if( ok(x+1, y) )   data[y][x+1]++;
      if( ok(x+1, y+1) ) data[y+1][x+1]++;
      if( ok(x, y+1) )   data[y+1][x]++;
      if( ok(x-1, y+1) ) data[y+1][x-1]++;
      if( ok(x-1, y) )   data[y][x-1]++;
      if( ok(x-1, y-1) ) data[y-1][x-1]++;
    }

    if( s == 3 ) {
      if( ok(x, y) )     data[y][x]++;
      if( ok(x, y-1) )   data[y-1][x]++;
      if( ok(x+1, y-1) ) data[y-1][x+1]++;
      if( ok(x+1, y) )   data[y][x+1]++;
      if( ok(x+1, y+1) ) data[y+1][x+1]++;
      if( ok(x, y+1) )   data[y+1][x]++;
      if( ok(x-1, y+1) ) data[y+1][x-1]++;
      if( ok(x-1, y) )   data[y][x-1]++;
      if( ok(x-1, y-1) ) data[y-1][x-1]++;
      
      if( ok(x, y-2) )     data[y-2][x]++;
      if( ok(x+2, y) )     data[y][x+2]++;
      if( ok(x, y+2) )     data[y+2][x]++;
      if( ok(x-2, y) )     data[y][x-2]++;
    }
    
  }

  int cnt = 0;
  int ma = 0;
  Rep(i, 10) Rep(j, 10) {
    if( !data[i][j] ) cnt++;
    ma = max(ma, data[i][j]);
  }

  cout << cnt << endl << ma << endl;
  
}

Measured memory_bytes: 3148
#include<stdio.h>
int main () {
	int a, b, x = 0;
	scanf("%d %d", &a, &b);
	for(int i = 0; i < 2; ++i){
		if(a >= b){
			x += a;
			a--;
		}else{
			x += b;
			b--;
		}
	}
	printf("%d\n", x);
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S;
int N,K;

const ll mo=998244353;


ll from[303][306];
ll to[303][306];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S>>K;
	vector<int> V;
	V.push_back(0);
	
	int sum=0;
	FORR(c,S) {
		if(c=='1') V.back()++, sum++;
		else V.push_back(0);
	}
	K=min(K,sum);
	N=V.size();
	
	from[K][0]=1;
	FOR(y,V.size()) {
		int v=V[y];
		ZERO(to);
		for(j=K;j>=0;j--) {
			for(i=0;i<=sum;i++) if(from[j][i]) {
				for(int tar=0;tar<=min(v+j,sum);tar++) {
					if(y==V.size()-1 && tar>v) break;
					if(tar<=v) {
						if(i+(tar-v)>=0) (to[j][i+(tar-v)]+=from[j][i])%=mo;
					}
					else {
						(to[j-(tar-v)][i+(tar-v)]+=from[j][i])%=mo;
					}
				}
			}
		}
		swap(from,to);
	}
	
	ll ret=0;
	FOR(i,K+1) ret+=from[i][0];
	cout<<ret%mo<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 5024
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define RREP(i, n) for (long long i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define RFOR(i, start, end) for (long long i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int a;
    string s;
    cin >> a >> s;
    if (3200 <= a) {
        print(s);
    } else {
        print("red");
    }

    return 0;
}

Measured memory_bytes: 256
//Author : Prakhar Asaiya
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define REPN(i,a,b) for(ll i = a; i <= b; ++i)
#define REPV(i,a,b) for(ll i = a; i >= b; --i)
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define with_tests int t; cin>>t; while(t--){ solve(); }
#define without_tests solve();
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 100000000
#define ff first
#define ss second
const int M=1e9+7;

void solve()
{
	string s;
	cin>>s;
	if(s.back() == 's')
	{
		s += "es";
		cout<<s<<"\n";
	}
	else
	{
		s += 's';
		cout<<s<<"\n";
	}
}
 
int main()
{/*
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#*/
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  //with_tests;
  without_tests;
  return 0;
}

Measured memory_bytes: 3668
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [N, A, B] = input[0].map(Number);

  return Math.min(A * N, B);
};

console.log(main(read()));


Measured memory_bytes: 29416
import java.util.*;
class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    String[] s=new String[n];
    int[] p=new int[n];
    int[] ans=new int[n];
    for(int i=0;i<n;i++){
      s[i]=sc.next();
      p[i]=sc.nextInt();
      ans[i]=i+1;
    }
    int inttmp;
    String strtmp;
    for(int i=0;i<n;i++){
      for(int j=1;j<n;j++){
        if(s[j-1].compareTo(s[j])>0||(s[j-1].compareTo(s[j])==0&&p[j-1]<p[j])){
          strtmp=s[j-1];
          s[j-1]=s[j];
          s[j]=strtmp;
          inttmp=p[j-1];
          p[j-1]=p[j];
          p[j]=inttmp;
          inttmp=ans[j-1];
          ans[j-1]=ans[j];
          ans[j]=inttmp;
        }
      }
    }
    for(int i=0;i<n;i++){
      System.out.println(ans[i]);
    }
  }
}


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

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define MP make_pair
#define PB push_back

const int MAX = 1e5+10;

int parent[MAX*2];
int rankb[MAX*2];
 
void init(int x) {
    for(int i = 0; i <= x; i++) {
        parent[i] = i;
        rankb[i] = 0;
    }
}
 
int root(int x) {
    return (parent[x]==x) ? x : parent[x]=root(parent[x]);
}
 
bool same(int x, int y) {
    return root(x) == root(y);
}
 
void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return;

    if (rankb[x] < rankb[y])
        parent[x] = y;
    else {
        parent[y] = x;
        if (rankb[x] == rankb[y]) rankb[x]++;
    }
}

int N;
map<int, ll> ver, hor;

int main() {
    cin >> N;
    init(MAX*2);
    REP (i, N) {
        int x, y;
        cin >> x >> y;
        unite(x, y+MAX);
    }

    set<int> s;
    REP (i, MAX) {
        ver[root(i)]++;
        hor[root(i+MAX)]++;
    }

    ll ans = -N;
    REP (n, 2*MAX) {
        ans += 1ll * ver[n] * hor[n];
    }
    cout << ans << endl;
}

Measured memory_bytes: 26752
MOD = 10**9 + 7
N, M = map(int,input().split())
a = set(int(input()) for _ in range(M))
dp = [0] * (N+1)
dp[0] = 1

for i in range(1, N+1):
    if i not in a and i > 1:
        dp[i] = (dp[i-1] + dp[i-2]) % MOD
    elif i not in a and i == 1:
        dp[i] = dp[i-1]
print(dp[-1])


Measured memory_bytes: 11884
//It’s never too late to become what you might have been....
 #include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf 1000000000000
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define S second
#define F first
#define boost1 ios::sync_with_stdio(false);
#define boost2 cin.tie(0);
#define mem(a,val) memset(a,val,sizeof a)
#define endl "\n"
#define maxn 100001

int main()
{
	boost1;boost2;	
	string s;
	ll ans=0,i,ctr=0;
	cin>>s;
	ans=s.length();
	for(i=s.length()-1;i>=0;i--)
	{
		if(s[i]=='T')
		ctr++;
		else
		{
			if(!ctr)
			continue;
			ctr--;
			ans-=2;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << "\n"
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

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

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  double n, m, d;
  cin >> n >> m >> d;

  double ans = 1.0;
  if (d == 0)
    ans *= n / pow(n, 2);
  else
    ans *= (n - d) * 2 / pow(n, 2);
  ans *= (m - 1);
  cout << ans << "\n";
}

Measured memory_bytes: 256
def resolve():
  N, K = list(map(int, input().split()))
  V = list(map(int, input().split()))
  r = 0
  for i in range(min(N,K)+1):
    for j in range(min(N-i,K-i)+1):
      a = V[:i]+V[N-j:]
      b = [x for x in a if x<0]
      b.sort()
      rij = sum(a)-sum(b[:K-i-j])
      r = max(r, rij)
  print(r)
resolve()

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	static boolean[][] connected;
	static boolean[] arrived;
	static int ans = 0;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		// make a map
		connected = new boolean[n][n];
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt() - 1; // start at 0
			int b = sc.nextInt() - 1;
			connected[a][b] = true;
			connected[b][a] = true;
		}

		arrived = new boolean[n];
		serch(arrived, 0);

		System.out.println(ans);

		sc.close();
	}

	// serch
	static void serch(boolean[] arrived, int arrive) {
		if (arrived[arrive]) {
			return;
		} else {
			arrived[arrive] = true;
		}

		if (isAccomplish(arrived)) {
			ans++;
			return;
		}

		for (int i = 0; i < connected.length; i++) {
			if (connected[arrive][i]) {
				serch(copyArray(arrived), i);
			}
		}
	}

	// copy a array
	static boolean[] copyArray(boolean[] arr1) {

		boolean[] arr2 = new boolean[arr1.length];
		for (int i = 0; i < arr1.length; i++) {
			arr2[i] = arr1[i];
		}

		return arr2;
	}

	// check accomplish
	static boolean isAccomplish(boolean[] arr) {
		for (int i = 0; i < arr.length; i++) {
			if (!arr[i]) {
				return false;
			}
		}
		return true;
	}

}


Measured memory_bytes: 24404
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int a[3],b[3],c[3],h,m,s,t;
  for(i=0;i<3;i++){
    cin>>h>>m>>s;
    t=h*3600+m*60+s;
    cin>>h>>m>>s;
    t=h*3600+m*60+s-t;
    a[i]=t/3600;
    b[i]=t%3600/60;
    c[i]=t%60;
  }
  for(i=0;i<3;i++)
    cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<endl;
  return 0;
}

Measured memory_bytes: 0
/* *
 *
 * Author: Hamkor
 *
 * */
 
#include <bits/stdc++.h>
 
using namespace std;
 
/* * * *   * * *   	* * * */
typedef long long ll;
const int oo = 1e9;
const ll mod = 100000000;
typedef complex<ll> P;
#define X real()
#define Y imag()
/* * * *   * * *   	* * * */
 
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int d; cin>>d;
	if (d == 25)cout<<"Christmas";
	else if (d == 24)cout<<"Christmas Eve";
	else if (d == 23)cout<<"Christmas Eve Eve";
	else cout<<"Christmas Eve Eve Eve";
	return 0;
}


Measured memory_bytes: 256