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

int main() {
  string S;
  cin >> S;
  
  vector<int> vec = {S.at(0), S.at(1), S.at(2), S.at(3)};
  int a = 0;
  
  for (int i = 0; i < 3; i++){
    if (vec.at(i) == vec.at(i + 1)){
      a++;
    }
  }
  if (a > 0){
    cout << "Bad" << endl;
  }
  else {
    cout << "Good" << endl;
  }
}

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

int main() {
  int a;
  cin >> a;
  string op;
  cin >> op;
  int b;
  cin >> b;

  if (op == "+") {
    cout << (a + b) << endl;
  } else if (op == "-") {
    cout << (a - b) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>
#include <sstream>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;

// to container
template <class C>
void input(C &c)
{
    for_each(c.begin(), c.end(), [](auto &i) { cin >> i; });
}

// to number, string
template <class T>
T input()
{
    T data;
    cin >> data;
    return data;
}

int main()
{
    string S = input<string>();
    vector<string> res;

    for (int bit = 0; bit < (1 << 3); ++bit)
    {
        int eq = S[0] - '0';
        ostringstream oss;
        oss << S[0];

        for (int i = 0; i < 3; ++i)
        {
            if (bit & (1 << (2 - i)))
            {
                eq += S[i + 1] - '0';
                oss << '+' << S[i + 1];
            }
            else
            {
                eq -= S[i + 1] - '0';
                oss << '-' << S[i + 1];
            }
        }
        if (eq == 7)
        {
            oss << "=7";
            res.push_back(oss.str());
        }
    }

    cout << res[0] << endl;

    return 0;
}

Measured memory_bytes: 256
k = gets.to_i
if(k%2==0) || (k%5==0)
	puts -1
	exit
end
a = 0
ans = 1
for i in 0..k-1
	a = (a * 10 + 7) % k
	if(a == 0)
		puts ans
		exit
	end
	ans += 1
end
puts -1


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

int main(){
    long long n, m;
    cin >> n >> m;

    long long s[m], c[m];
    for(long long i = 0; i < m; i++) cin >> s[i] >> c[i];

    for(long long i = 0; i <= 999; i++){
        string t;
        t = to_string(i);
        if(t.size() != n) continue;
       
        bool find = true;
        for(long long j = 0; j < m; j++){
            if(t[s[j]-1] != c[j]+'0') find = false;
        }
        if(find == true){
            printf("%lld\n", i);
            return 0;
        }
    }
    printf("-1\n");
    return 0;
}

Measured memory_bytes: 3696
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    public struct Pair { public int x, y; public Pair(int x, int y) { this.x = x; this.y = y; } }
    public static void Solve()
    {
        int D = NextInt();
        int G = NextInt();
        List<Tuple<int, int>> pc = Enumerable.Range(0, D).Select(v => new Tuple<int, int>(NextInt(), NextInt())).ToList();

        int M = (int)Math.Pow(2, D);
        int ans = INF;
        for (int i = 0; i < M; i++)
        {
            int sum = 0;
            int count = 0;
            Queue<int> Q = new Queue<int>();
            for (int x = D - 1; x >= 0; x--)
                if ((1 & i >> x) == 1)
                {
                    sum += (x + 1) * 100 * pc[x].Item1 + pc[x].Item2;
                    count += pc[x].Item1;
                }
                else
                    for (int j = 1; j < pc[x].Item1; j++)
                        Q.Enqueue((x + 1) * 100);
            while (Q.Count() != 0 && sum < G) { sum += Q.Dequeue(); count++; }
            if (sum >= G) ans = Math.Min(ans, count);
        }
        Console.WriteLine(ans);
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 17616
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

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

	ll ans=0;
	ans=(N*(N-1))/2;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <climits>


int main(){
    long N;
    std::cin >> N;
    std::vector<long> B;
    long A[80];
    for(long i=0; i<N; i++){
        long temp;
        std::cin >> temp;
        A[i]=temp;
    }

    long bottom=A[0];
    long ceil=A[0];
    bool pay=0;
    long kabu=0;
    long money=1000;
    for(long i=0; i<N; i++){
        if(pay==0){
            if(A[i]<=bottom){
                bottom=A[i];
            }else{
                kabu=money/bottom;
                money=money%bottom;
                ceil=A[i];
                pay=1;
            }
        }else{
            if(ceil<=A[i]){
                ceil=A[i];
            }else{
                money+=ceil*kabu;
                kabu=0;
                pay=0;
                bottom=A[i];
            }
        }
        if(i==N-1 && pay==1){
            money+=ceil*kabu;
            kabu=0;
            pay=0;
        }
    }
    std::cout << money << std::endl;
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


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

bool dp[7][100010];

int main(){
    ll x;cin>>x;
    dp[0][0]=1;
    ll a[7];
    rep(i,1,6){
        a[i]=99+i;
    }
    rep(i,1,6){
        rep(j,0,x){
            if(j>=a[i]){
                if(dp[i][j-a[i]]==0 && dp[i-1][j]==0){
                    dp[i][j]=0;
                }else{
                    dp[i][j]=1;
                }
            }else{
                if(dp[i-1][j]==0){
                    dp[i][j]=0;
                }else{
                    dp[i][j]=1;
                }
            }
        }
    }
    if(dp[6][x]==1){
        cout<<1<<endl;
    }else{
        cout<<0<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 896
using System;
using System.Linq;
using System.Threading.Tasks;
 
static class Program
{
static void Main()
{
   ulong replaceIdx = Console.ReadLine().Split(' ').Select(c => ulong.Parse(c)).Skip(1).First();
   var inputStr = Console.ReadLine().ToArray();
   inputStr[replaceIdx-1] = Char.ToLower(inputStr[replaceIdx-1]);
   Console.WriteLine(string.Join("",inputStr));
}
}

Measured memory_bytes: 13396
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int a, b, c, k;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> a >> b >> c >> k;
	bool ok = false;
	for (int i = k; i >= 0 && !ok; i--) {
		for (int j = k - i; j >= 0 && !ok; j--) {
			int x = c << i;
			int y = b << j;
			if (x > y && y > a) {
				ok = true;
			}
		}
	}
	if (ok) cout << "Yes\n";
	else cout << "No\n";
	//system("pause");
	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

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

  if(n==1){
    cout<<p<<endl;
    return 0;
  }

  map<ll,ll> mp;
  ll i=2;
  while(i*i<=p){
    if(p%i==0){
      mp[i]++;
      p/=i;
    }else{
      i++;
    }
  }
  mp[p]++;
  ll ans=1;
  for(ll j=2;j<=i;j++) ans*=pow(j,mp[j]/n);

  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 8704
#include <cmath>
#include <cstdio>
#include <algorithm>

using namespace std;

int n;
int h[100021];
int dp[100021];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
        scanf("%d", &h[i]);
    dp[1] = 0; dp[2] = abs(h[1] - h[2]);
    for (int i = 3; i <= n; ++i)
        dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]));
    printf("%d\n", dp[n]);
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N;
	cin >> N;
	vector<string> S(N);
	vector<string> ans;
	map<string, int>mp;
	map<string, bool>mpp;
	int ma = 0;
	REP(i, N) {
		cin >> S[i];
		mp[S[i]]++;
		chmax(ma, mp[S[i]]);
	}
	REP(i, N) {
		if (!mpp[S[i]] && ma == mp[S[i]]) {
			ans.push_back(S[i]);
			mpp[S[i]] = true;
		}
	}
	SORT(ans);
	REP(i, ans.size())cout << ans[i] << endl;
	return 0;
}



Measured memory_bytes: 39536
import sys
input = sys.stdin.readline

n, m = [int(x) for x in input().split()]
g = [[] for _ in range(n)]

for _ in range(m):
    l, r, d = [int(x) for x in input().split()]
    g[l - 1].append((r - 1, d))
    g[r - 1].append((l - 1, -d))

d = [None] * n
visited = [0] * n

for i in range(n):
    if visited[i] != 0:
        continue
    stack = [i]
    d[i] = 0
    while stack:
        u = stack.pop()
        visited[u] = 1
        for v, d_ in g[u]:
            if d[v] == None:
                d[v] = d[u] + d_
                stack.append(v)
            else:
                if d[v] != d[u] + d_:
                    print("No")
                    sys.exit()
print("Yes")


Measured memory_bytes: 78384
//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 

int a[maxs];
int tree[4*maxs];

void build(int node,int s,int e)
{
    if(s==e)
    {
        tree[node]=a[s];
    }
    else
    {
        int mid=(s+e)/2;
        build(node*2,s,mid);
        build(node*2+1,mid+1,e);
        if(tree[node*2]<tree[node*2+1])
        tree[node]=tree[node*2];
        else
        tree[node]=tree[node*2+1];
    }
}

int query(int node,int s,int e,int l,int r)
{
    if(l>e||s>r)
    return 100005;
    if(l<=s&&r>=e)
    return tree[node];
    else
    {
        int mid=(s+e)/2;
        int p1=query(2*node,s,mid,l,r);
        int p2=query(2*node+1,mid+1,e,l,r);
        if(p1<p2)
        return p1;
        else
        return p2;
    }
    
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    char ch;
   cin>>ch;
  if(ch>='A'&&ch<='Z')
    cout<<'A';
  else
    cout<<'a';
}




Measured memory_bytes: 3580
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int mod = 1000000007;

int d2(int k){
    int a=0;
    while(k%2==0){
        a++;
        k /=2;
    }
    return a;
}

int main(){
    int n,ans=0;
    cin>>n;
    rep(i,n){
        int kk=0;
        cin>>kk;
        ans += d2(kk);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		//????????£????????????
		Scanner sc = new Scanner(System.in);
		//????????°???????????????
		int i = 0;
		//x???0??§???????????°??°?????????
		while(true){
		//??\???????????????
		int x = sc.nextInt();
		//??°?????????????????°
		i++;
		//0?????\????????????
		if(x ==0){
			break;
		}
		//??\????????????????????¨???
		System.out.println("Case " + i + ": " + x);
		}
	}
}

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

size_t rankF2(vector<vector<long>>& a){ // calculate rank of matrix in F_2
    long n = a.size(), m = a[0].size();
    size_t now(0), ret(0);
    while(now < m && ret < n){
        size_t i(ret);
        for(; i < n; ++i)if(a[i][now])break;
        if(i == n){
            ++now;
            continue;
        }
        size_t j(i + 1);
        for(; j < n; ++j)if(a[j][now])for(int k = 0; k < m; ++k)a[j][k] ^= a[i][k];
        swap(a[ret], a[i]);
        ++ret;
    }
    return ret;
}

int main(){
    constexpr long m = 998244353;
    auto modpow = [&m](long n){
        long r = 1, p = 2;
        while(n){
            if(n & 1){
                r *= p;
                r %= m;
            }
            p *= p;
            p %= m;
            n >>= 1;
        }
        return r;
    };

    long N, M;
    cin >> N >> M;
    bool f = false;
    if(N > M && (f = true))swap(N, M);

    vector<vector<long>> a(N, vector<long>(M));
    if(f)for(int i = 0; i < M; ++i)for(int j = 0; j < N; ++j)scanf("%ld", &a[j][i]);
    else for(auto& i : a)for(auto &j : i)scanf("%ld", &j);

    auto r = rankF2(a);
    cout << modpow(N + M - r - 1) * (modpow(r) - 1) % m << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
#ifndef M_PI
const double M_PI=acos(-1);
#endif
using namespace std;
static const double EPS = 1e-8;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int(a.size()))
#define F first
#define S second
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};

bool vis[20][20];
string in[20];

main(){
  int w,h;
  while(cin>>w>>h,w|h){
    memset(vis,0,sizeof(vis));
    rep(i,h)cin>>in[i];
    int ans=0;
    rep(i,h){
      rep(j,w){
        if(in[i][j]!='@')continue;
        queue<PI> q;
        q.push(mp(i,j));
        while(!q.empty()){
          int x=q.front().F,y=q.front().S;q.pop();
          if(vis[x][y])continue;
          vis[x][y]=true;
          ++ans;
          rep(k,4){
            int nx=x+dx[k],ny=y+dy[k];
            if(nx<0 || h<=nx ||
               ny<0 || w<=ny ||
               vis[nx][ny] || in[nx][ny]=='#')continue;
            q.push(mp(nx,ny));
          }
        }
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 0
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define INF 100000000
#define MAX 200001
#define MOD 1000000007
ll fac[MAX], finv[MAX], inv[MAX];
const int MX = 1000005;

int main(){
    int n,m;cin>>n>>m;
    vector<int> c(m);
    vector<int> dp(n+1,INF);
    dp[0]=0;
    for(int i=0;i<m;i++) cin>>c[i];
    for(int i=0;i<n+1;i++){
        for(int j=0;j<m;j++){
            if(i-c[j]>=0) dp[i]=min(dp[i],dp[i-c[j]] + 1);
        }
    }
    cout<<dp[n]<<endl;
}


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

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

typedef long long ll;
const ll MOD=1e9+7;
using pear = pair<int,int>;

int main(){
    int ans=0, n;
    double d,x,y;
    cin>>n>>d;
    rep(i,n){
        cin>>x>>y;
        if(sqrt(x*x+y*y)<=d) ans++;
    } 
    cout<<ans<<endl;
}


Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(x) (x).begin(),(x).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; }

int dx[4] = {0,-1,0,1};
int dy[4] = {-1,0,1,0};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> x(5);
    rep(i, 5) {
        cin >> x[i];
        if (x[i] == 0) {
            cout << i + 1 << endl;
        }
    }

}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define ll long long
#define rep(i,a,b) for(int32 i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int32 i = (b) - 1; i >= (a); --i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define vint vector<int>
#define ALL(x) (x).begin(),(x).end()
#define C(x) cout << #x << ":" << x << endl
#define scanf scanf_s

using int32 = int_fast32_t;
using int64 = int_fast64_t;
using uint32 = uint_fast32_t;
using uint64 = uint_fast64_t;

using namespace std;

int main() {
	int32 n, l;
	cin >> n >> l;
	vector<vector<int32>> m(20, vector<int32>(n));
	rep(i, 0, n)
		cin >> m[0][i];
	int32 temp;
	rep(i, 0, 19){
		rep(j, 0, n){
			temp = j + (1 << i);
			if (temp < n) m[i + 1][j] = min(m[i][j], m[i][temp]);
		}
	}
	for (temp = 0;; ++temp){
		if ((1 << temp) > l){
			--temp;
			break;
		}
	}
	int32 s = 0, e = l - (1 << temp);
	printf("%d", min(m[temp][s], m[temp][e]));
	rep(i, 1, n - l + 1){
		printf(" %d", min(m[temp][++s], m[temp][++e]));
	}
	printf("\n");
	return 0;
}

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

int main() {

	int a,b,c,x,cnt=0;
  cin>>a>>b>>c>>x;
  for(int i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
      for(int k=0;k<=c;k++){
        if(x-i*500-j*100-k*50==0){cnt++;}
      }
    }
  }
  cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);
#if __cplusplus>=201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(std::string S){
  ll ans=0;
  REP(S.size()/2){
    if(S[i]!=S[S.size()-i-1]){
      ++ans;
    }
  }
  cout<<ans<<endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

using namespace std;

#define all(x) (x).begin(), (x).end()
typedef long double ld;
typedef long long ll;

const int mod = 998244353;

int add(int x) {  
  return x;
}

template<typename... T>
int add(int x, T... y) {  
  x += add(y...);
  if (x >= mod)
        x -= mod;
  return x;
}

template<typename... T>
int udd(int &x, T... y) { 
  return x = add(x, y...);
}

template<typename... T>
int sub(int x, T... y) { 
  return add(x, mod - add(y...));
}

int mul(int x) { 
  return x;
}

template<typename... T>
int mul(int x, T... y) { 
  return 1ll * x * mul(y...) % mod;
}

int bin(int x, int to) { 
  int y = 1;
  while (to) { 
        if (to & 1)
                  y = mul(x, y);
            x = mul(x, x);
                to >>= 1;
  }
  return y;
}

int inv(int x) { 
  assert(x != 0);
  return bin(x, mod - 2);
}
 

const int M = 300300;

int f[M], fi[M];

void pre() {
  f[0] = 1;
  for (int i = 1; i < M; ++i)
    f[i] = mul(i, f[i - 1]);
  for (int i = 0; i < M; ++i)
    fi[i] = inv(f[i]);
}


int main() {
#ifdef LOCAL
  assert(freopen("b.in", "r", stdin));
#endif

  ios_base::sync_with_stdio(false);

  pre();

  ll n, a, b, k;
  cin >> n >> a >> b >> k;

  int ans = 0;

  for (int i = 0; i <= n; ++i) {
    if (i * a <= k && (k - a * i) % b == 0) {
      ll j = (k - a * i) / b;
      if (j <= n) {
        udd(ans, mul(f[n], f[n], fi[i], fi[n - i], fi[j], fi[n - j]));
      }
    }
  }

  cout << ans << endl;

}



Measured memory_bytes: 2560
#include <iostream>
#include <cstring>
#include <algorithm>
#include <limits.h>
#include <cmath>
#include <time.h>
#include <cstdio>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/*  */
int main(void)
{
  int test = 1;
  int i,j,k,l;
  int n;
  int min = INT_MAX;
  int rep = INT_MIN;
  int a;
  scanf("%d",&n);
  rep(i,n) {
    scanf("%d",&a);
    if(a - min > rep) rep = a - min;
    if(min > a) min = a;
  }
  printf("%d\n",rep);
  return 0;
}

Measured memory_bytes: 3224
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int N;
    cin >> N;
    
    vector<int> A(N);
    int sum=0;
    for(int n=0; n<N; n++) {
        cin >> A[n];
        sum += A[n];
    }
    
    int mid=sum/N;
    if(sum%N>N/2) {
        mid++;
    }
    
    long long int ans=0;
    for(int n=0; n<N; n++) {
        ans += ((long long int)(A[n]-mid))*((long long int)(A[n]-mid));
    }
    
    cout << ans << endl;

    return 0;
    
}

Measured memory_bytes: 256
#include<iostream>
main(){int n,m,i,a,c[1000001];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}

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

int main() {
  int no;
  char blood[5];
  string blood_group[] = {"A", "B", "AB", "O"};
  map<string, int> data;
  while(scanf("%d,%s",&no,blood) != EOF) data[blood]++;
  for(int i = 0; i < 4; i++) cout << data[ blood_group[i] ] << endl;
  return 0;
}

Measured memory_bytes: 1228
import sys
from collections import Counter

# sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


def solve():

    c = Counter()
    n = read_int()
    a = read_int_list()
    for x in a:
        if x % 2 == 1:
            c[0] += 1
        elif x % 4 == 2:
            c[1] += 1
        else:
            c[2] += 1
    if c[0] > c[2] + 1:
        return 'No'
    elif c[0] == c[2] + 1:
        if c[1] > 0:
            return 'No'
        else:
            return 'Yes'
    else:
        return 'Yes'


def main():
    res = solve()
    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14628
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
typedef vector<int> Vi;
typedef pair<int,int> Pii;
typedef pair<int,Pii> Pip; 
const int INF = (1<<30);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){

  int n, m;
  while( cin >> n >> m, n+m ) {
    int a[1000], b[1000];
    
    for(int i=0; i<n; i++) {
      cin >> a[i];
    }
    
    for(int i=0; i<m; i++) {
      cin >> b[i];
    }
    
    int now = 0;
    int cnt = 0;
    for(int i=0; i<m; i++) {
      cnt++;
      now += b[i];
      now += a[now];
      if( now >= n ) break;
    }
    
    cout << cnt << endl;
  } 
}

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

int main() {
  int d;
  cin >> d;
  if(d==25){
    cout << "Christmas" << endl;
  }else if(d==24){
    cout << "Christmas Eve" << endl;
  }else if(d==23){
    cout << "Christmas Eve Eve" << endl;
  }else{
    cout << "Christmas Eve Eve Eve" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    
    vector<int> v(n);
    for(int i = 0; i < n; i++) {
        cin >> v[i];
    }
    
    for(int i = 0; i < n; i++) {
        if(v[i] % 2 == 0) {
            if(!(v[i] % 3 == 0 || v[i] % 5 == 0)) {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAXN 55
#define INF 1000000009

ll n;

int main()
{
    cin >> n;
    for(ll i = sqrt(n); i > 0; i--){
        if(n % i == 0){
            ll mx = i > n / i ? i : n / i;
            ll ans = 0;
            while(mx){
                ans++;
                mx /= 10;
            }
            printf("%lld\n", ans);
            return 0;
        }
    }


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  string S;
  cin >> S;
  string ans;
  rep(i, S.size())
      ans += "x";
  cout << ans << endl;
  return 0;
}

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

int main(void)
{
	int n;
	cin >> n;
	vector<int>res(n);
	for (int i = 0; i < n; i++)cin >> res[i];
	int q;
	cin >> q;
	for (int i = 0; i < q; i++)
	{
		int b, e, t;
		cin >> b >> e >> t;
		swap_ranges(res.begin() + b, res.begin() + e, res.begin() + t);
	}
	for (int i = 0; i < n; i++)
		if (i == 0)cout << res[i];
		else cout << " " << res[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 3100
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

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

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N, T, A;
  cin >> N >> T >> A;
  vll H(N);
  REP(i, 0, N) {
    ll h;
    cin >> h;
    H[i] = h;
  }

  double min = kMod;
  ll m_i = 0;
  REP(i, 0, N) {
    double t = T - double(H[i] * 0.006);
    if (abs(t - A) < min) {
      min = abs(t - A);
      m_i = i;
    }
  }
  cout << m_i + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int r = input[0];
            int c = input[1];

            int[,] table = new int[r + 1, c + 1];
            int[] data;

            for (int i = 0; i < r; i++)
            {
                data = new int[c];
                data = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

                for (int j = 0; j < c; j++)
                {
                    table[i, j] = data[j];
                    table[i, c] += data[j];
                    table[r, j] += data[j];
                }
                table[r, c] += table[i,c]; 
            }

            for (int i = 0; i < r+1; i++)
            {
                for (int j = 0; j < c+1; j++)
                {
                    Console.Write(table[i,j]);
                    if (!(j == c)) Console.Write(" ");
                }
                Console.WriteLine();
            }
        }
    }
}


Measured memory_bytes: 20420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    for(int i = 0;i < 200;i++){
        if(i % 2 != 0){
            a-=d;
            if(a <= 0){
                cout << "No" << endl;
                break;
            }
        }else{
            c-=b;
            if(c <= 0){
                cout << "Yes" << endl;
                break;
            }
        }
    }
}



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



void solve(){
    int n;
    cin >> n;
    int  b[n+10];
    rep(i,n-1){
        cin >> b[i];
    }
    /*
    数列a0,a1,a2,...
    は、
    b[0], min(b[0],b[1]), min(b[1],b[2]), ..., min(b[n-3], b[n-2]), b[n-2]
    0 0 10 10 10 23
    */
    int sum = 0;
    sum += b[0];
    //cout << b[0] << endl;
    sum += b[n-2];
    //cout << b[n-1] << endl;
    for(int i=0; i<n-2; i++){
        sum += min(b[i],b[i+1]);
    }
    cout << sum << endl;
}

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

Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {
  val Array(n, m) = StdIn.readLine.split(" ").map(_.toInt)

  val ans = (n to m).par.count(i => {
    ( i / 10000) == (i % 10) && (i / 1000 % 10) == (i / 10 % 10)
  })

  println(ans)
}


Measured memory_bytes: 28352
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i, n, N) for(ll i=(n);i<(N);i++)
#define RREP(i, n, N) for(ll i=(N-1);i>=(n);i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(), (v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll N;
ll A[100010];

int main() {
    cin >> N;
    REP(i, 0, N) {
        cin >> A[i];
    }

    sort(A, A + N);

    ll sum = 0LL;
    ll t = 0;
    REP(i, 0, N - 1) {
        sum += A[i];
        if (2LL * sum < A[i + 1]) {
            t = max(t, i+1);
        }
    }

    cout << N - t << endl;

    return 0;
}


Measured memory_bytes: 1024
n,k=gets.split.map(&:to_i)
as=gets.split.map(&:to_i)

fn = as.take_while {|e| e!=1}.length
bn = n - 1 - fn

ret = 0
k -= 1
ret += fn / k
ret += bn / k
ret += (((fn%k)+(bn%k))/k.to_f).ceil

p ret


Measured memory_bytes: 8068
N,M,L = map(int, input().split())

matrix1 = []
matrix2 = []

for n in range(N):
    matrix1.append(list(map(int, input().split())))
for l in range(M):
    matrix2.append(list(map(int, input().split())))


res = []
for n in range(N):
    larr = []
    for l in range(L):
        tmp = 0
        for m1,m2 in zip(matrix1[n], [matrix2[m][l] for m in range(M)]):
            tmp += m1*m2
  #      print(larr)
        larr.append(tmp)
 #       print(larr)
    res.append(larr)

for n in range(N):
    print(*res[n],sep=" ")


Measured memory_bytes: 7060
// Aizu Vol-1 0113: Period
// 2017.8.2

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

char *gets(char *);
char buf[100], *p;

int getInt(void)
{
	int n = 0;
	while (isspace(*p)) p++;
	while (isdigit(*p)) n = 10 * n + (*p++ - '0');
	return n;
}

#define MAX 1000000
int rr[MAX + 1], *rp, *re;

int main()
{
	int a, b, r, k;
	int i, w;

	while (gets(p = buf) != NULL) {
		a = getInt(), b = getInt();
		for (rp = rr, re = rp + b; rp < re; ) *rp++ = -1;
		for (rr[a] = 0, k = 1; ; k++) {
			a *= 10;
			putchar('0' + a / b);
			if ((r = a % b) == 0) { putchar('\n'); break; }
			if (rr[r] >= 0) {
				putchar('\n');
				i = w = rr[r];
				while (i--) putchar(' ');
				while (w++ < k) putchar('^');
				putchar('\n');
				break;
			}
			rr[r] = k, a = r;
		}
	}
	return 0;
}

Measured memory_bytes: 4388
#include<bits/stdc++.h>
#define N 300050
#define M 200
#define int long long
#define pb push_back
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
#define ll long long
#define SIZE N
#define MOD mod
using namespace std;
int n;
vector< pair< int , int > > ar;
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
    cin>>n;
    ar.resize(n-1);
    for(int i=0;i<n-1;i++){
        cin>>ar[i].x>>ar[i].y;
    }
    int ans = 0;
    for(int i=1;i<=n;i++){
        ans += (i)*(n-i+1);
    }
    for(int i=0;i<n-1;i++){
        if(ar[i].x>ar[i].y)swap(ar[i].x,ar[i].y);
        int cnt = ar[i].x * (n + 1ll - ar[i].y);
        ans -= cnt;
    }
    cout<<ans;
    
  	return 0;
}



Measured memory_bytes: 6328
main = mapM_ process . takeWhile (/= "0 0") . lines =<< getContents
  where process line = do
                          putStrLn $ unlines $ map (\x->case () of
                                                              _| odd x -> map (\y->case () of
                                                                                            _| odd y->'#'
                                                                                             | even y ->'.'
                                                                                             | otherwise ->' ') [1..w]
                                                               | even x -> map (\y->case () of
                                                                                             _| odd y ->'.'
                                                                                              | even y ->'#'
                                                                                              | otherwise ->' ') [1..w]
                                                                                             )
                                                                                               [1..h]
                          where [h,w] = map (read::String->Int) $ words line

Measured memory_bytes: 4952
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

const ll MAX_PRIME = 55555;
vector<int> primes;
vector<int> is_prime(MAX_PRIME + 1,true);
void init_primes(){
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i <= MAX_PRIME;i++){
        if(is_prime[i]){
            primes.push_back(i);
            for(int j = i*2; j <= MAX_PRIME; j+=i) is_prime[j] = false;
        }
    }
}

vector<int> ans;
void solve(){
    ll N; cin >> N;
    for(auto p:primes){
        if(ans.size() ==N) break;
        if(p%10 == 1){
            ans.push_back(p);
        }
    }
    cout << ans << endl;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    init_primes();
    solve();
    return 0;
}


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

int main(){
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int m = max(max(a,b),c);
	int n = m;
	while(k--){
		n*=2;
	}
	cout << a+b+c+n-m << endl;
	return 0;
}

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

int main()
{
	string S; cin >> S;
	ll a, b, c, d;
	a = S[0] - '0';
	b = S[1] - '0';
	c = S[2] - '0';
	d = S[3] - '0';
	//cout << a << " " << b << " " << c << " " << d << endl;

	ll index = 0;
	string ans = "";
	rep(i, (1<<3)) {
		ll tmp = S[0] - '0';
		ans = S[0];
		index = 1;
		rep (j, 3) {
			if ((i >> j) & 0x01) {
				tmp += S[index] - '0';
				ans += '+'; ans += S[index];
			}
			else {
				tmp -= S[index] - '0';
				ans += '-'; ans += S[index];
			}
			index++;
		}
		if (tmp == 7) {
			ans += "=7";
			cout << ans << endl;
			exit(0); 
		}

	}
	


}


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

if a**2 * b <= 2 * x:
    h = (a**2 * b - x) / a**2 * 2
    theta = h / (a**2 + h**2)**0.5
    ans = math.degrees(math.asin(theta))
else:
    h = 2 * x / a / b
    theta = h / (b**2 + h**2)**0.5
    ans = math.degrees(math.acos(theta))

print(ans)

Measured memory_bytes: 3188
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <tuple>

#define INF 100100100100
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

 
int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    
    ll sum = 0;
    ll mina = INF;
    ll count = 0;
    bool zero = false;
    rep(i,n){
        if(a[i] == 0){
            zero = true;
        }
        if(a[i] < 0){
            count++;
        }
        
        sum += abs(a[i]);
        mina = min(mina, abs(a[i]));
        
    }
    
    if(zero){
        cout << sum << endl;
        return 0;
    }
    if(count %2 == 0){
        cout << sum << endl;
        return 0;
    }
    cout << sum - 2*mina<< endl;
    
    
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f,g,h;
int main()
{
	cin>>a>>b;
	if(a<1||a>9||b<1||b>9)cout<<"-1";
	else cout<<a*b;
	return 0;
 } 

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  string s; cin >> s;
  deque<char> dq;
  for(int i = 0; i < s.size(); i++) dq.push_back(s[i]);
  int flag = 0;
  int q; cin >> q;
  for(int i = 0; i < q; i++) {
    int t; cin >> t;
    if (t == 1) {
      flag++;
      if (flag == 2) flag = 0;
    } else {
      int f; 
      char c;
      cin >> f >> c;
      f--;
      if(f ^ flag) {
        dq.push_back(c);
      } else {
        dq.push_front(c);
      }
    }
  }
  
  if(flag == 0) {
    while(dq.size()) {
      cout << dq.front();
      dq.pop_front();
    }
  } else {
    while(dq.size()) {
      cout << dq.back();
      dq.pop_back();
    }
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 1024
# coding: utf-8
# Your code here!
INT = list(map(int,input().split()))
N,M = INT[0],INT[1]

#print(N,M)

L_LIST = [0 for i in range(M)]
R_LIST = [0 for i in range(M)]
for i in range(M):
    LR_LIST = list(map(int,input().split()))
    L_LIST[i] = LR_LIST[0]
    R_LIST[i] =LR_LIST[1]

L_MAX = max(L_LIST)
R_MIN = min(R_LIST)

if R_MIN - L_MAX >= 0:
    print(R_MIN - L_MAX + 1)
    
else:
    print(int(0))

Measured memory_bytes: 11060
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main(){ 
	string S; 
	cin >> S; 
	int N = S.size(); 
	if(N % 2 == 0 && S.at(0) == S.at(N-1)){cout <<"First"<< endl;}
	if(N % 2 == 0 && S.at(0) != S.at(N-1)){cout <<"Second"<< endl;}
	if(N % 2 == 1 && S.at(0) == S.at(N-1)){cout <<"Second"<< endl;}
	if(N % 2 == 1 && S.at(0) != S.at(N-1)){cout <<"First" << endl;}
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
  int r, g, a;
  cin >> r >> g;
  if (r > g){
    a = g - (r - g);
    cout << a << endl;
  }else if (r < g){
    a = (g - r) + g;
    cout << a << endl;
  }else{
    cout << r << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define mod 1000000007
#define dom 998244353
#define all(c) begin(c),end(c)
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <typename T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }
#define long long long
#define List vector
#define var auto
#define Count size()
#define Length size()
int dd[] = { 0, 1, 0, -1, 0 }; //→↓←↑

struct LiChaoTree
{
	struct Line
	{
		long a, b;
		Line(long a, long b)
		{
			this->a = a;
			this->b = b;
		}
		long f(long x)
		{
			return a * x + b;
		}
	};
	int n;
	vector<Line> tr;
	Line ex = Line(0, LLONG_MAX);
	vector<long> X;

	//動的CHT, M=(x座標の最大値)
	LiChaoTree(int M)
	{
		M++; n = 1; while (n < M) n <<= 1;
		tr.clear();
		tr.resize((n << 1) - 1, ex);
		X.clear();
		X.resize(n);
		for (int i = 0; i < n; i++) X[i] = i;
	}
	//クエリ先読み動的CHT
	//M=(x座標の最大値)
	//Q=(ソート済みであるx座標のクエリ配列)
	LiChaoTree(long M, vector<long> Q)
	{
		int n_ = Q.size();
		n = 1; while (n < n_) n <<= 1;
		tr.clear();
		X.clear();
		X.resize(n);
		for (int i = 0; i < n_; i++) X[i] = Q[i];
		for (int i = n_; i < n; i++) X[i] = M << 1;
	}
	//座標xにおけるy座標の最小値
	//j=(そのx座標のインデックス
	long query(int j)
	{
		long x = X[j];
		int i = j + n - 1;
		long ret = tr[i].f(x);
		while (i > 0) { i = i - 1 >> 1; ret = min(ret, tr[i].f(x)); }
		return ret;
	}
	//直線 y=ax+b を追加
	void add(long a, long b)
	{
		add(0, 0, n, Line(a, b));
	}
	void add(int k, int l, int r, Line f)
	{
		long lx = X[l];
		long rx = X[r - 1];
		bool left = f.f(lx) < tr[k].f(lx);
		bool right = f.f(rx) < tr[k].f(rx);

		if (!left && !right) return;
		if (left && right) { tr[k] = f; return; }

		int m = l + r >> 1;
		long mx = X[m];
		bool mid = f.f(mx) < tr[k].f(mx);
		if (mid) { Line tmp = f; f = tr[k]; tr[k] = tmp; }

		if (left != mid) add(k << 1 | 1, l, l + r >> 1, f);
		else add(k + 1 << 1, l + r >> 1, r, f);
	}

};
//以下の漸化式は
//dp[i]=min_j (H[j]-H[i])^2 + dp[j] + C (j=[0,i-1])
//min_j (-2H[j] *H[i] +(H[j]^2+dp[j])) + (H[i]^2+C)
//と変形できるのでCHTで高速化できる。

void solve()
{
	int N; cin >> N;
	long C; cin >> C;
	vector<long> dp(N);
	LiChaoTree CHT(1000000);
	vector<long> H(N);
	rep(i, N)
	{
		cin >> H[i];
	}
	CHT.add(-2 * H[0], H[0] * H[0]);
	repi(j, 1, N)
	{
		dp[j] = H[j] * H[j] + C + CHT.query((int)H[j]);
		CHT.add(-2 * H[j], dp[j] + H[j] * H[j]);
	}
	cout << dp[N - 1] << endl;
}

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


Measured memory_bytes: 44416
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <cstdio>
#include <numeric>
#include <iomanip>

using namespace std;

using ll = long long;

string S;

int main()
{
    cin >> S;
    ll n = 1;
    if(S == "RRS" || S == "SRR")
    {
        n = 2;
    }
    else if(S == "RRR")
    {
        n = 3;
    }
    else if(S == "SSS")
    {
        n = 0;
    }
    cout << n << endl;
    return 0;
}

Measured memory_bytes: 3244