akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
/* #include <regex> */

using namespace std;

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

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

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

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

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

/* flip A[i] and A[i+1] */

const LL inf = 1e16;
const int maxn = 1e5+5;
/* dp(i,j,k) - at pos(i), j means flip i, k means flip i-1 */
LL A[maxn], n, dp[maxn][2][2];

LL dfs(const int i, const int j, const int k)
{
    if (i == n-1) {
        const LL x = k ? -A[i] : A[i];
        if (j)
            return -x - A[i+1];
        else
            return +x + A[i+1];
    }
    LL& ans = dp[i][j][k];
    if (-1 == ans) {
        ans = -inf;
        const LL x = (k ? -A[i] : A[i]) * (j ? -1 : 1);
        const LL a = dfs(i+1,0,j) + x;
        const LL b = dfs(i+1,1,j) + x;
        ans = max(ans, max(a,b));
    }
    return ans;
}

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    while (cin >> n) {
        memset(dp,-1,sizeof(dp));
        FOR(i,1,n+1)
            cin >> A[i];
        const LL ans = max(dfs(1,0,0),dfs(1,1,0));
        cout << ans << endl;
    }
    return 0;
}


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

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
    long long N;
    cin >> N;
    const auto &res = prime_factorize(N);
    cout << N << ":";
    for (auto p : res) {
        for (int i = 0; i < p.second; ++i) cout << " " << p.first;
    }
    cout << endl;
}



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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0',d=s[3]-'0';
    char op1,op2,op3;
    for(int i = -1;i < 2;i +=2)
    for(int j = -1;j < 2;j +=2)
    for(int k = -1;k < 2;k +=2){
        if(a+b*i+c*j+d*k==7){
            if(i+1)op1='+';else op1='-';
            if(j+1)op2='+';else op2='-';
            if(k+1)op3='+';else op3='-';
        }
    }
    cout << a << op1 << b << op2 << c << op3 << d << "=7" << endl;
    return 0;
}

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

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int k, n;
  cin >> k >> n;
  vector<int> A(n);
  int max_dist = 0;
  rep(i,n) {
    cin >> A[i];
    if (i > 0) max_dist = max(max_dist, A[i] - A[i-1]);
  }
  max_dist = max(max_dist, k - A[n-1] + A[0]);
  int ans = k - max_dist;
  cout << ans << endl;
  return 0;
}

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

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; }

using s64 = int64_t;
const long long MOD = 1e9+7;

int h, w;
vector<vector<char>> s;

using P = pair<int, int>;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int bfs(int sy, int sx) {
    vector<vector<int>> d(h, vector<int>(w, -1));

    int maxi = 0;
    queue<P> que;
    que.push(P(sy, sx));
    d.at(sy).at(sx) = 0;
    while (!que.empty()) {
        P p = que.front(); que.pop();
        for (int i = 0; i < 4; i++) {
            int ny = p.first + dy[i];
            int nx = p.second + dx[i];

            if (0 <= ny && ny < h &&
                0 <= nx && nx < w &&
                d.at(ny).at(nx) == -1 &&
                s.at(ny).at(nx) == '.'
            ) {
                que.push(P(ny, nx));
                d.at(ny).at(nx) = d.at(p.first).at(p.second) + 1;
                chmax(maxi, d.at(ny).at(nx));
            }
        }
    }
    return maxi;
}

int main() {    
    cin >> h >> w;
    s.resize(h, vector<char>(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> s.at(i).at(j);
        }
    }

    int maxi = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s.at(i).at(j) == '#') continue;

            chmax(maxi, bfs(i, j));
        }
    }
    cout << maxi << endl;
}   

Measured memory_bytes: 256
n, m = map(int, input().split())
ac = [0]*n
wa = [0]*n

for _ in range(m):
    p, s = input().split()
    p = int(p)-1
    if ac[p]: continue
    if s == "AC":
        ac[p] = 1
    else:
        wa[p] += 1
AC = 0
WA = 0

for i in range(n):
    AC += ac[i]
    if ac[i] >= 1:
        WA += wa[i]
print("{} {}".format(AC, WA))


Measured memory_bytes: 4596
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  string s;
  cin >> s;
  cout << s.substr(0,s.size()-8) << endl;
return 0;}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
 
 
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        // TODO ?????????????????????????????????????????????
        int i,j,n,q,a;
        a=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
            s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
            t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
            for(i=0;i<n;i++)
            {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            }
        }
        System.out.println(a);
    }
 
}

Measured memory_bytes: 31204
#include <iostream>
#include <string>

using namespace std;

int main(void){
    string n;

    cin >> n;

    for(int i = 0; i < n.length(); i++){
        if(n[i] == '1'){
            n[i] = '9';
            continue;
        }

        if(n[i] == '9'){
            n[i] = '1';
            continue;
        }
    }

    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

struct Process {
	string name;
	int time;
};

static void inputProcess(queue<Process>& processQueue, int n) {
  Process in;
  for (int i = 0; i < n; i++) {
    cin >> in.name  >> in.time;
    processQueue.push(in);
   }
}

int main() {
  int n, q, total = 0;
  cin >> n >> q;

  queue<Process> processQueue;
  inputProcess(processQueue, n);

  while(!processQueue.empty()) {
    Process now = processQueue.front();
    processQueue.pop();
//    cout << "now = " << now.name << ' ' << now.time << endl;
    if (now.time <= q) {
      total += now.time;
      cout << now.name << ' ' << total << endl;
    } else {
      now.time -= q;
      total += q;
      processQueue.push(now);
    }
  }
  
  return 0;
}



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

namespace AtCoder20190303_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int m, n;
            if (input[0] > input[1])
            {
                m = input[0];
                n = input[1];
            }
            else
            {
                m = input[1];
                n = input[0];
            }

            int modded = int.MaxValue;
            var kouyakuNums = new List<int>();

            while (modded != 0)
            {
                modded = m % n;
                m = n;
                n = modded;
            }

            kouyakuNums.Add(1);
            for (int i = 2; i <= m / 2; i++)
            {
                if (m % i == 0)
                {
                    kouyakuNums.Add(i);
                }
            }
            kouyakuNums.Add(m);
            kouyakuNums.Reverse();
            Console.WriteLine(kouyakuNums[input[2] - 1]);
        }
    }
}


Measured memory_bytes: 13396
#include<iostream>
using namespace std;
int main(){
	int n,a[10],i,j,z=1,k=1;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
		z*=3;
	}
	for(i=0;i<n;i++){
		if(a[i]%2==0){
			k*=2;
		}
	}
	cout<<z-k;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#define MOD 1000000007
#define ll long long

int cmpfunc(const void *a, const void *b){
    return (*(int*)a - *(int*)b);
}

void swap(int *a, int *b);

int main(int argc, char **argv){
    int n,i;
    scanf("%d",&n);
    int a[n+1];
    for(i=1;i<=n;i++) scanf("%d",&a[i]);
    int j=0;
    int position=1;
    while(j<2*n){
        j++;
        position = a[position];
        if(position==2){
            printf("%d\n",j);
            return 0;
        }
    }
    printf("-1\n");
    return 0;
}

void swap(int *a, int *b){
    int tmp=*a;
    *a = *b;
    *b = tmp;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    for(int i=0; ;i++){
    int h,w;
    cin >> h>>w;
    if(h == 0 && w==0)return 0;
    for(int j=0;j<w;j++)cout<<"#";
    cout <<endl;
    for(int j=1;j<h-1;j++){
        cout<<"#";
        for(int k=1;k<w-1;k++)cout<<".";
        cout<<"#";
        cout<<endl;
    }
    for(int j=0;j<w;j++)cout<<"#";
    cout<<endl;
    cout << endl;
    }

}


Measured memory_bytes: 3076
import sys
from operator import itemgetter
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def init(n):
  for i in range(N):
    par[i]=i
    rnk[i]=0
def find(x):
  if par[x]==x:
    return x
  else:
    par[x]=find(par[x])
    return par[x]
def unite(x,y):
  x=find(x)
  y=find(y)
  if x==y:
    return
  if (rnk[x]<rnk[y]):
    par[x]=y
  else:
    par[y]=x
    if(rnk[x]==rnk[y]):
      rnk[x]+=1
def same(x,y):
    return find(x)==find(y)

N = I()
xlist = []
ylist = []

par=[0 for i in range(N)]
rnk=[0 for i in range(N)]
init(N)

for i in range(N):
  x, y = IL()
  xlist.append([x, i])
  ylist.append([y, i])
xlist.sort(key=itemgetter(0))
ylist.sort(key=itemgetter(0))

node = []
for i in range(N-1):
  x, xID = xlist[i]
  nextx, nextxID = xlist[i + 1]
  y, yID = ylist[i]
  nexty, nextyID = ylist[i + 1]
  
  node.append([nextx - x, xID, nextxID])
  node.append([nexty - y, yID, nextyID])
node.sort(key=itemgetter(0), reverse=True)

ans = 0
while node:
  val, i, j = node.pop()
  if same(i, j):
    continue
  else:
    unite(i, j)
    ans += val
print(ans)

Measured memory_bytes: 126228
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ff first
#define ss second  
#define endl '\n'
#define pb push_back
#define t_case ll tt; cin>>tt; while (tt--)
#define all(v) v.begin(),v.end()
#define ub(a,x) upper_bound(all(a),x)-a.begin()
#define lb(a,x) lower_bound(all(a),x)-a.begin()
#define fr(a,b,c) for (ll a=b;a<c;a++)
#define take(xx,n) for (int i=0;i<n;i++) cin>>xx[i];
#define take1(xx,n) for (int i=1;i<=n;i++) cin>>xx[i];
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);

int main() 
{
	fastio
	//t_case
	{
		ll n,m,q,ans=0,f=1,d,k,x,y,sum=0,b  ; cin>>n  ;
		cout<<(1000-(n%1000))%1000;
		
		cout<<endl;
	}
	return 0;
}



Measured memory_bytes: 3640
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int k = sc.nextInt();
		int s = sc.nextInt();
        int ans = 0;
       
        aLoop: for(int a = 0; a <= k; a++) {
          bLoop: for(int b = 0; b <= k; b++) {
            int abSum = a + b;
            if (abSum > s) {
              continue aLoop;
            } else if (s - abSum <= k) {
              ans++;
            }
          }
        }
    
		// 出力
		System.out.println(ans);
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> A(Q), point(N, K-Q);
  for (int i=0; i<Q; i++) cin >> A[i];
  for (int i=0; i<Q; i++) point[A[i]-1]++;
  for (int i=0; i<N; i++) {
    if (point[i]<=0) cout << "No" << endl;
    else cout << "Yes" << endl;
  }
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////

const ll inf = 1LL<<60;

int main()
{
  ll n; cin >> n;
  vector<ll> a(n);
  vector<ll> b(n);
  for (int i=0; i<n; i++){
    cin >> a[i];
    cin >> b[i];
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  if (n%2 == 1) {
    ll ma = a[n/2];
    ll mb = b[n/2];
    cout << mb-ma+1 << endl;
    return 0;
  }
  for (int i=0; i<n; i++) {
    a[i] *= 2;
    b[i] *= 2;
  }
  int x = n-1;
  ll ma = (a[x/2]+a[x/2+1])/2;
  ll mb = (b[x/2]+b[x/2+1])/2;
  cout << mb-ma+1 << endl;

  return 0;
}


Measured memory_bytes: 6416
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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; }

// 無限大の値
const ll  LINF = 1LL << 60;
const int iINF = 1 << 29;

int main(void){
  int a,b;
  string op;
  cin >> a >> op >> b;
  
  cout << (op == "+" ? a+b : a-b) << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string.h>
using namespace std;
int main(){
  int n,i,lr[2],flag=0,count;
  string data;
  lr[0]=1;
  lr[1]=1;
  while(1){
    count=0;
    flag=0;
    cin >> n;
    if(n==0) break;
    for(i=0;i<n;i++){
      cin >> data;
      if(data=="lu") lr[0]=2;
      if(data=="ld") lr[0]=1;
      if(data=="ru") lr[1]=2;
      if(data=="rd") lr[1]=1;
      if(flag==0&&lr[0]==2&&lr[1]==2){
	flag=1;
	count++;
      }
      if(flag==1&&lr[0]==1&&lr[1]==1){
        flag=0;
	count++;
      }
    }
    lr[0]=1;
    lr[1]=1;
    cout << count << endl;
  }
  return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std ;
int main ()
{
int n ;
cin >> n;
double c=0.0;
for(int  i= 0;i<n;i++)
{
   double k;
   cin >> k;
   c+=1/k;
}
cout<<setprecision(12)<<(double)(1.0/c);
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <iomanip>
#include <bits/stdc++.h>
#include <string.h>
#include <string>
#include <algorithm>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define debug(x) cout << (#x) << " = " << x << endl;
#define debug2(i,j) cout << (#i) << "=" << i << " , " << (#j) << "=" << j << endl;

using namespace std;

ll modInverse(ll a,ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}

ll binomialCoeff(ll n,ll k)
{
    ll res = 1;
    if(k >n - k)
        k = n - k;
    for(int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

ll power(ll x,ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return temp*temp;
    else
        return x*temp*temp;
}

/* nCr % mod
ll fact[6*N];
ll inv[6*N],invfac[6*N];
ll mod = 998244353;

void factorial()
{
    fact[0] = invfac[0] = fact[1] = invfac[1] = 1;
    inv[1] = 1;
    for(int i=2;i<=5*N + 10;i++)
    {
        fact[i] = (fact[i-1]*i)%mod;
        inv[i] = (inv[mod%i]*(mod - mod/i))%mod;
        invfac[i] = (invfac[i-1]*inv[i])%mod;
    }
}*/

bool prime[100005];

void Sieve(int n)
{
    //bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    /*for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";*/
}

//******************************************************    CHECK CONSTRAINTS   ***************************************************************//

const int Nmax = 1e6 + 5;
ll mod = 1e9 + 7;

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int arr[6];
    int p = -1;
    for(int i=1;i<=5;i++)
    {
        cin >> arr[i];
        if(arr[i] == 0)
            p = i;
    }
    cout << p;
}


Measured memory_bytes: 3596
# -*- coding: utf-8 -*-

import itertools
import math

D, G = map(int, input().split())
ps, cs = [], []
for _ in range(D):
    p, c = map(int, input().split())
    ps.append(p)
    cs.append(c)

cps = list(itertools.product([True, False], repeat=D))
cps.pop(0) # Remove True all

ans = sum(ps)
for cp in cps:
    point, qs, maxp = 0, 0, 0
    for i in range(D):
        if cp[i]:
            point += (i + 1) * 100 * ps[i] + cs[i]
            qs += ps[i]
        else:
            maxp = i
    if point + (maxp + 1) * 100 * (ps[maxp] - 1) >= G:
        mq = max(0, math.ceil((G - point) / ((maxp + 1) * 100)))
        ans = min(ans, qs + mq)

print(ans)


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

// 小数点以下桁数
// fixed << setprecision(i)

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

int main()
{
  string s;
  int ans = 0, tmp = 0;

  cin >> s;
  for (int i = 0; i < s.size(); i++)
  {
    if (i % 2 == 0)
    {
      if (s[i] == '1')
        ans++;
    }
    else
    {
      if (s[i] == '0')
        ans++;
    }
  }
  for (int i = 0; i < s.size(); i++)
  {
    if (i % 2 == 1)
    {
      if (s[i] == '1')
        tmp++;
    }
    else
    {
      if (s[i] == '0')
        tmp++;
    }
  }
  cout << min(ans, tmp) << endl;
}

Measured memory_bytes: 3736
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(int argc, const char *argv[]) {
  int N, T, A, in;
  double HT;
  cin >> N;
  cin >> T >> A;
  vector<double> H(N);

  for(int i = 0; i < N; i++){
    cin >> in;
    HT = (double)T - (double)in * 0.006;
    H[i] = fabs((double)A - HT);
  }
  vector<double>::iterator iter = min_element(H.begin(), H.end());
  size_t index = distance(H.begin(), iter);

  cout << index + 1 << endl;
  return 0;
}


Measured memory_bytes: 888
S = input()

#奇数判定関数
def oj():
  o = "y"
  
  for i in S[0::2]:
    if i == "L":
      o = "n"
  return o
  
#偶数判定関数
def ej():
  e = "y"
  
  for i in S[1::2]:
    if i == "R":
      e = "n"
  return e
  

def j(o,e):
  if o == "y" and e == "y":
    print("Yes")
  else:
    print("No")

j(oj(),ej())

Measured memory_bytes: 3060
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int dp[2 * maxn][2];
int pre[2];
int GET(int val)
{
	if (val == 0)
		return 0;
	return GET(val % __builtin_popcount(val)) + 1;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n = 0; string s;
	cin >> n;
	cin >> s;
	int ones = count(s.begin(), s.end(), '1');
	int x = ones + 1, y = ones - 1;
	if (y != 0)
		dp[n - 1][0] = 1 % y;
	dp[n - 1][1] = 1 % x;
	for (int i = n - 2; i >= 0; --i)
	{
		if (y != 0)
			dp[i][0] = (2 * dp[i + 1][0]) % y;
		dp[i][1] = (2 * dp[i + 1][1]) % x;
	}
	for (int i = 0; i < n; ++i)
	{
		if (s[i] == '1')
		{
			if (y != 0)
			{
				pre[0] += dp[i][0];
				pre[0] %= y;
			}
			pre[1] += dp[i][1];
			pre[1] %= x;
		}
	}
	for (int i = 0; i < n; ++i)
	{
		int z = 0;
		if (s[i] == '1')
		{
			z = pre[0] - dp[i][0];
			if (z < 0)
				z += y;
		}
		else
		{
			z = pre[1] + dp[i][1];
			if (z >= x)
				z -= x;
		}
		if (s[i] == '1' && ones == 1)
			cout << "0" << endl;
		else
			cout << (GET(z) + 1) << endl;
	}
}


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

#define int ll
#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

const int MOD = 1E9 + 7, MAXN = 5E5 + 1000;

ll pow(ll x, ll y) {
	if(y == 0)
	return 1;
	ll temp = pow(x, y/2);
	temp = (temp*temp)%MOD;
	if(y%2 == 1)
		temp *= x;
	return temp%MOD;
}


int pr[MAXN], dp[MAXN];
vi primes;

int32_t main() {
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++)
		cin >> a[i];
	dp[1] = max(a[0], a[1]);
	int arr[n];
	arr[0] = a[0];
	for(int i = 2; i < n; i += 2) {
		arr[i] = a[i] + arr[i - 2];
	}
	for(int i = 2; i < n; i++) {
		if(i%2 == 0)
			dp[i] = max(dp[i - 2] + a[i], dp[i - 1]);
		else {
			dp[i] = a[i] + dp[i - 2];
			dp[i] = max(dp[i], arr[i - 1]);
		}
	}
	cout << dp[n - 1];
}

Measured memory_bytes: 8320
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 25, M = 1e6 + 25, oo = 1e9+7;
const long long OO = 1e18+25;
#define par pair<pair<int,int>, int>
#define f first
#define s second

int n, mem[N][2], u,v,vis[N][2];
vector <int> g[N];

long long dp(int ele=1, int precol=0)
{
    int &ret= mem[ele][precol];
    if(vis[ele][precol] && ret == -1) return 1;
    if(~ret) return ret;
    vis[ele][precol] = 1;
    int ans=0, ans1=1;
    if(!precol) ans =1;
    for(int e : g[ele])
    {
        vis[ele][1] ^= 2;
        ans1 = (1ll*ans1*dp(e, 0))%oo;
        vis[ele][1] ^= 2;
        if(!precol) ans = (1ll*ans*dp(e, 1))%oo;
    }
    ret = (ans+ans1)%oo;
    return ret;
}

int main()
{
    memset(mem, -1, sizeof mem);
    scanf("%d",&n);
    for(int i=0; i<n-1; i++) {scanf("%d%d",&u,&v);g[u].push_back(v);g[v].push_back(u);}
    printf("%lld",dp());
    return 0;
}

Measured memory_bytes: 15616
#include <stdio.h>

int
main()
{
	for (;;)
	{
		int w, h;
		scanf("%d %d", &h, &w);

		if (w == 0 && h == 0)
			break;

		int x, y;
		int is_edge;
		for (y = 0; y < h; y++)
		{
			for (x = 0; x < w; x++)
			{
				is_edge = x == 0 || x == w-1 || y == 0 || y ==h-1;
				printf("%c", is_edge ? '#' : '.');
			}
			printf("\n");
		}
		printf("\n");
	}

	return 0;
}

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

#define vi vector<int>
#define vii vector<int, int>
#define ll long long
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
#else
#define trace(...) 42
#endif

int main(){
    IOS;
    string s1, s2;
    cin >> s1 >> s2;
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    if (s == s1) a--;
    else b--;

    cout << a << ' ' << b;



    #ifdef LOCAL
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif

    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int dansuu = 1;
  
  int N;
  cin >> N;
  
  
  vector<int> d(N);
  for (int i = 0; i < N; i++) {
    
    cin >> d.at(i);
    
  }
  
  sort(d.begin(), d.end());
  
 
  
  int a =  d.at(0);
  
  for (int i = 0; i < N; i++){
    
    if (a != d.at(i)) {
      
      dansuu++;
      
      a = d.at(i);
      
    } else if (a == d.at(i)) {
      
      continue;
      
    }
    
  }
  cout << dansuu << endl;
  
}

Measured memory_bytes: 3592
#include <cstdio>

int
main(void)
{
  int n, b, f, r, v, rooms[4 + 1][3 + 1][10 + 1], i, j, k;
  char sep[] = "####################";

  for (i = 1; i <= 4; i++) {
    for (j = 1; j <= 3; j++) {
      for (k = 1; k <= 10; k++) {
        rooms[i][j][k] = 0;
      }
    }
  }


  std::scanf("%d", &n);
  for (i = 0; i < n; i++) {
    std::scanf("%d %d %d %d", &b, &f, &r, &v);
    rooms[b][f][r] += v;
  }

  for (i = 1; i <= 4; i++) {
    for (j = 1; j <= 3; j++) {
      for (k = 1; k <= 10; k++) {
        std::printf(" %d", rooms[i][j][k]);
      }
      std::printf("\n");
    }
    if (i < 4) {
      std::printf("%s\n", sep);
    }
  }

  return 0;
}



Measured memory_bytes: 2588
#include <stdio.h>
int main(void){
	
	int n,b,f,r,v,i,j,k;
	int a[4][3][10]={0};
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d%d%d",&b,&f,&r,&v);
		a[b-1][f-1][r-1]+=v;
	}
	for(i=0;i<4;i++){
		for(j=0;j<3;j++){
			for(k=0;k<10;k++){
				printf(" %d",a[i][j][k]);
			}
			printf("\n");
		}
		if(i!=3)printf("####################\n");
	}
	
	return 0;
}


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

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

priority_queue<int> p_que;
int n, m;
int a[100010];

int main(void){
	cin>>n>>m;
	for (int i = 0; i < n; i++) {
		cin>>a[i];
		p_que.push(a[i]);
	}

	while (m > 0 && p_que.size()) {
		int val = p_que.top(); p_que.pop();
		val /= 2;
		m--;

		if (val != 0) p_que.push(val);
	}

	ll ans = 0;
	while (p_que.size()) {
		ans += p_que.top(); p_que.pop();
	}

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

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

int main() {
  int ans = 0;
  for (int i = 0; i < 4; i++){
    char c;
    cin >> c;
    
    if (c == '+') {
      ans++;
    } else {
      ans--;
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 3604
import copy

n = int(input())
a = list(map(int,input().split()))
sum = 0

ans_a = 0
for i in range(len(a)):
    sum += a[i]
    if(i%2 == 0):
        if(sum >= 0):
            ans_a += sum + 1
            sum = -1
    else:
        if(sum <= 0):
            ans_a += 1 - sum
            sum = 1

sum = 0
ans_b = 0
for i in range(len(a)):
    sum += a[i]
    if(i%2 == 0):
        if(sum <= 0):
            ans_b += 1 - sum
            sum = 1
    else:
        if(sum >= 0):
            ans_b += sum + 1
            sum = -1

print(min(ans_a,ans_b))

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

int main()
{
  int N;
  int A[100100]={0};
  cin >> N;
  for(int i=0;i<N;i++) cin>>A[i];
  sort(A,A+N);
  N=N/2;
  int a=A[N]-A[N-1];
  cout <<a<<endl;
}

Measured memory_bytes: 640
X = input()
cnt = 0
s_cnt = 0
t_cnt = 0

for v in X:
    if s_cnt == 0 and v == 'T':
        cnt += 1
        t_cnt = 0
        continue

    if v == 'S':
        s_cnt += 1
    if v == 'T':
        t_cnt += 1

    if t_cnt == s_cnt:
        s_cnt = 0
        t_cnt = 0

print(cnt + s_cnt - t_cnt)

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

using namespace std;

#define all(x) (x).begin(),(x).end()
#define sz(x) (int)x.size()
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define debug(x) cerr << "  - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << "  - " << #x << ": " << x << "\t\t" << #y << ": " << y << endl;
#define debugv(v, n) cerr << #v << " : " << " "; for(int i = 0; i < n; i++) cerr << "\t" << #v << "[" <<  i <<  "]" <<  " : " << v[i] << "\n"; cerr << endl;
#define sep() cerr << "--------------------" << endl;

typedef long long ll;
const ll mod = 1e9 + 7;


int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int a, b;
	cin >> a >> b;
	cout << max(a - 2 * b, 0) << endl;
	return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
--import Data.Array
--import Data.Array.Unboxed
import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe

-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
-- templete

f :: IOArray (Int, Int) Char -> (Int, Int) -> IO (Maybe (Int, Int))
f arr p@(y,x) = do
    c <- readArray arr p
    case c of
        '.' -> return $ Just $ swap p
        'x' -> return Nothing
        _ -> writeArray arr p 'x' >> case c of
            '>' -> f arr (y,x+1)
            '<' -> f arr (y,x-1)
            'v' -> f arr (y+1,x)
            '^' -> f arr (y-1,x)


main = do
    [h, w] <- getInts
    unless (h==0 && w==0) $ do
        field <- replicateM h getLine >>= newListArray ((0,0),(h-1,w-1)) . concat :: IO (IOArray (Int,Int) Char)
        f field (0,0) >>= putStrLn . maybe "LOOP" (\(x,y) -> sjoin [x,y])
        main


Measured memory_bytes: 5172
import Control.Monad

main :: IO ()
main = do
  mn <- getLine
  if mn == "0 0"
    then return ()
    else do
      let [m,n] = map (read :: String -> Int) (words mn)
      ls <- replicateM n readLn
      let ans = solve m ls
      print ans
      main


solve :: Int -> [Int] -> Int
solve m ls = check m ls (maximum ls) 1500000
  where
    check :: Int -> [Int] -> Int -> Int -> Int
    check m ls mini maxi
      | mini == maxi = mini
      | rank ls width > m = check m ls (width+1) maxi
      | otherwise = check m ls mini width
      where
        width = (mini + maxi) `div` 2
        rank :: [Int] -> Int -> Int
        rank ls width = rank' ls width 0 1
          where
            rank' :: [Int] -> Int -> Int -> Int -> Int
            rank' [] _ _ count = count
            rank' (x:xs) width nowwidth count
              | x + nowwidth > width = rank' xs width x (count + 1)
              | otherwise = rank' xs width (x + nowwidth) count
                
            

Measured memory_bytes: 4056
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "



int main(){
    string s;cin>>s;
    (s[0]==s[1]||s[1]==s[2]||s[2]==s[3])?co("Bad"):co("Good");
}


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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

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

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

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

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

  string s; cin >> s;
  int n = SZ(s);
  vvi nxt(n+1, vi(26, n+1));
  RREP(i, n-1) {
    REP(j, 26) nxt[i][j] = nxt[i+1][j];
    nxt[i][s[i]-'a'] = i+1;
  }

  vector<pair<int, char>> p(n+2);
  vi len(n+2);
  len[n+1] = 0;
  p[n+1] = {INF, '*'};
  RREP(i, n) {
    int mi = INF;
    char arg = 'A';
    int to = INF;
    REP(j, 26) {
      int now = len[nxt[i][j]] + 1;
      if(mi > now) {
        mi = now;
        arg = 'a' + j;
        to = nxt[i][j];
      }
    }
    len[i] = mi;
    p[i] = {to, arg};
  }

  string ans = "";
  int pos = 0;
  while(pos < n+1) {
    ans.push_back(p[pos].second);
    pos = p[pos].first;
  }
  cout << ans << endl;

}
























Measured memory_bytes: 29332
//#include <bits/stdc++.h>
#include <vector>
//#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {

	long int X;
	long long int sum = 0;

	long int a = 0;
	long int b = 0;

	cin >> X;

	vector<long int> vec(X);

	for (int i = 0; i < X; i++) {
		a = (i + 1) % 3;
		b = (i + 1) % 5;
		if (a == 0 || b == 0) { 
			sum = sum + 0;
		}
		else { 
			sum = sum + i + 1;
		}
		
	}
	
	cout << sum << endl;
	
}


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

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

	rep(i, s.size()) {
		if (i % 2 == 1) {
			if (s[i] == 'R') {
				cout << "No" << endl;
				return 0;
			}
		}
		else {
			if (s[i] == 'L') {
				cout << "No" << endl;
				return 0;
			}
		}
	}

	cout << "Yes" << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int m,f,b;
	scanf("%d%d%d",&m,&f,&b);
	if(m>=b){
		printf("0\n");
	}else if(m+f<b){
		printf("NA\n");
	}else{
		printf("%d\n",b-m);
	}
    return 0;
}

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

using namespace std;

int n;
int a[222];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= 2*n; i++){ 
		scanf("%d", a+i);
	}
	sort(a+1, a+2*n+1, greater<int>());
	int res = 0;
	for (int i = 2; i <= n*2; i += 2) {
		res += a[i];
	}
	printf("%d\n", res);
	return 0;
} 


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  if(abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d))
    printf("Yes");
  else
    printf("No");
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
using namespace std;


int main() {
	int a, b;
	cin >> a >> b;
	string a2 = "";
	string b2 = "";
	for (int i = 0; i < b; i++)
	{
		a2 += to_string(a);
	}
	for (int i = 0; i < a; i++)
	{
		b2 += to_string(b);
	}

	if (a2 <= b2) {
		cout << a2 << endl;
	}
	else {
		cout << b2 << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define CST(x) cout<<fixed<<setprecision(x)
#define PI 3.14159265359
#define MOD 1000000007
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;

int main(){

    int x; cin >> x;
    int y = pow(x,3);
    cout << y << endl;
    return 0;
}


Measured memory_bytes: 3256
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	int n;
	int[] R;
	int max,min;
	
	public void input() {
		n = sc.nextInt();
		R = new int[n];
		for(int i=0; i<n; i++) R[i] = sc.nextInt();
	}
	
	public void compute() {
		min = R[0];
		//最大値は負の値をとることもあるので以下のように設定する
		max = Integer.MIN_VALUE;
		for(int i=1; i<n; i++) {
			max = Math.max(max, R[i]-min);
			min = Math.min(min, R[i]);
		}
		System.out.println(max);
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.compute();
	}
}



Measured memory_bytes: 102912
#include <bits/stdc++.h>
using namespace std;
template<class T> string toStr(T n){ostringstream ost;ost<<n;ost.flush();return ost.str();}

bool pal(int x){
	string s = toStr(x);
	int n = s.size();
	for(int i = 0; i < s.size() / 2; ++i){
		if(s[i]!=s[n - i - 1])return false;
	}
	return true;
}

int main(){
	int a, b;
	cin>>a>>b;
	int res = 0;
	for(int i = a; i <= b; ++i){
		if(pal(i))res++;
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int d[5];
    int k;
    for(int i =0;i<5;i++){
        cin >> d[i];
    }
    cin >> k;
    if(d[4] - d[0] > k) cout << ":(\n";
    else cout << "Yay!\n";
    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++)
void sort2array(double *a,long *b,long n){
    for(int i=0;i<n;i++){
        b[i]=i;
    }
    sort(b,b+n,[a](long i,long j)->bool {return a[i]<a[j];} );
}
int wtover(int a,int b){
    if(a%b>0)return (a/b)+1;
    else return a/b;
}
int INF=100000001;

int main(){
    int i;
    //入力
    cin>>i;
    int a,b,c,j;
    j=i;
    a=j/100;
    i=j%100;
    b=i/10;
    i=i%10;
    c=i;
    //処理
    if(a==7||b==7||c==7)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    //出力
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    FASTINOUT;
    int x,y;
    cin>>x>>y;
    if(y>=x)
        cout<<"unsafe\n";
    else
        cout<<"safe\n";
    return 0;
}


Measured memory_bytes: 3636
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef long long ll;
const int MYINF = 1e9+7;

#define QUEUE_MAX 100010

const char *queue_n[QUEUE_MAX];
int queue_t[QUEUE_MAX];
int front, back;
int n;
int m;

int empty() {
	return front == back;
}

void enqueue(const char *name, int time) {
	if (back == ((front + 1) % m)) {
		fprintf(stderr, "Queue full\n");
		exit(1);
	}
	queue_n[front] = name;
	queue_t[front] = time;
	front = (front + 1) % m;
}

const char *dequeue(int *time) {
	const char *name;
	if (front == back) {
		fprintf(stderr, "Queue empty\n");
		exit(1);
	}
	name = queue_n[back];
	*time = queue_t[back];
	back = (back + 1) % m;
	return name;
}

int main(int argc, char **argv)
{
	int q, i, t, e, d;
	char s[16];
	const char *name;

	scanf("%d %d", &n, &q);
	m = n + 10;

	for (i = 0; i < n; i++) {
		scanf("%s %d", s, &t);
		enqueue(strdup(s), t);
	}

	e = 0;
	while (!empty()) {
		name = dequeue(&t);
		d = t - q;
		if (d > 0) {
			e += q;
			enqueue(name, d);
		} else {
			e += t;
			printf("%s %d\n", name, e);
		}
	}

	return 0;
}

Measured memory_bytes: 2756
#include <cstdio>

int main()
{
	int n, i, j, ans=0;
	int a[2][100], s[100];

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

	for(j=0; j<n; j++){
		for(i=0; i<=j; i++){
			s[j]=s[j]+a[0][i];
		}
		for(i=j; i<n; i++){
			s[j]=s[j]+a[1][i];
		}
	}
	for(j=0; j<n; j++){
		if(ans<s[j]){
			ans=s[j];
		}
	}

	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a, b, c;
    cin >> a >> b >> c;

    if (a < b) {
        swap(a, b);
    }
    if (a < c) {
        swap(a, c);
    }

    int res = a * 10 + b + c;
    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 256
/*
Author: Dynamic JQ

Problem:

Time & Date(start):

Verdict:

Tags:
*/
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const LL BS = 26;
//const LL BS = 304180829;
const LL MOD = 998244353;

int n, cnt;
char s0[305][305], s1[305][305];
int h_h[305][305][305], h_v[305][305][305];
int cur[305];

void get_hash(char ch[][305], int h[][305][305])
{
	rep(i, n) {
		rep(j, n) {
			cur[j] = 0;
			rep(k, n) cur[j] = (cur[j] * BS + ch[j][(k + i) % n] - 'a') % MOD; 
		}
		rep(j, n) rep(k, n) h[i][j][k] = cur[(j + k) % n];
	}
}

int main()
{
	scanf("%d", &n);
	rep(i, n) scanf("%s", s0[i]);
	rep(i, n) rep(j, n) s1[i][j] = s0[j][i];
	get_hash(s0, h_h);
	get_hash(s1, h_v);
	rep(i, n) rep(j, n) {
		bool flag = true;
		rep(k, n) if(h_h[i][j][k] != h_v[j][i][k]) flag = false;
		if(flag) cnt ++;
	}
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 221568
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;

int main(){
	int n;
	cin >> n;
	vector<int> a(26, 50 * n);
	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		vector<int> b(26, 0);
		for(int j = 0; j < (int)s.size(); j++){
			b.at(s.at(j) - 'a')++;
		}
		for(int j = 0; j < 26; j++){
			a.at(j) = min(a.at(j), b.at(j));
		}
	}
	// for(int i = 0; i < 26; i++){
	// 	cout << a.at(i) << " ";
	// }
	// cout << endl;
	string ans = "";
	for(int i = 0; i < 26; i++){
		for(int j = 0; j < a.at(i); j++){
			ans += 'a' + i;
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int i,ace,point;
char card[100000];

int main(){
	while(fgets(card,90000,stdin)){
		if(card[0]=='0')break;
		ace=0;point=0;
		for(i=0;i<strlen(card)-1;i+=2){
			if(card[i]=='1'){
				if(card[i+1]==' ' || card[i+1]=='\n'){ace++;point+=11;}
				else{point+=10;i++;}
			}
			else point+=card[i]-'0';
			while(point>21 && ace>0){ace--;point-=10;}
			if(point>21){point=0;break;}
		}
		printf("%d\n",point);
	}
	return 0;
}

Measured memory_bytes: 520