akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x...) cerr << "[" << #x << "]: " << x << "\n";

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> pl;

ld const PI = 4*atan((ld)1);

int main()
{
	fastio;

	ll a, b, c, d;
	bool zero = false;
	cin >> a >> b >> c >> d;

	ll res = -1e18;
	if (a <= 0 && 0 <= b || c <= 0 && 0 <= d)
		res = 0;

	res = max(res, a*c);
	res = max(res, b*c);
	res = max(res, a*d);
	res = max(res, b*d);
	cout << res << '\n';

	return 0;
}


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

int main(){
  int cap[3]={1, 0, 0};
  char s1, s2;
  while(scanf(" %c,%c", &s1, &s2)!=EOF)swap(cap[s1-'A'], cap[s2-'A']);
  for(int i=0; i<3; i++)
    if(cap[i]==1)printf("%c\n", i+'A');
  return 0;
}

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

using namespace std;
#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;



int main () {
	SpeedForce;
	int a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	b -= a;
	for (int i = 0; i < n; ++i) {
		ll l = i * (ll)c - d * (ll)(n-i-1);
		ll r = i * (ll)d - c * (ll)(n-i-1);
		if (l <= b && b <= r) {
			cout << "YES\n";
			exit(0);
		}
	}

	cout << "NO\n";
   	return Accepted;
}

// B...a

Measured memory_bytes: 18688
s=input()
if s=="SUN":
    print(7)
if s=="MON":
    print(6)
if s=="TUE":
    print(5)
if s=="WED":
    print(4)
if s=="THU":
    print(3)
if s=="FRI":
    print(2)
if s=="SAT":
    print(1)
    


Measured memory_bytes: 8940
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using pq = priority_queue<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
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; }
const ll MOD = 1e9 + 7;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -MOD * MOD;
const long double pi = 3.141592653589793;
int main() {
	int n, k;
	cin >> n >> k;
	vector<bool> ok(n, false);
	rep(i, k) {
		int a;
		cin >> a;
		rep(j, a) {
			int b;
			cin >> b;
			b--;
			ok[b] = true;
		}
	}
	int ans = 0;
	rep(i, n) {
		if (!ok[i]) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    public class Program
    {
        static void Main(string[] args)
        {
            var r1 = ReadSplit();
            var r2 = ReadSplit();
            var N = r1[0].ToInt();
            var K = r1[1].ToInt();

            decimal cSum = 0;
            decimal pSum = 0;
            decimal max = 0;
            for (int i = 0; i < N; i++)
            {
                if (i >= K)
                {
                    pSum += r2[i - K].ToDecimal();
                }
                cSum += r2[i].ToDecimal();
                if (cSum - pSum > max)
                {
                    max = cSum - pSum;
                }
            }
            var ans = K + ((max - K.ToDecimal()) * (0.5).ToDecimal());
            Write(ans);
            Read();
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static string[] ReadSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        public static void Write(object str)
        {
            Console.WriteLine(str);
        }
    }
}


public static class Extentions
{
    public static int ToInt(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static decimal ToDecimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double ToDouble(this object obj)
    {
        return double.Parse(obj.ToString());
    }
}



Measured memory_bytes: 30556
H,W,K=map(int,input().split())
S=[list(input()) for _ in range(H)]

imos=[[0]*(W+1) for _ in range(H)]
for i,row in enumerate(S):
  for j,c in enumerate(row):
    imos[i][j+1]+=int(c=='#')
for i in range(H):
  for j in range(W):
    imos[i][j+1]+=imos[i][j]
    
ans=[[0]*W for _ in range(H)]
k=1
for i,row in enumerate(S):
  if imos[i][-1]==0: continue
  for j,c in enumerate(row):
    ans[i][j]=k
    if c=='#' and imos[i][j+1] < imos[i][-1]:
      k+=1
  k+=1

for i in range(H-1):
  if ans[i][0] and ans[i+1][0]==0:
    for j in range(W):
      ans[i+1][j]=ans[i][j]
for i in reversed(range(H-1)):
  if ans[i+1][0] and ans[i][0]==0:
    for j in range(W):
      ans[i][j]=ans[i+1][j]
      
for row in ans:
  print(*row)

Measured memory_bytes: 9424
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	vector<int> d(n);
	for(int i = 0; i < n; i++)
	{
		cin >> d[i];
	}
	
	sort(d.begin(), d.end(), [](const int& a, const int& b) {return a > b;});
	
	int ans = 0;
	for(int i = 0; i < n; i++)
	{
		if(i == 0)
		{
			ans++;
		}
		if(d[i] != d[i - 1])
		{
			ans++;
		}
	}
	
	cout << ans - 1 << endl;
	return 0;
}

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

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

typedef long long ll;

const int mod = 1e9 + 7;

using namespace std;



int main(void) {

	int D, T, S; cin >> D >> T >> S;

	if (S * T >= D) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
char x[100005];
int a[3];
int main(void){
    cin>>x;
    int xl=strlen(x);
    for(int i=0;i<xl;i++)a[int(x[i]-'a')]++;
    sort(a,a+3);
    if((a[0]==a[1]&&a[2]==a[1]+1)||(a[0]+1==a[1]&&a[1]==a[2])||(a[0]==a[1]&&a[1]==a[2]))cout<<"YES\n";
    else cout<<"NO\n";
}


Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#define int long long

using namespace std;

const int N=200009,M=1000000007,INF=1ll<<60;
int n;
struct Node
{
	int x,y;
	
	bool operator < (const Node A)const
	{
		if(x!=A.x)
			return x<A.x;
		return y<A.y;
	}
}a[N];

int calc()
{
	sort(a+1,a+1+n);
//	for (int i=1;i<=n;i++)
//		printf("%lld %lld\n",a[i].x,a[i].y);
	int Min=a[1].x+a[1].y,ans=-INF;
	for (int i=2;i<=n;i++)
		ans=max(ans,a[i].x+a[i].y-Min),
		Min=min(a[i].x+a[i].y,Min);
	return ans;
}

signed main()
{
	scanf("%lld",&n);
	for (int i=1;i<=n;i++)
		scanf("%lld %lld",&a[i].x,&a[i].y);
	int ans=calc();
	for (int i=1;i<=n;i++)
		a[i].x=-a[i].x;
	ans=max(ans,calc());
	for (int i=1;i<=n;i++)
		a[i].y=-a[i].y;
	ans=max(ans,calc());
	for (int i=1;i<=n;i++)
		a[i].x=-a[i].x;
	ans=max(ans,calc());
	printf("%lld\n",ans);
	return 0;
}

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

template<long long mod>
class modint{
private:
  long long a;
public:
  constexpr modint(const long long x = 0) noexcept : a(x%mod) {}
  constexpr long long& value() noexcept { return a; }
  constexpr const long long& value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint& operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if(a >= mod) a -= mod;
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if(a < rhs.a) a += mod;
    a -= rhs.a;
    return *this;
  }
  constexpr modint& operator*=(const modint rhs) noexcept {
    a = a*rhs.a%mod;
    return *this;
  }
  constexpr modint& operator/=(modint rhs) noexcept {
    long long k = mod-2;
    while(k > 0){
      if(k&1){
        *this *= rhs;
      }
      rhs *= rhs;
      k /= 2;
    }
    return *this;
  }
  friend ostream& operator<<(ostream &os, const modint &X){
    return os << X.a;
  }
  friend istream& operator>>(istream &is, modint &X){
    is >> X.a;
    X.a %= mod;
    if(X.a < 0) X.a += mod;
    return is;
  }
};


template<typename T>
struct Combination {
private:
  int sz;
  vector<T> F, F_;
public:
  Combination(int sz) : sz(sz), F(sz+1), F_(sz+1) {
    F[0] = 1;
    for(int i = 0; i < sz; ++i) F[i+1] = F[i]*(i+1);
    F_.back() = (T)1/F.back();
    for(int i = sz-1; i >= 0; --i) F_[i] = F_[i+1]*(i+1);
  }
  T C(int n, int k){
    assert(n <= sz);
    if(n < 0 or k > n) return (T)0;
    return F[n]*F_[k]*F_[n-k];
  }
};

int main(){
  using mint = modint<(int)1e9+7>;
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for(int i = 0; i < N; ++i) cin >> A[i];
  sort(A.begin(), A.end());
  Combination<mint> comb(N);
  mint ans = 0;
  for(int i = 0; i < N; ++i){
    ans += comb.C(i,K-1)*A[i];
    ans -= comb.C(N-i-1,K-1)*A[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 2176
def main():
    n, x = map(int, input().split())
    A = list(map(int, input().split()))
    ans = 0
    if A[0] > x:
        ans += A[0] - x
        A[0] = x

    for i in range(n - 1):
        j = i + 1
        if j < n and A[i] + A[j] > x:
            diff = A[i] + A[j] - x
            ans += diff
            A[j] -= diff
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
using str = string;
using ll = long long;
#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 FOR(i,f,t) for(int i=int(f); i<=int(t); i++)
#define RFOR(i,f,t) for(int i=int(f); i>=int(t); i--)
#define ALL(vec) (vec).begin(),(vec).end()
#define ASORT(vec) sort(ALL(vec))
#define DSORT(vec) sort(ALL(vec), greater<int>());
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define YES(ans) if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define Yes(ans) if(ans) cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define yes(ans) if(ans) cout<<"yes"<<endl; else cout<<"no"<<endl;

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    vector<ll> data(4);
    data.at(0) = a*c;
    data.at(1) = a*d;
    data.at(2) = b*c;
    data.at(3) = b*d;
    ASORT(data);
    cout << data.at(3) << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int a[30]={},b[30]={};
int main() {
    string s,t;
    cin >> s >> t;
    for(int i=0;i<s.size();i++){
        int num1=s[i]-'a';
        int num2=t[i]-'a';
        a[num1]++,b[num2]++;
        if(a[num1]!=b[num2]){cout<<"No"; return 0;}
    }
    cout<<"Yes";
}


Measured memory_bytes: 3916
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int NP = 11;
const int pnums[NP] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 };

const int MAX_EXP = 50;

/* typedef */

typedef long long ll;

/* global variables */

ll k;

/* subroutines */

double rec(int j, ll n, ll sum) {
  double max_sig = (double)sum / n;
  if (j >= NP) return max_sig;

  ll sum0 = sum;
  
  for (int i = 0; i < MAX_EXP; i++) {
    double sig = rec(j + 1, n, sum0);
    if (max_sig < sig) max_sig = sig;

    n *= pnums[j];
    if (n > k) break;
    sum0 = sum0 * pnums[j] + sum;
  }

  return max_sig;
}

/* main */

int main() {
  for (;;) {
    cin >> k;
    if (k == 0) break;

    double ans = rec(0, 1LL, 1LL);
    printf("%.6lf\n", ans);
  }
  return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

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

    unsigned long ans = 0;
    int len = str.size() - 1;
    int bit = 0;
    for (; bit < (1 << len); ++bit) {
        int digit = 0;
        for (int j = len; j >= 0; --j) {
            int value = str[j] - '0';
            ans += value * long(pow(10, digit));
            if (bit & (1 << (len - j))) digit = 0;
            else                    ++digit;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define ALL(x)    (x).begin(),(x).end()
#define UNIQ(c)   (c).erase(unique(ALL((c))), end((c)))
#define mp        make_pair
#define eb        emplace_back
#define REP(i, a) for (int i = 0; i < (a); i++)


int n;
int a[101010];

int main() {
	cin >> n;
	int minl = 101010, maxl = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		minl = min(minl, a[i]);
		maxl = max(maxl, a[i]);
	}
	if (maxl - minl >= 2) {
		cout << "No" << endl;
		return 0;
	}
	if (maxl - minl == 0) {
		if (2 * a[0] <= n || a[0] == n - 1) {
			cout << "Yes" << endl;
			return 0;
		}
		cout << "No" << endl;
	}
	if (maxl - minl == 1) {
		int num = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] == maxl - 1)num++;
		}
		if (num < maxl && 2 * (maxl - num) <= n - num) {
			cout << "Yes" << endl;
			return 0;
		}
		cout << "No" << endl;

	}

}


Measured memory_bytes: 768
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] p = new int[N];
        for (int i = 0; i < N; i++) {
            p[i] = sc.nextInt();
        }
        Arrays.sort(p);
        int ans = 0;
        for (int i = 0; i < K; i++) {
            ans += p[i];
        }
        System.out.println(ans);
    }
}



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


int main() {
    int N, maxnum = 0;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
        if(A.at(maxnum) < A.at(i)){
            maxnum = i;
        }
    }
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());
    for(int i = 0; i < N; i++){
        if(i == maxnum){
            cout << A.at(1) << endl;
        }else{
            cout << A.at(0) << endl;
        }
    }



}


Measured memory_bytes: 2432
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        fozubaoyou    pass System Test!
        quoted from "https://codeforces.com/contest/472/submission/7996840"
*/
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



int main(void){
    
	int a,b;
	cin>>a>>b;
	vvc v(100,vc(100,'.'));
	for(int i=0;i<100;i++){
		for(int j=50;j<100;j++){
			v[i][j]='#';
		}
	}
	int ly=1,lx=1,ry=1,rx=51;

	for(int i=0;i<b-1;i++){
		v[ly][lx]='#';
		lx+=2;
		if(lx>=49){
			lx=1;
			ly+=2;
		}
	}
	for(int i=0;i<a-1;i++){
		v[ry][rx]='.';
		rx+=2;
		if(rx>=99){
			rx=51;
			ry+=2;
		}
	}
	cout<<100<<" "<<100<<endl;
	for(int i=0;i<100;i++){
		for(int j=0;j<100;j++){
			cout<<v[i][j];
		}
		cout<<endl;
	}

}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
void turn(int dice[],int a,int b,int c,int d);

void turn(int dice[],int a,int b,int c,int d){

	int dummy;

	dummy = dice[a];
	dice[a] = dice[b];
	dice[b] = dice[c];
	dice[c] = dice[d];
	dice[d] = dummy;

}

int main(){
	//0:up 1:front 2:right 3:left 4:behind 5:down

    int dice[6];
    int i,n,sum=1;
    char str[6];

    for(;;){

    	sum=1;

    scanf("%d",&n);

    if(n==0) break;

    for(i=0;i<6;i++){

    	dice[i]=i+1;
    }

    for(i=0;i<n;i++){

    	scanf("%s",str);

    	if(strcmp(str,"North")==0) turn(dice,0,1,5,4);
    	if(strcmp(str,"East")==0) turn(dice,0,3,5,2);
    	if(strcmp(str,"West")==0) turn(dice,0,2,5,3);
    	if(strcmp(str,"South")==0) turn(dice,0,4,5,1);
    	if(strcmp(str,"Right")==0) turn(dice,1,2,4,3);
    	if(strcmp(str,"Left")==0) turn(dice,1,3,4,2);
    	
    	sum=sum+dice[0];
    }

    printf("%d\n",sum);

}

    return 0;

}

Measured memory_bytes: 604
A=int(input())
B=int(input())
C=int(input())
X=int(input())

ans = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            x = i*500+j*100+k*50
            if X == x:
                ans += 1
                break
print(ans)



Measured memory_bytes: 3060
# coding: utf-8
# Your code here!

"""
a, b, k = map(int, input().split())
a = list(map(int, input().split()))
for i in reversed(range(min(a, b)+ 1)):
"""

n, m, c = map(int, input().split())
b = list(map(int, input().split()))

ans = 0
for i in range(n):
    a = list(map(int, input().split()))
    sm = 0
    for j in range(m):
        sm += a[j]*b[j]
    if sm + c > 0:
        ans+=1

print(ans)

Measured memory_bytes: 3060
import numpy as np
# 駅の数を入力する
N = int(input())
# 乗車時間C、始発の発車時間S、発車間隔Fを入力する
C = np.empty(N - 1, dtype = int)
S = np.empty(N - 1, dtype = int)
F = np.empty(N - 1, dtype = int)
for i in range(N - 1):
    C[i], S[i], F[i] = map(int, input().split())

# 0〜N-2までの各駅iから駅N-１までの所要時間tを求める
for i in range(N - 1):
    # 駅iでの待機時間を加える
    t = S[i]
    # 駅iから駅i+1までの所要時間を加える
    t += C[i]
    # i+1〜N-2までの各駅jについて繰り返す
    for j in range(i + 1, N - 1):
        # tがS[j]より大きい場合
        if t > S[j]:
            # (t - S[j])をF[j]で割ったときの商aと余りbを求める
            a = (t - S[j]) // F[j]
            b = (t - S[j]) % F[j]
            # S[j]をF[j]だけ増やしていき、最初にt以上となる時間を新たなtとする
            t = S[j] + (a + min(b, 1)) * F[j]
        # tがS[j]よりも小さい場合
        elif t < S[j]:
            # S[j]を新たなtとする
            t = S[j]
        # 駅jから駅j+1までの所要時間を加える
        t += C[j]
    # tを出力する
    print(t)
# 駅N-1から駅N-1までの所要時間（0）を出力する
print(0)

Measured memory_bytes: 12512
#include<bits/stdc++.h>
using namespace std;
const long long llINF = 9223372036854775807;
const int INF = 2147483647;
const int maxn = 1e5 + 7;
const int maxm = 1e6 + 7;
const int mod = 1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-10;

long long n, a, b;

long long h[maxn];
long long ans = llINF;
bool check(long long x)
{
    long long cnt = 0;
    for (int i = 1; i <= n; i++)
    {
        long long tmp = h[i] - b * x; //余震
        if (tmp <= 0) //余震震死
            continue;
        cnt += tmp / (a - b) ;
        if (tmp % (a - b))
            cnt++;
    }
    if (cnt <= x)
        ans = min(ans, x);
    return cnt <= x;
}
int main(int argc, char const *argv[])
{
    scanf("%lld%lld%lld", &n, &a, &b);
    for (int i = 1; i <= n; i++)
        scanf("%lld", &h[i]);

    long long l = 0, r = 1e9;
    while (l <= r)
    {
        long long mid = (l + r) >> 1;
        if (check(mid))
            r = mid - 1;
        else
            l = mid + 1;
    }
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
long long dp[20][10][2];
string num = "0123456789";
long long digdp(long long n){
    int i,j;
    string s;
    while(n){
        s.push_back(num[n%10]);
        n /= 10;
    }
    reverse(s.begin(),s.end());
    for(i=0;i<=s.size();i++){
        for(j=0;j<10;j++){
            dp[i][j][0] = 0; dp[i][j][1] = 0;
        }
    }
    for(i=1;i<s[0] - '0';i++) dp[0][i][0] = 1;
    dp[0][s[0] - '0'][1] = 1;
    for(i=1;i<s.size();i++){
        for(j=1;j<10;j++){
            dp[i][j][0]++;
        }
        for(j=0;j<10;j++){
            if(j - 1>=0) dp[i][j - 1][0] += dp[i - 1][j][0];
            dp[i][j][0] += dp[i - 1][j][0];
            if(j + 1<10) dp[i][j + 1][0] += dp[i - 1][j][0];
        }
        for(j=0;j<10;j++){
            if(j - 1==s[i] - '0') dp[i][j - 1][1] += dp[i - 1][j][1];
            if(j - 1<s[i] - '0' && j - 1>=0) dp[i][j - 1][0] += dp[i - 1][j][1];
            if(j==s[i] - '0') dp[i][j][1] += dp[i - 1][j][1];
            if(j<s[i] - '0') dp[i][j][0] += dp[i - 1][j][1];
            if(j + 1==s[i] - '0') dp[i][j + 1][1] += dp[i - 1][j][1];
            if(j + 1<s[i] - '0') dp[i][j + 1][0] += dp[i - 1][j][1];
        }
    }
    long long ret = 0;
    for(j=0;j<10;j++){
        ret += dp[s.size() - 1][j][0] + dp[s.size() - 1][j][1];
    }
    return ret;
}

int main(){
    int i,k;
    cin >> k;
    if(k==1){
        cout << 1 << endl;
        return 0;
    }
    long long l = 1,r = 100000000000000;
    while(r - l>1){
        long long mid = (l + r)/2;
        if(digdp(mid)>=k) r = mid;
        else l = mid;
    }
    cout << r << endl;
}

Measured memory_bytes: 256
#include <cstdio>

int main(){
	int t;
	for(;;){
		scanf("%d",&t);
		if(t==0) break;
		int n;
		scanf("%d",&n);
		int sum=0,s,f;
		for(int i=0;i<n;i++){
			scanf("%d%d",&s,&f);
			sum+=f-s;
		}
		if(sum>=t) printf("OK\n");
		else printf("%d\n",t-sum);
	}
}

Measured memory_bytes: 1040
H, W = map(int, input().split())
I = [input() for _ in range(H)]
X = [[[0, 1][a=="#"] for a in inp] for inp in I]
k = 32
def r():
    global H, W, I
    I = ["".join([I[H - 1 - j][i] for j in range(H)]) for i in range(W)]
    H, W = W, H
def st1(s):
    return int(s.replace("#", "1" * k).replace(".", "0" * k), 2)
def st2(s):
    return int(s.replace("#", "0" * (k - 1) + "1").replace(".", "0" * k), 2)
def getsum(x):
    for i in range(8):
        x += x >> (k << i)
    return x & ((1 << k) - 1)

ans = 0
for _ in range(4):
    A1 = [st1(inp) for inp in I]
    A2 = [st1("".join([I[i][j] for i in range(H)])) for j in range(W)]
    B = [st2(inp[::-1]) for i, inp in enumerate(I)]
    C = [[0] * W for _ in range(H)]
    for j in range(W):
        s = 0
        m = (1 << j * k) - 1
        for i in range(H)[::-1]:
            s <<= k
            s += B[i] >> (j+1) * k
            s &= m
            C[i][j] = s
    for i in range(1, H):
        for j in range(1, W):
            ans += A1[i] >> (W - j) * k & A2[j] >> (H - i) * k & C[i][j]
    r()
            
print(getsum(ans))

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

int *fib;

int main()
{
	int H, W, K;
	unsigned long ans[101][9];


	cin >> H >> W >> K;

	fib = (int*)malloc(sizeof(int)*(W + 1));
	fib[0] = 1;
	fib[1] = 1;
	for (int i = 2; i <= W; i++)
	{
		fib[i] = fib[i - 2] + fib[i - 1];
	}

	for (int x = 0; x <= 8; x++) ans[0][x] = 0;
	ans[0][1] = 1;

	for (int i = 1; i <= H; i++)
	{
		for (int j = 1; j <= W; j++)
		{
			ans[i][j] = 0;
			if (j > 1)
			{
				ans[i][j] += ans[i - 1][j - 1] * fib[j-2]*fib[W-j] % 1000000007l;
			}
			if (j < W)
			{
				ans[i][j] += ans[i - 1][j + 1] * fib[j - 1] * fib[W - j-1] % 1000000007l;
			}
			ans[i][j] += ans[i-1][j] * fib[j - 1] * fib[W - j] % 1000000007l;
			ans[i][j] = ans[i][j] % 1000000007l;
		}
	}
	
	cout << ans[H][K] << endl;

	return(0);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[]) {
    int n;
    double sum, sig, s[1001], ave, a;
    while(1){
        scanf("%d", &n);
        if(n == 0) break;
        sum = 0;
        sig = 0;
        for(int i=0; i<n; i++){
            scanf("%lf", &s[i]);
            sum += s[i];
        }
        ave = sum / n;
        for(int i=0; i<n; i++){
            sig += (s[i]-ave) * (s[i]-ave);
        }
        a = sqrt(sig/n);
        printf("%.8lf\n", a);
    }
    return 0;
}



Measured memory_bytes: 2056
#pragma gcc optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i=(ll)(r);i<(ll)(n);++i)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define pb(n) push_back(n)
#define endl '\n'
#define debug(x) cout << #x << " = " << (x) << endl
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c
#define VIN(V) for(int ii = 0; ii < (V).size(); ii++) {cin >> (V).at(ii);}
#define OUT(n) cout << n << endl
#define OUT2(n1,n2) cout << n1 << " " << n2 << endl
#define OUT3(n1,n2,n3) cout << n1 << " " << n2 << " " << n3 << endl
#define VOUT(V) REP(ii,(V).size()){cout << (V)[ii] << " ";} cout<<endl;
#define VOUT2(V) REP(jj,(V).size()){VOUT(V[jj])}
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<vi > vvi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
ll n, m, k, ans, sum, cnt = 0; string s; char c; bool flg;

int main(){
  cin.tie(0);ios::sync_with_stdio(false);
  IN(n);
  vi a(n);
  VIN(a);

  FOR(i,0,n) sum += a[i];
  sum /= 2;
  ll evensum = 0;
  FOR(i,0,n/2) evensum += a[i*2+1];
  ll top = (sum - evensum) * 2;

  vi ans(n);
  ans[0] = top;
  FOR(i,1,n) {
    ans[i] = (a[i-1] - ans[i-1]/2) * 2;
  }

  VOUT(ans);
}


Measured memory_bytes: 2944
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
typedef  long long ll;
using namespace std;

int main(void) {
	ll N, A, B;
	cin >> N >> A >> B;
	
	ll ans = 0;

	if (A % 2 == B % 2)
	{
		ans = (B - A ) / 2;
	}
	else
	{
		ans = min(A - 1, N - B) + 1 + (B - A - 1) / 2;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
x, n = map(int, input().split())

if n == 0:
    print(x)
    exit()

p = list(map(int, input().split()))

for d in range(x + 2):
    if x-d not in p:
        print(x-d)
        exit()
        
    if x+d not in p:
        print(x+d)
        exit()

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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N;
    cin >> N;

    vector<vector<int>> table(N, vector<int>(N, 0));
    REP(i,N){
        ll u, k;
        cin >> u >> k;
        REP(j,k){
            ll v;
            cin >> v;
            table[u-1][v-1] = 1;
        }
    }

    REP(i, N){
        REP(j, N){
            printf("%d%c", table[i][j], (j == N-1)?'\n':' ');
        }
    }
}



Measured memory_bytes: 3272
n, k = map(int, input().split())
a = [ int(x) for x in input().split() ]

d = {}
for i in a:
    d[i] = d.get(i, 0) + 1

d = sorted(d.items(), key=lambda x: x[1])

if k >= len(d):
    ans = 0
else:
    ans = sum([ v for k, v in d[:len(d)-k]])

print(ans)

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

#define ll long long

int i,t,j;
int a[5];
bool ex[5];

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

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

int main(){
	
 	int N;
  	cin>>N;
 
  	vector<int64_t> lucas(N+1);
  	lucas.at(0)=2;
  	lucas.at(1)=1;
 	 
  	for (int i = 2; i<=N; i++) {
  		lucas.at(i)=lucas.at(i-2)+lucas.at(i-1);
    }
	cout<<lucas.at(N);
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loop2(num) for (lli j = 0 ; j < num ; j ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }
#define looppu(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . push_back (x) ;}
#define loopin(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . insert (x) ;}

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back ()
#define pof pop_front ()

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

signed main ()
{
    fastio
    st s ; cin >> s ;
    ll sum = 0 ;
    loop(s.size()){
        sum += s[i] - '0' ;
    }
    (stoi(s) % sum == 0 ? Yes : No);
    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
/*
 * hoge.c
 *
 *  Created on: 2017/08/26
 *      Author: CuSO4
 */


#include <stdio.h>

int main(){
	int s[10];
	int i,j;
	for(i=0;i<10;i++){
		scanf("%d",&s[i]);
	}
	for(j=0;j<9;j++){
		for(i=0;i<9-j;i++){
			if(s[i]<s[i+1]){
				int x = s[i];
				s[i] = s[i+1];
				s[i+1] = x;
			}
		}
	}
	for(i=0;i<3;i++){
		printf("%d\n",s[i]);
	}
	return 0;
}

Measured memory_bytes: 600
from operator import itemgetter
N,M=map(int,input().split(" "))
d={}
for i in range(M):
    r=list(map(int,input().split(" ")))
    if r[0] in d:
        d[r[0]].append((i,r[1]))
    else:
        d[r[0]]=[(i,r[1])]
for i in d:
    d[i]=sorted(d[i],key=lambda x:x[1])
r=[]
for i in d:
    for j in range(len(d[i])):
        r.append((i,j,d[i][j][0]))
r=sorted(r,key=lambda x:x[2])
for i in r:
    print("{0:06d}{1:06d}".format(i[0],i[1]+1))
    


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

int stair(int x){
	if(x==1) return 1;
	return x*stair(x-1);
}

int order(vector<int> X,int N,int index){
	int i;
	vector<int> tmp;

	for(i=index;i<N;i++){
		tmp.push_back(X[i]);
	}
	sort(tmp.begin(),tmp.end());
	
	for(i=0;i<N-index;i++){
		if(X[index]==tmp[i]) return i+1;
	}
}

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

	int N;
	int i,j;
	int tmp;
	int p_sum=0;
	int q_sum=0;
	int answer=0;
	int counter=0;
	double ave;
	vector<int> P;
	vector<int> Q;

	cin >> N;

	for(i=0;i<N;i++){
		cin >> tmp;
		P.push_back(tmp);
	}

	for(i=0;i<N;i++){
		cin >> tmp;
		Q.push_back(tmp);
	}


	for(i=0;i<N-1;i++){
		p_sum+=stair(N-i-1)*(order(P,N,i)-1);
		q_sum+=stair(N-i-1)*(order(Q,N,i)-1);
	}
	
	answer=abs(p_sum-q_sum);
	cout << answer << endl;

	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#define retrun return
#define cpnst const
int n;
typedef long long ll;
cpnst ll mod=1e9+7;
ll dp[5333][5333],facc[5555];
#include<vector>
std::vector<int>v[5333];
int siz[5555];
ll tmp[5555];
void mul(ll*x,ll*y,int szx,int szy)
{
	register int i,ii;
	for(i=0;i<=szx;i++)
		for(ii=0;ii<=szy;ii++)
			(tmp[i+ii]+=x[i]*y[ii])%=mod;
	for(i=0;i<=szx+szy;i++)x[i]=tmp[i],tmp[i]=0;
}
void dfs(int p=1,int f=0)
{
	dp[p][1]=siz[p]=1;
	register int i;
	for(auto t:v[p])
		if(t^f)
			dfs(t,p),mul(dp[p],dp[t],siz[p],siz[t]),siz[p]+=siz[t];
	for(i=1;i<=siz[p];i++)(dp[p][0]+=mod-facc[i]*dp[p][i]%mod)%=mod;
}
int main()
{
	scanf("%d",&n);
	register int i;
	for(facc[0]=1,i=2;i<=n;i+=2)facc[i]=facc[i-2]*(i-1)%mod;
	for(i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		v[x].push_back(y),v[y].push_back(x);
	}dfs(),printf("%lld\n",(mod-dp[1][0])%mod);
}
/*
Just go for it.
*/

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

using namespace std;

int main() {
  string S, T, U;
  int A = 0, B = 0;
  
  cin >> S >> T >> A >> B >> U;
  
  if (S == U) {
    A--;
  } else {
    B--;
  }
  
  cout << A << " " << B << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n) / gcd(n, m)*abs(m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;

void solve(){
  string s;
  cin>>s;
  int n=s.size();
  bool ng=false;
  rep(i,n){
    if(s[i]!=s[n-1-i])ng=true;
  }
  string t=s.substr(0,(n-1)/2);
  string r=s.substr((n+3)/2-1,(n-1)/2);
  //cerr<<t<<" "<<r;
  rep(i,t.size()){
    if(t[i]!=t[t.size()-1-i])ng=true;
  }
  rep(i,r.size()){
    if(r[i]!=r[r.size()-1-i])ng=true;
  }
  if(!ng)cout<<"Yes";
  else cout<<"No";
}

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

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int r;
    cin>>r;
    if(r<1200){
        cout<<"ABC"<<endl;
    }
    else if(r<2800){
        cout<<"ARC"<<endl;
    }
    else{
        cout<<"AGC"<<endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <bits/stdc++.h>
#define mod 1000000007
typedef long long ll;
using namespace std;
int n;
ll x;
int a,b,c;
int main()  
{  
	cin>>n;
	for(int i=0;i<n;i++){
		scanf("%I64d",&x);
		if(x%4==0) a++;
		else if(x%2==0) b++;
		else c++;
	}
	if(b>0) c++;
	if(a+1>=c) cout<<"Yes";
	else cout<<"No";
	return 0;  
}  


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

#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
 
#define ll long long
#define ld long double
#define pii pair<int,int>
 
#define files1 freopen("input.txt","r",stdin)
#define files2 freopen("output.txt","w",stdout)
#define files files1;files2
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0)
 
#define endl '\n'
#define ln(i,n) " \n"[(i) == (n) - 1]
 
void bad(string mes = "Impossible"){cout << mes;exit(0);}
template<typename ... T> void shit(T& ... x){}
template<typename ... T> void dec(T& ... x){shit(--x...);}
template<typename ... T> void inc(T& ... x){shit(++x...);}
#include <unordered_map>
// #include <unordered_mda>
 
template<typename T>
string bin(T x, int st = 2){
    string ans = "";
    while (x > 0){
        ans += char('0' + x % st);
        x /= st;
    }
    reverse(ans.begin(), ans.end());
    return ans.empty() ? "0" : ans;
}
 
template<typename T>
T input(){
    T ans = 0, m = 1;
    char c = ' ';
 
    while (!((c >= '0' && c <= '9') || c == '-')) {
        c = getchar();
    }
 
    if (c == '-')
        m = -1, c = getchar();
    while (c >= '0' && c <= '9'){
        ans = ans * 10 + (c - '0'), c = getchar();
    }
    return ans * m;
}
 
template<typename T>
void read(T& a) {
    a = input<T>();
}
 
template<typename T>
void read(T& a, T& b) {
    read(a), read(b);
}
 
template<typename T>
void read(T& a, T& b, T& c) {
    read(a, b), read(c);
}
 
template<typename T>
void read(T& a, T& b, T& c, T& d) {
    read(a, b), read(c, d);
}
 
const int inf = 1e9;
const double eps = 1e-9;
const int maxn = 1e5 + 10, base = 1e9 + 7;
const ll llinf = 1e18 + 1;
 
template<typename T>
T binpow(T n, T s)
{
    if (s <= 0)
        return 1LL;
    if (s % 2 == 0){
        T b = binpow(n, s / 2);
        return ( 1LL * b * b ) % base;
    } else {
        return (1LL* binpow(n, s - 1) * n) % base;
    }
}

int main() {
//    files1;
    string s;
    int k;
    fast_io;

    cin >> s >> k;

    for (int i = 0; i < s.size(); i++) {
        int cur = s[i] - 'a';
        if (cur == 0)
            continue;
        int cost = 26 - cur;
        if (cost <= k) {
            k -= cost;
            s[i] = 'a';
        }
    }

    k %= 26;
    s.back() += k;
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int x[100001];
int main(){
    int n,k;
    cin>>n>>k;
    int mn=1000100010;
    rep(i,n) cin>>x[i];
    rep(i,n){
        if(i+k-1<n)mn=min(mn,abs(x[i])+abs(x[i+k-1]-x[i]));
        if(i-k+1>=0)mn=min(mn,abs(x[i])+abs(x[i]-x[i-k+1]));
    }
    cout<<mn<<endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int r = sc.nextInt(); int c = sc.nextInt(); int k = sc.nextInt();
        long [][] item = new long[r][c];
        for (int i = 0; i < k; i++) {
            int row = sc.nextInt() - 1; int col = sc.nextInt() - 1;
            long val = sc.nextLong();
            item[row][col] = val;
        }
        long [][][] dp = new long[r][c][4];
        for (int i = 0; i < r; i++) {
            for (int j = 0; j < c; j++) {
                for (int x = 0; x <= 3; x++) {
                    if (item[i][j] > 0) {
                        if (x > 0)
                            dp[i][j][x] = Math.max(dp[i][j][x], (j == 0 ? 0 : dp[i][j - 1][x - 1]) + item[i][j]);
                        for (int y = 0; y <= 3; y++) {
                            dp[i][j][1] = Math.max(dp[i][j][1], (i == 0 ? 0 : dp[i - 1][j][y]) + item[i][j]);
                        }
                    }
                    dp[i][j][x] = Math.max(dp[i][j][x], (j == 0 ? 0 : dp[i][j - 1][x]));
                    for (int y = 0; y <= 3; y++) {
                        dp[i][j][0] = Math.max(dp[i][j][0], (i == 0 ? 0 : dp[i - 1][j][y]));
                    }
                }
            }
        }
        long ans = 0;
        for (int x = 0; x <= 3; x++) ans = Math.max(ans, dp[r - 1][c - 1][x]);
        out.println(ans);
        out.close();
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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


    }

}

Measured memory_bytes: 672736
#include <iostream>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <string>

using namespace std;
int main() {
	vector <int>a(5);
	int k;

	cin >> a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>k;

	sort(a.begin(), a.end());
	if (a[4] - a[0] <= k)
		cout << "Yay!";
	else
		cout << ":(";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		int w = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		if(b < a){
			int tmp = a;
			a = b;
			b = tmp;
		}

		System.out.println(Math.max(0, b - a - w));
    }
}

Measured memory_bytes: 21844
#include<iostream>

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	if (a + b == 15) {
		cout << "+";
	}
	else if(a*b == 15){
		cout << "*";
	}
	else {
		cout << "x";
	}

    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n,k;
int a[N];
int b[N];
int c[N];
int dp[N][3];

int f(int idx, int prev){
  if (idx>=n) return 0;
  int &ret = dp[idx][prev];
  if (ret!=-1 ) return ret;
  ret = 0;
  if (idx==0){
    ret = max(ret,f(idx+1,0)+a[idx]);
    ret = max(ret,f(idx+1,1)+b[idx]);
    ret = max(ret,f(idx+1,2)+c[idx]);
  }
  else{
    if (prev==0) ret = max({ret, f(idx+1,1)+b[idx], f(idx+1,2)+c[idx]});
    else if (prev==1) ret = max({ret, f(idx+1,0)+a[idx], f(idx+1,2)+c[idx]});
    else ret = max({ret, f(idx+1,0)+a[idx], f(idx+1,1)+b[idx]});
  }
  return ret;
}

int main(){
   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   cin >> n;
   for(int i=0; i<n; i++){
     cin >> a[i] >> b[i] >> c[i];
   }
   memset(dp,-1,sizeof dp);
   cout << f(0,0) << endl;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using ll = long long;
const ll INF_LL = 1000000000000;
#define fir first
#define sec second

int main()
{
    std::string s,t;
    std::cin >> s >> t;
    ll s_n = s.size(), t_n = t.size(); 
    std::map<char,ll> map;
    std::map<ll,std::deque<ll>> index;
    for(ll i = 0; i < s_n; i++){
        map[s[i]]++;
        index[s[i]].push_back(i);
    }
    bool res = true;
    for(ll i = 0; i < t_n; i++){
        if(map[t[i]] == 0)res = false;
    }
    if(!res){std::cout << -1 << std::endl; return 0;}


    long long ans = 0;
    long long ind = -1;
    for(ll i = 0; i < t_n; i++){
        //index[t[i]].begin(), index[t[i]].end;
        auto itr = std::upper_bound(index[t[i]].begin(), index[t[i]].end(), ind);
        if(itr == index[t[i]].end()){
            ind = index[t[i]][0];
            ans += s_n;
        }else{
            ind =* itr;
        }
    }
    std::cout << ans + ind + 1<< std::endl;
}


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

void call(int n);
bool contains(const string &str1, const string &str2);

int main(int argc, char *argv[])
{
    int n;
    cin >> n;
    call(n);

    return 0;
}

void call(int n)
{
    for (int i = 1; i <= n; ++i)
    {
        if ((i % 3 == 0) || contains(to_string(i), "3"))
        {
            cout << " " << i;
            continue;
        }
    }
    cout << endl;
}

bool contains(const string &str1, const string &str2)
{
    string::size_type pos = str1.find(str2);
    if (pos == string::npos)
    {
        return false;
    }
    return true;
}

Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int s[51][101]={};

int main() 
{
	c=0;
	while(cin >> a >> b)
	{
		if(a!=0)
		{
			s[c][a]++;
			s[c][b]++;
		}
		else
		{
			s[c][1]++;
			s[c][2]++;
			int t=0;
			for(int i=1; i<=100; i++)
			{
				if(s[c][i]%2!=0)
				{
					t++;
					break;
				}
			}
			if(t==0)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NG" << endl;
			}
			c++;
		}
	}
	return 0;
}

Measured memory_bytes: 3096
s=str(input())
t=str(input())
a=len(s)
flag=0
for i in range(a):
    t=t[a-1:]+t
    t=t[:-1]
    if t==s:
        flag=1
        break
    else:
        pass
if flag==1:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define debug(a) cout << #a << ": " << a << endl

int main() {
	int r, d, x; cin>>r>>d>>x;
	for(int i = 0; i < 10; i++){
		x = r * x - d;
		cout<<x<<endl;		
	}
}


Measured memory_bytes: 256