akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define REP(i,N) for(int i = 0; i < (int)N; i++)


int main(){
	int a;
	while(cin >> a){
		int ret = 0;
		REP(i,10)REP(j,10)REP(k,10)REP(l,10){
			if(i+j+k+l == a){
				ret++;
			}
		}
		cout << ret << endl;
	}
	return 0;
}

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

void Main() {
	int64_t a, b;
	cin >> a >> b;
	int64_t times = a * b;
	string ans = times % 2 == 1 ? "Odd" : "Even";
	cout << ans << endl;
}

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


Measured memory_bytes: 256
package main

import (
	"bufio"
	"os"
	"strconv"
	"strings"
	"fmt"
)

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func Geti() int {
	n, _ := strconv.Atoi(read())
	return n
}

func Getli(size int) ([]int) {
	a := make([]int, size)
	list := strings.Split(read(), " ")
	for i, s := range list {
		n, _ := strconv.Atoi(s)
		a[i] = n
	}
	return a
}

func main() {
	n := Getli(2)
	fmt.Println(n[0]-n[1]+1)
}

Measured memory_bytes: 640
import sys
N, M = map(int, input().split())
dp = [0]*(N + 1)
dp[0] = 1
A = [int(sys.stdin.readline()) for _ in range(M)]
D = set(A)
mod = 10**9 + 7
for i in range(1, N+1):
    res = 0
    if i - 1 >= 0 and i - 1 not in D:
        res += dp[i-1]
    if i - 2 >= 0 and i - 2 not in D:
        res += dp[i-2]
    dp[i] = res % mod
print(dp[-1])           

Measured memory_bytes: 51036
#include "bits/stdc++.h"
#define REP(i, m, n) for(long long i = m; i < n; ++i)
#define CO(n) cout << n << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

string S;

int main()
{
    ios::sync_with_stdio(false);
    cin >> S;
    int l = S.length();
    REP(i,0,l) S[i] = 'x';
    CO(S);
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
def sort_zip(a:list, b:list):
    z = zip(a, b)
    z = sorted(z)
    a, b = zip(*z)
    a = list(a)
    b = list(b)
    return a, b
def ceil(x):
    return math.ceil(x)
def floor(x):
    return math.floor(x)

def main():
    a, b, c, d = map(int, input().split())

    ans = max((a * c, a * d, b * c, b * d))
    if a <= 0 <= b or c <= 0 <= d:
        ans = max(ans, 0)
    print(ans)



if __name__ == '__main__':
    main()


Measured memory_bytes: 10028
#include <stdio.h>

int main(){

    int a,b;
    char op;

    while (1)
    {
         scanf("%d %c %d",&a,&op,&b);
    
    if (op=='+')
        printf("%d\n",a+b);
    else if (op=='-')
        printf("%d\n",a-b);
    else if (op=='*')
        printf("%d\n",a*b);
    else if (op=='/')
        printf("%d\n",a/b);
    else if (op=='?')
        break;
    }
    return 0;

}

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

using namespace std;

int main() {
  string str;
  cin >> str;
  int n = static_cast<int>(str.size());
  int cnt1 = 0;
  int cnt2 = 0;
  for (int i = 0; i < n; ++i) {
    if (str[i] == 'S') {
      ++cnt1;
    }
    if (str[i] == 'T' && 0 < cnt1) {
      --cnt1;
      ++cnt2;
    }
  }
  cout << n - cnt2 * 2 << endl;
}


Measured memory_bytes: 3692
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;


int main()
{
	int a, b, c, d, e,k;
	cin >> a >> b >> c >> d >> e>>k;

	if (e - a <= k)	cout << "Yay!";
	else cout << ":(";

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
const long long NR=210000;
long long n,ans,l,r,mid,a[NR],s[NR],t[NR];
int main()
{
	scanf("%lld",&n);
	for(long long i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		s[i]=s[i-1]+a[i];
		t[i]=t[i-1]^a[i];
	}
	for(long long i=1;i<=n;i++)
	{
		l=i;
		r=n+1;
		while((r-l)>1)
		{
			mid=(l+r)>>1;
			if((t[mid]^t[i-1])==(s[mid]-s[i-1]))
			{
				l=mid;
			}
			else
			{
				r=mid;
			}
		}
		ans+=(l-i+1);
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 4992
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

// BEGIN NO SAD
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// END NO SAD

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

bool dp[100005];
void solve() {
  dp[0] = true;
  for(int x = 100; x <= 105; x++) {
    for(int i = 0; i + x <= 100000; i++) {
      dp[i+x] |= dp[i];
    }
  }
  int n;
  cin >> n;
  if(dp[n]) cout << "1\n";
  else cout << "0\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            while (sc.hasNextInt()) {
                int a = sc.nextInt();
                int b = sc.nextInt();
                System.out.println(Integer.toString(a+b).length());
            }
        }
    }
}


Measured memory_bytes: 26432
N = int(input())
A = list(map(int,input().split()))

S = [A[0]]

for i in range(1,N):
    S.append(A[i]+S[i-1])

_sum = 0
for i in range(N):
    _sum += A[i]*(S[N-1]-S[i])
    _sum %= 10**9+7

print(_sum)

Measured memory_bytes: 105096
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));

typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
int main(){
    int n;
    std::cin >> n;
    VEC(int,a,n);
    reverse(all(a));
    irep(i,n){
        //std::cout << a[i]-1+i << std::endl;
        if(a[i]-1+i>=n){
            std::cout << -1 << std::endl;
            exit(0);
        }
        else{
            int p=a[i]-1;
            rep(j,p){
                swap(a[i+j+1],a[i+j]);
            }
        //    rep(i,n)std::cout << a[i] << " ";
          //  std::cout << std::endl;
                
        }
    }
    rep(i,n)std::cout << a[i] << std::endl;
}


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

using namespace std;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,a;
vector<long long> v,z;
long long gcd(long long a, long long b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int main(){
	cin>>n;
	for (long long i=0;i<n;i++){
		cin>>a;
		v.push_back(a);
	}
	while (v.size()>1){
		z.clear();
		for (int i=0;i<v.size()/2;i++) z.push_back(gcd(v[i*2],v[i*2+1]));
		if (v.size()%2==1) z.push_back(v[v.size()-1]);
		v=z;
	}
	cout<<v[0]<<endl;
	return 0;
}

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

int main(void) {
    int n, k;
    cin >> n >> k;
    int d;
    int count = 0;
    vector<int> b(n, 0);
    for (int i = 0; i < k; i++) {
        cin >> d;
        int x = 0;
        for (int j = 0; j < d; j++) {
            cin >> x;
            b.at(x - 1)++;
        }
    }
    for (int i = 0; i < n; i++) {
        if (b.at(i) == 0) count++;
    }
    cout << count;

}

Measured memory_bytes: 3600
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
patterns = []
def saiki(n, pat):
    if n == 0:
        patterns.append(pat)
        return
    for c in 'ABCX':
        pat += c
        saiki(n-1, pat)
        pat = pat[:-1]
def main():
    N, A, B, C = LI()
    L = []
    ans = inf
    for _ in range(N):
        L.append(I())

    saiki(len(L), '')
    for pat in patterns:
        if 'A' in pat and 'B' in pat and 'C' in pat:
            pass
        else:
            continue

        a, b, c = 0, 0, 0
        MP = 0
        for i, ch in enumerate(pat):
            if ch == 'X':
                continue

            if ch == 'A':
                if a > 0:
                    MP += 10
                a += L[i]
            if ch == 'B':
                if b > 0:
                    MP += 10
                b += L[i]
            if ch == 'C':
                if c > 0:
                    MP += 10
                c += L[i]
        tmp = min(
            abs(A-a) + abs(B-b) + abs(C-c),
            abs(A-a) + abs(B-c) + abs(C-b),
            abs(A-b) + abs(B-a) + abs(C-c),
            abs(A-b) + abs(B-c) + abs(C-a),
            abs(A-c) + abs(B-b) + abs(C-a),
            abs(A-c) + abs(B-a) + abs(C-b),
        )
        MP += tmp
        if MP < ans:
            ans_pat = pat
            ans = min(MP, ans)
    print(ans)

main()



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

const int mod = 998244353;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

struct combination {
    vector<mint> fact, ifact;
    // init struct with "n" of "nCk" (maximum number in other words)
    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }
    // c(n,k) returns mint that contains nCk (mod p (= 1e9+7)) in x
    // i.e.) mint num = c(n,k), then num.x == nCk (mod p (= 1e9+7))
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
};

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

int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    combination nck(n);
    mint ans;
    for (int i = 0; i <= k; i++) {
        mint pat(m * modpow(m - 1, n - i - 1));
        pat *= nck(n - 1, i);
        ans += pat;
    }
    cout << ans.x << endl;
}

Measured memory_bytes: 6372
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)

int main() {
    vector<int> a(3);
    rep(i,3) cin >> a[i];
    sort(a.begin(),a.end());
    if(a[0]+a[1]==a[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  bool card[4][13];
  for(int i = 0; i < 4; i++) {
    for(int j = 0; j < 13; j++) {
      card[i][j] = false;
    }
  }

  int n, m;
  char s;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> s >> m;
    if(s == 'S') {
      card[0][m-1] = true;
    } if(s == 'H') {
      card[1][m-1] = true;
    } if(s == 'C') {
      card[2][m-1] = true;
    } if(s == 'D') {
      card[3][m-1] = true;
    }
  }

  for(int i = 0; i < 4; i++) {
    for(int j = 0; j < 13; j++) {
      if(card[i][j] == false) {
        if(i == 0) {
          cout << "S " << j+1 << endl;
        }
        if(i == 1) {
          cout << "H " << j+1 << endl;
        }
        if(i == 2) {
          cout << "C " << j+1 << endl;
        }
        if(i == 3) {
          cout << "D " << j+1 << endl;
        }
      }
    }
  }

  return 0;
}



Measured memory_bytes: 3076
#include <stdio.h>
int main(){
int a,b,c;
int tmp=0;
scanf("%d",&a);scanf("%d",&b);scanf("%d",&c);
if(a>b){tmp=a;a=b;b=tmp;}
if(b>c){tmp=b;b=c;c=tmp;}
if(a>b){tmp=a;a=b;b=tmp;}
printf("%d %d %d\n",a,b,c);
return 0;
}

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

int main() {
  int h,w;
  	cin>>h>>w;
  for(int i=0;i<w+2;i++){
	cout<<"#";
  }
  cout<<""<<endl;
  for(int j=0;j<h;j++){
    string s;
    	cin>>s;
    cout<<"#"<<s<<"#"<<endl;
  }
  for(int i=0;i<w+2;i++){
	cout<<"#";
  }
  cout<<""<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
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;
}

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

void solve(long long A, long long B) {
  if (A < B) swap(A, B);
  cout << A + max(A - 1, B) << endl;
}

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


Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m = map(int, input().split())
uf = UnionFind(n)
for i in range(m):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)
print(len(set([uf.find(node) for node in range(n)])) - 1)

Measured memory_bytes: 82368
#coding:utf-8

R, G, B, N = map(int, input().split())

cnt = 0

for red in range(int(N/R)+1):
    for green in range(int((N-red*R)/G)+1):
        if (N - (red*R + green*G)) % B == 0:
            cnt += 1

print(cnt)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
using ll = long long;

int main() {
    string s;
    cin >> s;
    if(s[2]==s[3]&&s[4]==s[5])cout<< "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
let () =
  let get_shop = function
      1 -> "A"
    | 2 -> "B"
    | 3 -> "C"
    | 4 -> "D"
    | 5 -> "E"
    | _ -> "NONE"
  in
  let rec loop max = function
      0 -> max
    | i ->
       let line = read_line ()
                  |> Str.split (Str.regexp " ")
                  |> List.map int_of_string
                  |> Array.of_list in
       let (am, pm) = (line.(0), line.(1)) in
       if am = 0 && pm = 0 then (0,0)
       else if snd max < (am+pm) then
         loop ((5-i+1),am+pm) (i-1)
       else
         loop max (i-1)
  in
  let rec read () =
    let (max_shop, ampm) = loop (0, 0) 5 in
    if max_shop = 0 then ()
    else
      begin
        Printf.printf "%s %d\n" (get_shop max_shop) ampm;
        read ()
      end
  in read ()
;;

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

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define deb(x)     cout << #x << " = "<<x<<endl

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

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

int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 200005;


ll gcd(ll  a , ll b) {
	return (b == 0) ? a : gcd(b, a % b);
}
ll binpow(ll a, ll b) {
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a;
		a = a * a;
		b >>= 1;
	}
	return res;
}
ll powmod(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinv(ll n, ll p)
{
	return powmod(n, MOD - 2, MOD);
}


int main(int argc, char const *argv[])
{
	// two magical lines to speed up IO
	cin.tie(0);
	ios_base::sync_with_stdio(false);
// #ifndef ONLINE_JUDGE
// 	freopen("in.txt", "r", stdin);
// 	freopen("out.txt", "w", stdout);
// #endif
	int n;
	cin >> n;
	int a[n], b[n], c[n];
	int dp[n][3];
	F0R(i, n) {
		cin >> a[i] >> b[i] >> c[i];
	}
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	FOR(i, 1, n) {
		dp[i][0] = a[i] + max( dp[i - 1][1], dp[i - 1][2]);
		dp[i][1] = b[i] + max( dp[i - 1][0] , dp[i - 1][2] );
		dp[i][2] = c[i] + max( dp[i - 1][1] , dp[i - 1][0] );
	}
	int max = 0;
	F0R(i, 3) {
		if (dp[n - 1][i] >= max ) {
			max = dp[n - 1][i];
		}
	}
	cout << max << endl;



}










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

n, m, v, p = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a.sort()
a = a[::-1]

ans = p

b = a[p:]
b_cumsum = [a[p - 1]]
for i in b:
    b_cumsum.append(b_cumsum[-1] + i)

for i in range(len(b)):
    vote_cnt = max(0, (v - p - (len(b) - (i + 1))))
    if b_cumsum[i] + m * vote_cnt <= (b[i] + m) * (i + 1) and a[p - 1] <= b[i] + m:
        ans += 1
    else:
        break

print(ans)

Measured memory_bytes: 61336
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
const int N = 1e5 + 5;

void solve(){
	int n; cin >> n;
    bool poss = true;
    for(int i = 0, x; i < n; ++i){
        cin >> x;
        if( x % 2 == 0){
            if( x % 3 == 0 or x % 5 == 0)
                continue;
            else
                poss = false;
        }   
    }
    if( poss) cout <<"APPROVED\n";
    else cout << "DENIED\n";
    
	
}


int main(){
	ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); 
	//int t; cin >> t;
	//while(t--)
		solve();
}


Measured memory_bytes: 256
#include <stdio.h>
//sukhan
 int main(void){
 int a, b, c;

 scanf("%d%d%d", &a, &b, &c);

 int ispoor = 0;
 if (a == b && b != c) ispoor = 1;
 if (b == c && c != a) ispoor = 1;
 if (c == a && a != b) ispoor = 1;

 if (ispoor) {
 puts("Yes");
 } else {
 puts("No");
 }

 return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
const int inf = 1e18 + 7;
const int N = 1e6 + 7;
const int md = 1e9 + 7;
void sol() {
  int a, b;
  cin >> a >> b;
  int as = a * b;
  cout << as;
}

int32_t main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  //cin >> T; 
  for(int t = 1; t <= T; t++) {
    //cout << "Case #" << t << ": ";
    sol();
  }
  return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
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 main()
{
	int A, B;

	cin >> A >> B;

	cout << max(A + B, max(A - B, A * B)) << endl;

	return 0;
}

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

const int N = 36;

void BubbleSort(string *str, int n){
    for (int i = 0; i < n; ++i) {
        for (int j = n-1; j > i; --j) {
            if (str[j][1] < str[j-1][1]) {
                swap(str[j], str[j-1]);
            }
        }
    }
}

void SelectionSort(string *str, int n) {
    for (int i = 0; i < n; ++i) {
        int minj = i;
        for (int j = i; j < n; ++j) {
            if (str[j][1] < str[minj][1]) {
                minj = j;
            }
        }
        swap(str[i], str[minj]);
    }
}

bool CheckStable(string *origin, string *sort, int n) {
    for (int i = 0; i < n-1; ++i) {
        if (sort[i][1] == sort[i+1][1]) {
            int j1, j2;
            for (int j = 0; j < n; ++j) {
//                 cout << sort[i] << ' ' << sort[i+1] << ' ' << origin[j] << endl;
                if (sort[i] == origin[j]) {
                    j1 = j;
//                     cout << j1 << ' ' << sort[i] << ' ' << origin[j] << endl;
                }
                else if (sort[i+1] == origin[j]) {
                    j2 = j;
//                     cout << j2 << ' ' << sort[i+1] << ' ' << origin[j] << endl;
                }
            }
            if (j1 > j2) return false;
        }
    }
    return true;
}

int main() {
    int n;
    string str1[N], str2[N], str3[N];
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> str1[i];
        str2[i] = str1[i];
        str3[i] = str1[i];
    }
    BubbleSort(str2, n);
    SelectionSort(str3, n);
//     for (int i = 0; i < n; ++i) {
//         cout << str1[i] << ' ';
//     }
//     cout << endl;
    cout << str2[0];
    for (int i = 1; i < n; ++i) {
        cout << ' ' << str2[i];
    }
    cout << endl;
    if (CheckStable(str1, str2, n)) cout << "Stable" << endl;
    else cout << "Not stable" << endl;
    cout << str3[0];
    for (int i = 1; i < n; ++i) {
        cout << ' ' << str3[i];
    }
    cout << endl;
    if (CheckStable(str1, str3, n)) cout << "Stable" << endl;
    else cout << "Not stable" << endl;

    return 0;
}

Measured memory_bytes: 3228
/**
 * @author: shashankchdhry
 * @made:   2020-04-01 16:25:21 
**/
#include <bits/stdc++.h>

using namespace std;

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    vector<int> time(n);
    int sum = 0;
    for (int i = 0; i < n; i++)
    {    
        cin >> time[i];
        sum += time[i];
    }
    int m;
    cin >> m;
    vector<pair<int, int>> drinks(m);
    for (int i = 0; i < m; i++)
        cin >> drinks[i].first >> drinks[i].second;

    for (int i = 0; i < m; i++)
    {
        int temp_sum = sum;
        temp_sum -= time[drinks[i].first-1];
        temp_sum += drinks[i].second;
        cout << temp_sum << "\n";
    }


    return 0;
}

Measured memory_bytes: 256
import math

n,d = map( int, input().split())

point = [[0]*d for _ in range(n)]

for i in range(n):
    point[i] = list( map( int, input().split()))

count = 0
for i in range(n):
    for j in range(n):
        if i < j:
            sum = 0
            for k in range(d):
                sum += ( point[i][k] - point[j][k] ) ** 2
            sum = math.sqrt(sum)
            if sum % 1 == 0:
                count += 1
        else:
            continue

print(count)

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

// <formula> ::= 0 | 1 | 2 | P | Q | R |
// -<formula> | (<formula>*<formula>) | (<formula>+<formula>)

int eval(string &s,int &i,int P,int Q,int R){
    char c = s[i];
    i++;
    if(isdigit(c)) return c-'0';
    if(isalpha(c)) return  c=='P' ? P : c=='Q' ? Q : R;
    if(c == '-') return 2-eval(s,i,P,Q,R);
    int lv = eval(s,i,P,Q,R);
    char op = s[i];
    i++;
    int rv = eval(s,i,P,Q,R);
    i++;
    if(op == '*'){
        if(lv*rv == 0) return 0;
        if(lv*rv == 4) return 2;
        return 1;
    }
    if(op == '+'){
        if(lv+rv == 0) return 0;
        if(lv== 2 || rv == 2) return 2;
        return 1;
    }
    assert(false);
}

int main(void){
    string s;
    while(cin>>s, s!="."){
        int cnt = 0;
        rep(p,3)rep(q,3)rep(r,3){
            int i = 0;
            if(eval(s,i,p,q,r)==2) cnt++;
        }
        cout<<cnt<<endl;
    }
    return 0;
}



Measured memory_bytes: 3192
import copy
N = int(input())
A = [list(map(int,input().split())) for _ in range(2)]

def main():
  global ans
  ans=0
  right=(1,0)
  under=(0,1)
  path = [right for _ in range(N-1)]
  for i in range(N):
    x,y = 0,0
    cnt=A[0][0]
    tmp_path = copy.deepcopy(path)
    tmp_path.insert(i,under)
    for r,u in tmp_path:
      x += r
      y += u
      cnt+=A[y][x]
    ans = max(cnt,ans)
  print(ans)
  return

if __name__=="__main__":
  main()

Measured memory_bytes: 3444
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	max := 0
	sum := 0
	for i := 0; i < n; i++ {
		var j int
		fmt.Scan(&j)
		sum += j
		if max < j {
			max = j
		}
	}
	if sum-max > max {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define iter(it,c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end();++it)
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
const int INF = ~(1<<31);
const double pi = acos(-1);

int main() {
	cin.sync_with_stdio(false);
	int n;
	cin >> n;
	vi arr(n);
	ll sum = 0;
	rep(i,0,n) {
		cin >> arr[i];
		sum += arr[i];
	}
	ll first = arr[0];
	sum -= arr[0];
	ll bst = abs(first-sum);
	rep(i,1,n-1) {
		sum -= arr[i];
		first += arr[i];
		bst = min(bst, abs(first-sum));
	}
	cout << bst << endl;
	return 0;
}


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

#define rep(i,a,b) for(ll i=(a);i<=(b);i++)
#define END(x) do{cout<<(x)<<endl;exit(0);}while(0)
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define exp2(x)  (1LL<<(x))

using namespace std;
using ll=long long;

const int NN=1e5+10;
vector<int> xx[NN];
vector<int> yy[NN];
vector<bool> visited(NN, false);

vector<int> x(NN), y(NN);

void dfs(int u, set<int>&sx, set<int>&sy, int&c) {
    sx.insert(x[u]);
    sy.insert(y[u]);
    visited[u]= true;
    c++;
    for(auto id: xx[ x[u] ] ) {
        if (!visited[id]) dfs(id, sx, sy, c);
    }

    for(auto id: yy[ y[u] ] ) {
        if (!visited[id]) dfs(id, sx, sy, c);
    }
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
  int N; cin >> N;
  rep(i,0,N-1) {
      int u,v;
      cin >>u >> v;

      x[i] = u;
      y[i] = v;
      xx[u].push_back(i);
      yy[v].push_back(i);
  }
  ll ans = 0;

  rep(i, 0,N-1) {
      if (!visited[i]) {
          set<int> sx, sy;
          int c =0;
          dfs(i, sx, sy, c);
          ll sxs = sx.size();
          ll sys = sy.size();
          if (sxs == 1 or sys == 1) continue;

          ans += sxs*sys - c;
      }
  }

  END(ans);
}


Measured memory_bytes: 21248
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H, W;
    cin >> H >> W;
    ll ans = 0;
    if (H == 1 || W == 1) {
        ans = 1;
    } else {
        ans = (H * W + 1) / 2;
    }
    cout << ans << endl;
}


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

int main() {
	string c;
	long long int conb=0,ans=0;
	cin>>c;
	for (char ch:c){
		if (ch=='B') conb++;
		else ans+=conb;
		
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n;
ll a[200000];
int main(){
	cin >> n;
	a[0] = 0;
	a[n + 1] = 0;
	REP(i,n) {
		cin >> a[i + 1];
	}

	ll b = 0;;

	REP(i,n + 1) {
		b += abs(a[i] - a[i + 1]);
	}

	FOR(i,1,n + 1) {
		cout << b - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i + 1] - a[i - 1]) << endl;
	}
	return 0;
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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

    vector<ll> h(N);
    rep(i,N) cin >> h[i];

    sort(all(h));
    
    ll ans = h[K-1] - h[0];
    //ll ans = INF;
    //rep(i,N-K+1)
    for( ll i = 0; i < N-K+1; i++)
    {
        if( h[i+K-1] - h[i] < ans )
        {
            ans = h[i+K-1] - h[i];
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main()
{
    int n, a, b;
    cin >> n >> a >> b;

    if (n*a < b)
    {
        cout << n*a << endl;
    } else {
        cout << b<< endl;
    }
    return 0;
}

Measured memory_bytes: 256
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
#define fi first
#define se second
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    string s;
    cin>>s;
    
    cout<<s.substr(0,4)<<' '<<s.substr(4,8)<<endl;

}

Measured memory_bytes: 3668
#include<iostream>

using namespace std;

class Dice {
    public:
        int D1;
        int D2;
        int D3;
        int D4;
        int D5;
        int D6;

        Dice(int d1, int d2, int d3, int d4, int d5, int d6);
        void Rotate_E();
        void Rotate_N();
        void Rotate_S();
        void Rotate_W();

};

Dice::Dice(int d1, int d2, int d3, int d4, int d5, int d6) {
    D1 = d1;
    D2 = d2;
    D3 = d3;
    D4 = d4;
    D5 = d5;
    D6 = d6;
}

void Dice::Rotate_E() {
    int tmp;

    tmp = D3;
    D3 = D1;
    D1 = D4;
    D4 = D6;
    D6 = tmp;
}

void Dice::Rotate_N() {
    int tmp;

    tmp = D5;
    D5 = D1;
    D1 = D2;
    D2 = D6;
    D6 = tmp;
}

void Dice::Rotate_S() {
    int tmp;

    tmp = D5;
    D5 = D6;
    D6 = D2;
    D2 = D1;
    D1 = tmp;
}

void Dice::Rotate_W() {
    int tmp;

    tmp = D3;
    D3 = D6;
    D6 = D4;
    D4 = D1;
    D1 = tmp;
}

int main () {

    int d1, d2, d3, d4, d5, d6;
    cin >> d1 >> d2 >> d3 >> d4 >> d5 >> d6;
    Dice Dice1(d1, d2, d3, d4, d5, d6);

    int q;
    cin >> q;

    for (int i = 0; i < q; i++) {
        int a, b;
        cin >> a >> b;

        if (Dice1.D3 == b || Dice1.D4 == b) {
            Dice1.Rotate_E();
        }

        while (Dice1.D2 != b) {
            // cout << "Now Loading\n" << endl;
            Dice1.Rotate_N();
        }

        while (Dice1.D1 != a) {
            // cout << "Now Loading2\n" << endl;
            Dice1.Rotate_E();
        }

        cout << Dice1.D3 << endl;
    }

    return 0;
}


Measured memory_bytes: 3016
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s = input()
s = s.replace(",", " ")
print(s)

Measured memory_bytes: 5156
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int N, temp;
	cin >> N;
	string ans = "No";
	rep2(i, 1, 10)
	{
		if (N % i == 0)
		{
			temp = N/i;

			if (0 < temp && temp < 10)
			{
				ans = "Yes";
				break ;
			}
		}
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char c[300000];
int main()
{
	int n;
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		cin>>c[i];
	}
	int l = 0,r=n-1,ans=0;
	while(l<r)
	{
		while(c[l]!='W' && l<n)
			l++;
		while(c[r]!='R' && r>=0)
			r--;
		if(l==n || r==-1)
			break;
		if(l>=r)
			break;
		c[l] = 'R';
		c[r] = 'W';
		ans++;
	}
	cout<<ans<<endl;

	
	return 0;
}

Measured memory_bytes: 3780
#include<iostream>
#include<algorithm>
#include<functional>
#include <string>
#include<cstdio>
#include<math.h>
#include<stack>
#include<queue>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
#define MIN -93193111451418101
#define INF 931931114518101
using namespace std;
typedef long long int ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}
ll combination(ll n) {
	ll nck[100][100];
	nck[0][0] = 1;
	for (int i = 1; i < 1 + n; i++) {
		nck[i][0] = nck[i][i] = 1;
		for (int j = 1; j < i; j++) {
			nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j];
		}
	}
	return 0;
}
//------------------変数-----------------------//

//-------------------関数----------------------//

int main() {
	string a, b=""; cin >> a;
	ll s = a.size();
	for (ll i = s-1; i >=0; i--)
	{
		b += a[i];
	}
	REP(i, s) {
		if (a[i] != b[i]) { cout << "No" << endl; return 0; }
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
using namespace std;

const int maxn = 10;
int a[maxn];

int main()
{
    int N;
    while(scanf("%d",&N) == 1)
    {
        int cnt = 0;
        while(N)
        {
            int x = N % 10;
            N /= 10;
            a[cnt++] = x;
        }

        int ok = 0;
        if((a[3] == a[2] && a[2] == a[1]) || (a[2] == a[1] && a[1] == a[0]))
            ok = 1;
        if(ok) printf("Yes\n");
        else printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long

struct SCC{
  int V;
  vector<vector<int> > G,rG,T;
  vector<int> vs,used,cmp;
  SCC(){}
  SCC(int V):V(V){init();}
  void init(){
    G.clear();
    rG.clear();
    vs.clear();
    used.clear();
    cmp.clear();
    T.clear();
    
    G.resize(V);
    rG.resize(V);
    used.resize(V);
    cmp.resize(V);
  }
  void add_edge(int from,int to){
    G[from].push_back(to);
    rG[to].push_back(from);
  }
  void dfs(int v){
    used[v]=1;
    for(int i=0;i<(int)G[v].size();i++){
      if(!used[G[v][i]]) dfs(G[v][i]);
    }
    vs.push_back(v);
  }
  void rdfs(int v,int k){
    used[v]=1;
    cmp[v]=k;
    T[k].push_back(v);
    for(int i=0;i<(int)rG[v].size();i++){
      if(!used[rG[v][i]]) rdfs(rG[v][i],k);
    }
  }
  
  int scc(){
    fill(used.begin(),used.end(),0);
    vs.clear();
    for(int v=0;v<V;v++){
      if(!used[v]) dfs(v);
    }
    fill(used.begin(),used.end(),0);
    int k=0;
    for(int i=vs.size()-1;i>=0;i--){
      if(!used[vs[i]]){
	T.push_back(vector<int>());
	rdfs(vs[i],k++);
      }
    }
    return k;
  }
};


signed main(){
  int v,e;
  cin>>v>>e;
  SCC scc(v);
  for(int i=0;i<e;i++){
    int s,t;
    cin>>s>>t;
    scc.add_edge(s,t);
  }
  cout<<(v!=scc.scc())<<endl;
  return 0;
}

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

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

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(make_pair(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define INF (1 << 29)
const int mod = 1000000007;

ll modpow(ll x, ll n) {
    if(n == 0)
        return 1;
    ll res = modpow(x * x, n / 2);
    if(n & 1)
        res = res * x;
    return res;
}

int main() {
    ll h;
    cin >> h;
    ll cnt = 0;
    while(true) {
        if(h == 1) {
            break;
        }
        h /= 2;
        cnt++;
    }
    cout << 2 * modpow(2, cnt) - 1 << endl;
    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define pb push_back
#define bp __builtin_popcount
#define sz size()
#define ff first
#define ss second
#define vll vector<ll>
#define vbool vector<bool>
#define vpll vector<pair<ll,ll>>
#define pll pair<ll,ll>
#define vllv vector<vector<ll>>
#define setpri(x) cout<<setprecision(x)<<fixed;
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){if(n%x==0)return n/x; else return (n/x)+1;}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;
}
ll modinv(ll A,ll M){return pow1(A,M-2,M);}
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
ll factmod(ll n,ll mod){ll s=1; for(ll i=1;i<=n;i++){s*=i;s%=mod;} return s;}
vll fact1tonmod(ll n,ll mod){vll  ans(n+1);ans[0]=ans[1]=1;
    for(ll i=2;i<=n;i++)ans[i]=(ans[i-1]*i)%mod;
    return ans;
}
ll ncrmod(ll n,ll r,ll mod){
    ll ans=((((factmod(n,mod)%mod)*(modinv(factmod(r,mod),mod)%mod))%mod)*(modinv(factmod(n-r,mod),mod)))%mod;
    return ans;
}
ll ncr(ll n,ll r){if(n==1 || r==0)return 1;if(r>n/2)r=n-r;
    ll ans=1;for(ll i=1;i<=r;i++){ans=((ans * n )/i);n--;}return ans;
}
bool isprime(ll n){if(n==1 || (n!=2 && n%2==0))return false; if(n==2)return true; 
        for(ll i=3;i<=sqrt(n);i+=2)if(n%i==0)return false; return true; }
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
    if(a.ff != b.ff)return a.ff < b.ff;
    return a.ss > b.ss;
}
void solve(){
    ll i,j,k,n,l,m,x,y,z,r;
    cin>>n;
  double ans=2.0*3.1415927*(double)n;
  cout<<fixed<<setprecision(10)<<ans;
}
int main(){
    // FS;
    ll i,j,k,n,m,x,y,z,q;
    q=1;
	// cin>>q;
    while(q--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3864
#include<bits/stdc++.h>
#define ll long long
#define fr(i,x,y) for(int i=(x);i<=(y);i++)
#define rf(i,x,y) for(int i=(x);i>=(y);i--)
#define frl(i,x,y) for(int i=(x);i<(y);i++)
using namespace std;
const int N=100005;
const int p=1e9+7;
int n,a[N];
int tot[16];

template<class T> void read(T &x){
	char ch=getchar();x=0;
	for(;ch<'0'||ch>'9';ch=getchar());
	for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<3)+(x<<1)+ch-'0';
}

void Add(int &x,int y){
	x+=y;
	while(x>=p) x-=p;
}

int f[1<<16],sum[1<<16];
int main(){
	read(n);
	int x,y,w;
	fr(i,2,n){
		read(x);read(y);read(w);
		x++;y++;
		a[x]^=w;a[y]^=w;
	}
	fr(i,1,n) tot[a[i]]++;
	int ans=0,all=0;
	fr(i,1,15) ans+=tot[i]/2,all^=(tot[i]&1)<<i;
	fr(i,1,all)
	 if ((i&all)==i){
	 	//if ((i&(-i))==i){ f[i]=1;continue; }
	 	sum[i]=0;
	 	fr(j,0,15) if (i&(1<<j)) sum[i]^=j,f[i]++;
	 	if (sum[i]) continue;
	 	f[i]--;
	 	for(int j=(i-1)&i;j;j=(j-1)&i)
	 	 if (sum[j]==0) f[i]=min(f[i],f[j]+f[i^j]);
	 }
	cout<<ans+f[all]<<endl;
	return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>

int is_prime(int x){
  if(x%2 == 0) return 0;
  for(int j = 3;j*j < x;j += 2){
    if(x%j == 0) return 0;
  }
  return 1;
}

int main(void){
  int N;
  scanf("%d",&N);
  int cnt = 0;

  for(int i = 7;cnt < N;i += 5){
    if(is_prime(i)){
      printf("%d",i);
      cnt++;
      if(cnt != N) printf(" ");
      else printf("\n");
    }
  }

  return 0;
}

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

int main(void)
{
	string str;
	while (getline(cin, str))
	{
		while (str.find("the") == -1 && str.find("this") == -1 && str.find("that") == -1)
		{
			for (int i = 0; i < str.size(); i++)
			{
				if ('a' <= str[i] && str[i] < 'z') str[i]++;
				else if (str[i] == 'z') str[i] = 'a';
			}
		}
		cout << str << endl;
	}
	return 0;
}


Measured memory_bytes: 3000