akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
 
#define db double
using namespace std;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll h1, h2, m1, m2, k;
        cin >> h1 >> m1 >> h2 >> m2 >> k;
        ll mins = (h2 - h1) * 60 + (m2 - m1); 
        cout << max(0LL, mins - k);
    }
    return 0;
}

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

using namespace std;

char op[2] = {'+', '-'};

int main() {
  string s;
  cin >> s;
  int a = s[0] - '0';
  int b = s[1] - '0';
  int c = s[2] - '0';
  int d = s[3] - '0';

  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < 2; k++) {
        int sum = a;
        if (i)
          sum -= b;
        else
          sum += b;
        if (j)
          sum -= c;
        else
          sum += c;
        if (k)
          sum -= d;
        else
          sum += d;
        if (sum == 7) {
          cout << a << op[i] << b << op[j] << c << op[k] << d << "=7" << endl;
          return 0;
        }
      }
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

int n;
LL a[100010];

void solve() {
  cin >> n;
  REP(i, n) cin >> a[i];

  LL tmp = 0;
  REP(i, n) {
    if (i & 1) tmp -= a[i]*2;
    else tmp += a[i]*2;
  }

  LL res = tmp/2;
  REP(i, n) {
    cout << res << " ";
    res = (a[i] - res/2)*2;
  }
  cout << endl;
}

int main() {
	solve();
	return 0;
}


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

#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define pb push_back
#define endl "\n"
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007

void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}

int main(){
	c_p_c();
	ll n,k; cin >> n >> k;
	if(n%k==0){
		cout << 0 << endl;
		return 0;
	}
	if(n-k<0){
		ll mxn = abs(n-k) > n ? n : abs(n-k);
		cout << mxn << endl;
		return 0;
	}

	ll a = n%k;
	ll b = abs((n%k)-k);

	cout << min(a,b) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll INF = 1LL<<60;
/////////////////////////////////
int main(){
    ll N;
    cin >> N;
    ll ans = INF;
    for (ll i = 1; i * i <= N;i++){
        if(N%i==0){
            ans = min(ans, i - 1 + (N / i) - 1);
        }
    }
    cout << ans << endl;
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;

const ll e5 = 1 << 20;
const ll mod = 998244353;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

int main() {
  int n;
  cin >> n;
  vl w(n, 0);

  ll sum = 0;
  rep(i, n) {
    cin >> w[i];
    sum += w[i];
  }


  int s1 = 0;
  int s2 = sum;
  int min_diff = INT_MAX;
  rep(i, n) {
    s1 += w[i];
    s2 -= w[i];
    int diff = s1 - s2;
    if (diff < 0) {
      diff = -1 * diff;
    }
    if (diff < min_diff) {
      min_diff = diff;
    }
  }

  cout << min_diff << endl;

  return 0;
}

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

const int nmax=3010; 
ll N;
int bit[nmax];

void solve(){
    ll n;
    int i,j;
    n = N;  
    rep(i,nmax) bit[i]=0;
    i = 0;
    while(1){
        if (n - ((ll)(n/2)*2 ) != 0){
            // cout << "bit " << n << " " << i << " set 1" << endl;
            bit[i]=1;
        } 
        n = (ll)((n - bit[i]) /  (-2) );
        if (n ==  0){ break; }
        i = i + 1;
    }
    for(int j=i; j>=0; j--){
        cout << bit[j];
    }
    cout << endl;
}

int main() {
    int i,j; 
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N ;
    // cout << N <<  endl;
    solve();
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    ll rem = n % (a + b);
    ll q = n / (a + b);
    ll ans = (q * a) + min(rem, a);

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

Measured memory_bytes: 256
n = int(input())
x = input().split()
y = [0]
c = 0
for i in range(n-1):
  if int(x[i]) >= int(x[i+1]):
    c = c + 1
  else:
    y.append(c)
    c = 0
y.append(c)
print(max(y))

Measured memory_bytes: 11136
// https://ynucpc.github.io/blog/2018/04/15/cp_vscode/
// http://www.atmarkit.co.jp/ait/articles/1509/08/news019.html

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b)) 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
int stoi (string s, int tmp=10){
	istringstream stm(s);
	int res;
	stm >> res;
	return res;
}
double stod(string s, int tmp=10){
	istringstream stm(s);
	double res;
	stm >> res;
	return res;
}


// 配列の総和
// greater



int main(){
	/*
	ll A;
    cin >> A;
	cout << "hello" << endl;
	cout << stoi("14") << endl;
	*/
	ll N, ans=0, l=0;
	cin >> N;
	ll H[N];
	rep(i, N)cin >> H[i];
	rep(l, N){
		while(H[l]!=0){
			ll r=l;
			while(r<N && H[r]>0){
				H[r]--;
				r++;
			}
			ans++;
		}
	}
	cout << ans << endl;

}








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

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long a=sc.nextInt();
		long b=sc.nextInt();
		long c=a*b;
		long x=Math.max(a, b);
		long y=Math.min(a, b);
		while(y!=0) {
			long h=y;
			y=x%y;
			x=h;
		}
		System.out.println(c/x);

	}

}


Measured memory_bytes: 23764
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int []a = new int [n];
		Set <Integer>hs = new HashSet<Integer>();
		
		for(int i = 0 ; i < n ;i++) {
			a[i] = Integer.parseInt(sc.next());
			hs.add(a[i]);
		}
		sc.close();
		
		if(hs.size() > 3) {
			System.out.println("No");
			return;
		}
		if(n % 3 != 0 && hs.size() != 1) {
			System.out.println("No");
			return;
		}
		
		int []b = new int [hs.size()];
		int []c = new int [hs.size()];
		int id = 0;
		
		for(int num : hs) {
			c[id] = num;
			for(int i = 0 ; i < n ;i++) {
				if(a[i] == num) {
					b[id]++;
				}
			}
			id++;
		}
		
		if(hs.size() == 1) {
			if(c[0] == 0) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
		else if(hs.size() == 2) {
			if((b[0] == b[1] * 2) &&(c[0]^c[0]) == c[1]|| ((b[1] == b[0]*2) &&(c[1]^c[1]) == c[0] )) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
		else {
			if((b[0] == b[1])&&(b[1] == b[2])&&(c[0]^c[1]) == c[2]) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
	}

}


Measured memory_bytes: 50072
import java.util.Scanner;


public class Main{

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();

		int c = a*b;
		int d = (a+b)*2;
		System.out.println(c + " " + d);

	}
}



Measured memory_bytes: 25976
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)


// ------------debug用------------
#define FALSE cout<<"false"<<endl;
#define TRUE cout<<"true"<<endl;
// ------------debug用------------


// ------------計算用------------
#define ALL(x) (x).begin(),(x).end()
#define FOR(x) for(ll i = 0;i < x;++i)
// ------------計算用------------


// ------------出力用------------
#define PRINT(x) cout<<x<<endl;
// ------------出力用------------


using namespace std;
typedef long long ll;

int main(){
  string s;
  cin>>s;
  bool bad = false;
  for(int i = 0;i < 3;i++){
    if(s[i] == s[i + 1])bad = true;
  }
  if(bad)cout<<"Bad";
  else cout<<"Good";
  
  return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

// get next int value
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

// main calc
func calc() int {
	sc.Split(bufio.ScanWords)
	n := nextInt()

	max := nextInt()
	min := max

	for i := 1; i < n; i++ {
		val := nextInt()
		if val > max {
			max = val
		} else if val < min {
			min = val
		}
	}

	return max - min

}

// main
func main() {
	fmt.Println(calc())
}


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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 1010;

int n;
int q[N];

int main()
{
	scanf("%d", &n);
	
	int cnt = 0;
	for (int i = 1; i <= n; i ++ )
	{
		int x;
		scanf("%d", &x);
		
		int l = 1, r = cnt;
		while (l < r)
		{
			int mid = l + r >> 1;
			if (q[mid] < x) r = mid;
			else l = mid + 1;
		}
		
		if (l > r || q[r] >= x) q[ ++ cnt] = x;
		else q[r] = x;
	}
	
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 640
while 1 do
a,b=gets.split.map(&:to_i)
if a!=0 || b!=0 then
for b in 1..b do
print "#"
end
print "\n"
for a in 2..(a-1) do
print "#"
for i in 1..(b-2) do
print "."
end
print "#\n"
end
for i in 1..b do
print "#"
end
print "\n\n"
else break
end
end

Measured memory_bytes: 6104
import Control.Applicative
import Control.Monad
import Data.List

main = do
    n <- read<$>getLine
    tris <- map (map read.words)<$>replicateM n getLine
    mapM_ (putStrLn.yesOrNo.isRightTriangle) tris

isRightTriangle list = x^2 + y^2 == z^2
    where [x,y,z] = sort list

yesOrNo x = if x then "YES" else "NO"

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

int main() {
 string S;
  cin >> S;
  if(S.size()==2){
    cout << S << endl;
  }
    else{
      reverse(S.begin(), S.end());
    cout << S << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){

 int a,b,c;

 scanf("%d",&a);  

scanf("%d",&b);

 scanf("%d",&c);  

if(a<b&&b<c){   

printf("Yes\n");

 }

 else{

  printf("No\n");

 }

 return 0;

}

Measured memory_bytes: 580
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
S = input()
if 'N' in S and 'S' not in S:
    print('No')
elif 'S' in S and 'N' not in S:
    print('No')
elif 'W' in S and 'E' not in S:
    print('No')
elif 'E' in S and 'W' not in S:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 10368
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

///////////////////////////

ll N, M;


ll pw(ll a, ll b) {
	if (b == 0) { return 1; }
	ll x = pw(a, b / 2);

	if (b % 2 == 1) { return x * x%M*a%M; }

	return x * x%M;
}

ll iv(ll i) {
	if (i == 1) { return 1; }
	return M - iv(M%i)*(M / i) % M;
}


int main() {
	cin >> N >> M;

	vector<ll> frac(3*N + 1, 0);
	frac[0] = 1;
	repn(i, 3*N) frac[i] = frac[i - 1] * i%M;

	ll ans = 0;

	rep(i, N + 1)rep(j, N + 1) {
		if (3 * i + 2 * j > 3*N) { continue; }
		if (i + j > N) { continue; }

		ll x = pw(3, i)*pw(2, j) % M*frac[3*N - 3 * i - 2 * j] % M*frac[i] % M*frac[j] % M;

		ll y = frac[3*N] * iv(x) % M;

		
		ans = (ans + y) % M;
	}

	cout << ans;
	system("PAUSE");
}


Measured memory_bytes: 504
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		boolean flag =true;
		int h;
		int w;
		while(flag){
			h = sc.nextInt();
			w = sc.nextInt();
			if(h == 0 && w == 0){
				break;
			}
			for(int i = 0;i < h;i++){
				for(int j = 0;j < w;j++){
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
		}	
	}
}


Measured memory_bytes: 35172
M = 10 ** 9 + 7
s = raw_input().strip()

num = 0
q_list = []
d = 1
for i in range(len(s) - 1, -1, -1):
	c = s[i]
	if c != "?":
		num = (num + int(c) * d) % 13
	else:
		q_list.append(d)
	d = (d * 10) % 13

counts = [0] * 13
counts[0] = 1
counts_save = [0] * 13
for d in q_list:
	for i in range(13):
		counts_save[i] = counts[i] % M
	for n in range(1, 10):
		r = (d * n) % 13
		for m in range(13):
			counts[(r + m) % 13] += counts_save[m]

print(counts[(13 + 5 - num) % 13] % M)


Measured memory_bytes: 38508
import heapq
import os
from collections import defaultdict

import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, M, S = list(map(int, sys.stdin.buffer.readline().split()))
UVAB = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(M)]
CD = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(N)]
CD = [(0, 0)] + CD

graph = [[] for _ in range(N + 1)]
for u, v, a, b in UVAB:
    graph[u].append((a, b, v))
    graph[v].append((a, b, u))
for vs in graph:
    vs.sort()

mada = set(list(range(2, N + 1)))
heap = [(0, 1, S)]
ans = [INF] * (N + 1)
ans[1] = 0
# dp[v, s]: v にお金を s 持ってる状態で来たときの最小値
dp = defaultdict(lambda: INF)
dp[1, S] = 0
while heap and mada:
    d, v, s = heapq.heappop(heap)
    if d > dp[v, s]:
        continue
    if v in mada:
        mada.remove(v)

    ans[v] = min(ans[v], d)
    for a, b, u in graph[v]:
        if s - a < 0:
            break
        if d + b < dp[u, s - a]:
            dp[u, s - a] = d + b
            heapq.heappush(heap, (d + b, u, s - a))
    c, dd = CD[v]
    sc = min(s + c, 50 * N + 10)
    if d + dd < dp[v, sc]:
        dp[v, sc] = d + dd
        heapq.heappush(heap, (d + dd, v, sc))

print(*ans[2:], sep='\n')


Measured memory_bytes: 124512
import sys
import numpy as np
from math import *
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    rgb = int(input_raw[0])*100 + int(input_raw[1]) *10 + int(input_raw[2])
    if rgb % 4 == 0 :
        print 'YES'
    else:
        print 'NO'

if __name__ == '__main__':
    main()

Measured memory_bytes: 19176
n = int(input())
h = list(map(int,input().split()))
dp=[]
dp.append(0)
dp.append(abs(h[1]-h[0]))
for i in range(2,n):
    dp.append(min(dp[i-2] + abs(h[i]-h[i-2]), dp[i-1] + abs(h[i]-h[i-1])))
print(dp[n-1])

Measured memory_bytes: 13980
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		int[] V=new int[N];
		int[] C=new int[N];
		int[] X=new int[N];
		for(int i=0;i<N;i++)V[i]=sc.nextInt();
		for(int i=0;i<N;i++)C[i]=sc.nextInt();
		sc.close();
		for(int i=0;i<N;i++){
			X[i]=V[i]-C[i];
		}
		int ans=0;
		for(int i=0;i<X.length;i++){
			if(X[i]>0)ans +=X[i];
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 24020
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

int main() {
	int a[20000];
	int b[20000];
	string op[20000];
	int i;
	for (i = 0; i < 20000; i ++) {
		cin >> a[i] >> op[i] >> b[i];
		if (a[i] == 0 && op[i] == "?" && b[i] == 0) break;
	}

	for (int j = 0; j < i; j++) {
		if (op[j] == "+") cout << a[j] + b[j] << endl;
		else if (op[j] == "-") cout << a[j] - b[j] << endl;
		else if (op[j] == "*") cout << a[j] * b[j] << endl;
		else if (op[j] == "/") cout << a[j] / b[j] << endl;
	}
	return 0;
}


Measured memory_bytes: 3292
package main

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

func main() {
	scanner := makeWordScanner()
	x := eGetInt64(scanner)
	n := int64(100)
	y := 0
	for n < x {
		f := float64(n) * 1.01
		n = int64(f)
		y++
	}
	fmt.Println(y)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
const (
	TooLarge = math.MaxInt64
	TooSmall = math.MinInt64
)

func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeCharScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanRunes)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func pow(a, n int) int {
	if n == 0 {
		return 1
	}
	if n == 1 {
		return a
	}
	if n%2 == 1 {
		return pow((a*a), n/2) * a
	}
	return pow((a * a), n/2)
}
func powMod(a, n, mod int) int {
	if n == 0 {
		return 1 % mod
	}
	if n == 1 {
		return a % mod
	}
	if n%2 == 1 {
		return powMod((a*a)%mod, n/2, mod) * a % mod
	}
	return powMod((a*a)%mod, n/2, mod)
}

func factoricalMod(n, count, mod int) int {
	if count == 1 {
		return n % mod
	}
	return (n % mod) * (factoricalMod(n-1, count-1, mod)) % mod
}

func combinationMod(n, a, mod int) int {
	x := factoricalMod(n, a, mod)
	y := factoricalMod(a, a, mod)
	y = powMod(y, mod-2, mod)
	return ((x % mod) * (y % mod)) % mod
}
func countBitOfOn(i, numbits int) int {
	count := 0
	var bit uint64
	for bit = 0; bit < uint64(numbits); bit++ {
		t := 1 << bit
		if i&t > 0 {
			count++
		}
	}
	return count
}

type ints []int

func ToString(slice []int) string {
	format := fmt.Sprint(slice)
	return fmt.Sprint(format[1 : len(format)-1])
}


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

void solve()
{
   return;
}
int main() {
    int n,l;
    cin>>n>>l;
    string ans= "No";
    for(int i=0;i<=n;i++)
    {
        int rem= n-i;
        if(2* i + 4* rem == l)
        ans="Yes";
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3504
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int A, B, C, X, Y;
	int ans = 0;

	cin >> A >> B >> C >> X >> Y;

	if (A + B > C * 2) {
		int num = min(X, Y);
		ans += C * num * 2;
		X -= num;
		Y -= num;
	}

	if (A > C * 2) ans += C * 2 * X;
	else ans += A * X;

	if (B > C * 2) ans += C * 2 * Y;
	else ans += B * Y;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef pair<int, int> P;
typedef pair<double, P> PP;
int x[10000], y[10000];
struct UnionFind {
	int *par;
	int *rank;
	int size;
	UnionFind(int n) :size(n) {
		par = new int[size];
		rank = new int[size];
		for (int i = 0; i < size; i++) {
			par[i] = i;
			rank[i] = 0;
		}
	}
	int find(int x) {
		if (x == par[x]) return x;
		return par[x] = find(par[x]);
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (rank[x] < rank[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (rank[x] == rank[y]) rank[x]++;
		}
	}
};

int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
	}
	UnionFind U(N);
	vector<PP> e;
	double sum = 0;
	for (int i = 0; i < M; i++) {
		int p, q;
		cin >> p >> q; p--; q--;
		double d = sqrt(pow(x[p] - x[q], 2) + pow(y[p] - y[q], 2));
		sum += d;
		e.emplace_back(d, P(p, q));
	}
	sort(e.begin(), e.end());
	for (auto itr = e.rbegin(); itr != e.rend(); itr++) {
		if (U.same(itr->second.first, itr->second.second)) continue;
		U.unite(itr->second.first, itr->second.second);
		sum -= itr->first;
	}
	printf("%.15lf\n", sum);
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  VL xs(3);
  REP(i,3) cin >> xs[i];

  set<VL> s;
  int ans = 0;
  while(true){
	if(s.count(xs)){
	  ans = -1;
	  break;
	}
	s.insert(xs);
	VL tmp(3);
	REP(i,3)
	  if(xs[i]%2==1){
		goto END;
	  }
	REP(i,3) REP(j,3)
	  if(i != j) tmp[i] += xs[j]/2;
	xs = tmp;
	++ans;
  }
END:
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main(){
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    int cnt = 0;
    map<char, int> mci;
    rep(i, s.size()){
        mci[s[i]]++;
    }
    int max = 0;
    int ans = 100;
    char key;
    for(auto u : mci){
        //cout << u.first << "  " << u.second << endl;
        int now1 = 0;
        rep(i,s.size()){
            int now = 0;
            int j = i;
            while(j < s.size()){
                if(s[j] == u.first) break;
                j++;
                now++;
            }
            chmax(now1,now);
            i = j;
        }
        chmin(ans,now1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
# C - Typical Stairs

MOD = (10 ** 9) + 7
N, M = map(int, input().split())
A = [False] * (N + 1)
for _ in range(M):
    A[int(input())] = True
dp = [0] * (N + 1)
dp[0] = 1
if A[1] == False:
    dp[1] = 1

for i in range(2, N + 1):
    if A[i] == True:
        dp[i] = 0
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % MOD

print(dp[N])


Measured memory_bytes: 7668
n, a, b = map(int,input().split())
s = input()
a_p = 0
b_p = 0
 
for i in s:
    if i == 'a' and a_p + b_p < a + b:
        print('Yes')
        a_p += 1
    elif i == 'b' and a_p + b_p < a + b and b_p < b:
        print('Yes')
        b_p += 1
    else:
        print('No')

Measured memory_bytes: 9032
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> ii;
 
int main() {
    int n, last, t;
    cin >> n >> last;
    --last;
    for (int ctr1 = 1; ctr1 < n; ++ctr1) {
        cin >> t;
        if (last < t)
            t--;
        if (last > t) {
            cout << "No\n";
            return 0;
        }
        last = t;
    }
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
// Aizu 2417: Flick Input
// 2017.9.25 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

char kana[10][5][3] = {
	{ "wa", "\0", "nn", "\0", "wo" },  // 0
	{  "a",  "i",  "u",  "e",  "o"  },  // 1
	{ "ka", "ki", "ku", "ke", "ko" },  // 2
	{ "sa", "si", "su", "se", "so" },  // 3
	{ "ta", "ti", "tu", "te", "to" },  // 4
	{ "na", "ni", "nu", "ne", "no" },  // 5
	{ "ha", "hi", "hu", "he", "ho" },  // 6
	{ "ma", "mi", "mu", "me", "mo" },  // 7
	{ "ya", "\0", "yu", "\0", "yo" },  // 8
	{ "ra", "ri", "ru", "re", "ro" },  // 9
};
char tr['Z'];
char buf[1003];

int main()
{
	int a, b;
	char *p;

	tr['T'] = 0, tr['L'] = 1, tr['U'] = 2, tr['R'] = 3, tr['D'] = 4;
	scanf("%s", buf); p = buf;
	while (*p) {
		a = *p++ - '0';
		b = tr[*p++];
		printf(kana[a][b]);
	}
	putchar('\n');
	return 0;
}

Measured memory_bytes: 1844
n, a, b, c, d = map(int, input().split())
s = input()
for i in range(a, c - 2):
    if s[i] == "#" and s[i + 1] == "#":
        print("No")
        exit()
for i in range(b, d - 2):
    if s[i] == "#" and s[i + 1] == "#":
        print("No")
        exit()
if c > d:
    f = s[b - 2:d + 1].find("...")
    if f == -1:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 40048
#include <stdio.h>

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


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

int main(){   
   int n,a,b,sum=0,bsum=0;
   string s;
   cin >> n >> a >> b;
   cin >> s;
   for(int i=0;i<n;i++){
       if(s.at(i)=='a'){
           if(a+b>sum){
               cout << "Yes" <<endl;
               sum++;
           }else{
                cout << "No" << endl;
           }
           
       }
       if(s.at(i)=='b'){
           if(a+b>sum){
               if(b>bsum){
               cout << "Yes" <<endl;
               sum++;
               bsum++;
               }else{
               cout << "No" << endl;
                }
           }else{
                cout << "No" << endl;
            }
           
       }
       if(s.at(i)=='c'){
           cout << "No" << endl;
       }
   }
}


Measured memory_bytes: 896
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int h, w, n;
    int m;

    cin >> h >> w >> n;

    m = max(h, w);

    cout << (n + m - 1) / m << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }

LL sum2(LL n){
    return n * (n+1) / 2;
}

int main(){
    LL n;
    cin >> n;
    LL ans = sum2(n) - sum2(n/3)*3 - sum2(n/5)*5 + sum2(n/15)*15;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3188
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        char[][] S = new char[H][W];
        
        for(int i=0; i<H; i++){
            
            S[i] = sc.next().toCharArray();
            
        }
        

        for(int i=0; i<H; i++){
            
            for(int j=0; j<W; j++){
                
                if(S[i][j]=='#'){
                    
                    System.out.print(S[i][j]);
                    continue;
                }
                int count=0;
                if(i>0){
                    if(S[i-1][j]=='#'){
                        count++;
                    } 
                    if(j>0 && S[i-1][j-1]=='#'){
                        count++;
                    }
                    if(j<W-1 && S[i-1][j+1]=='#'){
                        count++;
                    }
                }

                if(j>0 && S[i][j-1]=='#'){
                    count++;
                }
                if(j<W-1 && S[i][j+1]=='#'){
                    count++;
                }

                if(i<H-1){
                    if(S[i+1][j]=='#'){
                        count++;
                    } 
                    if(j>0 && S[i+1][j-1]=='#'){
                        count++;
                    }
                    if(j<W-1 && S[i+1][j+1]=='#'){
                        count++;
                    }
                }
                
                System.out.print(count);
            }
            System.out.println();
        }
        
        
        
        
        
                
            

        }
        
        

        
        
        }
    


Measured memory_bytes: 36308
package main
  
import (
    "fmt"
    "sort"
)

func main() {
    var n int
    fmt.Scan(&n)
    ps := make([]int, n)
    ss := make([]int, n)
    for i := range ps {
        fmt.Scan(&ps[i])
        ss[i] = ps[i]
    }
    sort.Sort(sort.IntSlice(ss))
    var cnt int
    for i := range ps {
        if ps[i] != ss[i] {
            cnt++
        }
    }
    if cnt == 2 || cnt == 0 {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}


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

using namespace std;

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n; cin >> n;
	vector<int> v(n);	

	for(int i = 0; i < n; i++) cin >> v[i];

	int ans = 1e9;

	for(int i = -100; i <= 100; i++) {
		int temp = 0;
		for(auto &e : v) {
			temp += (e-i)*(e-i);
		}
		ans = min(temp,ans);
	}

	cout << ans << '\n';

	return 0;
}

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rep(i, k, n) for (int i = (int)(k); i < (int)(n); ++i)
#define rrep(i, k, n) for (int i = (int)(n) - 1; i >= (int)(k); --i)

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vv_ii;
typedef pair<int,ii> i_ii;
typedef vector<i_ii> vi_ii;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;

template <class T>
inline ostream& operator<<(ostream & o, vector<T> const& v) {
    for (int i = 0; i < (int)(v.size()) - 1; ++i)
        o << v[i] << ' ';
    if (!v.empty())
        o << v.back();
    return o;
}

template <class T, class Q>
inline ostream& operator<<(ostream & o, pair<T,Q> const& p) {
    o << "(" << p.fi << "," << p.se << ")";
    return o;
}


int main(){

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

    int n;
    cin >> n;
    vector<string> s(n);
    vi t(n);
    rep(i2, 0, n) {
        cin >> s[i2] >> t[i2];
    }
    string x;
    cin >> x;
    int i = 0;
    while (i < n && s[i] != x)
        ++i;
    ll ans = 0;
    ++i;
    while (i < n)
        ans += t[i++];
    cout << ans << '\n';


    return 0;
}

Measured memory_bytes: 256
N,A,B = map(int,input().split())
L = list(input())
p = 0
q = 0
for i in range(N) :
    if L[i] == "c" :
        print("No")
    elif L[i] == "a" :
        if p < A+B :
            p += 1
            print("Yes")
        else :
            print("No")
    else :
        if (p < (A+B)) and (q < B) :
            p += 1
            q += 1
            print("Yes")
        else :
            print("No")
            

Measured memory_bytes: 4708
#include <iostream>
#include <set>
#include <vector>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

typedef set<vector<int>> sv;

int main(){
    int n;
    while(cin>>n,n){
        sv prev; prev.insert(vector<int>(1,1));
        rep(i,n-1){
            sv next;
            for(auto v:prev){
                rep(i,v.size()){
                    if(i==0||v[i-1]>v[i]){
                        v[i]++;
                        next.insert(v);
                        v[i]--;
                    }
                }
                v.push_back(1);
                next.insert(v);
            }
            swap(prev,next);
        }
        for(auto v=prev.rbegin(); v!=prev.rend(); ++v){
            rep(i,v->size()-1) cout<<(*v)[i]<<" ";
            cout<<v->back()<<'\n';
        }
    }
}

Measured memory_bytes: 2144
#include <stdio.h>

long long a [200005];

int main()
{
    int n, k, i;

    scanf("%d %d", &n, &k);

    for (i = 1; i <= n; i ++) {
        scanf("%lld", &a[i]);
    }

    for (i = k+1; i <= n; i ++) {
        if (a [i] > a [i-k]) printf("Yes\n");
        else printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> pii;
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define SZ(x) x.size()
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 17;
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

int n, m, f[1<<17][17], blk[1<<17];
int mp[N][N];

void chk(int& x, int y) {
    if(y > x) x = y;
}

int main() {
    scanf("%d%d", &n, &m);
    int sum = 0;
    rep(i, 1, m) {
        int u, v, w;
        scanf("%d%d%d", &u, &v, &w);
        mp[u][v] = mp[v][u] = w;
        sum += w;
    }
    int mx = (1<<n);
    rep(i, 0, mx-1) {
        rep(j, 1, n) {
            rep(k, j+1, n) {
                if((i & (1<<(j-1))) && (i & (1<<(k-1)))) blk[i] += mp[j][k];  
            }
        }
    }
    memset(f, -1, sizeof(f));
    f[1][1] = 0;
    rep(i, 0, mx-1) {
        rep(j, 1, n) {
            if(i & (1<<(j-1)) && f[i][j] != -1) {
                rep(k, 1, n) {
                    if(!(i & (1<<(k-1))) && mp[j][k]) chk(f[i|(1<<(k-1))][k], f[i][j]+mp[j][k]);
                }
                int tp = (((mx-1)^i) | (1<<(j-1)));
                for(int k = tp; k; k = (k-1) & tp) {
                    if(k & (1<<(j-1))) chk(f[i|k][j], f[i][j]+blk[k]); 
                }
            }
        }
    }
    int ans = sum-f[mx-1][n];
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 9088
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        string s = Console.ReadLine();
        string t = Console.ReadLine();

        Console.WriteLine(s.Length == t.Length - 1 && t.StartsWith(s) ? "Yes" : "No");
    }
}


Measured memory_bytes: 26176
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
    int N, nmin, nmax, pcurr, pprev, maxi, maxv;
    for (;;) {
        scanf("%d %d %d", &N, &nmin, &nmax);
        if (N == 0 && nmin == 0 && nmax == 0) break;
        maxi = -1, maxv = 0;
        scanf("%d", &pprev);
        for (int i = 2; i <= N; i++) {
            scanf("%d", &pcurr);
            if (i > nmin && i <= nmax + 1 && pprev - pcurr >= maxv) maxv = pprev - pcurr, maxi = i -1;
            pprev = pcurr;
        }
        printf("%d\n", maxi);
    }
    return 0;
}


Measured memory_bytes: 2712
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
int n;
vector<int> a,m;
bool solve(int j,int m2){
	if(m2==0)return true;
	if(j>=n)return false;
	bool res=(solve(j+1,m2)||solve(j+1,m2-a[j]));
	return res;
}
int main(void){
	int tmp;
	int i,q;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>tmp;
		a.push_back(tmp);
	}
	cin>>q;
	for(i=0;i<q;i++){
		cin>>tmp;
		m.push_back(tmp);
	}
	for(i=0;i<q;i++){
		if(solve(0,m[i]))cout<<"yes\n";
		else cout<<"no\n";
    }
	return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (int)(n); ++(i))
#define rep1(i, n) for(int (i) = 1; (i) <= (int)(n); ++(i))
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<double>> vvd;
// typedef pair<int, int> P;
const ll divisor = 1000000007;

const int MAX_L = 150;
int sq(int h, int w){ return h * h + w * w; }

int main(){
  while(true){
    int h, w;
    cin >> h >> w;
    if(h * w == 0) break;

    int orgd = sq(h, w);
    int ansd = 0x7fffffff;
    int ansh = MAX_L, answ = MAX_L;
    rep1(i, MAX_L){ // h
      rep1(j, MAX_L){ // w
        if(j <= i) continue;

        int tmpd = sq(i, j);
        if((tmpd == orgd && i > h) || tmpd > orgd){
          if(tmpd < ansd){
            ansd = tmpd;
            ansh = i; answ = j;
          }
        }
      }
    }
    cout << ansh << " " << answ << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

/*ll gcd(ll a, ll b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}*/

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a * (b / g);
}*/

/*int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}*/

int main () {
	int n,m;
	cin >> n>>m;
	int a;
	map<int, int> mp;
	rep (i, n) {
		cin >> a;
		mp[a]++;
	}

	int cnt = 0;
	vector<pair<int, int>> p;
	for (const auto& x : mp) {
		if (x.second > 0) cnt++;
		p.emplace_back (x.second, x.first);
	}

	sort (all(p));
	int ans = 0;
	if (cnt <= m) {
		cout << 0 << endl;
		return 0;
	} else {
		for (int i = 0; i < cnt - m; i++) {
			ans += p[i].first;
		}
	}

	cout << ans << endl;
	
}



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

namespace ABC164
{
    class Program
    {
        static void Main(string[] args)
        {
            c();
        }

        public static void c()
        {
            long n = long.Parse(Console.ReadLine());
            var has = new HashSet<string>();
            for(long i = 0; i < n; i++)
            {
                string s = Console.ReadLine();
                if (has.Add(s))
                { }
            }
            long ans = has.Count;
            Console.WriteLine(ans);
        }

    }
}


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

using namespace std;

int main() {
	int a,b;
	cin >> a >> b;
	int k = (b + a) / 2;
	if (a == b)cout << 0 << endl;
	else if ((a + b) % 2==0)cout << k << endl;
	else printf("IMPOSSIBLE\n");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 110, M = 100100;
int n, W;
ll w[N], v[N];
ll mem[N][M + N];
ll dp(int i, ll wight){
    if(i == n)
        return 0;
    if(wight > W)
        return 0;
    ll &ret = mem[i][wight];
    if(ret != -1)
        return ret;
    ll path1 = 0, path2 = 0;
    if(wight + w[i] <= W)
        path1 = dp(i+1, wight+w[i]) + v[i];
    path2 = dp(i+1, wight);
    return ret = max(path1, path2);
}
int main(){
    memset(mem, -1, sizeof mem);
    scanf("%d %d", &n, &W);
    for(int i = 0; i < n; ++i)
        scanf("%lld %lld", &w[i], &v[i]);
    printf("%lld", dp(0, 0));

    return 0;
}


Measured memory_bytes: 86400
using System;

namespace B___Uneven_Numbers
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var ans = 0;
            for (var i = 1; i <= n; i++)
            {
                if (i.ToString().Length % 2 == 1)
                {
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 15188
#include <stdio.h>

int main(){
    int n;
    scanf("%d", &n);
    char s[n];
    scanf("%s", s);
    int count = 0;
    for(int i = 0; i < n-2; i++){
        if((s[i]=='A') && (s[i+1]=='B') && s[i+2]=='C'){
            count++;
        }
    }
    printf("%d", count);
    return 0;
}

Measured memory_bytes: 128