akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	A, B := getStdinInt2()

	A1 := A + B
	A2 := A - B
	A3 := A * B

	if A1 > A2 && A1 > A3 {
		fmt.Printf("%d\n", A1)
	} else if A2 > A3 {
		fmt.Printf("%d\n", A2)
	} else {
		fmt.Printf("%d\n", A3)
	}
}

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt2() (int, int) {
	list := getStdinIntArr()
	return list[0], list[1]
}
func getStdinInt3() (int, int, int) {
	list := getStdinIntArr()
	return list[0], list[1], list[2]
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinInt64_2() (int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1]
}
func getStdinInt64_3() (int64, int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1], list[2]
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}
func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}
func abs64(n int64) int64 {
	if n < 0 {
		return -n
	}
	return n
}
func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, _ := sc.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 2156
numlist = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())
print(numlist[k-1])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=505,maxm=200005;
int head[maxm],t[maxm<<1],ne[maxm<<1],sap[maxm<<1],S,T,d[maxm],num;
int cur[maxm],cnt[maxm],his[maxm],edge[maxm],pre[maxm];
const int inf=1e6;
inline void addedge(int x,int y,int z){
	ne[++num]=head[x];head[x]=num;t[num]=y;sap[num]=z;
	ne[++num]=head[y];head[y]=num;t[num]=x;sap[num]=0;
}
inline int isap(){
	rep(i,1,T)cur[i]=head[i],d[i]=0,cnt[i]=0;
	cnt[0]=T;
	int i=S,aug=inf,ans=0,minnum,jl;
	while(d[S]<T){
		bool flag=0;his[i]=aug;for(int j=cur[i];j!=-1;j=ne[j])if(d[t[j]]+1==d[i]&&sap[j]){
			cur[i]=j;edge[i]=j;pre[t[j]]=i;aug=min(aug,sap[j]);flag=1;i=t[j];
			if(i==T){
				ans+=aug;
				while(i!=S){i=pre[i];sap[edge[i]]-=aug;sap[edge[i]^1]+=aug;}
				aug=inf;
			}break;
		}if(flag)continue;minnum=T;forE(j,i)if(sap[j]&&d[t[j]]<minnum)minnum=d[t[j]],jl=j;
		if(--cnt[d[i]]==0)return ans;cnt[d[i]=minnum+1]++;cur[i]=jl;
		if(i!=S){i=pre[i];aug=his[i];}
	}return ans;
}
char s[maxn][maxn];
int n,m;
inline int tr(int x,int y){
	return x*2+y;
}
int main(){
	read(n);read(m);
	rep(i,1,n)scanf("%s",s[i]+1);
	S=n+m+1,T=S+1;
	rep(i,1,T)head[i]=-1;num=1;
	rep(i,1,n)rep(j,1,m){
		if(s[i][j]=='S'){
			addedge(S,i,inf);
			addedge(S,j+n,inf);
		}
		if(s[i][j]=='T'){
			addedge(i,T,inf);
			addedge(j+n,T,inf);
		}
		if(s[i][j]=='o'){
			addedge(i,j+n,1);
			addedge(j+n,i,1);
		}
	}
	int res=isap();
	if(res>=inf){
		puts("-1");
	}else{
		printf("%d\n",res);
	}
	return 0;
}


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

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

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define pb push_back
#define nl cout<<"\n"
#define F first
#define S second
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

const ll MOD = 1000000007;
ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

template<class T1, class T2> void add( T1 &x, T2 y, ll m = MOD )
{
    x += y;
    if( x >= m )
        x -= m;
}

template<class T1, class T2> void sub( T1 &x, T2 y, ll m = MOD )
{
    x -= y;
    if( x < 0 )
        x += m;
}

ll divisors( ll n, ll d )
{
    ll lo = 1;
    ll hi = n/d;

    ll sum = ((hi-lo+1)*(lo+hi)*d)/2;
    return sum;
}

int main() 
{
    fastio();

    ll n;
    cin>>n;

    ll total = n*(n+1)/2;

    ll ans = total - divisors(n,3LL) - divisors(n,5LL) + divisors(n,15LL);

    cout<<ans,nl;


    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}


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

using namespace std;

int main()
{
    int a[ 3 ], min_cost = INT_MAX;

    for( int i = 0; i < 3; cin >> a[ i++ ] );

    do min_cost = min( min_cost, abs( a[ 1 ] - a[ 0 ] ) + abs( a[ 2 ] - a[ 1 ] ) ); while( next_permutation( a, a + 3 ) );

    cout << min_cost;
}


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

int main(){
    int N,M;
    while(cin>>N>>M && !(N==0 && M==0)){
        pair<int,int>* road=new pair<int,int>[N];
        for(int i=0;i<N;++i){
            cin>>road[i].second>>road[i].first; //(P,D)
        }
        sort(road,road+N);
        reverse(road,road+N);
        for(int i=0;i<N;++i){
            if(M==0) break;
            int deduct=(road[i].second<=M ? road[i].second : M);
            road[i].second-=deduct;
            M-=deduct;
        }
        int S=0;
        for(int i=0;i<N;++i){
            S+=road[i].first*road[i].second;
        }
        cout<<S<<"\n";
        delete[] road;
    }
}

Measured memory_bytes: 3160
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	//昨日のと微妙に似ていて全然違う
	//巡回にならない！
	int n,Q,i,j;cin>>n>>Q;
	if(n==1){cout<<1<<endl;return 0;}
	vector<int>a(n+1);
	vector<int>gya(n+1);
	vector<int>hid(n+2);
	vector<int>mig(n+2);
	for(i=1;i<=n;i++){cin>>a[i];gya[a[i]]=i;}
	for(i=0;i<n+2;i++){hid[i]=i-1;mig[i]=i+1;}
	while(Q--){
		int q,b;cin>>q;b=gya[q];
		int Lh=mig[0];
		int Lm=hid[b];
		int Rh=mig[b];
		int Rm=hid[n+1];
		if(mig[0]==b){
			mig[0]=Rh;hid[n+1]=b;
			mig[b]=n+1;hid[b]=Rm;
			mig[Rm]=b;hid[Rh]=0;
			continue;
		}
		if(hid[n+1]==b){
			mig[0]=b;hid[n+1]=Lm;
			mig[b]=Lh;hid[b]=0;
			mig[Lm]=n+1;hid[Lh]=b;
			continue;
		}
		mig[0]=Rh;	hid[n+1]=Lm;
		mig[Lm]=n+1;hid[Rh]=0;
		mig[b]=Lh;	hid[b]=Rm;
		mig[Rm]=b;	hid[Lh]=b;
	}
	int bas=0;
	for(i=0;i<n;i++){
		bas=mig[bas];
		cout<<a[bas];
		if(i<n-1){cout<<" ";}
	}
	cout<<endl;
}


Measured memory_bytes: 4336
n = int(input())
lst = []
for i in range(n):
	str1 = input()
	lst.append(str1)
print('AC x' , lst.count('AC'))
print('WA x' , lst.count('WA'))
print('TLE x' ,lst.count('TLE'))
print('RE x' , lst.count('RE'))

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

int main() {
  int N , M;
  cin >> N >> M;
  
  vector<int> day(M);
  for (int i = 0; i < M; i++) {
    cin >> day.at(i);
  }
  
  int sum = 0; //宿題を終わらせるのにかかる日数
  for (int i = 0;i < M; i++) {
    sum += day.at(i);
  }
  
  if (N >= sum ) {
    cout << N - sum << endl;
  }
  else {
    cout << -1 << endl;
  }
}


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

using namespace std;

#define li int64_t
#define mod (li)(1e9+7)
const int MX1=1e5+5;

void solve(){
	int a,b;
	cin>>a>>b;
	cout<<2*b-a;
}

int main(){
	#ifndef ONLINE_JUDGE
	#endif
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
/**
 * b.cxx - 2019-08-24 11:29
 *
 * Copyright © 2019 Libao Jin <jinlibao@outlook.com>
 * Distributed under terms of the MIT license.
 */

#ifdef LOCAL
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

const int MOD = 1e9 + 7;

int main(int argc, char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;

  long long n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<int> rank1(n), rank2(n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (a[i] > a[j]) {
        ++rank2[i];
        if (i < j) ++rank1[i];
      }
    }
  }

  long long ret = 0;
  for (int i = 0; i < n; ++i)
    ret = (ret + (k * (k - 1) / 2 % MOD) * rank2[i] + k % MOD * rank1[i]) % MOD;

  cout << ret % MOD << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<algorithm>
#include<queue>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<stack>
#include<set>
#include<map>
#include<vector>
#define pi 3.1415926536
const int maxn = 1e5 + 5;
using namespace std;

int n,d = 1;
int a[105];
int main()
{
	scanf("%d",&n);
	for(int i = 1 ; i <= n; i++){
		scanf("%d", &a[i]);
	}
	sort(a + 1, a + n + 1);
	for(int i = 1; i < n; i++){
		if(a[i] != a[i + 1]) d++;
	}
	printf("%d\n", d);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define eb emplace_back
#define precision(n) cout << fixed << setprecision(n);
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
int main()
{
    fast;
    long long  int n,a,b;
   long long int ans;
    cin>>a>>b>>n;
    if(b>n)
    {
        ans=n;
    }
    else
    {
        ans=b-1;
    }

    cout<<(ans*a)/b-a*(ans/b)<<endl;
    return 0;
}


Measured memory_bytes: 3644
#[macro_use]extern crate text_io;
use proconio::input;


fn main() {
    input!(n:i32,m:i32);
    let mut h:Vec<i32> = Vec::new();
    for _ in 0..n {
        input!(n:i32);
        h.push(n);
    }
    let mut load = vec![vec![];n as usize];
    for _ in 0..m {
        input!(mut a:i32,mut b:i32);
        a -= 1; b -= 1;
        load[a as usize].push(b);
        load[b as usize].push(a);
    }
    let mut cnt = 0;
    for (i,v) in load.iter().enumerate() {
        let mut flag = true;
        for j in (*v).iter() {
            if h[i] <= h[(*j) as usize] {flag = false};
        }
        if flag {cnt += 1};
    }
    println!("{}",cnt);
}

Measured memory_bytes: 9604
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
      	int m = scn.nextInt();
		int[] x = new int[n];
      	int a = 0;
      	int b = 0;
		for(int i=0; i<m; i++){
			a = scn.nextInt()-1;
          	b = scn.nextInt()-1;
          	x[a]++;
          	x[b]++;
		}
      	for(int i=0; i<n; i++) {
      		System.out.println(x[i]);
    	}
	}
}


Measured memory_bytes: 35628
#include <iostream>
//#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
ll INF = 1000000000000 ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}
//void chmin(ll &a,ll b){if(a>b) a = b ;}
//const int MAX = 4000000 ;
//
////宣言するときはstaticをつけて静的変数にするかグローバル変数として宣言
//class SGT{
//public :
//	ll n ;
////	d変数は単位元、計算の邪魔をしない値に設定する、INFや0など
//	int d = 0 ;
//	pll num[MAX] ;
//
//	void init(vector<ll> &a){
//		n = 1 ;
//		while(a.size()>n) n *= 2 ;
//		for(int i=0;i<n;i++){
//			if(i<a.size()){
//				num[n-1+i].first = a.at(i) ;
//				num[n-1+i].second = i ;
//			}
//			else{
//				num[n-1+i].first = -INF ;
//				num[n-1+i].second = -1 ;
//			}
//		}
//		for(int i=n-2;i>=0;i--){
//			num[i] = max(num[i*2+1],num[i*2+2]) ;
//		}
//	}
//
////	内容次第でwhile内の計算式を書き換える
//	void update(int i,int a){
//		i += n-1 ;
//		num[i].first = a ;
//		while(i>0){
//			i = (i-1)/2 ;
//			num[i] = max(num[i*2+1],num[i*2+2]) ;
//		}
//	}
//
//	pll query(int a,int b,int l,int r,int now){
//		pll res ;
//		if(r<=a||b<=l){
//			res.first = -INF ;
//			res.second = -1 ;
//			return res ;
//		}
//		if(a<=r&&l<=b){
//			return num[now] ;
//		}
//		pll r1 = query(a,b,l,(l+r)/2,now*2+1) ;
//		pll r2 = query(a,b,(l+r)/2,r,now*2+2) ;
//		return max(r1,r2) ;
//	}
//};
//
//SGT sgt ;

int main(){
	ll n ; cin >> n ;
	vector<pll> pos,neg ;
	ll left=0,right=0 ;
	for(int i=0;i<n;i++){
		string s ; cin >> s ;
		ll l=0,r=0,cnt=0 ;
		for(int j=0;j<s.size();j++){
			if(s.at(j)=='('){
				cnt++ ;
			}else{
				if(cnt==0){
					r++ ;
				}else{
					cnt-- ;
				}
			}
		}
		l = cnt ;
		if(l==0&&r==0) continue ;
		if(l==0){
			right += r ;
		}else if(r==0){
			left += l ;
		}else{
			if(l-r>=0) pos.emplace_back(r,l-r) ;
			else neg.emplace_back(l,r-l) ;
		}
	}
	sort(all(pos)) ;
	sort(all(neg)) ;
	for(int i=0;i<pos.size();i++){
		if(left<pos.at(i).first){
			yorn(0) ;
			return 0 ;
		}
		left += pos.at(i).second ;
	}
	for(int i=0;i<neg.size();i++){
		if(right<neg.at(i).first){
			yorn(0) ;
			return 0 ;
		}
		right += neg.at(i).second ;
	}
	yorn(left==right) ;
}


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

int main() {
  string s;
  int n;
  cin >> n >> s;
  for (int i = 0; i < s.size(); ++i) {
    int x = s[i] - 'A';
    x = (x + n) % 26;
    cout << (char)('A' + x);
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <malloc.h>
int main() {
	int n;
	scanf("%d", &n);

	int x[n];
	double sum = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &x[i]);
	}

	for (int i = 0; i < n; i++) {
		sum += 1 / (x[i] * 1.000);
	}
	printf("%lf", 1 / sum);

	return 0;
}


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

int N;
int X[101010];
int Y[101010];
vector<pair<int, int>> R[101010];
vector<pair<int, int>> C[101010];

class UnionFind {
    public:
    vector<int> table;
    vector<vector<int>> data;
    UnionFind(int n) {
        table = vector<int> (n, -1);
        data = vector<vector<int>> (n);
        REP(i, n) data[i].push_back(i);
    }

    ~UnionFind(){};

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (table[x] >= table[y]) {
            for (auto i: data[x]) data[y].push_back(i);
            data[x].clear();
            table[y] += table[x];
            table[x] = y;
        } else {
            for (auto i: data[y]) data[x].push_back(i);
            data[y].clear();
            table[x] += table[y];
            table[y] = x;
        }
    }

    int find(int x) {
        if (table[x] < 0) return x;
        return table[x] = find(table[x]);
    }
};

void solve() {
    cin >> N;
    REP(i, N) cin >> X[i] >> Y[i];
    REP(i, N) R[X[i]].push_back({Y[i], i});
    REP(i, N) C[Y[i]].push_back({X[i], i});

    UnionFind uf = UnionFind(N);
    REP(i, 101010) REP2(j, 1, (int)R[i].size()) {
        uf.unite(R[i][j].second, R[i][0].second);
    }
    REP(i, 101010) REP2(j, 1, (int)C[i].size()) {
        uf.unite(C[i][j].second, C[i][0].second);
    }

    ll ans = 0;
    set<int> sx;
    set<int> sy;

    REP(i, N) if (uf.table[i] < 0) {
        sx.clear();
        sy.clear();
        for (auto j: uf.data[i]) {
            sx.insert(X[j]);
            sy.insert(Y[j]);
        }
        ans += 1LL * sx.size() * sy.size() - (ll)uf.data[i].size();
    }

    cout << ans << endl;
}

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


Measured memory_bytes: 22264
using System;
using System.Linq;

namespace A_Multiplication1
{
    class MainClass
    {
        public static void Main(string[] args)
        {

            var line = Console.ReadLine();
            var l = line.Split(' ').Select(s => int.Parse(s)).ToArray();

            Console.Write("{0}\n", l[0] * l[1]);
        }
    }
}


Measured memory_bytes: 28308
//テンプレ
#include <bits/stdc++.h>
//#define int long long
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define FOR(i,a,b)  for(int i = (a); i <= (b); ++i)
#define ALL(v) (v).begin(),(v).end()

using namespace std;
//constexpr int MOD = 10e9+7;
//constexpr int INF = 1LL << 60;
template <class T> inline bool chmin(T& a, T b){if(a > b){ a = b; return 1;} return 0;}  
template <class T> inline bool chmax(T& a, T b){if(a < b){ a = b; return 1;} return 0;}  
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
//

signed main (){
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   int a[3];
   cin >> a[0] >> a[1] >> a[2] ;
   REP (i,3)
   {
       if(max({a[0],a[1],a[2]}) == a[i])
       {
           cout << a[(i+1)%3] * a[(i+2)%3] /2 << endl;
       }
   }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
int main()
{
	using namespace std;
	int a,b,c;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
		c=a+b;
		int ans=1;
		while(c/10!=0)
		{
			++ans;
			c/=10;
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3144
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    int N,K;
    cin >> N >> K;
    vector<int>price(N);
    rep(i,N){
        cin >> price.at(i);
    }
    sort(price.begin(),price.end());
    int sum = 0;
    rep(i,K){
        sum += price.at(i);
    }
    cout << sum <<endl;
}


Measured memory_bytes: 3628
#define _CRT_SECURE_NO_WARNINGS
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// #define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) begin(c), end(c)
#define range(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) range(i,0,b)
#define rangei(i,a,b) for(ll a=a;i<=ll(b);i++)
#define repi(i,b) rangei(i,1,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator << (ostream &os, vector<T> const &);
template<int n, class...T>
typename enable_if<(n>=sizeof...(T))>::type
_ot(ostream &, tuple<T...> const &){}
template<int n, class...T>
typename enable_if<(n< sizeof...(T))>::type
_ot(ostream &os, tuple<T...> const &t){
    os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t);
}
    template<class...T>
    ostream & operator << (ostream &os, tuple<T...> const &t){
        _ot<0>(os, t); return os;
    }
template<class T, class U>
ostream & operator<<(ostream &os, pair<T,U> const &p){
    return os << "(" << p.first << ", " << p.second << ") ";
}
template<class T>
ostream & operator<<(ostream &os, vector<T> const &v){
    rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os;
}
#ifdef DEBUG
#define dump(...) (cerr << #__VA_ARGS__ << " = " << mt(__VA_ARGS__) \
                   << " [" << __LINE__ << "]" << endl)
#else
#define dump(...)
#endif
void fastios(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#define endl '\n'
}
template<class T>
size_t uniq(vector<T> &v){
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    return v.size();
}
template<class T>
size_t uniq(T *l, size_t n){
    sort(l,l+n);
    return unique(l,l+n) - l;
}
#define mems(arr,val) memset(arr,val,sizeof(arr));
int const mod = 1000000007;
int const inf = numeric_limits<int>::max()/8;

template <class T>
struct FenwickTree {
    int n;
    vector<T> x;
    FenwickTree(int n_ = 0) : n(n_), x(n_+1){
        fill(x.begin(), x.end(), 0);
    }
    T sum(int r){
        T S = 0;
        for(r = r-1; r >= 0; r = (r&(r+1))-1) S += x[r];
        return S;
    }
    T sum(int l, int r){
        return sum(r) - sum(l);
    }
    void add(int k, T a){
        for(; k < n; k |= k+1) x[k] += a;
    }
    void set(int k, T a){
        int x = sum(k, k+1);
        add(k, a-x);
    }
    vi to_a(int l = -1, int r = -1){
        if(l == -1) l = 0;
        if(r == -1) r = n;
        vi res(r-l);
        range(i,l,r) res[i-l] = sum(i,i+1);
        return res;
    }
};

int main(){
    fastios();
    int n,q;
    cin >> n >> q;
    FenwickTree<ll> t(n);
    rep(i,q){
        int c,x,y;
        cin >> c >> x >> y;
        x--;
        if(c == 0) t.add(x,y);
        else cout << t.sum(x,y) << endl;
    }
}

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

typedef long long ll;
typedef pair<int,int> P;
#define INF (int)(1e9)
#define EPS (1e-7)
#define MOD ((ll)1e9+7)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i = 1;i <= (int)(n); i++)
#define FOR(i,k,n) for(int i = (k); i < (int)(n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>


/*--------------------------------------------*/
/*ll factorial(ll);
void list_Prime(ll);
ll divisor(ll);
ll lcm(ll, ll);//AとBの最小公倍数
ll gcd(ll,ll);

int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
*/
/*--------------------------------------------*/
/*--------------------------------------------*/
/*
ll factorial(ll n){
    if(n==1)return 1;
    return n*factorial(n-1);
}
ll lcm(ll A, ll B) {//最小公倍数
    ll a = A;
    ll b = B;
    if (a == 0 || b == 0) { return 0; }
    if (a < 0) { a = -a; }
    if (b < 0) { b = -b; }
    while (b > 0) {
        ll c = a % b;
        a = b;
        b = c;
    }
    return A/a*B;
}

ll gcd(ll a,ll b){
    while (b != 0) {
        int t = b;
        b = a % b;
        a = t;
    }
    return a;
}


void list_Prime(ll n){//n以下の素数を全て見つける
    ll Limit=(int)sqrt((double)n);
    for(ll i=2;i<=n;i++)prime[i]=1;//最初はみんな素数かも
    //素数の整数倍を消していく(ルートnまで)
    for(ll i=2;i<=Limit;i++){
        if(prime[i]){
            for(ll j=2*i;j<=n;j++){
                if(j%i==0){
                    prime[j]=0;                
                }
            }
        }
    }
}

ll divisor(ll n){
    for(ll i=2;i<=n;i++){
        ll d=1;
        ll tmp=i;
        while(tmp>0){
            d++;
            while(tmp%d==0){
                prime[i]++;
                tmp/=i;
            }
        }
    }
    ll sum=1;
    for(ll i=2;;i<=n;i++){
        sum*=(prime[i]+1)/MOD;
    }    
    cout<<"sum="<<sum<<endl;

    return sum%MOD;
}
*/
/*--------------------------------------------*/
const int N=100010;
int main(){
    int n;cin>>n;
    vec a(n);
    vec b(n);
    vec c(n);
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    rep(i,n)cin>>c[i];
    //rep(i,n)cout<<b[i]<<endl;
    sort(ALL(a));sort(ALL(b));sort(ALL(c));
    //rep(i,n)cout<<b[i]<<endl;
    ll cnt=0;
    rep(i,n){
        int temp=b[i];
        //printf("temp=%d\n",temp);
        ll x=lower_bound(ALL(a),temp)-a.begin();
        //printf("x=%d\n",x);
        ll y=n-(upper_bound(ALL(c),temp)-c.begin());//tempを含めてはならないのでupper_bound関数
        //printf("y=%d\n",y);
        cnt+=x*y;
        //printf("cnt=%lld\n",cnt);
    }
    cout<<cnt<<endl;
}



Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
  
  
int main() {
  int h,w;
  cin >> h >> w ;
  string p = ""; rep(i,w+2) p += ".";
  vector<string> maze(h+2,p);
  for(int i=1;i<h+1;i++){
    string s;
    cin >> s;
    s = "."+s+".";
    maze.at(i) = s;
  }
  vector<vector<int>> ans(h,vector<int>(w,0));
  for(int i=1;i<h+1;i++){
    for(int j=1;j<w+1;j++){
      if(maze.at(i).at(j) == '#') ans.at(i-1).at(j-1) = -1;
      else{
        int k= 0;
        for(int x=i-1;x<=i+1;x++){
          for(int y=j-1;y<=j+1;y++){
            if(maze.at(x).at(y)=='#'){
              k ++;
            }
          }
        }
        ans.at(i-1).at(j-1) = k;
      }
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(ans.at(i).at(j) == -1){
        cout <<  "#" ;
      }else{
        cout << ans.at(i).at(j);
      }
    }
    cout << endl;
  }
}
  
              

  
  

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

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cins(int, n-1, b);
    ll ans = 0;
    For(i, n){
        if(i == 0) ans += b[0];
        else if(i == n-1) ans += b[n-2];
        else ans += min(b[i], b[i-1]);
    }
    Cout(ans);
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    long long N, cap[5], min=1000000000000000,ans;
    cin >> N;
    for(int i=0; i<5; i++){
        cin >> cap[i];
        if(cap[i]<min){
            min = cap[i];
        }
    }
    if(N%min == 0){
        ans = N/min + 4;
    }else{
        ans = N/min + 5;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())

H = list(map(int,input().split()))

H = H[::-1]

l = 0
cnt = 0
t = 0

while l < N - 1:
  if H[l] <= H[l+1]:
    cnt += 1
  else:
    t = max(t,cnt)
    cnt = 0
  l += 1

print(max(t,cnt))

Measured memory_bytes: 14224
#include<iostream>

using namespace std;

int log(int n){
  int log = 0;
  while(n%2==0){
    n /= 2;
    log++;
  }
  return log;
}

int main(){
  int N,i;
  int ans = 0;
  int A[111111];
  cin >> N;
  for(i=0;i<=N-1;i++)
    cin >> A[i];
  for(i=0;i<=N-1;i++)
    ans += log(A[i]);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;

int main(){
    long long N;
    cin >> N;
    vector<long long> x;

    for(long long i=1; i<=(long long) sqrt(N); i++){
        if(N%i==0){
            x.push_back(i);
        }
    }
    x.push_back(N);

    long long F;
    F=-1;
    for(long long A: x){
        long long B;
        B= N/A;
        double logA,logB,Fi;

        logA=log10(A);
        logB=log10(B);

        if(logA>=logB){
            Fi=logA;
        }else{
            Fi=logB;
        }

        //cout << "A B Fi " << A << " " << B << " " << Fi << endl;

        if(F<0){
            F=(long long) Fi;
        }else if(F> (long long) Fi){
            F=(long long) Fi;
        }
    }

    cout << F+1 << endl;

    return 0;
}


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

int main() {
	// your code goes here
	long long n;
	cin>>n;
	string s;
	cin>>s;
	long long a = (s[0]-'0')*100 + (s[2]-'0')*10 + (s[3]-'0');
	n *= a;
	cout<<n/100;
	return 0;
}

Measured memory_bytes: 3600
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>


#ifdef _DEBUG
#define typeof(X) std::identity<decltype(X)>::type //C++0x (for vs2010)
#else
#define typeof(X) __typeof__(X) // for gcc
#endif

#define sz(a)  int((a).size())
#define FOREACH(it, c) for (typeof((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define FOR(i,count) for (int i = 0; i < (int)(count); i++)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
const int MODULO = 100000 ;
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef complex<double> Cd;

using namespace std;


int main()
{
	int n;
	bool nw = false;
	while(cin>>n){
		if(nw) puts("");
		nw = true;
		int a[5];
		for(int i = 10000,j = 0; j < 5; i /= 10,j++) a[j] = (n / i) % 10;
		char c[6];
		FOR(j,5) c[j] = a[j]/5 ? ' ':'*';
		c[5] = '\0';
		puts(c);
		FOR(j,5) c[j] = a[j]/5 ? '*':' ';
		puts(c);
		puts("=====");
		FOR(i,5){
			FOR(j,5){
				putchar(a[j]%5 == i ? ' ':'*');
			}
			puts("");
		}
	}
	return 0;
}

Measured memory_bytes: 1116
<?php

fscanf(STDIN, '%d', $n);
$a = trim(fgets(STDIN));
$a_array = explode(' ', $a);

if(($n==1)&&($a_array[0]==0)){
echo 1;
return;
}
$unique_array = array_unique($a_array);
$count_values_array = array_count_values($a_array);
sort($unique_array);
$is_odd = $n % 2;


if ((count($unique_array) - $is_odd) * 2 + $is_odd !== $n) {
    echo 0;
    return;
}

($is_odd) ? $i = 0 : $i = 1;

foreach ($unique_array as $value) {

    if (($value != 0) && ($count_values_array[$value] != 2)) {
    echo 0;
        return;
    }
    if ($value != $i) {
    echo 0;
        return;
    }
    $i = $i + 2;
}

$herf = floor($n / 2);
$ans = 2;
$h = 1000000007;
for ($i = 1; $i < $herf; $i++) {
    $ans = $ans * 2 % $h;
}

echo $ans;


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

int main() {

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if ( a + b == c + d ){
    cout << "Balanced" << endl;
  }else if ( a + b > c + d ){
    cout << "Left" << endl;
  }else if( a + b < c + d ){
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,pos,iop;
vector<int> pre,in,post;
void rec(int l,int r){
  if(l>=r) return;
  int root=pre[pos++];
  int m=distance(in.begin(),find(in.begin(),in.end(),root));
  rec(l,m);
  rec(m+1,r);
  post.push_back(root);
}
void solve(){
  pos=0;
  rec(0,pre.size());
  REP(i,n){
    if(i) printf(" ");
    printf("%d",post[i]);
  }
  printf("\n");
}
int main(){
  int k;
  scanf("%d",&n);
  REP(i,n) {scanf("%d",&k);pre.push_back(k);}
  REP(i,n) {scanf("%d",&k);in.push_back(k);}
  solve();
  return 0;
}


Measured memory_bytes: 3276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

void primeFactor(ll val, map<ll,ll> &primeList){
  if(val<1){
    return;
  }
  for(int i=2;i*i<val;i++){
    while(val%i==0){
      primeList[i]++;
      val/=i;
    }
  }
  if(val!=1){
    primeList[val]=1;
  }
  return;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}

int n, m, q;
int a[50];
int b[50];
int c[50];
int d[50];

int f(int depth,int start, vector<int> g){
  int ret=0;
  if(depth==n){
    int sum=0;
    for(int i=0;i<q;i++){
      if(g[b[i]]-g[a[i]]==c[i]){
        sum+=d[i];
      }
    }
    return sum;
  }
  for(int i=start;i<=m;i++){
    g[depth]=i;
    int val=f(depth+1,i,g);
    ret=max(ret,val);
  }
  return ret;
}
int main() {
  cin >> n >> m >> q;
  for(int i=0;i<q;i++){
    cin>>a[i];a[i]--;
    cin>>b[i];b[i]--;
    cin>>c[i];
    cin>>d[i];
  }
  vector<int> g(11);
  int ans=f(0,1,g);
  cout<<ans<<endl;
  return 0;
}


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

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

using namespace std;

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

int Gcd(int a, int b) {
  if (a == 0) return b;
  if (b == 0) return a;
  assert(a != 0 && b != 0);
  return gcd(a, b);
}

class SegmentTree {
 public:
  SegmentTree(int size) {
    int two = 1;
    while (two < size) {
      two <<= 1;
    }
    v_.resize(two * 2 - 1);
  }
  void Add(int i, int v) {
    int index = v_.size() / 2 + i;
    while (true) {
      v_[index] = v;
      if (index == 0) break;
      v = Gcd(v, v_[index + (index % 2 == 0 ? -1 : 1)]);
      index = (index - 1) / 2;
    }
  }
  int Sum(int begin, int end) const {
    return sum(begin, end, 0, (v_.size() + 1) / 2, 0);
  }
  int sum(int begin, int end, int cbegin, int cend, int index) const {
    if (begin <= cbegin && cend <= end) {
      return v_[index];
    }
    if (cend <= begin || end <= cbegin) {
      return 0;
    }
    int cmid = (cbegin + cend) / 2;
    return Gcd(sum(begin, end, cbegin, cmid, index * 2 + 1),
               sum(begin, end, cmid, cend, index * 2 + 2));
  }
  std::vector<int> v_;
};

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  REP(i, N) cin >> A[i];

  SegmentTree t(N);
  REP(i, N) {
    t.Add(i, A[i]);
  }

  int ans = 0;
  REP(i, N) {
    ans = max(ans, Gcd(t.Sum(0, i), t.Sum(i + 1, N)));
  }
  cout << ans << endl;
}


Measured memory_bytes: 1664
/* Author darklight13 -_- 
   IIT Patna 
*/
#define _CRT_SECURE_NO_DEPRECATE
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#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;
#define int long long int
#define SYNC std::ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
typedef long double ld;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii>   vii;
//typedef tree<int, null_type, less<int>, rb_tree_tag, 
//             tree_order_statistics_node_update> 
//    data_set;
#define rep(i,l,r)   for(int i=(l);i<(r);i++)
#define deb(x)     cout << (#x) << " is " << (x) << endl
#define dbg(x)     cout << x << ' '
#define here cout << " Hey baitch!!\n";
#define  pb push_back
#define  F  first
#define  S  second
#define all(v) (v).begin(),(v).end()
#define sz(a) (int)((a).size())
#define sq(x) ((x)*(x))
const int MOD = 1e9+7;
const int MOD1 = 998244353;
const int N = 2e5+5;
const int INF = 1000111000111000111LL;
const ld PI = 3.1415926535898;
int n,dp[3005][3005];
vi a;
int play(int l, int r) {
	if(dp[l][r] != -1)	return dp[l][r];
	if(l > r)	return 0;
	if(l==r) {
		dp[l][r] = a[l];
		return a[l];
	}
	int res = max(a[l]-play(l+1,r),a[r]-play(l,r-1));
	dp[l][r] = res;
	return res;
}
int32_t main()
{
	SYNC
	cin >> n;
	memset(dp,-1,sizeof dp);
	a.resize(n);
	for(int &x : a)	cin >> x;
	cout << play(0,n-1);
    return 0;
}

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

typedef long long ll;

int n, t;
string s;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    bool flag = true;
    cin >> s;
    cin >> n;
    string h = "";
    for (int i = 0; i < n; ++i) {
        cin >> t;
        if (t == 1) {
            flag = !flag;
        } else if (t == 2) {
            int f;
            bool b;
            char c;
            cin >> f >> c;
            if (f == 1)
                b = true;
            else
                b = false;
            b ^= flag;
            if (b) {
                s += c;
            } else {
                h += c;
            }
        }
    }
    reverse(h.begin(), h.end());
    h += s;
    if (!flag) {
        reverse(h.begin(), h.end());
    }
    cout << h << endl;

    return 0;
}



Measured memory_bytes: 1144
import numpy as np
N = int(input())
total = []
dp = np.zeros((N,3), dtype = int)
for i in range(N):
  tmp = list(map(int,input().split()))
  if i == 0:
    dp[i][0] = tmp[0]
    dp[i][1] = tmp[1]
    dp[i][2] = tmp[2]
  else:
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + tmp[0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + tmp[1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + tmp[2]
print(max(dp[N-1]))


Measured memory_bytes: 16580
#include <bits/stdc++.h>
//#include<tr1/unordered_map>
//#include"Bignum/bignum.h"
//#define lll bignum
#define ls(x) ( x << 1 )
#define rs(x) ( x << 1 | 1 )
//#define mid ( ( l + r ) >> 1 )
#define lowbit(x) ( x & -x )
#define debug(x) (cout << "#x = " << (x) << endl)
#define Set(x, i) memset (x, i, sizeof(x))
#define re register
#define For(i, j, k) for(re int i = (j); i <= (k); ++i)
#define foR(i, j, k) for(re int i = (j); i >= (k); --i)
#define Cross(i, j, k) for(re int i = (j); i; i = (k))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll N = 1011;
const ll inf = 0x3f3f3f3f3f3f;
const ll dx[] = { 1, -1, 0, 0 };
const ll dy[] = { 0, 0, 1, -1 };

char A[N][N]; 
ll H, W, mp[N][N];

namespace IO {

	#define dd ch = getchar()
	inline ll read() {
		ll x = 0; bool f = 0; char dd;
		for (; !isdigit (ch); dd) f ^= (ch == '-');
		for (; isdigit (ch); dd)  x = (x << 3) + (x << 1) + (ch ^ 48);
		return f? -x: x;
	}
	#undef dd

	inline void write( ll x ) {
		if ( x < 0 ) putchar ('-'), x = -x;
		if ( x > 9 ) write ( x / 10 ); putchar ( x % 10 | 48 );
	}

	inline void wrn ( ll x ) { write (x); putchar (' '); }

	inline void wln ( ll x ) { write (x); putchar ('\n'); }

	inline void wlnn ( ll x, ll y ) { wrn (x), wln (y); }

}

using namespace IO;

inline bool Check () {
	For ( i, 1, H ) For ( j, 1, W )
		if ( !mp[i][j] ) return 0; return 1;
}

struct Node {
	ll x, y, Step;
};

int main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	queue < Node > Q;
	H = read(), W = read();
	For ( i, 1, H ) For ( j, 1, W ) {
		cin >> A[i][j];
		if ( A[i][j] == '.' ) mp[i][j] = 0;
		if ( A[i][j] == '#' ) mp[i][j] = 1, Q.push ( (Node) { i, j, 0 } );
	}
	ll cnt = 0;
	if ( Check () ) return puts ("0"), 0;
	while ( !Q.empty() ) {
		cnt = Q.front().Step;
		Node t = Q.front(); Q.pop();
		For ( i, 0, 3 ) {
			ll nx, ny;
			nx = t.x + dx[i], 
			ny = t.y + dy[i];
			if ( mp[nx][ny] ) continue;
			if ( nx > H || ny > W || nx <= 0 || ny <= 0 ) continue;
			mp[nx][ny] = 1; Q.push ( (Node) { nx, ny, cnt + 1 } );
		}
	} return wln (cnt), 0;
}

/*

*/



Measured memory_bytes: 33460
import math
 
h,n=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n):
    a[i],b[i]=list(map(int,input().split()))
 
 
dp=[[0 for j in range(h+1)] for i in range(n)]
for j in range(h+1):
    dp[0][j]=math.ceil(j/a[0])*b[0]
for i in range(n-1):
    for j in range(h+1):
        if j<a[i+1]: dp[i+1][j]=min(dp[i][j],b[i+1])
        else:dp[i+1][j]=min(dp[i][j],dp[i+1][j-a[i+1]]+b[i+1])
print(dp[n-1][h])

Measured memory_bytes: 211464
def main():
    N=int(input())
    S=input()
    p=int(len(S)/2)
    if len(S) % 2 == 0:
        if S[0:p] == S[p:]:
            print('Yes')
            return
        else:
            print('No')
            return
    else:
        print('No')
        return
main()

Measured memory_bytes: 9040
using System;
class Program
{
	static void Main(string[] args)
	{
		// 文字列の入力
		string s = Console.ReadLine();

		if (s.Substring(s.Length - 1) == "s")
			Console.WriteLine(s + "es");
		else
			Console.WriteLine(s + "s");
	}
}

Measured memory_bytes: 25900
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	LL l=-1,r=-1,n,k,a[100010]={},b[100010]={};
	cin>>n>>k;
	FORQ(i,1,n){
		cin>>b[i];
		a[i]=b[i];
	}
	a[0]=0;b[0]=0;
	FORQ(i,1,n)a[i]=a[i]+a[i-1];
	FORQ(i,1,n){
		b[i]=max(b[i-1],b[i-1]+b[i]);
	}
	LL mx=0;
	FOR(i,0,n-k+1){
		int p=i+1,q=p+k-1;
		LL tmp=b[n]-b[q]+b[p-1]-b[0];
		mx=max(mx,tmp);
		tmp+=a[q]-a[p-1];
		mx=max(mx,tmp);

	}
	cout<<mx;
    return 0;
}


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


int main(){

    int N,M,C;

    cin >> N >> M >> C;

    int B[M];
    for(int i=0;i<M;i++){
        cin >> B[i];
    }

    int count = 0;
    for(int i=0;i<N;i++){
        int A[M];
        int sum = 0;
        for(int j=0;j<M;j++){
            cin >> A[j];
            sum += A[j]*B[j];
        }
        sum += C;
        if(sum>0){count++;}
    }
    
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

#include <string.h>

using namespace std;

//Compiler version g++ 6.3.0

int main()

{

    char a[6];

    int k=0;

    cin>>a;

    

    for(int b=0;b<6;b++){

      if(a[b]>='a' && a[b]<='z')

      k++;

      else k=k+0;

    }

    

    if(k==6 && (a[2]==a[3]) && (a[4]==a[5]))

    cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#define N 200
#define INF 10000000
using namespace std;

int n,m[N][N],t;
queue<pair<int,int> > q;

int bfs(){
  int cnt=1,cntt=0,d[N][N]={};
  int x[6]={1,1,0,-1,-1,0},y[6]={1,0,-1,-1,0,1};
  pair<int,int> map,mapa;
   while(!q.empty()){
        map=q.front(),q.pop();
    for(int i=0;i<6;i++){
        mapa=make_pair(map.first+x[i],map.second+y[i]);
	if(m[mapa.first][mapa.second]==INF) d[mapa.first][mapa.second]=d[map.first][map.second]+1;
      if(m[mapa.first][mapa.second]!=INF|| m[mapa.first][mapa.second]==-1 || d[mapa.first][mapa.second]>t)continue;
		q.push(mapa),m[mapa.first][mapa.second]=1,cnt++;
    }
    cntt++;
  }
  return cnt;
}
 
int main(){
  pair<int,int>  map;
  int x,y,ans;
  while(1){
   for(int i=0;i<N;i++)
    for(int j=0;j<N;j++) m[i][j]=INF;
      cin>>t>>n;
      if(t+n==0) break;
    for(int i=0;i<n;i++){
      cin>>x>>y;
      m[100+x][100+y]=-1;
    }
    cin>>x>>y;
    m[100+x][100+y]=1;
      map=make_pair(100+x,100+y);
     q.push(map);
     ans=bfs();
     cout<<ans<<endl;
  }
   return 0;
}

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

using namespace std;

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;

const int N = (int) 1e5 + 7;
int n, a[N], b[N], c[N];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i] >> c[i];
    a[i] += max(b[i - 1], c[i - 1]);
    b[i] += max(a[i - 1], c[i - 1]);
    c[i] += max(a[i - 1], b[i - 1]);
  }
  cout << max(max(a[n], b[n]), c[n]) << "\n";
  return 0;
}


Measured memory_bytes: 1408