akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n, a, b; cin >> n >> a >> b;
	vi x(n); rep(i, n) cin >> x[i];
	ll ans = 0;
	rep(i, n - 1){
		ans += min((x[i + 1] - x[i]) * (ll)a, (ll)b);
	}
	cout << ans << endl;
	
	return 0;
}

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

vector<string> v;
int h, w;

int bfs(){
    int d[h][w];
    int dx[4]={1, 0, -1, 0};
    int dy[4]={0, 1, 0, -1};
    queue<pair<int, int> > que;
    rep(i, h)rep(j, w) d[i][j]=INF;
    que.push(make_pair(0, 0));
    d[0][0]=0;
    while (que.size())
    {
        pair<int, int> p = que.front();
        que.pop();
        if(p.first==h-1&&p.second==w-1) break;
        rep(i, 4){
            int nx=p.first+dx[i];
            int ny=p.second+dy[i];
            if(nx>=0&&nx<h&&ny>=0&&ny<w&&v[nx][ny]=='.'&&d[nx][ny] == INF){
                que.push(make_pair(nx, ny));
                d[nx][ny]=d[p.first][p.second]+1;
            }
        }
    }
    return d[h-1][w-1]+1;
    
}

int main(void){
    cin>>h>>w;
    v.resize(h);
    rep(i, h){
        cin>>v[i];
    }
    int minimum=bfs();
    if(minimum>=1000){
        cout<<-1<<endl;
        return 0;
    }
    int ans=0;
    rep(i, h){
        rep(j, w){
            if(v[i][j]=='.') ans++;
        }
    }
    ans-=minimum;
    
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    
    class Program
    {
        private const long COMDIV = 1000000007;

        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            Dictionary<double,int> dic = new Dictionary<double, int>();
            for (int x = 1; x <= 100; x++)
            {
                for (int y = 1; y <= 100; y++)
                {
                    for (int z = 1; z <= 100; z++)
                    {
                        var cal = Math.Pow(x, 2) + Math.Pow(y, 2) + Math.Pow(z, 2) + x * y + x * z + y * z;
                        if (!dic.ContainsKey(cal))
                        {
                            dic[cal] = 1;
                        }
                        else
                        {
                            dic[cal]++;
                        }
                    }
                }
            }

            for (int i = 1; i <= N; i++)
            {
                if (!dic.ContainsKey(i))
                {
                    Console.WriteLine(0);
                }
                else
                {
                    Console.WriteLine(dic[i]);
                }
            }
        }
    }
}

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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
 
typedef long long ll;
using namespace std;
 
int main() {
  int h,w;

  int x[] ={1,1,1,0,0,-1,-1,-1};
  int y[] ={1,0,-1,1,-1,1,0,-1};
  cin >> h >> w;
  char s[h][w];

  rep(i,0,h){
    rep(j,0,w){
      cin >> s[i][j];
    }
  }

  rep(i,0,h){
    rep(j,0,w){
      int c = 0;
      if(s[i][j] == '#') printf("%c",s[i][j]);
      else{
        rep(k,0,8){
          if(i+x[k] < 0 || i+x[k] >= h || j+y[k] < 0 || j+y[k] >= w) continue;
          if(s[i+x[k]][j+y[k]] == '#'){
            c++;
          }
        }
        printf("%d",c);
      }
    }
    printf("\n");
  }
	return 0;
}

Measured memory_bytes: 256
// atcoder/abc141/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  lli n, k, q;
  while (cin >> n >> k >> q) {
    vector<lli> a(q);
    cin >> a;
    each (i, a) --i;

    map<int, int> cnt;
    each (i, a) ++cnt[i];
    vector<lli> v(n, -1 * q + k);
    each (i, cnt) v[i.first] += i.second;
    each (i, v) cout << (0 < i ? "Yes" : "No") << endl;
  }

  return 0;
}


Measured memory_bytes: 5120
N,M = map(int, input().split())
stN = ""
stM = ""
for i in range(0,N):
  stN = stN + str(M)
for j in range(0,M):
  stM = stM + str(N)
if stN <= stM:
  print(stN)
else:
  print(stM)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long x = sc.NextLong();

        long answer = 0;
        if (x >= 1800)
        {
            answer = 1;
        }
        else if (x >= 1600)
        {
            answer = 2;
        }
        else if (x >= 1400)
        {
            answer = 3;
        }
        else if (x >= 1200)
        {
            answer = 4;
        }
        else if (x >= 1000)
        {
            answer = 5;
        }
        else if (x >= 800)
        {
            answer = 6;
        }
        else if (x >= 600)
        {
            answer = 7;
        }
        else
        {
            answer = 8;
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27540
#include<stdio.h>

int count(int c,int a,int n){
  if(c>=1){
    if(a>=1){
      if(n>=1){
	return 1+count(c-1,a-1,n-1);
      }
      else if(c>=2){
	return 1+count(c-2,a-1,n);
      }
    }
    else if(c>=3){
      return 1+count(c-3,a,n);
    }
  }
  return 0;
}

void doit(int m){
  if(m!=0){
    int ans;
    int c,a,n;
    scanf("%d %d %d",&c,&a,&n);
    ans=count(c,a,n);
    printf("%d\n",ans);
    doit(m-1);
  }
}

int main(){
  int m;
  scanf("%d",&m);
  doit(m);
  return 0;
}

Measured memory_bytes: 604
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		int C = stdIn.nextInt();
		
		double Cc = C * Math.PI /180;
		
		double L = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(Cc));
		double h = b * Math.sin(Cc);
		double S = b * Math.sin(Cc) * a /2;
		
		System.out.println(S);
		System.out.println(L + a + b);
		System.out.println(h);
	}
}

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

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef map<int,int> mii;

const int MOD = 1e9+7;
const int maxN = 2e5+1;
// ll fact[maxN];

// void factorial () {
// 	fact[0] = 1;
// 	for (int i = 1;i < maxN;++i) {
// 		fact[i] = (ll)i*fact[i-1];
// 	}
// }

ll power (ll x,ll n) {
	ll res = 1;
	while (n) {
		if (n&1) {
			res = (res*x)%MOD;
		}
		n = n/2;
		x = (x*x)%MOD;
	}
	return res;
}

ll modInverse (ll x) {
	return power(x,MOD-2);
}

ll nCr (ll n,ll k) {
	if (k > n) {
		k = n-k;
	}
	ll res = 1;
	for (ll i = 0;i < k;++i) {
		res = (res*(n-i))%MOD;
		res = (res*(modInverse(i+1)))%MOD;
	}
	return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	// factorial();
	ll n,a,b;
	cin >> n >> a >> b;
	ll ans = power(2,n)-1;
	if (a <= n) {
		ans = (ans-nCr(n,a)+MOD)%MOD;
	}
	if (b <= n) {
		ans = (ans-nCr(n,b)+MOD)%MOD;
	}
	cout << ans << '\n';
	return 0;
}



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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
ll n,a[100005],k;
ll dp[100005];
ll fun(int pos)
{
    if (pos==n-1)
    {
        return 0;
    }
    if (dp[pos]!=-1) return dp[pos];
    ll ret1=1e13;
    for (int i=1;i<=k;i++)
    if (pos+i<=n-1)
    ret1=min(ret1,abs(a[pos]-a[pos+i])+fun(pos+i));

    return dp[pos]=ret1;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
//    cout<<fixed;
//    cout<<setprecision(10);

    cin>>n>>k;
    for (int i=0;i<n;i++) cin>>a[i];
    memset(dp,-1,sizeof(dp));
    ll ans=fun(0);
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 8064
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][][] F = new int[n][5][2];
		for (int i = 0; i < F.length; ++i) {
			for (int j = 0; j < F[i].length; ++j) {
				for (int k = 0; k < F[i][j].length; ++k) {
					F[i][j][k] = sc.nextInt();
				}
			}
		}
		long[][] p = new long[n][11];
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < 11; ++j) {
				p[i][j] = sc.nextInt();
			}
		}

		long ret = -Long.MAX_VALUE / 3;
		for (int s = 1; s < 1 << 10; ++s) {
			int[] c = new int[n];
			for (int i = 0; i < 5; ++i) {
				for (int j = 0; j < 2; ++j) {
					if ((s >> (i + j * 5)) % 2 == 0) {
						continue;
					}
					for (int k = 0; k < n; ++k) {
						c[k] += F[k][i][j];
					}
				}
			}
			long tmp = 0;
			for (int i = 0; i < n; ++i) {
				tmp += p[i][c[i]];
			}
			ret = Math.max(ret, tmp);
		}
		System.out.println(ret);
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


Measured memory_bytes: 26188
ls = [
    1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
]

K = int(input())

print(ls[K - 1])

Measured memory_bytes: 38384
#pragma GCC optimize("-O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void Main();
#ifdef ConanYu
#include "local.hpp"
#else
#define debug(...) do { } while(0)
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main();
}
#endif

void Main() {
  ll a, b; cin >> a >> b;
  ll g = __gcd(a, b);
  int ans = 1;
  for(ll i = 2; i * i <= g; i++) {
    if(g % i == 0) {
      ans++;
      while(g % i == 0) g /= i;
    }
  }
  if(g > 1) ans++;
  cout << ans << "\n";
}


Measured memory_bytes: 256
vertices, edges = (int(n) for n in input().split(" "))
cost_dp = [[float("inf") if n != m else 0 for n in range(vertices)] for m in range(vertices)]
for e in range(edges):
    v1, v2, weight = (int(n) for n in input().split(" "))
    cost_dp[v1][v2] = weight
for neg in range(2):
    updated = 0
    for t in range(vertices):
        for i in range(vertices):
            for k in range(vertices):
                if cost_dp[i][k] > cost_dp[i][t] + cost_dp[t][k]:
                    updated = 1
                    cost_dp[i][k] = cost_dp[i][t] + cost_dp[t][k]
if neg == 1 and updated:
    print("NEGATIVE CYCLE")
else:
    for ve in range(vertices):
        ans = ["INF" if n == float("inf") else n for n in cost_dp[ve]]
        print(*ans)

Measured memory_bytes: 8664
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = do
	[ n, k ] <- readInts
	s <- getLine
	let
		groups = length $ group s
		groups' = max 1 $ groups - k * 2
	print $ n - groups'

Measured memory_bytes: 5500
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N, M; cin >> N >> M;
    vector<char> C(N, ' '); bool ok = true;
    REP(i, 0, M) {
        int s; char c; cin >> s >> c;
        s--;
        if (C[s] == ' ' || C[s] == c) C[s] = c;
        else ok = false;
    }

    if (!ok) {
        cout << -1 << endl;
        return 0;
    }

    if (C[0] == '0' && N != 1) {
        cout << -1 << endl;
        return 0;
    }

    vector<char> ans(N, ' ');
    REP(i, 0, N) {
        if (C[i] != ' ') {
            ans[i] = C[i];
            continue;
        }
        if (i == 0 && N != 1) ans[i] = '1';
        else ans[i] = '0';
    }

    REP(i, 0, N) cout << ans[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,x,y;
	cin>>a>>b>>c;
	cin>>x>>y;
	int sum=0;
	if(x>y)
	{
		if(a+b>2*c)
		{
			sum+=2*c*y;
			if(a>2*c)
			{
				sum+=2*c*(x-y);
			}
			else
			{
				sum+=a*(x-y);
			}
		}
		else
		{
			sum+=a*x+b*y;
		}
	}
	if(y>x)
	{
		if(a+b>2*c)
		{
			sum+=2*c*x;
			if(b>2*c)
			{
				sum+=2*c*(y-x);
			}
			else
			{
				sum+=b*(y-x);
			}
		}
		else
		{
			sum+=a*x+b*y;
		}
	}
	if(x==y)
	{
		if(a+b>2*c)
		{
			sum+=2*c*x;
		}
		else sum+=(a+b)*x;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
# AGC014A - Cookie Exchanges
def main():
    a, b, c = list(map(int, input().rstrip().split()))
    if a == b == c:
        A = (a, b, c)
        if any(i % 2 != 0 for i in A):
            print(0)
        else:
            print(-1)
        return
    ch = {(a, b, c)}
    ans = 0
    while True:
        A = (a, b, c)
        if any(i % 2 != 0 for i in A):
            break
        a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2
        if (a, b, c) in ch:
            break
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str;
        int i,j,a,b,sum;
        while(true){
            str = scan.nextLine();
            String[] num = str.split(" ", 0);
            a = Integer.valueOf(num[0]);
            b = Integer.valueOf(num[1]);
            if(a==0&&b==0){
                break;
            }
            sum = calc(a,b,0);
            System.out.println(sum);

        }


        scan.close();
    }
    public static int  calc(int a, int b,int c){
        int res;
        if(b < 0 || a < 0||c > 3){
            return 0;
        }else if(b == 0&&c == 3){
            return 1;
        }else{
            return calc(a-1, b, c) + calc(a-1, b-a, c+1);
        }
    }
}





Measured memory_bytes: 26416
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod=MOD):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        if k<0 or n<k:
            return 0
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

######################################################

ans='No'
N=intput()
tmp=0
for i in range(N):
    d1,d2=mint()
    if d1==d2:
        tmp+=1
    else:
        tmp=0
    if tmp==3:
        ans='Yes'
        break
print(ans)

Measured memory_bytes: 68080
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char *argv[])
{
    for(;;) {
        int n, m;
        cin >> n >> m;
        if(n == 0 && m == 0) break;
        vector<int> is;
        for(int i = 0; i < n; i++) {
            int c;
            cin >> c;
            is.push_back(c);
        }
        int best = -1;
        for(int i = 0; i < n; i++) {
            for(int j = i+1; j < n; j++) {
                int k = is[i] + is[j];
                if( k <= m && k > best) best = k;
            }
        }
        if(best < 0) cout << "NONE" << endl;
        else cout << best << endl;
    }
    return 0;
}


Measured memory_bytes: 3168
fn read() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let vec: Vec<String> = s
        .trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();

    vec[1].to_string()
}

fn main() {
    let s = read();
    println!("A{}C", s.chars().next().unwrap());
}


Measured memory_bytes: 4352
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
  int N;
  while(cin>>N && N){
    vector<int> l(N);
    REP(i, N) cin>>l[i];
    int M = 256;
    int as, aa, ac;
    double ent = 1e32;
    REP(S, 16)REP(A, 16)REP(C, 16){
      vector<int> R(N + 1);
      R[0] = S;
      REP(i, N) R[i + 1] = (A * R[i] + C) % M;
      REP(i, N) R[i + 1] = (R[i + 1] + l[i]) % M;
      double cnt[256] = {};
      REP(i, N) cnt[R[i + 1]] += 1.0;
      double e = 0;
      REP(i, 256)if(cnt[i] != 0){
        double c = cnt[i];
        e += -c/N * log(c/N);
      }
      if(e + EPS < ent){
        ent = e;
        as = S, aa = A, ac = C;
      }
    }
    printf("%d %d %d\n", as, aa, ac);
  }
  return 0;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    long long A=1,B=1;
    long long a[n],b[n];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        long long x=max((A-1)/a[i],(B-1)/b[i])+1;
        A=a[i]*x,B=b[i]*x;
    }
    cout<<A+B<<endl;
    return 0;
}

Measured memory_bytes: 3596
/*
 * “My code isn't a mess! It's organised chaos!”
 */

/*
 * short     2^15-1 ~ 3e4
 * int       2^31-1 ~ 2e9
 * long x86  2^31-1 ~ 2e9
 * long long 2^63-1 ~ 9e18
 */

#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define fr(a,b) for (int a=0; a<b; ++a)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1000000007ll;
const int infty = numeric_limits<int>::max();
struct _{_(){ios_base::Init i;ios_base::sync_with_stdio(0);cin.tie(0);}}_;
void err() {cerr << endl;}
template<typename T, typename... Ts>
void err(T a, Ts... as) {cerr << a << ' '; err(as...);}

 /*
  * Всегда прогоняй макс-тест перед 
  * нажатием «Отослать». Всегда.
  */ 

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

    cout << 800 * n - 200 * (n/15) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <sstream>

using namespace std;

int main()
{
    string s;

    cin >> s;

    int i = 0;
    long na = 0;
    long nbc = 0;
    long na_carry = 0;
    long count = 0;

    while (i < s.size()) {
        na = 0;
        while (i < s.size() && s[i] == 'A') {
            na++;
            i++;
        }
        if (na == 0) {
            na_carry = 0;
            i++;
            continue;
        }
        nbc = 0;
        while (i + 1 < s.size() && s[i] == 'B' && s[i+1] == 'C') {
            nbc++;
            i += 2;
        }
        if (nbc == 0) {
            continue;
        }
        count += (na_carry + na) * nbc;
        na_carry += na;
    }
        
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 640
N, K = map(int, input().split())
P = [int(i)-1 for i in input().split()]
C = [int(i) for i in input().split()]


ans = -1e18
for si in range(N):
    x = si
    s = []
    tot = 0
    while True:
        x = P[x]
        s.append(C[x])
        tot += C[x]
        if x == si:
            break
    l = len(s)
    t = 0
    for i in range(l):
        t += s[i]
        if i+1 > K:
            break
        now = t
        if tot > 0:
            e = (K-i-1)//l
            now += tot*e
        ans = max(ans, now)
print(ans)


Measured memory_bytes: 80792
x,n = map(int,input().split())
p = list(map(int,input().split()))
tmp = []
for i in range(-101,102):
    tmp.append(i)

if n == 0:
    print(x)
else:
    for i in p:
        tmp.remove(i)
    
    ans = []
    for i in tmp:
        a = abs(x-i)
        ans.append(a)
 
    b = min(ans)
    
    c = x+b
    d = x-b
 
    if c and d in tmp:
        print(d)
    elif c in tmp:
        print(c)
    elif d in tmp:
        print(d)


Measured memory_bytes: 9140
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
// #pragma GCC optimize("unroll-loops")



#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include <ext/rope>
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define Find order_of_key
// #define at find_by_order
#define x first
#define y second
#define ll long long
#define lll __int128
#define ull unsigned long long
#define ulll unsigned __int128
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define gu getchar_unlocked()
#define pu putchar_unlocked()
#define all(x) x.begin(),x.end()
#define endl '\n'

ll arr[20][20];
int n;
ll dp[(1<<17)];
ll dp1[(1<<17)];
ll val(int m){
	ll &s=dp1[m];
	if(~s)return s;
	s=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(m&(1<<i) && m&(1<<j)){
				s+=arr[i][j];
			}
		}
	}return s;
}

ll f(int m){
	if(m==0)return 0;
	ll &ma=dp[m];
	if(~ma)return ma;
	ma=0;
	for (int s=m; s; s=(s-1)&m){
		ma=max(ma,val(s)+f(m^s));
	}return ma;
}

int main()
{
	fast;
	memset(dp,-1,sizeof dp);
	memset(dp1,-1,sizeof dp1);
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>arr[i][j];
		}
	}cout<<f((1<<n)-1)<<endl;
	return 0;
}

Measured memory_bytes: 5720
#include <stdio.h>
#include <stdlib.h>
#define INF 1000000000
#define NMAX 150
#define KMAX 10
#define MMAX 75
struct stone {
  int x;
  int w;
};
int main(void)
{
  int i, j, k, l, n, m, ans, lx[NMAX], dp[NMAX][KMAX][MMAX+1];
  struct stone rs[NMAX][MMAX];
  while (scanf("%d %d", &n, &m), n) {
    ans = INF;
    for (i = 0; i < n; i++) {
      scanf("%d", &lx[i]);
      for (j = 0; j < lx[i]; j++) {
        scanf("%d %d", &rs[i][j].x, &rs[i][j].w);
      }
    }
    for (i = 0; i < n; i++) {
      for (j = 0; j < lx[i]; j++) {
        for (k = 0; k <= m; k++) {
          dp[i][j][k] = INF;
        }
      }
    }
    for (j = 0; j < lx[0]; j++) dp[0][j][0] = 0;
    if (m) {
      for (j = 0; j < lx[1]; j++) dp[1][j][1] = 0;
    }
    for (i = 0; i < n - 1; i++) {
      for (j = 0; j < lx[i]; j++) {
        for (k = 0; k <= m; k++) {
          if (dp[i][j][k] == INF) continue;
          for (l = 0; l < lx[i+1]; l++) {
            int dj = abs(rs[i][j].x - rs[i+1][l].x), risk = (rs[i][j].w + rs[i+1][l].w) * dj;
            if (dp[i+1][l][k] > dp[i][j][k] + risk) dp[i+1][l][k] = dp[i][j][k] + risk;
          }
          if (k == m || i + 2 == n) continue;
          for (l = 0; l < lx[i+2]; l++) {
            int dj = abs(rs[i][j].x - rs[i+2][l].x), risk = (rs[i][j].w + rs[i+2][l].w) * dj;
            if (dp[i+2][l][k+1] > dp[i][j][k] + risk) dp[i+2][l][k+1] = dp[i][j][k] + risk;
          }
        }
      }
    }
    for (j = 0; j < lx[n-2]; j++) {
      for (k = 0; k < m; k++) {
            //printf("%d ", dp[n-2][j][k]);
        if (ans > dp[n-2][j][k]) ans = dp[n-2][j][k];
      }
    }
    //putchar('\n');
    for (j = 0; j < lx[n-1]; j++) {
      for (k = 0; k <= m; k++) {
              //printf("%d ", dp[n-1][j][k]);
        if (ans > dp[n-1][j][k]) ans = dp[n-1][j][k];
      }
    }
    printf("%d\n", ans);
  }
}


Measured memory_bytes: 2212
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    for(auto& i : v){
        cin >> i;
    }
    sort(all(v));
    int sum = 0;
    REP(i, n-1){
        sum += v[i];
    }
    cout << ((v.back() - sum < 0) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
typedef long long ll;
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n],b[n],c[n-1];
  rep(i,n){cin>>a[i];}
  rep(i,n){cin>>b[i];}
  rep(i,n-1){cin>>c[i];}
  int k=0;
  rep(i,n){k+=b[a[i]-1];}
  rep(i,n-1){if(a[i+1]==a[i]+1){k+=c[a[i]-1];}}
  cout<<k<<endl;
}


Measured memory_bytes: 256
import sys
N=int(input())
S=[]
for _ in range(N):
    S.append(int(input()))
S.sort()
ans=sum(S)
i=0
if ans % 10 ==0:
    f=False
else:
    f=True
while ans % 10 == 0 and i < N:
    if S[i] % 10 !=0:
        ans -=S[i]
        f=True
    i+=1
if f:
    print(ans)
else:
    print(0)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_multiset tree<long long , null_type,less_equal<long long >, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_set tree<long long , null_type,less<long long >, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#define ll long long

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    string s;cin>>s;
    if(s[1]=='B') s[1]='R';
    else s[1]='B';
    cout<<s;
    return 0;
}


Measured memory_bytes: 3668
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    long long int H,W;
    cin>>H>>W;
    long long int ans=0;
    if(H==1||W==1){
        cout<<1<<endl;
    }
    else {
        if ((H * W) % 2 == 0) {
            ans = H * W / 2;
        } else {
            ans = (H * W / 2) + 1;
        }

        cout << ans << endl;
    }
}


Measured memory_bytes: 256
def gcd(a,b): 
    if a == 0: 
        return b 
    return gcd(b % a, a) 
  
def lcm(a,b): 
    return (a*b) // gcd(a,b) 
  
n = int(input())
arr = input()   # takes the whole line of n numbers
a = list(map(int,arr.split(' ')))
l = a[0]
ans = 0
for i in range(n):
    l = lcm(l, a[i])
for i in range(n):
    ans = ans + l//a[i]
print(ans%1000000007)

Measured memory_bytes: 4084
#include <iostream>

using namespace std;

bool is_uruu(int y)
{
	return y % 400 == 0 || (y % 4 == 0 && y % 100 != 0);
}

int daymonth(int y, int m)
{
	if (m == 2)
	{
		return is_uruu(y) ? 29 : 28;
	}
	
	if (m == 4 || m == 6 || m == 9 || m == 11)
	{
		return 30;
	}

	return 31;
}

int daycount(int y, int m, int d)
{
	int ret = 0;

	for (int i = 1; i < y; i++)
	{
		ret += is_uruu(i) ? 366 : 365;
	}

	for (int i = 1; i < m; i++)
	{
		ret += daymonth(y, i);
	}

	ret += d;

	return ret;
}

int main()
{
	int y1, m1, d1, y2, m2, d2;

	while (true)
	{
		cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;

		if (y1 < 0 || m1 < 0 || d1 < 0 || y2 < 0 || m2 < 0 || d2 < 0)
		{
			break;
		}

		cout << daycount(y2, m2, d2) - daycount(y1, m1, d1) << endl;
	}

	return 0;
}

Measured memory_bytes: 3048
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int n;
	cin >> n;
	
	int even = 0;
	for(int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		
		if( a % 2 == 0 ) even++;
	}
	
	if( n != even ) {
		cout << "first" << endl;
	} else {
		cout << "second" << endl;
	}
	
	
	return 0;
}


Measured memory_bytes: 3568
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f,g,h,x,y;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	scanf("%d %d %d %d",&e,&f,&g,&h);
	x=a+b+c+d;
	y=e+f+g+h;
	if(x>y || x==y) {
		printf("%d\n",x);
	}
	else {
		printf("%d\n",y);
	}
	return 0;
}
	

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

//read_kaisetsu
int main() {
    string s;cin>>s;
    ll n = s.size();

    ll ans = n*(n-1)/2 + 1;
    
    ll a[27];rep(i,27)a[i]=0;
//    memset(a,0,sizeof(a));

    rep(i,n){
    ll tmp = s[i]-'a';
//      cout<<tmp<<endl;
    ++a[tmp];
    }
    rep(i,27)if(a[i]>=2)ans-=a[i]*(a[i]-1)/2;

    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
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;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,p;cin>>a>>p;
    p += a*3;
    cout<<p/2<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	vector<ll> a;
	ll sum = 0;
	for (ll i = 0; i < n; i++)
	{
		ll x;
		cin >> x;

		sum += x;

		if (x % 10 != 0)
		{
			a.push_back(x);
		}
	}

	sort(all(a));

	if (a.size() > 0 && sum % 10 == 0)
	{
		sum -= a[0];
	}

	println((sum % 10 == 0 ? 0 : sum));

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=1270;

int main(){
	vi a;
	a.push_back(6);
	for(int i=1;7*i+1<=300000;i++){
		int x=7*i+1;
		bool B=1;
		for(auto j:a) if(x%j==0){
			B=0;
			break;
		}
		if(B) a.push_back(x);
		x=7*i+6;
		B=1;
		for(auto j:a) if(x%j==0){
			B=0;
			break;
		}
		if(B) a.push_back(x);
	}
	while(1){
		int n;
		cin>>n;
		if(n==1) break;
		cout<<n<<':';
		for(auto i:a) if(n%i==0) cout<<' '<<i;
		cout<<endl;
	}
}


Measured memory_bytes: 3244
#include<stdio.h>
#include<string.h>
 
 
int main(){
  int N,i;
  scanf("%d", &N);
 
  char W[N+1][12];
 
  for(i = 0; i < N+1; i++){
    fgets(W[i],12,stdin);
    W[i][strlen(W[i])-1] = '\0';
  }
 
 
 
 
  int j,cnt;
 
  for(i =1; i< N+1; i++){
    for(j = i+1; j < N+1; j++ ){
      if(strcmp(W[i],W[j]) == 0){
        printf("No\n");
        return 0;
      }
    }
  }
 
  for(i = 1; i< N+1; i++){
    if(i != N){
      j = i+1;
      cnt = strlen(W[i]);
      //      printf("cnt = %d\n",cnt);
      if(W[i][cnt-1] != W[j][0]){
        printf("No\n");
        return 0;
      }
    }
 
  }
 
  printf("Yes\n");
 
  return 0;
 
 
 
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
  
  int n,w;
  cin>>n>>w;
  
 long long int dp[n+1][w+1];
  for(int i=0;i<=n;i++)
  dp[i][0]=0;
  for(int j=0;j<=w;j++)
    dp[0][j]=0;
  
  for(int i=1;i<=n;i++)
  {
    int v,curr;
    cin>>curr>>v;
    for(int j=1;j<=w;j++)
    {
      
      	if(j<curr)
        {
          dp[i][j]=dp[i-1][j];
        }
       else
       {
        dp[i][j]=max(v+dp[i-1][j-curr],dp[i-1][j]);
       } 
      
     }
    
  }
  cout<<dp[n][w]<<endl;
  
  
  
  
  
  return 0;
}

Measured memory_bytes: 79104
n=int(input())
v = list(map(int,input().split()))

dic0 = [0 for i in range(10**5+1)]
dic1 = [0 for i in range(10**5+1)]
for i in range(n):
    if i%2==0:    
        dic0[v[i]] += 1
    if i%2==1:
        dic1[v[i]] += 1

MX0_1 = max(dic0)
MX1_1 = max(dic1)

li0 = []
li1 = []


for i in range(10**5+1):
    # if dic0[i]>10:
    #     print(i,dic0[i])
    # if dic1[i]>10:
    #     print(i,dic1[i],"\n")
    
    if dic0[i] == MX0_1:
        li0.append(i)
        dic0[i] = 0
    if dic1[i] == MX1_1:
        li1.append(i)
        dic1[i] = 0

# print(li0,li1)
# print(MX0_1,MX0_1)

if len(li0)>=2 or len(li1)>=2:
    print(n-MX0_1-MX1_1)
elif li0[0] == li1[0]:
    print(min(n-MX0_1-max(dic1), n-MX1_1-max(dic0)))
elif li0[0] != li1[0]:
    print(n-MX0_1-MX1_1)

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

#define F first 
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 10010, M = 10;

int n, h, w;
int a[N];
int g[N][N];

int main()
{
	cin >> h >> w >> n;
	for (int i = 1; i <= n; i ++ ) cin >> a[i];
	
	for (int i = 0, k = 1; i < h; i ++ )
		if (i & 1)
		{
			for (int j = 0; j < w; j ++ )
			{
				g[i][j] = k;
				if ( -- a[k] == 0) k ++ ;
			}
		}
		else
		{
			for (int j = w - 1; j >= 0; j -- )
			{
				g[i][j] = k;
				if ( -- a[k] == 0) k ++ ;
			}
		}
	
	for (int i = 0; i < h; i ++ )
	{
		for (int j = 0; j < w; j ++ )
			cout << g[i][j] << ' ';
		puts("");
	}
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
const int OFS = 100;
Int dp[111][111];
void mvX(Int k){
  for(Int i=0;i<111;i++)
    for(Int j=0;j+k<111;j++)
      dp[i][j]=dp[i][j+k];
}

void mvY(Int k){
  for(Int j=0;j<111;j++)
    for(Int i=110;i>=k;i--)
      dp[i][j]=dp[i-k][j];
}


signed main(){
  Int w,h,t,p;
  while(cin>>w>>h>>t>>p,w){
    vector<Int> d(t),c(t);
    for(Int i=0;i<t;i++) cin>>d[i]>>c[i];
    vector<Int> x(p),y(p);
    for(Int i=0;i<p;i++) cin>>x[i]>>y[i];
    memset(dp,0,sizeof(dp));
    for(Int i=0;i<h;i++)
      for(Int j=0;j<w;j++)
	dp[OFS-i][j]=1;
    
    for(Int k=0;k<t;k++){
      if(d[k]==1){
	for(Int i=0;i<111;i++){
	  for(Int j=0;j<c[k];j++){
	    dp[i][c[k]*2-(j+1)]+=dp[i][j];
	    dp[i][j]=0;
	  }
	}
	mvX(c[k]);
      }else{
	for(Int j=0;j<111;j++){
	  for(Int i=0;i<c[k];i++){
	    dp[OFS-c[k]*2+(i+1)][j]+=dp[OFS-i][j];
	    dp[OFS-i][j]=0;
	  }
	}
	mvY(c[k]);
      }
      if(0){
	for(int i=0;i<h;i++){
	  for(int j=0;j<w;j++){
	    cout<<dp[OFS-i][j];
	  }
	  cout<<endl;
	}
	cout<<endl;
      }
    }

    for(Int i=0;i<p;i++)
      cout<<dp[OFS-y[i]][x[i]]<<endl;
  }
  return 0;
}



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

int main() {
    int sum = 0;
   char s[3],o;
   for(int i = 0;i < 3;i++) cin >> s[i];
   for(int i = 0;i < 3;i++) {
       if(s[i]=='o') sum+=1;
   }
   cout << sum*100+700 << endl;
   return 0;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {

    input = input.split("\n");
  
    line1 = input[0].split(" ");
    let N = parseInt(line1[0], 10);
    let K = parseInt(line1[1], 10);

    line2 = input[1].split(" ");

    let ans = '';
    let pre = 0;
    let cur = 0;

    for (let i = K; i < N; i++) {
        pre = parseInt(line2[i - K], 10);
        cur = parseInt(line2[i], 10);

        if (pre < cur) {
            ans = ans + "Yes\n";
        } else {
            ans = ans + "No\n";
        }
    }

    console.log(ans);
}


Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 53368
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> dp(n + 1, 100000000);
    dp[0] = 0;
    vector<int> lis;
    lis.push_back(1);
    for (int i = 6; i <= n; i *= 6) {
        lis.push_back(i);
    }
    for (int i = 9; i <= n; i *= 9) {
        lis.push_back(i);
    }
    for (int i = 1; i <= n; i++) {
        for (auto t : lis) {
            if (i - t >= 0) {
                dp[i] = min(dp[i], dp[i - t] + 1);
            }
        }
    }

    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main(){

        string s;
        cin >>s;
        if(s=="Sunny"){
            cout<<"Cloudy";
        }
        else if(s=="Cloudy"){
            cout<<"Rainy";
        }
        else{
            cout<<"Sunny";
        }

        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
int x;
vector<int> pr;
int isprime(int x){

int i;
int cou=0;
for(i=2;i<x;i++){
    if(x%i==0)
    {cou++;
    break;
    }

}
if(cou==0)
    return 1;
else
    return 0;
}

int main(){
x=2200;
int n;
int i,j;
cin>>n;
ll a[n+1];
int fl=0;
map<pair<ll,ll>, int> w;
for(i=2;i<x;i++){

    if(isprime(i)){

        pr.pb(i);
    }

}

for(i=1;i<=n;i++)
    cin>>a[i];

    for(i=1;i<=n;i++){
  ll x=a[i],y=1,z=1;
        for(j=0;j<pr.size();j++){
            int cou=0;
            while(x%pr[j]==0){
                    cou++;
            x=x/pr[j];

            }
            cou=cou%3;
            if(cou==1){
                y=y*pr[j];
                z=z*pr[j]*pr[j];
            }
            if(cou==2){

                 z=z*pr[j];
                y=y*pr[j]*pr[j];
            }


        }
        if(x>1){

          ll xx=(ll)sqrt(x);
          if((xx*xx)==x)
          {
              y=y*x;
              z=z*xx;
          }
          else
          {
              y=y*x;
              z=z*(x)*x;
          }


        }

        pair<ll,ll> t=mp(y,z);
        if(y==1&&z==1){
            fl=1;
        }
        else
        w[t]=w[t]+1;
    }
map<pair<ll,ll>, int>::iterator z=w.begin();

int ans=0;

int g=0;
while(z!=w.end()){

    pair<ll,ll> x=(*z).first;



    pair<ll,ll> o;
    o.first=x.second;
    o.second=x.first;
    if(w.find(o)==w.end())
    {ans=ans+w[x];

    }
    else{
        g=g+max(w[o],w[x]);


    }



    z++;

}
ans=ans+g/2;
ans=ans+fl;
cout<<ans<<endl;





return 0;}


Measured memory_bytes: 7296
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_sum = [0]
B_sum = [0]
for i in range(N):
    A_sum.append(A_sum[i]+A[i])
for i in range(M):
    B_sum.append(B_sum[i]+B[i])

num = 0
J = M
for i in range(N+1):
    if A_sum[i] > K:
        break
    for j in reversed(range(J+1)):
        if A_sum[i] + B_sum[j] <= K:
            if num < i+j:
                num = i+j
            J = j
            break

print(num)


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

int main(void) {
    int ans, sum[17]; 
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (i == 0) sum[i] = s[0] - '0';
        else sum[i] = s[i] - '0' + sum[i - 1];
    }
    ans = sum[s.size() - 1];
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != '0') {
            ans = max((int)(sum[i] - 1 + 9 * (s.size() - i - 1)), ans);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int abs(int x) {
    if (x >= 0) return x;
    else return -x;
}

int main() {
    int x, n;
    cin >> x >> n;
    vector<int> d(102);
    rep(i,n) {
        int p;
        cin >> p;
        d[p] = 1;
    }
    P ans(99999, -1);
    for (int i = 0; i <= 101; ++i) {
        if (d[i] == 1) continue;
        int dif = abs(x - i);
        ans = min(ans, P(dif, i));
    }
    cout << ans.second << endl;
    return 0;
}

Measured memory_bytes: 3220
#include <stdio.h>
#include <string.h>
#define rep(i,l,n) for(i=l;i<n;i++)

int main(void){
	char b[201],a[201];
	int m,i,h,len,j;
	
	while(1){
		scanf("%s",b);
		if(b[0]=='-') break;
		len=strlen(b);
		
		scanf("%d",&m);
		
		rep(i,0,m){
			scanf("%d",&h);
			rep(j,0,len-h) a[j]=b[j+h];
			rep(j,len-h,len) a[j]=b[j-len+h];
			rep(j,0,len) b[j]=a[j];
		}
		rep(i,0,len) printf("%c",b[i]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 568