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

struct FenwickTree {
    vector<int> bit;  // binary indexed tree
    int n;

    FenwickTree(int n) {
        this->n = n;
        bit.assign(n, 0);
    }

    FenwickTree(vector<int> a) : FenwickTree(a.size()) {
        for (size_t i = 0; i < a.size(); i++)
            add(i, a[i]);
    }

    int sum(int r) {
        int ret = 0;
        for (; r >= 0; r = (r & (r + 1)) - 1)
            ret += bit[r];
        return ret;
    }

    int sum(int l, int r) {
        return sum(r) - sum(l - 1);
    }

    void add(int idx, int delta) {
        for (; idx < n; idx = idx | (idx + 1))
            bit[idx] += delta;
    }
};

int main() {
	const int MAXN = 200000;
	int a[MAXN],  b[MAXN]={0};
	int n, k;
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	const int iterations = 41;
	for(int i=1;i<=min(k, iterations);i++) {
		FenwickTree t1(n), t2(n);
		for(int j=0;j<n;j++) {
			b[j] += t1.sum(j, n-1);
			t1.add(min(n-1,j+a[j]), 1);
		}
		for(int j=n-1;j>=0;j--) {
			t2.add(max(0,j-a[j]), 1);
			b[j] += t2.sum(j);
		}
		for(int j=0;j<n;j++) {
			a[j]=b[j];
			b[j]=0;
		}
	}
	for(int i=0;i<n;i++) cout<<a[i]<<" ";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 6376
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int tmp;
	int l1 = 0, l2 = 0;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		if (tmp % 2 == 0)
			l1++;
		else
			l2++;
	}
	if (l2 % 2 == 0) {
		cout << "YES" << endl;
		return 0;
	}else {
		l1 += (l2-1)/2;
		if(l1 != 0){
			cout << "NO" << endl;
			return 0;
		}else{
			cout << "YES" << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
const int MAXN = 10 + 1e6;
const ll oo = 1 + 1e18;
const ll mod = 7 + 1e9;

int x, n, a[MAXN], d[MAXN];

int main()
{
    #define TASK "ABC"
    #ifndef ONLINE_JUDGE
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
    #endif ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n;

    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        d[ a[i] ]++;
    }

    int ans = 0;

    for (int i = 1; i <= n; i++)
    {
        if (d[a[i]] > 1)
        {
            ans++;
            continue;
        }

        if (d[1])
        {
            if (a[i] != 1)
            {
                ans++;
                continue;
            }
        }

        for (int j = 2; j * j <= a[i]; j++)
        {
            if (a[i] % j == 0)
            {
                if (d[ a[i] / j ] >= 1 || d[j] >= 1)
                {
                    ans++;  // cerr << i << ' ' << a[i] << ' ' << j << ' ' << a[i] / j << '\n';
                    break;
                }
            }
        }
    }

    cout << n - ans;

    return 0;
}




















































































Measured memory_bytes: 8304
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod // i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n - r)
        return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD


# --------------------------------------------

dp = None


def main():
    N = int(input())
    A = li_input()

    print(max(A) - min(A))


main()


Measured memory_bytes: 4924
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX

typedef pair<int, int> P;
int main(){
    long long n;
    cin>>n;
    vector<long long> x(n);
    vector<long long> y(n);
    vector<long long> h(n);
    rep(i,n){
        cin>>x[i]>>y[i]>>h[i];
    }
    bool flag=1;
    rep(i,101){
        rep(j,101){
                long long p=-1;
                rep(q,n){
                    long long mx=h[q]+abs(x[q]-j)+abs(y[q]-i);
                    if(h[q]!=0 && p==-1){
                        p=mx;
                        break;
                        
                    }
                }
                flag=1;
                rep(q,n){ 
                    long long hh=max(p-abs(x[q]-j)-abs(y[q]-i),0LL);
                    if (hh!=h[q]){
                        flag=0;
                        break;
                    }
                }
                if (flag){
                    cout<<j<<" "<<i<<" "<<p<<endl;
                }
                
               
            }
           
        }
        
    }

Measured memory_bytes: 256
using System;
using System.Linq;

    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            Console.WriteLine(S.Select((s,i)=> new { I = i,S=s}).Where(g=>g.I%2==0).Select(g=>g.S).ToArray());
        }
    }

Measured memory_bytes: 13920
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		//文字列SのかかれたボールA個
		//文字列TのかかれたボールB個
		String S = sc.next();
		String T = sc.next();
		int A = sc.nextInt();
		int B = sc.nextInt();

		//文字列Uのかかれたボール
		String U = sc.next();

		//すてた文字列を判定
		if (U.contains(S)) {

			A = A - 1;

		} else if (U.contains(T)) {

			B = B - 1;
		}

		System.out.println(A + " " + B);
	}

}


Measured memory_bytes: 21204
#include<bits/stdc++.h>
#define ll long long
using namespace std;

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

    //good luck kittu!
    int n, p;
    string s; cin>>n>>p>>s;
    ll ans = 0;
    if(p==2 || p==5){
        for(int i = 0; i<n; i++){
            if((s[i]-'0')%p==0) ans+=i+1;
        }
    }
    else{
        map<int, int> m;
        m[0]++;
        ll po = 1, sum = 0;
        for(int i = n-1; i>=0; i--){
            sum = (sum+(s[i]-'0')*po)%p;
            ans += m[sum];
            m[sum]++;
            po = (10*po)%p;
        }
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 916
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
n  = int(input())
#  = map(int, input().split())
a  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

ans_ = 0
for i, a_ in enumerate(a):
    if a[a_-1] == i + 1: 
        ans_ += 1
print(ans_ // 2)


Measured memory_bytes: 14196
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<int, int> qii;
typedef pair<int, int> pii;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//最小公倍数を返す関数
int mcd(int n) {
	return 0;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


int main() {
	string temp;
	int ans = 0;
	cin >> temp;
	repz (i,3)if(temp[i] == '1') ans++;

	cout << ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <map>

using namespace std;

int main()
{
  int const xs[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  map<int, int> m[11];
  for( int i=0; i<1024; ++i ) {
    int n = 0;
    array<int, 10> t;
    for( int j=0; j<10; ++j ) {
      if ( i & 1 << j ) {
        t[n++] = xs[j];
      }
    }
    do {
      int sum = 0;
      for( int j=0; j<n; ++j )
        sum += ( j + 1 ) * t[j];
      ++m[n][sum];
    } while( next_permutation( t.data(), t.data() + n ) );
  }


  int n, s;
  while( cin >> n >> s ) {
    cout << m[n][s] << endl;
  }
}

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

int main() {
  int N;
  string S;
  string Result="Three";
  cin >> N;
  
  rep(i, N){
    cin >> S;
    if (S == "Y"){
      Result = "Four";
      break;
    }
  }
  cout << Result << endl;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int h,w,n;
signed main(){
    cin>>h>>w>>n;
    int m=max(h,w);
    cout<<(n-1)/m+1<<endl;
    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    int ans = 0;
    vector<vector<int>> s(1100, vector<int>(2));
    for(int i = 0; i < n; i++){
        cin >> s.at(i).at(0) >> s.at(i).at(1);
        ans += s.at(i).at(1) - s.at(i).at(0) + 1;
    }


    cout << ans << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = [input() for x in range(N)]
B = [input() for x in range(M)]
c = []
for i in range(N-M+1):
    for j in range(N-M+1):
        a = []
        for y in range(M):
            a += [A[j+y][i:i+M]]
        c += [a]
print('Yes' if sum(1 for x in c if x == B)>0 else 'No')

Measured memory_bytes: 4596
n, m, x, y = list(map(int, input().split()))

xi = list(map(int,input().split()))
yi = list(map(int,input().split()))
xi.append(x)
yi.append(y)
xi.sort()
yi.sort()

if xi[-1] < yi[0]:
    print("No War")
else:
    print("War")

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main() {
long double n, k;
  cin >> n >> k;
  long double result = 0;
  int i, j;
  for (i = 1; i <= n; i++) {
    for (j = 0; ; j++) {
      if (i * pow(2, j) >= k) {
        result += 1 / pow(2, j) / n;
        break;
      }
    }
  }
  cout << setprecision(11) << result << endl;
  return 0;
}


Measured memory_bytes: 256
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY


#====UnionFindTree====
class UnionFindTree
    attr_accessor:parent,:size,:rank,:group
    def initialize(n)
        @parent=Array.new(n){|idx| idx}
        @rank=Array.new(n,0)
        @size=Array.new(n,1)
    end

    def find(x)
        return x if @parent[x]==x
        @parent[x]=find(@parent[x])
        return @parent[x]
    end

    def union(x,y)
        par_x=find(x)
        par_y=find(y)
        return if par_x==par_y
        if @rank[par_x]<@rank[par_y]
            @parent[par_x]=par_y
            @size[par_y]+=@size[par_x]
        else
            @parent[par_y]=par_x
            @size[par_x]+=@size[par_y]
            @rank[par_x]+=1 if @rank[par_x]==@rank[par_y]
        end
    end

    def same?(x,y)
        return find(x)==find(y)
    end

    def get_size(x)
        return @size[find(x)]
    end
    def make_groups()
      n=@parent.size
      @group=Array.new(n){ Array.new }
      @parent.each_with_index do|par,i|
        @group[find(par)]<< i
      end
    end
end


N,M=get_i
uft=UnionFindTree.new(N)
M.times do|i|
  a,b=get_i.map{|x| x-=1}
  uft.union(a,b)
end
uft.make_groups
ans=0
N.times do|i|
    ans+=1 unless uft.group[i]==[]
end
puts ans-1

Measured memory_bytes: 23924
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<random>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

#define FOR(i,a,b) for(long long i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(long long i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)
#define int long long

using namespace std;
typedef pair<int, int> pii;

int n,a[3][100010]={0};
int dp[3][100010]={0};

signed main() {
	cin>>n;
    rep(i,n){
        cin>>a[0][i]>>a[1][i]>>a[2][i];
    }
    rep(i,n){
        dp[0][i+1]=max(dp[1][i],dp[2][i])+a[0][i];
        dp[1][i+1]=max(dp[0][i],dp[2][i])+a[1][i];
        dp[2][i+1]=max(dp[0][i],dp[1][i])+a[2][i];
    }

    int ans=-1;
    rep(i,3){
        ans=max(ans,dp[i][n]);
    }
	
    cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    int n;
    cin>>n;
    ll num[n+1];
    num[n]=0;
    cin>>num[0];
    for (int i = 1; i < n; ++i) {
        ll t;
        cin>>t;
        num[i]=num[i-1]+t;
    }
    sort(num,num+n+1);
    ll ans=0;
    for (int j = 0; j < n; ++j) {
        if(num[j]==num[j+1]){
            ll t=1;
            while(num[j]==num[j+1] && j<n){
                t++;
                j++;
            }
            ans+=t*(t-1)/2;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define all(var) var.begin(), var.end()
#define input freopen("input", "r", stdin)
#define output freopen("output", "w", stdout)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int const MOD = 1e9+7;
typedef long long ll;
using namespace std;
 
int main(){
    double pi = acos(-1.0);
    double r; cin >> r;
    printf("%.20lf\n", 2*pi*r);
}


Measured memory_bytes: 3784
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<long long, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;

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

  ll n; cin >> n;

  int ans = 0;
  bool nine = true;
  while (n/10 != 0) {
    if (n%10 != 9) {
      nine = false;
    }
    n /= 10;
    ans += 9;
  }
  
  ans += n%10;
  if (!nine) {
    ans--;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  vec< bool > W(31, false);
  W[A] = true;
  W[B] = true;
  FORS(i, 0, 30) {
    if (W[i]) {
      if (i + A <= 30)
        W[i + A] = true;
      if (i + B <= 30)
        W[i + B] = true;
    }
  }
  vec< bool > S(3001, false);
  S[0] = true;
  vec< int > Slis;
  FORS(i, 0, 3000) {
    if (S[i]) {
      if (i + C <= 3000)
        S[i + C] = true;
      if (i + D <= 3000)
        S[i + D] = true;
    }
  }
  FORS(i, 0, 3000) {
    if (S[i])
      Slis.pb(i);
  }
  int ans[2] = {100 * A, 0};
  double maxE = 0;

  FORS(i, 1, F / 100) {
    if (!W[i])
      continue;
    int val = E * i;
    int sug;
    REPR(j, min(F - i * 100, val)) {
      if (S[j]) {
        sug = j;
        break;
      }
    }
    //    auto itr = upper_bound(ALL(Slis), min(F - i * 100, val));
    //    int sug = *(itr - 1);
    double nodo = 100.0 * sug / (sug + 100.0 * i);

    bool f = chmax(maxE, nodo);
    if (f) {
      ans[0] = i * 100 + sug;
      ans[1] = sug;
    }
  }
  cout << ans[0] << " " << ans[1] << "\n";
}


Measured memory_bytes: 384
# 再帰関数の呼び出し回数が多くなる時はこれが必要！！無いとruntime errorになる。
import sys
sys.setrecursionlimit(100000+10)

# 木の深さ優先探索
def add_edge(u, v):
	G[u].append(v)
	G[v].append(u)

def dfs(vertex):
	global values
	global now_index

	values[vertex] = values_to_give[now_index]
	now_index -= 1

	for info in G[vertex]:
		v = info
		if values[v] >= 0: 
			#探索済み
			pass
		else:
			dfs(v)

n = int(input())
edges = [list(map(int, input().split())) for _ in range(n-1)]
values_to_give = list(map(int, input().split()))
values_to_give.sort()

G = [[] for _ in range(n)] #グラフの隣接リスト表現
for edge in edges:
	add_edge(edge[0]-1, edge[1]-1)

values = [-1] * n
# values[0] = values_to_give[n-1]
now_index = n-1

dfs(0)

mmm = list(map(str, values))
print(sum(values_to_give) - max(values_to_give))
print(" ".join(mmm))


Measured memory_bytes: 15964
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N, M;
vector<int> G[1010];
int pre[1010];

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

	int A, B;
	cin >> N >> M;
	rep(i, 0, M)
	{
		cin >> A >> B;
		A--, B--;
		G[A].push_back(B);
	}

	set<int> ans;
	int ansv = INF;
	rep(i, 0, N)
	{
		fill(pre, pre + N, -1);
		queue<int> q;
		q.push(i);
		bool ok = false;
		while (!q.empty()&&!ok)
		{
			int v = q.front();
			q.pop();
			for (auto e : G[v])
			{
				if (pre[e] != -1)continue;
				q.push(e);
				pre[e] = v;
				if (e == i)
				{
					ok = true;
				}
			}
		}

		if (!ok)continue;

		int p = i;
		set<int> res;
		res.insert(p);
		while (pre[p] != i)
		{
			p = pre[p];
			res.insert(p);
		}

		if (SZ(res) < ansv)
		{
			ansv = SZ(res);
			ans = res;
		}
	}

	if (ansv == INF)
	{
		cout << -1 << endl;
	}
	else
	{
		cout << SZ(ans) << endl;
		for (auto v : ans)
		{
			cout << v + 1 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		pattern(k);
	}
	static void pattern(int k) {
		int n = 0;
		if(k%2==0) {
			n = (k/2)*(k/2);
		}else {
			n = (k - 1)/2 * ((k - 1)/2 + 1);
		}
		System.out.println(n);
	}
}


Measured memory_bytes: 23124
S = int(input())
if S == 1:
    print(0)
    exit()
MOD = 10**9 + 7
A = [0] * (S + 1)
A[0] = 1
A[1] = 0
A[2] = 0

cumsum = 1
for i in range(3, len(A)):
    A[i] = cumsum
    cumsum += A[i - 2]
    cumsum %= MOD
print(A[-1])


Measured memory_bytes: 9148
n,m,x,y=map(int,input().split())

xsihai=list(map(int,input().split()))
ysihai=list(map(int,input().split()))

xsihai.append(x)
ysihai.append(y)


xsihai.sort()
ysihai.sort()

xmax=max(xsihai)
ymin=min(ysihai)


if xmax<ymin:
    print("No War")
else:
    print("War")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
const int p = 998244353;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    s%=p;
    if (s<0) s+=p;
    return s;
}

int sub(int a, int b) {
    int s = (a-b);
    s = s%p;
    if (s<0) s+=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

const int N = 500000;

vector<int> facs(N);
vector<int> invfacs(N);
void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[n-k], invfacs[k]));
}

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

    int n;
    cin>>n;
    vector<int> a(n);
    vector<int> b(n);
    for (int i = 0; i<n; i++) cin>>a[i];
    for (int i = 0; i<n; i++) cin>>b[i];
    for (int i = 0; i<n; i++) if (a[i]>b[i]) {cout<<-1; return 0;}
    set<pair<int, int>> s;
    for (int i = 0; i<n; i++) s.insert(mp(b[i], i));
    long long cnt = 0;
    while (!s.empty())
    {
        auto it = *prev(s.end());
        int pos = it.second;
        if (b[pos]==a[pos])
        {
            s.erase(it);
            continue;
        }
        int sum = b[(pos+n-1)%n] + b[(pos+1)%n];
        int maxx = (b[pos] - a[pos])/sum;
        if (maxx==0) {cout<<-1; return 0;}
        cnt+=maxx;
        s.erase(mp(b[pos], pos));
        b[pos]-=maxx*sum;
        s.insert(mp(b[pos], pos));
    }
    cout<<cnt;


}

Measured memory_bytes: 15104
using System;

namespace AizuOnLine
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = 0;

            while(true){
                string str = Console.ReadLine();
                if (str == "0") { break; }

                count++;
                Console.WriteLine(string.Format("Case {0}: {1}", count, str));
            }
        }
    }
}

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

using namespace std;
using ll = long long;

//constructor: LCA(graph);
template<class T> 
class LCA_weight {
private:
    int n;
    int D = 30;                        //hight
    vector<int> depth;                 //depth from root
    vector<vector<pair<int,T>>> hen;   //tree
    vector<vector<int>> par;           //doubling array
    vector<T> dista;                    //distance form root

    void dfs(int v, int p, int dep, T dep_dist) {
        par[v][0] = p;
        depth[v] = dep;
        dista[v] = dep_dist;
        for(auto i : hen[v]) {
            if(i.first == p)continue;
            dfs(i.first, v, dep + 1, dep_dist + i.second);
        }
    }

public:

    LCA_weight(const vector<vector<pair<int,T>>>& hen):hen(hen) {
        n = hen.size();
        par.resize(n, vector<int>(D + 1));
        depth.resize(n);
        dista.resize(n);

        dfs(0, -1, 0, 0);
        for(int i = 0; i < D; i++) {
            for(int j = 0; j < n; j++) {
                if(par[j][i] == -1)par[j][i + 1] = -1;
                else par[j][i + 1] = par[par[j][i]][i];
            }
        }
    }

    //go back to root
    int back(int v, int dist) {
        for(int i = 0; i < D; i++)if((1 << i) & dist) {
            if(v == -1)return v;
            v = par[v][i];
        }
        return v;
    }



    //get LCA
    int get(int u, int v) {
        int ret = 0;
        if(depth[u] > depth[v])swap(u, v);
        ret = depth[v] - depth[u];
        v = back(v, ret);
        if(u == v)return v;

        int lef = 0, rig = n;
        while(rig - lef > 1) {
            int mid = (rig + lef) / 2;
            (back(u, mid) == back(v, mid) ? rig : lef) = mid;
        }
        return back(v, rig);
    }

    //u-v path distance
    T dist(int u, int v) {
        int lca = get(u, v);
        return (dista[u] + dista[v]) - dista[lca] * 2;
    }

    //print parents
    void print(int i) {
        cerr << "[";
        for(int j = 0; j < n; j++)cerr << par[j][i] << (j == n - 1 ? "" : ",");
        cerr << "]";
    }

};

int main()
{
    int n; cin >> n;
    vector<vector<pair<int,ll>>> hen(n);
    for(int i = 0; i < n - 1; i++) {
        int a, b, c; cin >> a >> b >> c;
        a--, b--;
        hen[a].emplace_back(b, c);
        hen[b].emplace_back(a, c);
    }
    LCA_weight<ll> lca(hen);
    int q, k; cin >> q >> k;
    k--;
    while(q--) {
        int s, t; cin >> s >> t; s--, t--;
        cout << lca.dist(s, k) + lca.dist(t, k) << endl;
    }
}

Measured memory_bytes: 42864
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <set>

using namespace std;
using ll = long long;

typedef pair<ll, ll> P;

const int MOD = 1000000007;
const ll INF = 1LL << 60;


// LRUD
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
// const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
// const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

vector<vector<int> > vvi;
vector<vector<vector<int> > > vvvi;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }


int main(int argc, char**argv){
    int n;
    cin >> n;
    cout << 180 * (n - 2) << endl;


    return 0;
}





















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

int main(){

    int n,k;
    int ans=0;
    cin>>n>>k;
    int a[100]={0};
    for(int i=0;i<k;i++){
        int d;
        cin>>d;
        for(int j=0;j<d;j++){
            int x;
            cin>>x;
            a[x-1]++;
        }

    }
    for(int i=0;i<n;i++){
        if(a[i]==0) ans++;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iomanip>
#include <map>
using namespace std;


signed main(){
    int n;
    int v;
    std::cin >> n;
    std::vector<int> value_list;

    for(auto i = 0; i < n; i++){
        cin >> v;
        value_list.push_back(v);
    }

    auto min_value = std::min_element(value_list.begin(), value_list.end());
    auto max_value = std::max_element(value_list.begin(), value_list.end());
    auto sum_value = std::accumulate(value_list.begin(), value_list.end(), 0LL);
    std::cout << *min_value << " " << *max_value << " " << sum_value << std::endl;

    return 0;
}


Measured memory_bytes: 3192
def examA():
    S = SI()
    ans = "Good"
    for i in range(len(S)-1):
        if S[i+1]==S[i]:
            ans = "Bad"
    print(ans)
    return

def examB():
    N, L = LI()
    ans = 0
    if L>=0:
        for i in range(N - 1):
            ans += (L + i + 1)
    else:
        for i in range(N):
            ans += (L+i)
        if L+N-1<0:
            ans -=(L+N-1)
    print(ans)
    return

def gcd(x, y):
    if y == 0:
        return x
    while y != 0:
        x, y = y, x % y
    return x
def lcm(x, y):
    return x * y // gcd(x, y)
def examC():
    A, B, C, D = LI()
    CD = lcm(C,D)
    ans = B - (B//C + B//D - B//CD) - ((A-1) - ((A-1)//C + (A-1)//D - (A-1)//CD))
    print(ans)
    return

def examD():
    N = I()
    AB = [LI() for _ in range(N)]
    AB.sort(key=lambda x:x[1])
    cur = 0; ans = "Yes"
    for a,b in AB:
        cur +=a
        if b<cur:
            ans = "No"
            break
    print(ans)
    return

def examE():
    N, K = LI()
    maxK = (N-1)*(N-2)//2
    if K>maxK:
        print(-1)
        exit()
    ansC = []
    for i in range(1,N):
        ansC.append([1,i+1])
    k = maxK-K
    for i in range(1, N):
        if k == 0:
            break
        for j in range(i + 1, N):
            ansC.append([i+1, j+1])
            k -= 1
            if k == 0:
                break
    M = len(ansC)
    print(M)
    for v in ansC:
        print(" ".join(map(str,v)))
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examE()


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

int main()
{
	int A, B, C;

	

	cin >> A >> B>>C;


	string result = "No";

	if (A == B && B != C)result = "Yes";
	if (C == B && A != C)result = "Yes";
	if (A == C && B != C)result = "Yes";
	
	cout << result<< endl;
}



Measured memory_bytes: 256
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<cmath>
#include<iomanip>
#include<iostream>
using namespace std;

int main() {
	string s;
	cin >> s;
	int t;
	t = s[6] - '0';
	if (s[5] == '1')
		cout << "TBD" << endl;
	else if (t > 4)
		cout << "TBD" << endl;
	else
		cout << "Heisei" << endl;
}





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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> a(n, vector<int>(m));
  rep(i, n) {
    cin >> c[i];
    rep(j, m) {
      cin >> a[i][j];
    }
  }
  int ans = (int)1e9;
  rep(bit, 1 << n) {
    int cost = 0;
    vector<int> u(m, 0);
    rep(i, n) {
      if (bit & 1 << i) {
        cost += c[i];
        rep(j, m) {
          u[j] += a[i][j];
        }
      }
    }
    bool ok = true;
    rep(i, m) {
      if (u[i] < x) {
        ok = false;
        break;
      }
    }
    if (ok) ans = min(ans, cost);
  }
  if (ans == (int)1e9) {
    cout << -1 << '\n';
  } else {
    cout << ans << '\n';
  }
  return 0;
}


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

					#define mp make_pair
					#define pb push_back
					#define sqr(x) (x) * (x)
					#define sors(s) sort(s.begin(), s.end())
					#define F first
					#define S second

					using namespace std;
					typedef long long ll;
					ll n;
					int main()
					{
                      cin >> n;
                      cout << (ll)n*n*n;
					}


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

int main()
{
ll n , k ;
cin >> n >> k ;
string s ;
cin >> s ;
vector<ll> v;
ll num=0;
rep(i,n-1){
  if(s[i]!=s[i+1])num++;
}
num-=k*2;
if(num<=0)ans=n-1;
else ans=n-num-1;

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


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

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> auto operator>>(istream& in, C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, istream&>::type {
    for (auto& v : c) { in >> v; } return in; }
template<class C> auto operator<<(ostream& out, const C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, ostream&>::type {
    int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
template<class T> void trace_(const char* s, const T& v) { cerr << s << "=" << v; }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { for (; *s != ','; ++s) { cerr << *s; } cerr << "=" << v << ","; trace_(++s, vs...); }
#define TRACE(...) (cerr << "\033[2m\033[33m", trace_(#__VA_ARGS__, __VA_ARGS__), cerr << "\033[0m\n")
#else
#define TRACE(...)
#endif

int main() {
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0, j = s.size() - 1; i < j; i++, j--) {
        int lxs = 0, rxs = 0;
        for (; s[i] == 'x'; i++) lxs++;
        for (; s[j] == 'x'; j--) rxs++;
        if (s[i] != s[j]) {
            cout << -1 << '\n';
            return 0;
        }
        ans += abs(lxs - rxs);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 512
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Data.List

data Dir = Up | Down | Unknown deriving Show

solve :: Int -> [Int] -> Int
solve n (a:as) = go 1 Unknown a as
  where
    go !k _ _ [] = k
    go !k Unknown x (y:ys)
        | x <  y    = go k Up      y ys
        | x >  y    = go k Down    y ys
        | otherwise = go k Unknown y ys
    go !k Up x (y:ys)
        | x > y     = go (k + 1) Unknown y ys
        | otherwise = go k Up y ys
    go !k Down x (y:ys)
        | x < y     = go (k + 1) Unknown y ys
        | otherwise = go k Down y ys

main :: IO ()
main = do
    n <- readLn :: IO Int
    as <- fmap read . words <$> getLine :: IO [Int]
    print $ solve n as

Measured memory_bytes: 33148
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  int n, a, c, mc = INT_MAX;
  cin >> n;
  REP(i, n) {
    cin >> a;
    c = 0;
    while (a % 2 == 0 && a != 1) {
      a /= 2;
      c++;
    }
    mc = min(c, mc);
  }
  cout << mc << endl;
  return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split(" "))
L = [0] * M
for i in range(M):
    L[i] = input().split(" ")
    
memoAC = [0] * N
memoWA = [0] * N
for list in L:
    if list[1] == "AC":
        memoAC[int(list[0])-1] = 1
    else:
        if memoAC[int(list[0])-1] != 1:
            memoWA[int(list[0])-1] += 1

for j in range(N):
    if memoAC[j] == 0:
        memoWA[j] = 0

AC = sum(memoAC)
WA = sum(memoWA)
print(AC,WA)

Measured memory_bytes: 63952
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <bitset>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)

using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

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

    ll i,j,h,ans;
    ll Q,K,P,C,N,X,A,B;
    ll pi = M_PI;
    long double H,M, kh,km;

    string S;
    map<long double, ll> m;
    vector<ll>  aa;
    
    cin>>N>>A;
    

    ans=N*A;
    
    
    cout<< ans<<endl;
    
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using lint = long;
using ll = long long;
#define rep(i,n) for(lint (i) = 0;(i) < (lint)(n);(i)++)
#define repInRange(i,start,end) for(lint (i) = (start);(i) < (end);++(i))
using lpair = pair<lint,lint>;
using llv = vector<long long>;
using lv = vector<lint>;
using Llist = list<lint>;

ll pow(ll k,ll l) {
	ll ret = 1;
	rep(i,l) {
		ret *= k;
	}
	return ret;
}

template <typename T>
T sum(vector<T> vec) {
	ll ret = 0;
	rep(i,vec.size()) {
		ret += vec.at(i);
	}
	return ret;
}

void Main() {
	lv v(3);
	rep(i,3) cin >> v[i];
	sort(v.begin(),v.end());
	if (v[0] == 5 && v[1] == 5 && v[2] == 7) {
		cout << "YES" << '\n';
		return ;
	}
	cout << "NO" << '\n';
}

signed main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	Main();
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int  n,u,w[100][100],color[100],d[100];

int main(){
  int i,j,mincost,sum=0;
  scanf("%d",&n);
 
  for(i=0;i<n;i++) for(j=0;j<n;j++){
      scanf("%d",&w[i][j]);
      if(w[i][j]==-1)w[i][j]=2001;
    }
 
  for(i=0;i<n;i++){
    d[i] =2001;
    color[i] =0;
  }
  d[0]=0;

  while (1){
    mincost=2001;    
for(i=0;i<n;i++){
      if (color[i] != 1 && d[i] < mincost){
	mincost = d[i];
	u = i;
      }
    }
    if (mincost ==2001)
      break;
    color[u] = 1;
    for (i=0;i<n;i++){
      if (color[i] != 1 && w[u][i] < d[i]){
	d[i] = w[u][i];
      }
    }
  }
  for (i=0;i<n;i++){
    sum+=d[i];
  }
  printf("%d\n",sum);
  return 0;
}

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

int main(int argc, char *argv[]) {
  std::string s, t;
  std::cin >> s >> t;
  for (size_t i = 0; i < s.size(); ++i) {
    std::rotate(s.begin(), s.begin() + 1, s.end());
    if (t == s) {
      std::cout << "Yes" << std::endl;
      return 0;
    }
  }
  std::cout << "No" << std::endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Main { //atcoder
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        int[] a = new int[n];
        for(int i =0 ;i<n;i++) a[i] = in.nextInt();
        int count = 0;
        for(int i = 0; i<n-1; i++){
            if(i+1==a[i]){
                //swap
                int temp = a[i];
                a[i] = a[i+1];
                a[i+1] = temp;
                ++count;
            }
        }
        if(n==a[n-1]) ++count;
        out.println(count);
        out.close();
    }
    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public boolean hasNext() {
            String next = null;
            try {
                next = reader.readLine();
            } catch (Exception e) {
            }
            if (next == null) {
                return false;
            }
            tokenizer = new StringTokenizer(next);
            return true;
        }

        public BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
    }
}



Measured memory_bytes: 44088
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  if (N == 0) {
    cout << 0 << endl;
  }
  else if (N % 111 == 0) {
    cout << 3 << endl;
  }
  else if (N % 100 == 0 || (N / 100 == 0 && N / 10 == 1 && N % 10 == 0) || (N /100 == 0 && N /10 == 0 && N % 10 == 1)) {
    cout << 1 << endl;
  }
  else if (N % 110 == 0 || (N % 100 % 10 == 1)) {
    cout << 2 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll n, d, x, y;
    cin >> n >> d;
    ll ans = 0; 
    rep1(i, n){
        cin >> x >> y;
        if (x*x + y*y <= d*d) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
import numpy as np
from scipy.sparse import *

U = 10**5
N = int(input())
XY = np.array([input().split() for _ in range(N)], dtype=np.int32)

graph = csr_matrix(([1]*N, (XY[:,0], U + XY[:,1])), (2*U+1, 2*U+1))
_, component = csgraph.connected_components(graph)

X_cnt = np.bincount(component[:U+1], minlength = 2*U+2)
Y_cnt = np.bincount(component[U+1:], minlength = 2*U+2)
pts_cnt = np.bincount(component[XY[:,0]], minlength = 2*U+2)
answer = (X_cnt * Y_cnt - pts_cnt).sum()
print(answer)


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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  std::string s;
  std::cin >> s;
  std::reverse(s.begin(), s.end());
  std::vector<std::string> sl = {"dream", "dreamer", "erase", "eraser"};
  for (auto &i : sl) {
    std::reverse(i.begin(), i.end());
  }

  while (!s.empty()) {
    const auto before = s.size();
    for (const auto &i : sl) {
      if (i.size() <= s.size() && s.compare(0, i.size(), i) == 0) {
        s.erase(0, i.size());
        break;
      }
    }
    if (before == s.size()) {
      break;
    }
  }

  if (s.empty()) {
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }

  return 0;
}


Measured memory_bytes: 512