akhauriyash/Code-Regression huggingface dataset:
// Author: Gaurang_Kothiya

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>
 
using namespace std;
using namespace __gnu_pbds;  

#define data_set(type) tree<type,null_type,less<type>,rb_tree_tag,tree_order_statistics_node_update>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define ld long double
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(int i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define ook(num) order_of_key(num)
#define fbo(num) find_by_order(num)
#define gcd(a,b) __gcd(a,b)
#define bits(n) __builtin_popcountll(n)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define RE rend()
#define RB rbegin()
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846

const int inf= 1e9 +1;
const int inf64= 1e18 -1;
const int MOD= 1e9 +7;



void Solve()
{
	int n;
	cin>>n;
	
	v(int) a(n);
	fe(x,a) cin>>x;
	
	int ans=0;
	f(i,0,n-3)
	{
		f(j,i+1,n-2)
		{
			f(k,j+1,n-1)
			{
				if(a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k])
				{
					v(int) vec;
					vec.pub(a[i]);
					vec.pub(a[j]);
					vec.pub(a[k]);
					sort(all(vec));
					if(vec[0]+vec[1]>vec[2]) ans++;
				}
			}
		}
	}
	cout<<ans;
}
 
signed main() 
{
	speed		

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);	

	int q=1;
	//cin>>q;
	
	while(q--)
	Solve();
		
	return 0;
} 

Measured memory_bytes: 3632
import sys
stdin = sys.stdin
from itertools import accumulate

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

n = ni()
h = na()
hpre = h[-1]
for hi in h[:-1][::-1]:
    if hi <= hpre:
        hpre = hi
    elif hi == hpre + 1:
        hpre = hi - 1
    else:
        print("No")
        quit()
print("Yes")

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//*find_by_order
//order_of_key

const int maxn = 1e6 + 5;
int n,a[maxn],x;
int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

  cin>>n>>x;
  int ans = n;
  for (int i=0; i<n; i++) {
    cin>>a[i]; x-=a[i];
  }
  sort(a,a+n);
  ans += x/a[0];
  out(ans);
  

  return 0;
}


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

#define Fast            ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define LL              long long
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define all(a)          a.begin(),a.end()
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))

int fx[]={-1,+1,0,0};
int fy[]={0,0,-1,+1};

int row,col,ans;
char cell[25][25];
int d[25][25],vis[25][25];

inline void bfs(int sx,int sy)
{
    MEM(vis,0);
    MEM(d,0);
    vis[sx][sy]=1;
    queue<pii>q;
    q.push(pii(sx,sy));
    while(!q.empty())
    {
        pii top=q.front();
        q.pop();
        for(int k=0; k<4; k++)
        {
            int tx=top.ff+fx[k];
            int ty=top.ss+fy[k];
            if(tx>=1 and tx<=row and ty>=1 and ty<=col and cell[tx][ty]!='#' and vis[tx][ty]==0)
            {
                vis[tx][ty]=1;
                d[tx][ty]=d[top.ff][top.ss]+1;
                ans=max(ans,d[tx][ty]);
                q.push(pii(tx,ty));
            }
        }
    }
    return;
}

int main()
{
    cin >> row >> col;
    FOR(i,1,row)
    {
        FOR(j,1,col)
        {
            cin >> cell[i][j];
        }
    }
    FOR(i,1,row){
        FOR(j,1,col){
            if(cell[i][j]=='.') bfs(i,j);
        }
    }
    cout << ans;
}



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

#define pb push_back

signed main()
{
  int N;
  string S;
  vector< string > S1, S2;
  
  string T;
  
  cin >> N;
  Rep(i, N) {
    string s1, s2;

    cin >> S;
    
    Rep(j, S.size()) {
      if(S[j] == '?') {
	s1.pb('z'); s2.pb('a');
      } else {
	s1.pb(S[j]); s2.pb(S[j]);
      }
    }
    
    S1.pb(s1); S2.pb(s2);
  }
  
  cin >> T;
  S1.pb(T); S2.pb(T);
  sort(S1.begin(), S1.end()); sort(S2.begin(), S2.end());
  
  int i = 0, j = S1.size() - 1;
  while(T != S1[i]) i++;
  while(T != S2[j]) j--;
  
  for(int k = i + 1; k <= j; k++) {
    cout << k << " ";
  }
  
  cout << j + 1 << endl;
  return 0;
}


Measured memory_bytes: 1536
function main(input) {
	// 入力
	input = input.split(" ");
	var a = parseInt(input[0], 10);
	var b = parseInt(input[1], 10);
	var s = (a * b) / 2;
	// 出力
	if (Number.isInteger(s) == true) {
		console.log('Even');
	} else {
		console.log('Odd');
	}
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <iostream>
#include <string>
int main()
{
  std::string S;
  std::cin >> S;
  if(S == "SUN")
     std::cout << "7" << std::endl;
   if(S == "MON")
     std::cout << "6" << std::endl;
      if(S == "TUE")
     std::cout << "5" << std::endl;
         if(S == "WED")
     std::cout << "4" << std::endl;
     if(S == "THU")
     std::cout << "3" << std::endl;
        if(S == "FRI")
     std::cout << "2" << std::endl;
           if(S == "SAT")
     std::cout << "1" << std::endl;
              
              return 0;
              }

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #整数1つinput
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii())
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #文字列1つinput
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

n = ii()
arr = limii()
dp = [0]*n
chk=True
cnt=1
while chk:
    if cnt==1:
        dp[cnt] = abs(arr[cnt]-arr[cnt-1])
    else:
        dp[cnt] = min(abs(arr[cnt]-arr[cnt-1])+dp[cnt-1],abs(arr[cnt]-arr[cnt-2])+dp[cnt-2])

    if cnt==n-1:
        chk=False
    cnt+=1
print(dp[-1])

Measured memory_bytes: 77164
#include <bits/stdc++.h>
#define MAX 10
#define For(i, a, b) for( int i = (a); i < (b); i++ )
#define ll long long
using namespace std;

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

    int n,m;
    cin>>n>>m;
   
    if(n != 0) n = (n-1) * n;
    if(m != 0) m = (m-1) * m;

    n/=2; m/=2;
    cout<<(n+m)<<endl;
    return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

ll const MOD = 1e9+7;

namespace math { namespace integer {

template<class T> T mod_mul(T x, T k, T m) { if(k == 0) { return 0; } if(k % 2 == 0) { return mod_mul((x + x) % m, k / 2, m); } else { return (x + mod_mul(x, k - 1, m)) % m; } }
template<class T> T mod_pow(T x, T n, T mod) { if(n == 0) { return 1; } if(n % 2 == 0) { return mod_pow(mod_mul(x, x, mod) % mod, n / 2, mod); } else { return mod_mul(x, mod_pow(x, n - 1, mod), mod); } }
template<class T> T extgcd(T a, T b, T& x, T& y) { T d = a; if(b != 0) { d = extgcd(b, a % b, y, x); y -= (a / b) * x;} else { x = 1, y = 0; } return d; }
template<class T> T mod_inverse(T x, T mod) { return mod_pow(x, T(mod - 2), mod); /* use fermat */ }
template<class T> T mod_inverse_composite_num_mod(T a, ll mod) { T x, y; extgcd(a, mod, x, y); return (mod + x % mod) % mod; }

}}
using namespace math::integer;

ll fact[2000010];

int main() {
  fact[0] = fact[1] = 1;
  REP(i, 2, 2000010) fact[i] = (fact[i - 1] * i) % MOD;

  int X, Y; cin >> X >> Y;

/*
  2 A + B = X;
  2 B + A = Y;
  B = X - 2 A;
  Y = 2 (X - 2 A) + A;
    = 2 X - 4 A + A;
    = 2 X - 3 A;
    */
  ll A = -1;
  REP(a, 0, X + 1) {
    if (Y == 2 * X - 3 * a) {
      A = a;
      break;
    }
  }
  ll B = X - 2 * A;
  if (A < 0 || B < 0) {
    cout << "0\n";
    return 0;
  }
  ll ans = (((fact[A + B] * mod_inverse(fact[A], MOD)) % MOD) * mod_inverse(fact[B], MOD)) % MOD;
  cout << ans << endl;
}


Measured memory_bytes: 15872
import std.stdio, std.string, std.conv, std.array, std.algorithm;

ulong[] getArray() {
  auto ary = appender( new ulong[]( 0 ) );
  foreach ( n; 1 .. 1000 ) {
	immutable ulong val = n * ( n + 1 ) * ( n + 2 ) / 6;
	if ( val >= 10 ^^ 6 ) {
	  break;
	} else {
	  ary.put( val );
	}
  }
  return ary.data;
}

ulong[] getOddArray() {
  immutable auto s = getArray().length;
  auto ary = appender( new ulong[]( 0 ) );
  foreach ( n; 1 .. s + 1 ) {
	immutable auto val = n * ( n + 1 ) * ( n + 2 ) / 6;
	if ( val % 2 == 1 ) {
	  ary.put( val );
	}
  }
  return ary.data;
}

void main()
{
  const ulong[] array = getArray();
  const ulong[] oddArray = getOddArray();

  ulong[] answer = new ulong[]( 100_0001 );
  answer[] = 100_0000;
  answer[ 0 ] = 0;
  ulong[] oddAnswer = new ulong[]( 100_0001 );
  oddAnswer[] = 100_0000;
  oddAnswer[ 0 ] = 0;
  
  foreach ( i; 0 .. 100_0001 ) {
	foreach ( v; array ) {
	  if ( i + v <= 100_0000 ) {
		answer[ i + v ] = min( answer[ i + v ], answer[ i ] + 1 );
	  }
	}
	foreach ( v; oddArray ) {
	  if ( i + v <= 100_0000 ) {
		oddAnswer[ i + v ] = min( oddAnswer[ i + v ], oddAnswer[ i ] + 1 );
	  }
	}
  }

  while ( true ) {
	immutable int n = to!int( strip( readln ) );
	if ( n == 0 ) break;
	writeln( answer[ n ], " ", oddAnswer[ n ] );
  }  
}

Measured memory_bytes: 18932
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

N=II()
DS=LI()

res = 0.0
for n in DS:
    res += 1/n

print(1/res)


Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		int ans = x;

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		for (int dif = 0; dif <= n; dif++) {

			//x-difがリストに無いとき
			if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			}

			//x+difがリストに無いとき
			if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			}

		}

		if (n > 100) {
			System.out.println("error");
		}
		System.out.println(ans);

		sc.close();

	}

}

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

int main(){

  int A, B, C, ma, oa, K;
  cin >> A >> B >> C >> K;
  ma = max({A, B, C});
  oa = A + B + C - ma;
  ma = ma * pow(2, K);
    
    cout << ma + oa << endl;
  
return 0;
  
}

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

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scanf("%c",&a)
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}

const int N = 3e5 + 10;

struct Seg_Tree {
    struct {
        int l, r, dat;
    } t[N * 4];

    void build(int p, int l, int r) {
        t[p].l = l, t[p].r = r;
        if (l == r) {
            t[p].dat = 0;
            return;
        }
        int mid = (l + r) >> 1;
        build(p << 1, l, mid);
        build(p << 1 | 1, mid + 1, r);
        t[p].dat = 0;
    }

    void change(int p, int x, int v) {
        if (t[p].l == t[p].r) {
            t[p].dat = max(t[p].dat, v);
            return;
        }
        int mid = (t[p].l + t[p].r) >> 1;
        if (x <= mid)change(p << 1, x, v);
        else change(p << 1 | 1, x, v);
        t[p].dat = max(t[p << 1].dat, t[p << 1 | 1].dat);
    }

    int ask(int p, int l, int r) {
        if (l <= t[p].l && r >= t[p].r)return t[p].dat;
        int mid = (t[p].l + t[p].r) >> 1;
        int val = 0;
        if (l <= mid)val = max(val, ask(p << 1, l, r));
        if (r > mid)val = max(val, ask(p << 1 | 1, l, r));
        return val;
    }
} tr;

int n, k;

int main() {
    n = qr(), k = qr();
    int ans = 0;
    tr.build(1, 1, 300000);
    repi(i, 1, n) {
        int x = qr();
        int res = tr.ask(1, max(1, x - k), min(300000, x + k)) + 1;
        ans = max(ans, res);
        tr.change(1, x, res);
    }
    pi(ans);
    return 0;
}

Measured memory_bytes: 16000
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int[] a=new int[n];
    for(int i=0;i<n;i++){
      a[i]=sc.nextInt();
    }
    int midx=0;
    int sidx=1;
    if(a[midx]<a[sidx]){
      midx=1;
      sidx=0;
    }
    for(int i=2;i<n;i++){
      if(a[i]>a[midx]){
        sidx=midx;
        midx=i;
      }else if(a[i]>a[sidx]){
        sidx=i;
      }
    }
    for(int i=0;i<n;i++){
      if(i==midx){
        System.out.println(a[sidx]);
      }else{
        System.out.println(a[midx]);
      }
    }
  }
}


Measured memory_bytes: 108548
#include <iostream>

using namespace std;

int main() {
	int checker = 0, counter = 0;
	int N = 10;
	cin >> N;
	int* A = new int[N];

	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	while (1) {
		for (int i = 0; i < N; i++) {
			if (A[i] % 2 == 1) {
				checker = 1;
				break;
			}
		}
		if (checker == 0) {
			counter++;
			for (int i = 0; i < N; i++) {
				A[i] = A[i] / 2;
			}
		}
		else {
			break;
		}
	}
	
	cout << counter << 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 n = sc.nextInt();
		int m =  sc.nextInt();
		
		if ( n < m ) {
			for(int i=0;i<m;i++) {
				System.out.print(n);
			}
			System.out.println();
		}else {
			for(int i=0;i<n;i++) {
				System.out.print(m);
			}
			System.out.println();
		}
		
	}
}


Measured memory_bytes: 20692
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
const ll MOD = 1e9;

int main(){
  int n;
  cin>>n;
  double t,a;
  cin>>t>>a;
  int ans;
  double mi=111111;
  for(int i=1;i<=n;i++){
	double h;
	cin>>h;
	double tmp=abs(a-(t-h*0.006));
	if(tmp<mi){
	  mi=tmp;
	  ans=i;
	}
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = []
for _ in range(N):
  A.append(int(input()))
  
A.sort(reverse=True)

if N == 2:
  ans = A[0] - A[1]
#elif N == 3:
#  ans = max( 2*A[0] - A[1] - A[2], A[0] + A[1] - 2*A[2])
elif N % 2 == 0:
  m = N // 2
  ans = 2*sum(A[:m-1]) + A[m-1] - A[m] - 2*sum(A[m+1:])
else:
  m = N // 2
  ans1 = 2*sum(A[:m]) - A[m] - A[m+1] - 2*sum(A[m+2:])
  ans2 = 2*sum(A[:m-1]) + A[m-1] + A[m] - 2*sum(A[m+1:])
  ans = max(ans1,ans2)
print(ans)
    

Measured memory_bytes: 13264
#include <iostream>
#include <limits>
#include <numeric>

constexpr long small_enough = -2000000001;

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

    long skip0 = 0;
    auto skip1 = small_enough;
    auto skip2 = small_enough;

    for (auto i = 1; i <= N; i++) {
        long input;
        std::cin >> input;

        if (i % 2 == 0) {
            skip2 = std::max(skip1, skip2);
            skip1 += input;

        } else {
            skip2 += input;
            skip1 = std::max(skip0, skip1);
            skip0 += input;
        }
    }

    std::cout << std::max(skip1, (N % 2 == 0 ? skip0 : skip2)) << std::endl;

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include<algorithm>
using namespace std;
int n,m,l,ans=0;

int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>m>>l;
        ans+=l-m+1;
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
//noob
#include<bits/stdc++.h>
using namespace std;
#define fori(x) for(int i=0;i<x;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long int 
#define ld long double
#define ull unsigned long long int
#define pi acos(-1)
#define test() int T,t=1;cin>>T;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int(x.size()))
typedef vector<int> vi;
typedef pair<int,int> PI;
const int N = (int)1e6 + 7;

void solve()
{
	string s;cin>>s;cout<<s;
	s[sz(s)-1]=='s'? cout<<"es"<<endl:cout<<"s"<<endl;
}
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	//freopen("input.txt","r",stdin);
	
solve();
	return 0;
}

Measured memory_bytes: 3656
//Radhe Radhe
#include<bits/stdc++.h>
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
using namespace std;

int main()
{
    fast_io
    ll i,t,n,j,inc,ans=0;
    string s;
    cin>>s>>inc;
    for(i=0;i<s.length(); i+=inc)
    {
        cout<<s[i];
    }
        cout<<endl;
    return 0;
}





Measured memory_bytes: 3652
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int func(int a){
    switch (a){
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12:
            return 0;
        case 4:
        case 6:
        case 9:
        case 11:
            return 1;
        default:
            return 2;
    }
}
main(){
    int a,b;
    cin >> a >> b;
    if(func(a)==func(b))cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
a,b,c,n = gets.split(' ').map(&:to_i)
counter = 0
(0..n / a).each do |a_num|
  (0..n / b).each do |b_num|
    c_num = (n - a * a_num - b * b_num) * 1.0 / c
    counter += 1 if c_num >= 0 && (c_num - c_num.to_i) < 0.00001
  end
end
puts counter


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    int N, A, B;
    string S;
    cin >> N >> A >> B >> S;
    int cnt = 0;
    int b = 0;
    rep(i, N) {
        bool flag = false;
        if (S[i] == 'a') {
            if (cnt < A + B) {
                flag = true;
                cnt += 1;
            }
        }
        if (S[i] == 'b') {
            if (cnt < A + B && b < B) {
                flag = true;
                cnt += 1, b += 1;
            }
        }
        if (flag) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3740
N = int(input())
DF = []
for i in range(N):
    S1, SP = input().split()
    DF = DF + [[i+1, S1, int(SP)]]
DF1 = sorted(DF, key=lambda x:x[2], reverse=True)
DF2 = sorted(DF1, key=lambda x:x[1], reverse=False)
for i in range(N):
    print(DF2[i][0])

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

int main(){
  int k;
  cin >> k;
  vector<int> data = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  
  cout << data.at(k-1);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;


//出力======================
void inorder(Node u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}
//==============================
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while (x != NIL)
    {
      y = x; 
      if (z->key < x->key)x = x->left; 
      else x = x->right; 
    }
  z->parent = y;

  if (y == NIL)root=z;
  else if (z->key < y->key)y->left = z; // z を y の左の子にする
  else y->right = z; // z を y の右の子にする
}

Node findkey(int key){
  Node X=root;
  
  while(1)
    {
      if(X==NIL)return NIL;
      if(X->key==key)return X;
      if(X->key < key)X=X->right;
      else X=X->left;
    }
}

Node Successor(Node A){//結果的に Aの右の子　の木の最小　つまり左を探してるだけ
  Node X;
  Node B;
  // if(A->right!=NIL)
  // {
  A=A->right;
  while(A->left!=NIL)A=A->left;
  return A;
  //}
  /*else
    {
    A=A->parent;
    while(1)
    {
    if(A==A->parent->left)return A->parent;
    A=A->parent;
    }
    }*/
}

void delete(Node X){
  Node B;
  Node child;

  if(X->right==NIL && X->left==NIL){///////>< ><//
    if(X->parent->right==X)X->parent->right=NIL;
    else X->parent->left=NIL;
    free(X);
  }
  else if(X->right!=NIL && X->left!=NIL){//o o//ココがおかしい
    B= Successor(X);//右の最も左 0><
    X->key=B->key;
    delete(B);
  }
  else{//o ><
    if(X->right==NIL)child=X->left;
    else child=X->right;
    if(X->parent==NIL){
      child->parent=NIL;
      return ;
    }
    if(X->parent->key < X->key)X->parent->right=child;
    else X->parent->left=child;
    child->parent=X->parent;
    free(X);
  }
}


int main(){
  int n, i, x;
  char com[20];
  int count=0;

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }
    else if (com[0] == 'f'){//FIND
      scanf("%d", &x);
      if(count)printf("\n");
      if(findkey(x)!=NIL)printf("yes\n");
      else printf("no\n");
    }
    else if(com[0] == 'd'){
      scanf("%d", &x);
      delete(findkey(x));

    }
    else if(com[0] == 'p'){//PRINT
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}




Measured memory_bytes: 20456
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1 << 20;
const int INF = INT_MAX;

int r, c;
int w, h;
int seg[8 * MAX_N];

void init()
{
	for (w = 1; w < r; w <<= 1);
	for (h = 1; h < c; h <<= 1);
	fill_n(seg, 8 * MAX_N, INF);
}

void update(int x, int y, int v, int k = 0, int ax = 0, int ay = 0, int bx = w, int by = h, int nxt = 0)
{
	if (x < ax || bx <= x) return;
	if (y < ay || by <= y) return;
	
	if (bx - ax == 1 && by - ay == 1){
		seg[k] = v;
		return;
	}
	
	if (nxt == 0 && bx - ax == 1) nxt = 1;
	else if (nxt == 1 && by - ay == 1) nxt = 0;
	
	if (nxt == 0){
		int m = (ax + bx) / 2;
		update(x, y, v, k * 2 + 1, ax, ay, m, by, nxt ^ 1);
		update(x, y, v, k * 2 + 2, m, ay, bx, by, nxt ^ 1);
	}
	else if (nxt == 1){
		int m = (ay + by) / 2;
		update(x, y, v, k * 2 + 1, ax, ay, bx, m, nxt ^ 1);
		update(x, y, v, k * 2 + 2, ax, m, bx, by, nxt ^ 1);
	}
	
	seg[k] = min(seg[k * 2 + 1], seg[k * 2 + 2]);
	
	//printf("seg[%d] = %d\n", k, seg[k]);
	//printf("%d %d %d %d %d\n", k, ax, ay, bx, by);
}

int getMin(int lx, int ly, int rx, int ry, int k = 0, int ax = 0, int ay = 0, int bx = w, int by = h, int nxt = 0)
{
	if (rx <= ax || bx <= lx) return INF;
	if (ry <= ay || by <= ly) return INF;
	if (lx <= ax && bx <= rx && ly <= ay && by <= ry) return seg[k];
	
	//printf("%d %d %d %d %d\n", k, ax, ay, bx, by);
	
	if (nxt == 0 && bx - ax == 1) nxt = 1;
	else if (nxt == 1 && by - ay == 1) nxt = 0;
	
	int vl, vr;
	if (nxt == 0){
		int m = (ax + bx) / 2;
		vl = getMin(lx, ly, rx, ry, k * 2 + 1, ax, ay, m, by, nxt ^ 1);
		vr = getMin(lx, ly, rx, ry, k * 2 + 2, m, ay, bx, by, nxt ^ 1);
	}
	else if (nxt == 1){
		int m = (ay + by) / 2;
		vl = getMin(lx, ly, rx, ry, k * 2 + 1, ax, ay, bx, m, nxt ^ 1);
		vr = getMin(lx, ly, rx, ry, k * 2 + 2, ax, m, bx, by, nxt ^ 1);
	}
	
	return min(vl, vr);
}

int main()
{
	int q;
	while (scanf("%d %d %d", &r, &c, &q), r|c|q){
		init();
		for (int i = 0; i < r; i++){
			for (int j = 0; j < c; j++){
				int v;
				scanf("%d", &v);
				update(i, j, v);
			}
		}
		while (q--){
			int r1, c1, r2, c2;
			scanf("%d %d %d %d", &r1, &c1, &r2, &c2);
			printf("%d\n", getMin(r1, c1, ++r2, ++c2));
		}
	}
	return 0;
}

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

using namespace std; 

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

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

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

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

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

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

LL modinv(LL a) {
    LL b = MOD, u = 1, v = 0;
    while (b) {
        LL t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

LL moddev(LL a, LL b){
	return a * modinv(b) % MOD;
}

void Main()
{
    int n;cin>>n;

    REP(i,n){
        int a;
        cin>>a;

        if(a%2 == 0){
            if(a%3 != 0 && a%5 != 0){
                cout << "DENIED" << endl;
                return;
            }
        }
    }
    cout << "APPROVED" << endl;

	return;
}

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

Measured memory_bytes: 384
def lscan; gets.split.map(&:to_i); end

n, a, b = lscan

if (b - a).even?
  p (b-a)/2
else
  s = ((a-1)+1)+(b-a-1)/2
  b, a = n-a+1, n-b+1
  t = ((a-1)+1)+(b-a-1)/2
  p [s, t].min
end

Measured memory_bytes: 1788
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define INF 1<<25
 
typedef long long ll;

int dy[8]={1,1,1,0,0,-1,-1,-1};
int dx[8]={-1,0,1,-1,1,-1,0,1};
struct S{
	int a,b,c;
};
bool asc(const S& left,const S& right){
	return left.c > right.c;
}

int v[1001],w[1001],dp[1001][10001];
int N,W;
int dfs(int num,int weight){
	if(dp[num][weight]!=0)
		return dp[num][weight];
	int res;
	if(num==N){
		res=0;
	}
	else if(weight<w[num]){
		res=dfs(num+1,weight);
	}
	else {
		res=max(dfs(num+1,weight),dfs(num+1,weight-w[num])+v[num]);
	}
	return dp[num][weight]=res;
}
int main(){
	cin>>N>>W;
	rep(i,N){
		cin>>v[i]>>w[i];
	}
	cout<<dfs(0,W)<<endl;
	return 0;
}

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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, D, A; cin >> N >> D >> A;
  vector<pair<ll, ll>> xh(N);
  for (ll i = 0; i < N; i++) {
    ll x, h; cin >> x >> h;
    xh.at(i) = make_pair(x, h);
  }
  sort(xh.begin(), xh.end());

  vector<ll> rec(N);
  ll j = 0;
  ll cnt = 0;
  ll eff = 0;
  for (ll i = 0; i < N; i++) {
    for ( ; j < i && xh.at(i).first - xh.at(j).first > 2*D; j++) {
      eff -= rec.at(j);
    }
    ll rem = xh.at(i).second - eff * A;
    ll amt = rem <= 0 ? 0 : (rem + (A-1)) / A;
    rec.at(i) = amt;
    eff += amt;
    cnt += amt;
  }
  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 4992
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    string s, t;
    cin  >> s >> t;

    cout << t << s << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 256
while True:
    s_0 = str(input())
    if s_0 == '-':
        break
    
    n_shuffle = int(input())
    for _ in range(n_shuffle):
        h = int(input())
        s_1 = s_0[:h]
        s_2 = s_0[h:]
        s_0 = s_2 + s_1
    print(s_0)


Measured memory_bytes: 5592
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin >> n;
  vi b(n);
  rep(i,n){
    cin >> b[i];
    if(i-(b[i]-1)<0){
      cout<<-1<<endl;
      return 0;
    }
  }
  vi ans;
  while(sz(b)){
    int x = -1;
    for(int i = sz(b)-1;i>=0;i--){
      if(i+1 == b[i]){
        x = i;
        break;
      }
    }
    if(x == -1){
      cout<<-1<<endl;
      return 0;
    }
    ans.push_back(b[x]);
    b.erase(b.begin()+x);
  }
  reverse(rng(ans));
  for(auto a:ans){
    cout<<a<<endl;
  }
  return 0;
}

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

int main() {
  int N, M, sum, lim;
  cin >> N >> M;
  vector<int> item(N);
  
  for (int i = 0; i < N; i++) {
    cin >> item.at(i);
  }
  //総得票数
  for (int i = 0; i < N; i++) {
    sum += item.at(i);
  }
  
  if (sum%(4*M) == 0) {
    lim = sum/(4*M);
  }
  
  else {
    lim = sum/(4*M) + 1;
  }
  
  
  int count;
  
  for (int i = 0; i < N; i++) {
    if (item.at(i) >= lim) {
      count++;
    }
  }
  
  if (count < M) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

  

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

class Cube{
public:
    int s[6];
    Cube(){}
    void roll_z(){roll(1,2,4,3);}//横回転、時計回り
    void roll_y(){roll(0,2,5,3);}//W
    void roll_x(){roll(0,1,5,4);}//N
    void roll(int i,int j,int k,int l){
        int t=s[i];s[i]=s[j];s[j]=s[k];s[k]=s[l];s[l]=t;
    }
};
bool eq(Cube c1,Cube c2){
    for(int i=0;i<6;i++){
        if(c1.s[i]!=c2.s[i]) return false;
    }
    return true;
}
bool equal(Cube c1,Cube c2){
    for(int i=0;i<6;i++){
        for(int j=0;j<4;j++){
            if(eq(c1,c2)){
                return true;
            }
            c1.roll_z();
        }
        if(i%2==0) c1.roll_y();
        else c1.roll_x();
    }
    return false;
}
Cube c[100];
int n;
bool check(){
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(equal(c[i],c[j])){
                 return false;
            }
        }
    }
    return true;
}
int main() {
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<6;j++){
            cin>>c[i].s[j];
        }
    }
    if(check()) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N, B, ans = 0;
	cin >> N;
	int preb = -1;
	rep(i, 0, N - 1)
	{
		cin >> B;
		if (i == 0)
		{
			ans += B;
		}
		else
		{
			ans += min(preb, B);
		}
		preb = B;
	}
	ans += preb;

	cout << ans << endl;

	return 0;
}

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

int main(){
    int A,B,C,X,Y;
    std::cin >> A >> B >> C >> X >> Y;

    int price = 0;

    bool combo = (A + B) > (C * 2);
    if(combo){
        while(X != 0 && Y != 0){
            --X;
            --Y;
            price += C * 2;
        }
    }

    if(A > 0){
        if( A > C * 2){
            while(X != 0){
                --X;
                --Y; 
                price += C * 2;
            }
        }else{
            while(X != 0){
                --X;
                price += A;
            }
        }
    }

    if(B > 0){
        if( B > C * 2){
            while(Y != 0){
                --X;
                --Y; 
                price += C * 2;
            }
        }else{            
            while(Y != 0){
                --Y;
                price += B;
            }
        }
    }

    std::cout << price;
}

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

int main() {
  string s;
  bool judge = true;
  char a;
  cin >> s;
  a = s.at(0);
  for(int i = 1; i < s.size(); ++i){
    if(a == s.at(i)){
      judge = false;
      cout << "Bad" << endl;
      break;
    }
    a = s.at(i);
  }
  if(judge){
    cout << "Good" << endl;
  }
}


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

char a[30]="CODEFESTIVAL2016",b[30];
int al,cnt;

int main(){
	al=strlen(a); cin>>b;
	for(int i=0;i<al;i++)
		if(a[i]!=b[i])
			cnt++;
	cout<<cnt<<endl;
	return 0;
}

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

void solve(std::istream &ist, std::ostream &ost)
{
    /* ------- 宣言と入力 ------- */

    long long N;
    ist >> N;

    /* ------- 計算 ------- */

    long long ans = 1;
    long long mod = pow(10, 9) + 7;

    // 全て

    for (long long i = 0; i < N; i++)
    {
        ans *= 10;
        if (ans >= mod)
        {
            ans %= mod;
        }
    }

    // 0-8で構成

    long long not_ans = 1;

    for (long long i = 0; i < N; i++)
    {
        not_ans *= 9;
        if (not_ans >= mod)
        {
            not_ans %= mod;
        }
    }

    ans -= not_ans;
    if (ans < 0)
    {
        ans += mod;
    }

    // 1-9で構成

    not_ans = 1;

    for (long long i = 0; i < N; i++)
    {
        not_ans *= 9;
        if (not_ans >= mod)
        {
            not_ans %= mod;
        }
    }

    ans -= not_ans;
    if (ans < 0)
    {
        ans += mod;
    }

    // 1-8で構成を1つ足す

    long long plus_ans = 1;

    for (long long i = 0; i < N; i++)
    {
        plus_ans *= 8;
        if (plus_ans >= mod)
        {
            plus_ans %= mod;
        }
    }

    ans += plus_ans;
    if (ans >= mod)
    {
        ans %= mod;
    }

    ost << ans << endl;
}

#ifndef WOMAIN
int main()
{
    solve(std::cin, std::cout);
    return 0;
}
#endif


Measured memory_bytes: 3504
#include<stdio.h>
#include<string.h>
int main()
{
    int i,x,z;
    char a[101];char y;
    gets(a);

    strlen(a);
    x=strlen(a)-2;
    y=a[strlen(a)-1];

    printf("%c%d%c\n",a[0],x,y);

    return 0;

}


Measured memory_bytes: 128
# https://atcoder.jp/contests/agc023/tasks/agc023_a

from collections import Counter
n = int(input())
nums = [0] + [int(i) for i in input().split()]

def nC2(n):
    return n * (n - 1) // 2

for i in range(n):
    nums[i + 1] += nums[i]
c = Counter(nums)
ans = 0
for v in c.values():
    ans += nC2(v)
print(ans)


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

using namespace std;

int main() {

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

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


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

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


int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }

    map<int,int> three;
    rep(i, n) {
        three[a[i]] = 0;
    }

    // 最大で3セットまでしかありえない
    if(three.size() > 3) {
        cout << "No" << endl;
        return 0;
    }

    // 出現回数を加算
    rep(i, n) {
        three[a[i]]++;
    }

    // 一般的なパターン
    if(three.size() == 3) {
        // 3の倍数以外はNG
        if(n % 3 != 0) {
            cout << "No" << endl;
            return 0;
        }
        // 3つの数のパターンの場合は、0が含まれる場合はNG
        bool check = false;
        for(auto itr = three.begin(); itr != three.end(); ++itr) {
            if(itr->first == 0) check = true;
        }
        if(check) {
            cout << "No" << endl;
            return 0;
        }

        // 排他的論理和が作られるかチェック
        vector<int> nums;
        for(auto itr = three.begin(); itr != three.end(); ++itr) {
            nums.push_back(itr->first);
        }

        if((nums[0] ^ nums[1]) != nums[2] ||
                (nums[1] ^ nums[2]) != nums[0] ||
                (nums[0] ^ nums[2]) != nums[1]) {
            cout << "No" << endl;
            return 0;
        }


        for(auto itr = three.begin(); itr != three.end(); ++itr) {
            if(itr->second != (n / 3)) {
                cout << "No" << endl;
                return 0;
            }
        }
    } else if(three.size() == 2) {
        // 0ともう一つの数のパターン
        // 3の倍数以外はNG
        if(n % 3 != 0) {
            cout << "No" << endl;
            return 0;
        }

        // 0以外の組み合わせの場合はNG
        bool check = false;
        for(auto itr = three.begin(); itr != three.end(); ++itr) {
            if(itr->first == 0) check = true;
        }
        if(!check) {
            cout << "No" << endl;
            return 0;
        }

        for(auto itr = three.begin(); itr != three.end(); ++itr) {
            if(itr->first == 0) if(itr->second != (n/3)) {
                cout << "No" << endl;
                return 0;
            }
            if(itr->first != 0) if(itr->second != ((n/3) * 2)) {
                cout << "No" << endl;
                return 0;
            }
        }
    } else {
        // 1つのみの場合は0の場合だけおk
        for(auto itr = three.begin(); itr != three.end(); ++itr) {
            if(itr->first != 0) {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    return 0;

}

/**

7
13 7 10 10 7 10 9

6
13 7 10 10 7 13

6
5 7 10 10 7 5

6
13 7 10 10 7 9

9
9 9 0 9 9 0 0 9 9

6
1 1 1 1 1 0

6
1 1 1 1 0 0

5
0 0 0 0 0

3
1 1 1

3
1 2 1

3
1 2 0

3
1 2 3


 */


Measured memory_bytes: 4224
#include <stdio.h>

#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, m[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int);
void dfs();

int main() {

  int i, j, u, k, v;

  scanf("%d", &n);

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

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

  for( i=0; i<n; i++ ) {
    scanf("%d %d", &u, &k);
    u--;
    for( j=0; j<k; j++) {
      scanf("%d", &v);
      v--;
      m[u][v] = 1;
    }
  }

  dfs();

  return 0;
}

void dfs_visit(int u) {

  int v;

  color[u] = GRAY;
  d[u] = ++tt;

  for( v=0; v<n; v++) {
    if( m[u][v] == 0 ) {
      continue;
    }
    if( color[v] == WHITE) {
      dfs_visit(v);
    }
  }
  color[u] = BLACK;
  f[u] = ++tt;
}


void dfs() {
  
  int u;
  
  for( u=0; u<n; u++) {
    color[u] = WHITE;
  }
  tt = 0;
  
  for( u=0; u<n; u++) {
    if( color[u] == WHITE )
      dfs_visit(u);
  }
    
  for( u=0; u<n; u++) {
    printf("%d %d %d\n", u+1, d[u], f[u]);
  }
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    ll a;
    double b;
    cin>>a>>b;
    ll bb=b*100+0.1;
    ll ans=a*bb;
    cout<<ans/100;
}

Measured memory_bytes: 3724
#define X first
#define Y second
#include<bits/stdc++.h>
using namespace std;
typedef pair <int, int > ii;
using ll = long long;
const int MAX=(1<<19),inf=0x3f3f3f3f,mod=1e9+7;

int dp[MAX];
ii a[MAX];
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("bao.inp","r",stdin);
    //freopen("ESCAPE.out","w",stdout);
    int n,x;
    cin>>n>>x;
    int M=(1<<n);
    a[0]=ii(x,0);
    dp[0]=x;
    for(int i=1;i<M;i++){
        cin>>x;
        dp[i]=dp[i-1];
        for(int j=0;j<n;j++)if(i&(1<<j)){
            //cout<<i<<' '<<(i^(1<<j))<<'\n';
            a[i]=max(a[i],a[i^(1<<j)]);
            dp[i]=max(dp[i],dp[i^(1<<j)]);
        }
        dp[i]=max(dp[i],a[i].X+x);
        for(int j=0;j<n;j++)if(a[i].Y&(1<<j)){
            dp[i]=max(dp[i],a[i^(1<<j)].X+a[i].X);
        }
        cout<<dp[i]<<'\n';
        a[i]=max(a[i],ii(x,i));
    }
}


Measured memory_bytes: 6744
#include "bits/stdc++.h"
using namespace std;

int main() {
    int A, B, C, K;
    cin >> A >> B >> C >> K;

    int ma = max(max(A, B), C);
    int ans = A + B + C - ma;
    for (int i = 0; i < K; i++) {
        ma *= 2;
    }
    ans += ma;
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# coding: utf-8
# import sys
# import pprint
# import numpy as np
# import code
import functools

if __debug__:
    debug = lambda *x: None
else:
    import logging
    logger = logging.getLogger()
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(logging.DEBUG)
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    ch.setFormatter(formatter)
    logger.addHandler(ch)
    debug = logger.debug

k, n, *a = (int(x) for x in input().split())
a = [int(x) for x in input().split()]

debug(k)
debug(n)
debug(a)

aa = a.copy()
aa.pop(0)
aa.append(k + a[0])
debug(aa)
# r = functools.reduce(lambda )

d = [y - x for x, y in zip(a,aa)]
debug(d)
d.sort()
debug(d)
d.pop()
debug(d)
print(sum(d))


Measured memory_bytes: 26940