akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
signed main(){
    int V,e,s;
    cin>>V>>e>>s;
    vector<vector<pii>>edge(V,vector<pii>());
    rep(i,e){
        pii a; int c; cin>>a.first>>a.second>>c;
        edge[a.first].push_back(pii(a.second,c));
    }
    vector<int>d(V,INF);
    d[s]=0;
    priority_queue<pii,vector<pii>,greater<pii>>que;
    que.push(pii(d[s],s));
    while(!que.empty()){
        pii now=que.top(); que.pop();
        if(d[now.second]<now.first)continue;
        for(int i=0; i<edge[now.second].size();i++){
            pii next=edge[now.second][i];
            if(now.first+next.second>d[next.first])continue;
            d[next.first]=now.first+next.second;
            que.push(pii(d[next.first],next.first));
        }
    }
    for(int v=0; v<V;v++)
        if(d[v]==INF)cout<<"INF"<<endl;
        else cout<<d[v]<<endl;
}

Measured memory_bytes: 19336
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
bitset <100001> d;

int kq[100001];
int ans=0;
void dfs(int i,vector <int> a[]){

for (int j=0;j<a[i].size();j++){

    if (d[a[i][j]]==0)
    {
        d[a[i][j]]=1;
        dfs(a[i][j],a);
    }
    kq[i]=max(kq[i],kq[a[i][j]]+1);
}
}
int main(){
int n,m;

cin>>n>>m;
vector <int> a[n+1];

for (int i=0;i<m;i++){
    int x,y;
    cin>>x>>y;
    a[x].push_back(y);
}

for (int i=1;i<=n;i++){
    kq[i]=0;
}

for (int i=1;i<=n;i++){
if (d[i]==0){
d[i]=1;
dfs(i,a);
}
}
for (int i=1;i<=n;i++){
 ans=max(ans,kq[i]);
}
cout<<ans;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
vector<char>v;
int main()
{

  string s = "abcdefghijklmnopqrstuvwxyz";
  string s1;
  getline(cin,s1);
  int flag;
  char ch;
  for(int i = 0; i < s.size(); i++){
        flag = 0;
    for(int j = 0; j < s1.size(); j++){
        if(s[i] == s1[j]){
            flag = 1;
            break;
        }
    }
    if(flag == 0){
        ch = s[i];
  break;
    }
  }
    if(flag == 0){
        printf("%c\n", ch);
    }
    else printf("None\n");

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int tam = 3005;
double ps[tam];
double dp[tam][tam];

int main(){
    int n;
    scanf("%d", &n);
    for(int i=1; i<=n; i++){
        scanf("%lf", &ps[i]);
    }
    memset(dp, 0, sizeof(dp));
    dp[1][1] = ps[1];
    dp[0][1] = 1-ps[1];
    for(int i = 2; i<=n; i++){
        dp[0][i] = dp[0][i-1]*(1-ps[i]);
        for(int j =1; j<=i; j++){
            dp[j][i] = dp[j][i-1]*(1-ps[i])+dp[j-1][i-1]*ps[i];
        }
    }
    double rta =0;
    for(int i = n/2+1; i<=n; i++){
        rta+=dp[i][n];
    }
    printf("%.12lf\n", rta);
    
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << ": " << x << '\n';

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  int fx = tx - sx, fy = ty - sy;
  cout << string(fy, 'U');
  cout << string(fx, 'R');
  cout << string(fy, 'D');
  cout << string(fx, 'L');
  cout << 'L' + string(fy + 1, 'U') + string(fx + 1, 'R') + 'D';
  cout << 'R' + string(fy + 1, 'D') + string(fx + 1, 'L') + 'U';
  cout << '\n';
}


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

int main() {
	int A, B;
	cin >> A >> B;

	int large = 1;
	int small = 1;
	if (A > B) {
		large = A;
		small = B;
	}
	else {
		large = B;
		small = A;
	}

	// 大きい方を基準に走査

	long long int ans = large;
	
	while (1) {

		if (ans % small == 0) {
			break;
		}
		ans += large;
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <utility>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)
typedef pair<int, string> P;




int main() {
    int k;
    cin >> k;
    string s;
    cin >> s;

    int n = s.size();

    if (k >= n){
        cout<<s<<endl;
        return 0;
        }
    else {
        rep(i,k){
        cout << s.at(i);
    }
        cout << "..." << endl;
        return 0;
    }
}

Measured memory_bytes: 3600
#include<iostream>

using namespace std;

int main(void)
{
	int a,b,c,d;
	cin >> a >> b >> c >> d;

	if(a<c)
	{
		if(b<c)
			cout << 0 << endl;
		else if(b>d)
			cout << d-c << endl;
		else
			cout << b-c << endl;
	}
	else
	{
		if(d<a)
			cout << 0 << endl;
		else if(d>b)
			cout << b-a << endl;
		else
			cout << d-a << endl;
	}
}
		

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <iterator>
#include <sstream>
#include <bits/stdc++.h>

using ll = long long;
using namespace std;
#define modmod 1000000007

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

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

    int s_count = 0;
    int t_count = 0;
    int res_count = 0;
    for(int i = 0; i < S.length(); i++){
        if(S[i] == 'T'){
            t_count++;
            if(t_count > s_count){
                res_count++;
                t_count = 0;
                s_count = 0;
            }
        }else{
            s_count++;
        }
    }

    cout << res_count*2 << endl;
    return 0;

}


Measured memory_bytes: 640
#N=int(input())
N,K = map(int,input().split())
#N=int(input())
A = list(map(int,input().split()))
#S=str(input())

now=1
flag=[0]+[-1]*(N-1)

for i in range(K):
    now = A[now-1]
    if flag[now-1]==-1:
        flag[now-1]+=i+2
    else:
        loop = i+1 - flag[now-1]
        zan=(K-i-1) - (K-i-1)//loop * loop
        ans = flag.index(flag[now-1]+zan)+1
        print(ans)
        exit()

print(now)


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

long long int K;

int sum(long long n)
{
    int res = 0;
    while (n > 0)
    {
        res += n % 10;
        n /= 10;
    }
    return res;
}

int main()
{
    cin >> K;
    long long int now = 0;
    long long int diff = 1;
    while (K > 0)
    {
        if ((now + diff) * sum(now + diff * 10) > (now + diff * 10) * sum(now+diff)) diff *= 10;
        now += diff;
        cout << now << endl;
        K--;
    }
    // int N = 1000000;
    // vector<double> a(N + 1);
    // for (int i = 1; i <= N; i++) a[i] = (double)i / sum(i);

    // vector<double> mins(N + 1);
    // mins[N] = a[N];
    // for (int i = N-1; i > 0; i--) mins[i] = min(mins[i+1], a[i]);
    // for (int i = 1; i <= N; i++) if (a[i] == mins[i]) cout << i << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
As = list(map(int, input().split()))
P = 1000000007

lst = [0,0,0]
rlt = 1

for i in range(N):
  cnt = lst.count(As[i])
  rlt *= cnt
  rlt %= P
  for j in range(3):
    if lst[j] == As[i]:
      lst[j] += 1
      break
      
print(rlt)

Measured memory_bytes: 83868
import math
#from decimal import Decimal
A,B,H,M = map(int,input().split())
Hd = 2*math.pi*H/12 + 30/360*2*math.pi*M/60
Md = 2*math.pi*M/60
Hx = A*math.cos(Hd)
Hy = A*math.sin(Hd)
Mx = B*math.cos(Md)
My = B*math.sin(Md)
r = ((Hx - Mx)**2 + (Hy - My)**2)**0.5
print(r)


Measured memory_bytes: 9504
///----> bismillahir rahmanir rahim <---- -- { ^ _ ^ }
///     { ^_^ }   { ^ _ ^ }



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


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi; ///VECTOR<VECTOR<INT>NAME>NAME 2
typedef vector<vl> vvl;///LONG LONG
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;///VECTOR WITH PAIR
typedef vector<pll> vll;
typedef double dl;

#define endl "\n"
#define PB push_back
#define F first
#define S second
#define as(a) (a).begin(),(a).end()
#define ras(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define over return 0;

#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

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


///--------> YOUR JOURNEY STARTS HERE <-------



int main(){

int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
    cin>>a[i];
}
ll ans=0;

if(n==1){

    cout<<0<<endl;
}
else{





for(int i=0;i<n-1;i++){
    if(a[i]>a[i+1]){ans+=a[i]-a[i+1];
        a[i+1]=a[i];

        //cout<<a[i]<<" "<<a[i+1]<<endl;
    }
}

cout<<ans<<endl;
}
over
}


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

#define ll long long
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define M 1000000007

void solve()
{
	ll n,r;
	cin>>n;
	while(n)
	{
		r=n%10;
		n=n/10;
		if(r==7) 
		{
			cout<<"Yes";
			return;
		}
	}
	cout<<"No";
}

int main() 
{
	FAST
	ll t=1;	
	//cin>>t;
	for(ll i=0;i<t;i++) solve();
	return 0;
}
    

Measured memory_bytes: 3636
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;
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];
  }
  mint p(int n,int k){
  return fact[n]*ifact[n-k];
  }
}comb(1000005);//100005まで計算（どこまで必要かで変更）

int main(){

ll X,Y;
cin>>X>>Y;
if(((2*Y-X)%3!=0)||(2*Y-X<0)){
  cout<<0<<endl;
  return 0;
}
ll i=(2*Y-X)/3;
if((X-i<0)||((X-i)%2!=0)){
  cout<<0<<endl;
  return 0;
}
ll j=(X-i)/2;
cout<<comb(i+j,i)<<endl;

return 0;
}

Measured memory_bytes: 18664
N = int(input())
S = input()

ans = 0
for i in range(0, 1000):
    if 0 <= i and i <= 9:
        num = "00"+str(i)
    elif 10 <= i and i <= 99:
        num = "0"+str(i)
    else:
        num = str(i)

    num_pos = 0
    s_pos = 0
    while True:
        if S[s_pos] == num[num_pos]:
            num_pos += 1
            if num_pos == 3:
                ans += 1
                break
        s_pos += 1
        if s_pos == N:
            break
print(ans)


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

int main()
{
	int a, b, m; cin >> a >> b >> m;
	vector<int> va(a);
	vector<int> vb(b);
	int mini = 1e6;
	int first = 1e6;
	int second = 1e6;
	for (int i = 0; i < a; ++i)
	{
		cin >> va[i];
		first = min(first, va[i]);
	}
	for (int i = 0; i < b; ++i)
	{
		cin >> vb[i];
		second = min(second, vb[i]);
	}
	 mini = first + second;
	int x, y, c;
	for (int i = 0; i < m; ++i)
	{
		cin >> x >> y >> c;
		mini = min(mini, va[x - 1] + vb[y - 1] - c);
	}
	cout << mini;
	return 0;
}

Measured memory_bytes: 1152
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

int N;
int X[1<<16], dp[1<<16];
vector<int> to[100050], ve[100050];
int st[100050];

int dfs(int u, int p = -1) {
  int res = 0;
  st[u] = 0;
  for (int zi = 0; zi < (int)to[u].size(); ++zi) {
    const int v = to[u][zi], a = ve[u][zi];
    if (v != p) {
      res += dfs(v, u);
      int stv = st[v];
      if (X[st[v]] != a) {
        int add = X[st[v]] ^ a;
        if (stv & (1 << add)) {
          stv ^= 1 << add;
          ++res;
        } else {
          stv |= 1 << add;
        }
      }
      res += __builtin_popcount(st[u] & stv);
      st[u] ^= stv;
    }
  }
  return res;
}

int main() {
  for (int i = 0; i < (1<<16); ++i) {
    X[i] = 0;
    for (int j = 0; j < 16; ++j) {
      if (i & (1 << j)) {
        X[i] ^= j;
      }
    }
  }

  int N = in();
  for (int i = 0; i < N - 1; ++i) {
    int x = in();
    int y = in();
    int a = in();
    to[x].push_back(y); ve[x].push_back(a);
    to[y].push_back(x); ve[y].push_back(a);
  }

  int res = dfs(0);
  vector<int> ps(1<<16);
  for (int i = 0; i < (1<<16); ++i) {
    ps[i] = i;
  }
  sort(ps.begin(), ps.end(), [] (const int a, const int b) {
    return __builtin_popcount(a) < __builtin_popcount(b);
  });

  for (int i : ps) {
    dp[i] = __builtin_popcount(i);
    for (int j = 1; j < 16; ++j) {
      if (!(i & (1 << j))) {
        continue;
      }
      for (int k = j+1; k < 16; ++k) {
        if (!(i & (1 << k))) {
          continue;
        }
        int cost = 1;
        if (i & (1 << (j ^ k))) {
          ++cost;
        }
        chmin(dp[i], dp[i ^ (1<<j) ^ (1<<k) ^ (1<<(j^k))] + cost);
      }
    }
  }

  printf("%d\n", res + dp[st[0]]);

  return 0;
}


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

int main() {
	int n;
	while (scanf("%d", &n), n != 1) {
		vector<int>factor;
		printf("%d:", n);
		for (int i = 1; i * 7 - 1 <= n; i++) {
			if (n % (i * 7 - 1) == 0)factor.push_back(i * 7 - 1);
			if (n % (i * 7 + 1) == 0)factor.push_back(i * 7 + 1);
		}
		for (int i = 0; i < factor.size(); i++) {
			bool is_prime = true;
			for (int j = 0; j < i; j++) {
				if (factor[i] % factor[j] == 0) {
					is_prime = false;
					break;
				}
			}
			if(is_prime)printf(" %d", factor[i]);
		}
		printf("\n");
	}
}

Measured memory_bytes: 1052
from sys import stdin

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))


ans = 0
for i in range(len(an)-1):
  if i > 0:
      if an[i-1] < an[i] and an[i] <= an[i+1]:
          ans += 1
      elif an[i-1] >= an[i] and an[i] > an[i+1]:
          ans += 1

print(ans)

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

int main(){
    int A,B,C;
    int flg_poor = 0;
    std::cin >> A >> B >> C;

    if(A==B && B==C){
        flg_poor = 0;
    }else if(A==B || B == C || C ==A){
        flg_poor = 1;
    }

    if(flg_poor == 1){
        std::cout << "Yes";
    }else{
        std::cout << "No";
    }
}

Measured memory_bytes: 3636
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    var a = sc.nextInt()
    var b = sc.nextInt()
    var c = sc.nextInt()
    var count = 0

    for (i in a..b) {
        if (c % i == 0) count++
    }
    println(count)
}


Measured memory_bytes: 27512
#include<cstdio>
#include<algorithm>
const int N=1e5+2;
int i,n,m,a[N];
long long ans=1e12,k[N],b[N];
void wk(int s,int t)
{
	if(b[s]+=s,++k[t],--k[s],s<t)b[1]+=t-s,b[t]-=s;else
	b[1]+=t,b[t]+=m-s,--k[1];
}
int main()
{
	for(scanf("%d%d",&n,&m);i++<n;scanf("%d",a+i));
	for(i=0;++i<n;wk(a[i]+1,a[i+1]+1));
	for(i=0;i++<m;)
	{
		k[i]+=k[i-1],b[i]+=b[i-1];
		ans=std::min(ans,k[i]*i+b[i]);
	}
	printf("%lld",ans);
}
/////////////////////////////////////////////////////////////////

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	scanf("%d", &n);
	int odd = (n + 1) / 2; //C++だと切り下げなのを活用してる。
	double ans = (double)odd / n;
	printf("%.10f\n", ans);
	return 0;
}

Measured memory_bytes: 3792
#include <stdio.h>

int main(void) {
	int i,ii, n, ary[4][13]={0};
	char mark[4] = {'S', 'H', 'C', 'D'};
	int inr;
	char inm;
	
	scanf("%d", &n);
	
	for(i=0;i<n;i++){
		scanf(" %c %d", &inm, &inr);
		if(inm=='S') ary[0][inr-1]=1;
		else if(inm=='H') ary[1][inr-1]=1;
		else if(inm=='C') ary[2][inr-1]=1;
		else if(inm=='D') ary[3][inr-1]=1;
	}
	
	for(i=0;i<4;i++){
		for(ii=0;ii<13;ii++){
			if(ary[i][ii] != 1){
				printf("%c %d\n", mark[i], ii+1);
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 596
first=0
second=0
third=0
for i in 1..10 do
  inp=gets.to_i
  if first<inp then
    third=second
    second=first
    first=inp
  elsif second<inp then
    third=second
    second=inp
  elsif third<inp then
    third=inp
  end
end
print(first,"\n",second,"\n",third,"\n")

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

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

typedef long long ll;

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

  vector<ll> point(n, k);

  for(int i=0; i<q; i++){
    int a;
    cin >> a;
    point[a-1] += 1;
  }

  for(int i=0; i<n; i++){
    if(point[i] - q <= 0){
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
ll gcd(ll a,ll b){//最大公約数
  if (a%b==0){
		return(b);
    }
	else{
		return(gcd(b,a%b));
    }
}
//素数列挙
#define P 1000000
vl primes;
ll primenum[P];
bool bprime[P+1];
ll searchprime(ll max){//発見した素因数の個数を返す
  bprime[1]=false;
  for(ll i=2;i<=max;i++){
    bprime[i]=true;
  }
  ll nowprimes=1;
  primes.pb(2);
  for(ll i=4;i<max;i+=2){
    bprime[i]=false;
  }

  for(ll i=3;i<max/2;i+=2){
    if(bprime[i]==true){
      //primes[nowprimes]=i;
      primes.pb(i);
      nowprimes++;
      for(ll j=2;i*j<=max;j++){
        bprime[i*j]=false;
      }
    }
  }
  return nowprimes;
}
int main(void){
  ll a,b;
  cin>>a>>b;
  ll n=gcd(a,b);
  ll now=2;
  ll ans=1;
  while(now<=(ll)sqrt(n)&& n !=1){
    if(n%now==0){
      ans++;
      while(n%now==0 && now!=1){
        n/=now;
      }
    }
    now++;
  }
  if(n>1){
    cout<<ans+1;
  }else{
    cout<<ans;
  }
  return 0;
}

Measured memory_bytes: 256
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let t: usize = itr.next().unwrap().parse().unwrap();
    let mut wv: Vec<(usize, usize)> = (0..n)
        .map(|_| {
            (
                itr.next().unwrap().parse().unwrap(),
                itr.next().unwrap().parse().unwrap(),
            )
        })
        .collect();
    wv.sort();

    let mut dp = vec![0; t + 1];
    for i in 0..n {
        for j in (0..t).rev() {
            dp[j] = max(dp[j], dp[j]);
            dp[min(t, j + wv[i].0)] = max(dp[min(t, j + wv[i].0)], dp[j] + wv[i].1);
        }
    }
    println!("{}", dp[t]);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <vector>
#define rep(i,n) for(int i = 0; i < n; i++)
using ll = long long;
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(m);
  vector<int> b(m);
  vector<int> cnt(n);
  int ans = 0;
  rep(i, m){
    cin >> a[i];
    cin >> b[i];
    cnt[a[i]-1]++;
    cnt[b[i]-1]++;
  }
  while(true){
    int temp = ans;
    rep(i, n){
      if(cnt[i] == 1){
        ans++;
        cnt[i]--;
        rep(j, a.size()){
          if(i + 1 == a[j]){
            cnt[b[j]-1]--;
            swap(a[j], a[a.size()-1]);
            swap(b[j], b[b.size()-1]);
            a.pop_back();
            b.pop_back();
            break;
          }else if(i + 1 == b[j]){
            cnt[a[j]-1]--;
            swap(a[j], a[a.size()-1]);
            swap(b[j], b[b.size()-1]);
            a.pop_back();
            b.pop_back();
            break;
          }
        }
      }
    }
    if(temp == ans){
      cout << ans << endl;
      return 0;
    }
  }
  return 0;
}

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

int main(){
    int N,W;
    cin>>N>>W;
    int dp[2][W+1];
    fill(dp[0],dp[2],0);
    for(int i=0;i<N;i++){
        int v,w;
        cin>>v>>w;
        for(int j=0;j<=W;j++)dp[i%2][j]=dp[(i+1)%2][j];
        for(int j=0;j<=W;j++){
            if(j+w<=W){
                dp[i%2][j+w]=max(dp[i%2][j+w],dp[i%2][j]+v);
            }
        }
    }
    int max=0;
    for(int i=0;i<=W;i++){
        if(max<dp[(N+1)%2][i])max=dp[(N+1)%2][i];
    }
    cout<<max<<endl;
}

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

int main() {
  int a[5];
  int k;
  for ( int i = 0; i < 5; i++ ) { cin >> a[i]; }
  cin >> k;
  string ans = "Yay!";
  for ( int i = 0; i < 4; i++ ) {
    for ( int j = i+1; j < 5; j++ ) {
      if ( a[j]-a[i] > k ) { ans = ":("; }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    } 

    for(int i=1; i<n; i++) {

        if(arr[i] >= arr[i - 1]) continue;

        ans +=  arr[i - 1] - arr[i];

        arr[i] = arr[i - 1];
    }

    cout<<ans<<endl;


}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 5172
n,k=list(map(int,input().split()))
l=[]
for i in range(n):
  l.append(k+i)
l.sort()
if max(l)>=0 and min(l)<=0:
  print(sum(l))
elif max(l)<0:
  print(sum(l)-l[n-1])
else:
  print(sum(l)-l[0])
  

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

using namespace std;

const int maxn = 4007;
const int maxm = 2e5 + 7;
const int base = 2000;
const int mod = 1e9 + 7;
const int inv2 = mod + 1 >> 1;
int n;

int f[maxn][maxn];

int a[maxm];
int b[maxm];
int fac[maxn << 1];
int inv[maxn << 1];

int Add(int x,int y){return (x += y) >= mod ? x - mod : x;}
int Sub(int x,int y){return (x -= y) <    0 ? x + mod : x;}
int Mul(int x,int y){return 1LL * x * y % mod;}
int Pow(int x,int k,int re = 1){
	for(; k; k >>= 1,x = Mul(x,x))
		if(k & 1)re = Mul(re,x);
	return re;
}
int C(int n,int m){
	return Mul(fac[n],Mul(inv[m],inv[n - m]));
}
int main(){
	scanf("%d",&n);
	for(int i = 1; i <= n; ++i){
		scanf("%d%d",&a[i],&b[i]);
		++f[base - a[i]][base - b[i]];
	}
	for(int i = 0; i < maxn; ++i){
		for(int j = 0; j < maxn; ++j){
			if(i)f[i][j] = Add(f[i][j],f[i - 1][j]);
			if(j)f[i][j] = Add(f[i][j],f[i][j - 1]);
		}
	}
	int ans = 0;
	for(int i = 1; i <= n; ++i)
		ans = Add(ans,f[a[i] + base][b[i] + base]);
	fac[0] = inv[0] = 1;
	for(int i = 1; i <= 8000; ++i)fac[i] = Mul(fac[i - 1],i);
	inv[8000] = Pow(fac[8000],mod - 2);
	for(int i = 7999; i; --i)inv[i] = Mul(inv[i + 1],i + 1);
	for(int i = 1; i <= n; ++i)
		ans = Sub(ans,C((a[i] << 1) + (b[i] << 1),(a[i] << 1)));
	printf("%d\n",Mul(ans,inv2));
	return 0;
}


Measured memory_bytes: 64640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=(int)1e9+7;
	static readonly int[][] di=new int[][]{new int[]{-1,0},new int[]{1,0},new int[]{0,-1},new int[]{0,1}};
	static void Main(){
		Sc sc=new Sc();
		int h=sc.I,w=sc.I,n=sc.I;
		int[] st=sc.Ia;
		string s=sc.S;
		string t=sc.S;
		int a=1,b=w,c=1,d=h;
		string ans="YES";
		for(int i = n-1;i>=0;i--) {
			if(t[i]=='R'&&a!=1){a--;}
			if(t[i]=='L'&&b!=w){b++;}
			if(t[i]=='D'&&c!=1){c--;}
			if(t[i]=='U'&&d!=h){d++;}
			if(s[i]=='R'){b--;}
			if(s[i]=='L'){a++;}
			if(s[i]=='D'){d--;}
			if(s[i]=='U'){c++;}
			if(a>b||c>d){ans="NO";break;}
		}
		if(c<=st[0]&&st[0]<=d&&a<=st[1]&&st[1]<=b){ }
		else{ans="NO";}
		Console.WriteLine("{0}",ans);
	}
}
public class Sc{
	private string[] a;
	private int n=-1,m=0;
	public int I{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split(new string[]{" ","　","	"},StringSplitOptions.RemoveEmptyEntries);}n++;return int.Parse(a[n]);}}
	public long L{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split(new string[]{" ","　","	"},StringSplitOptions.RemoveEmptyEntries);}n++;return long.Parse(a[n]);}}
	public double D{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split(new string[]{" ","　","	"},StringSplitOptions.RemoveEmptyEntries);}n++;return double.Parse(a[n]);}}
	public string S{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split(new string[]{" ","　","	"},StringSplitOptions.RemoveEmptyEntries);}n++;return a[n];}}
	public int[] Ia{get{if(n!=-1&&n!=a.Length-1){m=n;n=-1;return Array.ConvertAll(a.Skip(m+1).ToArray(),int.Parse);}return Array.ConvertAll(Console.ReadLine().Split(new string[]{" ","　","	"},StringSplitOptions.RemoveEmptyEntries),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(new string[]{" ","　","	"},StringSplitOptions.RemoveEmptyEntries),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(new string[]{" ","　","	"},StringSplitOptions.RemoveEmptyEntries),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(new string[]{" ","　","	"},StringSplitOptions.RemoveEmptyEntries),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(new string[]{" ","　","	"},StringSplitOptions.RemoveEmptyEntries),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split(new string[]{" ","　","	"},StringSplitOptions.RemoveEmptyEntries);}}
}

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

int main(){
  int n;
  char x,y;
  for(;cin>>n,n;cout<<endl){
    map<char,char>m;
    for(;n;n--){
      cin>>x>>y;
      m[x]=y;
    }
    for(cin>>n;n;n--){
      cin>>x;
      cout<<(m[x]?m[x]:x);
    }
  }
}

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

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

  int i = 0;   // カウンタ変数
  int sum = 0;
  int l;
  int r;
  vector<int> data(N);
  while (i < N) {//カウンタ変数であるIがNより小さい間は繰り返す
  
    cin >>l>>r; //R番目の席からL番目の席を引くことで何人座ったか求める   
    sum += r-l+1;//サムに座った人数を加算
    i++;//IがN回までひとつづつ増える
        
  }
cout<<sum<<endl;

}

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

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

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

	int n; cin >> n;
	double sum = 0;
	map<int,int> mp;

	double a[105];
	for (int i = 0;i < n;i++){
		cin >> a[i];
		sum += a[i];
	}

	double b = sum/n;

	double m = 1000000;
	int ans = -1;

	for (int i = 0;i < n;i++){
		if(abs(a[i] - b) < m){
			ans = i;
			m = abs(a[i] - b);
		}
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
typedef pair<int, int> P;

/** Problem2100 : Saizo **/
int main()
{
	int N, M; cin>>N;
	rep(i, N) {
		cin>>M;
		
		int a=0, b=0;
		int tmp;
		cin>>tmp;
		rep(j, M-1) {
			int d; cin>>d;
			if (d-tmp>0)
				a = max(a, d-tmp);
			else
				b = max(b, tmp-d);
			tmp = d;
		}
		
		cout << a << " " << b << endl;
	}
}

Measured memory_bytes: 1160
# N = int(input())
N, A, B = [int(_) for _ in input().split()]
if (B - A) % 2 == 0:
    print((B-A) // 2)
else:
    print(min(N - B + 1 + (N - (A + N-B+1)) // 2, A + (B - A - 1)//2))


Measured memory_bytes: 38340
#[allow(dead_code)]
fn main() {
    let x = i::u();
    let mut a = 100;
    let mut c = 0;
    while a < x {
        c += 1;
        a += a / 100;
    }
    println!("{}", c);
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


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

using namespace std;

int
main(void){
	int n; cin >> n;
	vector<int> vec(n);
	for(int i = 0; i < n; i++) cin >> vec[i];
	map<int, int> mp1;
	for(int i = 0; i < n; i++) mp1[vec[i]]++;
	int ans = 0;
	for(map<int, int> :: iterator It = mp1.begin(); It != mp1.end(); It++){
		if(It->second % 2 != 0) ans++;
	}
	cout << ans;
}


Measured memory_bytes: 5376
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  int x, y, z;
  cin >> x >> y >> z;
  cout << (x - z) / (y + z) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,m,f,d;
  long long c;
  char w;
  scanf("%d",&n);
  f=c=d=0;
  while(n--){
    scanf(" %c %d",&w,&m);
    if(f)continue;
    if(w=='('){
      //if(d==0&&c)f=1;
      c+=m;
      //d=1;
    }
    else{
      c-=m;
      //d=0;
    }
    if(c<0)f=1;
  }
  if(f||c)printf("NO\n");
  else printf("YES\n"); 
  return 0;
}

Measured memory_bytes: 580
from collections import Counter

N = int(input())
al = list(map(int,input().split()))
C = Counter(al)

ans = 0
for i in C.keys():
    if i in C:
        if C[i] == i:
            continue
        elif C[i] > i:
            ans += C[i] - i
        else:
            ans += C[i]
print(ans)

Measured memory_bytes: 18668
n=int(input())
s=[*input()]
q=int(input())
# BIT
B={chr(97+i):[0]*(n+1) for i in range(26)}
def bsum(c,i):
  s=0
  while i:
    s+=B[c][i]
    i-=i&-i
  return s
def badd(c,i,x):
  while i<=n:
    B[c][i]+=x
    i+=i&-i
for i,c in enumerate(s):
  badd(c,i+1,1)
for _ in range(q):
  x,y,z=input().split()
  y=int(y)-1
  if x=='1':
    badd(s[y],y+1,-1)
    s[y]=z
    badd(z,y+1,1)
  else:
    print(sum(bsum(c,int(z))-bsum(c,y)>0 for c in B))

Measured memory_bytes: 205820
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/24 15:04:55 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

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

// TOP
void	Main()
{
	int	n;
	cin >> n;

	vector<int>	V(n + 1);
	rep(i, n)
		cin >> V.at(i);

	int	cnt;
	cnt = 0;
	rep(i, n)
	{
		if (V.at(i) == i + 1 && V.at(i + 1) == i + 2)
		{
			cnt++;
			i++;
		}
		else if (V.at(i) == i + 1)
			cnt++;
	}
	cout << cnt << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scanner = new Scanner(System.in);
        String a = scanner.next(); //文字列a
        int A = Integer.parseInt(a); //数字A
        String b = scanner.next(); //文字列b
        int B = Integer.parseInt(b); //数字B
        
        String a_sum = "";
        String b_sum = "";
        
        for(int i=0; i<B; i++){
            a_sum = a_sum +a;
        }
        
        for(int i=0; i<A; i++){
            b_sum = b_sum +b;
        }
        
        int A_sum = Integer.parseInt(a_sum);
        int B_sum = Integer.parseInt(b_sum);
        
        if(A<=B){
            System.out.println(A_sum);
        }else{
            System.out.println(B_sum);
        }
        
    }
}


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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int inf = 1e9;
const int mod = 1e9+7;
const int maxn = 1e5+5;

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    int n,k;
    while (cin >> n >> k) {
        if (k == 1)
            cout << 0 << endl;
        else 
            cout << n-k << endl;
    }
    return 0;
}


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

#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

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

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

int dx8[8]={1,1,0,-1,-1,-1,0,1};
int dy8[8]={0,1,1,1,0,-1,-1,-1};


int main(){

    bool flag=false;
    ll sum=0;

    int h,w,n;
    cin>>h>>w>>n;

    map<P,int> cnt;

    rep(i,n){
        int x,y;
        cin>>y>>x;

        //db2(x,y);ln;
        
        if(! (x==1||x==w||y==1||y==h ))cnt[ P(x,y) ]++;

        rep(j,8){
            int nx = x+dx8[j];
            int ny = y+dy8[j];
            
            if(!(0<nx&&nx<=w&&0<ny&&ny<=h))continue;
            if(nx==1||nx==w||ny==1||ny==h)continue;
            
            cnt[ P(nx,ny) ]++;
            //db2(nx,ny);ln;

        }
    }



    vector<ll> ans(10,0);
    for(auto p:cnt){
        ans[ p.second ]++;

        //db3( p.first.first, p.first.second , p.second  );ln;

        sum++;
    }
    ans[0] = (ll)(h-2)*(w-2)-sum;
    
    rep(i,10)cout<<ans[i]<<endl;

    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 56448
/**
*    author:  souzai32
*    created: 05.08.2020 01:20:01
**/

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

int main() {

    string s;
    cin >> s;

    int n=s.size();
    vector<bool> alphabet(26);

    if(n==26){
        int i=1;
        while(1){
            if(s.at(n-i)<s.at(n-1-i)) i++;
            else{
                int j=0;
                while(1){
                    if(s.at(n-1-i)<s.at(n-1-j)){
                        s.at(n-1-i)=s.at(n-1-j);
                        break;
                    }
                    else j++;
                }
                
                for(int j=0; j<i; j++) s.pop_back();
                break;
            }

            if(i==26){
                s="-1";
                break;
            }
        }
    }
    else{
        rep(i,n){
            alphabet.at(s.at(i)-'a')=true;
        }

        int i=0;
        char a='a';
        while(1){
            if(alphabet.at(i)) i++;
            else{
                a+=i;
                s.push_back(a);
                break;
            }
        }
    }

    cout << s << endl;
    //cout << s.size() << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void){
	int a[5], k;

	scanf("%d",&a[0]);
	scanf("%d",&a[1]);
	scanf("%d",&a[2]);
	scanf("%d",&a[3]);
	scanf("%d",&a[4]);
	scanf("%d",&k);

	int flag = 0;

	for(int i=0; i<5; i++){
		for(int j=0;j<5;j++){
			if(abs(a[j]-a[i]) <= k){
				flag += 1;
			}
		}
	}


	if(flag!=25){
		printf(":(\n");
	}else{
		printf("Yay!\n");
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll x,h,w,ans=16384;
ll num[80][80];
bool flags[81][81][26000];
void Main(){
    cin>>h>>w;
    For(i,0,h){
        For(j,0,w){
            cin>>num[i][j];
        }
    }
    For(i,0,h){
        For(j,0,w){
            cin>>x;
            num[i][j]-=x;
        }
    }
    For(i,0,81){
        For(k,0,26000){
            flags[i][0][k]=false;
            flags[0][i][k]=false;
        }
    }
    flags[0][1][13000]=true;
    For(i,0,h){
        For(j,0,w){
            ll a=num[i][j];
            For(k,0,26000){
                flags[i+1][j+1][k]=flags[i][j+1][k-a]||flags[i][j+1][k+a]||flags[i+1][j][k-a]||flags[i+1][j][k+a];
            }
        }
    }
    For(k,0,26000){
        if(flags[h][w][k]) ans=min(ans,abs(k-13000));
    }
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}


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

int main(){
    int N,M,X,Y; cin >> N >> M >> X >> Y;
    vector <int> A(N);
    vector <int> B(M);
    rep(i,N) cin >> A[i];
    rep(i,M) cin >> B[i];
    int ans;
    int ANS=0;
    
    sort(A.begin(),A.end());
    ans=A[N-1]+1;
    sort(B.begin(),B.end());
    
    for (int i=X+1; i<=Y; i++){
        if(i>=ans && i<=B[0]){
            ANS=1;
        }
    }
    
    if(ANS==1) cout <<"No War";
    else cout << "War";

    
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define mod 1000000007
#define INF2 9999999999
#define INF (1 << 30)
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)

using namespace std;
using ll = __int64_t;

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

bool comp(const pair<int, ll>& p1, const pair<int, ll>& p2){
    return p1.second > p2.second;
}

void solve(){
    int p, q, r;
    cin >> p >> q >> r;
    cout << min(min(p+q, q+r), p+r) << endl;
}

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

Measured memory_bytes: 256