akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main(){
    int N;
    cin>>N;
    char a[100];
    int flag=0;
    for(int i=0;i<N;i++){
        cin>>a[i];
        if(a[i]=='Y'){flag=1;}
    }
    if(flag){cout<<"Four"<<endl;}
    else{cout<<"Three"<<endl;}

    return 0;
}

Measured memory_bytes: 256
import numpy as np
N = int(input())
stones = np.array([0 if stone == "." else 1 for stone in input()])
# stones = np.array([0 if stone == "." else 1 for stone in ".#....."])


def count_painted_stones_by_cumsum(stones, length):
    left_black_stones = np.roll(np.cumsum(stones), 1)
    left_black_stones[0] = 0
    right_white_stones = np.roll(np.cumsum(1 - stones[::-1]), 1)
    right_white_stones[0] = 0

    return np.min(left_black_stones + right_white_stones[::-1])


print(count_painted_stones_by_cumsum(stones, len(stones)))


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

int c[22][22], a[222][222];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int h, w;
  cin >> h >> w;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> c[i][j];
    }
  }
  for (int k = 0; k < 10; k++) {
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < 10; j++) {
        c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
      }
    }
  }
  int res = 0;
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      cin >> a[i][j];
      if (a[i][j] == -1) a[i][j] = 1;
      res += c[a[i][j]][1];
    }
  }
  cout << res << endl;
  return 0;
}


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

int main(){
    long long int n,k;
    cin>>n>>k;
    vector<long long int>a(n);
    for(long long int i=0;i<n;i++){
        cin>>a.at(i);
    }
    sort(a.begin(),a.end());
    long long int count=0;
    for(long long int i=0;i<n-k;i++){
        count+=a.at(i);
    }
    cout<<count<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
	string s;
	ll q;
	cin >> s >> q;


	bool flag = true;
	string ss, tt;
	while(q--) {
		ll t;
		cin >> t;
		if (t == 1) {
			flag = !flag;
		}
		else {
			ll f;
			string c;
			cin >> f >> c;
			if (f == 1) {
				if (flag) ss += c;
				else tt += c;
			}
			else {
				if (flag) tt += c;
				else ss += c;
			}
		}
	}
	if (flag) {
		reverse(all(ss));
		cout << ss << s << tt << en;
	}
	else {
		reverse(all(tt));
		reverse(all(s));
		cout << tt << s << ss << en;
	}
}

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

	solve();
	//int t; cin >> t; REP(i, t) solve();

	return 0;
}

Measured memory_bytes: 1040
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
int getDigit(int n);            // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;

// code
// ------------------------------------------------
int main() {

  int n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> sub(n-1);

  rep(i,n) cin >> a[i];

  rep(i,n-1)
  {
    sub[i] = a[i + 1] - a[i];
  }

  ll ans = 1;
  ll last = 0;
  rep(i,n-1)
  {
    if(last < 0)
    {
      if(sub[i] > 0)
      {
        ans++;
        last = 0;
      }
    }
    else if(last > 0)
    {
      if(sub[i] < 0)
      {
        ans++;
        last = 0;
      }
    }
    else
    {
      if(sub[i] == 0)continue;
      last = sub[i] > 0 ? 1 : -1;
    }
  }

  cout << ans << endl;

  

  return 0;
}
// funcの実体
// ------------------------------------------------
int getDigit(int n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 1)
      break;
    i++;
  }
  return i;
}
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long N;
    cin >> N;
    vector<long long> a(N);
    for(int i = 0; i < N; i++) cin >> a[i];
    vector<long long> b(N);
    long long res = 0, sum = 0;
    for(int i = 0; i < N; i++){
        if(i % 2 == 1) res += 2*a[i];
        sum += a[i];
    }
    b[0] = sum - res;
    cout << b[0] << ' ';
    for(int i = 1; i < N; i++){
        b[i] = 2*a[i - 1] - b[i - 1];
        if(i < N - 1) cout << b[i] << ' ';
        else cout << b[i] << endl;
    }
}

Measured memory_bytes: 2944
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
//const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================


int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================

	ll N;
	cin >> N;

	vll H(N);
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}

	vll dp(N);
	for (int i = 0; i < N; i++) {
		dp[i] = 0;
	}
	
	dp[0] = 0;
	dp[1] = abs(H[1] - H[0]);

	for (int i = 2; i < N; i++) {
		dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]));
	}


	cout << dp[N - 1];


}



Measured memory_bytes: 1792
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <deque>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
#define for1(i,n) for (ll i=0;i<(n);i++)
#define for2(i,m,n) for (ll i=(m);i<(n);i++)
#define for3(i,m,n,d) for (ll i=(m);i<(n);i+=(d))
#define DEBUG 0
template <class T>
void dumplist(T list)
{
    for (auto item : list) {
        cout << item << " ";
    }
    cout << endl;
}


void solve()
{
    ll N,L;
    cin >> N >> L;
    ll ans = 0;
    for1(i,N) {
        ans += L + i;
    }
    // L -- L+N-1
    if ((L <= 0) && (L+N-1 >= 0)) {
        cout << ans << endl;
    }
    else if (L > 0) {
        cout << ans - L << endl;
    }
    else if (L+N-1 < 0) {
        cout << ans - (L+N-1) << endl;
    }
}

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


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



N = int(input())
candidate = make_divisors(N)
ans = 0

for j in candidate:
    if j == 1:
        continue
    if N % (j - 1) == N // (j - 1):
        ans += (j -1)

print(ans)

Measured memory_bytes: 3272
import math
a, b, t = map(int, input().split())
t = math.radians(t)
h = b * math.sin(t)
s = a * h / 2
c = math.sqrt(a **2 + b **2 - 2 * a * b * math.cos(t))
l = a + b + c
print(s)
print(l)
print(h)


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define PI (acos(-1))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

#define MAXN 1123456
#define MOD 1000000007

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
typedef vector<vi> vvi;

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

  ll h, n;
  cin >> h >> n;
  vi a(n);
  rep(i,0,n) cin >> a[i];
  ll tot = accumulate(all(a), 0LL);
  if (tot >= h) cout << "Yes\n";
  else cout << "No\n";
  
}

Measured memory_bytes: 1024
import itertools

def q49(n, k, h):
    h.sort()
    a = [h[i+k-1]-h[i] for i in range(n-k+1)]
    return min(a)
            
N, K = [int(i) for i in input().split()]
h = []
for _ in range(N):
    h.append(int(input()))
print(q49(N, K, h))

Measured memory_bytes: 11316
import java.util.Scanner;

public class Main {

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

        if (w >= s) {
            System.out.println("unsafe");
        } else {
            System.out.println("safe");
        }

        sc.close();
    }

}


Measured memory_bytes: 35784
r, c = map(int, input().split())
sum_list= []

for i in range(r):
    row_list = list(map(int, input().split()))
    sum_row = 0
    for j in range(c):
        sum_row += row_list[j]
        print('{} '.format(row_list[j]), end='')
        sum_list.append(row_list[j])
    print(sum_row)
    sum_list.append(sum_row)

for k in range(c+1):
    sum_col = 0
    for l in range(r):
        m = l*(c+1)+k
        sum_col += sum_list[m]
    if k != c:
        print('{} '.format(sum_col), end='')
    else:
        print(sum_col)


Measured memory_bytes: 5720
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline
    import numpy as np

    N, S = map(int, input().split())
    A = list(map(int, input().split()))

    MOD = 998244353

    dp = np.zeros(S + 1, dtype="int32")
    dp[0] = 1

    for i in range(N):
        p = (dp * 2) % MOD
        p[A[i]:] += dp[:-A[i]]
        dp = p % MOD

    print(dp[S])

main()

Measured memory_bytes: 27412
n, m = map(int, input().split())

al = []
for _ in range(n):
    al.append(list(input()))

bl = []
for _ in range(m):
    bl.append(list(input()))

flag1 = False
for ax in range(n-m+1):
    for ay in range(n-m+1):

        flag2 = True
        for bx in range(m):
            for by in range(m):
                if al[ax+bx][ay+by] != bl[bx][by]:
                    flag2 = False
        if flag2:
            flag1 = True

if flag1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
A, B = map(int, input().split())


A_new = A
if B == 1:
    count = 0    
else:
    count = 1
    while A_new <= B:
        if A_new == B:
            break
        else:
            A_new = A_new-1
            A_new += A
            count += 1
print(count)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
 
string t[16]={"KIHBR", "KIHBRA", "KIHBAR", "KIHBARA", "KIHABR", "KIHABRA", "KIHABAR", "KIHABARA", "AKIHBR", "AKIHBRA", "AKIHBAR", "AKIHBARA", "AKIHABR", "AKIHABRA", "AKIHABARA"};
 
int main(){
    string s;
    cin >> s;
    bool flag = false;
    for(int i=0;i<16;++i){
        if(s == t[i]){
            flag = true;
            break;
        }
    }
    if(flag)cout << "YES" << endl;
    else cout << "NO" << endl;
 
    return 0;
}

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

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

    int N;
    cin >> N;
    vector<string> S(N);
    for (int i = 0; i < N; i++) {
        string tmp;
        cin >> tmp;
        sort(tmp.begin(), tmp.end());
        S[i] = tmp;
    }
    sort(S.begin(), S.end());
    S.push_back("");

    long long ans = 0;
    string tmp = S[0];
    long long term = 1;
    for (int i = 1; i <= N; i++) {
        if (tmp == S[i])
            term++;
        else {
            ans += (term * (term - 1)) / 2;
            term = 1;
            tmp = S[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    cin>>x;
    if(x >=400 && x<= 599)
        cout<<8<<"\n";
    else if(x >=600 && x<= 799)
        cout<<7<<"\n";
    else if(x >=800 && x<= 999)
        cout<<6<<"\n";
    else if(x >=1000 && x<= 1199)
        cout<<5<<"\n";
    else if(x >=1200 && x<= 1399)
        cout<<4<<"\n";
    else if(x >=1400 && x<= 1599)
        cout<<3<<"\n";
    else if(x >=1600 && x<= 1799)
        cout<<2<<"\n";
    else if(x >=1800 && x<= 1999)
        cout<<1<<"\n";
    
    return 0;
}

Measured memory_bytes: 3632
def is_unique(seq):
    return len(seq) == len(set(seq))

n = int(input())
W = [input() for _ in range(n)]
a = []
before_tail = ""
current_first = " "
flag = True
for i in range(1,n):
    current_first = W[i][0]
    before_tail = W[i-1][-1]
    if current_first != before_tail:
        flag = False
        break

if flag and is_unique(W):
    print("Yes")
else:
    print("No")

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

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

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

int main(void) {
	ll N;
	cin >> N;
	const ll MAX = 1e7;
	vector<ll> vec(MAX+1, 0);
	for(int i=1; i<=N; i++){
		for(int j=1; j*i<=MAX; j++){
			vec[i*j]++;
			//if(j*i < 5) cout << "i: " << i << " j: " << j << " i*j: " << i*j << endl;
		}
	}
	
	ll ans = 0;
	for(int k=1; k<=N; k++){
		ans += k*vec[k];
		//cout << " k: " << k << " vec[k]: " << vec[k] << " ans: " << ans << endl;
	}
	cout << ans << endl;

}


Measured memory_bytes: 81392
N = int(input())
table = []
for _ in range(N):
    a,b = map(int, input().split())
    if a > b:
        print('No')
        exit()
    table.append((a,b))

table = sorted(table, key = lambda x:x[1])
time = 0
for i in range(N):
    a, b = table[i]
    if time > b - a:
        print('No')
        exit()
    time += a
print('Yes')


Measured memory_bytes: 74712
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,m,ans;
int a[100001],b[100001];
bool box[401][401],use[401];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++) cin>>a[i]>>b[i];
	for(int i=1;i<=n;i++)
	{
		box[i][i]=1;
		for(int j=m;j>=1;j--)
		{
			bool x=box[i][a[j]],y=box[i][b[j]];
			if(x&&y) use[i]=true;//如果x,y此前已经在i的集合中i就不能选了 
			else if(x) box[i][b[j]]=1; 
			else if(y) box[i][a[j]]=1;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(use[i]) continue;
		for(int j=i+1;j<=n;j++)
		{
			if(use[j]) continue;
			bool flag=true;
			for(int k=1;k<=n;k++)
				if(box[i][k]&&box[j][k])//有交集不可取 
				{
					flag=0;
					break;
				}
			ans+=flag;
		}
	}
	cout<<ans; 
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
const int ms = 3e3+1;
int n;

double p[ms], dp[ms][ms];

double solve(int pos, int heads){
  if(pos == n){
    if(heads > n/2)
      return 1;
    return 0;
  }

  double &ans = dp[pos][heads];
  if(ans != -1)
    return ans;
  ans = 1;

  ans *= (solve(pos+1, heads)*(1-p[pos])  + solve(pos+1, heads +1)*(p[pos]));

  return ans;

}



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

  for(int i = 0; i < ms; i++) for(int j = 0; j < ms; j++) dp[i][j] = -1;

  cout<<setprecision(10)<<fixed<<solve(0, 0);
}

Measured memory_bytes: 70784
#include <iostream>

using namespace std;

int main()
{
    int A,B,C;
    cin >> A >> B >> C;
    if (A < C && C < B)
        cout << "Yes" << endl;
    else if (A > C && C > B)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int[] A = new int[N];
	int[] B = new int[N];
	for(int i = 0; i<N; i++) {
	    A[i] = sc.nextInt();
	    B[i] = A[i] -i-1;
	}
	Arrays.sort(B);
	int b = B[N/2];
	long ans = 0;
	for(int i = 0; i<N; i++) {
	    ans += (long)(Math.abs(B[i] - b));
	}
	System.out.println(ans);

    }
}

Measured memory_bytes: 68240
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int K;
    string S;
    cin >> K >> S;
    if(S.size() <= K) {
        cout << S << endl;;    
    }else {
        string ans;
        for(int i = 0; i < K; i++) {
            ans += S.at(i);
        }
        cout << ans << "..." << endl;
    }
}

Measured memory_bytes: 3600
#include<stdio.h>
int main(void){
int N,l[10000],r[10000], ans=0;
scanf("%d", &N);
for(int i=0;i<N;i++){
    scanf("%d%d",&l[i],&r[i]);
    ans+=r[i]-l[i];
}
printf("%d\n",ans+N);
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
    int A, B;
    cin >> A>>B;
    cout << A*B-(A+B-1) << endl; 

   return 0;
}

Measured memory_bytes: 256
a = list(map(int,input().split()))
num_5 = 0
num_7 = 0

for i in a:
  if i==5:
    num_5 = num_5+1
  if i==7:
    num_7 = num_7+1

if num_5==2 and num_7==1:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 9064
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define endl "\n"
    #define MOD 1000000007
    #define print(A,n) for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
    #define take(A,n) for(ll i=0;i<n;++i)cin>>A[i];
    //    for(auto& it : m)
    void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
    ll int power(ll int x, ll int y, ll int p)  
    {  
       ll int res = 1;     // Initialize result  
     
        x = x % p; // Update x if it is more than or  
                    // equal to p
       
        if (x == 0) return 0; // In case x is divisible by p;
     
        while (y > 0)  
        {  
            // If y is odd, multiply x with result  
            if (y & 1)  
                res = (res*x) % p;  
     
            // y must be even now  
            y = y>>1; // y = y/2  
            x = (x*x) % p;  
        }  
        return res;  
    }  
     
    ll int modInverse(ll int a,ll int m)
    {
        ll int g = __gcd(a, m);
       
            // If a and m are relatively prime, then modulo inverse
            // is a^(m-2) mode m
           
           return      power(a, m-2, m);
       
    }
     
     
    int main()
    {
     
      fastio();
     
    ll int T=1;
   // cin>>T;
     
    for(ll int test=1;test<=T;test++)
    {
         ll int n;
         cin>>n;
         n/=100;
         n/=2;
         n=10-n;
         cout<<n<<endl;
    
    }
     
     
     
    return 0;}

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

int main()
{
    int n,c;
    int m,l,t;
    cin >> m;
    int a,b;
    a=m/100;
    b=m%100;
    if(a>0 && a<=12 && (b>12 || b==00))
    {cout << "MMYY" << '\n';}
    else if(b<=12 && b!=00 && (a>12 || a==00))
    {cout << "YYMM" << '\n';}
    else if(a<=12 && a!=00 && b<=12 && b!=00)
    {cout << "AMBIGUOUS" << '\n';}
    else if((a>12 || a==00) &&(b>12 || b==00))
    {cout << "NA" << '\n';}
}


Measured memory_bytes: 256
import collections
def main():
    H, W = map(int, input().split())
    A = []
    for _ in range(H):
        A.append(input())
    cur = []
    visited = collections.defaultdict(dict)
    for i in range(H):
        for j in range(W):
            if A[i][j] == "#":
                cur.append([i, j])
                visited[i][j] = 1
            else:
                visited[i][j] = 0
    mv = [[1, 0], [-1, 0], [0, 1], [0, -1]]
    count = 0
    while cur:
        temp = []
        for i, j in cur:
            for di, dj in mv:
                i1, j1 = i+di, j+dj
                if 0 <= i1 < H and 0 <= j1 < W and not visited[i1][j1]:
                    visited[i1][j1] = True
                    temp.append([i1, j1])
        if len(temp) > 0:
            count += 1
        cur = temp
    return count

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 184932
// Problem : C - Not so Diverse
// Contest : AtCoder - AtCoder Beginner Contest 081
// URL : https://atcoder.jp/contests/abc081/tasks/arc086_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
	int n,k;cin>>n>>k;
	map<int,int> mp;
	for(int i=0;i<n;i++)
	{
		int x;cin>>x;
		mp[x]++;
	}
	if(size(mp)<=k)
	cout<<0;
	else
	{
		vi v;
		for(pii p:mp)
		v.pb(p.se);
		sort(all(v));
		int x=size(v)-k;
		int ans=0;
		for(int i=0;i<x;i++)
		ans+=v[i];
		cout<<ans;
	}
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


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

a=1
sum_a=0
while a<=N:
	sum_a=sum_a+a
	a=a+1

b=1
sum_b=0
while b<=N//3:
	sum_b=sum_b+b
	b=b+1
	
c=1
sum_c=0
while c<=N//5:
	sum_c=sum_c+c
	c=c+1
	
d=1
sum_d=0
while d<=N//15:
	sum_d=sum_d+d
	d=d+1
	

print(sum_a+15*sum_d-3*sum_b-5*sum_c)

Measured memory_bytes: 9116
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
// #define endl '\n'
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

vi v[1024];

int32_t main()
{
	IO_OP;
	
	int n;
	cin >> n;
	for(int i=1;i<=n;i++) {
		v[i] = vi(n-1);
		for(int j=n-2;j>=0;j--)
			cin >> v[i][j];
	}
	vector<pi> s;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if(v[i].back() == j && v[j].back() == i) {
				s.EB(i, j);
			}
	int ans = 0;
	while(s.size()) {
		vector<pi> t;
		for(int i=0;i<s.size();i++) {
			int x = s[i].F, y = s[i].S;
			v[x].pop_back(), v[y].pop_back();
			if(v[x].size() && v[v[x].back()].size() &&  v[v[x].back()].back() == x)
				t.EB(x, v[x].back());
			if(v[y].size() && v[v[y].back()].size() &&  v[v[y].back()].back() == y)
				t.EB(y, v[y].back());
			
		}
		ans++;
		swap(s, t);
	}
	for(int i=1;i<=n;i++)
		if(v[i].size()) {
			cout << -1 << endl;
			return 0;
		}
	cout << ans << endl;
}



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

int main() {
    vector<long long> f[3], g[3];
    int n;
    cin >> n;
    for (int j = 0; j < 3; j++) {
        for (int i = 0; i < n; i++) {
            long long val;
            cin >> val;
            f[j].push_back(val);
        }
        sort(f[j].begin(), f[j].end());
    }
    long long last = 0;
    for (int i = 0; i < n; i++) {
        long long val = 0;
        if (i > 0) {
            val = g[1][i - 1];
        }
        while (last < n && f[0][last] < f[1][i]) { last++; }
        val += (long long)last;
        g[1].push_back(val);
    }
    last = 0;
    for (int i = 0; i < n; i++) {
        long long val = 0;
        if (i > 0) {
            val = g[2][i - 1];
        }
        while (last < n && f[1][last] < f[2][i]) { last++; }
        if (last > 0) { val += g[1][last - 1]; }
        g[2].push_back(val);
    }
    cout << g[2][n - 1] << endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  int A[2][N];
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < N; j++) {
      cin >> A[i][j];
    }
  }

  int candy = 0;
  int max = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j < i; j++)
      candy += A[0][j];
    for (int j = i - 1; j < N; j++)
      candy += A[1][j];
    max = candy > max? candy : max;
    candy = 0;
  }
  cout << max << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int k;
  cin >> k;
  string s;
  cin >> s;
  if(s.length() > k){
    cout << s.substr(0, k) + "...";
  }
  else {
    cout << s;
  }
  return 0;
}

Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws NumberFormatException 
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
				
		for(int i = 0; i < n; i++){
			MaxMinManager mg = new MaxMinManager(br.readLine());
			
			System.out.println(mg.difference());
		}

	}

}

class MaxMinManager {
	int max;
	int min;
	
	public MaxMinManager(String str){
		char[] carray = str.toCharArray();
		
		max = generateMax(carray);
		min = generateMin(carray);
	}
	
	private int generateMax(char[] carray){
		StringBuffer sb = new StringBuffer();
		Arrays.sort(carray);
		sb.append(carray);
		sb.reverse();
//		System.out.println("sorted Max"+sb.toString());
		
		return Integer.parseInt(sb.toString());
	}
	
	private int generateMin(char[] carray){
		Arrays.sort(carray);
//		System.out.println("sorted Min"+new String(carray));
		return Integer.parseInt(new String(carray));
	}
	
	public int difference(){
		return max - min;
	}
}

Measured memory_bytes: 24184
#include<stdio.h>
int main (void)
{
  int a,b[110],c,d[110],e[110],i,l;
  int t[110],k=0;
  
  scanf("%d",&a);
  
  for(i=0;i<a;i++)
    scanf("%d",&b[i]);
 scanf("%d",&c);
  
  for(i=0;i<c;i++)
  {
    scanf("%d",&d[i]);
    scanf("%d",&e[i]);
  }

  for(l=0;l<c;l++)
{
  for(i=0;i<a;i++)
  {
    if(i==d[l]-1)
      t[i]=e[l];
    else
      t[i]=b[i];
    k+=t[i];
  if(i==a-1)
   {
     printf("%d\n",k);
     k=0;
   }
  }
}
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

int n, ans[500][500];

int f(int x, int y) {
	dec(i, 12) {
		if(bit(x ^ y, i)) { return i; }
	}
	return 0;
}

int main() {
	cin >> n;
	
	inc(i, n) {
	inc(j, n) {
		ans[i][j] = f(i, j) + 1;
	}
	}
	
	inc(i, n) {
	incID(j, i + 1, n) {
		cout << ans[i][j] << (j == n - 1 ? "\n" : " ");
	}
	}
	
	return 0;
}


Measured memory_bytes: 1408
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    long N = lread();
    auto A = aryread();
    DList!long ans;
    bool rev;
    foreach (a; A)
    {
        if (!rev)
        {
            ans.insertBack(a);
        }
        else
        {
            ans.insertFront(a);
        }
        rev = rev == false;
    }
    if (!rev)
    {
        ans.array.arywrite();
    }
    else
    {
        ans.array.reverse.arywrite();
    }
}


Measured memory_bytes: 23880
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

const LL inf = 11234567890;
LL N;
std::vector<LL>h, memo;

LL dp(LL i)
{
	if (i == N - 1) return 0;
	if (memo[i] != -1) return memo[i];
	LL res1 = dp(i + 1) + std::abs(h[i] - h[i + 1]), res2 = inf;
	if (i + 2 <= N - 1) res2 = dp(i + 2) + std::abs(h[i] - h[i + 2]);
	return memo[i] = std::min(res1, res2);
}

int main()
{
	in >> N;
	h.resize(N);
	rep(i, N) in >> h[i];

	memo.resize(N, -1);
	out << dp(0) << std::endl;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair

int main(){
	ll n;
	cin >> n;
	ll a[n];
	map<ll,ll> ma;
	ll res=0;
	for(ll i=0;i<n;i++){
		cin >> a[i];
		ma[a[i]]++;
		res+=a[i];
	}
	ll q;
	cin >> q;
	for(ll i=0;i<q;i++){
		ll b,c;
		cin >> b >> c;
		res=res-ma[b]*(b-c);
		ma[c]+=ma[b];
		ma[b]=0;
		cout << res << endl;
	}
}


Measured memory_bytes: 10276
#include<iostream>
#include<iomanip>
#include<math.h>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<set>
#include<vector>
using namespace std;

#define INF 1<<21
#define MOD 1000000007

int main(){
    int x,y,z;
    int ans=0;
    cin>>x>>y>>z;
    x-=2*z+y;
    ans=x/(y+z);
    cout<<ans+1<<endl;
    return 0;
}


Measured memory_bytes: 256
S = input()

red = 0  # 0
blue = 0 # 1
m = 0
for s in S:
	if s == '0':
		if blue != 0:
			blue -= 1
			m += 2
		else:
			red += 1
	elif s == '1':
		if red != 0:
			red -= 1
			m += 2
		else:
			blue += 1

print(m)

Measured memory_bytes: 3188
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using 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 SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(n);
  Vi H(n);
  VIN(H)
  bool test = true;
  for(int i = n-1; i > 0; i--){
    if(H[i]+1 == H[i-1]) H[i-1]--;
    else if(H[i] < H[i-1]) test = false;
  }
  Yes(test);
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code
int main(int argc, char const* argv[])
{
	int a,b;
	cin >> a >> b;
	cout << max(a+b, max(a-b, a*b)) << endl;
	return 0;
}


Measured memory_bytes: 256
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int n,i,j,a,b,c,k;
            cin>>n>>a>>b>>c;
            int dp[n+1][3];
            int ar[3];
            ar[0]=a,ar[1]=b,ar[2]=c;
            dp[n][0]=a,dp[n][1]=b,dp[n][2]=c;
            for(i=n-1;i>=1;--i)
            {
                cin>>ar[0]>>ar[1]>>ar[2];
                
                for(j=0;j<3;++j)
                {
                    dp[i][j]=0;
                    for(k=0;k<3;++k)
                    {
                        if(k==j)
                            continue;
                        dp[i][j]=max(dp[i][j],ar[j]+dp[i+1][k]);
                    }
                }
            }
            int ans=max(dp[1][0],max(dp[1][1],dp[1][2]));
            cout<<ans<<endl;
        }
        return 0;
    }


Measured memory_bytes: 1408
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);
parse_tuple!(A, B, C, D);
parse_tuple!(A, B, C, D, E);

// ===

fn main() {
  let (n, m, xc, yc): (usize, usize, i32, i32) = read();
  let mut x: Vec<i32> = readnc();
  let mut y: Vec<i32> = readnc();
  x.push(xc);
  y.push(yc);
  x.sort();
  y.sort();

  if x[n] < y[0] {
    println!("No War");
  } else {
    println!("War");
  }
}


Measured memory_bytes: 4352
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long ab = gcd(a, b);
 
		long c = 0;
		for (long i = 2; i * i <= ab; i++) {
			if (ab % i != 0) continue;
			c++;
			while (ab % i == 0) {
				ab /= i;
			}
		}
		if (ab > 1) c++;
		System.out.println(c + 1);
	}
 
 
	private static long gcd(long a, long b) {
		while (a % b != 0) {
			long x = a % b;
			a = b;
			b = x;
		}
		return b;
	}
}

Measured memory_bytes: 23764
#include <stdio.h>
#include <string.h>
int main(){
	char s1[100],s2[100];
	while(scanf("%s%s",s1,s2)!=EOF){
		int i;

			for(i=0;i<strlen(s1);i++){
			if(s1[0]==s2[i]){
				int j,t=i,flag=1;
				for( j=0;j<strlen(s2);j++){
					if(s2[(j+t)%strlen(s2)]!=s1[j]){
						flag=0;
						break;
					}
				}
				if(flag){
					printf("Yes\n");
					break;
				}
			}
		}
		if(i==strlen(s1))
			printf("No\n");
	}
		
	
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  ll a,b;
  cin >> a >> b;
  int upper = sqrt((ll) max(a,b)) + 2;
  //int upper = (int)1e6 + 10;
  vector<bool> is_prime (upper,true);
  is_prime[0] = false;
  is_prime[1] = false;
  for(ll i=2;i<=(upper)/2;i++){
    if (is_prime[i] == false)
      continue;
    ll t = i*2;
    while(true){
      is_prime[t] = false;
      t += i;
      if(t>=upper)
        break;
    }
  }
  int count = 0;
  rep(i,upper){
    if(is_prime[i] == false)
      continue;
    int p = i;
    bool flag_a = false;
    bool flag_b = false;
    //cout << p << endl;
    if(a%p == 0){
      while(a%p == 0) a = a/p;
      flag_a = true;
    }
    if(b%p == 0){
      while(b%p == 0) b = b/p;
      flag_b = true;
    }
    if(flag_a && flag_b) count++;
  }
  if(a > 1 && b > 1 && (a%b == 0 || b%a == 0)) count++;
  cout << count + 1 << endl;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  string t;
  cin >> t;
  bool update=false;
  rep(i,s.size()){
    for(int j=i;j<s.size();j++){
      if(s[j]!=t[j-i]) break;
      if(j==s.size()-1){	  
	update=true;
	for(int k=j-i+1;k<t.size();k++){
	  s.pb(t[k]);
	}
      }
    }      
    if(update) break;          
  }
  /*rep(i,s.size()){
    cout << s[i];
    }*/
  if(update) cout << s.size() << endl;
  else cout << s.size()+t.size() << endl;

  
  return 0;
    

}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
   

int main(){
    double r;
    cin>>r;
    
    cout<<fixed<<setprecision(6)<<r*r*M_PI<<" "<<2*r*M_PI<<"\n";
    
    
    
    
}



Measured memory_bytes: 3288
#include <stdio.h>
#include <algorithm>
#include <iostream>
using namespace std;

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

int main()
{
  int d=0;
  while(cin >> d){
    int x=d;
    int sum=0;
    while(x<600){
      sum += d*x*x;
      x += d;
    }
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
k = int(input())

if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()

val = 7
idx = 1

while True:
    if val % k == 0:
        break
    else:
        idx += 1
        val = (val * 10 + 7) % k

print(idx)


Measured memory_bytes: 63028
#include <iostream>
using namespace std;
 
int main(){
    int h, w;
    while(true){
        cin >> h >> w;
        if(h==0) break;
        for(int j=0;j<h;j++){
            if(j==0 || j==h-1){
                for(int i=0;i<w;i++){
                    cout << "#";
                }
                cout << endl;
            }else{
                for(int i=0;i<w;i++){
                    if(i==0 || i==w-1){
                        cout << "#";
                    }else{
                        cout << ".";
                    }
                }
            cout << endl;
            }
        }
    cout << endl;
    }
}


Measured memory_bytes: 3088
#include <stdio.h>

int gcd(int a, int b) {
	int tmp;
	if (b > a) {
		tmp = a;
		a = b;
		b = tmp;
	}

	while (b) {
		tmp = a % b;
		a = b;
		b = tmp;
	}
	return a;
}

void ex_gcd(int a, int b, int* g, int* x, int* y) {
	int r0, r1, r2, x0, x1, x2, y0, y1, y2, q;
	r0 = a; r1 = b;
	x0 = 1; x1 = 0;
	y0 = 0; y1 = 1;
	while (r1 > 0) {
//		printf("x0 = %d, y0 = %d\n", x0, y0);
		r2 = r0 % r1;
		q = r0 / r1;
		x2 = x0 - q * x1;
		y2 = y0 - q * y1;
		r0 = r1; r1 = r2;
		x0 = x1; x1 = x2;
		y0 = y1; y1 = y2;
	}
	*g = r0;
	*x = x0;
	*y = y0;
	return;
}

int main(void) {
	int a, b, g;
	int x = 0, y = 0;
	scanf("%d %d", &a, &b);
	
//	g = gcd(a, b);
	ex_gcd(a, b, &g, &x, &y);
	printf("%d %d\n", x, y);
	return 0;
}

Measured memory_bytes: 596