akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

template < typename T > std::string to_string( const T& n ) {
    ostringstream stm ;
    stm << n ;

    return stm.str() ;
}

void generate_string(int input_1,int input_2, string& s);
void output_smaller_one_in_dictionary_order(string s, string t);

int main() {
    int input[2];

    cin >> input[0] >> input[1];
    string repeat_an_integer[2];
    generate_string(input[1], input[0], repeat_an_integer[0]);
    generate_string(input[0], input[1], repeat_an_integer[1]);
    output_smaller_one_in_dictionary_order(repeat_an_integer[0], repeat_an_integer[1]);

    return 0;
}

void generate_string(int input_1,int input_2, string& s) {
    for(int i = 0; i < input_2; i++) {
        s += to_string(input_1);
    }
}

void output_smaller_one_in_dictionary_order(string s, string t) {
    if(s <= t) {
        cout << s << endl;
    } else {
        cout << t << endl;
    }
}

Measured memory_bytes: 384
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  a=b=0
  for x in l:
    if x%4==0:
      b+=1
    elif x%2==0:
      a+=1

  if a==0 and b*2+1>=n:
    return 'Yes'
  elif a+b*2>=n:
    return 'Yes'
  return 'No'

print(main())


Measured memory_bytes: 16516
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int q;
	cin>>q;
	while(q--){
		vi a(9),b(9);
		rep(i,9)cin>>a[i];
		rep(i,9)cin>>b[i];
		sort(all(b));
		int co=0;
		do{
			int sum=0;
			rep(i,9)if(a[i]>b[i])sum+=a[i]+b[i];
			if(85<sum)co++;
		}while(next_permutation(all(b)));
		double out=co/362880.;
		cout<<shosu(9)<<out<<" "<<1-out<<endl;
	}
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    int n,A[300001];
    cin>>n;
    rep(i,3*n) cin>>A[i];
    sort(A,A+3*n,greater<int>());
    ll ans=0;
    rep(i,3*n) if(i%2==1&&i<2*n) ans+=A[i];
    cout<<ans;
}

Measured memory_bytes: 1408
use std::io::{self, BufRead};

fn main() {
    let stdin = io::stdin();
    let (a, b): (u32, u32) = stdin.lock().lines().skip(1).map(|r| {
        r.as_ref().map(|l| {
            let mut s = l.split_whitespace().map(|s| s.parse().unwrap());
            (s.next().unwrap(), s.next().unwrap())
        }).unwrap()
    }).max_by_key(|&(a, _)| a).unwrap();
    println!("{}", a+b);
}

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

#define vec(v) vector<int>(v)
#define be(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define mapci(mp) map<char*,int>(mp)
#define mapcc(mp) map<char*,char*>(mp)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int ans=0,n,a;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a%2==1){
            ans++;
        }
    }
    if(ans%2==1){
        cout <<"NO"<<endl;
    }
    else{
        cout <<"YES"<<endl;
    }
    return 0;
}


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

using namespace std;



int main(int argc, char* argv[])
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int N, M, X, Y;
  cin >> N >> M >> X >> Y;

  vector<int> x(N); for(int& xi : x) cin >> xi;
  vector<int> y(M); for(int& yi : y) cin >> yi;
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());

  int minz = max(X+1, x.back() + 1);
  int maxz = min(Y, y[0]);

  if (minz <= maxz) cout << "No War\n";
  else cout << "War\n";

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < A[i].size(); j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	int A, B, C;
	cin >> A >> B >> C >> K;
	int tmp = 0;
	while (B <= A) {
		B *= 2;
		tmp++;
	}
	while (C <= B) {
		C *= 2;
		tmp++;
	}
	string ans = "No";
	if (tmp <= K) {
		ans = "Yes";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#include<stdio.h>
#include<functional>
#include<queue>

using ll = long long;

using namespace std;

ll mod = 1000000007;

ll n_pow(ll a, ll n) {
	if (n == 0)return 1;
	ll t = n_pow(a, n / 2);
	t *= t;
	t %= mod;
	if (n % 2 == 1)t *= a;
	return t % mod;
}

const int INF = 1001001001;


int main() {
	int n;
	ll w;
	cin >> n >> w;
	vector<int>value(n);
	vector<ll>weight(n);
	int sum_v = 0;
	for (int i = 0; i < n; i++) {
		cin >> weight[i] >> value[i];
		sum_v += value[i];
	}
	vector<vector<ll>>dp(n + 1, vector<ll>(sum_v + 1, INF));
	dp[0][0] = 0;
	for (int i = 0; i < n; i++) {
		for (int v = 0; v < sum_v + 1; v++) {
			if (v - value[i] < 0) {
				dp[i + 1][v] = dp[i][v];
			}
			else {
				dp[i + 1][v] = min(dp[i][v], dp[i][v - value[i]] + weight[i]);
			}
		}
	}
	int ans = 0;
	for (int v = 0; v < sum_v + 1; v++) {
		if (dp[n][v] <= w) {
			ans = v;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 80256
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
#define diup(a, b) (a % b == 0 ? a / b : a / b + 1)
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

void Main()
{
	int n;
	cin >> n;

	cout << (n + 1) * n / 2;
}

/*****/

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

	std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	iv, _ := strconv.Atoi(scanString())
	return iv
}

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

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 100000), 100000000)
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	_ = scanInt()
	s := scanString()
	b, w := 0, 0
	for _, r := range s {
		if r == '.' {
			w++
		}
	}
	ans := w
	for _, r := range s {
		if r == '.' {
			w--
		} else {
			b++
		}
		ans = min(ans, b+w)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2480
N = int(input())
A1_lis = list(map(int, input().split()))
A2_lis = list(map(int, input().split()))

sum_list = []
for i in range(N):
    sum_list.append(sum(A1_lis[:i])+sum(A2_lis[i-1:]))
if N==1:
    print(A1_lis[0]+A2_lis[0])
else:
    print(max(sum_list))


Measured memory_bytes: 2940
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    string s, t;
    cin >> s >> t;
    int cs[128] = {};
    int ct[128] = {};
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());

    if(s < t) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 256
/*input
9 4 1
1 5
2 4
3 3
4 2
5 1
6 2
7 3
8 4
9 5
*/

//https://atcoder.jp/contests/abc153/tasks/abc153_f

#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>

using namespace std;

void run() {
	int n, i, j=0;
	ll d, a;
	cin >> n >> d >> a;
	vector<pair<ll, ll>> monster(n);
	vector<int> prefix(n+1, 0);		// Prefix array to store how many bombs have already been dropped on future locations
	for(i=0; i<n; i++)
		cin >> monster[i].first >> monster[i].second;
	sort(monster.begin(), monster.end());
	i = 0;	// current monster
	ll ret = 0;
	while(i < n) {
		ll x = monster[i].first, h = monster[i].second;
		ll bomb_x = x + d;
		ll bombs = max(0ll, (h - prefix[i]*a + a - 1) / a);
		for(; j<n; j++) {	// Monsters in range
			if(abs(monster[j].first - bomb_x) > d)
				break;
		}
		ret += bombs;
		prefix[i] += bombs;
		prefix[j] -= bombs;
		prefix[i+1] += prefix[i];
		i++;
	}
	cout << ret << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);		
	int t = 1;
	// cin >> t;
	while(t--) {
		run();
	}
}


Measured memory_bytes: 4224
#include<stdio.h>

int cnt;

void insertionSort(int* a, int n, int g){

    int i, j, v;

    for(i = g; i < n; i++){
        v = a[i];
        j = i - g;
        while((j >= 0) && (a[j] > v)){
            a[j + g] = a[j];
            j = j - g;
            cnt++;
        };
        a[j + g] = v;
    }
}

void shellsort(int* a, int n)
{
    cnt = 0;
    int i, p;
    int m;
    int G[15];

    p = 1;
    for(i = 1; i < 20; i++){
        p = p * 3;
        if(p - 1 > 2 * n) break;
    }
    if(i > 1) i = i - 1;
    m = i;

    p = 1;
    for(i = 0; i < m; i++){
        p = p * 3;
        G[m - 1 - i] = (p - 1) / 2;
    }
    printf("%d\n", m);
    for(i = 0; i < m - 1; i++) printf("%d ", G[i]);
    printf("%d\n", G[m - 1]);

    for(int i = 0; i < m; i++){
        insertionSort(a, n, G[i]);
    }
}

int main()
{
    int i, A[1000000], n;
    scanf("%d", &n);
    for(i = 0; i < n; i++) scanf("%d", &A[i]);

    shellsort(A, n);
    printf("%d\n", cnt);
    for(i = 0; i < n; i++) printf("%d\n", A[i]);

    return 0;
}

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

using namespace std;

bool isQwerty(char c){
  return !(
  c == 'y' ||
  c == 'u' ||
  c == 'i' ||
  c == 'o' ||
  c == 'p' ||
  c == 'h' ||
  c == 'j' ||
  c == 'k' ||
  c == 'l' ||
  c == 'n' ||
  c == 'm'
);
 return true;
}

int main(){

  while(true){

string str;
cin >> str;

if(str == "#")break;

int i = 0;
int ans = 0;

bool nowQwerty = isQwerty(str[i]);

for(i  = 1; i < str.size(); i++){
  if(nowQwerty != isQwerty(str[i])){
    ans++;
    nowQwerty = !nowQwerty;
  }
}

cout << ans << endl;
}

return 0;

}

Measured memory_bytes: 3172
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
int main(){
    int N;
    cin >> N;
    
    int A[100000] = {};
    int a[100000] = {};
    int Count = 0;
    for(int i=0;i<N;i++){
        cin >> A[i];
        a[i] = abs(A[i]);
        if(A[i]<=0){
            Count++;
        }
    }
    
    long long ans = 0;
    
    
    if(Count%2==0){
        for(int i=0;i<N;i++){
            ans = ans+a[i];
        }
        }else{
            sort(a,a+N);
            for(int i=1;i<N;i++){
                ans = ans + a[i];
        }
            ans = ans - a[0];
    }
    
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N;
    string S;
    cin >> N >> S;
    if (N % 2) {
        puts("No");
        return 0;
    }
    for (int i = 0, j = N/2; j < N; i++, j++) {
        if (S[i] != S[j]) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
}

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

int main(){
  int a,b,c,ans;
  string s;
  cin>>a;
  ans+=a/100;
  a-=(a/100)*100;
  ans+=a/10;
  a-=(a/10)*10;
  ans+=a;
  cout<<ans<<"\n";
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int i = 0;
		while(i==0){
			int a = scan.nextInt();
			String or = scan.next();
			int b = scan.nextInt();
			if(or.equals("?")){
				 i=1;
				 break;
			     }else if(or.equals("+")){
					System.out.println(a + b);
				 }else if(or.equals("-")){
				 	System.out.println(a - b);
				 }else if(or.equals("*")){
				 	System.out.println(a * b);
				 }else if(or.equals("/")){
				 	System.out.println(a / b);
			}
		}
	}
}


Measured memory_bytes: 26272
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */


class Bridge {
public:
    vector<vector<int>> G;
    vector<int> ord, low;
    vector<pair<int, int>> bridges;
    int k;
    
    Bridge(int N):k(0) {
        G.resize(N); ord.resize(N, -1); low.resize(N, -1);
    }
    void clear() { G.clear();ord.clear();low.clear(); }
    void add_edge(int s, int t) {
        G[s].emplace_back(t);
        G[t].emplace_back(s);
    }
    
    bool is_bridge(int u, int v)const {
        if (ord[u] > ord[v])swap(u, v);
        return ord[u] < low[v];
    }
    
    /* Lowlink */
    void dfs(int u,int rev = -1) {
        ord[u] = low[u] = k;
        k++;
        for (auto v : G[u]) {
            if (v == rev)continue;
            if (ord[v] < 0) {
                dfs(v, u);
                low[u] = min(low[u], low[v]);
            }
            else {
                low[u] = min(low[u], ord[v]);
            }
            if (is_bridge(u, v)) {
                int s = u, t = v;
                if (s > t) swap(s, t);
                bridges.push_back({ s,t });
            }
        }
    }
    
    void solve() {
        dfs(0);
        sort(bridges.begin(), bridges.end());
    }
};

ll solve(){
    ll res = 0;
    ll N,M; cin >> N >> M;
    Bridge B(N);
    for(int i = 0; i < M;i++){
        ll a,b; cin >> a >> b;
        a--; b--;
        B.add_edge(a, b);
    }
    B.solve();
    res = B.bridges.size();
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 384
s = input()

min_diff = 1000
s_list = list(s)
for i in range(1, len(s_list) - 1):
    diff = abs(int(s_list[i - 1] + s_list[i] + s_list[i + 1]) - 753)
    min_diff = min(min_diff, diff)

print(min_diff)


Measured memory_bytes: 2940
using System;

public class ABC129C {
  public static void Main(string[] args) {
    var str = Console.ReadLine().Split();
    int n = int.Parse(str[0]);
    int m = int.Parse(str[1]);
    int[] a = new int[m];
    long[] dp = new long[n+1];
    long mod = 1000000007;
    
    for (int i = 0; i < n+1; i++) {
      dp[i] = 100001;
    }
    
    dp[0] = 1;
    dp[1] = 1;
    
    for (int i = 0; i < m; i++) {
      var str2 = Console.ReadLine();
      a[i] = int.Parse(str2);
      dp[a[i]] = 0;
    }
    
    for (int i = 2; i < n+1; i++) {
      if (dp[i] == 0) {
        continue;
      }else {
        dp[i] = dp[i-1] + dp[i-2];
        dp[i] = dp[i] % mod;
      }
    }
    
    Console.WriteLine(dp[n] % mod);
        
  }
}   

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

#define read(a) cin >> a
#define out(a)  cout << a
#define ull unsigned long long
#define ll long long
#define FOR(i, l, r) for (ll i = l; i <= r; i++)
#define FOD(i, l, r) for (ll i = l; i >= r; i--)
#define fast ios_base::sync_with_stdio(false);

int main()
{
    fast;
    ll n;
    read(n);
    if (n >= 30) cout << "Yes";
    else out("No");
}



Measured memory_bytes: 3644
use std::collections::VecDeque;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        h: usize,
        w: usize,
        s: [chars; h],
    }

    let mut b_count = 0;
    for i in 0..h {
        for j in 0..w {
            if s[i][j] == '#' {
                b_count += 1;
            }
        }
    }

    let mut visited = vec![vec![false; w]; h];
    let mut queue = VecDeque::new();
    queue.push_back((0, 0, 0));
    while queue.len() > 0 {
        let (i, j, d) = queue.pop_front().unwrap();
        if visited[i][j] {
            continue;
        }
        visited[i][j] = true;
        if i == h - 1 && j == w - 1 {
            println!("{}", w * h - d - 1 - b_count);
            return;
        }
        if i > 0 && s[i - 1][j] == '.' {
            queue.push_back((i - 1, j, d + 1));
        }
        if i < h - 1 && s[i + 1][j] == '.' {
            queue.push_back((i + 1, j, d + 1));
        }
        if j > 0 && s[i][j - 1] == '.' {
            queue.push_back((i, j - 1, d + 1));
        }
        if j < w - 1 && s[i][j + 1] == '.' {
            queue.push_back((i, j + 1, d + 1));
        }
    }
    println!("-1");
}


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

#define FST first
#define SCD second
#define MODP 1000000007

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

int f[600000];
int X[600000];

int cmp(PA x, PA y) {
    return x.SCD < y.SCD;
}

int main() {
#ifdef FDB
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    int n, m, k;
    cin>>n;
    vector<PA> R;
    for (int i=0;i<n;++i) {
        int x, l;
        scanf("%d%d", &x, &l);
        X[i<<1] = x-l;
        X[(i<<1)+1] = x+l;
        R.push_back(PA(x-l, x+l));
    }
    int tot = n<<1;
    sort(X, X+tot);
    tot = unique(X, X+tot) - X;
    for (int i=0;i<n;++i) {
        R[i].FST = lower_bound(X,X+tot,R[i].FST)-X;
        R[i].SCD = lower_bound(X,X+tot,R[i].SCD)-X;
    }
    f[0] = 0;
    sort(R.begin(), R.end(), cmp);
    int ptr = 0;
    for (int i=1;i<tot;++i) {
        f[i] = f[i-1];
        while (ptr<n&&R[ptr].SCD==i) {
            f[i] = max(f[R[ptr].FST]+1, f[i]);
            ++ptr;
        }
    }
    cout<<f[tot-1]<<endl;
    return 0;
}

Measured memory_bytes: 3956
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scan()
	t := Scan()
	ans := "No"
	for i := 0; i < len(s); i++ {
		if s[i:]+s[:i] == t {
			ans = "Yes"
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1780
# -*- coding: utf-8 -*-
"""
Created on Fri Aug  7 01:24:25 2020

@author: saito
"""

# %% import phase

# %% define phase

# %% input phase
N = int(input())

# %% process phase
answer = 1000-((N-1)%1000+1)

# %%output phase
print(answer)

Measured memory_bytes: 9100
#include<stdio.h>
#include<stdlib.h>

int main()
{
	long long int k, n; 
	long long int i, x, y;
	y = 0;
	scanf("%lld %lld", &k, &n);
	long long int a[2000000] = {0};
	for(i = 0; i < n; i++)
	{
		scanf("%lld", a + i);
	}
	x = a[n - 1] - a[0];
	for(i = 1; i < n; i++)
	{
		if(y == 0 || y > k - a[i] + a[i - 1])
		{
			y = k - a[i] + a[i - 1];
		}
	}
	
	if(x < y)
	{
		printf("%lld", x);
	}
	else printf("%lld", y);
}


Measured memory_bytes: 15744
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)

int main(){
  char c,a;
  cin>>c;
  if(c=='A') a='T';
  if(c=='T') a='A';
  if(c=='C') a='G';
  if(c=='G') a='C';  
  cout<<a<<endl;
}

Measured memory_bytes: 256
from sys import setrecursionlimit
setrecursionlimit(10**8)
N=int(input())
Graph=[[] for i in range(N)]
for i in range(N-1):
  u,v,w=map(int,input().split())
  w%=2
  Graph[u-1].append((v-1,w))
  Graph[v-1].append((u-1,w))
  
root=0
color=[-1]*N
color[0]=0
def dfs(x):
  for i,w in Graph[x]:
    if color[i]==-1:
      color[i]=(color[x]+w)%2
      dfs(i)
dfs(0)
for i in range(N):
  print(color[i])
    

Measured memory_bytes: 159136
import collections


class RollingHashSingle:
    def __init__(self, s, base, mod):
        self.base = base
        self.mod = mod

        self.hash = [0]
        self.power = [1]
        for c in s:
            self.hash.append((self.hash[-1] * base + ord(c)) % mod)
            self.power.append(self.power[-1] * base % mod)

    def get(self, left, right):
        h = self.hash[right] - self.hash[left] * self.power[right - left]
        return (h + self.mod) % self.mod


class RollingHash:
    def __init__(self,
                 s,
                 base=(10**4 + 7, 10**4 + 9),
                 mod=(10**9 + 7, 10**9 + 9)):
        if isinstance(base, int):
            assert isinstance(mod, int)
            self.base = (base, )
            self.mod = (mod, )
        elif isinstance(base, tuple):
            assert isinstance(mod, tuple)
            assert len(base) == len(mod)
            self.base = base
            self.mod = mod
        else:
            raise ValueError()

        self._rh = [
            RollingHashSingle(s, base, mod)
            for base, mod in zip(self.base, self.mod)
        ]

    def get(self, left, right):
        return tuple(rh.get(left, right) for rh in self._rh)


n = int(input())
s = input().rstrip()
rh = RollingHash(s)


def check(diff):
    d = collections.defaultdict(list)
    for i in range(n - diff + 1):
        h = rh.get(i, i + diff)
        d[h].append(i)
    for l in d.values():
        if max(l) - min(l) >= diff:
            return True
    return False


lo = 0
hi = n // 2 + 1
while lo + 1 < hi:
    mid = (lo + hi) // 2
    if check(mid):
        lo = mid
    else:
        hi = mid
print(lo)

Measured memory_bytes: 5864
x = list(map(int, input().split()))
x.sort()
#print(x)
ans = 0

if x[2] % 2 == x[1] % 2 == x[0] % 2:
  ans = (x[2] - x[1]) // 2 + (x[2] - x[0]) // 2
elif (x[2] % 2 == x[1] % 2 and x[2] % 2 != x[0] % 2) or (x[2] % 2 == x[0] % 2 and x[2] % 2 != x[1] % 2):
  ans = (x[2] - x[1]) // 2 + (x[2] - x[0]) // 2 + 2
else:
  ans = (x[2] - x[1]) // 2 + (x[2] - x[0]) // 2 + 1
  
print(ans)


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

const int N = 1e3 + 5;
const int M = 5e3 + 5;
#define st first
#define nd second

typedef pair<int,int> pun;
typedef long long ll;

vector<int> G[N];

int X[N];
int Y[N];

bool dp[M];

void licz(int x, bool& possible) {
	for (int i = 0; i <= X[x]; i ++) dp[i] = false;
	dp[0] = true;
	int sum = 0;
	int all = 0;
	for (int y : G[x]) {
		sum += min(X[y], Y[y]);
		all += X[y] + Y[y];
		for (int i = X[x]; i >= 0; i --) {
			if (dp[i]) {
				if (i + X[y] + Y[y] - 2 * min(X[y], Y[y]) <= X[x])
					dp[i + X[y] + Y[y] - 2 * min(X[y], Y[y])] = true;
			}
		}
	}
	if (sum > X[x]) possible = false;
	for (int i = X[x] - sum; i >= 0; i --) {
		if (dp[i]) {
			Y[x] = all - sum - i;
			return;
		}
	}
}

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 2; i <= n; i++) {
		int a;
		scanf("%d", &a);
		G[a].push_back(i);
	}
	for (int i = 1; i <= n; i ++) scanf("%d", &X[i]);
	bool possible = true;
	for (int i = n ; i >= 1; i --) licz(i, possible);
	printf("%s\n", possible? "POSSIBLE" :"IMPOSSIBLE");
}


Measured memory_bytes: 256
package main

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

var z byte = '0'

func main() {
	s := readBytes()
	x, y := 0, 0
	for i := range s {
		if s[i] == z {
			x++
		} else {
			y++
		}
	}
	fmt.Println(min(x, y) * 2)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 896
N = input()
s = input()
 
N1 = int(N)/2
 
import math
N1= math.ceil(N1)
N1= int(N1)-1
 
list_s = list(s)
list_s.sort()
X = list_s[N1]
 
if X=='R':
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
inp = raw_input()
for i in xrange(8):
    ans = int(inp[0])
    ansStr = inp[0]
    a = bin(i)[2:].zfill(3)
    for j in xrange(3):
        buff = int(inp[j + 1]) * (-1 if(a[j] == "1")else 1)
        ans += buff
        ansStr += ("-"if(buff < 0)else "+") + inp[j + 1]
    #print ans
    if(ans == 7):
        print ansStr+"=7"
        break

Measured memory_bytes: 2568
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    string S;
    cin >> S;
    int p = 0, g = 0;
    int k = 0, m = 0;
    for(auto&& s : S){
        if(s=='g'){
            if((p+1) <= g){
                p++;
                k++;
            }else{
                g++;
            }
        }else if(s=='p'){
            if((p+1) <= g){
                p++;
            }else{
                g++;
                m++;
            }
        }
    }
    pr(k-m);
}

Measured memory_bytes: 512
//aea ctmr
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//v.erase(unique(v.begin(),v.end()),v.end());
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define PI 3.14159265358979323846
 
typedef long double ld;
typedef long long ll;
const ll N = 400500;
const ll mod = 1e9 + 7;
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif

bool wea(string s){
	int l = s.size();
	for(int i = 0; i < l; i++){
		if(s[i] != s[l - i - 1]) return false;
	}

	return true;
}

int main(){
    fastio;
	string s;
	cin >> s;
	int n = s.size();
	string s1 = s.substr(0, (n - 1) / 2);
	string s2 = s.substr((n + 1) / 2);
	//trace(s, s1, s2);
	if(wea(s) and wea(s1) and wea(s2)) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
n,w = map(int,input().split())
box = []
v = []
for i in range(n):
  W,V = map(int,input().split())
  box.append([W,V])
  v.append(V)
vmax = n*max(v)
inf = float('inf')
dp = [[inf for i in range(vmax+1)] for j in range(n+1)]
dp[0][0] = 0
for i in range(1,n+1):
  for j in range(vmax+1):
    if j >= box[i-1][1]:
      dp[i][j] = min(dp[i-1][j-box[i-1][1]] + box[i-1][0],dp[i-1][j])
    else:
      dp[i][j] = min(dp[i][j],dp[i-1][j])
ans = []
for i in range(vmax+1):
  if dp[n][i] <= w:
    ans.append(i)
print(max(ans))

Measured memory_bytes: 320948
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline int read()
{
	int s=0,f=1;char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

int n;

inline void init()
{
	n=read();
	if(__builtin_popcount(n)==1)puts("No"),exit(0);
	puts("Yes");
	REP(i,1,2)printf("%d %d\n",i,i+1);
	printf("%d %d\n",3,1+n);
	REP(i,1,2)printf("%d %d\n",i+n,i+n+1);
	REP(k,2,n-1>>1)
	{
		int a=k*2,b=k*2+1;
		printf("%d %d\n",a,b); printf("%d %d\n",b,1+n);
		printf("%d %d\n",1+n,a+n); printf("%d %d\n",a+n,b+n);
	}
	if(~n&1)
	{
		int x,y;
		int now=__builtin_clz(n);
		x=1<<31-now; y=n^x^1;
		printf("%d %d\n",n,x+n);
		printf("%d %d\n",n<<1,y);
	}
}

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


Measured memory_bytes: 2816
h,w=map(int,input().split())
l=['.'*(w+2)]+['.'+input()+'.' for i in range(h)]+['.'*(w+2)]

ans='Yes'
for i in range(1,h+1):
    for j in range(1,w+1):
        if l[i][j]=='#':
            if l[i-1][j]==l[i+1][j]==l[i][j-1]==l[i][j+1]=='.':
                ans='No'
print(ans)

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

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

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

bool isTriangle( int a, int b, int c ){
	std::vector<int> v = { a, b, c};
	std::sort(v.begin(),v.end());
	
	return v[0]>v[2]-v[1];
}


// 1,?,N の番号がついた N 本の棒があります。棒 i(1?i?N) の長さは Li
//
// です。
//
// このうち、三角形を作ることのできるような長さの異なる 3
//
// 本の棒を選ぶ方法は何通りあるでしょうか。
//
// つまり、3
// つの整数 1?i<j<k?N の組であって次の 2
//
// つの条件の両方を満たすものの個数を求めてください。
//
//     Li,Lj,Lk
//
// がすべて異なる
// 3
// 辺の長さが Li,Lj,Lk であるような三角形が存在する
//
int main(int argc, char const* argv[])
{
	using namespace std;
	
	int count;
	cin >> count;
	
	vector<int> c;//Container
	for (int i = 0; i < count; i++) {
		int val;
		cin >> val;
		c.push_back(val);
	}
	
	// for (auto v : c) {
	// 	cout << v << ",";
	// }
	// cout << endl;
	
	
	int result =0;
	for (int i = 0; i < count-2; i++) {
		for (int j = i+1; j < count-1; j++) {
			for(int k = j+1; k < count; k++){
				int x =  c[i];
				int y = c[j];
				int z = c[k];
				//Li,Lj,Lk すべて異なる
				if( x!=y && x!=z && y!=z){
					if(isTriangle(x,y,z)){
						result++;
						// cout<<"( "<<x<<","<<y<<","<<z <<")\n";
						// cout<<"( "<<i+1<<","<<j+1<<","<<k+1 <<")\n";
					}
				}
			
			}
		}
	}
	
	
	cout << result << endl;
	
	return 0;
}

Measured memory_bytes: 3624
// {{{
#include <bits/stdc++.h>
using namespace std;
using ll = long long int; // int_fast64_t;
template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;
using vi = vt<int>;
using vvi = vvt<int>;
using vl = vt<ll>;
using vvl = vvt<ll>;
constexpr int INF = 1 << 30;  // 1073741824 2倍すると -2147483648
constexpr ll INFL = 1l << 62; // 4611686018427387904 2倍すると-0.9*10^18
constexpr int dx4[] = {0, 1, 0, -1};
constexpr int dy4[] = {1, 0, -1, 0};
constexpr int dx8[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy8[] = {0, -1, 0, 1, -1, -1, 1, 1};
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define RANGE(i, a, b) for (int i = (a); i <= (b); i++)
#define RANGER(i, a, b) for (int i = (b); i >= (a); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, 0, (n))
// }}}
void fillRect(vvi& m, int x1, int x2, int y1, int y2, int v){
	RANGE(x, x1, x2) RANGE(y, y1, y2) m[y][x] = v;
	cerr << x1 << ":" << x2 << " " << y1 << ":" << y2 << "=" << v << "   ";
}
int main() {
  int H, W, K;
	cin >> H >> W >> K;
	vt<string> S;
	REP(i, H){
		string s;
		cin >> s;
		S.push_back(s);
	}

	vvt<int> r(H, vt<int>(W, 0));
	int pvY = -1, pvX, cv = 1;
	REP(y, H){
		bool found = false;
		pvX = -1;
		REP(x, W){
			if(S[y][x] == '#') {
				found = true;
				fillRect(r, pvX+1, x, pvY+1, y, cv);
				cv++;
				pvX = x;
			}
		}
		if(found){
			if(pvX != W-1){
				fillRect(r, pvX+1, W-1, pvY+1, y, cv-1);
			}
			pvY = y;
		}
	}
	FOR(i, pvY+1, H){
		REP(j, W){
			r[i][j] = r[i-1][j];
		}
	}

	REP(y, H){
		REP(x, W){
			cout << r[y][x] << " ";
		}
		cout << endl;
	}
  return 0;
}
/* vim: set fdm=marker: */


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int cnt[100010];
int main()
{
    int N,M;
    cin >> N >> M;
    rep(i,M){
        int a,b;
        cin >> a >> b;
        --a;--b;
        cnt[a]++;cnt[b]++;
    }
    bool ok=true;
    rep(i,N){
        ok&=(cnt[i]%2==0);
    }
    if(ok)cout << "YES";
    else cout << "NO";
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <map>
#include <queue>
#include <deque>
#include <set>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define FOR(i,a,b) for (int i = (a) ; i <= (b); ++i)
#define all(x) (x).begin(), (x).end()
//#define repitr(itr, st) for(auto itr = st.begin(); itr != st.end(); ++itr)
#define P_B push_back
#define PO_B pop_back
#define E_B emplace_back
#define M_P make_pair
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << endl
//#define print(x) printf("%d\n", x)

using namespace std;
using ll = long long;
using Pii = pair<int,int>;
using Pll = pair<ll,ll>;
using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<vector<int> >;
using VVL = vector<vector<ll> >;
//int dx[4] = {1, 0, -1, 0};
//int dy[4] = {0, 1, 0, -1};
//const ll LINF = (ll)1e18 - 1;
//const int INF = 1e9 - 1;
//int:±2*10^9くらい　ll:±9*10^18くらい


void Main(){
	string s, t;
	ll ans=0;
	cin >> s >> t;

	rep(i, s.size()){
		if(s[i] != t[i]) ans++;
	}

	cout << ans << endl;







}

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

  return 0;
}


Measured memory_bytes: 3888
/*  
    |\_/|
    |* *|
    \_+_/
*/
#include<bits/stdc++.h>

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  char c;

  cin>>c;

  if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
    cout<<"vowel"<<endl;
  }else{
    cout<<"consonant"<<endl;
  }
  
  return 0;

}


Measured memory_bytes: 256
//12
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int n,m;cin>>n>>m,n|m;){
    int p[1001];
    for(int i=0;i<n;i++){
      cin>>p[i];
    }
    p[n]=0;
    static int pd[1001*1001];
    for(int i=0;i<n+1;i++){
      for(int j=0;j<n+1;j++){
	pd[i*(n+1)+j]=p[i]+p[j];
      }
    }
    sort(pd,pd+(n+1)*(n+1));
    int r=0;
    for(int i=0;i<(n+1)*(n+1);i++){
      int x=lower_bound(pd,pd+(n+1)*(n+1),m-pd[i])-pd;
      if(pd[i]+pd[x]==m){
	r=m;
      }else if(x>0){
	r=max(r,pd[i]+pd[x-1]);
      }
    }
    cout<<r<<endl;
  }
  return 0;
}

Measured memory_bytes: 5096
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(v) v.begin(), v.end()
#define ll long long
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;

//snippets:tmp,cl,cvl,cs,co,coy,con,cov

int main(){
    ll n;
    cin >> n;
    vll odd;
    vll even;
    rep(i,n){
        ll a;
        cin>>a;
        if((i+1)%2==0){
            even.push_back(a);
        }else{
            odd.push_back(a);
        }
    }
    if(n==1){
        cout<<odd[0]<<endl;
        return 0;
    }
    if(n%2==1) swap(odd,even);
    reverse(all(even));
    rep(i,even.size()) cout<<even[i]<<" ";
    rep(i,odd.size()-1) cout<<odd[i]<<" ";
    cout<<odd[odd.size()-1]<<endl;
    
}

Measured memory_bytes: 3948
#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <cstring>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define RANGE(i, x, n) for(int i = x; i < n; ++i)
using namespace std;

int main()
{
    int X;
    cin >> X;
    int sum = 0, ans;
    RANGE(i, 1, 1e9) {
        sum += i;
        if(sum >= X) {
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import math


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def generate_primes(n):
    if n < 2:
        return []
    is_prime_array = [True] * (n + 1)
    is_prime_array[0], is_prime_array[1] = False, False
    for i in range(2, n+1):
        if is_prime_array[i]:
            k = 2 * i
            while k < n + 1:
                is_prime_array[k] = False
                k += i
    return list(filter(lambda i: is_prime_array[i], range(n+1)))


def main():
    N = II()
    if N <= 1:
        print(0)
        exit()
    max_prime = math.ceil(N**0.5)
    primes = generate_primes(max_prime)
    es = [0] * len(primes)
    for i in range(len(primes)):
        while N % primes[i] == 0:
            N /= primes[i]
            es[i] += 1

    ans = 0
    if int(N) != 1:
        ans += 1

    for i in range(len(es)):
        k = 1
        while es[i] - k >= 0:
            es[i] -= k
            k += 1
            ans += 1

    print(ans)


main()


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

#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

ll Gcd(ll a,ll b){
    if(a < b)swap(a, b);

	if(a%b == 0)return(b);

	else return(Gcd(b, a%b));
}

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

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

    ll l_gcd[n], r_gcd[n];
    l_gcd[0] = a[0], r_gcd[n-1] = a[n-1];
    rep(i, n-1){
        l_gcd[i+1] = Gcd(l_gcd[i], a[i+1]);
        r_gcd[n-2-i] = Gcd(r_gcd[n-1-i], a[n-2-i]);
    }

    ll ans = 0;
    rep(i, n){
        if(i == 0)ans = max(ans, r_gcd[i+1]);
        else if(i == n-1)ans = max(ans, l_gcd[i-1]);
        else ans = max(ans, Gcd(l_gcd[i-1], r_gcd[i+1]));
    }   
    
    cout << ans << endl;
}

Measured memory_bytes: 2560