akhauriyash/Code-Regression huggingface dataset:
while True:
	da,op,db = map(str,input().split())
	if op=='?':
		break
	a = int(da)
	b = int(db)
	if op=='+':
		print(a+b)
	elif op=='-':
		print(a-b)
	elif op=='*':
		print(a*b)
	else:
		print(a//b)


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

M=N//7

flag=0
for i in range(M+1):
  #print(N-i*7)
  if (N-i*7)%4==0:
    flag=1
    break
else:
  if N==4 or N==7:
    flag=1

print('Yes' if flag==1 else 'No')

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

int main() {
  string s;
  cin >> s;
  
  int x = 0;
  
  if (s[0] == '1') x++;
  if (s[1] == '1') x++;
  if (s[2] == '1') x++;
  
  cout << x << endl;
}  


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

using namespace std;

int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  if ((!a || !b) || (a < 0 && b > 0)) {
    puts("Zero");
  } else if (a > 0 && b > 0) {
    puts("Positive");
  } else {
    (a + b) % 2 ? puts("Positive") : puts("Negative");
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vc= vector<char>;
#define REP(i,x,n) for(int i=x; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()


int main(){
  int n,ans=1;
  char st;
  cin >> n;
  vc s(n);
  rep(i,n)  cin >> s[i];

  st=s[0];
  REP(i,1,n){
    if(st==s[i]){
      
    }else{
      ans++;
      st= s[i];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef		long long       ll;
typedef         long double      dl;
typedef     unsigned long long  ull;
#define		pb              push_back
#define		PB              pop_back
#define		nn              "\n"
#define     O_O             ios_base::sync_with_stdio(false); cin.tie(NULL)
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define		ss              ' '
#define	       MEM(a,b)         memset(a,(b),sizeof(a))
#define	       CLR(p)           memset(p,0,sizeof(p))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
#define         arrsize(a)      (sizeof(a)/sizeof(a[0]))
//#define       arrsize(a)      (sizeof(a)/sizeof(*a))
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
#define		pi              acos(-1.0)
#define	       ff               first
#define	       sc              second
typedef        pair <int, int>   pii;
typedef       pair <ll, ll>      pll;
typedef      vector< pair <ll, ll> >      vpll;
typedef		vector<ll>      vll;
typedef		map<string,ll>      msl;
typedef		map<ll,ll>      mll;
#define yes cout << "YES\n"
#define no cout<<"NO\n"
//memset(ar,-1,sizeof(ar));
//#define sort(x) sort(x.begin(), x.end())
//sort(a,a+n,greater<ll>())
//for (auto it = mp.begin(); it != mp.end(); ++it){}
// string x(w.size(),'1');
#define MAX 1000005
#define precision(a) fixed << setprecision(a)

#define mod 1000000007

ll ar[MAX],br[MAX];

int main()
{
 //O_O ;
ll n;cin>>n;
ll c=0,x=0;
for(ll i=0;i<n;i++)
{
   cin>>ar[i]>>br[i];

}
for(ll i=0;i<n;i++)
{
   if(ar[i]==br[i])
    c++;
    else
        c=0;
   if(c>2)
   {
       cout<<"Yes"<<nn;
       return 0;
   }


}

cout<<"No"<<nn;


    return 0;
}


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

using namespace std;

int main(void)
{
    unsigned long long int a, b, n;
    cin >> a >> b >> n;
    unsigned long long int x = b - 1 < n ? b - 1: n;
    cout << (a * x) / b - a * (x / b) << endl;
    return 0;
} 

Measured memory_bytes: 3652
import heapq
N, M = map(int, input().split())
work = [0] * N
for i in range(N):
    work[i] = [0] * 2
    a, b = map(int, input().split())
    if M-a >= 0:
        work[i][0], work[i][1] = a, -1 * b
    else:
        work[i][0], work[i][1] = 10**9, -1 * b
ans = 0
work_day = sorted(work)
index = 0
heap = []
heapq.heapify(heap)
for j in range(M+1):
    if index >= N:
        if len(heap) > 0:
            ans += heapq.heappop(heap)*(-1)
        continue
    while (work_day[index][0] <= j):
        heapq.heappush(heap, work_day[index][1])
        index += 1
        if index >= N:
            break
    if len(heap) > 0:
        ans += heapq.heappop(heap)*(-1)


print(ans)


Measured memory_bytes: 21548
n,W=map(int,input().split())
items=[list(map(int,input().split())) for i in range(n)]
weight=[items[i][0] for i in range(n)]
value=[items[i][1] for i in range(n)]

limit=sum(value)
inf=10**9
dp=[[0]+[inf]*limit for i in range(n+1)]
#print(dp)
for i in range(n):
  w=weight[i]
  v=value[i]
  for j in range(limit+1):
    if j>=v:
      dp[i+1][j]=min(dp[i][j],dp[i][j-v]+w)
    else:
      dp[i+1][j]=min(dp[i][j],w)
#print(dp[n])
ans=max([i for i in range(limit+1) if dp[n][i]<=W])
print(ans)

Measured memory_bytes: 137500
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sstream> //C++
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
#include <map> //C++

using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)



/*
int N, i;
int H[100];
scanf("%d", &N);
for (i = 0; i < N; i++) scanf("%s", &H[i]);
*/



int main()
{
	
	int n, k, d[101], a;

	cin >> n >> k;
	int i,j;
	int count[101];

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

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

		cin >> d[i];
		
		for (j = 1; j <= d[i]; j++) {

			cin >> a;

			count[a] = 1;
		}

	
	}
	int c = 0;
	for (i = 1; i <= n; i++) {
		if (count[i] == 0) {
			c++;
		}

	}

	cout << c;






	

}

Measured memory_bytes: 3636
import java.util.Scanner;

	public class Main {
		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);

			int n = sc.nextInt();
			int[][] d = new int[n][2];
			int count = 0;
			boolean ans=false;
			for(int i=0;i<n;i++) {
				d[i][0] = sc.nextInt();
				d[i][1] = sc.nextInt();
			}

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

				if(d[i][0]==d[i][1]) {
					count++;
				}else {
					count=0;
				}if(count >= 3) {
					ans=true;}
			}
			if(ans) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}


		}
	}

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

using namespace std;



int main(){
  
 int n;
 cin>>n;
 int k;
  cin>>k;
  
 vector<int> a;
  
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    
   a.push_back(x);
    
    
  }
  

  int dp[n];

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

      dp[i]=INT_MAX;

  }

    dp[0]=0;


  for(int i=0;i<n-1;i++){
	
    for(int j=i+1;j<=i+k;j++){
      
      if(j<n){
        dp[j]=min(dp[j],dp[i]+abs(a[j]-a[i]));
      }else{
       break;
        
      }
      
      
    }
     
  }

  cout<<dp[n-1];

  
  
 return 0;
  
  
}



Measured memory_bytes: 1272
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;
int deco[1000];

ll res[11];
void Sequence() {
	ll H, W, N;
	cin >> H >> W >> N;
	map<pii, ll> m;
	res[0] = (W - 2) * (H - 2);
	int d[3] = { -2, -1,0};
	for (size_t i = 0; i < N; i++)
	{
		ll a, b;
		cin >> a >> b;
		a--;
		b--;
		for (size_t x = 0; x < 3; x++)
		{
			for (size_t j = 0; j < 3; j++)
			{
				int nx = a + d[x];
				int ny = b + d[j];
				if (nx < 0 || ny < 0 || (nx + 2) >= H || (ny + 2) >= W) continue;
				ll v = ++m[pii(nx, ny)];
				res[v - 1]--;
				res[v]++;
			}
		}
	}

	for (size_t i = 0 ; i < 10; i++)
	{
		cout << res[i] << endl;
	}
}
int main() {
	Sequence();
	return 0;
}



Measured memory_bytes: 56448
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 1000000000000000007LL;
constexpr int inf = 1000000007;

// 切り上げ割り算
template <typename T>
T ceil_div(T a, T b) {
    return a > 0 && b > 0
        ? (a + b - 1) / b
        : a < 0 && b < 0
        ? a / b + ((-a % -b) != 0)
        : a / b;
}

int main() {
    ll n, k; cin >> n >> k;
    vector<ll> a(n);
    for (int i = 0; i < n ; ++i) cin >> a[i];
    sort(a.begin(), a.end());
    ll l = -1000000000000000000LL;
    ll r = -l;
    while (r - l > 1) {
        ll cur = (l + r) / 2;
        ll cnt = 0;
        for (int i = 0; i < n; ++i) {
            if (a[i] != 0) {
                if (a[i] > 0) {
                    ll div = cur / a[i];
                    ll idx = upper_bound(a.begin() + i + 1, a.end(), div) - a.begin();
                    cnt += max(idx - i - 1, 0LL);
                }
                else {
                    ll div = ceil_div(cur, a[i]);
                    ll idx = lower_bound(a.begin() + i + 1, a.end(), div) - a.begin();
                    cnt += n - max(idx, (ll)(i + 1));
                    if (idx <= i) cnt -= 1;
                }
            }
            else {
                if (cur >= 0) cnt += n - i - 1;
            }
        }

        if (cnt >= k) r = cur;
        else l = cur;
    }
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 1920
def main():
  N = int(input())
  M = int(N/10) * 10
  N -= M
  if N == 3:
    print('bon')
  elif N == 0 or N == 1 or N == 6 or N == 8:
    print('pon')
  else:
    print('hon')
    

if __name__ == '__main__':
  main()


Measured memory_bytes: 9164
import java.util.Scanner;

public class Main{
	public static void moveNorth(int[] num){
		int temp1 = num[0];
		int temp2 = num[1];
		int temp3 = num[5];
		int temp4 = num[3];
		num[0] = temp4;
		num[3] = temp3;
		num[5] = temp2;
		num[1] = temp1;
	}
	
	public static void moveSouth(int[] num){
		int temp1 = num[0];
		int temp2 = num[3];
		int temp3 = num[5];
		int temp4 = num[1];
		num[0] = temp4;
		num[1] = temp3;
		num[5] = temp2;
		num[3] = temp1;
	}
	
	public static void moveEast(int[] num){
		int temp1 = num[0];
		int temp2 = num[2];
		int temp3 = num[5];
		int temp4 = num[4];
		num[0] = temp4;
		num[4] = temp3;
		num[5] = temp2;
		num[2] = temp1;
	}
	
	public static void moveWest(int[] num){
		int temp1 = num[0];
		int temp2 = num[4];
		int temp3 = num[5];
		int temp4 = num[2];
		num[0] = temp4;
		num[2] = temp3;
		num[5] = temp2;
		num[4] = temp1;
	}
	
	public static void moveRight(int[] num){
		int temp1 = num[1];
		int temp2 = num[2];
		int temp3 = num[3];
		int temp4 = num[4];
		num[1] = temp4;
		num[4] = temp3;
		num[3] = temp2;
		num[2] = temp1;
	}
	
	public static void moveLeft(int[] num){
		int temp1 = num[1];
		int temp2 = num[4];
		int temp3 = num[3];
		int temp4 = num[2];
		num[1] = temp4;
		num[2] = temp3;
		num[3] = temp2;
		num[4] = temp1;
	}

	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] num = new int[6];
		//ceil = 0; north = 1; east = 2; south = 3; west = 4; floor = 5;
		
		int[] result = new int[1000];
		int index = 0;
		while( n != 0 ){
			String[] direct = new String[n];
			int sum = 1;
			num[0] = 1; num[1] = 5;	num[2] = 3; num[3] = 2;	num[4] = 4; num[5] = 6;
			for(int i = 0; i < n; i++){
				direct[i] = stdIn.next();
				if( direct[i].equals("North") ){
					moveNorth(num);
				} else if( direct[i].equals("East") ){
					 moveEast(num);
				} else if( direct[i].equals("South") ){
					moveSouth(num);
				} else if( direct[i].equals("West") ){
					moveWest(num);
				} else if( direct[i].equals("Right") ){
					moveRight(num);
				} else {
					moveLeft(num);
				}
				sum += num[0];
			}
			result[index] = sum;
			index++;
			n = stdIn.nextInt();
		}
		
		for(int i = 0; i < index; i++){
			System.out.println(result[i]);
		}
	}
}

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

int main(){
  int a,b;
  cin >> a >> b;
  int sa=b-a;

  int sum=0;
  for(int i=0;i<sa;i++){
    sum+=i;
  }

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

Measured memory_bytes: 256
#include <stdio.h>
#define MAX_INPUT 100000
typedef struct point{
    int x, y;
    bool operator<(const struct point &X) const{
        if (y != X.y) return y < X.y;
        return x < X.x;
    };
} Point;
Point P[MAX_INPUT], T[MAX_INPUT], L[MAX_INPUT], R[MAX_INPUT];
int N;
void input(void);
void msort(int s, int e);
int ccw(Point O, Point A, Point B){ return (A.x - O.x) * (B.y - O.y) - (A.y - O.y) * (B.x - O.x);};
void MC(void);
int main(void){
    //freopen("in.txt", "r", stdin);
    input();
    msort(0, N - 1);
    MC();
    return 0;
}
void MC(void){
    R[0] = P[0]; R[1] = P[1];
    int i, cntR = 2, cntL = 2;
    for (i = 2; i < N; i++){
        while (cntR >= 2 && ccw(P[i], R[cntR - 1], R[cntR - 2]) > 0) cntR--;
        R[cntR++] = P[i];
    }
    L[0] = P[N - 1]; L[1] = P[N - 2];
    for(i = N - 3; i >= 0; i--){
        while (cntL >= 2 && ccw(P[i], L[cntL - 1], L[cntL - 2]) > 0) cntL--;
        L[cntL++] = P[i];
    }
    printf("%d\n", cntR + cntL - 2);
    for(i = 0; i < cntR; i++) printf("%d %d\n", R[i].x, R[i].y);
    for(i = 1; i < cntL - 1; i++) printf("%d %d\n", L[i].x, L[i].y);
}
void msort(int s, int e){
    if(s >= e) return;
    int m = s + (e - s) /2;
    msort(s, m);
    msort(m + 1 , e);
    int i = s, j = m + 1, k = s;
    while (i <= m || j <= e){
        if (j > e || (i <= m && P[i] < P[j]))
            T[k++] = P[i++];
        else
            T[k++] = P[j++];
    }
    for(i = s; i <= e; i++) P[i] = T[i];
}
void input(void){
    scanf("%d", &N);
    for (int i = 0; i < N; i++) scanf("%d%d", &P[i].x, &P[i].y);
}

Measured memory_bytes: 4568
#include<cmath>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string.h>
#define lowbit(x) (x)&(-x)
using namespace std;
int n,k,q,c[100010];
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
void add(int x,int k)
{
	for (int i=x; i<=n; i+=lowbit(i))
		c[i]+=k;
}
int sum(int x)
{
	int ans=0;
	for (int i=x; i>0; i-=lowbit(i))
		ans+=c[i];
	return ans;
}
int main()
{
	n=read(),k=read(),q=read();
	for(int i=1; i<=q; i++)
	{
		int a=read();
		add(1,-1),add(a,1);
		add(a+1,-1);
	}
//	for(int i=1; i<=n; i++)
//		cout<<sum(i)<<' ';
	for(int i=1; i<=n; i++)
		if(sum(i)>-k)
			puts("Yes");
		else
			puts("No");
	return 0;
}

Measured memory_bytes: 1024
#include <cassert>
#include <utility>

template <class Abelian, template <class T> class Container>
class potentialized_union_find {
	class node_type;

public:
	using value_structure = Abelian;
	using value_type = typename value_structure::value_type;
	using container_type = Container<node_type>;
	using size_type = typename container_type::size_type;

protected:
	value_structure vfo;
	container_type c;

private:
	class node_type {
	public:
		typename potentialized_union_find::size_type par, siz;
		typename potentialized_union_find::value_type val;
	};
	value_type potential(size_type x) {
		value_type ret = vfo.identity();
		while (x != c[x].par) {
			c[x].val = vfo(c[x].val, c[c[x].par].val);
			ret = vfo(ret, c[x].val);
			x = c[x].par = c[c[x].par].par;
		}
		return ::std::move(ret);
	}

public:
	potentialized_union_find() : vfo(), c() {}
	explicit potentialized_union_find(
		const size_type size, const value_structure &x = value_structure())
		: vfo(x), c(size, { 0, 1, vfo.identity() }) {
		for (size_type i = 0; i < size; ++i) {
			c[i].par = i;
		}
	}

	size_type size() const { return c.size(); }
	bool empty() const { return c.empty(); }

	size_type find(size_type x) {
		assert(x < size());
		while (x != c[x].par) {
			c[x].val = vfo(c[x].val, c[c[x].par].val);
			x = c[x].par = c[c[x].par].par;
		}
		return x;
	}
	value_type diff(const size_type x, const size_type y) {
		assert(x < size());
		assert(y < size());
		assert(same(x, y));
		return vfo(potential(y), vfo.inverse(potential(x)));
	}
	bool same(const size_type x, const size_type y) {
		assert(x < size());
		assert(y < size());
		return find(x) == find(y);
	}
	size_type size(const size_type x) {
		assert(x < size());
		return c[find(x)].siz;
	}

	::std::pair<size_type, size_type> unite(size_type x, size_type y,
		value_type d) {
		assert(x < size());
		assert(y < size());
		d = vfo(vfo(d, potential(x)), vfo.inverse(potential(y)));
		x = find(x);
		y = find(y);
		if (x != y) {
			if (c[x].siz < c[y].siz) {
				::std::swap(x, y);
				d = vfo.inverse(d);
			}
			c[x].siz += c[y].siz;
			c[y].par = x;
			c[y].val = ::std::move(d);
		}
		return ::std::pair<size_type, size_type>(x, y);
	}
};

template <class T> class plus_abelian {
public:
	using value_type = T;
	value_type operator()(const value_type &x, const value_type &y) const {
		return x + y;
	}
	value_type identity() const { return value_type(0); }
	value_type inverse(const value_type &x) { return -x; }
	value_type reverse(const value_type &x) const { return x; }
};

#include<iostream>
#include<vector>
template<class T>
using vec = ::std::vector<T>;

int main() {
	int n, m;
	::std::cin >> n >> m;
	potentialized_union_find<plus_abelian<int>, vec> T(n);
	while (m--) {
		int l, r, d;
		::std::cin >> l >> r >> d;
		--l;
		--r;
		if (T.same(l, r) && T.diff(l, r) != d) {
			::std::cout << "No" << ::std::endl;
			return 0;
		}
		else {
			T.unite(l, r, d);
		}
	}
	::std::cout << "Yes" << ::std::endl;
	return 0;
}


Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fi first
#define se second 
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define pp pair<ll,ll> 
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t = 1;
void solve() 
{
	ll a, b;
	cin>>a>>b;
	ll g = __gcd(a,b) ;
	cout << a*(b/g) << "\n";
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cin >> t ;
    while(t--){
        solve();
    }
    return 0 ;
}


Measured memory_bytes: 256
N = int(input())
S = [input() for _ in range(N)]

ac = str(S.count("AC"))
wa = str(S.count("WA"))
tle = str(S.count("TLE"))
re = str(S.count("RE"))

print("AC x " + ac)
print("WA x " + wa)
print("TLE x " + tle)
print("RE x " + re)

Measured memory_bytes: 16172
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int c=-1;
	for(int i=0;i<s.length();i++) if(s[i]=='C')
	{
		c=i;
		break;
	}
	if(c==-1)
	{
		puts("No");
		return 0;
	}
	for(int i=c+1;i<s.length();i++) if(s[i]=='F')
	{
		puts("Yes");
		return 0;
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

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




/******************************************************************************************/

ll sum[200005];


int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

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

	for (int i = 1; i <= n; i++)
	{
		sum[i] = sum[i - 1] + a[i - 1];
	}
	
	ll ans = 1LL << 60;


	int left = 1, center = 2,right = 3;
	while(center < n - 1)
	{

		while (left < center -1) {
			if (abs(sum[left] - (sum[center] - sum[left])) > abs(sum[left + 1] - (sum[center] - sum[left + 1]))) {
				left++;
			}
			else
			{
				break;
			}
		}
		
		while (right < n) {
			if (abs(sum[n] - sum[right] - (sum[right] - sum[center])) > abs(sum[n] - sum[right + 1] - (sum[right + 1] - sum[center]))) {
				right++;
			}
			else
			{
				break;
			}
		}

		ll mini = min(min(sum[left], sum[center] - sum[left]), min(sum[right] - sum[center], sum[n] - sum[right]));
		ll maxi = max(max(sum[left], sum[center] - sum[left]), max(sum[right] - sum[center], sum[n] - sum[right]));
		ans = min(ans, maxi - mini);
		center++;
	}

	cout << ans << endl;


	return 0;
}


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

int main() {
    int n;
    cin >> n;
    ll ans = 0;
    vector<ll> calc;
    REP(i, n+1) {
        if(i == 0) calc.push_back(2);
        else if(i == 1) calc.push_back(1);
        else {
            calc.push_back(calc[i-1] + calc[i-2]);
        }
    }
    cout << calc.back() << endl;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
//--
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstdio>
#include<cstring>
#include<sstream>
#include<complex>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = Y-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

#define re real()
#define im imag()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef complex<double> pt;
typedef pair<pt,pt> line; //sX+tY

double dot(pt a,pt b){return (conj(a)*b).real();}
double cros(pt a,pt b){return (conj(a)*b).imag();}
pt proj(pt a,pt to){
  return dot(a,to)/norm(to)*to;
}

pt refle(pt a,pt mirror){
  return pt(2)*proj(a,mirror)-a;
}

int pt3(pt a,pt b,pt c){
  pt p=b-a,q=c-a;
  double tmp;
  tmp=cros(p,q);
  if(tmp>0){
    return 0;
  }else if(tmp<0){
    return 1;
  }else if(norm(p+q)<max(norm(p),norm(q))){
    return 2;
  }else if(norm(q)>norm(p)){
    return 3;
  }else if(norm(q)<norm(p)){
    return 4;
  }
  return 5;
}

pt dir(line a){return a.Y-a.X;}

int line2(line a,line b){
  
  if(dot(dir(a),dir(b))==0)
    return 1;//直交
  if(cros(dir(a),dir(b))==0)
    return 2;//平行
  return 0;
}

int main(){
  int i,j,k,n,re;
  line s1,s2;
  double a[8];
  cin>>n;
  rep(i,n){
    rep(j,8)
      cin>>a[j];
    s1.X=pt(a[0],a[1]);
    s1.Y=pt(a[2],a[3]);
    s2.X=pt(a[0+4],a[1+4]);
    s2.Y=pt(a[2+4],a[4+3]);
    cout<<line2(s1,s2)<<endl;
  }
  return 0;
}

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

typedef long long unsigned ll;

map<int,int> mmap;
int main(){

    //freopen("test.in","r",stdin);

    int n,tmp;
    cin>>n;

    for(int i=0;i<n;i++){
        cin>>tmp;
        mmap[tmp]++;

    }

    //map<int, int>::iterator iter;

    vector<int> cot;
    for(auto iter = mmap.begin();iter!=mmap.end();iter++){
            //cout<<(iter->first)<<' '<<(iter—>second)<<endl;
        tmp=iter->second;
        if(tmp >=2 ) cot.push_back(tmp);
    }

    int two_ct,ct;

    two_ct=ct=0;
    for(int i=0;i<cot.size();i++){
        while(cot[i]>2){
            cot[i]-=2;
            ct++;
        }
        if(cot[i]==2) two_ct++;
    }

    ct+= two_ct/2 + two_ct%2;

    cout<<n-ct*2<<endl;


    return 0;
}


Measured memory_bytes: 4992
#include<stdio.h>
int main(){
  char s[10]={0};
  int f[30]={0};
  printf("?a\n");
  while(1){
    fflush(stdout);
    scanf("%s",s);
    if(s[1]==0||f[s[1]-'a']||s[2]||s[0]-'a')break;
    f[s[1]-'a']=1;
    printf("?%caa\n",s[1]);
  }
  printf("!OUT\n");
  fflush(stdout);
  return 0;
}

Measured memory_bytes: 1264
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        
        int n = Integer.parseInt(str);
        
        str = br.readLine();
        String[] temp = str.split("\\s");
        int[] Suretu = new int[n];
        
        for(int i=0;i<n;i++){
            Suretu[i]=Integer.parseInt(temp[i]);
        }
        
        //Arrays.sort(Suretu);
        
        StringBuilder output = new StringBuilder();
        for(int i= n-1;i>=0;i--){
            if(i != 0){
            output.append(Suretu[i]);
            output.append(" ");
            }else{
            output.append(Suretu[i]);
            }
        }
        System.out.println(output.toString());
    }
}

Measured memory_bytes: 24440
#include <algorithm>
#include <array>
#include <iostream>
#include <unordered_map>

std::array<int, 11> ns, cs, minn;
std::array<std::unordered_map<int, int>, 11> cache;

int f(int i, int rn) {
    if (i == 1) {
        if (ns[1] < rn) return -1;
        int p = rn;
        if (ns[1] == rn) p += cs[1];
        return p;
    }
    if (rn < minn[i]) {
        int p = 0;
        for (; i > 0; --i) {
            int n = std::min(ns[i], rn);
            p += i * n;
            if (n == rn) break;
            rn -= n;
        }
        return p;
    }
    int maxp = 0;
    for (int n = 0; n <= std::min(ns[i], rn); ++n) {
        int p = i * n;
        if (n == ns[i]) p += cs[i];
        int np;
        int nn = rn - n;
        auto& cch = cache[i - 1];
        auto itr = cch.find(nn);
        if (itr != cch.end()) {
            np = itr->second;
        } else {
            np = f(i - 1, nn);
            cch[nn] = np;
        }

        if (np >= 0) {
            p += np;
            if (maxp < p) maxp = p;
        }
    }
    return maxp;
}

int main() {
    int D, G;
    std::cin >> D >> G;
    G = G / 100;
    int sumn = 0;
    for (int i = 1; i <= D; ++i) {
        int n, c;
        std::cin >> n >> c;
        ns[i] = n;
        cs[i] = c / 100;
        sumn += n;
    }

    auto nsb = ns.begin() + 1;
    for (int i = 1; i <= D; ++i) {
        minn[i] = *std::min_element(nsb, nsb + i);
    }

    int mn = 1;
    int mx = sumn;
    while (mn < mx) {
        int x = mn + ((mx - mn) / 2);
        if (G <= f(D, x)) {
            mx = x;
        } else {
            mn = x + 1;
        }
    }
    std::cout << mn << std::endl;
}


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

int main(){
    int X;
    cin >> X;
    int x = X / 500;
    int y = (X % 500) / 5;
    cout << x*1000+y*5 << endl;
}


Measured memory_bytes: 256
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define test(s) \
  if (!(s))     \
    cout << "Line " << __LINE__ << ": [" << #s << "] is false" << endl;
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
#pragma endregion

signed main() {
  string S;
  cin >> S;
  string ans = S.substr(0, 3);
  cout << ans << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N,M,X,ans=1e9; cin>>N>>M>>X;
  vector<vector<ll>> C(13,vector<ll>(13,0));
  vector<ll> work;
  for(ll i=0; i<N; i++) for(ll j=0; j<=M; j++) cin>>C[i][j];
  for(ll i=1; i<(1<<N); i++){
    work.assign(13,0);
    ll cnt=0;
    while(cnt<N){
      if(1&(i>>cnt)) for(ll j=0; j<=M; j++) work[j]+=C[cnt][j];
      cnt++;
    }
    //check
      for(ll j=1; j<=M; j++){
      if(work[j]<X) break;
      if(j==M) ans=min(work[0],ans);
    }
  }
  if(ans==1e9) ans=-1;
  cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define debug(var) std::cout << #var << " : " << var << std::endl;
using ll = long long;
using ull = unsigned long long;
ll mod = 1e9 + 7;
using Graph = std::vector<std::vector<int>>;


int main(){


	int A, B; std::cin >> A >> B;
	if(A == 1)A = 14;
	if(B == 1)B = 14;
	if(A > B)std::cout << "Alice";
	else if(B > A)std::cout << "Bob";
	else std::cout << "Draw";

	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int a,b,c,k,max=0,i;
scanf("%d %d %d %d",&a,&b,&c,&k);
for(i=1;i<k+1;i++){
    if (a>0){
        max+=1;
        a = a-1;}
    else if (b>0){
        max+=0;
        b = b-1;}
    else if (c>0){
        max = max-1;
        c = c-1;
}
}
printf("%d",max);
return 0;
}

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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

template<typename T1,typename T2> using P = pair< T1, T2 >;
using Pii = P<int,int>;
using Pdd = P<double,double>;

int main(){
    int n,m;
    cin>>n>>m;
    Vll a(n);
    REP(i,n) cin>>a[i];
    V<P<LL,LL>> bc(m);
    REP(i,m){
        cin>>bc[i].se>>bc[i].fi;
    }

    REP(i,n){
        bc.pb(mp(a[i],1));
    }

    sort(ALL(bc),greater<P<LL,LL>>());

    LL total = 0;
    LL cnt = 0;
    REP(i,bc.size()){
        int l = bc[i].se;
        if(cnt+bc[i].se>n) l = n-cnt;
        total += l*bc[i].fi;
        cnt += l;
    }
    cout<<total<<endl;

    return 0;
}

Measured memory_bytes: 8580
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
signed main(){
  int x=0,y=0,z=0,w=0,n=0,m=0;
  string s;
  std::cin >> x>>y;
  n=x;
  m=y;
  while(x>0){
    x/=10;
    z++;
  }
  while(y>0){
    y/=10;
    w++;
  }
  if(z>w)rep(i,m)std::cout << n;
  else if(w>z)rep(i,n)std::cout << m;
  else rep(i,max(n,m))std::cout << min(n,m);
}


Measured memory_bytes: 256
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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








int main(){
    int R, C, K; std::cin >> R >> C >> K;
    std::vector<std::vector<int>> v(R+1, std::vector<int>(C+1, 0));
    {
        int r, c, V;
        for(int i(0); i < K; ++i){
            std::cin >> r >> c >> V;
            v[r][c] = V;
        }
    }
    //dp[i][j][k] = (i, j) で 同じ行でk個持った時の最大値
    std::vector<std::vector<std::vector<long long>>> dp(R+1,
     std::vector<std::vector<long long>>(C+1,
      std::vector<long long>(4, 0)));
    for(int i(1); i <= R; ++i){
        for(int j(1); j <= C; ++j){
            for(int k(0); k < 3; ++k){
                chmax(dp[i][j][k+1], dp[i][j-1][k] + v[i][j]);
            }
            for(int k(0); k <= 3; ++k){
                chmax(dp[i][j][k], dp[i][j-1][k]);
                chmax(dp[i][j][0], dp[i-1][j][k]);
                chmax(dp[i][j][1], dp[i-1][j][k] + v[i][j]);
            }
        }
    }
    long long ans(0);
    for(int i(0); i < 4; ++i){
        chmax(ans, dp[R][C][i]);
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 671496
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define ii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(),a.end()

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> tpa;
typedef long long ll;
typedef unsigned long long ull;

const int N=1e5+5;
int n,it[2*N];
ii a[N];
vector<int> ext;

main(){
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n;
	for(int i=1; i<=n; ++i){
		int u,v;
		cin>>u>>v;
		a[i]={u-v,u+v};
	}
	sort(a+1,a+n+1,[](ii x,ii y){
		return make_pair(x.se,x.fi)<make_pair(y.se,y.fi);
	});
	int cur=-1e9,ans=0;
	for(int i=1; i<=n; ++i){
		if(cur<=a[i].fi){
			cur=a[i].se;
			ans++;	
		}
	}
	cout<<ans;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    string o,e;
    cin >> o >> e;
    int n = e.length() + o.length();
    int ne = 0, no = 0;
    string ans = "";
    rep(i,n){
        if(i%2 == 0){
            ans += o[no];
            no++; 
        }else{
            ans += e[ne];
            ne++;
        }
    }
    cout << ans << endl;
    return 0;   
}

Measured memory_bytes: 3680
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    n = gets.chomp.to_i

    ans = 1
    loop do
      v = ans * 2
      break if n < v

      ans = v
    end

    puts ans
  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 2172
use proconio::*;

fn diff(t: &str, s: &str) -> usize {
    let mut ret = 0;
    let m = t.len();
    let mut t = t.char_indices();
    let mut s = s.char_indices();
    for i in 0..m {
        let tt = t.next().unwrap().1;
        let ss = s.next().unwrap().1;
        if tt != ss {
            ret += 1;
        }
    }

    ret
}

fn main() {
    input!{
        s: String,
        t: String,
    }

    let mut ans = 100000;
    for i in 0..(s.len() - t.len() + 1) {
        ans = ans.min(diff(&t[0..t.len()], &s[i..i+t.len()]));
    }

    println!("{}", ans);
}


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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int res = -1;
  if (s == "SUN") res = 7;
  if (s == "MON") res = 6;
  if (s == "TUE") res = 5;
  if (s == "WED") res = 4;
  if (s == "THU") res = 3;
  if (s == "FRI") res = 2;
  if (s == "SAT") res = 1;
  cout << res << '\n';
}


Measured memory_bytes: 764
sub f{map{push@$_,$a[--$|]for@a=glob}<>;my($x,$b,$w)=($_,1,1);$_-"@_"and($w*=f($x))%=$==1e9+7,$b=$b*$c%$=for@$x;$b+=$c=$w}$_+=<>;print&f%$=

Measured memory_bytes: 170240
from collections import Counter

N=int(input())

Words=[]
for i in range(N):
    Words.append(input())

c = Counter(Words)

max_value = max(c.values())

word_list=[i[0] for i in c.most_common() if i[1] == max_value]

for k in sorted(word_list):
    print(k)

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int x;
  cin >> x;
  bitset<32> bit(x);
  cout << bit << endl;
  cout << ~bit << endl;
  cout << (bit<<1) << endl;
  cout << (bit>>1) << endl;



  return 0;
}



Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    int i = 0;
    while (1) {
        if (i%2 == 0) {
            c -= b;
            if (c <= 0) {
                cout << "Yes" << endl;
                return 0;
            }
        }
        else {
            a -= d;
            if (a <= 0) {
                cout << "No" << endl;
                return 0;
            }
        }
        i++;
    }
}

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


int main(){

	int n; cin >> n;
	for(int i = n; i < 1000; i++){
		string s = to_string(i);
		if(s[0] == s[1] && s[1] == s[2]) {
			cout << i << endl;
			exit(0);
		}
	}

	cout <<".."<< endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define __ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define LOG1(x1,x2) cout << x1 << ": " << x2 << endl;
#define LOG2(x1,x2,y1,y2) cout << x1 << ": " << x2 << " , " << y1 << ": " << y2 << endl;
#define LOG3(x1,x2,y1,y2,z1,z2) cout << x1 << ": " << x2 << " , " << y1 << ": " << y2 << " , " << z1 << ": " << z2 << endl;
typedef long long ll;
typedef double db;
const int N = 1e5+100;
const int M = 1e5+100;
const db EPS = 1e-9;
using namespace std;

int n,a[N];

int check(){
	rep(i,2,n)
		if(a[i] <= a[i-1]) return 0;
	return 1;
}

int main()
{
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",&a[i]);
	if(check()) printf("YES\n");
	else{
		int jud = 0;
		rep(i,1,n)
			rep(j,i+1,n){
				swap(a[i],a[j]);
				if(check()) jud = 1;
				swap(a[j],a[i]);
			}
		if(jud) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 256
// ABC 159-D
// 2020.3.24 bal4u

#include <stdio.h>

typedef long long ll;

#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)

int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

void out(ll n) { // 非負整数の表示（出力）
	int i; char b[30];

	if (!n) pc('0');
	else {
		//		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}

int f[200005];
int A[200005];

int main()
{
	int i, N, a, ma;
	ll s;

	N = in();
	ma = 0;
	for (i = 0; i < N; ++i) {
		A[i] = a = in(), f[a]++;
		if (a > ma) ma = a;
	}
	s = 1; for (i = 1; i <= ma; ++i) s += (ll)f[i]*(f[i]-1) >> 1;
	for (i = 0; i < N; ++i) out(s - f[A[i]]);
	return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
vector<uint64_t> luc(87, 0);

uint64_t luca(int n) {
  if (n == 0)
    return 2;
  else if (n == 1)
    return 1;
  else {
    if (luc.at(n) > 0)
      return luc.at(n);
    else
      return luc.at(n) = luca(n - 1) + luca(n - 2);
  }
}

int main() {
  int N;
  cin >> N;
  cout << luca(N) << endl;
}


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

int main() {
	ll a;
	double b;
	cin >> a >> b;
	ll B = b * 100 + 0.0001;
	//ll ans = a * b+0.000001;
   //ll B = b;
	cout << a * B/100 << endl;
	return 0;
}


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

const double pi = acos(-1);
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
int n, k;

long long pre(int m){
    return 1LL * m * (m + 1) / 2;
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> k;
    long long ans = 0;
    for(int i = k;i <= n;i++){
        long long num = pre(n) - pre(n - i) - pre(i - 1) + 1; 
        ans = (ans + num) % mod;
    }
    ans = (ans + 1) % mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
import math

K = int(input())
ans = 0
table = []
for i in range(1, K + 1):
    for j in range(1, K + 1):
        table.append(math.gcd(i, j))

for i in table:
    for j in range(1, K + 1):
        ans += math.gcd(i, j)

print(ans)


Measured memory_bytes: 9252
main=do
  [h,w]<-map read.words<$>getLine
  s<-lines<$>getContents
  f h w 0 0 s
f h w i j s=
  putStr(if s!!i!!j=='#'then"#"else show(sum[if s!!tx!!ty=='#'then 1 else 0|r<-[0..7],let tx=i+(dx!!r),let ty=j+(dy!!r),tx>=0&&ty>=0&&tx<h&&ty<w]))>>
  if j+1<w then f h w i (j+1) s else
    putStrLn"">>if i+1<h then f h w (i+1) 0 s else return()
dx=[0,1,0,-1,1,1,-1,-1]
dy=[1,0,-1,0,1,-1,1,-1]

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

int main()
{
    string s;
    cin >> s;
    int len = s.size();

    string ss[] = {"dream", "dreamer", "erase", "eraser"};
    int slen[4];
    for (int i = 0; i < 4; i++)
    {
        slen[i] = ss[i].size();
    }
    
    bool ans = false;
    while (1)
    {
        int i,ss_pos;
        for (i = 0; i < 4; i++)
        {
            ss_pos = s.rfind(ss[i]);
            if(ss_pos != -1)
            {
                if(ss_pos == len - slen[i])
                {
                    s.erase(ss_pos);
                    len = s.size();
                    break;
                }
            }
        }
        if(i == 4)
        {
            ans = false;
            break;
        }
        if(s.empty())
        {
            ans = true;
            break;
        }
    }
    
    cout << (ans ? "YES" : "NO") << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int INF = 1001001001;
const int MOD = 1000000007;

template <typename T>
void print(const T &v);

const int V = 100100;
vector<P> G[V]; // pair<辺の距離, 行き先の頂点> (隣接リスト)
ll dist[V];     // dist[i]はsから頂点iへの最短距離が入る
bool used[V];
void dijkstra(ll s)
{ // s: 始点
    fill_n(dist, V, INT_MAX);
    fill_n(used, V, false);
    priority_queue<P, vector<P>, greater<P>> q; // 値が小さい順に取り出されるpriority_queue
    q.push(P(0, s));
    while (!q.empty())
    {
        ll d, t; // d: sからの距離 t: 行き先
        tie(d, t) = q.top();
        q.pop();
        if (used[t])
            continue; // 既に探索済か
        used[t] = true;
        dist[t] = d;
        for (P e : G[t])
        {
            if (dist[e.second] <= d + e.first)
                continue;
            q.push(P(d + e.first, e.second));
        }
    }
}

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M);
    rep(i, M)
    {
        cin >> a[i] >> b[i];
        --a[i];
        --b[i];
    }
    rep(i, M)
    {
        G[a[i]].push_back(make_pair(1, b[i]));
        G[b[i]].push_back(make_pair(1, a[i]));
    }
    dijkstra(0);
    vector<int> ans(N);
    for (int i = 1; i < N; i++)
    {
        int next = dist[i] - 1; // 移動先の部屋の入り口までの距離
        for (auto p : G[i])
        {
            if (dist[p.second] == next)
            {
                ans[i] = p.second;
                break;
            }
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i < N; i++)
    {
        cout << ans[i] + 1 << endl;
    }
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 22856
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            if(N%2==0)
            {
                Console.WriteLine(N);
            }
            else
            {
                Console.WriteLine(N * 2);
            }
        }
    }
}


Measured memory_bytes: 11092