akhauriyash/Code-Regression huggingface dataset:
// AOJ Volume 0 Problem 0012

#include <stdio.h>
#include <math.h>

typedef struct {
	double x1;
	double y1;
	double x2;
	double y2;
} LINE;


int cross(LINE *l1, LINE *l2)
{
	double ta, tb, tc, td;

//	ta=(x3-x4)*(y1-y3)+(y3-y4)*(x3-x1)
//	tb=(x3-x4)*(y2-y3)+(y3-y4)*(x3-x2)
//  tc=(x1-x2)*(y3-y1)+(y1-y2)*(x1-x3)
//  td=(x1-x2)*(y4-y1)+(y1-y2)*(x1-x4)

	ta = (l2->x1 - l2->x2) * (l1->y1 - l2->y1) + (l2->y1 - l2->y2) * (l2->x1 - l1->x1);
	tb = (l2->x1 - l2->x2) * (l1->y2 - l2->y1) + (l2->y1 - l2->y2) * (l2->x1 - l1->x2);
	tc = (l1->x1 - l1->x2) * (l2->y1 - l1->y1) + (l1->y1 - l1->y2) * (l1->x1 - l2->x1);
	td = (l1->x1 - l1->x2) * (l2->y2 - l1->y1) + (l1->y1 - l1->y2) * (l1->x1 - l2->x2);

//	ta = (l2->x2 - l2->x1) * (l1->y1 - l2->y1) + (l2->y2 - l2->y1) * (l1->x1 - l2->x1);
//	tb = (l2->x2 - l2->x1) * (l1->y2 - l2->y1) + (l2->y2 - l2->y1) * (l1->x2 - l2->x1);

//	tc = (l1->x2 - l1->x1) * (l2->y1 - l1->y1) + (l1->y2 - l1->y1) * (l2->x1 - l1->x1);
//	td = (l1->x2 - l1->x1) * (l2->y2 - l1->y1) + (l1->y2 - l1->y1) * (l2->x2 - l1->x1);

	if ((ta * tb <= 0) && (tc * td <= 0)){
		return (1);
	}
	return (0);
}

int main(void)
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	double xg, yg;
	LINE a, b, c, x;
	int flag;
	
	while (scanf("%lf%lf%lf%lf%lf%lf%lf%lf", 
			 	 &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF){

		xg = (x1 + x2 + x3) / 3.0;
		yg = (y1 + y2 + y3) / 3.0;
		
		a.x1 = x1;
		a.y1 = y1;
		a.x2 = x2;
		a.y2 = y2;

		b.x1 = x2;
		b.y1 = y2;
		b.x2 = x3;
		b.y2 = y3;

		c.x1 = x3;
		c.y1 = y3;
		c.x2 = x1;
		c.y2 = y1;

		x.x1 = xp;
		x.y1 = yp;
		x.x2 = xg;
		x.y2 = yg;

		flag =  cross(&a, &x);
		flag += cross(&b, &x);
		flag += cross(&c, &x);

		if (flag == 0){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	return (0);
}

Measured memory_bytes: 0
// Ivan Carvalho
// Problem T - Educational Dynamic Programming Contest - AtCoder
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int MAXN = 3010;
const int MOD = 1e9 + 7;

string s;
int vis[MAXN][MAXN],ok[MAXN][MAXN];
ll dp[MAXN][MAXN],somatorio[MAXN][MAXN];
int N;

ll solve(int pos, int ultimo);

ll calc(int pos,int ultimo);

ll solve(int pos,int ultimo){

	if(vis[pos][ultimo]) return dp[pos][ultimo];
	vis[pos][ultimo] = 1;

	if(ultimo > pos + 1) return dp[pos][ultimo] = 0;

	if(pos == 0) return dp[pos][ultimo] = 1;

	if(s[pos-1] == '>'){
		ll tot = calc(pos-1,N) - calc(pos-1,ultimo - 1);
		return dp[pos][ultimo] = ((tot + MOD) % MOD);
	}
	else{
		ll tot = calc(pos-1,ultimo-1);
		return dp[pos][ultimo] = (tot % MOD);
	}

}

ll calc(int pos,int ultimo){

	if(ultimo == 0) return 0;

	if(ok[pos][ultimo]) return somatorio[pos][ultimo];
	ok[pos][ultimo] = 1;

	ll tot = solve(pos,ultimo) + calc(pos,ultimo - 1);
	return somatorio[pos][ultimo] = (tot % MOD);

}

int main(){

	cin >> N;
	cin >> s;

	ll tot = 0;
	for(int i = 1;i<=N;i++){
		tot += solve(N-1,i);
	}

	tot %= MOD;

	cout << tot << endl;

	return 0;

}

Measured memory_bytes: 423680
n, m, x = map(int, input().split())
c = []
a = []
for i in range(n):
    inp = list(map(int, input().split()))
    c.append(inp[0])
    a.append(inp[1:])

ans = -1
for i in range(2 ** n):
    bi = list(bin(i)[2:].zfill(n))
    cost = 0
    understand = [0] * m
    for j, buy in enumerate(bi):
        if buy == "1":
            cost += c[j]
            for k in range(m):
                understand[k] += a[j][k]
    f = True
    for j in range(m):
        if understand[j] < x:
            f = False

    if f:
        if ans == -1:
            ans = cost
        else:
            ans = min(ans, cost)

print(ans)


Measured memory_bytes: 9232
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  cin>>s;
  if(s=="MON") cout<<6<<endl;
  if(s=="TUE") cout<<5<<endl;
  if(s=="WED") cout<<4<<endl;
  if(s=="THU") cout<<3<<endl;
  if(s=="FRI") cout<<2<<endl;
  if(s=="SAT") cout<<1<<endl;
  if(s=="SUN") cout<<7<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
         Scanner scn=new Scanner(System.in);
         int a=scn.nextInt();
         int b=scn.nextInt();
         int c=scn.nextInt();
         int d=scn.nextInt();
         if(Math.abs(a-c)<=d||(Math.abs(a-b)<=d&&Math.abs(b-c)<=d)){
             System.out.println("Yes");
         }else{
             System.out.println("No");
         }
    }
}


Measured memory_bytes: 22868
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  map<char, ll> MAP;
  FOR(i,0,n) {
    int a;
    char c;
    int b;
    cin >> a >> c >> b;
    MAP[c] += b;
    if(MAP['('] == MAP[')']) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
  return 0;
}

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

using ll = long long;
using namespace std;

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

	int n,k; cin >> n >> k;

	if(n % k) cout << 1 << endl;
	else cout << 0 << endl;	

	return 0;

}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <utility>
#include <climits>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define F first
#define S second
#define OUT(x) cout << x << "\n"
using namespace std;
using point = pair< int,int >;
using ll = long long;

int dp[100001];
int solve(int n);

int main() {
    int n;
    cin >> n;
    int h[n];
    REP(i, n) {
        scanf("%d", &h[i]);
    }

    dp[0] = 0;
    dp[1] = max(h[0], h[1]) - min(h[0], h[1]);

    FOR(i, 2, n) {
        dp[i] = min(dp[i - 1] + max(h[i], h[i - 1]) - min(h[i], h[i - 1]), dp[i - 2] + max(h[i], h[i - 2]) - min(h[i], h[i - 2]));
    }

    OUT(dp[n - 1]);

    return 0;
}


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

#define rep(i, from, to) for (int i = from; i < to; ++i)
#define REP(i, from, to) for (int i = from; i <= to; ++i)
using namespace std;

typedef pair<int, int> P;

int data[9][9];
queue<P> que;
int dx[] = {-1, 0,1, 0};
int dy[] = {0, -1, 0, 1};
int x, y;
int datax, datay, endC;

void pData(int p[9][9]) {
	REP(i, 1, datay) {
		REP(j, 1, datax) {
			cout << p[i][j] << " ";
		}
		cout << endl;
	}
}
void copy(int p1[9][9], int p2[9][9]) {
	REP(i, 1, 8) {
		REP(j, 1, 8) {
			p1[i][j] = p2[i][j];
		}
	}
}

int countColor(int masu[9][9]) {
	bool isGone[9][9];
	REP(i, 1, 8) {
		REP(j, 1, 8) {
			isGone[i][j] = false;
		}
	}
	int num = 1;
	P p = P(1, 1);
	que.push(p);
	isGone[1][1] = true;
	while(!que.empty()) {
		p = que.front();
		que.pop();
		y = p.first; x = p.second;
		rep(i, 0, 4) {
			int tmpy = y + dy[i];
			int tmpx = x + dx[i];
			if (tmpy < 1 || tmpy > datay || tmpx < 1 || tmpx > datax) {
				continue;
			}
			if (masu[tmpy][tmpx] == endC && !isGone[tmpy][tmpx]) {
				isGone[tmpy][tmpx] = true;
				que.push(make_pair(tmpy, tmpx));
				++num;
			}
		}
	}
	return num;
}

void nuruColor(int masu[9][9], int c) {
	int now = masu[1][1];
	bool isGone[9][9];
	REP(i, 1, 8) {
		REP(j, 1, 8) {
			isGone[i][j] = false;
		}
	}
	isGone[1][1] = true;
	masu[1][1] = c;
	P p = P(1, 1);
	que.push(p);
	while(!que.empty()) {
		p = que.front();
		que.pop();
		y = p.first; x = p.second;
		rep(i, 0, 4) {
			int tmpy = y + dy[i];
			int tmpx = x + dx[i];
			if (tmpy < 1 || tmpy > datay || tmpx < 1 || tmpx > datax) {
				continue;
			}
			if (masu[tmpy][tmpx] == now && !isGone[tmpy][tmpx]) {
				isGone[tmpy][tmpx] = true;
				masu[tmpy][tmpx] = c;
				que.push(make_pair(tmpy, tmpx));
			}
		}
	}
}	

int data1[9][9], data2[9][9], data3[9][9], data4[9][9], data5[9][9];
void solve() {
	while(true) {
		int ans = -1;
		cin >> datay >> datax >> endC;
		if (datay == 0 && datax == 0 && endC == 0) return;

		REP(i, 1, datay) {
			REP(j, 1, datax) {
				cin >> data[i][j];
			}
		}
		REP(i, 1, 6) {
			copy(data1, data);
			//pData(data1);
			nuruColor(data1, i);
			//pData(data1);
			REP(i2, 1, 6) {
				copy(data2, data1);
				nuruColor(data2, i2);
				//pData(data2);
				REP(i3, 1, 6) {
					copy(data3, data2);
					nuruColor(data3, i3);
					//pData(data3);
					REP(i4, 1, 6) {
						copy(data4, data3);
						nuruColor(data4, i4);
						//pData(data4);

						copy(data5, data4);
						nuruColor(data5, endC);
						int tmp = countColor(data5);
						//if (ans < tmp) {
							//pData(data5);
							//cout << endl;
						//}
						ans = max(ans, tmp);
						//pData(data5);
					}
				}
			}
		}
		cout << ans << endl;
	}
}
void test() {
	rep(i, 0, 2) {
		datay = 1;datax = 1;
		endC = 5;
		REP(i, 1, datay) {
			REP(j, 1, datax) {
				cin >> data[i][j];
			}
		}
		nuruColor(data, 5);
		pData(data);
		cout << countColor(data) << endl;
	}
}

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

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

int main()
{
    int l,r,m;
    cin>>l>>r>>m;
    int cnt=0;
    for(int i=l;i<=r;i++)
    {
        if(i%m==0)cnt++;
    }

    cout<<cnt<<endl;
}


Measured memory_bytes: 3600
#include<stdio.h>

#define big(a,b) ((a)<(b)?(a):(b))
 
int main(){
	int n,i,ashu[2][100001]={{0}},tmp,ans=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&tmp);
		ashu[i%2][tmp]++;
	}
	int max[2][2]={{0,0},{0,0}};
	for(i=0;i<=100000;i++){
		if(ashu[0][max[0][0]]<ashu[0][i]){
			max[0][1]=max[0][0];
			max[0][0]=i;
		}else if(ashu[0][max[0][1]]<ashu[0][i]){
          			max[0][1]=i;
		}
		if(ashu[1][max[1][0]]<ashu[1][i]){
			max[1][1]=max[1][0];
          			max[1][0]=i;
		}else if(ashu[1][max[1][1]]<ashu[1][i]){
			max[1][1]=i;
		}
   	}
	if(max[0][0]!=max[1][0])ans=n-ashu[0][max[0][0]]-ashu[1][max[1][0]];
	else {
		ans=big(n-ashu[0][max[0][0]]-ashu[1][max[1][1]],n-ashu[0][max[0][1]]-ashu[1][max[1][0]]);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 896
n,m = map(int,input().split())
para = [int(input()) for i in range(m)]
mod = 10**9+7


dp = [-1]*(n+1)
dp[0] = 1
for i in para :
    dp[i] = 0
import sys
sys.setrecursionlimit(200000)
def dps(cnt,cantvisit):
    if cnt == n + 1 :
        return 

    else :
        if cnt == 1 :
            if cnt in cantvisit :
                dp[1] = 0
                cnt += 1
            else : 
                dp[1] = 1
                cnt += 1
        else :
            if dp[cnt] != 0 :  
                dp[cnt] = (dp[cnt-1] + dp[cnt-2]) % mod
                cnt += 1
            else :
                cnt += 1
        return dps(cnt,cantvisit)

dps(1,para)
print("{}".format(dp[-1]%mod))

Measured memory_bytes: 93760
#E 復習
N = list(input())
N = [int(n) for n in N]
N.insert(0, 0)
len_N = len(N)
ans = 0

for i in reversed(range(len_N)):
    num = int(N[i])
    if num == 10:
        N[i-1] += 1
    #他の人の回答をみて、足りなかったのはここの処理。なぜ必要なのか調べる。
    elif num==5:
        if int(N[i-1])>=5:
            ans += 5
            N[i-1] += 1
        else:
            ans += 5
    ###################################
    elif num >5:
        ans += (10-num)
        N[i-1] += 1
    else:
        ans += num

print(ans)

Measured memory_bytes: 21484
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,ll>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif
ll gcd (ll x, ll y) { return y ? gcd(y,x%y) : x; }

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  sort(all(a));
  if (k > a[n-1]) {
    cout << "IMPOSSIBLE\n"; 
    return 0;
  }
  ll gcdint = a[n-1];
  rep(i,n-1) {
    gcdint = gcd(gcdint, a[i]);
  }
  if (k % gcdint == 0) cout << "POSSIBLE\n";
  else cout << "IMPOSSIBLE\n"; 
  return 0;
}

Measured memory_bytes: 1024
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int[] a = new int[n+1];
		for (int i = 1; i < a.length; i++) {
			a[i] = parseInt(sc.next());
		}
		sc.close();
		a[0] = 10001;
		int cnt=0;
		int doshoku=0;
		for (int i = 1; i < a.length; i++) {
			if(a[i-1]==a[i]) {
				doshoku++;
			} else {
				cnt+=doshoku/2;
				doshoku=1;
			}
		}
		cnt+=doshoku/2;
		out.println(cnt);
	}
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
int temp;
string s;
bool a[27]; 
int main()
{
    cin>>s;
    for(int i=0;i<=s.length()-1;i++)
      if(s[i]<='z'&&s[i]>='a'&&a[s[i]-96]==0)
        {
            a[s[i]-96]=1;
            temp++;
        }
    if(temp==26)
      {
        cout<<"None"<<endl;
        return 0;
      }
    for(int i=1;i<=26;i++)
      if(a[i]==0)
        {
          cout<<char(i+96)<<endl;
          return 0;
        }
    return 0;
}

Measured memory_bytes: 512
#[macro_export]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    input!{
      n: i32,
      m: i32
  }
 
 println!("{} {}", n*m , 2*(m+n));
}


Measured memory_bytes: 5032
n = int(input())
s = input()
st=0
m=0
lv = 0
for x in s:
    if x == '(':
        lv+=1
    else:
        lv-=1
    m=min(m,lv)
gl=lv-m
st-=m
print('('*st+s+')'*gl)



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

int s[100001];

int binarySearch(int p, int t)
{
    int leftid = 0;
    int rightid = p-1;
    int midid;
    while (leftid <= rightid)
    {
        midid = (leftid + rightid) / 2;
        if (s[midid] == t) return 1;
        else if ( s[midid] < t ) leftid = midid+1;
        else if ( s[midid] > t ) rightid = midid-1;
    }
    return -1;
    
}

int main()
{
    int pindex, qindex;
    // int s[100001];
    int t;
    int sum = 0;

    cin >> pindex;

    for (int i = 0; i < pindex; i++)
    {
        cin >> s[i];
    }

    cin >> qindex;

    for (int j = 0; j < qindex; j++)
    {
        cin >> t;
        // check
        // if (linearsearch(pindex, s, t) == 1)
        if (binarySearch(pindex, t) == 1)
        {
            sum += 1;
        }      

    }
    cout << sum << endl;

    return 0;
    
}


Measured memory_bytes: 3468
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
int a[10],b[111];
int main()
{
	int s=0;
	for(int i=1;i<=3;i++)
	{
		cin>>a[i];
		b[a[i]]++;
	}
	for(int i=0;i<=111;i++)
	{
		if(b[i]>0)
		{
			s++;
		}
	}
	cout<<s;
}

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

int main() {
  int d;
  cin >> d;
  if (d == 25) cout << "Christmas" << endl;
  else if (d == 24) cout << "Christmas Eve" << endl;
  else if (d == 23) cout << "Christmas Eve Eve" << endl;
  else if (d == 22) cout << "Christmas Eve Eve Eve" << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x real()
#define y imag()
using namespace std;
typedef complex <double> point;
typedef vector <int> V;
string str[101];
vector <point> G[101];
V node[101];
map <string,V> M;
int n,ans;

double dot(point a,point b){return a.x*b.x+a.y*b.y;}
double cross(point a,point b){return a.x*b.y-a.y*b.x;}

int ccw(point a,point b,point c){
  point d = b-a;
  point e = c-a;
  if(cross(d,e)>0) return 1;
  if(cross(d,e)<0) return -1;
  if(dot(d,e)<0) return 2;
  if(abs(d) < abs(e)) return -2;
  return 0;
}


bool intersection(point a,point b,point c,point d){
  if(!(ccw(a,b,c)*ccw(a,b,d)<=0&&ccw(c,d,a)*ccw(c,d,b)<=0))return 0;
  if(abs(ccw(a,b,c))==1||abs(ccw(a,b,d))==1)return 0;
  double AB=abs(a-b)+abs(c-d);
  double D=max(abs(a-c),abs(a-d));
  D=max(D,max(abs(b-c),abs(b-d)));
  if(AB==D) return 0;
  return 1;
}

void mk_node(){
  for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++){
      if(str[i]==str[j])continue;
      int is=G[i].size(),js=G[j].size();
      for(int k=0;k<is;k++)
	for(int l=0;l<js;l++){
	  point a=G[i][k],b=G[i][(k+1)%is];
	  point c=G[j][l],d=G[j][(l+1)%js];
	  if((intersection(a,b,c,d)))node[i].push_back(j),k=is,l=js;
	}
    }
  for(int i=0;i<n;i++) M[str[i]].push_back(i);
}


int col[101];
void check(){
  int c=0;
  for(int i=0;i<n;i++){
    c=max(c,col[i]);
    for(int j=0;j<node[i].size();j++)
      if(col[i]==col[node[i][j]])return;
  }
  ans=min(ans,c);
}

void nxp(map<string,V>::iterator it,int c){
  if(it==M.end()){
    check();
    return ;
  }
  V a=it->second;
  for(int i=0;i<=c;i++){
    for(int j=0;j<a.size();j++)col[a[j]]=i;
    nxp(++it,max(c,i+1));
    it--;
  }
  	 }


int main(){
  while(cin>>n,n){
    M.clear();
    ans=10;
    for(int i=0;i<n;i++) G[i].clear(),node[i].clear();

    for(int i=0;i<n;i++){
      cin>>str[i];
      while(1){
	int a,b;
	cin>>a;
	if(a==-1) break;
	cin>>b;
	G[i].push_back(point(a,b));
      }
    }

    mk_node();
    nxp(M.begin(),0);
    cout <<ans+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 1296
#include<cstdio>

int city,road;
int a[55],b[55];
int flag[55];

int main()
{
	scanf("%d %d",&city,&road);
	for(int i = 1;i <= road;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	for(int i = 1; i <= road; i++){
		flag[a[i]] ++;
		flag[b[i]] ++;
	}
	for(int i = 1; i <= city;i++){
		printf("%d\n",flag[i]);
	}
	return 0;
}

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

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

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    int N;
    cin >> N;
    int X[N];
    int Y[N];
    int xmin,ymin,xmax,ymax;
    xmin = ymin = INF;
    xmax = ymax = -INF;
    rep(i,N) {
        int x, y;
        cin >> x >> y;
        X[i] = x;
        Y[i] = y;
        xmin = min(xmin,x);
        ymin = min(ymin,y);
        xmax = max(xmax,x);
        ymax = max(ymax,y);
    }
    int ans = 0;
    if (ymin==ymax) {
        ans = xmax-xmin;
    }
    else if (xmax==xmin) {
        ans = ymax-ymin;
    }
    else {
        int xm,ym;
        xm = (xmax+xmin)/2;
        ym = (ymax+ymin)/2;
        vector<int> dst(4,0);
        rep(i,N) {
            int idx = 0;
            if (X[i]<xm && Y[i]<ym) idx=0;
            else if(X[i]>=xm && Y[i]<ym) idx=1;
            else if (X[i]<xm && Y[i]>=ym) idx=2;
            else idx=3;
            int d = abs(X[i]-xm) + abs(Y[i]-ym);
            dst[idx] = max(dst[idx],d);
        }
        ans = max(ans, dst[0]+dst[3]);
        ans = max(ans, dst[1]+dst[2]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 5172
#include <stdio.h>

int main(void) {
  int a,b,c,k;
  a=0;
  b=0;
  c=0;
  k=0;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  scanf("%d",&k);
  c=k-(a+b);
if(k<=a)
{
    printf("%d",k);
}
else if(k<=a+b)
{
    printf("%d",a);
}
else
{
    printf("%d",a-c);
}
  
  return 0;
}

Measured memory_bytes: 1716
#include <vector>
#include <iostream>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;

int main() {
    int n,k ;
    cin >> n >> k ;
    ll a[n];
    for(int i=0;i<n;i++) cin >> a[i] ;

    ll tmp = 1 ;
    int cnt = k ;
    int idx = k-1 ;
    while (cnt)
    {
        tmp*= a[idx] ;
        cnt-- ;
        idx-- ;
    }

    for(int i=k;i<n;i++){
        ll tmp2 = 0 ;
        ll tmp3 = 0 ;
        int idx = i ;
        //while (cnt)
        //{
        //    tmp2*= a[idx] ;
        //    tmp2/= a[idx-k] ;
        tmp2 = a[idx] ;
        tmp3 = a[idx-k] ;

        //    cnt-- ;
        //    idx-- ;
        //}
        if(tmp2<=tmp3){
            cout << "No" << endl ;
        }else{
            cout << "Yes" << endl ;
        }
           //cout << tmp << endl ;    
           //cout << tmp2 << endl ;    

       // tmp =  tmp2 ;
    }
    return 0 ;
}


Measured memory_bytes: 5144
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 50;

long long aa[N];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++)
		cin >> aa[i];
	long long ans = 0;
	while (true) {
		long long sum = 0;
		for (int i = 0; i < n; i++) {
			long long cnt = aa[i] / n;
			sum += cnt;
		}
		if (sum == 0) {
			cout << ans << '\n';
			return 0;
		}
		ans += sum;
		for (int i = 0; i < n; i++) {
			long long cnt = aa[i] / n;
			aa[i] = aa[i] % n + sum - cnt;
		}
	}
	return 0;
}


Measured memory_bytes: 3640
#include<stdio.h>
int main(){
    long long n;
    scanf("%lld",&n);
    if(n==0){
        puts("0");
        return 0;
    }
    int k=(n>0)?-1:1;
    long long ans=0;
    int d=0;
    if(n<0)n=-n;
    while(1){
        long long tmp=((long long)1)<<d;
        //printf("n=%d\n",n);
        //printf("%d %lld, %lld\n",k,tmp,n%(tmp<<1));
        if(n==(long long)-k*tmp){
            ans+=tmp;
            break;
        }
        if((n%(tmp<<1))!=0){
            ans+=tmp;
            n+=k*tmp;
        }
        k=-k;
        d++;
    }
    long long anstmp=ans;
    int digit=0;
    while(anstmp){
        //printf("anstmp=%d\n",anstmp);
        digit++;
        anstmp/=2;
    }
    while(digit){
        printf("%d",(ans>>(digit-1))%2);
        digit--;
    }
    return 0;
}


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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;

class Prime {
private:
    VI _pv;

public:
    Prime(int n) {
        if(n < 2) return;
        _pv.push_back(2);
        FOR(i, 3, n) {
            for(auto p : _pv) {
                if(i % p == 0) break;
                if(p == _pv.back() or p > sqrt(i)) {
                    _pv.push_back(i);
                    break;
                }
            }
        }
    }

    int operator[] (int i) {
        return _pv[i];
    }

    int size() {
        return (int)_pv.size();
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    Prime prime(100);

    VI prime_cnt(prime.size(), 0);
    FOR(i, 1, n) {
        int tmp = i;
        REP(j, prime.size()) {
            while(tmp % prime[j] == 0) {
                tmp /= prime[j];
                prime_cnt[j]++;
            }
        }
    }

    int over2 = 0;
    int over4 = 0;
    int over14 = 0;
    int over24 = 0;
    int over74 = 0;
    REP(i, prime_cnt.size()) {
        if(prime_cnt[i] >= 2) over2++;
        if(prime_cnt[i] >= 4) over4++;
        if(prime_cnt[i] >= 14) over14++;
        if(prime_cnt[i] >= 24) over24++;
        if(prime_cnt[i] >= 74) over74++;
    }

    int ans = over4 * (over4 - 1) / 2 * max(over2 - 2, 0);
    ans += over14 * max(over4 - 1, 0);
    ans += over24 * max(over2 - 1, 0);
    ans += over74;
    cout << ans << ln;
    return 0;
}


Measured memory_bytes: 256
using System;

public class AtCoder{
	public static void Main(){
		string[] s;
		s = NextS();
		
		int n, l;
		n = int.Parse(s[0]);
		l = int.Parse(s[1]);
		s = NextS();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) a[i] = int.Parse(s[i]);
		
		int ans = -1;
		for(int i=0; i<n-1; i++) if(a[i] + a[i+1] >= l) ans = i;
		if(ans > -1) Console.WriteLine("Possible");
		else{
		    Console.WriteLine("Impossible");
		    return;
		}
		int c = 0;
		while(c != ans){
		    Console.WriteLine(c + 1);
		    c++;
		}
		c = n-2;
		while(c != ans){
		    Console.WriteLine(c + 1);
		    c--;
		}
		Console.WriteLine(ans + 1);
	}

	public static void DebugWL(object x){ System.Diagnostics.Debug.WriteLine(x); }
	public static string[] NextS(){ return Console.ReadLine().Trim().Split(' '); }
}


Measured memory_bytes: 26972
// 2020-08-09 21:00:00
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<ll, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

pair<ll, int> f(string s) {
  auto pos = s.find('.');
  if(pos == string::npos) {
    return make_pair(stoll(s), 0);
  }
  s.replace(pos, 1, "");
  return make_pair(stoll(s), s.size() - pos);
}

using T = tuple<int, int, int>;
map<T, int> mp;
void answer() {
  int n;
  cin >> n;
  rep(i, n) {
    string s;
    cin >> s;
    ll a;
    int b;
    tie(a, b) = f(s);
    while(a % 10 == 0) {
      a /= 10;
      b--;
    }
    int two = 0, five = 0;
    while(a % 2 == 0) {
      a /= 2;
      two++;
    }
    while(a % 5 == 0) {
      a /= 5;
      five++;
    }
    mp[T(b, two, five)]++;
  }
  ll ans = 0;
  for(const auto& m1 : mp) {
    int zero1, two1, five1;
    tie(zero1, two1, five1) = m1.first;
    for(const auto& m2 : mp) {
      int zero2, two2, five2;
      tie(zero2, two2, five2) = m2.first;
      if(zero1+zero2 <= max(min(two1, five2), min(two2, five1))) {
        if(m1 == m2) {
          ans += 1ll * m1.second * (m1.second-1);
        } else {
          ans += 1ll * m1.second * m2.second;
        }
      }
    }
  }
  cout << ans/2 << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3608
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls int
#define give main()
const int mod = 1000000007;
#pragma endregion
const int N = 200005;

ll n, d, a, aa, bb, ans, loc=1;
lll arr[N];
set<pair<lll, ll>> s;

ll fw[N], fw2[N];
void update(int x, int y, ll v) { //inclusive
    for (int tx=x; tx < N; tx += tx&(-tx)) fw[tx] += v, fw2[tx] -= v*(x-1);
    for (int ty=y+1; ty < N; ty += ty&(-ty)) fw[ty] -= v, fw2[ty] += v*y; 
}
ll sum (int x) {
    ll res = 0;
    for (int tx=x; tx; tx -= tx&(-tx)) res += fw[tx]*x + fw2[tx];
    return res;
}
ll range_sum(int x, int y) { //inclusive
    return sum(y)-sum(x-1);
}

ll point(int x) {
    return range_sum(x, x);
}

pls give {
    AC;
    cin >> n >> d >> a;
    for (int i=0; i<n; i++) {
        cin >> aa >> bb;
        arr[i] = {aa, bb};
        // s.insert({{aa, i+1}, ceil((double)bb/a)});
    }
    sort(arr, arr+n);
    for (int i=0; i<n; i++) {
       s.insert({{arr[i].first, i+1}, ceil((double)arr[i].second/a)}); 
    }
    for (auto i : s) {
        if (i.second <= point(i.first.second)) continue;
        auto it = s.upper_bound({{i.first.first + 2*d, 1000000000}, 1000000005});
        --it;
        ans += i.second-point(i.first.second);
        update(i.first.second, (*it).first.second, i.second-point(i.first.second));
    }
    cout << ans;
    
}

Measured memory_bytes: 19072
#include <type_traits>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
namespace loquat {
template <typename T, typename F>
auto binary_search(T l, T r, F&& less)
	-> typename std::enable_if<std::is_integral<T>::value, T>::type
{
	while(l < r){
		const auto c = l + (r - l) / 2;
		if(less(c)){
			l = c + 1;
		}else{
			r = c;
		}
	}
	return l;
}
}
using namespace std;
using ll = long long;
static ll solve(ll a, ll b){
	const ll limit =
		loquat::binary_search(1ll, a, [&](ll c){
			return ((a * b + c - 1) / c - 1) > b;
		});
	const ll t =
		loquat::binary_search(1ll, limit, [&](ll c){
			const auto x = __int128_t(a) * b * (c + 1);
			const auto y = __int128_t(a) * b * c;
			return x > (y + (c * (c + 1)));
		});
	return (t - 1) + max(min(limit - t, ((a * b + t - 1) / t - 1) - b), 0ll);
}
int main(){
	ios_base::sync_with_stdio(false);
	int q;
	cin >> q;
	while(q--){
		ll a, b;
		cin >> a >> b;
		const ll answer = solve(a, b) + solve(b, a);
		cout << answer << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    h=list(map(int,input().split()))
    for i in range(10**7):
        c=-1
        for j,x in enumerate(h):
            if c==-1 and x!=0:
                c=j
            elif c!=-1 and x==0:
                break
        else:
            j+=1
        if c==-1:
            print(i)
            exit()
        for k in range(c,j):
            h[k]-=1

if __name__ == '__main__':
    main()


Measured memory_bytes: 40432
#include<stdio.h>

int main(void) {
   int H, W, i, j, k;

   for(i=1;;i++){
     scanf("%d %d", &H, &W);
     if(H ==0 && W ==0) break;
     for(j=1;j<=H;j++){
       for(k=1;k<=W;k++){
         if(j%2 == 1 && k%2 == 1) printf("#");
         else if(j%2 == 0 && k%2 == 0) printf("#");
         else printf(".");
       }
       printf("\n");
     }
     printf("\n");
   }
   return 0;
}



Measured memory_bytes: 2688
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

a, b = map(int, input().split())
if a == b:
    print(0)
else:
    if (a + b) % 2 == 0:
        print((a + b) // 2)
    else:
        print('IMPOSSIBLE')


Measured memory_bytes: 7876
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

int		main(void)
{
	int n;
	cin >> n;
	string S;
	cin >> S;

	int ans =1;
	int f = S[0];
	for (int i = 0; i < n; ++i)
	{
		if (S[i] != f)
			++ans;
		f = S[i];
	}
	cout << ans << endl;
}



Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
using namespace std;
typedef long long LL;
typedef double ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
const int INF=1<<30;
LL answer;
LL gcd(LL a,LL b){
	if(b==0) return 0;
	if(a<b) return gcd(b,a);
	LL nums=a/b;
	answer+=b*nums;
	return gcd(b,a%b);
}
int main(){

	LL N,X;
	cin >> N >> X;
	gcd(N-X,X);
	cout << answer*3 << endl;
	return 0;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
c=max(int(100*a/8),10*b)
d=min(int(100*a/8+100/8),10*b+10)
f=0
for x in range(c,d+1):
    if f==0 and int(x*0.08)==a and int(x*0.1)==b:
        f=1
        print(x)
if f==0:
    print(-1)

    


Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-8;

long double a = 25.0;
long double b = 26.0;
long double c = 1.0;

long long seek(long long Ntemp){

    long double X = a*( (long double)  Ntemp ) + b ;

    return (long long) ceil( log10(X)/log10(b) - c );
}

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

    string S;

    long long n = seek(N);
    N = N - ( (long long) ( pow(b, ((long double) n) ) - b + eps ) /a );

    //cout << "N n " << N << " " << n << endl;

    // # S is n characters

    long long ntemp = n;

    for(int i=0; i<n; i++){
        ntemp = ntemp - 1;
        long long A = (long long) ( pow( b, (long double) (ntemp) ) + eps );
        int ctmp = (int) ( (N-1)/A );

        char ctmp2 = 'a' + ctmp;

        S.push_back(ctmp2);
        
        //cout << "i ntemp  A ctmp N S " << i << " " << ntemp << " " << A << " " << ctmp << " " << N << " " << S << endl; 
        N = N - ( (long long) ctmp )*A;
    }

    cout << S << endl;

    return 0;
}

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

using namespace std;

#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int n, a[100000];

int solve(bool flag, int cnt, int now) {
    FOR(i, 1, n) {
        if(flag) {
            if(a[i] + now >= 0 ) {
                cnt += a[i] + now + 1;
                now -= a[i] + now + 1;
            }
            flag = false;
        }
        else {
            if(a[i] + now <= 0) {
                cnt += abs(a[i] + now) + 1;
                now += abs(a[i] + now) + 1;
            }
            flag = true;
        }
    }
    return cnt;
}

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

    cin >> n;
    rep(i, n) cin >> a[i];
    FOR(i, 1, n) a[i] += a[i - 1];
    int cnt = 0, now = 0, res = 0;
    if(a[0] != 0) {
        if(a[0] < 0) now += abs(a[0]) + 1;
        else now += -a[0] - 1;
        cnt = abs(a[0]) + 1;
        bool flag = (a[0] < 0) ? true : false;
        res = solve(flag, cnt, now);
        cnt = now = 0;
        flag = (a[0] > 0) ? true : false;
        chmin(res, solve(flag, cnt, now));
    }
    else {
        cnt = now = 1;
        bool flag = true;
        res = solve(flag, cnt, now);
        now = -1;
        flag = false;
        chmin(res, solve(flag, cnt, now));
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, AB, CD):
    ans = 0
    AB.sort(key=lambda x: x[0], reverse=True)
    for a, b in AB:
        CD.sort(key=lambda x: x[1])
        idx = 0
        while idx < len(CD):
            c, d = CD[idx]
            if a < c and b < d:
                break
            idx += 1
        else:
            continue
        ans += 1
        del CD[idx]
    print(ans)


if __name__ == '__main__':
    input = sys.stdin.readline
    N = int(input())
    AB = [tuple(map(int, input().split())) for _ in range(N)]
    CD = [tuple(map(int, input().split())) for _ in range(N)]
    main(N, AB, CD)


Measured memory_bytes: 67792
//@formatter:off
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<P>
#define vvp vector<vector<P>>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?"":","); return os<<']'; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << '\n'; }
void YES(bool b) { cout << (b ? "YES" : "NO") << '\n'; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;
//@formatter:on

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int d, t, s;
    cin >> d >> t >> s;
    Yes(s * t >= d);
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define loop(i,a,n) for (int i = (a); (i) < (n); ++ (i))
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF (int)1e9
#define MOD 0
//#define int ll
using namespace std;
typedef vector<long long> vl;

signed main() {
  string S;
  int n;
  cin >> S;
  n = S.size();
  int count = 0;
  cin.tie(0);
  ios::sync_with_stdio(false);
  rep(i,n) {
    if(S[i] == 'o') count++;
  }
  count += 15 - n;
  if(count >= 8) puts("YES");
  else puts("NO");
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    char str[20 + 1],str2[20 + 1];
    int i,len = 0;

    gets(str);

    for(i=0;str[i]!='\0';i++)
        len++;

    for(i=0;str[i]!='\0';i++)
    {
        str2[i] = str[len - 1 - i];
    }

    str2[i] = '\0';

    puts(str2);


    return 0;
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N, M; cin >> N >> M;
    vector<ll> A(N); rep(i, N) cin >> A[i];
    sort(A.rbegin(), A.rend());
    ll ok = 0, ng = LLINF;
    ll m = (ok+ng)/2;
    while(abs(ok-ng) > 1){
        //mを超えるような握手は何通りあるか
        ll res = 0;
        rep(i, N){
            ll key = m-A[i];
            ll left = -1, right = N;
            ll mid = (left+right)/2;
            while(abs(left-right) > 1){
                if(A[mid] >= key) left = mid;
                else right = mid;
                mid = (left+right)/2;
            }
            res += left+1;
        }
        if(res >= M) ok = m;
        else ng = m;
        m = (ok+ng)/2;
    }
    //ok*M + はみ出し分が答え
    ll ans = ok*M;
    vector<ll> ruiseki(N+1, 0);
    rep(i, N) ruiseki[i+1] = ruiseki[i] + A[i];
    rep(i, N){
        //A[i]+A[j] >= ok -> A[i]+A[j]-okを足す
        ll key = ok-A[i]; //key=5で[7,7,6,5,5,4,...]のときはruiseki[5]-key*5を足す
        ll left = -1, right = N;
        ll mid = (left+right)/2;
        while(abs(left-right) > 1){
            if(A[mid] >= key) left = mid;
            else right = mid;
            mid = (left+right)/2;
        }
        ans += ruiseki[left+1] - (left+1)*key;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
N, x = map(int, input().split())
a = list(map(int, input().split()))

a.sort()
happy_kid = 0
for i in range(N):
    x = x - a[i]
    if i == N - 1:
        if 0 == x:
            happy_kid += 1
    elif x >= 0:
        happy_kid += 1
    else:
        break
print(happy_kid)

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

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

    long ans = 0;
    for (int i = 1; i <= N; i++){
        if ((i % 5 !=0) and (i % 3 != 0)) ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define MOD 1000000007
#define PI (6.28318530718/2.0)
#define ft first
#define sec second
#define ll long long
#define pb push_back
using namespace std;
ll a,b,c,d;
int main()
{
	cin >> a >> b >> c >> d;
	cout << max({a*c,a*d,b*c,b*d});
}

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

f = [0] * (N+1)

for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            v = i*i + j*j + k*k + i*j + j*k + k*i
            if v <= N:
                f[v] += 1

for i in range(1, N+1):
    print(f[i])

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t n,m,l;
  cin >> n >> m >> l;
  
  int64_t a[n*m] = {};
  int64_t b[m*l] = {};
  for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
          cin >> a[m*i+j];
      }
  }
  for(int i=0;i<m;i++){
      for(int j=0;j<l;j++){
          cin >> b[l*i+j];
      }
  }
  for(int i=0;i<n;i++){
      for(int j=0;j<l;j++){
          int64_t c = 0;
          for(int k=0;k<m;k++){
              c += a[m*i+k]*b[l*k+j];
          }
          cout << c;
          if(j!=l-1) cout << " ";
      }
      cout << endl;
  }
 
  return 0;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

ll g1(ll n, int p) {
  if (n == 0) return 0;
  return n/p + g1(n/p,p);
} 
ll g2(ll n, int p) {
  if (n%2 == 1) return g1(n,p) - g2(n-1, p);
  ll res = g1(n/2,p);
  if (p == 2) res += n/2;
  return res;
}

int main () {
  ll n;
  cin >> n;
  ll ans = min(g2(n,2), g2(n,5));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(){
 int a;
 int b;
 int c;
	if(!((scanf("%d",&a)==1) 
		&& (scanf("%d",&b)==1)
	&& (scanf("%d",&c)==1))){
		return -1;
	}
 
 if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5)){
  printf("YES");
 } else {
  printf("NO");
 }
  return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			// input
			long n = in.nextLong();
			long m = in.nextLong();

			// solve
			long count = 0;
			if (n == 1 && m != 1) {
				count = (m-2);
			} else if (m == 1 && n != 1) {
				count = (n-2);
			} else if (m == 1 && n == 1) {
				count = 1;
			} else {
				count = ((m-2)*(n-2));
			}
			out.println(count);
		}

	}

	static class ArrayUtils {
		public static Map<Integer, Integer> getCountMap(int[] array) {
			Map<Integer, Integer> map = new TreeMap<>();
			for (int x : array)
				map.merge(x, 1, Integer::sum);
			return map;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 21460
#include<stdio.h>
const int N = 10000;

int main()
{
	int a[N] = {0}, n, maxn = -1000000, minn = 1000000;
	long long sum = 0;
	scanf("%d", &n);
	for (int i = 0;i < n; i++)
	{
		scanf("%d", &a[i]);
		if(a[i] > maxn)
		{
			maxn = a[i];
		}
		if(a[i] < minn)
		{
			minn = a[i];
		}
		sum += a[i];
	}
	printf("%d %d %lld\n", minn, maxn, sum);
	
	return 0;
}


Measured memory_bytes: 2800