akhauriyash/Code-Regression huggingface dataset:
//import java.io.*;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        int a,b;
        String op;
        boolean isEnd=true;
        Scanner sc = new Scanner(System.in);;
        //char op;
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        try{
            while(isEnd)
            {
                a=sc.nextInt();
                op=sc.next();
                b=sc.nextInt();

            /* line=reader.readLine();
            a=Integer.parseInt(line);

            op=String.parseString(line);

           // line=reader.readLine();
            b=Integer.parseInt(line); */

                switch(op)
                {
                    case "+":
                        System.out.println(a+b);
                        break;
                    case "-":
                        System.out.println(a-b);
                        break;
                    case "*":
                        System.out.println(a*b);
                        break;
                    case "/":
                        System.out.println(a/b);
                        break;
                    case "?":
                        isEnd=false;
                        break;
                    default:
                        break;
                }
            }
            

        }catch(NumberFormatException e){
            System.out.println(e);
        /* }catch(UTILLException e){
            System.out.println(e); */
        }
    }
}


Measured memory_bytes: 26296
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<unordered_set>
#include<unordered_map>
using namespace std;

void DFS(vector<vector<int>> &graph, int i, vector<bool> &visited)
{
    int j;
    for(j=0;j<graph[i].size();j+=1)
    {
        if(visited[graph[i][j]]==false)
        {
            visited[graph[i][j]] = true;
            DFS(graph, graph[i][j], visited);
        }
    }
}


int main()
{
    int N, M, i, j, a, b, count = 0;
    cin>>N>>M;
    vector<vector<int>> graph(N+1);
    vector<bool> visited(N+1, false);
    for(i=1;i<=M;i+=1)
    {
        cin>>a>>b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    for(i=1;i<=N;i+=1)
    {
        if(visited[i]==false)
        {
            count+=1;
            visited[i]==true;
            DFS(graph, i, visited);
        }
    }
    cout<<count-1<<endl;
}


Measured memory_bytes: 9540
/**
 *   author: Shubham Srivastava
 *   created: 25 January 2020  23:53:45
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define MOD 1000000007
#define INF 0x7fffffff
#define sorti(v) sort(v.begin(),v.end())
#define sortd(v) sort(v.rbegin(),v.rend())
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
ll parent[2000005];

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll n;cin>>n;
    vector <ll> arr(n);
    for(int i=0;i<n;i++)cin>>arr[i];
    vector <ll> dp(n,0);
	for(int i=1;i<=n;i++){
		int val1 = INT_MAX, val2 = INT_MAX;
		if(i-1 >= 0)
			val1 = dp[i-1] + abs(arr[i]-arr[i-1]);
		if(i-2 >= 0)
			val2 = dp[i-2] + abs(arr[i]-arr[i-2]);
		dp[i] = min(val1,val2);
	}
	cout<<dp[n-1];
return 0;
}

Measured memory_bytes: 1792
def check(a,cnt):
  c = [int(x)%2 for x in a]
  if 1 in c:
    return 0,cnt,a
  else :
    cnt +=1
    b = [int(x)/2 for x in a]
    return 1,cnt,b
 
N = input()
a = input().split()
cnt = 0
m = 1
while(m != 0):
  m,cnt,a = check(a,cnt)
  if m == 0:
    print(cnt)
  else :
    continue

Measured memory_bytes: 3064
// C - String Transformation
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

string S, T;

bool solve(){
	vvi ss(26, vi()), tt(26, vi());//[char-'a']<index>
	rp(i, 0, S.size()) ss[S[i]-'a'].push_back(i);
	rp(i, 0, T.size()) tt[T[i]-'a'].push_back(i);

	vi cs(200000+1, 0), ct(200000+1, 0);//[count]<count_num> 1_origin
	rp(i, 0, ss.size()) cs[ss[i].size()]++;
	rp(i, 0, tt.size()) ct[tt[i].size()]++;

	rp(i, 1, 200000+1) if(cs[i] != ct[i]) return false;
	return true;
}

int main(){
	cin>>S>>T;
	cout<< (solve()? "Yes":"No") <<endl;
}

Measured memory_bytes: 4488
(let* ((n (read))
       (lst (loop :repeat n :collect (= (read) (read)))))
  (if (loop :for k :from 0
            :for j :from 3 :upto n
            :never (equal '(T T T) (subseq lst k j)))
      (princ "No")
      (princ "Yes")))

Measured memory_bytes: 23868
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

const long long MOD = 1e9 + 7;

vector<ll> sft(ll n)
{
    vector<ll> tmp(3);
    tmp[0] = 10 * n + 3;
    tmp[1] = tmp[0] + 2;
    tmp[2] = tmp[1] + 2;
    return tmp;
}
int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, c;
    cin >> a >> b >> c;
    ll s = (a + b + c) / 2;
    ll ans = sqrt(s * (s - a) * (s - b) * (s - c));
    cout << ans << endl;
}

Measured memory_bytes: 256
S = input()

A = int(S[:2])
B = int(S[2:])

if 0 < A <= 12 and 0 < B <= 12:
    print('AMBIGUOUS')
elif not (0 < A <= 12 or 0 < B <= 12):
    print('NA')
elif 0 < A <= 12:
    print('MMYY')
else:
    print('YYMM')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vpi = vector<pi>;
using vvpi = vector<vpi>;
const ull MOD = 998244353;
#ifdef LOCAL
#include "../../pp.hpp"
#define debug pp::debug
#else
#define debug(args...)
#endif

int n;
vector<long long> a;
vector<vector<long long>> dp;

long long solve(int i, int j) {
    if (i == j) return a[i];
    if (i + 1 == j) return max(a[i], a[j]);
    if (dp[i][j] != -1) return dp[i][j];

    long long ans = a[i] + min(solve(i+2, j), solve(i+1, j-1));
    ans = max(ans, a[j] + min(solve(i, j-2), solve(i+1, j-1)));
    dp[i][j] = ans;
    return ans;
}

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

    cin >> n;
    dp = vector<vector<long long>>(n, vector<long long>(n, -1));
    a = vector<long long>(n);
    for (int i = 0; i < n; ++i) cin >> a[i];

    long long x = solve(0, n-1);
    long long y = accumulate(a.begin(), a.end(), 0LL) - x;
    cout << x - y << '\n';
}


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

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

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

  int a, p; cin >> a >> p;
  cout << (a*3+p)/2 << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;

const int N = 101, W = 1e5 + 1;
const ll inf = 1e18;
ll dp[N][W];
int n, w, weight[N], value[N];

ll solve(int i, int w){
   if (w > ::w) return -inf;
   if (i == n) return 0;
   if (dp[i][w] != -1) return dp[i][w];
   dp[i][w] = max(solve(i + 1, w), value[i] + solve(i + 1, w + weight[i]));
   return dp[i][w];
}

int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.precision(10);
   cout << fixed;
   cin >> n >> w;
   for (int i = 0; i < n; ++i){
      cin >> weight[i] >> value[i];
   }
   memset(dp, -1, sizeof(dp));
   cout << solve(0, 0) << '\n';
   return 0;
}

Measured memory_bytes: 79232
def examB():
    N = I()
    St = S()
    cur = int(0)
    ans = int(0)
    for s in St:
        if s=="I":
            cur +=1
        elif s=="D":
            cur -=1
        ans = max(ans,cur)
    print(ans)

import sys
import copy
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()


Measured memory_bytes: 3444
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
#include<bitset>

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

using namespace std;
using ll = long long;

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

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


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



int main() {
    int q; cin >> q;
    vector<int> l(q), r(q);
    for (int i = 0; i < q; i++)
    {
        cin >> l[i] >> r[i];
    }

    // エラトステネス
    int mx = 100100;
    vector<bool> is_prime(mx, 1);   // すべて素数と初期化
    is_prime[0] = false;
    is_prime[1] = false;
    for (int i = 2; i < mx; i++) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < mx; j += i) {
            is_prime[j] = false;
        }
    }

    // 2017like numberかどうか
    vector<int> a(mx);
    for (int i = 0; i < mx; i++)
    {
        if (i%2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
    }

    // 累積和
    vector<int> s(mx+1);
    for (int i = 0; i < mx; i++)
    {
        s[i+1] = a[i] + s[i];
    }
    
    for (int i = 0; i < q; i++)
    {
        cout << s[r[i]+1] - s[l[i]] << endl;
    }
        

    return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int a;
string s;
int main()
{
  cin >> a >> s;
  if(a>=3200) cout << s << "\n";
  else cout << "red" << "\n";
  return 0;
}


Measured memory_bytes: 256
a, b, k = map(int, input().split())
s = set()

for i in range(a, min(a+k, b+1)):
    s.add(i)
for i in range(max(b-k+1, a), b+1):
    s.add(i)
s = list(sorted(s))

for n in s:
    print(n)

Measured memory_bytes: 38256
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <set>

using namespace std;

int main() {
  
    int a,b,c ;
    cin>>a>>b>>c ;
 
    for (int i = 1; i <= b; i++)
    {
        int tmp = i*a ;
        if(tmp%b==c){
            cout << "YES" << endl ;
            return 0 ;
        }
    }
    
    cout << "NO" << endl ;
    
return 0 ;

}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{

 int i, j, k;

 int a, b, c;

 while(scanf("%d %d", &a, &b), a > 0){

   c = 0;

  for(i = 1; i <= a; ++i){

   for(j = i + 1; j <= a; ++j){

    for(k = j + 1; k <= a; ++k){

     if(i + j + k == b){

        ++c;

      }

    }

  }
}

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

 }

 return 0;

}

Measured memory_bytes: 1856
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top=0,t[1000];
void push(int);
int pop(void);

int main(){
  int x,y;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      x=pop();
      y=pop();
      push(x+y);
    } else if ( s[0] == '-' ){
      y=pop();
      x=pop();
      push(x-y);
    }else if ( s[0] == '*' ){
      x=pop();
      y=pop();
      push(x*y);
    } else {
      push(atoi(s));
    }
  }
  printf("%d\n",pop());

  return 0;
}void push(int x){
  if(top==1000){
    printf("Stack overflow!\n");
    exit(1);
  }
  t[top]=x;
  top++;
}
int pop(void){
  if(top==0){
    printf("Stack is empty!\n");
    exit(2);
  }
  top--;
  return t[top];
}



Measured memory_bytes: 2044
n=int(input())
c= sorted(list(map(int, input().split())), reverse=True)
l = len(c)
m = l//2
ans = c[0]

if l%2 == 0:
    for i in range(1,m):
        ans += 2*c[i]
else:
    for i in range(1,m):
        ans += 2*c[i]
    ans += c[m]
print(ans)

Measured memory_bytes: 31544
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    long long x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;

    vector<long long> red(a);
    vector<long long> green(b);
    vector<long long> apple;

    for(long long i = 0; i < a; i++){
        cin >> red[i];
    }
    for(long long i = 0; i < b; i++){
        cin >> green[i];
    }
    for(long long i = 0; i < c; i++){
        long long clear;
        cin >> clear;
        apple.push_back(clear);
    }

    sort(red.begin(), red.end(), greater<long long>());
    sort(green.begin(), green.end(), greater<long long>());
   

    long long sum = 0;
    

    for(long long i = 0; i < x; i++){
        apple.push_back(red[i]);
    }
    for(long long i = 0; i < y; i++){
        apple.push_back(green[i]);
    }

    sort(apple.begin(), apple.end(), greater<long long>());

   for(long long i = 0; i < x+y; i++){
       sum += apple[i];
   }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 9028
import java.util.Scanner;


public class Main {
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int n4 = n%10;
		n/=10;
		int n3 = n%10;
		n/=10;
		int n2 = n%10;
		n/= 10;
		
		if(n==n2 && n2 ==n3)
			System.out.println("Yes");
		else if(n2==n3 && n3==n4){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		} 
    }
}

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

int main()
{
    int n, count = 0;
    bool odd = false;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    while (odd == false)
    {
        for (int i = 0; i < n; i++)
        {
            if (a.at(i) % 2 != 0)
            {
                count--;
                odd = true;
                break;
            }
            a.at(i) /= 2;
        }
        count++;
    }
    cout << count << endl;
}

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

int n;
int a[300000]; 

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

int main()
{
	n=qr();
	for(int i=1;i<=n;i++)
		a[i]=qr();
	sort(a+1,a+n+1);
	for(int i=2;i<=n;i++)
		if(a[i]==a[i-1])
		{
			cout<<"NO"<<endl;
			return 0;
		}
	cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 1024
from sys import stdin
N = int(stdin.readline().rstrip())
ST = []
for i in range(N):
    s, t = stdin.readline().rstrip().split()
    ST.append((s, int(t)))
X = stdin.readline().rstrip()
for i in range(N):
    if ST[i][0] == X:
        print(sum(st[1] for st in ST[i+1:]))

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
  string s;
  cin >> s;
  
  if(s.size() == 1){
    P(0);
    ret 0;
  }

  /*
  long a[26]={};

  rep(i,0,s.size()){
    a[s[i] - 'a']++;
  }
  
  bool f = false;
  P(s);
  
  rep(i,0,s.size()){    
    if(a[i] % 2 == 1 && i != 23){
      if(f){
        P(-1);
        P("done 1");
        ret 0;
      }
      else{
        f = true;
      }
    }  
  }
  */
  long i = 0;
  long sumx = 0;
  while(i < s.size() -i-1 ){
    char c1=s[i],c2=s[s.size()-1-i];
    //printf("i:%ld c1:%c c2:%c\n",i,c1,c2);
    //P(s);
    if(s[i] != s[s.size() - 1 - i] ){
      if(s[i] == 'x'){
        if(i!=0)
          s.insert(s.size()-i , "x");
        else
          s += "x";

        sumx++;
      }else if(c2 == 'x'){
        s.insert(i,"x");
        sumx++;
        
        if(i!=0)
          i--;
      }
      
      else{
        P(-1);
        //P("done 2");
        ret 0;
      }
      
      
    }
    else{
      i++;
    }
  }
  
  P(sumx);
  ret 0;
}

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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;

ll f(ll x, const VL& a) {
    ll res = 0;
    REP(i, a.size()) res += x ^ a[i];
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    VL a(n);
    VI bit_cnt(50, 0);
    REP(i, n) {
        cin >> a[i];
        ll temp = a[i];
        REP(j, 50) {
            bit_cnt[j] += temp % 2;
            temp /= 2;
        }
    }
    
    ll ans_x = 0;
    FORR(i, 49, 0) {
        if(bit_cnt[i] <= n / 2 and ans_x + (1LL << i) <= k)
            ans_x += (1LL << i);
    }
    cout << f(ans_x, a) << ln;
    return 0;
}


Measured memory_bytes: 1024
/******************************\
*  Everyone has a different way of thinking, so God Created us
Hope You Respect My Way..,Thank You ):  *
*                            *
*   Created by : Murad   *
\******************************/
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
#include<bits/stdc++.h>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define MP make_pair
#define fi first
#define se second
#define INF 2147483647
#define _INF -2147483647
#define pq priority_queue
#define MM multimap
#define PB push_back
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define MAXN 100004
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
LL MMIN(LL a, LL b)
{
	if (a <= b)
		return a;
	else
		return b;
}
LL MMAX(LL a, LL b) {
	if (a >= b)
		return a;
	else
		return b;
}
int main()
{
	El3zba;
	char a[100];
	int k, n; cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int i = 0;
	while (i<n) {
		if (i == k - 1) {
			char c = a[k - 1];
			int val = c - 'A';
			int req = val + 97;
			a[k - 1] = toascii(req);
			break;
		}
		else
			i++;
	}
	for (int i = 0; i < n; i++)cout << a[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
def divide_by_2(n)
  ret =	0
  loop do
    break if n%2 == 1
    n /= 2
    ret	+= 1
  end
  ret
end

gets
nums = gets.chomp.split(' ').map(&:to_i)
p nums.map{ |i| divide_by_2(i) }.inject(:+)


Measured memory_bytes: 2556
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
const int MAXN = 2e5 + 5;

int last[MAXN + 5], other[MAXN + 5], pre[MAXN + 5];

int N, all = -1;

void build(int u, int v)
{
	pre[++all] = last[u];
	last[u] = all;
	other[all] = v;
}

int dfs(int ans, int fa)
{
	int cnt = 0;
	int dt = last[ans];
	while(dt != -1){
		int dr = other[dt];
		if(dr != fa) cnt ^= dfs(dr, ans);
		dt = pre[dt];
	}
	if(ans == 1) return cnt;
	return cnt + 1;
}

int main()
{
	memset(last, -1, sizeof(last));
	scanf("%d", &N);
	for(int i = 1; i < N; i++){
		int u, v;
		scanf("%d %d", &u, &v);
		build(u, v);
		build(v, u);
	}
	int check = dfs(1, 0);
	if(check) printf("Alice\n");
	else printf("Bob\n");
}


Measured memory_bytes: 7168
#include<iostream>

using namespace std;


int main() {

	int l;
	cin >> l;

	double ll = (double)l;

	double a, b, c;
	a = ll / 3;
	b = a;
	c = a;

	double ans = a * b*c;

	printf("%.12f", ans);

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define pb push_back
#define pf push_front
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
 
ll gcd(ll x, ll y) {
	if(y==0) return x;
	return gcd(y,x%y);	
}

ll lcm(ll x, ll y) {
	ll z=gcd(x,y);
	return x/z*y;
}

int main()
{
	ll n,m;
	cin >> n >> m;
	if(n>m) swap(n,m);
	if(n==1 && m==1) cout << 1 << endl;
	else if(n==1) cout << m-2 << endl;
	else cout << (n-2)*(m-2) << endl;
	return 0;
}


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

using namespace std;

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;

//階乗
int factorial(int k){
    int result=1;
    for (int i=1;i<=k;++i){
        result*=i;
    }
    return result;
}


int main() {
    ll x,ans=0;
    cin>>x;

    if(x%11>0&&x%11<7)ans++;
    else if(x%11>6)ans+=2;

    ans+=(x/11)*2;

    cout<<ans<<endl;


}






Measured memory_bytes: 256
# a-b-c-dのようなつながり方でないとアウト
connected_town_dict = {i:set() for i in range(1,5)}

for i in range(3):
    a,b = map(int, input().split())
    connected_town_dict[a].add(b)
    connected_town_dict[b].add(a)

for i in range(1,5):
    if len(connected_town_dict[i])!=1 and len(connected_town_dict[i])!=2:
         print("NO")
         break
else:
    print("YES")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int gcd (int a , int b){
	if(b==0)return a;
	else return gcd(b,a%b);
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long long int n , x , num;
	cin>>n>>x;
	vector<int> diff(n);;
	for( int  i = 0 ; i < n ; ++i ){
		cin>>num;
		diff[i]=abs(num-x);
	}
	sort(diff.begin(),diff.end());
	int res =gcd(diff[0],diff[1]) ;
	for( int i = 2 ; i < n ; ++i ){
		res = gcd(diff[i],res);
	}
	cout<<res;
	return 0;
}

Measured memory_bytes: 640
s = input()
n = len(s)
s = s + "R"
change = [0 for i in range(n)]
num = [0 for i in range(n + 1)]
i = 0
p = s[0]
q = "L"
count = 1
while i < n:
    p_next = s[i + 1]
    if s[i] != s[i + 1]:
        if s[i] == "R":
            num[i + 1] += count // 2
            num[i] += (count + 1) // 2
        else:
            num[i - count] += count // 2
            num[i - count + 1] += (count + 1) // 2
        count = 1
    else:
        count += 1
    i += 1
for i in range(n - 1):
    print(str(num[i]), end = " ")
print(str(num[n - 1]))

Measured memory_bytes: 5640
import itertools
import math
#import numpy as np
N = int(input())

xys = [list(map(int, input().split())) for _ in range(N)]

loots = list(itertools.permutations(range(1,N+1)))
#print(len(loots))

goukei = 0
for loot in loots:
#    print(loot)
    for index, value in enumerate(loot[1:N]):
#        print(xys[loot[index]-1][0], xys[loot[index-1]-1][0],"\n",xys[loot[index]-1][1], xys[loot[index-1]-1][1])
        goukei += math.sqrt((xys[loot[index]-1][0] - xys[loot[index-1]-1][0]) ** 2 + (xys[loot[index]-1][1] - xys[loot[index-1]-1][1]) ** 2)
#        print(xys[1][0] ,xys[loot[index-1]-1][0])
#    print(goukei)


print(goukei / len(loots))
        

Measured memory_bytes: 7972
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>
#include <cmath>

using namespace std;

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

  if(A<C){
    if(B<C) cout << 0 << endl;
    else if(B<=D) cout << B-C << endl;
    else  cout << D-C << endl;
  }
  else if(A==C){
    cout << min(B-A,D-C) << endl;
  }
  else if(A>C){
    if(A<D){
      if(B<=D) cout << B-A << endl;
      else if(D<B)  cout << D-A << endl;
    }
    else if(A==D){
      cout << 1 << endl;
    }
    else if(A>D){
      cout << 0 << endl;
    }
  }

  return 0;
}


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

int main(){
    char search[21], word[21];
    int count=0;
    int i;
    
    scanf("%s", search);
    while(1){
        scanf(" %s", word);
        if(strcmp(word, "END_OF_TEXT")==0)break;
        for(i=0;word[i]!='\0';i++){
            word[i]=tolower(word[i]);
        }
        if(strcmp(word, search)==0){
            count++;
        }
    }
    printf("%d\n", count);

    return 0;
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
using namespace std;
 
int N, D;
vector<int> v;

int calc(int x){
  long long p = 0LL;
  while(!(x&1)) x  /= 2, ++p;
  return p;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  //freopen("5.txt", "r", stdin);
  cin >> D >> N;
  if(D == 0 && N%100 == 0){
   cout << N+1 << "\n";
   return 0;
  }
  if(D == 1 && N == 100){
    cout << 10100 << "\n";
    return 0;
  }
  if(D == 2 && N == 100){
   cout << 1010000 << "\n";
   return 0;
  }
  long long rep = (long long)N * (long long)pow(100, D);

  cout << rep << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define inf = 1e9 + 5;
#define dbg(vari) cerr << #vari << " = " << (vari) << endl;

void solve(long long a, std::string s) {
  if (!(a < 3200)) {
      cout << s << endl;
  } else {
      cout << "red" << endl;
  }
}


int main() {
  long long a;
  scanf("%lld", &a);
  std::string s;
  std::cin >> s;
  solve(a, s);
  return 0;
}


Measured memory_bytes: 256
/*!enjoy karo yaar!*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

#include<bits/stdc++.h>
using namespace std;

#define     int             long long int
#define     fast()          ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)          begin(x),end(x)
#define     rz(x)           resize(x)
#define     asn(x,y)        assign(x,y)
#define     mem(a,b)        memset(a,b,sizeof(a))
#define     sz(x)           ((int)(x.size()))
#define     eb              emplace_back
#define     pb              push_back
#define     pf              push_front
#define     pob             pop_back
#define     pof             pop_front
#define     ins             insert
#define     vi              vector<int>
#define     pii             pair<int,int>
#define     mii             map<int,int>
#define     F               first
#define     S               second
#define     makep           make_pair
#define     maket           make_tuple
#define     remax(a,b)      a=max(a,b)
#define     remin(a,b)      a=min(a,b)
#define     bitcount(x)     __builtin_popcountll(x)
#define     iceil(n,x)      (((n)+(x)-1)/(x))
#define     gcd(a,b)        (__gcd((a),(b)))
#define     lcm(a,b)        ((a)*((b)/gcd((a),(b))))
#define     dbug(x)         cout<<#x<<": "<<(x)<<"\n"
#define     flush           fflush(stdout)
#define     show(x)         for(auto zz:x)cout<<zz<<" ";cout<<"\n";
#define     show2(x)        for(auto zz:x)cout<<zz.F<<" "<<zz.S<<"\n";

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const ld pi=acos(-1);
const ll inf=1e18,M=1e9+7;
const int N=1e5+5;

vi v[N],have(N);

int n,k;
int ans=1;

void upd(int x)
{
    //cout<<x<<"...\n";

    if(x<=0)
    {
        cout<<0;
        exit(0);
    }

    ans=(ans*x)%M;
}

void dfs(int x,int p,int d)
{
    //cout<<x<<" "<<p<<" "<<d<<"\n";

    have[x]=1;

    if(p && sz(v[x])==1)
    {
        upd(k-d);
        return;
    }

    if(d)           // par assigned, can determine for x
        upd(k-d);

    int cur=0;      // for the children of x
    if(d) cur+=2;           // as both par and x have been assigned
    for(auto c:v[x])
    {
        if(c==p)
            continue;

        dfs(c,x,cur);

        if(have[x]==1 && !d)        // first child helps in determining x if not done so yet
        {
            upd(k-have[c]);
            ++cur;
        }

        ++cur;
        ++have[x];
    }
}

void solve()
{
    cin>>n>>k;

    if(n==1)
    {
        cout<<k;
        return;
    }

    int a,b;
    for(int i=1;i<n;++i)
    {
        cin>>a>>b;
        v[a].pb(b);
        v[b].pb(a);
    }

    dfs(1,0,0);
    cout<<ans;
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    for(int z=1;z<=t;++z)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}



Measured memory_bytes: 12416
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

;; Hauptteil

(defun main ()
  (declare #.OPT)
  (let* ((s1 (map '(simple-array uint8 (*))
                  (lambda (c) (- (char-code c) 97))
                  (the string (read-line))))
         (s2 (map '(simple-array uint8 (*))
                  (lambda (c) (- (char-code c) 97))
                  (the string (read-line))))
         (table1 (make-array 26 :element-type 'int8 :initial-element -1))
         (table2 (make-array 26 :element-type 'int8 :initial-element -1)))
    (write-line
     (dotimes (i (length s1) (return "Yes"))
       (if (= -1 (aref table1 (aref s1 i)))
           (setf (aref table1 (aref s1 i)) (aref s2 i))
           (unless (= (aref table1 (aref s1 i)) (aref s2 i))
             (return "No")))
       (if (= -1 (aref table2 (aref s2 i)))
           (setf (aref table2 (aref s2 i)) (aref s1 i))
           (unless (= (aref table2 (aref s2 i)) (aref s1 i))
             (return "No")))))))

#-swank(main)


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n,sum=0;
    cin>>n;
    vector<ll> a(n);
    unordered_map<ll,ll> mp;
    for (int i = 0; i < n; i++)
    {
        cin>>a[i];
        mp[a[i]]++;
        sum+=a[i];
    }
    ll q;
    cin>>q;
    for (int i = 0; i < q; i++)
    {
        ll b,c;
        cin>>b>>c;

        int cnt=mp[b];
        mp[c]+=cnt;
        mp.erase(b);
        sum+=(c-b)*cnt;
        cout<<sum<<endl;
    }
    
    
    return 0;
}

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

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

int main(){
	long long int n,k,large=0;cin>>n>>k;
  	vector<long long int> a(n);
  	for(int i=0;i<n;i++) cin>>a[i];
  	sort(a.begin(),a.end());
	if(k>a[n-1]){ cout<<"IMPOSSIBLE"<<endl; return 0;}
  	
  	long long g=a[0];
  	for(int i=1;i<n;i++){
    	g=gcd(g,a[i]);
    }
  	if(k%g==0){
    	cout<<"POSSIBLE"<<endl;
    }else{
    	cout<<"IMPOSSIBLE"<<endl;
    }
  	
}  

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef vector<int> vi;

void normalize(vi &v){
  map<int,int> id;
  int k = 0;
  rep(i,v.size()){
    if(v[i] != 0 && id.count(v[i])==0)id[v[i]] = ++k;
  }
  
  rep(i,v.size())v[i] = id[v[i]];
}

int special(string s){
  int n = s.size(), cnt = 0;
  rep(i,n){
    if(s[i] == '?')s[i] = '#';
    if(s[i] == '#')cnt++;
  }

  rep(i,n-1){
    if(s[i]=='.' && s[i+1]=='.')return -1;
  }

  for(int i=1;i<n-1;i++){
    if(s[i]=='.' && s[i-1]=='#' && s[i+1]=='#')return -1;
  }

  return cnt;
}

int main(){
  int h,w;
  cin >> h >> w;
  vector<string> c(h);
  rep(i,h)cin >> c[i];

  if(h==1){
    cout << special(c[0]) << endl;
    return 0;
  }
  if(w==1){
    string s;
    rep(i,h)s += c[i];
    cout << special(s) << endl;
    return 0;
  }
  
  map<vi,int> cur;
  cur[vi(w,0)] = 0;

  rep(i,h)rep(j,w){
    map<vi,int> nxt;
    int nh = i, nw = j+1;
    if(nw==w)nh++, nw=0;

    for(pair<vi,int> p : cur){
      vi s = p.first, ns = s;
      int num = p.second;

      if(c[i][j] == '?' || c[i][j] == '.'){
	if( i>0 && s[j]==0 )goto OUT_W;
	if( j>0 && s[j-1]==0 )goto OUT_W;

	int cnt = 0;
	rep(k,w){
	  if(s[k]==s[j])cnt++;
	}
	if(i>0 && cnt==1)goto OUT_W;
	
	ns[j] = 0;
	nxt[ns] = max(nxt[ns], num);
      }
    OUT_W:;
      
      if(c[i][j] == '?' || c[i][j] == '#'){
	if( i>0 && j>0 && s[j]!=0 && s[j-1]==s[j] )goto OUT_B;
	int nc = 0;
	rep(k,w)nc = max(nc,s[k]); nc++;
	if(i>0 && s[j]>0)nc = s[j];
	if(j>0 && s[j-1]>0)nc = s[j-1];
	ns[j] = nc;
	if(i>0 && s[j]>0 && j>0 && s[j-1]>0){
	  int tmp = s[j];
	  rep(k,w){
	    if(s[k] == tmp)ns[k] = nc;
	  }
	}
	
	normalize(ns);
	nxt[ns] = max(nxt[ns], num+1);	
      }
    OUT_B:;
    }
    cur = nxt;
  }
  
  int ans = -1;
  for(pair<vi,int> p : cur){
    bool f = true;
    for(int u : p.first){
      if(u>1)f = false;
    }
    if(f)ans = max(ans, p.second);
  }
  cout << ans << endl;
}

Measured memory_bytes: 2168
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <iomanip>
#include <climits>
#include <string>
#include <sstream>
#include <numeric>
#include <stack>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (c - a - b >= 0 && (c - a - b) * (c - a - b) > 4 * a * b) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let A: Vec<usize> = sc.vec(N);
    let mut hold = false;
    let mut stock = 0;
    let mut ans = 1000;
    for i in 0..N {
        if i < N-1 && A[i] <= A[i+1] {
            if !hold {
                stock += ans / A[i];
                ans %= A[i];
                hold = true;
            }
        } else {
            ans += A[i] * stock;
            stock = 0;
            hold = false;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2100
#include <stdio.h>

int main()
{
    int a, b;
    scanf("%d %d", &a, &b);
    if (a < b)
    {
        int t = a;
        a = b;
        b = t;
    }
    int r = a % b;
    while (r != 0)
    {
        a = b;
        b = r;
        r = a % b;
    }
    printf("%d\n", b);
    return 0;
}


Measured memory_bytes: 2124
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,cnt=0,temp;
  long long a[100009],b[100009];
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i]>>b[i];
  reverse(a,a+n);
  reverse(b,b+n);
  for(int i=0;i<n;i++){
    a[i]+=cnt;
    temp=b[i]-(a[i]%b[i]);
    if(temp!=b[i])cnt+=temp;
  }
  cout<<cnt<<endl;
  return(0);
}


Measured memory_bytes: 1920
n=int(input())
x=input().split()
a=[]
for i in range(n):
	a.append(int(x[i]))
counter=0
for i in range(n-1):
	if a[i+1]-a[i]<0: 
		counter+=-a[i+1]+a[i]
		a[i+1]+=-a[i+1]+a[i]

print(counter)

Measured memory_bytes: 31960
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;
#define int LL

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

signed main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  int k; cin >> k;
  int ans = 0;
  for (RI i = 1; i <= k; ++i)
    for (RI j = 1; j <= k; ++j)
      for (RI l = 1; l <= k; ++l)
        ans += __gcd(__gcd(i, j), l);
  cout << ans;

  return 0;
}

// created by Daniel yuan


Measured memory_bytes: 3628
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

var (
	readString func() string
)

func init() {
	readString = newReadString(os.Stdin)
}

type sortString []string

func (s sortString) Len() int {
	return len(s)
}

func (s sortString) Less(i, j int) bool {
	return len(s[i]) < len(s[j])
}

func (s sortString) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

type sortRunes []rune

func (s sortRunes) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s sortRunes) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s sortRunes) Len() int {
	return len(s)
}

func SortString(s string) string {
	r := []rune(s)
	sort.Sort(sortRunes(r))
	return string(r)
}

func main() {
	n := readInt()
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = readString()
	}

	// 1
	sort.Sort(sortString(s))

	// 2
	mapArray := make([]map[string]int, n)
	for i := range mapArray {
		mapArray[i] = make(map[string]int)
	}

	for i := range s {
		for ii := range s[i] {
			mapArray[i][string(s[i][ii])] = mapArray[i][string(s[i][ii])] + 1
		}
	}

	// 3
	tmp := make(map[string]int)
	for i := range mapArray[0] {
		tmp[i] = mapArray[0][i]
		for ii := 1; ii < n; ii++ {
			if tmp[i] > mapArray[ii][i] {
				tmp[i] = mapArray[ii][i]
			}
		}
	}

	ans := ""
	for i := range tmp {
		for ii := 0; ii < tmp[i]; ii++ {
			ans = ans + i
		}
	}

	fmt.Println(SortString(ans))
}

/*-------------------inputs-------------------*/

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

/*-------------------utilities-------------------*/

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}


Measured memory_bytes: 768
/* Simplicity and Goodness */

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 402;

ll dp[N][N], a[N];

ll rec(int i, int j)
{
    if(i == j)
        return 0;

    ll& ans = dp[i][j];

    if(ans != -1)
        return ans;

    ll sum = 0;

    rep(k, i, j+1)
    sum += a[k];

    ans = (ll) 1e18;

    rep(k, i, j+1) {
        ans = min(ans, rec(i, k) + rec(k+1, j) + sum);
    }

    return ans;
}

void solve()
{
    int n;
    scn(n);

    memset(dp, -1, sizeof(dp));

    rep(i, 0, n)
    lscn(a[i]);

    lprin(rec(0, n-1));
}

int main()
{
    int t = 1;
    // scn(t);

    while(t --) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 5108
#include <bits/stdc++.h>
using namespace std;
#define REP(i, m, n) for(int i = m; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define dup(x, y) (((x) + (y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
typedef vector<vector<int>> Graph;
template <class T> inline void chmax(T &a, T b) {
    if(a < b) {
        a = b;
    }
}
template <class T> inline void chmin(T &a, T b) {
    if(a > b) {
        a = b;
    }
}
template <class T> inline T gcd(T x, T y) {
    if(y == 0) {
        return x;
    } else if(x == 0) {
        return y;
    }
    return gcd(y, x % y);
}
template <class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template <class T> inline vector<T> convert_to_binary_number(T x) {
    vector<T> binary_num;
    while(x != 1) {
        binary_num.push_back(x % 2);
        x /= 2;
    }
    binary_num.push_back(1);
    return binary_num;
}
template <class T> inline void print_vector(vector<T> vec) {
    for(int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    cout << endl;
}
vector<LL> make_divisors(LL n) {
    vector<LL> divisors;
    for(int i = 1; i <= sqrt(n); i++) {
        if(n % i == 0) {
            divisors.push_back(i);
            if(i != n / i) {
                divisors.push_back(n / i);
            }
        }
    }
    return divisors;
}
const LL MOD = 1e9 + 7;
const int INF = 1 << 30;
const LL LLINF = 1LL << 60;
using namespace std;

vector<int> x, y;
double ans = 0;

void rec(int c_node, double length, vector<bool> vec) {
    for(int i = 0; i < vec.size(); i++) {
        if(!vec[i]) {
            vector<bool> vect = vec;
            vect[i] = true;
            double c_length = length + sqrt((x[i] - x[c_node]) * (x[i] - x[c_node]) +
                        (y[i] - y[c_node]) * (y[i] - y[c_node]));
            rec(i, c_length, vect);
        }
    }


    rep(i, vec.size()) {
        if(!vec[i]) break;
        if(i == vec.size() - 1){
            ans += length;
        }
    }
}

int factorial(int n) {
    if(n == 0) {
        return 1;
    } else {
        return n * factorial(n - 1);
    }
}

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

    x.resize(N);
    y.resize(N);
    rep(i, N) cin >> x[i] >> y[i];

    for(int i = 0; i < N; i++) {
        vector<bool> vec(N, false);
        vec[i] = true;
        rec(i, 0, vec);
    }

    printf("%.9lf", ans / factorial(N));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int a, b, c, d;
    std::cin>>a>>b>>c>>d;

    int l = a + b;
    int r = c + d;
    std::string ans;
    if(l < r){
        ans = "Right";
    }else if(l > r){
        ans = "Left";
    }else{
        ans = "Balanced";
    }
    std::cout<<ans<<std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int he, wi, hi;
	int i;
	int n;
	int x;
	float p = 3.14;
	
	while (1){
		scanf("%d %d %d", &he, &wi, &hi);
		if (he == 0 && wi == 0 && hi == 0){
			break;
		}
		scanf("%d", &n);
		for (i = 0; i < n; i++){
			scanf("%d", &x);
			if ((wi * wi) + (hi * hi) < (x * 2) * (x * 2)){
				printf("OK\n");
			}
			else {
				printf("NA\n");
			}
		}
	}
	return (0);
}

Measured memory_bytes: 580