akhauriyash/Code-Regression huggingface dataset:
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

int main(void){
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(s.substr(i, n) == t.substr(0, j + 1)){
                cout << s.size() + t.size() - (j + 1) << endl;
                return 0;
            }
        }
    }

    cout << s.size() + t.size() << endl;
}

Measured memory_bytes: 256
//Author: Lixiang
#include<stdio.h>
const int maxn=53;
const long long mod=1e9+7;
struct D{
	char s[maxn];
	int a[maxn],N,n;
	long long f[maxn];
	void init(){
		scanf("%d",&N);
		scanf("%s",s);
		for(int i=0;i<N;i++){
			if(s[i]==s[i+1]){
				a[++n]=2;
				i++;
			}
			else a[++n]=1;
		}
	}
	void work(){
		if(a[1]==1)f[1]=3;
		else f[1]=6;
		for(int i=2;i<=n;i++){
			if(a[i]==1){
				if(a[i-1]==1)f[i]=f[i-1]*2%mod;
				else f[i]=f[i-1];
			}
			else{
				if(a[i-1]==1)f[i]=f[i-1]*2%mod;
				else f[i]=f[i-1]*3%mod;
			}
		}
		printf("%lld\n",f[n]);
	}
}sol;
int main(){
	sol.init();
	sol.work();
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

ll n;
ll s[101];

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    ll sum = 0;
    vector<int> noten;
    for(int i=0;i<n;i++){
        sum += s[i];
    }
    for(int i=0;i<n;i++){
        if(s[i] % 10 != 0) noten.push_back(s[i]);
    }
    sort(noten.begin(), noten.end());
    if(sum % 10 == 0){
        if(noten.empty()) sum = 0;
        else sum -= noten[0];
    }
    cout << sum << endl;
    return 0;
}

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

int main(){
    int a,b;
    int cnt=0;
    int m[16]={0};
    while(scanf("%d%d",&a,&b),a,b){
        int ro[32][32]={{0}};
        ro[0][1]=1;
        int n;
        scanf("%d",&n);
        int x,y;
        for(int i=0;i<n;i++){
            scanf("%d%d",&x,&y);
            ro[y][x]=1;
        }
        for(int i=1;i<=b;i++){
            for(int j=1;j<=a;j++){
                if(ro[i][j]==1)ro[i][j]=0;
                else ro[i][j]=(ro[i-1][j]+ro[i][j-1]);
            }
        }
        m[cnt]=ro[b][a];
        cnt++;
    }
    for(int i=0;i<cnt;i++){
        printf("%d\n",m[i]);
    }
    return 0;
}

Measured memory_bytes: 1192
#include<stdio.h>
int main(void)
{
	int i,n,m=0,x=0;
	char a[101];
	scanf("%d",&n);
	scanf("%s",a);
	for(i=0;i<n;i++){
		if(a[i]=='D'){
			m--;
		}
		else if(a[i]=='I'){
			m++;
		}
		if(x<m){
			x=m;
		}
	}
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
main(){
  int n,k;
  int num[100005]={0};
  int left[100005]={0};
  int right[100005]={0};
  int cnt[100005]={0};
  int bunkatu=0;
  while(cin>>n>>k,n||k){
    memset(left,-1,sizeof(left));
    memset(right,-1,sizeof(right));
    memset(cnt,0,sizeof(cnt));
    int a;
    for(int i=0;i<k;i++){
      cin>>num[i];
    }
    sort(num,num+k);
    if(num[0]==0){
      int maxs=1;
      int now=1;
      bunkatu=1;
      left[1]=num[1];
      for(int i=2;i<k;i++){
	if(num[i-1]+1==num[i]){
	  now++;
	}
	else{
	  right[bunkatu]=num[i-1];
	  cnt[bunkatu]=now;
	  now=1;
	  bunkatu++;
	  left[bunkatu]=num[i];
	}
	maxs=max(maxs,now);
      }
      //cout<<bunkatu<<endl;
      right[bunkatu]=num[k-1];
      cnt[bunkatu]=now;
      cnt[0]=cnt[bunkatu+1]=0;
      /*
      for(int i=0;i<=bunkatu+1;i++){
	cout<<cnt[i]<<" "<<left[i]<<" "<<right[i]<<endl;
      }
      */
      if(num[0]==0){
	maxs=max(maxs,cnt[0]+1);
	for(int i=0;i<=bunkatu;i++){
	  if(left[i]){
	    maxs=max(maxs,cnt[i]+1+cnt[i+1]);
	  }
	}	
      }
      cout<<maxs<<endl;
    }
    else{
      int maxs=1;
      int now=1;
      for(int i=1;i<k;i++){
	if(num[i-1]+1==num[i]){
	  now++;
	}
	else{
	  cnt[bunkatu]=now;
	  now=1;
	}
	maxs=max(maxs,now);
      }
      cout<<maxs<<endl;
    }
  }
}

Measured memory_bytes: 2744
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 N, M, C;
  cin >> N >> M >> C;
  vector<i64> l(C);
  for (i64 i = 0; i < C; i++)
    cin >> l[i];
  vector<pair<i64, i64>> b(N);
  for (i64 i = 0; i < N; i++)
  {
    cin >> b[i].second >> b[i].first;
    b[i].second--;
  }
  sort(b.rbegin(), b.rend());
  i64 ans = 0, cnt = 0;
  for (pair<i64, i64> i : b)
  {
    if (0 < l[i.second])
    {
      ans += i.first;
      l[i.second]--;
      cnt++;
    }
    if (M <= cnt)
      break;
  }
  cout << ans << endl;
  return 0;
}



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

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

		while(true){
			final int w = sc.nextInt();
			final int d = sc.nextInt();
			
			if(w == 0 && d == 0){
				break;
			}
			
			int[] wh = new int[21];
			int[] dh = new int[21];
			
			for(int i = 0; i < w; i++){
				wh[sc.nextInt()]++;
			}
			
			for(int i = 0; i < d; i++){
				dh[sc.nextInt()]++;
			}
			
			int cost = 0;
			for(int i = 0; i <= 20; i++){
				int dup = Math.min(wh[i], dh[i]);
				
				cost += dup * i;
				cost += (wh[i] - dup) * i;
				cost += (dh[i] - dup) * i;
			}
			
			System.out.println(cost);
		}
		
	}

}

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

int main(){
  int n;
  cin >> n;
  if(n<11||n==12||n==14||n==15||n==16||n==18||n==20||n==21
    ||n==24||n==25||n==27||n==28||n==30||n==32||n==35||n==36
    ||n==40||n==42||n==45||n==48||n==49||n==54||n==56||n==63
     ||n==64||n==72||n==81){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

typedef long long ll;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
	int x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("E.in", "r", stdin);
	freopen ("E.out", "w", stdout);
#endif
}

const int N = 1e5 + 1e3;

int n, l[N], r[N], len[N];

ll tl, tr, ans;

priority_queue<ll> L;
priority_queue<ll, vector<ll>, greater<ll>> R;

int main () {

	File();

	For (i, 1, n = read()) 
		l[i] = read(), r[i] = read(), len[i] = r[i] - l[i];

	L.push(r[1]); R.push(r[1]);
	For (i, 2, n) {
		tl -= len[i - 1]; tr += len[i];
		ll lp = L.top() + tl, rp = R.top() + tr;
		if (lp <= r[i] && r[i] <= rp) 
			L.push(r[i] - tl), R.push(r[i] - tr);
		else if (r[i] >= rp) {
			ans += r[i] - rp; R.pop(); L.push(rp - tl);
			R.push(r[i] - tr); R.push(r[i] - tr);
		} else {
			ans += lp - r[i]; L.pop(); R.push(lp - tr);
			L.push(r[i] - tl); L.push(r[i] - tl);
		}
	}
	printf ("%lld\n", ans);

	return 0;

}

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <string>
#include <bitset>

int main()
{
    int N;
    std::cin >> N;
    std::string s;
    std::cin >> s;

    std::vector<bool> sheep(N);
    bool valid = false;
    for(int i=0; i<4; i++){
        std::bitset<2> bit(i);
        sheep[0] = bit[0]; sheep[1] = bit[1];

        for(int i=1; i<N-1; i++){
            bool b = (s[i]=='o');
            b ^= sheep[i];
            sheep[i+1] = sheep[i-1] ^ b;
        }

        // for(int i=0; i<N; i++){
        // if(sheep[i] == true) printf("S");
        // else printf("W");
        // }
        // printf("\n");

        bool b1 = (s[N-1]=='o');
        bool b2 = (s[0]=='o');
        b1 ^= sheep[N-1];
        b2 ^= sheep[0];
        if((sheep[0]^sheep[N-2]) == b1 && (sheep[N-1]^sheep[1]) == b2){
            valid = true; break;
        }
    }

    if(valid == false){printf("-1\n"); return 0;}
    for(int i=0; i<N; i++){
        if(sheep[i] == true) printf("S");
        else printf("W");
    }
    printf("\n");
}

Measured memory_bytes: 512
from collections import namedtuple

Task = namedtuple('Task', 'name time')

class Queue:
    def __init__(self, n):
        self.n = n
        self._l = [None for _ in range(self.n + 1)]
        self._head = 0
        self._tail = 0

    def enqueue(self, x):
        self._l[self._tail] = x
        self._tail += 1
        if self._tail > self.n:
            self._tail -= self.n

    def dequeue(self):
        if self.isEmpty():
            raise IndexError("pop from empty queue")
        else:
            e = self._l[self._head]
            self._l[self._head] = None
            self._head += 1
            if self._head > self.n:
                self._head -= self.n
            return e

    def isEmpty(self):
        return self._head == self._tail

    def isFull(self):
        return self._tail == self.n

if __name__ == '__main__':
    n, q = map(int, input().split())
    queue = Queue(n+1)
    for _ in range(n):
        name, time = input().split()
        time = int(time)
        queue.enqueue(Task(name=name, time=time))

    now = 0
    while not queue.isEmpty():
        task = queue.dequeue()
        t = task.time
        if t <= q:
            now += t
            print(task.name, now)
        else:
            now += q
            queue.enqueue(Task(task.name, t - q))



Measured memory_bytes: 13188
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
using namespace std;
char c;
int a,b;
int main()
{
    cin>>a>>c>>b;
    if(c=='+')
    cout<<a+b<<endl;
    else
    cout<<a-b<<endl;
    return 0;
}

Measured memory_bytes: 256
import copy
class SegmentTree(object):
    __slots__ = ['sz','func','I','seg']
    def __init__(self, N, func, I):
        self.sz = N
        self.func = copy.deepcopy(func)
        self.I = I
        self.seg = [I for i in range(self.sz * 2)]
 
    def assign(self, k, x):
        self.seg[k + self.sz] = x
 
    def build(self):
        for i in range(self.sz - 1, 0, -1):
            self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])
 
    def update(self, k, x):
        k += self.sz
        self.seg[k] = x
        while k > 1:
            k //= 2
            self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])
 
    def query(self, a, b):
        L = self.I
        R = self.I
        a += self.sz
        b += self.sz
        while a < b:
            if a % 2 == 1:
                L = self.func(L, self.seg[a])
                a += 1
            if b % 2 == 1:
                b -= 1
                R = self.func(self.seg[b], R)
            a //= 2
            b //= 2
        return self.func(L, R)

def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    from fractions import gcd
    N = int(readline())
    m = map(int,read().split())
    seg = SegmentTree(N , gcd , 0)
    for i in range(N):
        seg.assign(i , next(m))
    seg.build()
    ans = 1
    for i in range(N):
        ans = max(ans,gcd(seg.query(0,i) , seg.query(i+1,N)))
    print(ans)

main()


Measured memory_bytes: 82340
arr = []
count = 0
n = gets
arr = gets.chomp.split.map(&:to_i)

(arr.length - 1).times do |i|
  j = arr.length - 1
  i += 1
  while j > 0
    if(arr[j] < arr[j-1])
      tmp = arr[j]
      arr[j] = arr[j-1]
      arr[j-1] = tmp
      count += 1
    end
    j -= 1
  end
end
puts arr.join(' ')
puts count


Measured memory_bytes: 6880
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define wi(t) int t;cin>>t;while(t--)
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];
ll int gcd(ll int a, ll int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
int tc=1;
void solve()
    { 
        string s,t;
        cin>>s>>t;
        int ans=INT_MAX;
        string temp=s.substr(0,t.size());
        int c=0;
       
        for(int i=0;i<t.size();i++)
        {
            if(temp[i]!=t[i])
            c++;
        }
        ans=min(ans,c);
        for(int i=t.size();i<s.size();i++)
        {
            temp.erase(temp.begin());
            temp.push_back(s[i]);
            c=0;
            for(int j=0;j<t.size();j++)
        {
            if(temp[j]!=t[j])
            c++;
        }
        ans=min(ans,c);
        }
        cout<<ans<<"\n";
    }

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    //wi(t)
    {
      solve();
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
    int i, u, v;
    while(m--){
        cin>>u>>v;
    u--, v--;
        g[u].pb(v);
        g[v].pb(u);
    }
}

void dfs(int u, int par){
    for(int v:g[u]){
        if (v == par) continue;
        dfs(v, u);
    }
}







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

using namespace std;

int n, check[1111111];

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

	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int temp;
		cin >> temp;
		check[temp]++;
	}

	for (int i = 1; i <= n; i++) {
		cout << check[i] << '\n';
	}

	return 0;
}


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

typedef long long LL;
const int N = 1005, mod = 1000000007;

int n, m; LL k;
std::string s[N];

int pow(int x, int y, int ans = 1) {
	for (; y; y >>= 1, x = (LL) x * x % mod)
		if (y & 1) ans = (LL) ans * x % mod;
	return ans;
}

int solve(int a, int b, int v, int k) {
	int q = pow(v, mod - 2, a);
	return pow(v, k - 1, (v + (LL) (mod - b) * pow(mod + 1 - q, mod - 2, mod + 1 - pow(q, k)) % mod));
}

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n >> m >> k, k %= mod - 1;
	if (k <= 1) return std::cout << "1\n", 0;
	for (int i = 0; i < n; ++i)
		std::cin >> s[i], std::for_each(s[i].begin(), s[i].end(), [] (char &x) { x = x == '#'; });
	int aH = 0, aV = 0, bH = 0, bV = 0, v = 0;
	for (int i = 0; i < n; ++i)
		v += std::count(s[i].begin(), s[i].end(), 1);
	for (int i = 0; i < n; ++i) aH += s[i][0] && s[i][m - 1];
	for (int i = 0; i < m; ++i) aV += s[0][i] && s[n - 1][i];
	if (aH && aV) return std::cout << "1\n", 0;
	if (!aH && !aV) return std::cout << pow(v, k - 1) << '\n', 0;
	for (int i = 0; i < n; ++i)
		for (int j = 1; j < m; ++j) bH += s[i][j - 1] && s[i][j];
	for (int i = 1; i < n; ++i)
		for (int j = 0; j < m; ++j) bV += s[i - 1][j] && s[i][j];
	if (!aH) std::swap(aH, aV), std::swap(bH, bV);
	std::cout << solve(aH, bH, v, k - 1) << '\n';
	return 0;
}

Measured memory_bytes: 1280
n = int(input())
w = list(map(int, input().split()))
p = [0 for i in range(n)]
p[0] = w[0]
for i in range(1, n):
    p[i] = p[i-1] + w[i]
diff = float('inf')
for j in range(n):
    cd = abs(p[n-1] - (2*p[j]))
    diff = min(diff, cd)
print(diff)

Measured memory_bytes: 9132
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;

int main(){
    int A,B;
    cin >> A >> B;
    if(A+B==3){
        cout << "3" << endl;
    }
    else if(A+B==4){
        cout << "2" << endl;
    }
    else{
        cout << "1" << endl;
    }
}

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

#define int long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

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

bool solve(int a, int b, int c, int d)
{
  if(a < b or d < b) return false;

  if(c < b){
    int g = gcd(b, d);
    int ma = (b-a%g+g-1)/g*g+a%g-g;
    if(ma > c) return false;
  }

  return true;
}

signed main()
{
  int t;
  cin >> t;
  while(t--){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    cout << (solve(a, b, c, d) ? "Yes" : "No") << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
A1 = l()
A2 = l()
ans = 0
for i in range(N):
    ans = max(ans,sum(A1[:i+1])+sum(A2[i:]))
print(ans)

Measured memory_bytes: 5052
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n = I()
    print(180*(n-2))
    return

#B
def B():
    s = S()
    res = 15-len(s)
    k = s.count("o")
    if k+res >= 8:
        print("YES")
    else:
        print("NO")
    return

#C
def C():
    n = I()
    return

#D
def D():
    n = I()
    return

#E
def E():
    n = I()
    return

#F
def F():
    n = I()
    return

#Solve
if __name__ == "__main__":
    B()


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

int main(){
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  reverse(s.begin(),s.end());
  int p = 0;
  vector<int> ans;
  while(true) {
    if(n - p <= m) {
      ans.push_back(n-p);
      break;
    } else {
      if(s[p+m] == '0') {
        ans.push_back(m);
        p += m;
      } else {
        int t = p+m-1;
        while(s[t] == '1' && t > p) {
          t--;
        }
        if(t == p) {
          cout << -1 << endl;
          return 0;
        } else {
          ans.push_back(t-p);
          p = t;
        } 
      }
    }
  }
  reverse(ans.begin(),ans.end());
  for(auto k : ans) cout << k << " ";
  cout << endl;
  return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a;
  cin >> a;
  int count = 0;
  for(int i = 0; i < 3; i ++){
    if(a.at(i) == '1'){
      count ++;
    }
  }
  cout << count <<endl;
}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

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

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

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    string s;
    cin>>s;

    if(s=="AAA" || s=="BBB")flag=false;
    else flag=true;

    //cout <<fixed<<setprecision(16)<< << endl;
    
    //cout<<ans<<endl;
    
    if(flag)cout << "Yes" <<endl;
    else cout << "No" <<endl;
    
    return 0;
}


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

bool prime(int n) {
    if (n == 2) return true;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return true;
}

void prime_fac(int n) {
    printf("%d:", n);
    int m = n;
    for (int i = 2; i * i <= n; i++) {
        while (m % i == 0) {
            printf(" %d", i);
            m /= i;
        }
    }
    if (m != 1) printf(" %d", m);
    printf("\n");
}

int main() {
    int n;
    scanf("%d", &n);
    // rep(i, n) {
    //     if (i < 2) continue;
    //     prime_fac(i);
    // }
    prime_fac(n);
}


Measured memory_bytes: 3216
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>
#include <fstream>
#include <ctime>

using namespace std;
using ll = long long;

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) { return toupper(c); }
};

struct ToLower {
    char operator()(char c) { return tolower(c); }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string S;
    cin >> S;

    string T = "AKIHABARA";
    int len = T.length();

    REP(i, len) {
        if (i > S.length())break;
        if (S[i] != T[i] && T[i] == 'A') {
            S.insert(S.begin() + i, T[i]);
        }
    }

    YESNO(S == T, "YES", "NO");
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] S = in.next().toCharArray();
        int count = 0;
        long answer = 0;
        for (int i = 0; i < S.length; i++) {
            if (S[i] == 'W') {
                answer += i - count;
                count++;
            }
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 27532
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
int solve()
{
	string s;
    cin >> s;
    if(s.length() == 6)
    {
        if ((s[2]==s[3])&&(s[4]==s[5]))
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}
int main()
{
    /* #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #else
    #endif */
    solve();
    /* #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: "<<1.0*clock()/ CLOCKS_PER_SEC<<" Sec\n";
    #endif */
    return 0;
} 

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

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++)  cin >> v[i];
    sort(v.rbegin(), v.rend());
    multiset<int> add, sub;
    if(v[0] < 0){
        add.insert(v[0]);
        for(int i = 1; i < n; i++)  sub.insert(v[i]);
    }else if(v[n-1] >= 0){
        sub.insert(v[n-1]);
        for(int i = 0; i < n-1; i++)    add.insert(v[i]);
    }else{
        int i = 0;
        while(v[i] >= 0)    add.insert(v[i++]);
        while(i < n)        sub.insert(v[i++]);
    }
    vector<int> a, b;
    int val;
    while(a.size() != n-1){
        if(sub.size() >= add.size()){
            auto ait = --add.end(), bit = sub.begin();
            int x = *ait, y = *bit;
            add.erase(ait), sub.erase(bit);
            a.push_back(x), b.push_back(y);
            add.insert(x-y);
            val = x-y;
        }else{
            auto ait = --add.end(), bit = sub.begin();
            int x = *ait, y = *bit;
            add.erase(ait), sub.erase(bit);
            a.push_back(y), b.push_back(x);
            sub.insert(y-x);
            val = y-x;
        }
    }
    
    cout << val << endl;
    for(int i = 0; i < n-1; i++)    cout << a[i] << " " << b[i] << endl;

    return 0;
}

Measured memory_bytes: 7040
N = int(input())
count = [0] *4
hyoka_li = ['AC','WA','TLE','RE']
for _ in range(N):
  hyoka = input()
  if hyoka == hyoka_li[0]:count[0] += 1
  elif hyoka == hyoka_li[1]:count[1] += 1
  elif hyoka == hyoka_li[2]:count[2] += 1
  else:count[3] += 1
for i in range(4):
	print('{} x {}'.format(hyoka_li[i],count[i]))

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

#define FOR(i, j, k) for(int i=j ; i<k ; i++)
#define REP(i, j) FOR(i, 0, j)
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main() {

    string s; cin >> s;

    if (s[0] != 'A') { cout << "WA" << endl; return 0; }
    int lc = 0;
    REP(i, s.size()) {
        if (i == 0) continue;

        if ( 2 <= i && i <= s.size() - 2 ) {
            if (s[i] == 'C') lc++;
        }
        if (s[i] != 'C' && !islower(s[i])) {cout << "WA" << endl; return 0;}
    }

    if (lc == 1) cout << "AC" << endl;
    else cout << "WA" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using ull = unsigned long long;
using ll = long long;
using namespace std;

int main(void) {

    int n;
    cin >> n;
    vector<string> d(n);
    int top_b = 0, bottom_a =0, both = 0;
    for (int i = 0; i < n; ++i) {   

        cin >> d[i];
        bool tb = false, ba = false;

        // printf("input: %s\n", d[i].c_str());

        if (d[i][0] == 'B') {
            tb = true;
        }
        if (d[i][d[i].size()-1] == 'A') {
            ba = true;
        }

        // printf("bottom_a:%d,top_b%d\n", ba, tb);

        if (tb && ba) {
            both++;
        } else if (tb) {
            top_b++;
        } else if (ba) {
            bottom_a++;
        }
    }

    int ord = 0;
    for (auto& s: d) {
        for (int i = 0; i < s.size()-1; ++i) {
            if (s[i] == 'A' && s[i+1] == 'B') {
                ord++;
            }
        }
    }
    int comb = 0;
    if (both == 0) {
        comb = min(bottom_a, top_b);
    } else {
        if (bottom_a + top_b == 0) {
            comb = both - 1;
        } else {
            comb = both + min(bottom_a, top_b);
        }
    }

    cout << ord + comb << endl;

    return 0;
}

Measured memory_bytes: 3712
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> menu(m);
    REP(i, n){
        int k;
        cin >> k;
        REP(j, k){
            int a;
            cin >> a;
            menu[a - 1]++;
        }
    }
    int ans = 0;
    REP(i, m){
        if (menu[i] == n) ans++;
    }
    cout << ans << "\n";
}


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

int main() {
    vector<int> A(5), P = { 0, 1, 2, 3, 4 };
    for (int i = 0; i < 5; i++) cin >> A.at(i);

    int fans = 1e5;
    do {
        int ans = 0;
        for (int i = 0; i < 5; i++) {
            while (ans % 10 != 0) ans++;
            ans += A.at(P.at(i));
        }
        fans = min(fans, ans);
    } while (next_permutation(P.begin(), P.end()));
    cout << fans << endl;
}

Measured memory_bytes: 3608
#include <stdio.h>
int main(){
    int a,b,c,i,count=0;
    scanf("%d%d%d", &a,&b,&c);
    for (i = a; i <= b; i++){
        if (c%i == 0){
            count++;
        }
    }
    printf("%d\n", count);
}

Measured memory_bytes: 2732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/

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

    ll A,B;
    cin >> A >> B;

    cout << A * B / gcd(A,B) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
typedef long long ll; 
const int N = 2e5+5;

int main()
{	
	char k;
	scanf("%c",&k);
	if(k >= 'a' && k <= 'z') printf("a");
	else printf("A"); 
	return 0;
} 

Measured memory_bytes: 3760
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {

		int H = nextInt();
		int W = nextInt();
		int N =nextInt();
		int[] a = nextInts();

		int d=1;
		int h=0;
		int w=0;
		int idx=0;
		int[][] x = new int[H][W];
		while(h<H){
			while(w>=0&&w<W){
				if(a[idx]!=0){
					x[h][w]=idx+1;
					a[idx]--;
					w+=d;
				}else{
					idx++;
				}
			}
			d*=-1;
			w+=d;
			h++;
		}

		for(h=0;h<H;h++){
			StringBuffer sb = new StringBuffer();
			for(w=0;w<W;w++){
				sb.append(x[h][w]);
				sb.append(" ");
			}
			sb.deleteCharAt(sb.length()-1);
			System.out.println(sb.toString());
		}

	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 22356
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<sys/time.h>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
inline int ri()
{
	register int x=0;register bool f=0;register char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=1;ch=getchar();}
	while(ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=getchar();};
	return f?-x:x;
}
void wi(int x)
{
	if(x<0)	x=-x,putchar('-');
	if(x>9)	wi(x/10);
	putchar('0'+x%10);
}
const int N=1005;
ll a[N],q[N],vis[N];
int main()
{
	ll mx=-1e9-7,n=ri(),i,s1=0,s2=0,id=0,st=0,nxt,j;
	for(i=1;i<=n;i++)
	{
		a[i]=ri();
		if(mx<a[i])
		{
			mx=a[i];
			id=i;
		}
		if(i&1)	s1+=a[i]>0?a[i]:0;
		else 	s2+=a[i]>0?a[i]:0;
	}
	if(s1<=0&&s2<=0)
	{
		printf("%lld\n%lld\n",mx,n-1);
		for(i=n;i>id;i--)	printf("%lld\n",i);
		for(i=1;i<id;i++)	printf("%lld\n",1);
		return 0;
	}
	if(s1>s2)	id=1,printf("%lld\n",s1);
	else	id=0,printf("%lld\n",s2);
	for(i=1;i<=n;i++)
	{
		if((i&1)==id&&a[i]>0)	vis[i]=1;
		if(!st&&vis[i])	st=i;
	}
	for(i=n;i>=1;i--)
	{
		if(vis[i])	break;
		q[++q[0]]=i;
	}
	for(;i!=st;i=nxt)
	{
		if(vis[i-2])
		{
			q[++q[0]]=i-1;
			nxt=i-2;
		}
		else
		{
			for(j=i-2;!vis[j];j-=2)	q[++q[0]]=j;
			q[++q[0]]=j+1;
			nxt=j;
		}
	}
	for(i--;i>=1;i--)	q[++q[0]]=1;
	printf("%lld\n",q[0]);
	for(i=1;i<=q[0];i++)
		printf("%lld\n",q[i]);
	return 0;
}


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

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

void solve(){
  int n;
  cin >> n;
  vector<int> a;
  rep(i,n) {
    int k;
    cin >> k;
    a.emplace_back(k);
  }
  int minuscount = 0;
  rep(i,n){
    if(a[i]<0) minuscount++; 
  }
  long long ans=0;
  if(minuscount % 2 ==0) {
    rep(i,n){
       ans += max(a[i], -a[i]);
    }
  }
  else {
    int minimum = max(a[0], -a[0]);
    for(int i=1; i<n; i++){
      minimum = min(minimum, max(a[i], -a[i])); 
    }
    rep(i,n){
      ans += max(a[i], -a[i]);
    }
    ans -= 2*minimum;
  }
  cout << ans << endl;
}

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


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

int ABS(int a){
	return a >= 0 ? a : -a;
}

int main(){
	int N, i, T, D;
	scanf("%d", &N);
	int *t = (int *)malloc(sizeof(int) * (N + 1));
	int *x = (int *)malloc(sizeof(int) * (N + 1));
	int *y = (int *)malloc(sizeof(int) * (N + 1));
	t[0] = 0;
	x[0] = 0;
	y[0] = 0;
	for(i = 1; i <= N; i++){
		scanf("%d%d%d", &t[i], &x[i], &y[i]);
	}
	for(i = 1; i <= N; i++){
		T = t[i] - t[i - 1];
		D = ABS(x[i] - x[i - 1]) + ABS(y[i] - y[i - 1]);
		if(T < D || (T - D) % 2 != 0){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
int main() {
  int a, b;
  vector<int> ab(3);
  cin >> a >> b;
  ab[0] = a+b;
  ab[1] = a-b;
  ab[2] = a*b;
  auto ans = max_element(ALL(ab));
  cout << *ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std; 
typedef long long ll;
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=n/2,j=i+1,k=1;k<=m;k++,i--,j++){
		if(n%2==0&&(j-i==n/2||j-i==n/2+1))j++;
		cout<<i<<' '<<j<<endl;
	}
	return 0;
}

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

int main(){
    string s;
    string a = "CODEFESTIVAL2016";
    cin >> s;
    int k = 0;
    for(int i = 0; i<16; i++){
        if(s[i] != a[i]) k++;
    }
    cout << k << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

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

mod = int(10**9+7) #出力の制限

def cmb(n, r, mod=mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

NN = 5*10**5 # 使うデータによって変える
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, NN + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


dic = {}
for i, a in enumerate(A):
    if not a in dic.keys():
        dic[a] = i
    else:
        l, r = dic[a], i
        break

ans = [0]*(N+2)

for k in range(N):
    nCk = cmb(N-1, k)
    ans[k] = (ans[k] + nCk) % mod
    ans[k+1] = (ans[k+1] + 2*nCk - cmb(N-r+l, k)) % mod
    ans[k+2] = (ans[k+2] + nCk) % mod

for k in range(1, N+2):
    print(ans[k])


Measured memory_bytes: 81476
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        x: usize,
    }
    let mut table = vec![true; 2 * x];
    for i in 2..x {
        for j in (i..2 * x).step_by(i) {
            table[j] = false;
        }
    }
    println!("{}", (x..2 * x).find(|i| table[*i]).unwrap());
}


Measured memory_bytes: 2268
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;
#define SZ 666666
int n,M=0,fst[SZ],vb[SZ],nxt[SZ];
void ad_de(int a,int b)
{
	++M; nxt[M]=fst[a]; fst[a]=M; vb[M]=b;
}
void adde(int a,int b)
{
	ad_de(a,b);ad_de(b,a);
}
int md[SZ],mu[SZ],fa[SZ];
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
void dfs(int x,int f=0)
{
	fa[x]=f;
	for esb(x,e,b) if(b!=f)
	{
		dfs(b,x); md[x]=max(md[x],md[b]);
	}
	++md[x];
}
typedef long long ll;
char c[SZ];
bool q[SZ],h[SZ],zs[SZ]; int dfn[SZ],C=0,ls[SZ];
void dfs2(int x,int f=0)
{
	int cm=mu[x]+1; dfn[x]=++C;
	if(c[x]=='1') q[C]=h[C]=zs[x]=1;
	vector<int> vs;
	for esb(x,e,b) if(b!=f) vs.push_back(b);
	for(int i=0;i<vs.size();++i)
	{
		int v=vs[i];
		mu[v]=max(mu[v],cm);
		cm=max(cm,md[v]+2);
	}
	cm=mu[x]+1;
	for(int i=int(vs.size())-1;i>=0;--i)
	{
		int v=vs[i];
		mu[v]=max(mu[v],cm);
		cm=max(cm,md[v]+2);
	}
	vs.clear();
	for esb(x,e,b) if(b!=f)
		dfs2(b,x),zs[x]|=zs[b];
	ls[x]=C;
}
int dd[SZ],uu[SZ];
void doit(int x)
{
	vector<int> v;
	v.push_back(mu[x]-1);
	for esb(x,e,b) if(b!=fa[x]) v.push_back(md[b]);
	sort(v.begin(),v.end());
	int p=v[v.size()-1]-1;
	if(v.size()>1) p=min(p,v[v.size()-2]+1);
	else p=min(p,1);
	dd[x]=p; uu[x]=1e9; if(c[x]=='1') uu[x]=0;
	for esb(x,e,b) if(b!=fa[x]) if(zs[b]) uu[x]=min(uu[x],md[b]);
	if(q[dfn[x]-1]||h[ls[x]+1]) uu[x]=min(uu[x],mu[x]-1);
}
int main()
{
	scanf("%d",&n);
	for(int i=1,a,b;i<n;++i)
		scanf("%d%d",&a,&b),adde(a,b);
	scanf("%s",c+1); dfs(1); mu[1]=1; dfs2(1);
	for(int i=1;i<=C;++i) q[i]|=q[i-1];
	for(int i=C;i>=1;--i) h[i]|=h[i+1];
	ll ans=1;
	for(int i=1;i<=n;++i)
		doit(i), ans+=max(dd[i]-uu[i]+1,0);
	printf("%lld\n",ans);
}

Measured memory_bytes: 44928
#include <iostream>

using namespace std ;

long long int arr[60] ;

int main()
{
    long long int k ;

    cin >> k ;

    // vorodi
    if (k == 0) {
        cout << 2 << endl;
        cout << 1 << " " << 1;
        return 0;
    }

    for(int i = 0 ; i < 50 ; i++)
        arr[i] = i ;

    for(int i = 0 ; i < 50 ; i++)
        arr[i] += (k) / 50 ;

    if (k % 50 != 0) {
        for(int i = 0 ; i < k % 50 ; i++)
        {
            arr[i] += 50 ;

            for(int j = 0 ; j < 50 ; j++)
                if(j != i)
                    arr[j]-- ;
        }
    }

    cout << 50 << endl ;
    for(int i = 0 ; i < 50 ; i++)
        cout << arr[i] << " " ;

    cout << endl ;
	return 0 ;
}


Measured memory_bytes: 256
A,B=map(int,input().split())
S=input()
judge=True
for i in range(A):
    if not S[i].isdecimal():
        judge=False
if S[A]!="-":
    judge=False
for i in range(B):
    if not S[A+1+i].isdecimal():
        judge=False
if judge==True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		boolean[] is1 = new boolean[N];
		boolean[] isN = new boolean[N];
		for(int i = 0; i < M; i++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(a == 1) is1[b] = true;
			if(b == 1) is1[a] = true;
			if(a == N) isN[b] = true;
			if(b == N) isN[a] = true;
		}
		int i;
		for(i = 2; i < N; i++){
			if(is1[i]){
				if(isN[i]){
					System.out.println("POSSIBLE");
					break;
				}
			}
		}
		if(i == N){
			System.out.println("IMPOSSIBLE");
		}
	}
}

Measured memory_bytes: 93992
#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;

int a[300000];
int b[300000];
int main() {
  int n,m;
  cin>>n>>m;
  int k=0;
  for(int i=0;i<m;i++)
  {
    int t1,t2;
    cin>>t1>>t2;
    if(t1>t2)swap(t1,t2);
    if(t1==1)b[k++]=t2;
    if(t2==n)a[t1]=1;
  }
  for(int i=0;i<k;i++)
  {
  if(a[b[i]]){cout<<"POSSIBLE"<<endl;return 0;}}
  cout<<"IMPOSSIBLE"<<endl;
  return 0;
 
  }

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
#define EPS 0.00001
#define print for(int i=0; i < N; i++) cout << used[i] << " "; cout << endl;
  
double len(double* coord1, double* coord2){
  double res = 0;
  for(int i=0;  i< 3; i++){
    res += (coord1[i] - coord2[i]) * (coord1[i] - coord2[i]);
  }
  return res;
}
  
  
int comb(int vertex){
  vertex--;
  return (vertex * (1 + vertex))/2;
  
  
  //int res = 0;
  //for(int i=vertex; i > 1; i--){
  //  int d = 2, n = 1;
  //  for(int j = i-1; j > 1; j--){
  //    n *= j;
  //  }
  //  res += n;
  //}
  //return res;
}
  
bool used[30];
double ans = 0;
int N, M;
double lenlist[30][30];
double coord[30][3];
  
void func(int i){
  if(i == M){
    vector<int> cho;
    int idx = 0;
    double l = 0;
    for(int i=0; i < N; i++){
      if(used[i]) cho.push_back(i);
    }
  
    for(int i=0; i < cho.size(); i++){
      for(int j=i+1; j < cho.size(); j++){
        l += len(coord[cho[i]], coord[cho[j]]);
      }
    }
    ans = max(ans, l);
    return;
  }
  
  for(int k=0; k < N; k++){
    if(used[k] == true) break;
    used[k] = true;
    func(i+1);
    used[k] = false;
  }
}
  
int main(void){
  for(int i=0; i < 30; i++) for(int j=0; j < 30; j++) lenlist[i][j] = 0;
  cin >> N >> M;
  for(int i=0; i < N; i++){
    for(int j=0; j < 3; j++){
      cin >> coord[i][j];
    }
  }
  int idx = 0;
  for(int i=0; i < N; i++){
    for(int j=i+1; j < N; j++){
      lenlist[i][j] = len(coord[i], coord[j]);
    }
  }
  
  for(int i=0; i < 30; i++) used[i] = false;
  func(0);
  
  printf("%.5f\n", ans);
  //for(int i=0; i < N; i++){
  //  for(int j=i+1; j < N; j++){
  //    cout << "lenlist[" << i << "][" << j << "] = " << lenlist[i][j] << endl;
  //  }
  //}
  return 0;
}

Measured memory_bytes: 1272
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int A = sc.nextInt();
    if (X < A ) {
      System.out.println(0);
    } else {
      System.out.println(10);
    }
  }
}

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

def count(x):
    c = 0
    for i in range(1, x + 1):
        if x % i == 0:
            c += 1
    return c

ans = 0
for i in range(3, N + 1, 2):
    if count(i) == 8:
        ans += 1
print(ans)

Measured memory_bytes: 38512