akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t MOD=1000000007;
 
int main() {
  
  int a; cin>>a;
  string s[a];
  int ac =0, wa=0, tle=0, re=0;
  for (int i=0; i<a; i++) {
    cin >> s[i];
    
  }
  for (int i=0; i<a; i++) {
    
    if (s[i] == "AC") ac++;
  }
  for (int i=0; i<a; i++) {
    if (s[i]== "WA") wa++;
  }
  for (int i=0; i<a; i++) {
    if (s[i]== "TLE") tle++;
  }
  for (int i=0; i<a; i++) {
    if (s[i] =="RE") re++;
  }
  cout <<  "AC x " << ac << endl;
  cout <<  "WA x " << wa << endl;
  cout <<  "TLE x " << tle << endl;
  cout <<  "RE x " << re << endl;
  
}

Measured memory_bytes: 6672
n = int(input())
a = list(map(int, input().split()))

r = 0
tempSum = 0
xor = 0
count = 0

for l in range(n):
    while r < n and (tempSum + a[r]) == (xor ^ a[r]):
        tempSum += a[r]
        xor ^= a[r]
        r += 1
    
    count += (r - l)

    tempSum -= a[l]
    xor ^= a[l]

print(count)

Measured memory_bytes: 23560
#include <cstdio>
#include <cstring>

const int MaxN = 10000 + 5;

int N, K;
char S[MaxN];

inline char nextUpper(char c) {
  if (c == 'Z') return 'A';
  else return c + 1;
}

int main() {
  scanf("%d", &K);
  scanf("%s", S + 1);
  for (int i = 1; S[i]; ++i) {
    char c = S[i];
    for (int j = 1; j <= K; ++j) c = nextUpper(c);
    putchar(c);
  }
  putchar('\n');
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main() {
	int  i, j, b, min, n, cnt, a[100];
	cnt = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	
	for (i = 0; i < n; i++) {
		min = i;
		for (j = i; j < n; j++) {
			if (a[min] > a[j]) {
				min = j;
			}
		}
		if (i != min) {
			b = a[i];
			a[i] = a[min];
			a[min] = b;
			cnt++;
		}
	}

	for (i = 0; i < n-1; i++) {
		printf("%d ", a[i]);
	}
	printf("%d\n", a[n - 1]);
	printf("%d\n", cnt);

	return 0;
}

Measured memory_bytes: 600
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
// #define mp make_pair
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'
#define int ll
vector<ll> ft(1, 1LL);

/*======================================================================*/
// ll power(ll x, ll y) {
//     ll res = 1;x %= mod;
//     while (y > 0) {
//         if (y & 1)res = (res*x) % mod;
//         y = y>>1;
//         x = (x*x) % mod;
//     }
//     return res%mod;
// }
// bool cmp(pair<int, int> a, pair<int, int> b){
//     return (a.fi+a.si) > (b.fi+b.si);
// }
// void solve(){
//     int n, s = 0;
//     cin >> n;
//     vector<pair<int, int> > v(n) ;
//     rep(i, 0, n)cin >> v[i].fi >> v[i].si, s += v[i].fi;
//     sort(all(v), cmp);
//     rep(i, 0, n){
//         if(v[i].fi+v[i].si <= s){
//             cout << "INDEFINITELY\n";
//             return;
//         }
//         else s -= v[i].fi;
//     }
//     int mi, ans = s;
//     rep(i,0,n){
//         if()
//     }
// }
class Dsu {
    public :
    vector<int> drr;
    vector<int> size_arr;
    Dsu (int n) {
        rep(i, 0, n+1)drr.pb(i), size_arr.pb(1);
    }
    int f_p (int a) {return drr[a] == a ? a : f_p(drr[a]);}
    ll size (int a) {return (ll)size_arr[f_p(a)];}
    void uni(int a, int b) {
        int ap = f_p(a);
        int bp = f_p(b);
        if(ap == bp)return;
        if(size_arr[ap] <= size_arr[bp])swap(ap,bp);
        drr[bp] = ap;
        size_arr[ap] += size_arr[bp];
    }
};
void solve() {
    int d, s, t;
    cin >> d >> s >> t;
    if(d <= s*t)cout<< "Yes\n";
    else cout << "No\n";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    // fact((2e6+10));
    // //declare  and  global
    int t = 1;
    // cin >> t;
    rep(i, 0, t){
        solve();
    }
}


Measured memory_bytes: 3640
N, K = map(int, input().split())
a = []
b = []
Sum = 0
for i in range(N):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)
s = [*range(len(a))]
sort_s = sorted(s, key = lambda i: a[i])
sort_a = [a[i] for i in sort_s]
sort_b = [b[i] for i in sort_s]
for i in range(N):
    Sum += sort_b[i]
    if Sum >= K:
        print(sort_a[i])
        break

Measured memory_bytes: 23716
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;
/*
vector<vector<ll>> dat;
template<class T>struct SegTree{
	int n;
	SegTree(const vector<T> &v){
		int size = v.size();
		for(n = 1; n < size; n *= 2);
		dat.resize(2 * n - 1);
		
		rep(i, n) dat[i + n - 1].pb(v[i]);
		for(int i = n - 2; i >= 0; i--){
			int l = i * 2 + 1, r = i * 2 + 2;
			dat[i].resize(dat[l].size() + dat[r].size());
			merge(all(dat[l]), all(dat[r]), dat[i].begin());
		}
	}
	
	int query(int a, int b, T val, int k, int l, int r){
		if(r <= a || b <= l) return 0;
		if(a <= l && r <= b){
			if(k >= dat.size() || dat[k].empty()) return 0;
			return dat[k].end() - lower_bound(all(dat[k]), val);
		}
		int vl = query(a, b, val, k * 2 + 1, l, (l + r) / 2);
		int vr = query(a, b, val, k * 2 + 2, (l + r) / 2, r);
		
		return vl + vr;
	}
	int query(int a, int b, T val){ return query(a, b, val, 0, 0, n); }
};
*/

int bit[210000];
int sum(int i){
	int res = 0;
	for(; i; i -= i & -i) res += bit[i];
	return res;
}
void add(int i, int x){
	for(; i < 210000; i += i & -i) bit[i] += x;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, k; cin >> n >> k;
	vi a(n);
	vector<ll> s(n + 1);
	rep(i, n) cin >> a[i], s[i + 1] = s[i] + a[i];
	
	rep(i, n + 1) s[i] -= (ll)i * k;
	/*
	SegTree<ll> *seg = new SegTree<ll>(s);
	
	ll ans = 0;
	rep(i, n) ans += seg->query(i + 1, n + 1, s[i]);
	cout << ans << endl;
	*/
	
	vector<ll> val = s;
	sort(all(val)); val.erase(unique(all(val)), val.end());
	
	vector<ll> ans(n);
	for(int i = n; i >= 0; i--){
		int k = lower_bound(all(val), s[i]) - val.begin() + 1;
		if(i < n) ans[i] = n - i - sum(k - 1);
		add(k, 1);
	}
	/*
	rep(i, n) dbg(i, ans[i]);
	rep(i, n + 1) dbg(i, s[i]);
	*/
	cout << accumulate(all(ans), 0ll) << endl;
	
	return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
#define vi vector<int>
#define vl vector<long long>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define vp vector<P>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
#define INFTY 1e9
const int mod = 1000000007;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

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

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

//cout << fixed << setprecision(10) << y << endl;
struct edge {int to, cost;};
vector< vector<edge> > es;

int gcd(int a, int b) {
    int r = a % b;
    if (r == 0) return b;
    return gcd(b, r);
}

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

int main() {
    int n;
    cin >> n;
    vl a(n);
    REP(i, n) cin >> a[i];
    int s = 0;
    REP(i, n) {
       s ^= a[i];
    }
    REP(i, n) {
        if (i == 0) {
            cout << (a[i] ^ s);
        } else {
            cout << ' ' << (a[i] ^ s);
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 4848
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> vs;
    for (int i = 0; i < h; i++) {
        string s;
        cin >> s;
        vs.push_back(s);
    }
    int res = 0;
    for (int i = 0; i < pow(2, h); i++) {
        for (int j = 0; j < pow(2, w); j++) {
            int bb = 0;
            for (int a = 0; a < h; a++) {
                for (int b = 0; b < w; b++) {
                    if (vs[a][b] == '.') continue;
                    if (((1 << a) & i) == 0 && ((1 << b) & j) == 0) {
                        bb++;
                    }
                }
            }
            if (bb == k) res++;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 4104
#include<stdio.h>
int main(){
 int a,b;
 scanf("%d %d",&a,&b);
 if(a<b){
  printf("a < b\n");}
  if(a>b){
   printf("a > b\n");}
   if(a==b){
    printf("a == b\n");}
    return(0);}

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

int main(){
	int n, k;
	cin >> n >> k;
	int a[n];
	for(int &i:a) cin >> i;
	bool b[n + 1][k + 1]{}, c[n + 1][k + 1]{};
	b[0][0] = true;
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= k; j++){
			b[i + 1][min(j + a[i], k)] |= b[i][j];
			b[i + 1][j] |= b[i][j];
		}
	}
	c[n][0] = true;
	for(int i = n; 0 < i; i--){
		for(int j = 0; j <= k; j++){
			c[i - 1][min(j + a[i - 1], k)] |= c[i][j];
			c[i - 1][j] |= c[i][j];
		}
	}
	int ans = n;
	for(int i = 0; i < n; i++){
		int sum[k + 1]{};
		for(int j = 0; j < k; j++){
			sum[j + 1] = sum[j] + c[i + 1][j];
		}
		for(int j = 0; j < k; j++){
			if(b[i][j] && 0 < sum[k - j] - sum[max(0, k - a[i] - j)]){
				ans--;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 49152
#include <iostream>

using namespace std;

int main()
{
	int i, j, k ,l;
	int n, sum;
	
	while(cin >> n)
	{
		sum = 0;
		for(i = 0; i < 10; i++)
		{
			for(j = 0; j < 10; j++)
			{
				for(k = 0; k < 10; k++)
				{
					for(l = 0; l < 10; l++)
					{
						if(n == i + j + k + l)
						{
							sum = sum + 1;
						}
					}
				}
			}
		}
		
		cout << sum << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
/*
 * Author : Andrew J
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
using ll = long long;
using ii = pair <ll , ll>;
void in(ll &x);
const ll N = 21;
const ll M = 1e9 + 7;
ll n;
ll grid[N][N], dp[N + 5][1 << N];

ll f(ll cur , ll mask) {
  if (cur >= n) return __builtin_popcount(mask) == n;
  ll &sol = dp[cur][mask];
  if (sol != -1) return sol;
  sol = 0;
  for (ll i = 0 ; i < n ; i++) {
    if (mask & (1 << i)) {

    } else {
      if (grid[i][cur]) {
        (sol += f(cur + 1 , mask | (1 << i))) %= M;
      }
    }
  }
  return sol;
}

int main() {
  in(n);
  for (ll i = 0 ; i < n ; i++) {
    for (ll j = 0 ; j < n ; j++) {
      in(grid[i][j]);
    }
  }
  // for (ll cur = 0 ; cur <= n ; cur++) {
  //   for (ll mask = (1 << n) - 1 ; mask >= 0 ; mask--) {
  //     ll &sol = dp[cur][mask];
  //     if (cur == 0) {
  //       sol = __builtin_popcount(mask) == n;
  //     } else {
  //       for (ll i = 0 ; i < n ; i++) {
  //         if (mask & (1 << i)) {
  //
  //         } else {
  //           if (grid[i][cur - 1]) {
  //             sol += dp[cur - 1][mask | (1 << i)];
  //           }
  //         }
  //       }
  //     }
  //   }
  // }
  // printf("%d\n" , dp[n][0]);
  memset (dp , -1 , sizeof dp);
  printf("%lld\n" , f(0 , 0));
  return 0;
}

void in(ll &x){
	bool neg = false;
	register ll c;
	x = 0;
	c = getchar();
	if(c == '-'){
		neg = true;
		c = getchar();
	}
	for (; c > 47 && c < 58; c = getchar())
	x = (x << 1) + (x << 3) + c - 48;
	if (neg) x *= -1;
}

Measured memory_bytes: 429676
#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<string,int> &fir,pair<string,int> &las){
	if(fir.first<las.first)return true;
	else{
		if(fir.first == las.first){
			if(fir.second> las.second )return true;
			else return false;
		}
		else return false;
	}
}
vector<string> stos;
map<string,int> ms;
int maps(string s){
	if(ms.count(s))return ms[s];
	else{
		stos.push_back(s);
		return ms[s] = stos.size() - 1;
	}
}
int main(){
	// interesting
	// interestin
	int N;
	cin>>N;
	vector<pair<string,int>> arr;
	vector<pair<string,int>> seara;
	for(int i =0;i<N;i++){
		string s;
		int score;
		cin>>s>>score;
		maps(s);
		arr.emplace_back(s,score);
		seara.emplace_back(s,score);
	}
	
	sort(arr.begin(),arr.end(),cmp);
	for(int i=0;i<(int)arr.size();i++){
		for(int j =0;j<(int)seara.size();j++){
			if(seara[j] == arr[i])cout<<j+1<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>

int main()
{
	std::string S;
	int black[2] = {0, 0}, white[2] = {0, 0};

	std::cin >> S;
	for (int i = 0; i < S.size(); ++i) {
		if (S[i] == '0')
			++black[i%2];
		else
			++white[i%2];
	}

	int ret = std::min(black[0] + white[1], black[1] + white[0]);
	std::cout << ret << "\n";
}


Measured memory_bytes: 512
def resolve():
	s = input()
	ans = 0
	for i in range(len(s)-1, 1, -1):
		if len(s[:i]) % 2:
			next
		else:
			if s[:i//2] == s[i//2:i]:
				ans = max(ans, len(s[:i]))
	print(ans)
resolve()

Measured memory_bytes: 38452
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
//#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<list>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<setprecision(20)
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1e9+7;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
//llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int i,j,n,ans=0;cin>>n;
	int A[100];
	for(i=0;i<n;i++){cin>>A[i];}
	for(i=0;i<n;i++){
		for(j=0;j<n-1;j++){
			if(A[j]>A[j+1]){swap(A[j],A[j+1]);ans++;}
		}
	}
	for(i=0;i<n;i++){cout<<A[i]<<(i+1<n?" ":"\n");}
	cout<<ans<<endl;
	return 0;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cout << #x << " = " << (x) << "\n";

void solve() {
	long long x; cin >> x;
	long long l = 0, r = x;
	while (l < r) {
		long long m = l + r >> 1;
		if (m * (m + 1) / 2 < x) {
			l = m + 1;
		}
		else {
			r = m;
		}
	}
	cout << l << "\n";
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}

Measured memory_bytes: 256
// finish date: 2018/02/03
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

// finish date: 2018/01/31
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;


int main() {
    ll X, Y;
    cin >> X >> Y;
    if (X % Y == 0) {
        cout << -1 << endl;
        return 0;
    }
    cout<<X*(Y+1)<<endl;

    return 0;

}



Measured memory_bytes: 256
t = [list(map(int, input().split())) for _ in range(3)]
if t[0][0]+t[1][1]+t[2][2] == t[0][1]+t[1][2]+t[2][0] == t[0][2]+t[1][0]+t[2][1]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
def mycounter(dd,l):
    d=dict()
    for i in l:
        if i in d:
            d[i]+=1
        else:
            d[i]=1
    ddd=dict()
    for i in d.keys():
        if i in dd:
            ddd[i]=min(d[i],dd[i])
    return ddd

n=int(input())
d=dict()
for i in input():
    if i in d:
        d[i]+=1
    else:
        d[i]=1
for i in range(n-1):
    d=mycounter(d,input())
p=""
for i,j in sorted(d.items()):
    p+=i*j
print(p)

Measured memory_bytes: 3064
import sys

H,W = map(int,input().split())
a = []
for i in range(H):
    a.append(list(input()))

#行削除
for line in a[:]:
    if line.count('.') == len(line):
        a.remove(line)

if len(a)==0:
    sys.exit

b = []

#転地
for row in range(len(a[0])):
    tmp = []
    for line in range(len(a)):
        tmp.append(a[line][row])
    b.append(tmp)    

for line in b[:]:
    if line.count('.') == len(line):
        b.remove(line)
c=[]
#転地
for row in range(len(b[0])):
    tmp = []
    for line in range(len(b)):
        tmp.append(b[line][row])
    c.append(tmp)    


for row in c:
    print(''.join(row))
        
    
        
    


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

using namespace std;

using ll = long long;

int const mod = 1e9 + 7;
int const maxn = 21;

vector<int> v[maxn];

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    
    int n;
    cin >> n;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            int ok;
            cin >> ok;

            if (ok) {
                v[i].push_back(j);
            }
        }
    }

    vector<int> dp(1<<n);
    dp[0] = 1;

    for (int i = 1; i < (1<<n); i++) {
        int cnt = __builtin_popcount(i);
        for (int x : v[cnt-1]) {
            if (i&(1<<x)) {
                dp[i] += dp[i^(1<<x)];

                if (dp[i] >= mod) {
                    dp[i] -= mod;
                }
            }
        }
    }

    cout << dp[(1<<n)-1] << "\n";
}

Measured memory_bytes: 8448
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	for {
		var count int
		n, x := nextInt(), nextInt()
		if n == 0 && x == 0 {
			break
		}
		for i := 1; i <= n; i++ {
			for j := i + 1; j <= n; j++ {
				for k := j + 1; k <= n; k++ {
					if i+j+k == x {
						count++
					}
				}
			}
		}
		fmt.Fprintf(out, "%d\n", count)
	}
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}



Measured memory_bytes: 1180
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  string S;
  cin>>S;
  if(S=="ABC"){
    cout<<"ARC"<<endl;
  }
  if(S=="ARC"){
    cout<<"ABC"<<endl;
  }

  return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1e+9;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w",stdout);
    #endif
    
    int n,k;
    cin>>n>>k;
    vector<int> h(n);
    for(int& i: h){
        cin>>i;
    }
    vector<int> dp(n, INF);
    dp[0] = 0;
    for(int i=0;i<n;i++){
        for(int j = i+1; j<= i+k;j++){
            dp[j] = min(dp[j] , dp[i] + abs(h[i] - h[j]));
        }
    }

    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 3964
n = int(input())
l = list(map(int, input().split()))

from collections import Counter
c = Counter(l)
c = sorted(c.items(), reverse=1)

temp = 0
for i in range(len(c)):
    if c[i][1] >= 2:
        if temp != 0:
            print(temp * c[i][0])
            exit()
        else:
            temp = c[i][0]
    if c[i][1] >= 4:
            print(c[i][0] ** 2)
            exit()
else:
    print(0)

Measured memory_bytes: 21412
using System;
class Program
{
  static void Main(string[] args)
  {
    Write((int)((Read()-1)/111)*111+111);
  }

  static void Write(string s) { Console.WriteLine(s); return; }
  static void Write(long n) { Console.WriteLine(n.ToString()); return; }
  static string ReadStr() { return Console.ReadLine(); }
  static string[] ReadStrs() { return Console.ReadLine().Split(' '); }
  static long Read() { return long.Parse(Console.ReadLine()); }
  static long[] Read(long n) {
    long[] p = new long[n];
    string[] t = Console.ReadLine().Split(' ');
    for(long i = 0; i < n; i++) { p[i] = long.Parse(t[i]); }
    return p;
  }
  static long abs(long n) { return (n > 0) ? n : -n; }
  static long gcd(params long[] n) { long p = n[0]; for (long i = 1; i < n.Length; i++) { p = gcd(p, n[i]); } return p; }
  static long gcd(long a, long b) { return (a==0)?b:gcd(b % a, a); }
  static long lcm(params long[] n) { long p = n[0]; for (long i = 1; i < n.Length; i++) { p = lcm(p, n[i]); } return p; }
  static long lcm(long a, long b) { return a * b / gcd(a, b); }
  static long max(params long[] n) { long p = n[0]; for (long i = 1; i < n.Length; i++) { p = (p>n[i])?p:n[i]; } return p; }
  static long min(params long[] n) { long p = n[0]; for (long i = 1; i < n.Length; i++) { p = (p<n[i])?p:n[i]; } return p; }
  static void YN(bool t) { Console.WriteLine(t ? "YES" : "NO"); }
  static void Yn(bool t) { Console.WriteLine(t ? "Yes" : "No"); }
  static void yn(bool t) { Console.WriteLine(t ? "yes" : "no"); }
  static string clip(string s, int start, int count) {
    if (start + count < s.Length) { s = s.Remove(start + count); }
    if (start > 0) { s = s.Remove(0, start); }
    return s;
  }
}


Measured memory_bytes: 11092
n, k = map(int, input().split())
s = input()
a = [i for i in range(1, n) if s[i] != s[i-1]]
a = [0]+ a if s[0] == '1' else [0, 0] + a
a += [n] if s[-1] == '1' else [n, n]
l, x = len(a), k * 2 + 1
if l <= x:
    print(n)
else:
    ans = max(a[i + x] - a[i] for i in range(0, l - x + 1, 2))
    print(ans)


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

int main()
{
	
		string s;
		cin>>s;
		ll k = s.size();
		if(s[k-1] == 's')
		{
			s += 'e';
			s += 's';
		}
		else
		s += 's';
		cout<<s<<endl;
	
	return 0;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long 
int F[2100010];

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

void fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= 2100000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}
int P(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return Div(F[n], F[n - r]);
}

int C(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}
int H(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return C(n + r - 1, r);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M, K;
    fact();
    cin >> N >> M >> K;
    int pattern = Mul(C(N * M, K), (K * (K - 1)) / 2);
    int ave = Div(N + M, 3);
    cout << Mul(pattern, ave) << endl;
    


    return 0;
}


Measured memory_bytes: 16640
#![allow(unused_macros)]

macro_rules! line {
    () => {{
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf
    }};
}
macro_rules! input {
    { $( $i:ident : $t:ty ),* } => {
        let ( $( $i ),* ) = match &line!().split_whitespace().collect::<Vec<_>>()[..] {
            &[ $( $i ),* ] => ( $( $i.parse::<$t>().unwrap() ),* ),
            _ => panic!(),
        };
    };
}

fn main() {
    input!(a: i64, b: i64, _c: i64, k: i64);

    println!(
        "{}",
        if k <= a {
            k
        } else if k <= a + b {
            a
        } else {
            a - (k - (a + b))
        }
    )
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int n, k;
  cin >> n >> k;
  if (k == 1) {
    cout << 0 << endl;
    return;
  }
  vi32 a(n);
  cin >> a;
  rep(i, n) a[i]--;

  vi32 sum(n + 1);
  rep(i, n) (sum[i + 1] = sum[i] + a[i]) %= k;
  
  i64 ans = 0;
  map<int, int> ma;
  repc(i, n) {
    int r = i, l = i - k;
    if (l >= 0) ma[sum[l]]--;
    ma[sum[r]]++;
    ans += ma[sum[r]] - 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 11264
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int C = sc.nextInt();
        int[] B = new int[M];
        int[][] A = new int[N][M];
        for (int i = 0; i < M; i++) {
            B[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                A[i][j] = sc.nextInt();
            }
        }
        sc.close();

        int ans = 0;
        for (int i = 0; i < N; i++) {
            int sum = 0;
            for (int j = 0; j < M; j++) {
                sum += (A[i][j] * B[j]);
            }
            if (sum + C > 0) ans++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23124
// 1_6_D
#include<stdio.h>

int main(void)
{
	int n, m, i, j;
	int matrix[100][100];
	int vector[100];
	int ans = 0;

	scanf("%d %d", &n, &m);

	for(i = 0; i < n; i++){
		for(j = 0; j < m; j++){
			scanf("%d", &matrix[i][j]);
		}
	}

	for(j = 0; j < m; j++){
		scanf("%d", &vector[j]);
	}

	for(i = 0; i < n; i++){
		for(j = 0; j < m; j++){
			ans += matrix[i][j] * vector[j];
		}
		printf("%d\n", ans);
		ans = 0;
	}

	return 0;
}

Measured memory_bytes: 640
attrs = Array.new
while line = $stdin.gets
    attrs << line.chomp
end

S = attrs[0]
K = attrs[1].to_i

s_ary = S.split("").map{|v| v.to_i}

one_count_from_top = 0
stop_num = 0
s_ary.each do |i|
    if i == 1 then
        one_count_from_top += 1
    else
        stop_num = i
        break
    end
end


if K <= one_count_from_top then
    puts 1
else
    puts stop_num
end


Measured memory_bytes: 1788
import math

line = input().split()
sx, sy, tx, ty = int(line[0]), int(line[1]), int(line[2]), int(line[3])

result = ""




if ty > sy:
    if tx > sx:
        result += "U" * (ty - sy)
        result += "R" * (tx - sx)
        result += "D" * (ty - sy)
        result += "L" * (tx - sx)
        result += "L" + "U"*(ty-sy + 1)
        result += "R"*(tx - sx + 1) + "D"
        result += "R" + "D"*(ty-sy + 1)
        result += "L"*(tx-sx + 1) + "U"
    else:
        result += "U" * (ty - sy)
        result += "L" * (tx - sx)
        result += "D" * (ty - sy)
        result += "R" * (tx - sx)
        result += "R" + "U" * (ty - sy + 1)
        result += "L" * (tx - sx + 1) + "D"
        result += "L" + "D" * (ty - sy + 1)
        result += "R" * (tx - sx + 1) + "U"

else:
    if tx > sx:
        result += "D" * (ty - sy)
        result += "R" * (tx - sx)
        result += "U" * (ty - sy)
        result += "L" * (tx - sx)
        result += "L" + "D" * (ty - sy + 1)
        result += "R" * (tx - sx + 1) + "U"
        result += "R" + "U" * (ty - sy + 1)
        result += "L" * (tx - sx + 1) + "D"
    else:
        result += "D" * (ty - sy)
        result += "L" * (tx - sx)
        result += "U" * (ty - sy)
        result += "R" * (tx - sx)
        result += "R" + "D" * (ty - sy + 1)
        result += "L" * (tx - sx + 1) + "U"
        result += "L" + "U" * (ty - sy + 1)
        result += "R" * (tx - sx + 1) + "D"

print(result)


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

int main(){
  int a, b, k;
  cin >> a >> b >> k;
  
  if(b-a >= 2 * k){
    for(int i = 0; i < k; i++) cout << a + i << endl;
    for(int i = k-1; i >= 0; i--) cout << b - i << endl;
  }
  else for(int i = a; i <= b; i++) cout << i << endl;
}

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

int main() {
    int a,b;
    cin>>a>>b;

    cout<<a*b<<endl;

 
}

Measured memory_bytes: 3620
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

a, b, c, d = nm()
while True:
    c -= b
    if c <= 0:
        print('Yes')
        break
    a -= d
    if a <= 0:
        print('No')
        break


Measured memory_bytes: 9192
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;
 
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair
 
static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;
 
template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
    v.assign(a,vector<T>(b,t));
}
 
//v.erase(unique(v.begin(),v.end()),v.end());
 
 
string mes_a(string in){
	string res=string(in.rbegin(),in.rend());
	return res;
}
string mes_j(string in){
	return in.substr(in.size()-1)+in.substr(0,in.size()-1);
}
string mes_c(string in){
	return in.substr(1)+in.substr(0,1);
}
string mes_e(string in){
	int t=in.size()/2;
	rep(i,t){
		swap(in[i],in[i+in.size()-t]);
	}
	return in;
}
string mes_p(string in){
	stringstream ss;
	ss<<in;
	stringstream res;
	rep(i,in.size()){
		char t;
		ss>>t;
		if('0'<=t&&t<='9'){
			t=((t-'0')+9)%10+'0';
		}
		res<<t;
	}
	string ret;
	res>>ret;
	return ret;
}
string mes_m(string in){
	stringstream ss;
	ss<<in;
	stringstream res;
	rep(i,in.size()){
		char t;
		ss>>t;
		if('0'<=t&&t<='9'){
			t=((t-'0')+1)%10+'0';
		}
		res<<t;
	}
	string ret;
	res>>ret;
	return ret;
}


int main(){
	int n;
	cin>>n;
	rep(i,n){
		string s1,s2;	
		cin>>s1>>s2;
		rep(j,s1.size()){
			int i=s1.size()-1-j;
			// cout<<s2<<endl;
			if(s1[i]=='J'){
				s2=mes_j(s2);
			}
			else if(s1[i]=='C'){
				s2=mes_c(s2);
			}
			else if(s1[i]=='E'){
				s2=mes_e(s2);
			}
			else if(s1[i]=='A'){
				s2=mes_a(s2);
			}
			else if(s1[i]=='P'){
				s2=mes_p(s2);
			}
			else if(s1[i]=='M'){
				s2=mes_m(s2);
			}
		}
		cout<<s2<<endl;
	}
}

Measured memory_bytes: 1232
#include <iostream>
#include <stdio.h>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;


int main(void)
{
	int N; cin >> N;
	int K; cin >> K;
	int ans = 0;
	rep(i, 0, N) {
		int x; cin >> x;
		ans += min(abs(x - K), x);
	}
	ans *= 2;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val ans = readLine()!!.split(" ").map { it.toInt() }.filter { it%2==0 }.all { it%3 == 0 || it%5 == 0 }
    println(if(ans) "APPROVED" else "DENIED")
}


Measured memory_bytes: 37880
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
using namespace std;
typedef long long ll;
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
 
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b){
	ll g=gcd(a,b);
	return a/g*b;
}
 
ll digitsum(ll a){
	ll x=0;
	while(a>0){
		x+=a%10;
		a/=10;
	}
	return x;
}
int main(){
	string s,t,u;
	cin>>s>>t>>u;
	char x='A'-'a';
	char a=s[0]+x,b=t[0]+x,c=u[0]+x;
	cout<<a<<b<<c<<endl;
	
}

Measured memory_bytes: 256
str = input()

strlist = []

reversedstrlist = []

count = 0

strlist = list(str)

length = len(str)

reversedstrlist.append(strlist[::-1])

reversedstrlist = reversedstrlist[0]

for i in range(length):
    if strlist[i] != reversedstrlist[i]:
        count = count + 1
    else:
        continue

count = int(count / 2)

print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll Q, H, S, D;
        cin >> Q >> H >> S >> D;
        ll N;
        cin >> N;

        vector<pair<ld, char> > v(4);
        v[0].first = Q / 0.25;
        v[0].second = 'Q';
        v[1].first = H / 0.5;
        v[1].second = 'H';
        v[2].first = S;
        v[2].second = 'S';
        v[3].first = D / 2.0;
        v[3].second = 'D';

        sort(all(v));

        ll ans = 0;
        rep(i, 0, 4) {
              char c = v[i].second;

              if (c == 'S') {
                      ll x = N;
                      ans += x * S;
                      N -= x;
               } else if (c == 'D') {
                       ll x = N / 2;
                       ans += x * D; 
                       N -= 2 * x;
               } else if (c == 'H') {
                       ll x = N * 2;
                       ans += x * H;
                       N = 0;
               } else {
                       ll x = N * 4;
                       ans += x * Q;
                       N = 0;
               }
               if (N == 0) break;
        }
        cout << ans << endl;
}

Measured memory_bytes: 3632
S = input()
if S == 'SUN':
  mark = 7
elif S == 'MON':
  mark = 6
elif S == 'TUE':
  mark = 5
elif S == 'WED':
  mark = 4
elif S == 'THU':
  mark = 3
elif S == 'FRI':
  mark = 2
elif S == 'SAT':
  mark = 1
print(mark)

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

int main()
{
	long long x,y;
	cin>>x>>y;
	long long n=max(x,y),m=min(x,y);
	if(n==1&&m==1) cout<<1;
	else if(n==2&&m==1) cout<<0;
	else if(m==1) cout<<n-2;
	else cout<<(n-2)*(m-2)<<endl;
	return 0;
}

Measured memory_bytes: 256
public class Main {
  private static void solve() {
    int n = ni();
    long X = ni();
    long[] sum = new long[n + 1];
    for (int i = 0; i < n; i ++) {
      sum[i + 1] = sum[i] + nl();
    }

    long ret = Long.MAX_VALUE;
    outer: for (int m = 1; m <= n; m ++) {
      long now = (n + m) * X;
      for (int k = 1, i = n; i > 0 ; i -= m, k ++) {
        now += (long)(2L * k + 1 + (k == 1 ? 2 : 0)) * (sum[i] - sum[Math.max(0, i - m)]);
        if (now < 0) continue outer;
      }
      ret = Math.min(ret, now);
    }
    System.out.println(ret);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 49316
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin >> s >> t;
  bool a=true;
  for(int i=0;i<(s.size());i++){
    if(s[i]!=t[i]){
      a=false ;
      break;
    }
  }
  if(a)cout << "Yes" <<endl;
  else cout << "No" <<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
using namespace std;
 
int main(){
	long long n,i,q;
	long long cnt = 0;
	cin >> n;
	long long a[100000];
	for (long long i = 0; i < n; i++){
		cin >> a[i];
	}
	if (a[0]>1){
		cnt+=a[0]-1;
	}
	i = 1;
	q = 1;
	
	while (i<n){
		if (a[i] >(q+1)){
			cnt += ((a[i] - 1) / (q+1));
			a[i] = 1;
		}
		else if((q+1)==a[i]){
			q = a[i];
		}
		i++;
	}
	//cnt++;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1152