akhauriyash/Code-Regression huggingface dataset:
// This amazing code is by Eric Sunli Chen.
#include<bits/stdc++.h>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

char s[211][211];
int n,m,pre[211][211];

int dp1[211][211][211],dp2[211][211][211];
int ndp1[211][211][211],ndp2[211][211][211];

inline bool check_same(int x,int y,int xx,int yy)
{
	if(x>xx||y>yy)return true;
	int sum=pre[xx][yy]+pre[x-1][y-1]-pre[x-1][yy]-pre[xx][y-1];
	if(sum==0||sum==(xx-x+1)*(yy-y+1))return true;
	return false;
}

inline bool check(int x,int y,int xx,int yy)
{
	if(x>xx||y>yy)return true;
	int tmp;
	tmp=dp1[x][xx][y];if(tmp<m)tmp=dp1[x][xx][tmp+1];
	if(tmp>=yy)return true;
	tmp=dp2[y][yy][x];if(tmp<n)tmp=dp2[y][yy][tmp+1];
	if(tmp>=xx)return true;
	return false;
}

int main()
{
	get2(n,m);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s[i]+1);
		for(int j=1;j<=m;j++)
		{
			pre[i][j]=pre[i-1][j]+pre[i][j-1]-pre[i-1][j-1];
			if(s[i][j]=='#')pre[i][j]++;
		}
	}
	
	for(int i=1;i<=n;i++)for(int ii=i;ii<=n;ii++)
	{
		int cur=0;
		for(int j=1;j<=m;j++)
		{
			while(cur<m&&check_same(i,j,ii,cur+1))cur++;
			dp1[i][ii][j]=cur;
		}
	}
	for(int j=1;j<=m;j++)for(int jj=j;jj<=m;jj++)
	{
		int cur=0;
		for(int i=1;i<=n;i++)
		{
			while(cur<n&&check_same(i,j,cur+1,jj))cur++;
			dp2[j][jj][i]=cur;
		}
	}
	if(dp1[1][n][1]==m)
	{
		puts("0");
		return 0;
	}
	
	for(int t=1;;t++)
	{
		for(int i=1;i<=n;i++)for(int ii=i;ii<=n;ii++)
		{
			int cur=0;
			for(int j=1;j<=m;j++)
			{
				while(cur<m&&check(i,j,ii,cur+1))cur++;
				ndp1[i][ii][j]=cur;
			}
		}
		for(int j=1;j<=m;j++)for(int jj=j;jj<=m;jj++)
		{
			int cur=0;
			for(int i=1;i<=n;i++)
			{
				while(cur<n&&check(i,j,cur+1,jj))cur++;
				ndp2[j][jj][i]=cur;
			}
		}
		for(int i=1;i<=n;i++)for(int ii=i;ii<=n;ii++)for(int j=1;j<=m;j++)dp1[i][ii][j]=ndp1[i][ii][j];
		for(int j=1;j<=m;j++)for(int jj=j;jj<=m;jj++)for(int i=1;i<=n;i++)dp2[j][jj][i]=ndp2[j][jj][i];
		if(dp1[1][n][1]==m)
		{
			printf("%d\n",t);
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 135168
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
template<class T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
 /* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)*/
template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
/* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹) */
///////////////////////////////////////////////
const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 



int main() {
	int ans = 0;
	int N,K;	cin >> N >> K;
	vector<int> A;

	for (int i = 0; i < N; i++)
	{
		int a; cin >> a;
		A.PB(a);
	}


	for (int a = 0; a <= K; a++)
	{
		for (int b = 0; b <= K; b++)
		{
			for (int c = 0; c <= K; c++)
			{
				int n_ans = 0;
				priority_queue<int, vector<int>, greater<int> > que;
				if(a+b+c>K){continue;}
				if(a+b>N){continue;}
				if(a+b<c){continue;}
				for (int i = 0; i < a; i++)
				{
					que.push(A[i]);
					n_ans += A[i];
				}
				for (int i = 0; i < b; i++)
				{
					que.push(A[N-1-i]);
					n_ans += A[N-1-i];
				}
				for (int i = 0; i < c; i++)
				{
					n_ans -= que.top();
					que.pop();
				}
				if(n_ans > ans){ans = n_ans;}	

			}
			
		}
		
	}
	cout << ans << endl;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rrepn(i, n) for (int i = ((int)(n)); i > 0; --i)
#define SZ(x) ((int)(x).size())
template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
vector<pair<string, P> > vec;
// vector<vector<int>> data(3, vector<int>(4));

const string YES = "YES";
const string NO = "NO";

void solve(long long A, long long V, long long B, long long W, long long T) {
    if (abs(A - B) <= T * (V - W))
        cout << YES << endl;
    else
        cout << NO << endl;
}

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


Measured memory_bytes: 3696
#include<stdio.h>
using namespace std;
#include<algorithm>
int main(void)
{
	int N;
	int A[10000];
	int count=0;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
		while(A[i]%2==0) {
			count++;
			A[i] = A[i] / 2;
		}
	}
	printf("%d", count);


	return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a, b := Scanner(), Scanner()
	if a == b {
		fmt.Println("H")
	} else {
		fmt.Println("D")
	}
}


Measured memory_bytes: 1768
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    double pi = std::acos(-1);

    double a, b, h, m;
    std::cin >> a >> b >> h >> m;

    double t = std::abs((h/12+m/(12*60) - m/60)) * 2*pi;

    double ans = std::sqrt(a*a + b*b - 2*a*b*std::cos(t));

    std::cout << ans << '\n';
}



Measured memory_bytes: 4232
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
using namespace std;

typedef pair <int, int> pii;
typedef pair <int, pii> ppi;

const int MAX_N = 2e5 + 10, MAX_M = 2e5 + 10, SQRT = 230, inf = 1000000000;
int n, Arr[MAX_N];
int cnt;

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> Arr[i];

	sort(Arr, Arr + n);
	cout << Arr[n / 2] - Arr[n / 2 - 1];
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(){
    int s[400], m, i, j, l=0, h;
    while(1){
        int l=0;
        while((s[l++]=getchar())!='\n'){}
        if(s[0]=='-')break;
        scanf("%d", &m);
        for(i=0; i<m; i++){
            scanf(" %d", &h);
            for(j=0; j<l-1; j++)s[l-1+j]=s[j];
            for(j=h; j<h+l-1; j++)s[j-h]=s[j];
        }
        for(i=0; i<l-1; i++)printf("%c", s[i]);
        (void)getchar();
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 568
#include <iostream>
using namespace std;
int main(){
  int m,f,r;
  while(1){
    cin >> m >> f >> r;
    if(m==-1&&f==-1&&r==-1) break;
    if(m==-1||f==-1) cout << 'F' << endl;
    else if(m+f>=80) cout << 'A' << endl;
    else if(m+f>=65) cout << 'B' << endl;
    else if(m+f>=50) cout << 'C' << endl;
    else if(m+f>=30){
      if(r>=50) cout << 'C' << endl;
      else cout << 'D' << endl;
    }
    else cout << 'F' << endl;
  }
  return 0;
}


Measured memory_bytes: 3012
A = []
for i in range(3):
  for x in input().split():
    A.append(int(x))
    
N = int(input())

for _ in range(N):
  y = int(input())
  A = [0 if x == y else x for x in A]

if any((sum(A[::3]) == 0,
       sum(A[1::3]) == 0,
       sum(A[2::3]) == 0,
       sum(A[:3]) == 0,
       sum(A[3:6]) == 0,
       sum(A[6:]) == 0,
       sum(A[::4]) == 0,
       sum(A[2:7:2]) == 0)):
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3064
using System;

using System.Linq;

using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
            var a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            Console.WriteLine("{0} {1} {2:0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000}", a[0] / a[1], a[0] % a[1], a[0] / (double)a[1]);
        
    }
}



Measured memory_bytes: 9804
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
class union_find{
  int n;
  vector<int> par,rk,size;
  public:
  union_find(int max_n){
    n = max_n+1;
    for(int i=0;i<=n;i++){
      par.emplace_back(i);
      rk.emplace_back(0);
      size.emplace_back(1);
    }
  }
  int root(int x){
    vector<int> nodes;
    while(x!=par[x]){
      nodes.emplace_back(x);
      x = par[x];
    }
    for(auto v:nodes){
      par[v] = x;
    }
    return x;
  }
  void unite(int x,int y){
    x = root(x);
    y = root(y);
    if(x==y) return;
    if(rk[x]<rk[y]){
      par[x] = y;
      size[y] += size[x];
    }else{
      par[y] = x;
      if(rk[x]==rk[y]) rk[x]++;
      size[x] += size[y];
    }
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
  int treesize(int x){
    return size[root(x)];
  }
};
using TP = tuple<ll,ll,ll>;
signed main(){
  init_io();
  ll v,e,s,t,w,ans=0;
  cin >> v >> e;
  priority_queue<TP,vector<TP>,greater<TP>> que;
  union_find uf(v);
  for(int i=0;i<e;i++){
    cin >> s >> t >> w;
    que.push(TP(w,s,t));
  }
  while(!que.empty()){
    TP tmp = que.top();
    que.pop();
    s = get<1>(tmp);
    t = get<2>(tmp);
    if(!uf.same(s,t)){
      ans += get<0>(tmp);
      uf.unite(s,t);
    }
  }
  cout << ans << endl;
}



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

using namespace std;

int main() {
    
    int n;
    cin >> n;
    
    map<string,long long> mp;

    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }
    
    long long ans = 0;
    for (auto p: mp) 
        ans += (p.second * (p.second - 1)) / 2;
    
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
using namespace std;
using namespace __gnu_pbds;

#define sp << " " <<
#define mod 1000000007
#define PI 3.14159265358979323
#define y second
#define x first
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define pqueue priority_queue< ll >
//#define pdqueue priority_queue< ll,vector<ll> ,greater< ll > >
#define codejamDebug(x) cout<<"Case #"<<x<<": ";
#define debug(x) cout<<#x<<" :"<<x<<endl;
#define rep(i,n) for(long long i=0;i<n;i++)
#define f(i,a,b) for(long long i = a; i < b; i++)
#define fd(i,a,b) for(long long i = a; i >=b; i--)
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int           ll;
typedef long double             ld;
typedef unsigned long long int ull;
typedef vector <int>            vi;
typedef vector <ll>            vll;
typedef pair <int, int>        pii;
typedef pair <ll, ll>          pll;
typedef vector < pii >        vpii;
typedef vector < pll >        vpll;
typedef vector <string>         vs;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//Handle:cyber_rajat
ll n,k;

vector<vector<ll> > mul(vector<vector<ll> > a , vector<vector<ll> > b)
{
	vector<vector<ll> > t(n,vector<ll>(n));
	rep(i,n)
	{
		rep(j,n)
		{
			rep(k,n)
			{
				t[i][j]+=((a[i][k]*b[k][j])%mod);
				t[i][j]%=mod;
			}
		}
	}
	return t;
}

vector<vector<ll> > powM(vector<vector<ll> > ad,vector<vector<ll> > I, ll p)
{
	if(p==0)return I;
	if(p==1)return ad;
	vector<vector<ll> > r=powM(ad,I,p/2);
	vector<vector<ll> > res=mul(r,r);
	if(p&1)res=mul(res,ad);

	return res;
}

int main(int argc, char const *argv[])
{
	sync;
	cin>>n>>k;
	vector<vector<ll> > ad(n,vector<ll>(n));
	vector<vector<ll> > I(n,vector<ll>(n));
	rep(i,n)
	{
		rep(j,n)
		{
			ll a;
			cin>>a;
			ad[i][j]=a;
			if(i==j)I[i][i]=1;
		}
	}
	vector<vector<ll> > ans=powM(ad,I,k);
	ll result=0;
	rep(i,n)
	{
		rep(j,n)
		{
			result+=ans[i][j];
			result%=mod;
		}
	}
	cout<<result<<endl;
	return 0;
}


Measured memory_bytes: 2944
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    A,B,C = LI()
    print("Yes" if ((A==B and B!=C) or (B==C and C!=A) or (C==A and A!=B)) else "No")

main()



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

using namespace std;

int main(){
    int N, i, flag=0;
    vector<int> L(6);
    vector<int> T(4);

    for (i=0;i<4;i++){
        T[i] = 0;
    }

    for (i=0;i<6;i++){
        cin >> L[i];
        T[L[i]-1]++;
        if (T[L[i]-1]==3) flag = 1;
    }
    
    for (i=0;i<4;i++){
        if(T[i] == 0) flag = 1;
    }

    if (flag) cout << "NO\n";
    else cout << "YES\n";
}
   

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,d[110],count = 0;
    cin >> n;
    for (int i = 0;i < n;i++) cin >> d[i];
    sort(d,d+n,greater<int>());
    for (int i = 0;i < n;i++){
        if(d[i]==d[i+1])
            continue;
        else
            count++;                
    }
    cout << count << endl;
   
   
}

Measured memory_bytes: 256
def f(b, n)
  return n if n < b
  f(b, n/b) + n%b
end

def solve(n, s)
  return n+1 if n == s
  2.upto(Math::sqrt(n)) do |b|
    return b if f(b, n) == s
  end
  Math::sqrt(n).to_i.downto(1) do |p|
    b = (n-s+p)/p
    next if b < 2
    return b if f(b, n) == s
  end
  -1
end

n, s = 2.times.map{gets.to_i}
p solve(n, s)


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

int A,B;

int main()
{
    cin>>A>>B;
    int l=max(A,B);
    int s=min(A,B);
    int pair=l-s;
    int remain=16-s*2;
    if(remain>=pair*2)
    {
        cout<<"Yay!"<<endl;
    }
    else cout<<":("<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define int long long
signed main() {
  int N,P=0,W=0,G=0,Y=0;
  cin >> N;
  vector<char> vec(N);
  for(int i=0; i<N; i++) {
    cin >> vec.at(i);
    if(vec.at(i)=='P') {
      P=1;
    }
    if(vec.at(i)=='W') {
      W=1;
    }
    if(vec.at(i)=='G') {
      G=1;
    }
    if(vec.at(i)=='Y') {
      Y=1;
    }
  }
  
  if(P+W+G+Y==4) {
    cout << "Four" << endl;
  }
  else {
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

int n, k;
vector<int> a;

bool ok(int x)
{
    vector<int> b(n);
    rep(i, n) b[i] = a[i] % x;
    sort(all(b));
    vector<int> c(n);
    rep(i, n) c[i] = x - b[i];
    vector<int> B(n + 1, 0), C(n + 1, 0);
    //ruisekiwa
    rep(i, n) B[i + 1] = B[i] + b[i];
    for (int i = n - 1; i >= 0; i--)
        C[i] = C[i + 1] + c[i];
    rep(p, n + 1)
    {
        int X = B[p], Y = C[p];
        if (X > k || Y > k)
            continue;
        int d = abs(X - Y);
        if (d % k == 0)
            return true;
    }
    return false;
}

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

    cin >> n >> k;
    a.resize(n);
    rep(i, n) cin >> a[i];
    int sum = 0;
    rep(i, n) sum += a[i];
    int ans = 1;
    for (int i = 1; i * i <= sum; i++)
    {
        if (sum % i == 0)
        {
            if (ok(i))
                ans = max(ans, i);
            if (ok(sum / i))
                ans = max(ans, sum / i);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <vector>

int main()
{
	int n;
	scanf("%d", &n);

	int* a = (int*)calloc(n + 1, sizeof(int));
	for (int i = 1; i <= n; i++)
		scanf("%d", a + i);

	std::vector<int> c;

	int* d = (int*)calloc(n + 1, sizeof(int));
	for (int i = n / 2 + 1; i <= n; i++)
	{
		d[i] = a[i];
		if (d[i])c.push_back(i);
	}

	for (int i = n / 2; i > 0; i--)
	{
		int b = 0;
		for (int j = i * 2; j <= n; j += i)
			b += d[j];
		d[i] = (a[i] == b % 2 ? 0 : 1);
		if (d[i])c.push_back(i);
	}

	printf("%d\n", c.size());
	for (int i = 0, m = c.size(); i < m; i++)
		printf("%d ", c[i]);

	return 0;
}

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#define int long long
using namespace std;
int d, g, p[11], c[11], k, ans = 114514;
bool b[11];
int f(int m) {
	if (m == d) {
		int r = 0, point = 0;
		for (int i = 0; i < d; i++) {
			if ((i != k) && b[i]) {
				r += p[i];
				point += p[i] * (i + 1) * 100 + c[i];
			}
		}
		if (point + p[k] * (k + 1) * 100 + c[k] < g)return 114514;
		if (point + p[k] * (k + 1) * 100 < g)return r + p[k];
		else return r + max((int)0, (g - point) / ((k + 1) * 100) + (bool)((g - point) % ((k + 1) * 100)));
	}
	b[m] = true;
	int r = f(m + 1);
	b[m] = false;
	r = min(r, f(m + 1));
	return r;
}
signed main() {
	cin >> d >> g;
	for (int i = 0; i < d; i++)cin >> p[i] >> c[i];
	for (k = 0; k < d; k++) 
		ans = min(ans, f(0));
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=1e9+7;

const int N=2e5+1;
vector<ll> a[N];
vector<bool> vis(N);
ll tot=0;

void dfs(ll v){
    vis[v]=true;
    tot++;
    for(ll u:a[v]){
        if(!vis[u]){
            dfs(u);
        }
    }
}

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();
    
    ll n,m;
    cin>>n>>m;
    map<pair<ll,ll>,ll> mpp;
    for(int i=0;i<m;i++){
        ll u,v;
        cin>>u>>v; u--,v--;
        if(u>v) swap(u,v);
        if(mpp[{u,v}]==1) continue;
        a[u].pb(v);
        a[v].pb(u);
        mpp[{u,v}]=1;
    }
    vector<ll> gp;
    ll mx=0;
    for(int i=0;i<n;i++){
        if(!vis[i]){
            tot=0;
            dfs(i);
            mx=max(mx,tot);
        }
    }
    cout<<mx;


    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

Measured memory_bytes: 33484
n = int(input())
arr = []
for i in range(n):
	arr.append(list(map(int,input().split())))

sort_arr = sorted(arr, key=lambda x:x[1])

tmp = 0
flg = 0

for j in range(n):
	tmp += sort_arr[j][0]
	if tmp > sort_arr[j][1]:
		flg = 1
		break

if flg ==1 :
	print('No')
else:
	print('Yes')

Measured memory_bytes: 55260
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int count1=0,count2=0;
  for(int i=0; i<n; i++){
	string tarous;
	string hanakos;
	cin >> tarous >> hanakos;

	if(tarous>hanakos) count1 += 3; 
	if(tarous==hanakos) {
	  count1 += 1; count2 += 1;
	}
	if(tarous<hanakos) count2 += 3;
  }
  cout << count1 << " " << count2 << endl;

  return 0;
}



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

int n, k;
int a[100055];
int dp[100155];

int main() {
	cin >> n >> k;
	
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	
	memset(dp, 63, sizeof(dp));
	
	dp[0] = 0;
	
	for (int i = 0; i < n; i++) for (int j = i + 1; j <= i + k; j++) {
		dp[j] = min(dp[j], dp[i] + abs(a[i] - a[j]));
	}
	
	cout << dp[n - 1];
}


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

int main() {
	int N;
	cin >> N;
	vector<string> W(N);
	for (int i = 0; i < N; i++) {
		cin >> W[i];
	}

	for (int i = 1; i < N; i++) {
		string before = W[i - 1];
		int fin = before.length() - 1;
		char tail = before[fin];
		string now = W[i];

		if (!(tail == now[0])) {
			cout << "No" << endl;
			return 0;
		}
		for (int j = 0; j < N; j++) {
			if (i == j) {
				continue;
			}
			if (W[i] == W[j]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}

	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define INF 1000 * 1000 * 1000
using namespace std;

int main()
{
	int n , a , b;
	cin >> n >> a >> b;
	if(not(b - a - 1))
	{
		cout << "Borys";
		return 0;
	}
	if(not((b - a - 1) % 2))
	{
		cout << "Borys";
	}
	else
		cout << "Alice";
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int64;
 
unordered_map< string, int > ff;
 
void stop()
{
  int ret = 0;
  vector< pair< char, int > > vv;
  for(auto &c : ff) if(isalpha(c.first[0])) vv.emplace_back(c.first[0], c.second);
  sort(begin(vv), end(vv));
  for(auto& c : vv) printf("%c=%d\n", c.first, c.second);
  exit(0);
}
 
 
int main()
{
  int N;
  int convert[1001];
  char buff[64], type[50][5], var1[50][5], var2[50][5], var3[50][5];
  memset(convert, -1, sizeof(convert));
 
  fgets(buff, sizeof(buff), stdin);
  sscanf(buff, "%d", &N);
 
  for(int i = 0; i < N; i++) {
    int line;
    fgets(buff, sizeof(buff), stdin);
    sscanf(buff, "%d %s %s %s %s", &line, type[i], var1[i], var2[i], var3[i]);
    convert[line] = i;
    ff[var1[i]];
    ff[var2[i]];
    ff[var3[i]];
  }
  for(int i = 0; i < 16; i++) ff[to_string(i)] = i;
 
  int i = 0;
  for(int c = 0; c < 30000000; c++) {
    if(type[i][0] == 'H') stop();
    int val;
    bool set = true;
    if(type[i][0] == 'A') {
      val = ff[var2[i]] + ff[var3[i]];
    } else if(type[i][1] == 'U') {
      val = ff[var2[i]] - ff[var3[i]];
    } else if(type[i][1] == 'E') {
      val = ff[var2[i]];
    } else {
      set = false;
    }
 
    if(set && (val < 0 || val >= 16)) stop();
    if(set) ff[var1[i]] = val;
 
    if(type[i][0] == 'I' && ff[var1[i]] != 0) {
      i = convert[stoi(var2[i])];
    } else {
      i++;
    }
 
    if(i < 0 || i >= N) stop();
  }
 
  puts("inf");
}

Measured memory_bytes: 3284
#include <stdio.h>
int main(void){
	int r,c,i,j;
	scanf("%d %d",&r,&c);
	int a[100+1][100+1]={};
	for(i=0;i<r;i++){
		for(j=0;j<c;j++){
			scanf("%d",&a[i][j]);
		}
	}
	for(i=0;i<r;i++){
		for(j=0;j<c;j++){
			printf("%d ",a[i][j]);
			a[i][c]=a[i][c]+a[i][j];
		}
		printf("%d",a[i][c]);
		putchar('\n');
		a[i][c]=0;
	}
	for(j=0;j<c;j++){
		for(i=0;i<r;i++){
			a[r][j]=a[r][j]+a[i][j];
			a[r][c]=a[r][c]+a[i][j];
		}
		printf("%d ",a[r][j]);
		a[r][j]=0;
	}
	printf("%d\n",a[r][c]);
	return 0;
}


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

int ans[500][2][12];//二つ目の次元の0の0に数列の長さ、0の1に操作回数、1に答えの数列

int counter=0,flag=0;

void solve(){
	int n;
	cin >> n;
	if(n==0){flag=1;return;}
	ans[counter][0][0]=n;
	
	int S[12];//数列
	for(int i=0;i<n;i++){
		cin >> S[i];
	}
	
	bool check=false;//操作の有無のフラグ
	int time=0;//操作回数
	do{
		map<int,int> marker;
		for(int i=0;i<n;i++){
			marker[S[i]];
			marker[S[i]]++;
		}
		check=false;
		for(int i=0;i<n;i++){
			if(S[i]!=marker[S[i]]){
				check=true;
				S[i]=marker[S[i]];
			}
		}
		if(check) time++;
	}while(check);
	
	ans[counter][0][1]=time;
	for(int i=0;i<n;i++){
		ans[counter][1][i]=S[i];
	}
	counter++;
}

int main(){
	while(flag==0)solve();
	for(int i=0;i<counter;i++){
		cout << ans[i][0][1] << endl;
		for(int j=0;j<ans[i][0][0]-1;j++){
			cout << ans[i][1][j]<<" ";
		}
		cout << ans[i][1][ans[i][0][0]-1] << endl;
	}
}
			
	
	

Measured memory_bytes: 1208
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {
	private static final int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int R = sc.nextInt();
		int G = sc.nextInt();
		int B = sc.nextInt();
		int N = sc.nextInt();

		int count = 0;
		for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= N; j++) {
				int sum = R * i + G * j;
				if (sum > N) {
					break;
				}
				if ((N - sum) % B == 0) {
					count++;
				}
			}
		}

		System.out.println(count);
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public char nextChar() throws IOException {
			return (char) skip();
		}

		public int nextInt() throws IOException {
			int num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}

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

using namespace std;

int main() {
	int n;
  	cin >> n;
  	string s, t;
  	cin >> s >> t;
  	for (int i = 0; i < s.size(); i++) {
    	cout << s[i] << t[i];
    }
  	cout << endl;
  	return 0;
}

Measured memory_bytes: 256
// スタックサイズ: 100MB

#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1e18;
const double EPS = 1e-10;
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }



int main() {
	fastio;
	
	ll N;
	cin >> N;
	map<ll, ll> po;
	rep(i, N) {
		ll t;
		cin >> t;
		if (po.find(t) == po.end()) po[t] = 1;
		else if (po[t] == 1) po[t] = 0;
		else po[t] = 1;
	}
	ll ans = 0;
	for (auto p : po) ans += p.second;
	cout << ans << endl;
}

Measured memory_bytes: 6528
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

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

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

int n, m;
int a[120][120];

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n >> m;
	--n;
	--m;
	for (int i = 0; i < 50; ++i)
		for (int j = 0; j < 100; ++j)
			a[i][j] = 0;
	for (int i = 50; i < 100; ++i)
		for (int j = 0; j < 100; ++j)
			a[i][j] = 1;
	for (int i = 0; i < 50; i += 2)
		for (int j = 0; j < 100; j += 2)
			if (m)
				a[i][j] = 1, --m;
	for (int i = 51; i < 100; i += 2)
		for (int j = 0; j < 100; j += 2)
			if (n)
				a[i][j] = 0, --n;
	cout << 100 << " " << 100 << "\n";
	for (int i = 0; i < 100; ++i) {
		for (int j = 0; j < 100; ++j)
			if (a[i][j] == 0)
				cout << ".";
			else
				cout << "#";
		cout << "\n";
	}
	return 0;
}




Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    int ary[5];
    int counter = 0;
    int x;

    while (a <= b) {
        x = a;

        for (int i = 0; i < 5; ++i) {
            ary[i] = x % 10;
            x /= 10;
        }

        if (ary[0] == ary[4] && ary[1] == ary[3]) ++counter;
        ++a;
    }

    cout << counter << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll sum, d[51][51];
int n, cnt[2], a;
bool p;
int main()
{
	cin >> n >> p;
	for(int i = 1;i <= n; ++ i){
		cin >> a;
		++cnt[a % 2];
	}
	d[0][0] = 1;
	for(int i = 1;i <= cnt[1]; ++ i){
		d[i][0] = 1;
		for(int j = 1;j <= i; ++ j)d[i][j] = d[i - 1][j] + d[i - 1][j - 1];
	}
	for(int i = 0;i <= cnt[1]; ++ i){
		if(i % 2 == p)sum += d[cnt[1]][i];
	}
	cout << ll(pow(2ll, cnt[0])) * sum;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>

using namespace std;

const int mod = 1000000007;

int main() {
  int n, m; cin >> n >> m;
  vector<bool> is_broken(n+10, false);
  for (int i = 0; i < m; i++) {
    int a; cin >>a;
    is_broken[a] = true;
  }

  vector<int> dp(n+10, 0);
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    if ( !is_broken[i+1] ) {
      dp[i+1] += dp[i];
      dp[i+1] %= mod;
    }
    if ( !is_broken[i+2] ) {
      dp[i+2] += dp[i];
      dp[i+2] %= mod;
    }
  }
  cout << dp[n] << endl;
  return 0;
}

Measured memory_bytes: 640
n = int(input())
T = list(map(int, input().split()))
m = int(input())
P = [list(map(int, input().split())) for _ in range(m)]
for p in P:
    tmp_l = T.copy()
    tmp_l[p[0]-1] = p[1]
    print(sum(tmp_l))

Measured memory_bytes: 64040
using System;

namespace _20190304_05 {
    class Program {
        static void Main(string[] args) {
            var str = Console.ReadLine();
            var c0 = 0;
            var c1 = 0;
            foreach (var c in str) {
                if (c == '0') {
                    c0++;
                } else {
                    c1++;
                }
            }
            Console.WriteLine(Math.Min(c0, c1) * 2);
        }
    }
}


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

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

    int A[n];
    for(int i=0;i<n;i++){
        cin >> A[i];
    }
    
    for(int i = n - 1;i>=0;i--){
        if(i != n - 1){cout << " ";}
        cout << A[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3088
#include<stdio.h>

int swap(int *a,int *b)
{
  int t;
  t=*a;
  *a=*b;
  *b=t;
}

int main(void)
{
  int a,b;
  char buf[256];
  while(1){
  fgets(buf,sizeof(buf),stdin);
  sscanf(buf,"%d%d",&a,&b);
  
  if(a==0 && b==0)
    break;
  if(a>b)
    swap(&a,&b);

  printf("%d %d\n",a,b);
  }
  return 0;
}

Measured memory_bytes: 612
#include<iostream>
#include<vector>
#include<queue>

using namespace std;
using Graph=vector<vector<int>>;



struct Edge {
	int node1, node2, weight;

	Edge() {}

	Edge(int n1, int n2, int w) :node1(n1), node2(n2), weight(w) {}

	void numset(int n1, int n2, int w) {
		node1 = n1; node2 = n2; weight = w;
	}

};

void eswap(Edge& e1, Edge& e2) {
	Edge temp = e1;   e1 = e2;  e2 = temp;
}

void bubbleSort(vector<Edge>& edge) {
	bool flag;
	for (int i = 0; i < edge.size(); i++) {
		flag = true;
		for (int j = 0; j < edge.size()-i-1; j++) {
			if (edge.at(j).weight > edge.at(j + 1).weight) {
				eswap(edge.at(j), edge.at(j + 1));
				flag = false;
			}
		}
		if (flag) break;
	}
}

int kruskal(Graph &spntree,vector<Edge>& edgeset) {
	int size = spntree.size();
	queue<int> unconnected;
	vector<bool> connected(size,false);
	
	if (edgeset.size() == 0) return 0;
	bubbleSort(edgeset);

	connected.at(edgeset.at(0).node1)=true;
	connected.at(edgeset.at(0).node2) = true;
	spntree.at(edgeset.at(0).node1).push_back(edgeset.at(0).node2);
	spntree.at(edgeset.at(0).node2).push_back(edgeset.at(0).node1);
	int index=0,count = 2,cost=edgeset.at(0).weight;
	Edge ed;
	edgeset.erase(edgeset.begin());

	while (count<size) {
		ed = edgeset.at(index);
		if (connected.at(ed.node1) == true && connected.at(ed.node2) == false) {
			connected.at(ed.node2) = true;
			spntree.at(ed.node1).push_back(ed.node2);
			spntree.at(ed.node2).push_back(ed.node1);
			edgeset.erase(edgeset.begin() + index);
			count++; cost += ed.weight;
			index = 0; continue;
		}
		else if (connected.at(ed.node2) == true && connected.at(ed.node1) == false) {
			connected.at(ed.node1) = true;
			spntree.at(ed.node1).push_back(ed.node2);
			spntree.at(ed.node2).push_back(ed.node1);
			edgeset.erase(edgeset.begin() + index);
			count++; cost += ed.weight;
			index = 0; continue;
		}
		index++;
	}
	return cost;


}

int main(void) {

	int size, temp,cost,edgenum=0;
	Edge etemp;
	vector<Edge> edgeset;
	cin >> size;
	Graph spntree(size);
	for (int i = 0; i < size; i++) {
		for (int j = 0; j < size; j++) {
			cin >> temp;
			if (i < j) {
				if (temp != -1) {
					edgenum++;
					etemp.numset(i, j, temp);
					edgeset.push_back(etemp);
				}
			}
		}
	}

	cost=kruskal(spntree, edgeset);
	cout << cost << endl;
}




Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int EPS = 1e-9; 

int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  int cnt = 0;
  int mn = 110111010;
  for (int i = 0; i < N; ++i) cin >> P.at(i);
  for (int i = 0; i < N; ++i) {
    mn = min(mn, P.at(i));
    if (mn == P.at(i)) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 1024
x, y = [int(_) for _ in input().split()]
#x=a+b
#y=2a+4b
b = (y - 2 * x) // 2
a = x - b
if a >= 0 and b >= 0 and 2 * a + 4 * b == y:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9168
import math
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
'''


#a = list(map(int, input().split()))

n = int(input())
m = n/3
print(m*m*m)














Measured memory_bytes: 67684
from collections import Counter
n = int(input())
list_A = list(map(int, input().split()))
list_A = list_A + [i for i in range(1, n+1)]
l = Counter(list_A)
ans = sorted(l.items(), key=lambda x:x[0])

for i in range(n):
    print(ans[i][1]-1)

Measured memory_bytes: 53324
//
//  ALDS1_2_A_BubbleSort.cpp
//  test
//
//  Created by Sajor on 2019/3/21.
//  Copyright © 2019年 Sajor. All rights reserved.
//

#include <iostream>
using namespace std;
# define MAX_N 105

void print(int a[], int n){
    for(int i=0; i<n; i++){
        if (i>0) cout << " ";
        cout << a[i];
    }
    cout << endl;
}

int bubbleSort(int *a, int n){
    int count=0;
    for (int i=1; i<n; i++){
        for (int j=0; j<n-i; j++){
            if(a[j]>a[j+1]){
                a[j] ^= a[j+1];
                a[j+1] ^= a[j];
                a[j] ^= a[j+1];
                count++;
            }
        }
    }
    return count;
}

int main()
{
    int N, a[MAX_N];
    cin >> N;
    for (int i=0; i<N; i++){
        cin >> a[i];
    }
    int c = bubbleSort(a, N);
    print(a, N);
    cout << c << endl;
    return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll max_n = 1e4;
ll d[max_n]={0};
const ll INF = 1e18;
ll n,m;
struct edge{
  ll from, to;
  ll cost;
};
edge es[max_n];
bool vellman(int s){
  fill(d, d+n, INF);
  d[s] = 0;
  for(int i=0 ; i<n ; i++){
    bool update = false;
    bool upn = false;
    for(int j=0 ; j<m ; j++){
      edge e = es[j];
      if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
        d[e.to] = d[e.from] + e.cost;
        update = true;
        if(e.to==n-1) upn = true;
      }
    }
    if(!update) break;
    if(upn && i == n-1)return false;

  }
  return true;
}
int main(){
  cin >> n >> m;
  for(int i=0 ; i<m ; i++){
    ll x,y; ll z;
      cin >> x >> y >> z;
    --x;  --y;
    es[i].from=x; es[i].to=y; es[i].cost=-z;
  }
  if(!vellman(0)){
    cout << "inf" << endl;

  }else{
    cout << -d[n-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
int f(int a,int b,int x){return (x?(x-1?a*b:a-b):a+b);}
int r[4];
int main(){
	while(cin>>r[0]>>r[1]>>r[2]>>r[3]&&r[0]){
		lol(q,99){string z="+-*";
			lol(i,3)lol(j,3)lol(k,3){
				if(f(f(r[0],r[1],i),f(r[2],r[3],k),j)==10){
					cout<<"(("<<r[0]<<z[i]<<r[1]<<")"<<z[j]<<"("<<r[2]<<z[k]<<r[3]<<"))\n";
					goto l;
				}
				if(f(f(f(r[0],r[1],i),r[2],j),r[3],k)==10){
					cout<<"((("<<r[0]<<z[i]<<r[1]<<")"<<z[j]<<r[2]<<")"<<z[k]<<r[3]<<")\n";
					goto l;
				}
			}
			if(q%6==5)swap(r[0],r[1]);
			else if(q%2==1)swap(r[1],r[2]);
			else swap(r[2],r[3]);
			//cout<<r[0]<<" "<<r[1]<<" "<<r[2]<<" "<<r[3]<<endl;
		}cout<<"0"<<endl;
		l:;
	}
	return 0;
}

Measured memory_bytes: 3044
MM = input().split()
A = int(MM[0])
B = int(MM[1])
list1 =[]
for i in range(A):
  aa = input()
  if '.'*B == aa:
    pass
  else:
    list1.append(list(aa))


for i in range(B):
  count = 0
  for j in range(len(list1)):
    if list1[j][i] == '#':
      count +=1
  if count == 0:
    for j in range(len(list1)):
     
      list1[j][i] = 'a'

for i in list1:
  if 'a' in i:
    i.remove('a')

for i in list1:
  for j in i:
    if j != 'a':
      print(j,end='')
  print()
    
  
               
    
  
               

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

int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  
  int a, b, c, d, e, saisyo, ans;
  a=(A-1)%10+1;
  b=(B-1)%10+1;
  c=(C-1)%10+1;
  d=(D-1)%10+1;
  e=(E-1)%10+1;
  saisyo = min(a, min(b, min(c, min(d,e))));
  ans=A+B+C+D+E-a-b-c-d-e+40+saisyo;
  
  cout << ans << endl;
}

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

using namespace std;

int main() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int sum = 0;
	if (k <= a) {
		cout << k;
	}
	else if (k <= (a + b)) {
		cout << a;
	}
	else if (k <= (a + b + c)) {
		cout << (a - (k - a - b));
	}
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < (a); ++i)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    ll a,v,b,w,t;
    cin >> a >> v >> b >> w >> t;

    if(a > b) swap(a,b);

    ll A = a + v*t;
    ll B = b + w*t;

    if(A >= B){
        cout << "YES" << endl;
        return 0;
    }else{
        cout << "NO" << endl;
        return 0;
    }
}

Measured memory_bytes: 3552
N,M,Q=map(int,input().split())
LR=[list(map(int,input().split())) for _ in range(M)]
PQ=[list(map(int,input().split())) for _ in range(Q)]
tab=[[0]*(N+1) for _ in range(N+1)]
for l,r in LR:
    tab[l][r]+=1

for y in range(N+1):
    for x in range(1,N+1):
        tab[y][x]+=tab[y][x-1]

for y in range(1,N+1):
    for x in range(N+1):
        tab[y][x]+=tab[y-1][x]

for p,q in PQ:
    print(tab[q][q]-tab[q][p-1]-tab[p-1][q]+tab[p-1][p-1])

Measured memory_bytes: 109528
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

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

    if (A <= X && X <= A+B) cout << "YES" << endl;
    else cout << "NO" << endl;
}


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

#define         eps         10e-9
#define         pi          2*acos(0)
#define         P1          1e9+7
#define         P2          1e9+9
#define         lli         long long int

using namespace std;

///ISNNJB
int ara[100010],brr[100010];

/**int fx[]={+1,-1,+0,+0};
int fy[]={+0,+0,+1,-1};
int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};*/

int main() {
    /***freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    lli a,b,c,d,t,n,m,x,y,q,ctn,l1,l2,total=0;
    cin>>n;
    for (int i=1; i<=n; i++){
        cin>>ara[i];
        brr[ara[i]]++;
    }

    for (int i=1; i<=n; i++)
        total+=ara[i];
    cin>>q;

    for (int i=1; i<=q; i++) {
        cin>>a>>b;
        m=brr[a];
        if(a<b) {
            if(m==0)
                cout<<total<<endl;
            else {
                x=m*b;
                y=m*a;
                total-=y;
                total+=x;
                brr[b]+=brr[a];
                brr[a]=0;
                cout<<total<<endl;
            }
        }

        else {
            if(m==0)
                cout<<total<<endl;
            else {
                x=m*b;
                y=m*a;
                total-=y;
                total+=x;
                brr[b]+=brr[a];
                brr[a]=0;
                cout<<total<<endl;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 4388
#include<cstdio>
#include<vector>
using namespace std;
const int MAXN=100005;

struct AdjEdge
{
	int v,d;
	AdjEdge(int a,int b)
	{v=a;d=b;}
};

int N;
int fa[MAXN],siz[MAXN],dis[MAXN];
int val[MAXN];
vector<AdjEdge> adj[MAXN];

void dfs(int u)
{
	siz[u]=1;
	for(auto e:adj[u])
	{
		if(e.v==fa[u])
			continue;
		fa[e.v]=u;
		dis[e.v]=e.d;
		dfs(e.v);
		val[u]=max(val[u],siz[e.v]);
		siz[u]+=siz[e.v];
	}
}

int main()
{
	scanf("%d",&N);
	for(int i=1;i<N;i++)
	{
		int u,v,d;
		scanf("%d%d%d",&u,&v,&d);
		adj[u].emplace_back(v,d);
		adj[v].emplace_back(u,d);
	}
	
	dfs(1);
	int c1=-1,c2=-1,best=0x7F7F7F7F;
	long long ans=0;
	for(int i=1;i<=N;i++)
	{
		if(fa[i])
			ans+=2LL*min(siz[i],siz[1]-siz[i])*dis[i];
		
		int tmp=max(val[i],siz[1]-siz[i]);
		if(tmp==best)
			c2=i;
		if(tmp<best)
			best=tmp,c1=i,c2=-1;
	}
	if(c2!=-1)
	{
		if(fa[c2]==c1)
			ans-=dis[c2];
		else
			ans-=dis[c1];
	}
	else
	{
		int mn=0x7F7F7F7F;
		for(auto e:adj[c1])
			mn=min(mn,e.d);
		ans-=mn;
	}
	printf("%lld\n",ans);
	
	return 0;
}


Measured memory_bytes: 11264
import itertools

a, b, m = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
m_list = [list(map(int, input().split())) for _ in range(m)]

kumiawase_kingaku = min(a_list) + min(b_list)

for x, y, c in m_list:
    reizouko = a_list[x-1]
    denshirenji = b_list[y-1]
    kingaku = reizouko + denshirenji - c
    if kingaku < kumiawase_kingaku:
        kumiawase_kingaku = kingaku

print(kumiawase_kingaku)

Measured memory_bytes: 82028