akhauriyash/Code-Regression huggingface dataset:
/*

                              Jai Shree Krishna !!
                                 Radhe Radhe !!
                                 
             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
             
*/
   
   
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vvi vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
#define ins insert
#define rep(i,s,e)   for(int i=s;i<=e;i++)
#define repd(i,s,e)  for(int i=e;i>=s;i--)
#define vb vector<bool>
#define read2(n,m) int n,m; cin >> n >> m;
#define range(v) v.begin(),v.end()
#define sortd(v) sort(v.begin(),v.end(),greater<int>())
#define sorti(v) sort(v.begin(),v.end())

const ll inf = 1e18;
const ll mod = 1e9 + 7;
 
signed main()
{
 
    fast;
    int a,b,n;
    cin >> a >> b >> n;
    if(b>n){
    	int ans = (a*n)/b;
    	cout<<ans<<endl;
    }
    else if(b<=n) {
    	n=b-1;
    	int ans = (a*n)/b;
    	cout<<ans<<endl;
    }
    
    return 0;
}

/* Pooja Yadav */

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i <= n; i++)
#define FORR(i, m, n) for(ll i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n)
#define MAX 100000
#define inf 1000000007
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

int main() {
    //cin高速化
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    ll k;
    cin >> k >> s;
    ll num = s.size();
    if(num<=k)cout << s <<"\n";
    else{
        s = s.substr(0, k);
        cout << s << "..." <<"\n";
    }
	return 0;
}

Measured memory_bytes: 3656
dy = [0, 0, 1, -1]
dx = [1, -1, 0, 0]


def bfs(start, goal):
    q = [[start]]
    while len(q) > 0:
        path = q.pop(0)
        n = path[len(path) - 1]
        if n == goal:
            return path
        else:
            for sy, sx in zip(dy, dx):
                py = n[0] + sy
                px = n[1] + sx
                if py < 0 or H <= py:
                    continue
                if px < 0 or W <= px:
                    continue
                if S[py][px] == "#":
                    continue
                if visited[py][px]:
                    continue
                visited[py][px] = True
                x = (py, px)
                if x not in path:
                    new_path = path[:]
                    new_path.append(x)
                    q.append(new_path)
    return None


H, W = map(int, input().split())
S = []
for i in range(H):
    S.append([c for c in input()])
# print(S)
visited = [[False for _ in range(W)] for _ in range(H)]
start = (0, 0)
goal = (H-1, W-1)
ans = bfs(start, goal)
if ans is None:
    print(-1)
    exit()
# print(ans)
counter = 0
for i in range(H):
    for j in range(W):
        if (i, j) in ans:
            continue
        if S[i][j] == ".":
            counter += 1
print(counter)


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

int main(){
  ll a,b;
  string ans;
  cin >> a >> b;
  if(a < b){
    rep(i,b){
      ans = ans + to_string(a);
    }
  }
  else{
    rep(i,a){
      ans = ans + to_string(b);
    }
  }
  cout << ans << endl;
}




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

using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define sz(s) (int)s.size()

int main() {
    int n, bw;
    cin >> n >> bw;
    unordered_map<int, int> dp;
    dp[0] = 0;
    rep(i, 0, n) {
        int w, v;
        cin >> w >> v;
        unordered_map<int, int> ndp = dp;
        for (auto p : dp)
            if (p.first + w <= bw) ndp[p.first + w] = max(ndp[p.first + w], p.second + v);
        dp.swap(ndp);
    }
    int ans = 0;
    for (auto p : dp) ans = max(ans, p.second);
    cout << ans << '\n';
}

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

int main()
{
    int N,ar[2][100],sum=0,max=-1;
    cin >> N;
    for(int i=0; i<2; i++){
        for(int j=0; j<N; j++){
            cin >> ar[i][j];
        }
    }
    for(int i=0; i<N; i++){
        sum = 0;
        for(int j=0; j<=i; j++){
            sum += ar[0][j];
        }
        for(int k=i; k<N; k++){
            sum += ar[1][k];
        }
        if(sum > max){
            max = sum;
        }
    }
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
//　10min
int main(void){
  int a, b, c, d;
  int ans = 0;
  int start = 0;
  int fin = 0;

  scanf("%d%d%d%d", &a, &b, &c, &d);

  if(a > c){
    start = a;
  }else{
    start = c;
  }

  if(b > d){
    fin = d;
  }else{
    fin = b;
  }

  ans = fin - start;
  if(ans < 0){
    ans = 0;
  }
  printf("%d\n", ans);
  
  return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#include <unordered_set>

#define _CRT_SECURE_NO_WARNINGS

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

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

using LL = long long int;
using LD = long double;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

void out(int h, int w, vs s, char x) {
	REP(i, h) {
		REP(j, w) {
			cout << ((s[i][j] == x || s[i][j] == '#') ? '#' : '.');
		}
		cout << endl;
	}
}

void solve(int h, int w, vs s) {
	REP(i, w) {
		s[0][i] = 'A';
		s[h - 1][i] = 'B';
	}

	REP(i, h) {
		REP(j, w) {
			if (s[i][j] == '.') s[i][j] = "AB"[j % 2];
		}
	}

	out(h, w, s, 'A');
	cout << endl;
	out(h, w, s, 'B');
}

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

	int h, w;
	cin >> h >> w;
	vs s(h);
	REP(i, h) cin >> s[i];

	solve(h, w, s);
	return 0;
}

Measured memory_bytes: 1540
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define F first
#define S second
#define INF 1 << 30

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int N, M;

bool cmp(const pi &a, const pi &b){
  return a.S > b.S;
}

int main(){
  int D, P;
  while(scanf("%d%d", &N, &M) && N+M){
    vector<pi>p(N);
    ll res = 0;
    rep(i, N){
      scanf("%d%d", &D, &P);
      p[i] = make_pair(D, P);
      res += D*P;
    }

    sort(p.begin(), p.end(), cmp);

    rep(i, N){
      //      printf("%lld %d %d\n", res, p[i].F, p[i].S);
      if(p[i].F >= M){
	res -= M * p[i].S;
	M = 0;
      }else{
	res -= p[i].F * p[i].S;
	M -= p[i].F;
      }
      if(M == 0) break;
    }
    printf("%lld\n", res);
  }
  return 0;
}

Measured memory_bytes: 1268
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7



int main() {
	

	int N, A[30], B[30], C[30];
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
		A[i]--;
	}
	for (int i = 0; i < N; i++) {
		scanf("%d", &B[i]);
	}
	for (int i = 0; i < N-1; i++) {
		scanf("%d", &C[i]);
	}

	int ans = 0;

	for (int i = 0; i < N; i++) {
		ans += B[i];
	}
	for (int i = 0; i < N - 1; i++) {
		if (A[i + 1] - A[i] == 1) {
			ans += C[A[i]];
		}
	}

	printf("%d",ans);






}






Measured memory_bytes: 128
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();

    writeln(0);
    stdout.flush();
    auto s = sread();
    if (s == "Vacant")
        return;
    long z = (s == "Male") ? 0 : 1;
    long ok = 0;
    long ng = N - 1;

    while (1 < (ng - ok))
    {
        long x = (ok + ng) / 2;
        writeln(x);
        stdout.flush();
        s = sread();
        if (s == "Vacant")
            return;
        long g = (s == "Male") ? 0 : 1;
        if ((x & 1) == (z ^ g))
        {
            ok = x;
        }
        else
        {
            ng = x;
        }
    }
    writeln(ng);
    stdout.flush();
    s = sread();
    if (s == "Vacant")
        return;
}


Measured memory_bytes: 852
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
const int IINF = 1000000000;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){

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

    int N, H, W; cin >> N >> H >> W;
    int ans = 0;
    rep(i,N){
        rep(j,N){
            if (i+H-1 >= N || j+W-1 >= N) continue; 
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  long int j;
  cin>>j;
  long int ans=0;
  for(long int i=0;i<=j;i++){
    if(i%3!=0 && i%5!=0){
      ans+=i;
    }
    else{
      int unko=0;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back

const int MOD=1e9+7;
const int MAX=1e6+5;
vll modfac(MAX,1);

ll modpow(ll m,ll n,ll p) {
  if(n==0) return 1;
  ll res=modpow(m,n/2,p);
  if(n%2==0) res=(res*res)%p;
  else res=(((res*res)%p)*m)%p;
  return res;
}

ll modinv(ll m,ll p) {
  return modpow(m,p-2,p);
}

ll modcom(ll n,ll r,ll p) {
  return ((modfac[n]*modinv(modfac[r],p))%p*modinv(modfac[n-r],p))%p;
}

int main() {
  ll x,y; cin>>x>>y;
  ll ans=0;

  for(ll i=1;i<=MAX;i++) {
    modfac[i]=modfac[i-1]*i%MOD;
  }

  for(ll i=0;i<=min(x/2,y);i++) {
    if(y-i==2*(x-2*i)) {
      ans+=modcom(i+(y-i)/2,i,MOD);
      ans%=MOD;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 11012
import itertools

N, M = [int(i) for i in input().split()]
KS = []
for _ in range(M):
    KS.append(tuple([int(i) for i in input().split()]))
P = tuple([int(i) for i in input().split()])

ans = 0
for t in itertools.product([0, 1], repeat=N):
    for m in range(M):
        if sum(t[x - 1] for x in KS[m][1:]) % 2 != P[m]:
            break
    else:
        ans += 1
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000

int main(){
  string s;
  cin >> s;
  string s1 = "dream",s2 = "dreamer",s3 = "erase",s4 = "eraser";
  bool judge = true;
  reverse(s.begin(),s.end());
  reverse(s1.begin(),s1.end());
  reverse(s2.begin(),s2.end());
  reverse(s3.begin(),s3.end());
  reverse(s4.begin(),s4.end());
  while(s.size() > 0){
    if(s.find(s1) == 0){
      s.erase(0,5);
    }
    else if(s.find(s2) == 0){
      s.erase(0,7);
    }
    else if(s.find(s3) == 0){
      s.erase(0,5);
    }
    else if(s.find(s4) == 0){
      s.erase(0,6);
    }
    else{
      judge = false;
      break;
    }
  }
  if(judge){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 512
def collatz(a):
    if a % 2 == 1:
        return 3*a+1
    return a/2


s = int(input())
memory = dict()

n = s
count = 1
while True:
    if n in memory.keys():
        break

    memory[n] = True
    n = collatz(n)
    count += 1

print(count)


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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1010;
const ll INF = 1LL << 60;

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



// Main Code
int findans(vector<int> powers, int e) {
    int cnt = 0;
    for (int p : powers) {
        if (p >= e - 1) cnt++;
    }
    return cnt;
}
 
int main() {
    int n;
    cin >> n;
    vector<int> powers(n + 1, 0);
    repn(i, 2, n)
    {
        int num = i;
        for (int k = 2; k * k <= num; k++) {
            while (num % k == 0) {
                num /= k;
                powers[k]++;
            }
        }
        if (num > 1) powers[num]++;
    }
  
    int ans = 0;
    ans += findans(powers, 75);
    ans += findans(powers, 25) * (findans(powers, 3) - 1);
    ans += findans(powers, 15) * (findans(powers, 5) - 1);
    ans += findans(powers, 5) * (findans(powers, 5) - 1) * (findans(powers, 3) - 2) / 2;
    cout<<ans<<endl;
	
}


Measured memory_bytes: 256
#include <stdio.h>

#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

#define N 200010
#define MAX 1000000000000000000
#define MOD 1000000007

#include <stdio.h>

int main (void) {
    unsigned int n, i;
    long sum = 0;

    scanf("%u", &n);

    for (i = 0; i <= n; i++) {
        if (i % 3 == 0 || i % 5 == 0) {
            // nop
        } else {
            sum += i;
        }
    }

    printf("%ld", sum);

    return 0;
}



Measured memory_bytes: 1728
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

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

bool solve2(vector<int>& a){
	
	int nokori = 0;
	rep(i,10)nokori += a[i];
	if(nokori==0){
		return true;
	}
	
	bool ok = false;
	rep(i,10-2){
		if(a[i]>0 && a[i+1]>0 && a[i+2]>0){
			a[i]--;a[i+1]--;a[i+2]--;
			if(solve2(a))ok=true;
			a[i]++;a[i+1]++;a[i+2]++;
		}
	}
	
	rep(i,10){
		if(a[i]>=3){
			a[i]-=3;
			if(solve2(a))ok=true;
			a[i]+=3;
		}
	}
	
	/*
	if(nokori==12){
		printf("!!! ");
		rep(i,a.size())printf("%d-%d ",i,a[i]);printf(" = %d\n",ok);
	}*/
	return ok;
}

bool solve(string a){
	
	vector<int> sum(10);
	rep(i,a.size())sum[a[i]-'0']++;
	
	/*
	rep(i,sum.size()){
		printf("%d-%d ",i,sum[i]);
	}puts("");
	*/
	bool ok = false;
	rep(i,10){
		if(sum[i]>=2){
			sum[i]-=2;
			bool ck = solve2(sum);
			sum[i]+=2;
			
			if(ck==true)ok=true;
		}
	}
	
	rep(i,10)if(sum[i]>4)ok=false;
	
	return ok;
}

int main(){
	
	string s;
	while(cin>>s){
		string a;
		bool flg = false;
		vector<int> lis;
		reps(i,1,10){
			a=s+char('0'+i);
			
			if(solve(a)){
				lis.push_back(i);
			}
		}
		if(lis.size()==0)printf("0");
		rep(i,lis.size()){
			if(i!=0)printf(" ");
			printf("%d",lis[i]);
		}puts("");
	}
}

Measured memory_bytes: 1208
C=[None for i in range(3)]
for i in range(3):
  C[i]=list(map(int,input().split()))

ok=True

for p in range(2):
  diff=[0]*3
  for i in range(3):
    diff[i]=C[i][p+1]-C[i][p]
  if len(set(diff))>1:
    ok=False
  
for p in range(2):
  diff=[0]*3
  for i in range(3):
    diff[i]=C[p+1][i]-C[p][i]
  if len(set(diff))>1:
    ok=False

print(("No","Yes")[ok])


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

int A, B, C, D;

string ANS(void) {

	while (1) {

		C -= B;
		if (C <= 0) { return "Yes"; }

		A -= D;
		if (A <= 0) { return "No"; }
	}

	return "";
}

int main(void) {

	cin >> A >> B >> C >> D;

	cout << ANS() << endl;


	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <istream>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <climits>
using namespace std;

typedef ostringstream OSS;
typedef istringstream ISS;

typedef vector<int> VI;
typedef vector< VI > VVI;

typedef long long LL;

typedef pair<int, int> PII;
typedef vector<PII> VPII;

#define X first
#define Y second

int count(string heystack, string needle) {
	int N = heystack.size();
	int cnt = 0;

	for (int i = 0; i + needle.size() <= N; i++) {
		cnt += heystack.substr(i, needle.size()) == needle;
	}

	return cnt;
}

int main(void) {
	string s;
	while (cin >> s) {
		cout << count(s, "JOI") << endl;
		cout << count(s, "IOI") << endl;
	}

	return 0;
}

Measured memory_bytes: 1216
n=int(input())
A=[]
for i in range(n):
    s=input()
    l=0
    o=0
    for c in s:
        if c=='(':
            l+=1
        else:
            l-=1
            o=min(o,l)
    A.append((l,o))
A.sort(key=lambda x:-10**9 if x[1]==0 else -x[1] if x[0]>=0 else 10**7+x[1]-x[0])
last=0
for l,o in A:
    if last+o<0:
        print("No")
        exit(0)
    last+=l
print("Yes" if last==0 else "No")

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

#define int long long

#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

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

template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}

// https://twitter.com/vane11ope ←フォローしましょう
// (ノ)>◡<(ヾ)ﾓﾁﾓﾁ
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const int MOD = 998244353;


    char c;
    cin>>c;
    int a=c-'a',A=c-'A';
    if(a<0)cout<<'A'<<endl;
    else if(A<0)cout<<'a'<<endl;
    else if(a<A)cout<<'a'<<endl;
    else cout<<'A'<<endl;
}


Measured memory_bytes: 3616
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
// #include<unordered_map>
#include<set>
// #include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y, idx;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

template<typename T>
T minT(T a, T b) {
	if (a < b) return a;
	else return b;
}

template<typename T>
T maxT(T a, T b) {
	if (a > b) return a;
	else return b;
}

template<typename T>
T absT(T a) {
	if (a < 0) a *= -1;
	return a;
}

template<typename T>
T powT(T a, T x) {
	T res = 1;
	while (x > 0) {
		if (x & 1) res = res * a;
		a = a * a;
		x >>= 1;
	}
	return res;
}

ll StoLL(string str) {
	ll ret = 0, ini = 0;
	if (str[0] == '-') ini = 1;
	repi(i, ini, str.length()) {
		ret *= 10;
		ret += (ll)(str[i] - '0');
	}
	if (ini) ret *= -1;
	return ret;
}

///////////////////////////////////////////////////////////////////////////////////////

ll a[3], ans;

int main() {
	repi(i, 0, 3) cin >> a[i];
	ll b, c, d;
	b = abs(a[0] - a[1]);
	c = abs(a[1] - a[2]);
	d = abs(a[2] - a[0]);
	ans = b + c + d;
	ans -= max(b, max(c, d));
	wrln(ans);
	return 0;
}


Measured memory_bytes: 256
s = input()
even = ['L', 'U', 'D']
odd = ['R', 'U', 'D']
flg = True
for i in range(len(s)):
  if i % 2 == 1:
    if s[i] not in even:
      flg = False
  else:
    if s[i] not in odd:
      flg = False
if flg:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include "bits/stdc++.h"
 
using namespace std;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define vllin(x,n) vll (x)(n);FOR(i,0,n-1){cin >>(x)[i];}
#define vllin2(a,b,n) vll (a)(n);vll (b)(n);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i];}
#define vllin3(a,b,c,n) vll (a)(n);vll (b)(n);vll (c)(n);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i]>>(c)[i];}
#define vlling(x,n) (x).assign(n,0);FOR(i,0,n-1){cin >>(x)[i];}
#define vlling2(a,b,n) (a).assign(n,0);(b).assign(n,0);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i];}
#define vlling3(a,b,c,n) (a).assign(n,0);(b).assign(n,0);(c).assign(n,0);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i]>>(c)[i];}
#define vpl4in(x,n) vpl4 (x)((n),mp(0,0));FOR(i,0,n-1){cin >>x[i].fi>>x[i].se;}
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define says(x) cout<<(x)<<(' ');
#define sas cout<<(' ');
#define sayR(x) cout<<fixed<<setprecision(10)<<(x);
#define salR(x) cout<<fixed<<setprecision(10)<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define pow(a,b) ll(pow(a,b))

ll MOD=998244353;	

signed main(){
	llin(a);
	llin(b);
	llin(c);
	sal((c/a)*b)
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int ans=0;
int main()
{
	int a[5];
	for(int i=1;i<=5;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=5;i++)
	{
		if(a[i]==0)
		ans=i;
	}
	cout<<ans;
 } 

Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}

void solve(){
  ll n;
  cin>>n;
  vector<ll> v1(n),v2(n);
  rep(i,0,n) cin>>v1[i]>>v2[i];
  sort(all(v1));
  sort(all(v2));
  if(n%2) cout<<v2[n/2]-v1[n/2]+1LL<<endl;
  else{
    double x = (v1[n/2LL]+v1[(n-1)/2LL])/2.0, zy= (v2[n/2LL]+v2[(n-1)/2LL])/2.0;
    double z=(zy-x)*2+1;
    cout<<(ll)z<<endl;
  }
}
int main(){
    optimizeIO();
    // tc
    {
      solve();
    }
}


Measured memory_bytes: 6268
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int dfs(vector<int> adj[],int node, int n,int visited[],int dp[]){
    for(int i=0;i<adj[node].size();i++){
        if(!visited[adj[node][i]]){
            visited[adj[node][i]] = 1;
             dp[node] = max(dp[node],1+dfs(adj,adj[node][i],n,visited,dp));
        }else{
            dp[node] = max(dp[node],dp[adj[node][i]]+1);
        }
    }
    return dp[node];
}

int main() {
    
    int t;
    t=1;
   // cin >> t;
    while(t--){
        
        int n,m;
        cin >> n >> m;
        
        vector<int> adj[n+1];
        for(int i=0;i<m;i++){
            int u,v;
            cin >> u >> v;
            
            adj[u].push_back(v);
        }
        
        int ans = 0;
        int dp[n+1];
        int visited[n+1];
        memset(visited,0,sizeof(visited));
        memset(dp,0,sizeof(dp));
        for(int i=1;i<=n;i++){
            if(!visited[i]){
                visited[i] = 1;
                dfs(adj,i,n,visited,dp);
            }
        }
        for(int i=1;i<=n;i++){
          //  cout << dp[i] << " ";
            ans=max(ans,dp[i]);
        }
        //cout << endl;
        cout << ans << endl;


    }
    return 0;

}

Measured memory_bytes: 9856
s = int(input())
def calc(a):
    if (a % 2 == 0):
        return a/2
    else:
        return 3*a+1
a_set = set([s])
ss = calc(s)
while (ss not in a_set):
    a_set.add(ss)
    ss = calc(ss)
print(len(a_set)+1)

Measured memory_bytes: 3060
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")



/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main() { 
  char x;cin>>x;
  cout << (char)(x+1) << endl;
}

Measured memory_bytes: 256
using System;

namespace ALDS1_6_B
{
    static class Swapper
    {
        public static void Integer(ref int a, ref int b)
        {
            if (a == b) return;
            a ^= b;
            b ^= a;
            a ^= b;
        }
    }
    static class Algorithm
    {
        public delegate void SwapperAction<T>(ref T a, ref T b);
        public static int Partition<T>(T[] a, int s, int t, SwapperAction<T> swapper) where T : IComparable
        {
            int p = s;
            T x = a[t];
            for (int i = s; i < t; ++i)
            {
                if (a[i].CompareTo(x) <= 0) swapper.Invoke(ref a[p++], ref a[i]);
            }
            swapper.Invoke(ref a[p], ref a[t]);
            return p;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int q = Algorithm.Partition(a, 0, a.Length - 1, Swapper.Integer);
            var strs = Array.ConvertAll(a, (s) => s.ToString());
            strs[q] = '[' + strs[q] + ']';
            Console.WriteLine(string.Join(" ", strs));
        }
    }
}

Measured memory_bytes: 20720
#include <stdio.h>

int main(){
	int N,K;
	scanf("%d %d",&N,&K);
	int p[N];
	for(int i=0;i<N;i++) scanf("%d",&p[i]);
	
	int sum=0,max=0;
	for(int i=0;i<K;i++) sum += p[i];
	max = sum;
	for(int i=1;i<N-K+1;i++){
		sum = sum+p[i+K-1]-p[i-1];
		if( sum>max ){
			max = sum;
		}
	}
	
	double expect=max;
	printf("%f\n",(expect+K)/2.0);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define ill(_x)  ll _x;scanf("%lld",&_x);
#define idb(_x)  double _x;scanf("%lf",&_x);
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vs vector<string>
#define in0(x, a, b)((x)>=a && (x)<=b    )
#define in1(x, a, b)((x)>a && (x)<b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const double pi = 3.14159265358979323846;
const int INF = 0x3f3f3f3f;
const int X10=1024,X11=2048,X12=4096,X13=8196,X14=16392,X15=32786,X16=65536,X17=131072,X18=262144,X19=524288,X20=1048576;

pair<int,int> f(int a1,int a2,int a3){
    return {a1-a2,a2-a3};
};
pair<int,int> A[100003];
pair<int,int> B[100003];
void _(){
    int n,m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int a,b;
        cin >> a >> b;
        A[i]={a,b};
        B[i]={b,a};
    }
    sort(A,A+m);
    sort(B,B+m);
    int ind=0;
    int lst=0;
    int num =0;
    while (ind<=m-1){
        while(lst > B[ind].second){ind++;if(B[ind].second==0){num--;
            break;}}
        lst =B[ind].first;
        num++;ind++;
    }
    cout << num;


}






int main() {
#ifdef Debug
    freopen("/home/joduskame/Desktop/cpp/IO/Input.txt", "r", stdin);
    freopen("/home/joduskame/Desktop/cpp/IO/Output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    _();
    return 0;

}








Measured memory_bytes: 1792
N = int(input())
rlt = 0

lst = [2]*(N+1)
lst[1] = 1

for i in range(2,N//2+1):
  j = 2
  while i*j <= N:
    lst[i*j] += 1
    j += 1

for i in range(1,N+1):
  rlt += i*lst[i]
  
print(rlt)

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

typedef long long ll;

int main(){
    int a,b;
    char c;
    cin >> a >> c >> b;
    if(c=='+'){
        cout << a+b << endl;
    }else{
        cout << a-b << endl;
    }
    return 0;
}


Measured memory_bytes: 256
h,w,m=map(int,input().split())
table=[]
H=[0]*h
W=[0]*w
li_h=[]
li_w=[]

for i in range(m):
    h1,w1=list(map(int,input().split()))
    table.append((h1-1,w1-1))
    H[h1-1]+=1
    W[w1-1]+=1

h_flag=0
w_flag=0

Hm=max(H)
Wm=max(W)

Hh=[i for i, x in enumerate(H) if x == Hm]
Ww=[i for i, x in enumerate(W) if x == Wm]

cnt=0

for (h, w) in table:
    if H[h] == Hm and W[w] ==  Wm:
        cnt += 1

if cnt<len(Hh)*len(Ww):
    print(Hm+Wm)
else:
    print(Hm+Wm-1)



Measured memory_bytes: 153268
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
	  result=(result*base)%modulus;
	  exponent=exponent>>1;
	  base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
vector<ll>A;
int main(){FAST;
for(ll i=1;i<=3;i++){
	ll x;cin>>x;
	A.pb(x);
}
sort(all(A));
ll ans =0 ;
for(ll i=1;i<3;i++){
	ans+=A[i]-A[i-1];
}
cout<<ans;
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
    int main(void)
    {
        int n,k,a[100005],i,count=0;
        scanf("%d%d",&n,&k);
        for(i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            if(a[i]>=k)
                count++;
        }
        printf("%d\n",count);
        return 0;
    }

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////




int main() {
	
	ll N;
	cin >> N;
	vector<ll> A(N + 1,0);
	repn(i, N) cin >> A[i];

	ll ans = 0;
	repn(i, N) {
		ans += (A[i - 1] + A[i]) / 2;
		if (A[i] > 0) { A[i] = (A[i - 1] + A[i]) % 2; }
	}

	cout << ans;
	

	system("PAUSE");
}


Measured memory_bytes: 1272
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	vector<int> a(N), b(N), c(N);
	for (int i = 0; i < N; i++) {
		cin >> a.at(i) >> b.at(i) >> c.at(i);
	}

	vector<vector<int>> v(N, vector<int>(3));
	v.at(0).at(0) = a.at(0);
	v.at(0).at(1) = b.at(0);
	v.at(0).at(2) = c.at(0);

	for (int i = 1; i < N; i++) {
		v.at(i) = { a.at(i) + max(v.at(i - 1).at(1),v.at(i - 1).at(2)),
					b.at(i) + max(v.at(i - 1).at(0),v.at(i - 1).at(2)),
					c.at(i) + max(v.at(i - 1).at(0),v.at(i - 1).at(1)) };
	}

	//for (int i = 1; i < N; i++) {
	//	cout << v.at(i).at(0) << ' ';
	//	cout << v.at(i).at(1) << ' ';
	//	cout << v.at(i).at(2) << endl;
	//}

	cout << max(v.at(N - 1).at(0), max(v.at(N - 1).at(1), v.at(N - 1).at(2))) << endl;
}

Measured memory_bytes: 9828
import math
a, b, x = map(int, input().split())

if a*a*b/2 == x:
    print(math.degrees(math.atan(b/a)))
if a*a*b/2 > x:
    print(math.degrees(math.atan(a*b*b/2/x)))
if a*a*b/2 < x:
    print(math.degrees(math.atan(2*(a*a*b-x)/a/a/a)))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define mod 1000000007
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    ll n;
    cin >> n;
    ll x[5];
    rep(i, 0, 5) cin >> x[i];
    sort(x, x + 5);
    ll ans = 5;
    if (n % x[0] == 0) ans += (n / x[0]) - 1;
    else ans += n / x[0];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<long long int> vec;
int Count[5], K;
long long arr[5][1005];

int main()
{
    scanf("%d %d %d %d", &Count[0], &Count[1], &Count[2], &K);
    for(int i = 0; i < 3; i++)
    {
        for(int j = 0; j < Count[i]; j++)
        {
            scanf("%lld", &arr[i][j]);
        }
    }
    for(int i = 0; i < 3; i++)
    {
        sort(arr[i], arr[i] + Count[i], greater<long long int>());
    }
    for(int i = 0; i < Count[0]; i++)
    {
        for(int j = 0; j < Count[1]; j++)
        {
            for(int k = 0; k < Count[2]; k++)
            {
                if((i + 1) * (j + 1) * (k + 1) <= K)
                {
                    vec.push_back(arr[0][i] + arr[1][j] + arr[2][k]);
                }
                else
                {
                    break;
                }
            }
        }
    }
    sort(vec.begin(), vec.end(), greater<long long int>());
    for(int i = 0; i < K; i++)
    {
        printf("%lld\n", vec[i]);
    }
}

Measured memory_bytes: 1400
#include<cstdio>
#include<utility>
#include<vector>
#include<queue>
using namespace std;
typedef pair<int, int> P;

const int INF = 1050;
struct vertex {
    vector<int> to;
    int dist = INF;
};

int n, m;
int sd[1000], prv[1000];
vertex ver[1000];
priority_queue<P, vector<P>, greater<P>> q;

int main() {
    scanf("%d %d", &n, &m);
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        ver[a - 1].to.emplace_back(b - 1);
    }
    for (int i = 0; i < n; i++) sd[i] = INF;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) ver[j].dist = INF;
        ver[i].dist = 0;
        q.emplace(0, i);
        while(!q.empty()) {
            P p = q.top(); q.pop();
            if (p.second != i && ver[p.second].dist != p.first) continue;
            if (p.second == i && p.first != 0 && sd[i] != p.first) continue;
            for (auto &j : ver[p.second].to) {
                if (j != i && p.first + 1 < ver[j].dist) {
                    ver[j].dist = p.first + 1;
                    q.emplace(ver[j].dist, j);
                }
                if (j == i && p.first + 1 < sd[i]) {
                    sd[i] = p.first + 1;
                    q.emplace(sd[i], i);
                }
            }
        }
    }
    
    int minsd = INF, ind;
    for (int i = 0; i < n; i++) {
        if (sd[i] < minsd) {
            minsd = sd[i];
            ind = i;
        }
    }
    if (minsd == INF) {
        printf("-1\n");
        return 0;
    }
    
    for (int i = 0; i < n; i++) ver[i].dist = INF; 
    ver[ind].dist = 0;
    sd[ind] = INF;
    q.emplace(0, ind);
    while(!q.empty()) {
        P p = q.top(); q.pop();
        if (p.second != ind && ver[p.second].dist != p.first) continue;
        if (p.second == ind && p.first != 0 && sd[ind] != p.first) continue;
        for (auto &i : ver[p.second].to) {
            if (i != ind && p.first + 1 < ver[i].dist) {
                ver[i].dist = p.first + 1;
                q.emplace(ver[i].dist, i);
                prv[i] = p.second;
            }
            if (i == ind && p.first + 1 < sd[ind]) {
                sd[ind] = p.first + 1;
                q.emplace(sd[ind], ind);
                prv[i] = p.second;
            }
        }
    }

    printf("%d\n", minsd);
    for (int i = 0, j = ind; i < minsd; i++) {
        printf("%d\n", j + 1);
        j = prv[j];
    }
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> V(N);
  for (int i = 0; i < N; i++) 
    cin >> V.at(i);
  
  int m = V.at(0);
  int count = 1;
  for (int i = 1; i < N; i++) {
    if (V.at(i) >= m) {
      count++;
      m = V.at(i);
    }
  }
  cout << count << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  rep(i, N) cin >> p[i];
  int cnt = 0;
  rep(i, N){
    if(i+1 != p[i]) cnt += 1;
  }
  string ans = cnt > 2 ? "NO" : "YES";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
	
	int n, x, count;
	
	while(1){
	scanf("%d", &n);
	scanf("%d", &x);
	
	if(n == 0 && x == 0)
		return 0;
	
	count = 0;
	
	for(int i = 1; i <= n; i++){
		for(int j = i+1; j <= n; j++){
			for(int k = j+1; k <= n; k++){
				if(i+j+k == x)
					count++;
				}
			}
		}
	printf("%d\n", count);
	}
  	return 0;
}

Measured memory_bytes: 1032
#include <bits/stdc++.h>
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)
# define INF 1000000007

using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;

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 (a>b) { a=b; return 1; } return 0; }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }

ll combination(ll a, ll b) {
    ll aa = 1;
    ll bb = 1;
    for (int i = 0; i < b; i++) {
        aa *= (a - i);
        bb *= (i + 1);
    }
    return aa / bb;
}

int main()
{
    int N, A, B;
    cin >> N >> A >> B;
    if (N * A < B) {
        cout << N * A << endl;
    } else {
        cout << B << endl;
    }

    return 0;
}


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

#define int long long

using namespace std;



int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int K, X;

    cin >> K >> X;

    if(K*500 >= X)
    {
    	cout << "Yes" << '\n';
    }
    else
    {
    	cout << "No" << '\n';
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        int n = sc.nextInt();
        int o = 0;
        for (int i = 0;i < n;i++) {
            if (sc.nextInt()%2==1) o++;
        }
        
        if (o%2==0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 32088
#include <iostream>
#include <vector>
#include <array>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <string>
#include <utility>
#include <cmath>
#include <cstdio>

using namespace std;

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

using ll = long long;
using ull = unsigned long long;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif


void solve() {
    int A, B, X;
    cin >> A >> B >> X;
    if (A <= X && A + B >= X) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }
}


int main() {
    solve();
    return 0;
}


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

int main(void)
{
    IOS
    int m1, d1;
    cin >> m1 >> d1;
    int m2, d2;
    cin >> m2 >> d2;

    if (d2 == 1 && m1 +1 == m2) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var tbl = new int[n][];
        for (int i = 0; i < n; i++) {
            tbl[i] = ToIntArray(input.ReadLine(), 3);
        }

        var now = new int[] { 0, 0, 0 };

        foreach(var tx in tbl) {
            var addx = Math.Abs(now[1] - tx[1]);
            var addy = Math.Abs(now[2] - tx[2]);
            var addt = tx[0] - now[0];

            if (addt <= 0) return No;
            if (addt < addx + addy) return No;
            if (addt % 2 != (addx + addy) % 2) return No;

            now = tx;
        }

        return Yes;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


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

int main(){
    long long n, m;
    cin >> n >> m;
    long long ans;
    if(n >= m / 2){
        ans = m / 2;
    }else{
        ans = n;
        m -= n * 2;
        ans += m / 4;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
using namespace std;

void func(int N, int d, string s, char now) {
  if (d == N) {
    cout << s << endl;
    return;
  }

  for (char c = 'a'; c <= now + 1; ++c) {
    func (N, d + 1, s + c, max(now, c));
  }
}

int main() {
  int N;
  cin >> N;
  func (N, 0, "", 'a' - 1);
  return 0;
}


Measured memory_bytes: 1536
import java.util.*;
public class Main {

	public void doIt(){
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		String [] array = str.split("[ \\.,]+");
		boolean isFirst = true;
		for(int i=0; i < array.length; i++){
			int len = array[i].length();
			if(len >= 3 && len <= 6 ){
				if(isFirst){
					System.out.print(array[i]);
					isFirst = false;
				}
				else{
					System.out.print(" "+ array[i]);
				}
			}
		}
		System.out.println("");
	}
	public static void main(String[] args) {
		Main obj = new Main();
		obj.doIt();

	}

}

Measured memory_bytes: 0