akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? " " : "");
    outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? "\n" : "");
    outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
    cout << head;
    outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(size_t, N);

    var(string, s, t);

    string res = "";
    rep(i, N) {
        res += s[i];
        res += t[i];
    }

    outl(res);

    return 0;
}


Measured memory_bytes: 256
open System
open System.Text;
open System.Linq
open System.Collections.Generic

[<EntryPoint>]
let main _ = 
    let ab = Console.ReadLine().Split() |> Array.map int
    Console.WriteLine(if (ab.[0] * ab.[1]) % 2 = 0 then  "Even" else "Odd")
    0


Measured memory_bytes: 19204
#include <iostream>
using namespace std;
 
int main() {

  int n;
  cin >> n;
  string s;

  bool three = true;

  for(int i = 0; i<n;i++){
    cin >> s;
    if (s == "Y") three = false;
  }

  if(three) cout << "Three";
  else cout << "Four";

}

Measured memory_bytes: 256
A, B = list(map(int, input().split()))
if A == 1:
    if B == 1:
        print("Draw")
    else:
        print("Alice")
elif B == 1:
    print("Bob")
else:
    if A > B:
        print("Alice")
    elif A == B:
        print("Draw")
    else:
        print("Bob")


Measured memory_bytes: 3060
a, b = (int(i) for i in input().split())
#0??¨0?????\??????????????´????????????????????????
while a != 0 or b != 0:
    count = 0
    #i?????????????????°???
    for i in range(1, a-1):
        #j?????????????????°???
        for j in range(i+1 , a):
            #k?????????????????°???
            for k in range(i+2, a+1):
                #??????????????´???????????????????????????
                if i + j + k == b and i < j < k:
                    count += 1
    print("{0}".format(count))
    a, b = (int(i) for i in input().split())

Measured memory_bytes: 7636
#include <stdio.h>

int main()
{
	char s[4];
  	scanf("%s", s);
  	int n = 0;
  
  	for(int i = 0; i < 4; i++){
    	if (s[i] == '+'){
        	n++;
        } else {
        	n--;
        }
    }
  	printf("%d", n);
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<deque>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<map>
#include<stack>
#include<set>
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const int maxn =1000100;
typedef pair<ll,ll>p1;
typedef pair<pair<ll,ll>,ll>p2;
map<pair<pair<ll,ll>,ll>,ll>m1;
map<pair<ll,ll>,ll>m2;
const int MOD = 1e9;
const int N=351;
const int inf = 0x3f3f3f3f;
typedef pair<char, int> PAIR;
map<string,int>mm;
ll a[maxn];
ll dp[maxn];
int main()
{
    ll n,k;
    scanf("%lld %lld",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
    }
    dp[0] = 0;
    dp[1] = 0;
    for(int i=2;i<=n;i++)
    {
        dp[i] = inf;
    }
    for(ll i=2;i<=n;i++)
    {
        for(ll j=i-1;j>=max(1ll,i-k);j--)
        {
            dp[i] = min(dp[j]+abs(a[j]-a[i]),dp[i]);
        }
    }
    cout<<dp[n]<<endl;
}

Measured memory_bytes: 5264
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second
 
int main(int argc, char **argv) {
	int x, y, z;
	cin >> x >> y >> z;
	cout << ((x - z) / (y + z)) << endl;
	return 0;
}
 

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
long long int n;
  long long int i;
  scanf("%lld",&n);
  printf("%lld:",n);
  
  for(i=2;i*i<=n;i++){
    while(n%i==0){
      printf(" %lld",i);
      n=n/i;
    }
  }
  if(n!=1)printf(" %lld",n);
  printf("\n");
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
const int INF=1<<29,MAX=600001;
struct P {int x,y,z;}b[15];

int D(P p, P q) {return abs(p.x-q.x)+abs(p.y-q.y)+abs(p.z-q.z);}

int d[MAX];
int main() {
  int n,m;
  cin >> n >> m;
  int a[n],e[2]={0,0};
  for(int i=0; i<n; i++) cin >> a[i];
  sort(a,a+n);
  for(int i=0; i<MAX; i++) d[i]=(i?INF:0);
  for(int i=0; i<n; i++) {
    e[(a[i]+1)%2]=a[i];
    d[a[i]]=1;
    for(int j=a[i]-e[a[i]%2]; j<=a[i]+e[a[i]%2]; j+=2) d[j]=min(d[j],2);
  }
  for(int i=0; i<=a[n-1]*2; i+=2) d[i]=min(d[i],2);
  for(int i=0; i<MAX; i++) d[i]=min(d[i],min(d[abs(i-e[0])],d[abs(i-e[1])])+1);
  for(int i=0; i<m; i++) cin >> b[i].x >> b[i].y >> b[i].z;
  int w[m][m],dp[1<<m][m],ans=INF;
  for(int i=0; i<m; i++) {
    for(int j=0; j<m; j++) w[i][j]=d[D(b[i],b[j])];
  }
  fill(dp[0],dp[1<<m],INF);
  for(int i=0; i<m; i++) dp[1<<i][i]=d[D((P){0,0,0},b[i])];
  for(int t=1; t<(1<<m); t++) {
    for(int i=0; i<m; i++) {
      for(int j=0; j<m; j++) dp[t|(1<<j)][j]=min(dp[t|(1<<j)][j],dp[t][i]+w[i][j]);
    }
  }
  for(int i=0; i<m; i++) ans=min(ans,dp[(1<<m)-1][i]);
  cout << (ans<INF?ans:-1) << endl;
  return 0;
}



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

using namespace std;

int main()
{
    int n,b,a;
    scanf("%d%d%d",&n,&a,&b);
    if (abs(a-b) % 2 == 0 )
    {
        printf("Alice");
    }
    else
    {
        printf("Borys");
    }
}


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

int main() {
  int D, G;
  cin >> D >> G;
  vector<int> p(D), c(D);
  for (int i = 0; i < D; i++)
    cin >> p[i] >> c[i];

  int mn = INT_MAX;
  for (int i = 0; i < (1 << D); i++) {
    int sum = 0;
    int cnt = 0;

    for (int j = 0; j < D; j++) {
      if ((1 << j) & i) {
        sum += p[j] * 100 * (j + 1) + c[j];
        cnt += p[j];
      }
    }
    if (sum >= G) {
      mn = min(mn, cnt);
      continue;
    } else {
      for (int j = D - 1; j >= 0; j--) {
        if ((1 << j) & i) continue;
        for (int z = 0; z < p[j]; z++) {
          if (sum >= G) break;
          sum += (100 * (j + 1));
          cnt++;
        }
      }
      mn = min(mn, cnt);
    }
  }
  cout << mn << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#define maxn 2005
#define mod 1000000007
#define ll long long
using namespace std;
int dp[maxn][maxn],n,m,fac[maxn*maxn],inv[maxn*maxn];//dp[i][j]表示放了i个白球,其中j种颜色的球已经放完了
int c(int n,int m){return (ll)fac[n]*inv[m]%mod*inv[n-m]%mod;}
int main()
{
	cin>>n>>m;dp[0][0]=1;
	if(m==1){cout<<1<<endl;return 0;}
	fac[0]=1;inv[0]=inv[1]=1;
	for(int i=1;i<=n*m;i++)fac[i]=(ll)fac[i-1]*i%mod;
	for(int i=2;i<=n*m;i++)inv[i]=(mod-(ll)(mod/i)*inv[mod%i]%mod)%mod;
	for(int i=2;i<=n*m;i++)inv[i]=(ll)inv[i]*inv[i-1]%mod;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=i;j++)
		{
			dp[i][j]=dp[i-1][j];
			if(j)(dp[i][j]+=(ll)dp[i][j-1]*c(n*m-i-(j-1)*(m-1)-1,m-2)%mod)%=mod;
		}
	}
	cout<<((ll)dp[n][n]*fac[n]%mod+mod)%mod;
	return 0;
}


Measured memory_bytes: 47360
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  string S;
  cin >> S;
  int ans = 1;
  for (int i = 1; i < (int)S.size(); ++i) {
    if (S[i - 1] != S[i]) {
      ans++;
    }
  }
  cout << ans - 1 << endl;
  return 0;
}


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

int main() {
  int n,mod=86400,d[mod];
  memset(d,0,sizeof(d));
  cin >> n;
  int t=0;
  for(int i=0; i<n; i++) {
    int a,b;
    cin >> a >> b;
    t+=a;
    t%=mod;
    d[t]++;
    t+=b;
    t%=mod;
  }
  int cnt=0;
  for(int i=0; i<=10800; i++) cnt+=d[i];
  int ans=cnt;
  for(int i=1; i<mod; i++) {
    cnt-=d[i-1];
    cnt+=d[(i+10800)%mod];
    ans=max(ans,cnt);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		sc.close();
		boolean ok1 = S[2] == S[3];
		boolean ok2 = S[4] == S[5];
		System.out.println(ok1 && ok2 ? "Yes" : "No");
	}
}


Measured memory_bytes: 22732
require "set"
n,m = gets.chomp.split(" ").map(&:to_i)
ps_arr = m.times.map{
  arr = gets.chomp.split(" ")
  [arr[0].to_i, arr[1]]
}

hash = {}
set = Set.new
ac_count = 0
wa_count = 0
ps_arr.each do |(p, s)|
  if set.include?(p) then
    next
  elsif s == "AC" then
    wa_count += hash[p].to_i
    ac_count += 1
    set << p
  else
    hash[p] ||= 0
    hash[p] += 1
  end
end

puts "#{ac_count} #{wa_count}"


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

int main()
{
    int n;
    int i, count = 0;
    
    cin >> n;
    
    int a[n];
    
    for(i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i] % 2 == 1) {
            count++;
        }
    }
    
    if(count % 2 == 0) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }
    
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

const string NO = "IMPOSSIBLE";

void solve(long long A, long long B)
{
    if ((A + B) % 2 != 0)
    {
        cout << NO << endl;
    }
    else
    {
        cout << (A + B) / 2 << endl;
    }
}

int main()
{
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    solve(A, B);
    return 0;
}


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

int64_t beki(int64_t n,int64_t x){
 int64_t s,ans;
  s=(n*n)%1000000007;
  ans=(s*n)%1000000007;
  return ans;}

int main() {
int64_t n,k,a;
  a=0;
  n=3;
  cin>>k;
  vector<int64_t> ans(k);
  ans.at(k-1)=1;
  for(int64_t i=k-2;i>=0;i--){
  ans.at(i)=beki(k/(i+1),3);
    for(int64_t j=1;(i+1)*j<=k;j++){
    ans.at(i)=ans.at(i)-ans.at((i+1)*j-1);
     }
    ans.at(i)=ans.at(i)+beki(k/(i+1),3);
  }
  for(int64_t i=0;i<k;i++){a=a+(i+1)*ans.at(i);
  while(a>=1000000007){a=a-1000000007;}}
  cout<<a<<endl;
}  


Measured memory_bytes: 3536
D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
1 < (I=(0..25).select{C[_1]==0}).size and S.each {|s;z|
  I.each {|i| if i!=(z||=i); s[z]<s[i] ? z = i+s[z]=0 : s[i]=0 end }
}
L,M,N = [-1]*27,8,4
def calc(d,n)
  s,x = S[d],0
  n = D-d  if n > D-d
  t = (0..25).map {s[_1] > 0 ? C[_1]*(d-L[_1])*n+s[_1] : 0}
  i = (0..25).max_by(M){t[_1]}.max_by {|i|
    0 == (c=t[i])*(n-1) and next c
    l,L[i] = L[i],d
    c += calc(d+1,n-1) >> 5
    L[i] = l
    x < c ? x=c : c
  }
  ((x>0 ? x : t[i]) << 5) + i
end
D.times { p 1 + i=calc(_1,N)&31; L[i]=_1 }

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

int main(){
  vector<vector<int>> A(3,vector<int> (3));
  for(int i=0;i<3;i++) for(int j=0;j<3;j++) cin >> A.at(i).at(j);
  int N,b;
  cin >> N;

  for(int i=0;i<N;i++){
    cin >> b;
    for(int j=0;j<3;j++) for(int k=0;k<3;k++) if(b==A.at(j).at(k)) A.at(j).at(k) = 0;    
  }

  int sum_cross = A.at(0).at(0) + A.at(1).at(1) + A.at(2).at(2);
  int sum_cross_rev = A.at(0).at(2) + A.at(1).at(1) + A.at(2).at(0);
  for(int i=0;i<3;i++){
    int sum_row = 0;
    int sum_col = 0;
    for(int j=0;j<3;j++){
//      cout << A.at(i).at(j) << endl;
      sum_row += A.at(i).at(j);
      sum_col += A.at(j).at(i);
    }
//    cout << sum_row << " : " << sum_col << " : " << sum_cross << endl;
    if(sum_row == 0 || sum_col == 0 || sum_cross == 0 || sum_cross_rev == 0){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3656
n,a,b=map(int,input().split())
mod=10**9+7

ans=pow(2,n,mod) - 1

def c(n, r):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

ans -= c(n,a)
ans -= c(n,b)
print(ans % mod)

Measured memory_bytes: 3064
<?php namespace Track;

function main($lines) {
  foreach ($lines as $index=>$value) {
    // printf("line[%s]: %s\n", $index, $value);
    // var_dump($value);
    if($value[0] == "-1" && $value[1] == "-1" && $value[2] == "-1"){
        break;
    }
    if($value[0] + $value[1] >= 80){
        echo "A".PHP_EOL;
    }elseif($value[0] + $value[1] >= 65 && $value[0] + $value[1] < 80){
        echo "B".PHP_EOL;
    }elseif($value[0] + $value[1] >= 50 && $value[0] + $value[1] < 65){
        echo "C".PHP_EOL;
    }elseif($value[0] + $value[1] >= 30 && $value[0] + $value[1] < 50 && $value[0] != "-1" && $value[1] != "-1"){
        if($value[2] >= 50){
            echo "C".PHP_EOL;
        }else{
            echo "D".PHP_EOL;
        }
    }else{
        echo "F".PHP_EOL;
    }
  }
}

$array = array();
while (true) {
  $stdin = fgets(STDIN);
  if ($stdin == "") {
    break;
  }
  $array[] = explode(" ",rtrim($stdin));
}
main($array);


Measured memory_bytes: 9360
#include <iostream>

using namespace std;
int main(){
    char b;

    string res;

    cin >> b;

    if(b == 'A' ) res = "T";
    else if(b == 'C')res = "G";
    else if(b == 'G')res = "C";
    else res = "A";

    cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int main(){
    int n; cin>>n;
    bool alleven=true;
    for(int i=0; i<n; i++){
        int a; cin>>a;
        if(a%2==1) alleven=false;
    }

    if(alleven) cout << "second" << endl;
    else cout << "first" << endl;
}

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

int main(){
  int n, a;
  int sum = 1, odd = 1;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a;
    sum *= 3;
    if(a % 2 == 0) odd *= 2;
  }
  cout << sum - odd << endl;
  return 0;
}


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

char b[17] = "CODEFESTIVAL2016";
int cnt;

int main(){
    char a[17]; scanf("%s", a);
    for(int i = 0; i < 16; i++) if(a[i] != b[i]) cnt++;
    printf("%d\n", cnt);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
  int	len;
  char	s[100000+1]={0};
  scanf("%s",s);
  len = strlen(s);
  
  for(int i=0; i<len; i=i+2){
    printf("%c", s[i]);
  }
  return 0;
}

Measured memory_bytes: 1720
from math import factorial as fact
import math
import sys
import itertools
import numpy as np
from collections import Counter
import datetime


#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(range(n),r))



def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def factorization(n):
	tmp=n
	count=0
	for i in range(2,int(n**0.5)+2):
		if tmp%i==0:
			cnt=0
			while tmp%i==0:
				cnt+=1
				tmp//=i
			count+=1
	if tmp!=1:
		count+=1

	return count
			




N=input1()
A=input_array()
B=input_array()
C=input_array()
result=0
before=0
for i in range(N):
	result+=B[A[i]-1]
	if (before+1==A[i]) and before!=0:
		result+=C[A[i]-2]
	before=A[i]

print(result)






Measured memory_bytes: 12476
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];

	for (int j = 0; j < n-1; ++j)
			cout << a[j] << " ";
		cout << a[n-1] << endl;


	for (int i = 1; i < n; ++i)
	{
		int at = a[i];
		//atが初めてa[j]より大きくなんなかったときはa[dai]が最大
		int dai = i;

		//atの置き場所を考える
		for (int j = 0; j <= i-1; ++j)
		{
			//a[i]が初めてatより大きくなったとき
			if(at < a[j])
			{
				dai = j;
				break;
			}
		}
		//実際に配列に割り込んでatを置く
		for (int j = i; j > dai; --j)
			a[j] = a[j-1];
		a[dai] = at;
		for (int j = 0; j < n-1; ++j)
			cout << a[j] << " ";
		cout << a[n-1] << endl;
	}

	return 0;
}


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

/*https://github.com/kurokoji/.cpp-Template/wiki#struct-fast*/
//理解できていないものはコメントアウト
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* short */
//#define pb push_back
//#define eb emplace_back
//#define mp make_pair
//#define Fi first
//#define Se second
#define ALL(v) begin(v), end(v) // sort(ALL(v));みたいに使う
//#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
//#define EACH(i, n) for (auto&& i : n)

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
//using pii = pair<int, int>;
using D = double;
//using P = complex<D>;
using vs = vector<string>;
//template <typename T> using PQ = priority_queue<T>;
//template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
//const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 }, dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };

/* func */
inline bool inside(int y, int x, int H, int W) { return y >= 0 && x >= 0 && y < H && x < W; }
inline int in() { int x; cin >> x; return x; }
//inline vs split(const string& t, char c) { vs v; stringstream s(t); string b; while (getline(s, b, c)) v.eb(b); return v; }
//template <typename T> inline bool chmin(T& a, const T& b) { if (a > b) a = b; return a > b; }
//template <typename T> inline bool chmax(T& a, const T& b) { if (a < b) a = b; return a < b; }
//template <typename T, typename S> inline void print(const pair<T, S>& p) { cout << p.first << " " << p.second << endl; }
template <typename T> inline void print(const T& x) { cout << x << '\n'; }
//template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) { for (auto&& p : v) print(p); }
//template <typename T> inline void print(const vector<T>& v, string s = " ") { REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n"); }


//#define int long long

signed main() {
	int N, M, C;

	cin >> N >> M >> C;

	vi B;
	vvi A;

	B = vector<int>(M, 0);
	A = vector<vector<int>>(N, vector<int>(M, 0));

	for (int i = 0; i < M; ++i) B[i] = in();
	for (int j = 0; j < N; ++j) for (int k = 0; k < M; ++k) A[j][k] = in();

	int ans = 0;

	for (int j = 0; j < N; ++j) {
		ll sum = 0;

		for (int k = 0; k < M; ++k) sum += A[j][k] * B[k];

		if (sum + C > 0) ans++;
	}

	cout << ans << endl;

	#ifdef _DEBUG
		system("pause");
	#endif
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <set>

using namespace std;

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

  set<int> s;
  
  for(int i=A; i<A+K; i++)
    if(A <= i && i <= B)
      s.insert(i);
  for(int i=B-K+1; i<=B; i++)
    if(A <= i && i <= B)
       s.insert(i);

  for(auto a : s)
    cout << a << endl;
  
  return 0;
}


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

int main() {
   vector<int> a(3);
   rep(i, 3) {
      cin >> a[i];
   }
   
    sort(a.begin(), a.end());

    cout << a[0] + a[1] << endl;
}

Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#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++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    vector<int> a(n + 2);
    a[0] = inf, a[n + 1] = -inf;
    rep(i, n) {
        cin >> a[i + 1];
    }
    int ans = 1000LL, cur = 0;
    for(int i = 1; i <= n; ++ i) {
        if(a[i - 1] >= a[i] && a[i] <= a[i + 1]) {
            cur += ans / a[i];
            ans -= a[i] * (ans / a[i]);
        }
        if(a[i - 1] <= a[i] && a[i] >= a[i + 1]) {
            ans += cur * a[i];
            cur = 0;
        }
        //cerr << ans << " " << cur << endl;
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3612
var obj = init();
Main();
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");}
function init(){
  var inputFile = myin();
  var returnObj = {
    "list" : inputFile, "index" : 0, "max" : inputFile.length,
    "hasNext" : function(){return (this.index < this.max);},
    "next" : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
	var N = one[0];
	var M = one[1];
	var list = nextIntArray();
	var sum = 0;
	for(var i = 0; i < M; i++){
		sum += list[i];
	}
	if(N < sum){
		myout(-1);
	}else{
		myout(N - sum);
	}
}

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


int main(){
    string S;
    ll ans = 0;
    ll cnt_B = 0;
    cin >> S;

    for(ll i = 0; i < S.size(); i++){
        if(S[i] == 'B') cnt_B++;
        if(S[i] == 'W') ans += cnt_B; 
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
X = int(input())


# 素数判定の関数
def check(n):
  ans = True
  for i in range(2,int(n**0.5)):
    if n % i == 0:
      ans = False
      break

  return ans


flg = True
cnt = 0
while flg:
  _ = X+cnt
  ck = check(_)
  if ck:
    flg = False
    ans = _
  
  cnt += 1

print(ans)  

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >>a>>b;
  int n=0;
  if(a<b){
    for(int i=0;i<b;i++){
      n+=a*pow(10,i);
    }
    cout<<n<<endl;
  }else{
    for(int i=0;i<a;i++){
      n+=b*pow(10,i);
    }
    cout<<n<<endl;
  }
}

Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {
  var x, a, b int;
  fmt.Scan(&x, &a, &b)
  y := -a + b
  var ans string
  if y <= 0 {
    ans = "delicious"
  } else if y <= x {
    ans = "safe"
  } else {
    ans = "dangerous"
  }
  fmt.Println(ans)
}

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

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector <int> A(n+1);
  for(int i=0; i<n; i++) {
    cin >> A[i+1];
  }
  for(int i=1; i<=n; i++) {
    A[i] += A[i-1];
    A[i] %= m;
  }
  map <int, int> X;
  for(int i=0; i<=n; i++) {
    X[A[i]]++;
  }
  long long res = 0;
  for(auto ele : X) {
    cerr << ele.second << "\n";
    res +=1LL *  ele.second * (ele.second-1) / 2;
  }
  cout << res << "\n";
}


Measured memory_bytes: 3584
def main():
    while 1:
        try:
            p = [float(x) for x in input().split()]
            x = (p[4]*p[2]-p[1]*p[5])/(p[0]*p[4]-p[1]*p[3])
            y = (p[2]-p[0]*x)/p[1]
        except:
            break
        if abs(x)<1e-4:
            x=0.0
        if abs(y)<1e-4:
            y=0.0
        print("{:.3f} {:.3f}".format(x,y))

main()


Measured memory_bytes: 5588
N = gets.to_i
h = {}
gets.split.each do |a|
    a = a.to_i
    if h.has_key?(a) then
        h[a] += 1
    else
        h[a] = 1
    end
end
h = h.select{|k,v| v>= 2}
if h.count < 2 then
    puts '0'
    exit
end
h = h.sort
if h[-1][1] >= 4 then
    puts h[-1][0] * h[-1][0]
else
    puts h[-1][0] * h[-2][0]
end

Measured memory_bytes: 16452
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int n, t[101], v[101];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> t[i];
	for (int i = 0; i < n; i++)
		cin >> v[i];
	t[n] = 1, v[n] = 0;
	int x = 1, s = 0, d = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < t[i] * 2; j++, x++) {
			int m = 10000;
			for (int k = 0, T = 0; k <= n; T += t[k++]) {
				int l = k == i ? v[k] * 2 : k < i ? v[k] * 2 + x - T * 2 - t[k] * 2 : v[k] * 2 - x + T * 2;
				if (l < m) m = l;
			}
			if (m == s)
				d += s * 2;
			else if (m < s)
				d += s * 2 - 1, s--;
			else
				d += s * 2 + 1, s++;
		}
	}
	//cout << double(d) / 8 << endl;
	printf("%f\n", double(d) / 8);
	return 0;
}


Measured memory_bytes: 256
mat = [list(map(int,input().split())) for i in range(3)]
mat = mat[0]+mat[1]+mat[2]

n = int(input())
for _ in range(n):
  m = int(input())
  for i in range(9):
    if mat[i] == m:
      mat[i] = 1000

if sum(mat[:3])>=3000:
  print("Yes")
elif sum(mat[3:6])>=3000:
  print("Yes")
elif sum(mat[6:])>=3000:
  print("Yes")
elif sum(mat[::3])>=3000:
  print("Yes")
elif sum(mat[1::3])>=3000:
  print("Yes")
elif sum(mat[2::3])>=3000:
  print("Yes")
elif sum(mat[::4])>=3000:
  print("Yes")
elif sum(mat[2:7:2])>=3000:
  print("Yes")
else:
  print("No")



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mt make_tuple
typedef long long int ll;

using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;


typedef long long int ll;


static ll n, a[214514], s[214514];

int main(void){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
		s[i+1] = s[i] + a[i];
	}
	sort(&s[0], &s[n+1]);
	ll ans = 0, cnt = 0;
	for(int i=0;i<=n;i++){
		if (i==n || s[i]!=s[i+1]){
			cnt++;
			ans += cnt * (cnt-1) / 2;
			cnt = 0;
		}else{
			cnt++;
		}
	}
	cout << ans << endl;



		

	return 0;
}


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

int main() {
    int n,i,m;
    cin>>n;
    long t[n],sum=0;
    for(i=0;i<n;i++){ 
        cin>>t[i];
        sum+=t[i];
    }
    cin>>m;
    int p[m]; long x[m];
    for(i=0;i<m;i++) cin>>p[i]>>x[i];
    for(i=0;i<m;i++)
        cout<<sum-t[p[i]-1]+x[i]<<'\n';
}

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

using namespace std;

#define LL long long
#define MOD 1000000007



int main() {
	int r;
	cin >> r;
	cout << 3 * r*r << endl;

	return 0;
}

Measured memory_bytes: 256
c = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]
n = int(input())
for i in range(n):
    b,f,r,v=map(int,input().split())
    c[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        print(' '+' '.join(map(str,c[i][j])))
    if i < 3:
        print('#'*20)


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

int main() {
	long long	a,b,c,i,j,k,n,m,x,y,h,w;
	long long  ans = 1;
	string	str;
	
	cin >> h >> w;
	
	if ( ( h > 1 ) && ( w > 1 ) ) {
		ans  = ((w+1)/2) * ((h+1)/2);
		ans += (w/2) * (h/2);
	}
	cout << ans << endl;


}


Measured memory_bytes: 256
// g++ -I ~/Documents/programming/cppLib -std=gnu++14 -o test ~/Documents/programming/cppLib/test.cpp && ./test && rm test
#include <bits/stdc++.h>
using namespace std;
template <typename T> using vector2 = vector <vector  <T>>;
template <typename T> using vector3 = vector <vector2 <T>>;
template <typename T> using vector4 = vector <vector3 <T>>;
using lint = long long;
#define FOR( i, a, b ) for( lint i=(a) ; i < (b) ; ++i )
#define REP( i, n )    for( lint i= 0  ; i < (n) ; ++i )
#define ALL( v )       (v).begin(), (v).end()

//	cinからvectorへ入力
template<typename T>
istream& operator >> ( istream& is, vector<T>& vec ) {
    for( T& x: vec ) {
        is >> x;
    }
    return is;
}

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

    string S;
    cin >> S;

    int W = 0, E = count( ALL(S), 'E' );

    if( S[0] == 'E' ) { E --; }
    int min = E;

    FOR( i, 1, N ) {
        if( S[i-1] == 'W' ) {
            W ++;
        }
        if( S[i]   == 'E' ) {
            E --;
        }

        if( W + E < min ) {
            min = W + E;
        }
    }

    cout << min << endl;
}


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

#define INF 1e9


int main(){
  int N, K;
  cin >> N >> K;
  vector<double> p(N);
  vector<double> kitai(N, 0);
  REP(i, N){
    cin >> p[i];
    kitai[i] = p[i]*(p[i]+1)/2;
    kitai[i]/= p[i];
  }
  double sum = 0;
  REP(i, K){
    sum += kitai[i];
  }
  double ans = sum;
  FOR(i, K, N){
    sum -= kitai[i-K];
    sum += kitai[i];
    ans = max(sum, ans);
  }
  printf("%.9f\n", ans);
  return 0;
}


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

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int dp[2][110];

int main() {
    int n;
    cin >> n;
    vi a[2];
    rep(i, n) {
        int b;
        cin >> b;
        a[0].pb(b);
    }
    rep(i, n) {
        int b;
        cin >> b;
        a[1].pb(b);
    }

    dp[0][0] = a[0][0];
    int dx[2] = {0, 1};
    int dy[2] = {1, 0};
    auto isOutOfRange = [](int h, int w, int H, int W) {
        return h < 0 || h >= H || w < 0 || w >= W;
    };
    
    rep(i, n) {
        rep(j, 2) {
            rep(k, 2) {
                int nx = i + dx[k];
                int ny = j + dy[k];
                if(isOutOfRange(ny, nx, 2, n)) continue;
                dp[ny][nx] = max(dp[ny][nx], dp[j][i] + a[ny][nx]);
            }
        }
    }
    cout << dp[1][n-1] << endl;
    return 0;
}

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

typedef long long ll;

const ll mod = 1000*1000*1000+7;
ll N;
vector<int> D;

ll cc[80][2][2];
ll dp(int pos, int c, int e) {
    ll &ret = cc[pos][c][e];
    if(ret != -1) return ret;

    if(pos == D.size()) return ret = 1;

    ret = 0;

    if(e) {
        if(2*c + D[pos] == 0) {
            ret += dp(pos + 1, 0, 1);
            ret %= mod;
        }
        if(2*c + D[pos] == 1) {
            ret += dp(pos + 1, 1, 1);
            ret %= mod;
        }
        if(2*c + D[pos] >= 2) {
            ret += dp(pos + 1, 0, 0);
            ret %= mod;
        }
        if(2*c + D[pos]) {
            if(2*c + D[pos] == 1) {
                ret += dp(pos + 1, 0, 1);
                ret %= mod;
            }
            if(2*c + D[pos] == 2) {
                ret += dp(pos + 1, 1, 1);
                ret %= mod;
            }
            if(2*c + D[pos] == 3) {
                ret += dp(pos + 1, 0, 0);
                ret %= mod;
            }
        }
        if(2*c + D[pos] == 2) {
            ret += dp(pos + 1, 0, 1);
            ret %= mod;
        }
        if(2*c + D[pos] == 3) {
            ret += dp(pos + 1, 1, 1);
            ret %= mod;
        }
    }
    else {
        ret += 3*dp(pos + 1, 0, 0)%mod;
        ret %= mod;
    }
    return ret;
}

int main() {
    cin>>N;
    while(N) {
        if(N & 1) D.push_back(1);
        else D.push_back(0);
        N /= 2;
    }
    reverse(D.begin(), D.end());
    memset(cc, -1, sizeof(cc));
    cout<<dp(0, 0, 1);
}


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

int main(){
    int n;
    cin >> n;
    int p[n];
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    int count = 0;
    for(int i = 0; i < n - 2; i++){
        if(p[i] < p[i+1]){
            if(p[i+1] < p[i+2]){
                count++;
            }
        }else if(p[i] > p[i+1]){
            if(p[i+1] > p[i+2]){
                count++;
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
from sys import stdin
n,x,y = [int(x) for x in stdin.readline().rstrip().split()]
a = [0] * n
for i in range(x):
    a[i] = x - (i+1)
k = y - x
if k % 2 == 1:
    k = k//2 + 1
    for i in range(k):
        a[i+x] = i+1
        a[y-1-i] = i+1
else:
    k = k//2 
    for i in range(k):
        a[i+x] = i+1
        a[y-1-i] = i+1
for i in range(n-y):
    a[y+i] = a[y-1]+i+1
c = [0] * n
for i in range(n):
    for j in range(i+1,n):
        A = j-i
        B = abs(x-1 - i) + a[j]
        p = min(A,B)
        c[p] += 1
for i in range(n-1):
    print(c[i+1])

Measured memory_bytes: 44764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define f first
#define s second

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("input.in", "r", stdin);
        //freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	int a[n], b[n], c[n];
	int dp[n][3];
	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i] >> c[i];
	}
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for(int i = 1; i < n; i++){
		dp[i][0] = a[i] + max(dp[i - 1][2], dp[i - 1][1]);
		dp[i][1] = b[i] + max(dp[i - 1][0], dp[i - 1][2]);
		dp[i][2] = c[i] + max(dp[i - 1][0], dp[i - 1][1]);
	}
	cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2]))  << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

int main(void){
	int n,q,sum=0;
	vector<int> s;
	int a[20],m[200],mflag[200]={0};
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%d",&m[i]);
	}
	for(int i=0;i<(1<<n);i++){
		sum = 0;
		for(int j=0;j<n;j++){
			if(1 & i>>j){
				s.push_back(a[j]);
			}
		}
		for(int j=0;j<s.size();j++){
			sum += s[j];
		}
		for(int j=0;j<q;j++){
			if(sum == m[j])mflag[j]=1;
		}
		s.clear();
	}
	for(int i=0;i<q;i++){
		if(mflag[i]==1){
			printf("yes\n");
		}else{
			printf("no\n");
		}
	}
	return 0;
}


Measured memory_bytes: 2648
import collections
v,e=map(int,input().split())
g=[list(map(int,input().split())) for _ in range(e)]
ans=0
for i in range(e):
  tmp=g[:i]+g[i+1:]
  ga=[[] for _ in range(v+1)]
  for j in range(e-1):
    s,t=tmp[j][0],tmp[j][1]
    ga[s].append(t)
    ga[t].append(s)
  visited=[0]*(v+1)
  queue=collections.deque([1])
  visited[1]=1
  while 1:
    if len(queue)==0:
      break
    tv=queue.popleft()
    for i in ga[tv]:
      if visited[i]==0:
        queue.append(i)
        visited[i]=1
  if visited.count(1)!=v:
    ans+=1
print(ans)

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

using namespace std;

const long long mod = 1e9 + 7;


int main() {

	int n, m;
	cin >> n >> m;

	vector<int>oks(n + 1, true);
	for (int i = 0; i < m; ++i) {
		int a;
		cin >> a;
		oks[a] = false;
	}

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

	for (int now = 0; now < n; now++) {
		for (int next = now + 1; next <= min(n, now + 2); ++next) {
			if (oks[next]) {
				dp[next] += dp[now];
				dp[next] %= mod;
			}
		}
	}

	cout << dp[n] << endl;

	return 0;
}

Measured memory_bytes: 1408
{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import Control.Monad
import Data.Char

step :: (Int, Int) -> (Bool, Int) -> (Int, Int)
step (ac, wa) (isAC, n)
  | isAC = (ac+1, wa+n)
  | otherwise = (ac, wa)

main = do
  [n, m] <- map read . words <$> getLine :: IO [Int]

  (acs :: VUM.IOVector Bool) <- VUM.replicate n False
  (was :: VUM.IOVector Int) <- VUM.replicate n 0

  replicateM_ m $ do
    bs <- B.getLine
    let Just (i, j) = B.readInt bs
    let res = B.unpack $ B.dropWhile isSpace j
    prev <- VUM.read acs (i-1)
    when (not prev && res == "AC") $ do 
      VUM.write acs (i-1) True
    when (not prev && res == "WA") $ do
      VUM.modify was (+1) (i-1)

  acs' <- VU.unsafeFreeze acs
  was' <- VU.unsafeFreeze was
  let (a,b) = VU.foldl' step (0,0) $ VU.zip acs' was'
  putStr $ show a
  putStr " "
  putStrLn $ show b
    


Measured memory_bytes: 1916
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		for (int i=0; i<n; i++) {
			int out_count = 0;
			int hit_count = 0;
			int score = 0;
			while (sc.hasNext()) {
				String s = sc.next();
				if (s.equals("OUT")) {out_count++;}
				else if (s.equals("HIT")) {
					if (hit_count==3) {score++;}
					else {hit_count++;}
				}
				else if (s.equals("HOMERUN")) {
					score += hit_count + 1;
					hit_count = 0;
				}
				if (out_count==3) {
					System.out.println(score);
					out_count = 0;
					hit_count = 0;
					score = 0;
				}
			}
		}
	}
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

struct Dinic {
	struct edge{int to;long long cap,rev;};
	vector<vector<edge>> G;
	vector<int> level;
	vector<int> iter;

	Dinic(int n):G(n, vector<edge>()),level(n),iter(n){}

	void add_edge(int from,int to,long long cap){
		G[from].push_back((edge){to,cap,(ll)G[to].size()});
		G[to].push_back((edge){from,0,(ll)G[from].size()-1});
	}

	void bfs(int s){
		fill(level.begin(), level.end(), -1);
		queue<int> que;
		level[s] = 0;
		que.push(s);
		while(!que.empty())	{
			int v = que.front();que.pop();
			for(int i = 0;i < G[v].size();++i){
				edge &e = G[v][i];
				if(e.cap > 0 && level[e.to] < 0){
					level[e.to] = level[v] + 1;
					que.push(e.to);
				}
			}
		}
	}

	int dfs(int v ,int t,long long f){
		if(v == t)return f;
		for(int &i = iter[v];i < G[v].size() ;++i){
			edge &e = G[v][i];
			if(e.cap > 0 && level[v] < level[e.to]){
				long long d = dfs(e.to,t,min(f,e.cap));
				if(d > 0){
					e.cap -= d;
					G[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}

	long long solve(int s,int t){
		long long flow = 0;
		while(1){
			bfs(s);
			if(level[t] < 0)return flow;
			fill(iter.begin(), iter.end(), 0);
			long long f;while((f = dfs(s,t,INF)) > 0)flow += f;
		}
	}
};

int main() {
	int v, e;cin >> v >> e;
	Dinic dinic(v + 1);

	REP(i, e){
		ll a, b, c;cin >> a >> b >> c;
		dinic.add_edge(a, b, c);
	}

	cout << dinic.solve(0, v - 1) << endl;
}



Measured memory_bytes: 3216
#include <stdio.h>
#include <string.h>

int main(void)
{
	int n;
	scanf("%d", &n);
	char verdict[n];
	int count[4] = {0};
	char a[4][4] = {"AC", "WA", "TLE", "RE"};
	for (int i = 0; i < n; i++)
	{
		scanf("%s", &verdict[i]);
		for (int j = 0; j < 4; j++)
		{
			if (strcmp(&verdict[i], a[j])== 0)
			{
				count[j]++;
				break;
			}
		}
	}
	for (int i = 0; i < 4; i++)
	{
		printf("%s x %d\n", a[i], count[i]);
	}
	return 0;
}

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int X, A;
    cin >> X >> A;
    cout << (X < A ? 0 : 10) << endl;

    return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import math
def isSquare(x):
    x_sqrt = int(math.floor(math.sqrt(x)))
    if x_sqrt * x_sqrt == x:
        return True
    else:
        return False

def distSquare(a, b, D):
    result = 0
    for i in range(D):
        result += (a[i]-b[i]) * (a[i]-b[i])
    return result

def solve(N: int, D: int, X: "List[List[int]]"):
    count = 0
    for i in range(N):
        for j in range(i+1, N):
            if isSquare(distSquare(X[i], X[j], D)):
                count += 1
    print(count)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    X = [ [ int(next(tokens)) for _ in range(D) ] for _ in range(N) ]  # type: "List[List[int]]"
    solve(N, D, X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064