akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


int main() {
    char hw[60][60] = {};
    int h,w;
    cin >> h >> w;
    rep(i,0,h){
        rep(j,0,w){
           cin >> hw[i+1][j+1];
        }
    }
    rep(i,1,h+1){
        rep(j,1,w+1){
            if(hw[i][j] == '#') continue;
            int cnt = 0;
            rep(ii,i-1,i+2){
                rep(jj,j-1,j+2){
                    if(hw[ii][jj] == '#'){
                        cnt++;
                    }
                }
            }
            hw[i][j] = (char)('0' + cnt);
        }
    }
    rep(i,1,h+1){
        rep(j,1,w+1){
            cout << hw[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int n, k;
    cin >> n >> k;
    int A[n];
    repi(i, n, 0)
    {
        cin >> A[i];
    }

    int j = 0;
    int ans = INF;
    repi(i, n, k - 1)
    {
        int l = A[j], r = A[i];
        int rot1 = abs(A[j]) + abs(A[j] - A[i]),
            rot2 = abs(A[i]) + abs(A[j] - A[i]);
        ans = min(ans, min(rot1, rot2));
        j++;
    }
    cout << ans << endl;
    return 0;
}

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


int main(){
  int64_t N,count;
  cin >> N;
  count = 0;
  if(N%2 != 0){
    cout << count << endl;
  }else{
    for(int64_t i=5;i<=N;i=i*5){
      count += N/(i*2);
    }
    cout << count << endl;
  }
    
    
    
}


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

//{{{
#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
// clang-format off
void _print() { cerr << "]\033[0m\n"; }
template <typename T> void __print(T x) { cerr << x; }
template <typename T, typename... V> void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
#ifdef LOCAL
#define debug(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m["; _print(x)
#define debug_arr(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m" << (x) << "\033[0m\n"
#else
#define debug(x...)
#define debug_arr(x...)
#endif
// clang-format on
//}}}

int T;

const int N = 2e3 + 10;

const LL inf = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;

int n, m;
int a[N], b[N];

string s;

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif

    while (cin >> s)
    {
        int ans;
        if (s == "SSS") ans = 0;
        if (s == "SSR") ans = 1;
        if (s == "SRS") ans = 1;
        if (s == "SRR") ans = 2;
        if (s == "RSS") ans = 1;
        if (s == "RSR") ans = 1;
        if (s == "RRS") ans = 2;
        if (s == "RRR") ans = 3;
        cout << ans << endl;
    }
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> p(n+1);
    FOR(i,1,n+1){
      cin>>p[i];
    }
    int ans=0;
    FOR(i,1,n+1){
      //cout<<i<<' '<<p[i]<<' '<<p[1]<<' '<<p[2]<<' '<<p[3]<<'\n';
      if(p[i]==i && i!=n){
        //cout<<i<<'\n';
        ans++;
        int x=p[i+1];
        p[i+1]=i;
        p[i]=x;
      }
      if(i==n && p[n]==n){
        //cout<<' '<<i<<'\n';
        ans++;
      }
    }
    /*
    FOR(i,1,n+1){
      cout<<p[i]<<' ';
    }
    */
    //cout<<'\n';
    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>
 
using namespace std;
 
double EPS = 1e-10;
 
double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}
 
struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}
 
  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }
 
  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }
 
  point operator * (double d){
    return point(x*d,y*d);
  }
};
 
struct segment{
  point a,b;
};
 
double dot(point a, point b) {
  return (a.x * b.x + a.y * b.y);
}
 
double cross(point a, point b) {
  return (a.x * b.y - a.y * b.x);
}
 
int is_intersected_ls(point a1, point a2, point b1, point b2) {
  return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
         ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}

int is_point_on_line(point a, point b, point c) {
  return cross(b-a, c-a)==0.0 &&
         (dot(b-a, c-a) > -EPS) &&
         (dot(a-b, c-b) > -EPS);
}

int inside(point p, vector<point> ps){
  point a,b;
  a=b=p;

  b.x=1000000;

  double ymx=-DBL_MAX,ymn=DBL_MAX;
  for(int i=0;i<ps.size();i++){
    ymx=max(ymx,ps[i].y);
    ymn=min(ymn,ps[i].y);
  }
  if(a.y<=ymn||a.y>=ymx)return 0;

  int cnt1=0;
  for(int i=0;i<ps.size();i++)
    if(is_point_on_line(a,b,ps[i]))cnt1++;
  
  int cnt=0;
  for(int i=0;i<ps.size();i++)
    if(is_intersected_ls(ps[i],ps[(i+1)%ps.size()],a,b))cnt++;

  return (cnt-cnt1)%2;
}

int main(void){
  int n;
  point k,s,in;
  vector<point>p; 

  cin >> n;
  while(n--){
    p.clear();
    for(int i=0;i<3;i++){
      cin >> in.x >> in.y;
      p.push_back(in);
    }     

    cin >> k.x >> k.y >> s.x >> s.y;

    if(inside(k,p)!=inside(s,p))cout << "OK" << endl;
    else cout << "NG" << endl;
     
  }
 
  return 0;
}

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

int main() {
	string S;
	cin >> S;
	int N = S.size();
	vector<int> A(N), B(N);
	for (int i = 0; i < N; i++) {
		if (i % 2 == 0) {
			A.at(i) = 1;
		} else {
			B.at(i) = 1;
		}
	}

	int A_cnt = 0, B_cnt = 0;
	for (int i = 0; i < N; i++) {
		if (A.at(i) != S.at(i) - '0') A_cnt++;
		if (B.at(i) != S.at(i) - '0') B_cnt++;
	}

	cout << min(A_cnt, B_cnt) << endl;
}

Measured memory_bytes: 1280
A, V = [ int(i) for i in input().strip().split(' ')]
B, W = [ int(i) for i in input().strip().split(' ')]
T = int(input())

# 鬼が右
if A > B:
    A_len = A-V*T
    B_len = B-W*T
#    A_len = max(-(10**9), A-V*T)
#    B_len = max(-(10**9), B-W*T)
    if A_len <= B_len:
        print('YES')
    else:
        print('NO')
# 鬼が左
else:
    A_len = A+V*T
    B_len = B+W*T
#    A_len = min(10**9, A+V*T)
#    B_len = min(10**9, B+W*T)
    if A_len >= B_len:
        print('YES')
    else:
        print('NO')


Measured memory_bytes: 9080
#include <stdio.h>

int func(int,int);

int main(){
  int x,y;
  scanf("%d %d",&x,&y);
  printf("%d\n",func(x,y));
  return 0;
}
int func (int a,int b){
  int r;
  r=a%b;
  if(r==0)return b;
  return func(b,r);
}



Measured memory_bytes: 2140
def main():
    S = input()
    s_odd = [S[i] for i in range(0, len(S), 2)]  # 奇数文字目のみを格納
    s_even = [S[i] for i in range(1, len(S), 2)]  # 偶数文字目のみを格納
    if "R" in s_even: print("No"); return
    if "L" in s_odd: print("No"); return
    print("Yes")
 
if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll x,y,a,b,t1,t2;
  
  cin>>x>>y>>a>>b;
  if(a%y==0) t1=a/y;
  else t1=(a/y)+1;
  if(x%b==0) t2=x/b;
  else t2=(x/b)+1;
  if(t1<=t2) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
   
}

Measured memory_bytes: 3620
n = int(input())  # nは入力回数
num_list = []
for i in range(n):
    num_list.append(list(map(int,input().split())))
count = 0


for l in range(n):
  if count == 3:
    break
  if num_list[l][0] == num_list[l][1]:
    count += 1
  else:
    count = 0

if count == 3: 
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9184
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in x;
  cin>>x;
  in s=(x/11)*2;
  x%=11;
  if(x)
    ++s;
  if(x>6)
    ++s;
  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;

int N,A[2001], B[2001], dp[2001][2001][2], done[2001][2001][2];

int solve(int a, int b, int turn) {
    if (done[a][b][turn]) return dp[a][b][turn];
    
    int cur = max(a,b)+1;
    done[a][b][turn] = 1;
    
    if (cur == N+1) return dp[a][b][turn] = abs(A[a]-B[b]);
    if (turn == 0) {
        return dp[a][b][turn] = max(solve(cur,b,turn),solve(cur,b,turn^1));
    } else {
        return dp[a][b][turn] = min(solve(a,cur,turn),solve(a,cur,turn^1));
    }
}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> N >> A[0] >> B[0];
	FOR(i,1,N+1) {
	    cin >> A[i];
	    B[i] = A[i];
	}
	cout << solve(0,0,0);
}

// read!
// ll vs. int!

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

#define rep(i,n)  for(int i=0;i<n;++i)
#define per(i,n)  for(int i=n-1;i>=0;--i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)
#define sc3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define sl1(a)  scanf("%lld",&a)
#define sl2(a,b)  scanf("%lld %lld",&a,&b)
#define sl3(a,b,c)  scanf("%lld %lld %lld",&a,&b,&c)
#define PI 3.1415926535897932

//typedef long long ll;

const int MAX=710000;
const int MOD=1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i=2;i<MAX;i++) {
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k) {
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
int main(){
    COMinit();
    int x,y,ans=0;
    sc2(x,y);
    if ((x+y)%3!=0 || x>(x+y)/3*2 || y>(x+y)/3*2){
        printf("0\n");
        return 0;
    }
    ans=COM((x+y)/3,min(x,y)-(x+y)/3);
    printf("%d\n",ans%MOD);
    return 0;
}


Measured memory_bytes: 16896
// g++ -std=gnu++1y -O2 xxx.cpp

#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>;
#define rep(i,l,r)for(int i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31)) /*オーバーフローしない程度に大きい数*/
#define MOD 1000000007


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

    int a[N+1],b[N+1],c[N+1];
    rep(i,1,N+1) cin>>a[i]>>b[i]>>c[i];
    
    int dp[N+1][3];
    memset(dp, 0, sizeof(dp));

    int ans;
    rep(i,1,N+1) {
        dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
        dp[i][1]=max(dp[i-1][0]+b[i],dp[i-1][2]+b[i]);
        dp[i][2]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
    }
    ans=max(dp[N][0],max(dp[N][1],dp[N][2]));

    cout << ans << endl;

    return 0;
}

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

typedef valarray<double> vec;
typedef valarray<vec> mat;

// forward elimination
inline int pivoting(mat &a,int k){
	int n=a.size(),p=k,ret=0;
	double cmax=abs(a[k][k]);
	range(i,k+1,n){
		if(abs(a[i][k])>cmax){
			p=i,ret=1;
			cmax=abs(a[i][k]);
		}
	}
	if(k!=p) swap(a[k],a[p]);
	return ret;
}

// forward elimination
int forward(mat &a){
	int n=a.size(),m=a[0].size(),ret=0;
	rep(i,n-1){
		ret+=pivoting(a,i);
		if(abs(a[i][i])<1e-10) break;
		range(j,i+1,n){
			double coef=a[j][i]/a[i][i];
			range(k,i,m) a[j][k]-=coef*a[i][k];
		}
	}
	return ret;
}

//backward substitution

vec back(mat &a){
	int n=a.size(),m=a[0].size();
	vec x(0.0,n);
	x[n-1]=1.0;
	for(int i=n-2;i>=0;i--){
		double sum=0.0;
		if(i+1<n) range(j,i+1,n) sum+=a[i][j]*x[j];
		x[i]=1.0/a[i][i]*(a[i][m-1]-sum);
	}
	// rep(i,n) cout << x[i] << endl;
	return x;
}

int s,n,k;
double dp[11][120];

void init(int m){
	dp[0][0]=1.0;
	rep(i,k)rep(j,m+1){
		range(add,1,n+1){
			dp[i+1][j+add]+=1.0*dp[i][j]/n;
		}
	}
	return;
}

mat mul(mat a,mat b){
	int m=a.size();
	mat c(vec(0.0,m),m);
	rep(i,m)rep(j,m) rep(k,m) c[i][j]+=a[i][k]*b[k][j];
	return c;
}

mat power(mat a,int n){
	int m=a.size();
	mat b(vec(0.0,m),m);
	rep(i,m) b[i][i]=1.0;
	while(n){
		if(n&1) b=mul(b,a);
		a=mul(a,a);
		n>>=1;
	}
	return b;
}

int main(void){
	cin >> s >> n >> k;
	s=abs(s);
	if(n==1){
		if(s%k)
			cout << -1 << endl;
		else
			cout << s/k << endl;
		return 0;
	}
	int m=n*k+1;
	init(m);
	mat a(vec(0.0,m+1),m);

	rep(i,m) a[i][i]-=1.0;
	rep(i,m-1){
		int cur=i+1;
		rep(j,m){
			int tar=abs(cur-j);
			if(tar>0) a[i][tar-1]+=dp[k][j];
		}
	}
	rep(i,m) a[i][m-1]+=1.0;
	rep(i,m) a[i][m]=0.0;

	forward(a);
	vec x=back(a);

	cout.precision(20);
	if(s<=n*k){
		cout << fixed <<  x[s-1] << endl;
		return 0;
	}

	mat b(vec(0.0,m),m);
	rep(i,m-1) b[i][i+1]=1.0;
	rep(i,m-1) b[m-2][i]=dp[k][m-1-i];
	b[m-2][m-1]=1.0;
	b[m-1][m-1]=1.0;

	int idx=s-n*k;
	b=power(b,idx);
	double ans=0.0;
	rep(i,m) ans+=b[m-2][i]*x[i];
	cout << ans << endl;
	return 0;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

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

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}


void Main()
{
    int n;cin>>n;
    VI v(n);
    REP(i, n) cin >> v[i];
    VI c(n);
    REP(i, n) cin >> c[i];

    int result = 0;
    REP(i,n){
        result += max(0,v[i]-c[i]);
    }
    cout<<result<<endl;
    
    

	return;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 2e5+10 , OO = 0x3f3f3f3f ;
//const int mod = 1000000007;
 
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(vec) for(auto &x : vec) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

int n , k;

int main()
{
   // startTime = (double)clock();
    #ifndef ONLINE_JUDGE
        //freopen("in.in", "r", stdin);
        //freopen("out.in", "w", stdout);
    #endif
	//ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    scanf("%d %d", &n , &k);
    vector < int > a(n);
    for(int i = 0 ; i < n ; ++i)
        scanf("%d" , &a[i]);
    sort(ALL(a));
    int sum = 0;
    for(int i = 0 ; i < k ; ++i)
        sum += a[i];
    printf("%d\n", sum);



    return 0;
}

Measured memory_bytes: 3800
process.stdin.on("data",function(c){
	var x=0,y=0,r=0,p=Math.PI/180;
	(c+"").trim().split("\n").some(function(n){
		n=n.split(",");
		x+=+n[0]*Math.sin(r*p);
		y+=+n[0]*Math.cos(r*p);
		r+=+n[1];
	});
	console.log(x|0);
	console.log(y|0);
}).resume();

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

int main(){
	int n,p; cin>>n>>p;
	vector<int> v(n);
	bool even=true;
	rep(i,n) {cin>>v[i]; if(v[i]%2!=0) even=false;}
	
	if(even&&p==1) cout<<0<<endl;
	else if(even&&p==0){
		ll ans=2;
		for(int i=1; i<n; i++){
			ans*=2;
		}
		cout<<ans<<endl;
	}
	else {
		ll ans=2;
		for(int i=1; i<n; i++){
			ans*=2;
		}
		cout<<ans/2<<endl;
	}
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
const ll INF=1000000000000001;
const double PI=3.141592653589;


int main(){
  int n; cin>>n;
  if(n%2==0)
  cout<<n<<endl;
  else
  cout<<n*2<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	int n;
	cin >> n;
	vector<ll> v(n);
	rep(i,n) cin >> v[i];
	vector<ll> sum(n+1);
	rep(i,n) sum[i+1] = sum[i] + v[i];
	ll l = sum[n];
	ll ans = abs(sum[1] - (l - sum[1]));
	for (int i = 1; i <= n - 1; i++) {
		ll x = sum[i];
		ll y = l - sum[i];
		ans = min(ans, abs(x-y));
	}
	cout << ans << endl;
}

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

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

int main(void)
{
    int h,w;
    string ans1,ans2;

    while (true)
    {
        cin >> h >> w;
        if (h == 0 && w == 0)   break;

        ans1 = "";
        rep(i, w)
            ans1 += "#";
        ans2 = "#";
        for (int i = 1; i < w-1; i++)
            ans2 += ".";
        ans2 += "#";

        cout << ans1 << endl;
        for (int i = 1; i < h - 1; i++)
            cout << ans2 << endl;
        cout << ans1 << endl;

        cout << endl;
    }
}



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

int m,n,bk[100];
int check(int hi,int lo) {
	int i,h=0,s;
	for (i=0;i<m;i++) {
		s=0;
		while(true) if (s+bk[h]<=(hi+lo)/2 && h<n) s+=bk[h++]; else break;
	}
	if (h==n) return 1;
	return 0;
}
int main() {
    int hi,lo,i;
    while(cin >> m >> n) {
		if (m==0) break;
		hi= 1500000; lo=0;
		for (i=0;i<n;i++) cin >> bk[i];
		for (i=0;i<22;i++) if (check(hi,lo)==1) hi=(hi+lo)/2; else lo=(hi+lo)/2;
		cout << hi << endl; 
	}	
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main(void) {
	int i,n,m,na,nb,min=114514,s=0;
	scanf("%d%d",&n,&m);
	for(i = 1;i <= m;i++){
		scanf("%d%d",&na,&nb);
		if(n > na){s+=(n-na);}
		if(min > na){min = na;}
	}
	printf("%d\n",s-(n-min));
	return 0;
}

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

int n;
int a[N],cnt[N];

int main()
{
	int sum=1,ans=1;
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&a[i]);
		ans*=3;
		if(a[i]%2==0) sum*=2;
	}
	printf("%d\n",ans-sum);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	cin>>n;
	while(n>0)
	{
		if(n%10==9)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
		n=n/10;
	}
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf 1000000005
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define mod 1000000007
#define sz(a) ((ll)(a).size())

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcount(s);}
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define eps 1e-9
typedef pair<int, int> II;
typedef pair<ll, ll> LL;
template<class T> T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;}
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define PI (2 * acos((ld)0))
#define linf (1ll << 60)
#define y1 y32432
#define y0 y435346

#define maxn 305

ll f[maxn][maxn], g[maxn][maxn];
int n, m;

void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
}

int main()
{
//	gen();
//	freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    ms(f, 0); ms(g, 0);
    cin >> n >> m;
    f[1][1] = 1;

    Rep(run, m){
    	For(i, 1, n) For(j, 0, n) {
    		g[i][j] = f[i][j];
    		f[i][j] = 0;
    	}
    	For(i, 1, n) For(j, 0, i) if(g[i][j]){
    		add(f[i + 1][j], g[i][j] * (n - i) % mod);
    		add(f[i][i], g[i][j] * j % mod);
    		add(f[i][j], g[i][j] * (i - j) % mod);
    	}
    }

    cout << f[n][n] << endl;

    return 0;
}


Measured memory_bytes: 1664
#include <stdio.h>
int dp[50];

int fib(int n){
  if(n==0||n==1) return dp[n]=1;
  if(dp[n]!=-1) return dp[n];
  return dp[n] = fib(n-1)+fib(n-2);
}

int main(){
  int n,i;
  for(i=0;i<50;i++) dp[i] = -1;

  scanf("%d",&n);
  printf("%d\n",fib(n));
  return 0;
}


Measured memory_bytes: 2056
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+5;
const int mod=1e9+7;
int n;
ll ans1=1,ans2=1,ans3=1;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)ans1=ans1*10%mod;

    for(int i=1;i<=n;i++)ans2=ans2*9%mod;

    for(int i=1;i<=n;i++)ans3=ans3*8%mod;

    ans1=(ans1-2*ans2%mod+mod)%mod;
    ans1=(ans1+ans3)%mod;

    printf("%lld\n",ans1);

    return 0;
}


Measured memory_bytes: 3864
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	int a,b,c;
	public void solve() {

		String sa = next();
		String sb = next();
		String sc = next();
		a = 0;
		b = 0;
		c = 0;
		char now = 'a';
		while(true){

			if(now == 'a'){
				if(a == sa.length()){
					out.println("A");
					return;
				}
				now = sa.charAt(a);
				a++;
			}else if(now == 'b'){
				if(b == sb.length()){
					out.println("B");
					return;
				}
				now = sb.charAt(b);
				b++;
			}else{
				if(c == sc.length()){
					out.println("C");
					return;
				}
				now = sc.charAt(c);
				c++;
			}
		}

	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

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

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

Measured memory_bytes: 8020
#include "bits/stdc++.h"
using namespace std;
#define all(v) (v).begin(), (v).end()
#define io ios::sync_with_stdio(0)
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rson rt << 1 | 1, mid + 1, r
#define lson rt << 1, l, mid
#define lll __int128
#define pii pair<int, int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eps 1e-12
#define int long long
const int mod = 1e9 + 7;
inline int ksm(int a, int b)
{
    int ans = 1;
    for (; b; b >>= 1, a = a * a % mod)
        if (b & 1)
            ans = ans * a % mod;
    return ans;
}
char s[2000000];
int c[2000000],b[2000000];
signed main()
{
    io;
    cin>>s+1; int n=strlen(s+1)+1;
    for(int i=2;i<=n;i++){
        if(s[i-1]=='<')b[i]=b[i-1]+1;
    }
    for(int i=n-1;i;i--){
        if(s[i]=='>')c[i]=c[i+1]+1;
    }
    int ans = 0;
    rep(i,1,n)ans+=max(c[i],b[i]);
    cout<<ans<<endl;
    
    getchar(); //
    getchar();
}


Measured memory_bytes: 12544
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

int main(void) {
  ll N;
  cin >> N;
  vector<ll> A(1LL << N);
  REP(i, 0, 1LL << N) cin >> A[i];

  const ll INF = 1LL << 50;
  vector<pll> dp(1LL << N);
  REP(i, 0, 1LL << N) dp[i] = pll(i, 0);
  REP(i, 0, 1LL << N) {
    REP(j, 0, N) if(!(i & (1LL << j))) {
      pll x = dp[i | (1LL << j)], y = dp[i];
      vector<ll> s = { x.first, x.second, y.first, y.second };
      sort(s.begin(), s.end());
      s.erase(unique(s.begin(), s.end()), s.end());
      sort(s.begin(), s.end(), [&](ll p, ll q) { return A[p] > A[q]; });
      dp[i | (1LL << j)] = pll(s[0], s[1]);
    }
  }

  ll ans = 0;
  REP(i, 1, 1LL << N) {
    ans = max(ans, A[dp[i].first] + A[dp[i].second]);
    cout << ans << endl;
  }
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using ll = long long;
using P = pair<int,int>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}




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

    vector<ll> A(N+1);
    vector<ll> P(N+1);
    vector<ll> M(N+1);
    map<ll, ll> map1;
    map<ll, ll> map2;

    rep2(i,1,N+1){
        cin >> A[i];
        P[i] = i + A[i];
        M[i] = i - A[i];
        map1[P[i]] += 1;
        map2[M[i]] += 1;
    }

    ll ans = 0;

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

    cout << ans << endl;

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 42168
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int H, W;
int my[] = {-1, 1, 0, 0};
int mx[] = {0, 0, -1, 1};
string tank = "^v<>";

void disp(vector< vector<char> > &v, bool t, int y, int x, int d){
  REP(i, H){
    REP(j, W){
      if(i == y && j == x) cout <<tank[d];
      else cout <<v[i][j];
    }
    cout <<endl;
  }
  if(t) cout <<endl;
}

void move(vector< vector<char> > &v, char c, int &y, int &x, int &d){
  if(c == 'U') d = 0;
  if(c == 'D') d = 1;
  if(c == 'L') d = 2;
  if(c == 'R') d = 3;
  if(c == 'S'){
    int xx = x, yy = y;
    while(xx >= 0 && yy >= 0 && xx < W && yy < H){
      if(v[yy][xx] == '#') break;
      if(v[yy][xx] == '*') { v[yy][xx] = '.'; break; }
      yy += my[d]; xx += mx[d];
    }
  }
  if(c != 'S' && y + my[d] >= 0 && y + my[d] < H && x + mx[d] >= 0 && x + mx[d] < W && v[y + my[d]][x + mx[d]] == '.') { y += my[d]; x += mx[d]; }
}

int main() {
  int T; cin >>T;
  REP(t, T){
    cin >>H >>W;
    vector< vector<char> > v(H, vector<char>(W));
    REP(i, H) REP(j, W) cin >>v[i][j];
    int y, x, d, l;
    REP(i, H){
      REP(j, W){
        int l = tank.find(v[i][j], 0);
        if(l != string::npos) { y = i; x = j; d = l; v[i][j] = '.'; }
      }
    }
    int N; cin >>N;
    REP(n, N){ char c; cin >>c; move(v, c, y, x, d); }
    disp(v, t + 1 == T ? 0 : 1, y, x, d);
  }
  return 0;
}

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

int main(){
  int A,B;
  cin >> A >> B;
  if(A>12){
    cout << B << endl;
  }else if(A<6){
    cout << 0 << endl;
  }else{
    cout << B/2 << endl;
  }
  return 0;
}


Measured memory_bytes: 3620
// Why am I so dumb? :c
#include<bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

const int MAXN = (int)1e3 + 5;

char s[MAXN][MAXN];

int n, m, a, b;

bool greedy(int a, int b) {
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			if (s[i][j] == '.' && s[i][j + 1] == '.' && s[i + 1][j] == '.' && s[i + 1][j + 1] == '.') {
				if (b >= 2) {
					s[i][j] = s[i][j + 1] = '^';
					s[i + 1][j] = s[i + 1][j + 1] = 'v';
					b -= 2;
				}
			}			
		}
	}

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			if (s[i][j] == '.' && s[i][j + 1] == '.' && s[i + 1][j] == '.' && s[i + 1][j + 1] == '.') {
				if (a >= 2) {
					s[i][j] = s[i + 1][j] = '<';
					s[i][j + 1] = s[i + 1][j + 1] = '>';
					a -= 2;
				}
			}
		}
	}

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {			
			if (s[i][j] == '.' && s[i + 1][j] == '.') {
				if (b >= 1) {
					s[i][j] = '^';
					s[i + 1][j] = 'v';
					--b;
				}
			}
		}
	}

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			if (s[i][j] == '.' && s[i][j + 1] == '.') {
				if (a >= 1) {
					s[i][j] = '<';
					s[i][j + 1] = '>';
					--a;
				}
			}
		}
	}

	if (a == 0 && b == 0) {
		printf("YES\n");

		for (int i = 0; i < n; ++i) {
			printf("%s\n", s[i]);
		}

		return 1;
	}

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			s[i][j] = '.';
		}
	}

	return 0;	
}

void solve() {
	scanf("%d %d %d %d", &n, &m, &a, &b);

	if ((a + b) * 2 > n * m) {
		printf("NO\n");
		return;
	}    

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			s[i][j] = '.';
		}
	}

	if (greedy(a, b)) {		
		return;
	}    

	if (n % 2 == 1 && m % 2 == 1 && a >= 2 && b >= 2) {
		/*
		<>^
		^.v
		v<>
		*/

		s[0][0] = '<';
		s[0][1] = '>';
		s[0][2] = '^';
		s[1][0] = '^';
		s[1][2] = 'v';
		s[2][0] = 'v';
		s[2][1] = '<';
		s[2][2] = '>';

		if (greedy(a - 2, b - 2)) {			
			return;			
		}

		s[0][0] = '<';
		s[0][1] = '>';
		s[0][2] = '^';
		s[1][0] = '^';
		s[1][2] = 'v';
		s[2][0] = 'v';
		s[2][1] = '<';
		s[2][2] = '>';

		int _a = a - 2, _b = b - 2;

		for (int i = 3; i + 1 < n; i += 2) {
			if (_b > 0) {
				s[i][2] = '^';
				s[i + 1][2] = 'v';
				--_b;
			}
		}

		for (int i = 3; i + 1 < m; i += 2) {
			if (_a > 0) {
				s[2][i] = '<';
				s[2][i + 1] = '>';
				--_a;
			}
		}

		if (greedy(_a, _b)) {
			return;
		}
	}

	if (n % 2 == 1) {
		int _a = a;	

		for (int i = 0; i + 1 < m; i += 2) {
			if (_a > 0) {
				s[n - 1][i] = '<';
				s[n - 1][i + 1] = '>';
				--_a;
			}
		}
		
		if (greedy(_a, b)) {
			return;			
		}
	}

	if (m % 2 == 1) {
		int _b = b;	

		for (int i = 0; i + 1 < n; i += 2) {
			if (_b > 0) {
				s[i][m - 1] = '^';
				s[i + 1][m - 1] = 'v';
				--_b;
			}
		}
		
		if (greedy(a, _b)) {			
			return;			
		}
	}

	printf("NO\n");
}

int main() {
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 2176
import java.util.*;

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

        long a = sc.nextLong();
        long b = sc.nextLong();
        long n = sc.nextLong();

        long ans = Long.MIN_VALUE;
        long x = Math.min(b - 1, n);

        long j = (long)((double)a * x / b);
        long k = (long)((double)x / b);
        long l = j - a * k;
        ans = Math.max(ans, l);

        System.out.println(ans);

    }
}


Measured memory_bytes: 35628
N, = map(int, input().split())
X = list(map(int, input().split()))
r = 0
for d in range(1, N):
    s = 0
    vs = set([0, N-1])
    for ld in range(d, N, d):
        bld = N-ld-1
        vs.add(bld)
        if ld in vs or bld < d:
            break
        vs.add(ld)
        s += X[ld] + X[bld]
        r = max(s, r)
print(r)


Measured memory_bytes: 88148
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

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

int main(){
    string s, t;
    cin >> s >> t;
    int len = s.size(), cnt=0;
    rep(i, len){
        if(s[i]!=t[i]){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3916
num = list(map(int, input().split()))
H = list(map(int, input().split()))
N = num[0]
K = num[1]

dp = [float("inf")] * N
dp[0] = 0
for i in range(N):
    try:
        for j in range(K):
            dp[i+1] = min(dp[i+1], dp[i-j]+abs(H[i+1]-H[i-j]))
    except:
        continue

print(dp[-1])

Measured memory_bytes: 55392
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long idx=0;
    long A, B;
    cin >> A >> B;
    if (A < 10 && B < 10) cout << A*B << endl;
    else cout << -1 << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int countAC = 0;
        int countWA= 0;
        int countTLE = 0;
        int countRE = 0;
        for(int i =0; i < N; i++){
            String str = sc.next();
            if(str.equals("AC")){
                countAC++;
            }else if(str.equals("WA")){
                countWA++;
            }else if (str.equals("TLE")){
                countTLE++;
            }else{
                countRE++;
            }
        }
        System.out.println("AC x " + countAC );
        System.out.println("WA x " + countWA );
        System.out.println("TLE x " + countTLE );
        System.out.println("RE x " + countRE );
    }
}


Measured memory_bytes: 59068
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        String[] s = scanner.nextLine().split(" ");
        int an[] = new int[n];
        for (int i = 0; i < n; i++) {
            an[i] = Integer.parseInt(s[i]);
        }
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if (an[i] < an[j]) {
                    int tmp = an[i];
                    an[i] = an[j];
                    an[j] = tmp;
                }
            }
        }
        int diff = 0;
        for (int i = 0; i < n - 1; i += 2) {
            diff += an[i] - an[i + 1];
        }
        if (n % 2 == 1) {
            diff += an[n - 1];
        }

        System.out.println(diff);
        scanner.close();
    }
}


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

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	if (A + B > C + D) {
		cout << "Left";
	} else if (A + B == C + D) {
		cout << "Balanced";
	} else {
		cout << "Right";
	}
	return 0;
}

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

using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    if(a>b*2)
    {
        cout<<a-(b*2)<<endl;
    }
    else
    {
        cout<<"0"<<endl;
    }
    return 0;
}



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

int main()
{
    long N;
    cin >> N;
    long buf;
    vector <long> A(N);
    for(int i = 0; i < N - 1; i++){
      cin >> buf;
      A[buf - 1]++;
    }
    for(int i = 0; i < N - 1; i++){
      cout << A[i] << endl;
    }
    cout << "0" << endl;
    return 0;
}


Measured memory_bytes: 4792
import sys

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))
# print(A)
# print(B)

sum_a = sum(A)
sum_b = sum(B)
need_n = sum_b - sum_a

need_an = 0
need_bn = 0
for i in range(N):
    if A[i] > B[i]:
        need_bn += A[i] - B[i]
    elif A[i] < B[i]:
        tmp = B[i] - A[i]
        need_an += tmp // 2

# print(need_n, need_an, need_bn)
if sum_a <= sum_b and need_an >= need_bn:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 10404
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N;
  cin >> N;
  int H,W;
  cin >> H >> W;
  cout << (N-H+1) * (N-W+1) << endl;
  return 0;
}

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

int main(){
    long long int x;
    cin >> x;
    for (int a=0;a<1000;++a){
        for(int b=-1000;b<1000;++b){
            if((a*a*a*a*a)-(b*b*b*b*b)==x){
                cout << a << " " << b << endl;
                return(0);
            }
        }

    }
    
}

Measured memory_bytes: 3584
#include<cstdio>
using namespace std;
char s; 
int main()
{
	scanf("%c", &s);
	if(s == 'a' || s == 'e' || s == 'i' || s == 'o' || s == 'u') printf("vowel\n");
	else printf("consonant\n");
	return 0;
}


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

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,dp[3005][3005];
int cev;
string s,ss,s1;
vector<int> v;

int main(void){
	fio();
	cin>>s>>ss;
	for(int i=0;i<=(int)s.size();i++){
		for(int j=0;j<=(int)ss.size();j++){
			if(i==0 || j==0)dp[i][j]=0;
			else if(s[i-1]==ss[j-1])dp[i][j]=dp[i-1][j-1]+1;
			else dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
		}
	}
	//~ cout<<dp[s.size()][ss.size()]<<endl;
	int x=s.size();
	int y=ss.size();
	//~ int ind=dp[s.size()][ss.size()];
	while(x>0 && y>0){
		
		if(s[x-1]==ss[y-1]){s1+=s[x-1];x--;y--;}
		else if(dp[x-1][y]>dp[x][y-1]){x--;}
		else y--;
		//~ cout<<x<<" "<<y<<endl;
	}
	reverse(s1.begin(),s1.end());
	cout<<s1<<endl;
	return 0;
}


Measured memory_bytes: 37248
using System;
namespace _0006
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int how = str.Length;
            for(int i=0;i<how;i++)
            {
                Console.Write(str[how-i-1]);
            }
            Console.WriteLine();
        }
    }
}

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

vector<ll> memo(100000);

ll dfs(ll num) {
  if (num < 0) {
    return 1000000;
  } else if (num == 0) {
    return 0;
  } else if (num < 6) {
    return num;
  }
  if (memo[num] > 0) return memo[num];

  ll res1 = 1 + dfs(num - pow(6, 1));
  ll res2 = 1 + dfs(num - pow(6, 2));
  ll res3 = 1 + dfs(num - pow(6, 3));
  ll res4 = 1 + dfs(num - pow(6, 4));
  ll res5 = 1 + dfs(num - pow(6, 5));
  ll res6 = 1 + dfs(num - pow(6, 6));

  ll res7  = 1 + dfs(num - pow(9, 1));
  ll res8  = 1 + dfs(num - pow(9, 2));
  ll res9  = 1 + dfs(num - pow(9, 3));
  ll res10 = 1 + dfs(num - pow(9, 4));
  ll res11 = 1 + dfs(num - pow(9, 5));

  memo[num] = min(
      res1,
      min(res2,
          min(res3,
              min(res4,
                  min(res5,
                      min(res6,
                          min(res7,
                              min(res8, min(res9, min(res10, res11))))))))));
  return memo[num];
}

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

  cout << dfs(n) << endl;
}

Measured memory_bytes: 2816
#include <stdio.h>
#include <limits.h>

int main(void){
    
   long int A = 0;
   long int B = 0;
   long int K = 0;
   //int i;
   
   scanf("%ld",&A);
   scanf("%ld",&B);
   scanf("%ld",&K);
   
   if(A>=K){
       A = A-K;
   }else{
       K = K-A;
       A = 0;
       B = B-K;
       if(B<0){
           B = 0;
       }
   }
   
   
   
    printf("%ld %ld\n", A, B);
    
    return 0;
    
}


Measured memory_bytes: 128
A, B, C, D = list(input())

N = 3
for i in range(2**N):
    op123 = ['+', '+', '+']
    for j in range(N):
        if((i >> j) & 1):
            op123[j] = '-'

    if eval(A+op123[0]+B+op123[1]+C+op123[2]+D) == 7:
        print((A+op123[0]+B+op123[1]+C+op123[2]+D+'=7'))
        exit(0)


Measured memory_bytes: 3060
import java.util.*;
/*
NOTES:
-more than 10 digits (10^10), use long
-prefix sum of 1's and -1's to control flow of highlighting a region
-log(a)/log(b) = log base b of a
-create a position array if trying to see if elements show up next to each other sequentially
 i.e. elements 1,2,3 are within 3 spots of each other in an array
      arr[scannedInt - 1] = i; (position of i at p[i] in original)
- use a freq array when counting instances of an element occurring
- increment the counter first before simulating anything turn-based (two player game)

 */

public class Main {
    static long mod = (long)(Math.pow(10, 9) + 7);
    public static String alpha = "zabcdefghijklmnopqrstuvwxy";
    public static void main(String[] args) {
        Scanner scan =new Scanner(System.in);
        char[] arr = scan.next().toCharArray();
        if(Character.isLowerCase(arr[0])) System.out.println("a");
        else System.out.println("A");

        scan.close();
    }





    static int GCD(int a, int b) {
        // Everything divides 0
        if (a == 0) return b;
        if (b == 0) return a;

        // base case
        if (a == b) return a;

        // a is greater
        if (a > b) return GCD(a-b, b);
        return GCD(a, b-a);
    }
    static int LCM(int a, int b){
        return (a*b)/(GCD(a,b));
    }
    static String rev(String s){
        char[] arr = s.toCharArray();
        for(int i = 0; i<(s.length()+1)/2; i++){
            char temp = arr[i];
            arr[i] = arr[s.length()-i-1];
            arr[s.length()-i-1] = temp;
        }
        String fin = new String(arr);
        return fin;
    }
    static long pow(long a, long N) {
        if (N == 0) return 1;
        else if (N == 1) return a;
        else {
            long R = pow(a,N/2);
            if (N % 2 == 0) {
                return R*R;
            }
            else {
                return R*R*a;
            }
        }
    }

    static long powMod(long a, long N) {
        if (N == 0) return 1;
        else if (N == 1) return a % mod;
        else {
            long R = powMod(a,N/2) % mod;
            R *= R;
            R %= mod;
            if (N % 2 == 1) {
                R *= a;
                R %= mod;
            }
            return R % mod;
        }
    }

}

Measured memory_bytes: 35628