akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back

int main()
{
	int n, s;
	cin >> n >> s;
	int arr[n];
	for(int i=0; i<n; i++) cin >> arr[i];
	sort(arr, arr+n);
	int cnt = 0;
	for(int i=0; i<n-1; i++) {
		s -= arr[i];
		if(s<0) break;
		cnt++;
	}
	if(s > 0 && s == arr[n-1]) cnt++;
	cout << cnt << endl;
	return 0;
}



Measured memory_bytes: 3600
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include <iostream>
using namespace std;

//双方向リストのノード(リストの各要素)
struct Node {
    int key;
    Node *prev, *next;
};

Node *nil;

//入力したキーを含むノードを探索
Node* listSearch(int key) {
    Node *cur = nil->next;
    while ( cur != nil && cur->key != key ) {
        cur = cur->next;
    }
    return cur;
}

//双方向リストの初期化
void init() {
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void printList() {
    Node *cur = nil->next;
    int isf = 0;
    while( 1 ){
        if( cur == nil) break;
        if ( isf++ > 0 ) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    cout << endl;
}

//双方向リストのノードを削除
void deleteNode(Node *t) {
    if( t == nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

//双方向リストの最初のノードを削除
void deleteFirst() {
    deleteNode(nil->next);
}

//双方向リストの最後のノードを削除
void deleteLast() {
    deleteNode(nil->prev);
}

//指定したキーを含むノードを削除
void deleteKey(int key) {
    deleteNode(listSearch(key));
}

//双方向リストへの挿入
void insert(int key) {
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

int main() {
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for(i = 0; i < n; i++) {
        scanf("%s%d", com, &key);     //リストに対して利用する関数と数字を入力
        if( com[0] == 'i' ) { insert(key); np++; size++; }
        else if( com[0] == 'd' ) {
            if( strlen(com) > 6 ) {
                if( com[6] == 'F' ) deleteFirst();
                else if( com[6] == 'L' ) deleteLast();
            } else {
                deleteKey(key); nd++;
            }
            size--;
        }
    }
    printList();
    return 0;
}


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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    // 3
    // 1 2
    // 1 3
    // 1 4
    // のようなタイプ
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
  }

// 最大公約数
fn gcd(a: i64, b: i64) -> i64 {
    let mut aa: i64 = if a > b { a } else { b };
    let mut bb: i64 = if a > b { b } else { a };
    while bb != 0 {
        let tmp = bb;
        bb = aa % tmp;
        aa = tmp;
    }
    return aa;
}

// 最小公倍数
fn lcm(a: i64, b: i64) -> i64 {
    a / gcd(a, b) * b
}

const LARGE_PRIME: usize = 1000000007;

fn main() {
    input! {
        s: String,
        t: String
    }
    println!("{}{}", t, s);
}


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

const int N = 1e5 + 5;
string s;

int surplus[N];
int rocksToEnd[N]; //Not including the indexed rock

int main() {
	ios_base::sync_with_stdio(false);

	cin >> s;

	int cumu = 0;
	for(int i = 0; i < s.length(); i++) {
		if(s[i] == 'g') {
			surplus[i] = ++cumu;
		} else {
			surplus[i] = --cumu;
		}
	}

	cumu = 0;
	for(int i = s.length()-1; i+1; i--) {
		if(s[i] == 'g') {
			rocksToEnd[i] = cumu++;
		} else {
			rocksToEnd[i] = cumu;
		}
	}

	for(int i = 0; i < s.length(); i++) {
		if(surplus[i] >= s.length()-1-i) {
			cout << rocksToEnd[i] << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 1232
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cctype>
#include <string>

using namespace std;

typedef long long ll;

#define rep(i,n)  for(int i=0;i<(n);++i)
#define all(x) (x).begin(),(x).end()

ll gcd(ll x, ll y) { return y ? gcd(y, x%y) : x; }

const int mod = 1000000007;
const int INF = 1001001001;

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> g;
    rep(i, m) {
        int ai, bi;
        cin >> ai >> bi;
        g.emplace_back(bi, ai);
    }
    sort(g.begin(), g.end());

    int end = 0;
    int ans = 0;
    rep(i, m) {
        if(end <= g[i].second) {
            ans += 1;
            end = g[i].first;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 1000000007

signed main(){
    int n;
    cin>>n;
    int ans=1;
    for(int i=1;i<=n;i++){
        ans*=i;
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
/* ANTHOR KUMAR DAS
KUET ECE 2K18*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sc(a) scanf("%d",&a)
#define sc1(n) scanf("%lld",&n)
#define sc2(b,c) scanf("%lld%lld",&b,&c)
#define f(a,b) for(a=0;a<b;a++)
#define pb(a) push_back(a)
#define br break
int main()
{
    int n,s=0,i,j;
    cin>>n;
    int a[n];
    for(i=0;i<(n-1);i++)
    {
        cin>>a[i];
    }
    s=a[0]+a[n-2];
    for(i=(n-2);i>0;i--)
    {
        j=min(a[i],a[i-1]);
        s=s+j;
    }
    cout<<s<<endl;


    return 0;
}



Measured memory_bytes: 256
#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 k, n;
    cin >> k >> n;
    vector<int> a(n, 0);
    rep(i, n){
        cin >> a[i];
    }
    int distance = a[n-1] - a[0];
    rep(i, n){
        distance = min(distance, a[i] + (k - a[i+1]));
    }
    cout << distance << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        List<Integer> l = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            l.add(s.nextInt());
        }
        System.out.println(Collections.max(l) - Collections.min(l));
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    ll n,q;
    cin >> n;
    vector<ll> v(n,0);
    rep(i,n)cin >> v[i];
    cin >> q;
    vector<ll> vv(q,0);
    rep(i,q)cin >> vv[i];

    //二分探索
    ll res = 0;
    sort(v.begin(),v.end());
    rep(i,q){
        ll left = -1;
        ll right = v.size();
        while(right - left > 1){
            ll mid = (left + right)/2;
            if(v[mid] == vv[i]){
                ++res;
                break;
            }
            if(v[mid] < vv[i])left = mid;
            else right = mid;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3812
#include <iostream>
#include <array>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>

using namespace std;
using ll = long long;

ll W, H, N, sr, sc;
string S, T;

void input() {
    cin >> H >> W >> N >> sr >> sc;
    cin >> S >> T;
}

bool solve() {
    ll upcap = sr-1, downcap = H - sr, leftcap = sc-1, rightcap = W - sc;
//    cerr << leftcap << ' ' << rightcap << ' ' << upcap << ' ' << downcap << endl;
    for (ll i = 0; i < N; i++) {
        switch (S[i]) {
            case 'L':
                if (--leftcap < 0) return false;
                break;
            case 'R':
                if (--rightcap < 0) return false;
                break;
            case 'U':
                if (--upcap < 0) return false;
                break;
            case 'D':
                if (--downcap < 0) return false;
                break;
        }
//        cerr << leftcap << ' ' << rightcap << ' ' << upcap << ' ' << downcap << endl;
        switch (T[i]) {
            case 'L':
                rightcap = min(W-1, ++rightcap);
                break;
            case 'R':
                leftcap = min(W-1, ++leftcap);
                break;
            case 'U':
                downcap = min(H-1, ++downcap);
                break;
            case 'D':
                upcap = min(H-1, ++upcap);
                break;
        }
//        cerr << leftcap << ' ' << rightcap << ' ' << upcap << ' ' << downcap << endl;
    }
    return true;
}

int main() {
    input();
    cout << (solve() ? "YES" : "NO") << endl;
//    solve();

    return 0;
}



Measured memory_bytes: 1020
import java.util.Scanner;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
public class Main {
    public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    List<Integer> P = new ArrayList<Integer>();
    List<Integer> Q = new ArrayList<Integer>();
    List<Integer> Ps = new ArrayList<Integer>();
    List<Integer> Qs = new ArrayList<Integer>();   
    int a = 1; 
    int b = 1;
    for(int i=0; i<N; i++){
    	int x = sc.nextInt();
        P.add(x);
        Ps.add(x);
    }
    for(int i=0; i<N; i++){
    	int x = sc.nextInt();
        Q.add(x);
        Qs.add(x);
    } 
    Collections.sort(Ps);
    Collections.sort(Qs);
      
   for(int i=0; i<N-1;i++){
     int searchNumber = P.get(i);
     int x = 0;
     int y = 1;
     for(int j=0; j<Ps.size(); j++){
     	if(searchNumber == Ps.get(j)){
          x = j;
          Ps.remove(j);
          break;
        }
     }
   for( int k = (N - i - 1); k > 0; k--) y *= k;
   if(x != 0) a += x * y;
   }
      
   for(int i=0; i<N-1;i++){
     int searchNumber = Q.get(i);
     int x = 0;
     int y = 1;
     for(int j=0; j<Qs.size(); j++){
     	if(searchNumber == Qs.get(j)){
          x = j;
          Qs.remove(j);
          break;
        }
     }
   for( int k = (N - i - 1); k > 0; k--) y *= k;
   if(x != 0) b += x * y;
   }
      
   int answer = a - b;
   if(answer < 0) answer = -answer;
   System.out.println(answer);   
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int N,Q;
string S;
vector<char> T(200200),D(200200);

int solve(int X){
  rep(i,Q){
    if(X==-1 or X==N) break;
    if(S[X]==T[i]){
      if(D[i]=='L') X--;
      else X++;
    }
  }
  if(X==-1) return -1;
  if(X==N) return 1;
  return 0;
}

int main(){
  cin>>N>>Q;
  cin>>S;
  rep(i,Q) cin>>T[i]>>D[i];
  int ans=N;
  int ok=N;
  int ng=-1;
  rep(i,20){
    if(abs(ok-ng)<=1) break;
    int mid=(ok+ng)/2;
    if(solve(mid)==1) ok=mid;
    else ng=mid;
  }
  ans-=N-ok;
  ok=-1;
  ng=N;
  rep(i,20){
    if(abs(ok-ng)<=1) break;
    int mid=(ok+ng)/2;
    if(solve(mid)==-1) ok=mid;
    else ng=mid;
  }
  ans-=ok+1;
  cout<<ans<<endl;
}


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

using namespace std;

bool Solve() {
    int n;
    cin >> n;

    for (int i = 0; 4 * i <= n; ++i)
        for (int j = 0; 4 * i + 7 * j <= n; ++j)
            if (4 * i + 7 * j == n) return true;

    return false;
}

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

    cout << (Solve() ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define IOS std::cin.tie(0),std::ios::sync_with_stdio(false)

namespace idaten {

	using namespace std;
	using ll = int_fast64_t;
	using ull = uint_fast64_t;
	using P = std::pair<int64_t, int64_t>;
	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<class Type>struct is_vector : std::false_type {};
	template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
	template <typename T> inline std::ostream& operator << (std::ostream& out, const std::vector<T>& v) {
		if (v.empty())return out;
		constexpr bool is_vector_v = is_vector<T>::value;
		if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
		else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
		return out;
	}
	inline void put() {}
	template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
	template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
	inline void putn() {}
	template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

	void dfs(int now, vector<vector<int>>& path, vector<int>& find, vector<int>& finish, int& time) {
		find[now] = time++;
		REP(i, path[now].size()) {
			int t = path[now][i];
			if (find[t] < 0) {
				dfs(t, path, find, finish, time);
			}
		}
		finish[now] = time++;
	}

	void solve() {
		IOS;
		int n;
		cin >> n;
		vector<vector<int>> path(n);
		REP(i, n) {
			int u, k;
			cin >> u >> k;
			u--;
			REP(j, k) {
				int v;
				cin >> v;
				v--;
				path[u].push_back(v);
			}
		}
		vector<int> visit(n, 0);
		vector<int> find(n, -1);
		vector<int> finish(n, -1);
		int time = 1;
		REP(i, n) {
			if (find[i] < 0) {
				dfs(i, path, find, finish, time);
			}
		}
		REP(i, n) {
			put(i + 1, find[i], finish[i]);
		}
	}
} // namespace idaten

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



Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" \
                              << "\n";

int main()
{
    ll n, r = 0, g = 0, b = 0;
    ll ans;
    cin >> n;
    string s;
    cin >> s;

    REP(i, n)
    {
        if (s.at(i) == 'R')
            r++;
        if (s.at(i) == 'G')
            g++;
        if (s.at(i) == 'B')
            b++;
    }
    ans = r * g * b;

    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            int k = (j - i) + j;
            if (k >= n)
                break;
            if (s.at(i) != s.at(j) && s.at(j) != s.at(k) && s.at(k) != s.at(i))
            {
                ans--;
            }
        }
    }
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[10]={0};
int main(){
	int n;
	int b=0;
	for(int i=0;i<4;i++){
		int s;
		cin>>s;
		a[s]++;
	}
	if(a[1]!=0 && a[9]!=0 && a[4]!=0 && a[7]!=0)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
} 

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

int main(void) {

	double r, l, s;
	
	scanf("%lf", &r);
	
	l = r * M_PI * 2;
	s = r * r * M_PI;
	
	printf("%f %f\n", s, l);
	
	return 0;
}

Measured memory_bytes: 648
#include<bits/stdc++.h>
using namespace std;
int main()
{
 	int a,b,c,d;
  	cin>>a>>b>>c>>d;
  for(int i=0;i<1000;i++)
  {
    c-=b;
    if(c<=0)
    {
     	cout<<"Yes"; 
      return 0;
    }
    a-=d;
    if(a<=0)
    {
     	cout<<"No";
      return 0;
    }
  }
}

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

int main(void){
    int N;
    cin >> N;
    long long res = 0;    
    for(int i=1; i<N+1; i++){
        res += (long long)(N/i)*(N/i+1)/2*i;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>
#include<math.h>
#define N 1000

int main(void){
  int i,num;
  double x1[N],y1[N],
         x2[N],y2[N],
         x3[N],y3[N],
         xp[N],yp[N];
  double a,b,c,z,s1,s2,s3,eSum;

  for(i=0;
      scanf("%lf%lf%lf%lf%lf%lf%lf%lf",
        &x1[i],&y1[i],
        &x2[i],&y2[i],
        &x3[i],&y3[i],
        &xp[i],&yp[i])==8;i++){}
  num=i;
  for(i=0;i<num;i++){
    a=sqrt((x1[i]-x2[i])*(x1[i]-x2[i])+(y1[i]-y2[i])*(y1[i]-y2[i]));
    b=sqrt((x3[i]-x2[i])*(x3[i]-x2[i])+(y3[i]-y2[i])*(y3[i]-y2[i]));
    c=sqrt((x1[i]-x3[i])*(x1[i]-x3[i])+(y1[i]-y3[i])*(y1[i]-y3[i]));
    z=(a+b+c)/2;
    eSum=sqrt(z*(z-a)*(z-b)*(z-c));
    a=sqrt((x1[i]-x2[i])*(x1[i]-x2[i])+(y1[i]-y2[i])*(y1[i]-y2[i]));
    b=sqrt((xp[i]-x2[i])*(xp[i]-x2[i])+(yp[i]-y2[i])*(yp[i]-y2[i]));
    c=sqrt((x1[i]-xp[i])*(x1[i]-xp[i])+(y1[i]-yp[i])*(y1[i]-yp[i]));
    z=(a+b+c)/2;
    s1=sqrt(z*(z-a)*(z-b)*(z-c));
    a=sqrt((xp[i]-x2[i])*(xp[i]-x2[i])+(yp[i]-y2[i])*(yp[i]-y2[i]));
    b=sqrt((x3[i]-x2[i])*(x3[i]-x2[i])+(y3[i]-y2[i])*(y3[i]-y2[i]));
    c=sqrt((xp[i]-x3[i])*(xp[i]-x3[i])+(yp[i]-y3[i])*(yp[i]-y3[i]));
    z=(a+b+c)/2;
    s2=sqrt(z*(z-a)*(z-b)*(z-c));
    a=sqrt((x1[i]-xp[i])*(x1[i]-xp[i])+(y1[i]-yp[i])*(y1[i]-yp[i]));
    b=sqrt((x3[i]-xp[i])*(x3[i]-xp[i])+(y3[i]-yp[i])*(y3[i]-yp[i]));
    c=sqrt((x1[i]-x3[i])*(x1[i]-x3[i])+(y1[i]-y3[i])*(y1[i]-y3[i]));
    z=(a+b+c)/2;
    s3=sqrt(z*(z-a)*(z-b)*(z-c));
    if(eSum+0.0000000000000005>=s1+s2+s3){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
#define ll long long 
using namespace std;
ll n,x,y,ans;
inline ll mx(ll a,ll b){return a>b ? a : b;}
int main()
{
//	freopen("Mysterious Light.in","r",stdin);
	scanf("%lld%lld",&n,&x);
	y=mx(x,n-x); x=n-y;
	ans=n;
	while(x>=1)
	{
		if(y%x==0) { ans+=(y/x*2*x-x); break; }
		ans+=y/x*2*x;
		ll tt=x; x=y%x; y=tt;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <set>

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

int main()
{
	int i,n,kaisu,k;
	long double ans=0;
	cin >>n>>k;
	rep(i,min(n,k)){
		kaisu=log2((double)(k)/(i+1))+0.9999;
		ans+=1.0/pow(2,kaisu);
	}
	if (n>k) ans+=n-k;
  	ans/=n;
	cout << setprecision(11)<<ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep0(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<string, int, int> TU;
typedef tuple<int, int, int> TI;

int main()
{
    ll n, m;
    cin >> n >> m;
    ll input[n+1];
    rep1(i, n)
    {
        ll tmp;
        cin >> tmp;
        input[i] = tmp;
    }
    int memo[n+1]={}, index = 1;
    ll now = 1, loop = 0;
    while (m > 0)
    {
        if (memo[now] != 0)
        {
            loop = index - memo[now];
            break;
        }
        memo[now] = index;
        now = input[now];
        m--;
        index++;
    }
    if (!loop)
    {
        cout << now << endl;
    }
    else
    {
        ll mod = m % loop;
        rep0(i, mod)
        {
            memo[now] = index;
            now = input[now];
            m--;
            index++;
        }
        cout << now << endl;
    }
}


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

int main()
{
  int size,count=0;
  string S,T;
  
  cin>>S;
  cin>>T;
  size=S.size();
  for(int i=0;i<size;i++)
  {
   if(S[i]!=T[i]) 
     count++;
  }
  cout<<count;
}

Measured memory_bytes: 3560
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int i = 0;
    boolean ok = false;

    for (i = 0; i < s.length(); i++) {
      if (s.charAt(i) == 'C') {
        break;
      }
    }

    for (; i < s.length(); i++) {
      if (s.charAt(i) == 'F') {
        ok = true;
        break;
      }
    }

    if (ok) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
}

Measured memory_bytes: 35456
#include<cstdio>

int insertionSort(int* , int length);
int output_array(int*, int length);

int main()
{
    int length;
    scanf("%d", &length);
    int seq[length];
    for (int i=0;i<length;i++)
    {
        scanf("%d", &seq[i]);
    }
    output_array(seq, length);
    insertionSort(seq, length);
}

int insertionSort(int *array , int length)
{
    for (int i=1; i<length; i++)
    {
        //printf("%d\n", i);
        int v = array[i];
        int j =i - 1;
        //printf("j=%d\n", j);
        while((j>=0)&&(array[j]>v))
        {
            array[j+1]=array[j];
            j--;
            //output_array(array, length);
        }
        array[j+1] = v;
        output_array(array, length);
    }
}

int output_array(int *array, int length)
{
    for (int i=0;i<length;i++)
    {
        if(i<length-1)
        {
            printf("%d ", array[i]);
        }
        else{
            printf("%d", array[i]);
        }
    }
    printf("\n");
}

Measured memory_bytes: 2736
#include<stdio.h> 
#include<iostream> 
#include<string.h>
#include<cstring>
#include<string>
#include<math.h>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
#define cuttime ios::sync_with_stdio(false)
#define swap(x, y) x ^= y, y ^= x, x^= y
#define INF 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define scan1(x) scanf("%d",&x)
#define scan2(x,y) scanf("%d%d",&x,&y)
#define scan3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define scanll1(x) scanf("%lld",&x)
#define scanll2(x,y) scanf("%lld%lld",&x,&y)
#define scanll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define lowbit(x) (x&(-x))
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N=2e5+20;
const int MAX=10000007;
inline ll read() {
    char c=getchar();ll x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0',c=getchar();}
    return x*f;
}
inline void out(int x) {   
	if(x>9) out(x/10);   
	putchar(x%10+'0'); 
} 
int main(){
	ll a,b,c;
	scanll3(a,b,c);
	for(int i=0;i<=b;++i){
		if((a*i)%b==c){
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	
	return 0;
}

Measured memory_bytes: 256
// import scala.io.StdIn._
import java.util.Scanner

object Main extends App {
  def readALine(c:Int):List[Int] = if (c > 0) sc.nextInt::readALine(c-1) else Nil
  def readLines(r:Int, c:Int):List[List[Int]] = if (r > 0) readALine(c)::readLines(r-1, c) else Nil
  val sc = new Scanner(System.in)
  val n, m, x = sc.nextInt
  val ls = readLines(n, m+1)
//  println(ls)

  def opVecs(op:(Int, Int)=>Int,a:List[Int],b:List[Int],ac:List[Int]):List[Int] = {
    (a, b) match {
      case (Nil, Nil) => ac.reverse
      case (x::xs, y::ys) => opVecs(op, xs, ys, op(x,y)::ac)
    }
  }
  def add(a:List[Int],b:List[Int]):List[Int] = opVecs((x,y)=>x+y, a, b, Nil)

  def haveAchieved(v:List[Int],x:Int):Boolean = v.forall((a) => a>=x)

  def evaluate(books:List[List[Int]], cost:Int, grades:List[Int], minCost:Int):Int = {
    books match {
      case Nil => if (haveAchieved(grades, x))
                    if (cost < minCost) cost else minCost
                  else minCost
      case (c::el)::xs if (c + cost <  minCost) => {
        val newMinCost = evaluate(xs, c+cost, add(el, grades), minCost)
        evaluate(books.tail, cost, grades, newMinCost)
      }
      case _ => evaluate(books.tail,cost,grades,minCost)
    }

  }

  val bound = 12*100000+1
  val result = evaluate(ls, 0, List.fill(m)(0), bound)
  println(if (result < bound) result else -1)  
}


Measured memory_bytes: 57028
//ID: LRL52  Date: 2019.10.9 ~ 10.10
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#include<bits/stdc++.h>
using namespace std;
const int N = 4055, M = 2055; char ss[1 << 21], *A = ss, *B = ss, cc;
inline char gc(){return A == B && (B = (A = ss) + fread(ss, 1, 1 << 21, stdin), A == B) ? EOF : *A++;}
template<class T>inline void rd(T &x){
	int f = 1; x = 0, cc = gc(); while(cc < '0' || cc > '9'){if(cc == '-') f = -1; cc = gc();}
	while(cc >= '0' && cc <= '9'){x = x * 10 + (cc ^ 48); cc = gc();} x *= f;
}
const int P = 1e9 + 7;
int n;
int a[200055], b[200055], f[N][N];
const int maxn = 8000;
int jc[maxn + 5], jcinv[maxn + 5], inv[maxn + 5];

void Prework(int maxn){
	jc[0] = jc[1] = jcinv[0] = jcinv[1] = inv[1] = 1;
	rep(i, 2, maxn) jc[i] = 1LL * jc[i - 1] * i % P;
	rep(i, 2, maxn) inv[i] = 1LL * (P - P / i) * inv[P % i] % P;
	rep(i, 2, maxn) jcinv[i] = 1LL * jcinv[i - 1] * inv[i] % P;
}

int C(int n, int m){return 1LL * jc[n] * jcinv[n - m] % P * jcinv[m] % P;}

#define f(i, j) f[i + 2005][j + 2005]
int main(){
	//freopen("AGC001E.in", "r", stdin);
	//freopen("AGC001E.out", "w", stdout);
	rd(n);
	rep(i, 1, n) rd(a[i]), rd(b[i]);
	Prework(8000);
	rep(i, 1, n)
	    ++f(-a[i], -b[i]);
	rep(i, -2000, 2000)
	    rep(j, -2000, 2000)
	        f(i, j) = (1LL * f(i, j) + f(i - 1, j) + f(i, j - 1)) % P;
	int ans = 0;
	rep(i, 1, n) 
	    ans = (ans + f(a[i], b[i])) % P;
	rep(i, 1, n){
		ans = (ans - C(2 * (a[i] + b[i]), 2 * a[i]) + P) % P;
	} 
	ans = 1LL * ans * inv[2] % P;
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;

int main(void)
{
    int r, D, x;
    cin >> r >> D >> x;
    int xx = x;
    for(int i = 0; i < 10; i++){
        xx = r * xx - D;
        cout << xx << endl;;
    }
    return 0;
}

Measured memory_bytes: 256
from itertools import *

N,K=map(int,input().split())
S=input()

nums=[]
if S[0]=="0":
  nums.append(0)
i=0
while i<len(S):
  j=i
  while j<len(S) and S[j]==S[i]:
    j+=1
  nums.append(j-i)
  i=j
if S[-1]=="0":
  nums.append(0)

sums=[0]+list(accumulate(nums))

ans=0
for left in range(0,len(sums),2):
  right=left+K*2+1
  if len(sums)<=right:
    right=len(sums)-1
  ans=max(ans,sums[right]-sums[left])

print(ans)


Measured memory_bytes: 82604
#include<iostream>
using namespace std;
int main(){
   int sam1,sam2,a,b,n;

   while(cin >> n,n !=0){

   sam1 = 0;
   sam2 = 0;

   for(int i=0;i<n;i++){
	cin >> a >> b;

	if(a>b){
		sam1 += a+b;
	}else if(b>a){
		sam2 += a+b;
	}else if(a == b){
		sam1 += a;
		sam2 += b;
	}
   }

   cout << sam1 << " " << sam2 << endl;

   }

   return 0;
}
 
   

Measured memory_bytes: 1160
// finish date: 2018/01/10
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int i=a;i<b;i++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long

bool isExist(char c, string str) {
    rep(i, str.length()) {
        if (c == str[i]) return true;
    }
    return false;
}

int fact(int n) {
    int ans = 1;
    FOR(i, 1, n + 1) {
        ans *= i;
    }
    return ans;
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && b == c) cout << 1 << endl;
    else if (a == b || b == c || c == a) cout << 2 << endl;
    else cout << 3 << endl;


    return 0;
}

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

int main() {
  string s; cin >> s;
  int remains = 0;
  for (auto &ch : s) {
    remains = (remains + ch - '0') % 9;
  }
  if(remains == 0) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}

Measured memory_bytes: 3724
k = int(input())
a, b = map(int,input().split())

if b // k != a // k:
    ans = 'OK'
else:
    if a % k == 0:
        ans = 'OK'
    elif b % k == 0:
        ans = 'OK'
    else:
        ans = 'NG'


print(ans)


Measured memory_bytes: 9168
#include <cstdint>
#include <iostream>
#include <map>
#include <vector>
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); i++)

using namespace std;

const int N = 200000;
int ary[N + 1];
map<int, int> cnt;

int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  ary[0] = 0;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    ary[i + 1] = (static_cast<int>(ary[i]) + a - 1) % k;
  }
  cnt[0] = 1;
  int64_t ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i - k >= 0)
      cnt[ary[i - k]]--;
    ans += cnt[ary[i]];
    cnt[ary[i]] += 1;
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 10368
n,u,v=map(int,input().split())
tree=[[]for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
va=[-1]*n
q=[v-1]
va[v-1]=0
while q:
    x=q.pop()
    for j in tree[x]:
        if va[j]==-1:
            q.append(j)
            va[j]=va[x]+1
q=[u-1]
vt=[-1]*n
vt[u-1]=0
ans=0
while q:
    x=q.pop()
    ans=max(ans,va[x])
    for j in tree[x]:
        if vt[j]==-1:
            if vt[x]+1<va[j]:
                q.append(j)
                vt[j]=vt[x]+1
            elif vt[x]+1==va[j]:
                vt[j]=vt[x]+1
print(ans-1)

Measured memory_bytes: 28548
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <queue>
# define MOD 1000000000+7
# define INF 1000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
long long int a = 0, b = 0, c = 0, d = 0, e = 0, ans = 0, x = 0, y = 0, z = 0, N = 0, m = 0, maxy = 0, mini = 9999999999, mini2 = 9999999999, counter = 0, endp = 0, checker = 0;

std::vector <char> vec{}, vecsec{}, vecth{};
long long int iremono[100010], koware[100001];
long long  int iremono2[100001], check[100001], xpo[10000001], ypo[10000001], hei[1000001];
std::vector<char>kinds{}, kaku{}, kakutwo{};
char maze[1000];
int sx, sy;
int gx, gy;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
bool okada = false, okada2 = false;
long long int dp[4][100003] ,ire[4][100003];
std::string input[103],one,two,three;
char re;

int H, W;//はんい
bool qw = false, er = false, ty = false, ui = false;
std::string code;
long long int gcd(long long int a, long long int b)
{
	if (a < b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}

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

int main() {
	cin >> one >> two;
	rep(i, one.size()) {
		kaku.push_back(one[i]);
	}
	rep(i, two.size()) {
		kakutwo.push_back(two[i]);
	}
	sort(kaku.begin(), kaku.end());
	sort(kakutwo.begin(), kakutwo.end(), std::greater<char>());
	if (kaku < kakutwo) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}




Measured memory_bytes: 2432
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public static void Main()
    {
        var S = Console.ReadLine().Select(x => x.ToString()).ToArray();
        int ans = 0;

        for (int i = 0; i < S.Length; i++)
        {
            if(i == 0)
            {
                //なにもしない
            }
            else if(S[i-1] == S[i])
            {
                if (S[i] == "0")
                {
                    S[i] = "1";
                }
                else
                {
                    S[i] = "0";
                }
                ans = ans + 1;
            }
        }

            Console.WriteLine(ans);
    }
}

Measured memory_bytes: 18144
#include <bits/stdc++.h>
using namespace std;
#define ll	    long long
#define vi      vector <ll>
#define vii     vector <pair<int,int>>
#define ii      pair<int,int>
#define loop(n)	for(int i=0;i<n;i++)
#define pb      push_back
const ll mod=1e9+7;
void fast();
bool is_prime(int x){
    if(x==2)
        return true;
    if(x%2==0||x==1)
        return false;
    for(int i=3;i*i<=x;i+=2){
        if(x%i==0)
            return false;
    }
    return true;
}
int main()
{
    fast();
    vi v(100005,0);
    for(int i=1;i<=100000;i++){
        if((i&1)&&is_prime(i)&&is_prime((i+1)/2))
            v[i]++;
        v[i]+=v[i-1];
    }
    int q;
    cin>>q;
    while(q--){
        int l,r;
        cin>>l>>r;
        cout<<v[r]-v[l-1]<<endl;
    }
}
void fast(){
std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
/*

*/


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

int main(){
	int n;
	int m;
	const int nmax = 50;
	const int mmax = 10;
	while(cin >> n){
		double x[nmax+1][mmax];
		double y[nmax+1][mmax];
		double dis[nmax+1][mmax];
		int direction[nmax+1][mmax];
		int size[nmax+1];
		if(n == 0) break;
		for(int i = 0; i <= n; i++){
			cin >> m;
			size[i] = m;
			for(int j = 0; j < m; j++){
				cin >> x[i][j] >> y[i][j];
			}
			for(int j = 1; j < m; j++){
				double dx = x[i][j] - x[i][j-1];
				double dy = y[i][j] - y[i][j-1];
				dis[i][j] = dx * dx + dy * dy;
				if(dx == 0){
					if(dy > 0){
						direction[i][j] = 0;
					}else direction[i][j] = 2;
				}else{
					if(dx > 0){
						direction[i][j] = 1;
					}else direction[i][j] = 3;
				}
			}
		}
		for(int i = 1; i <= n; i++){
			if(size[0] != size[i]) continue;
			for(int j = 0; j < 4; j++){
				bool f = true;
				for(int k = 1; k < m; k++){
					if(direction[0][k] != ((direction[i][k] + j) % 4)
						|| dis[0][k] != dis[i][k])
					{
				
					f = false;
						break;
					}
					
				}
				if(f){ 
					cout << i << endl;
					break;
				}
				f = true;
				for(int k = 1; k < m; k++){
					if(direction[0][k] != ((direction[i][m-k] + j) % 4)
						|| dis[0][k] != dis[i][m-k])
					{
						f = false;
						break;
					}
				}
				if(f){
					cout << i << endl;
					break;
				}
			}
		}
		cout << "+++++" << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	int R, G, B, N;
	cin >> R >> G >> B >> N;

	int ans = 0;
	for (int r = 0; r <= N; r += R) {
		for (int g = 0; g + r <= N; g += G) {
			int rest = N - r - g;
			if (rest < 0 || rest % B != 0) {
				continue;
			}
			ans++;
		}
	}

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


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include <string>
#include<iomanip>
#include<cstdio>
#include<math.h>
#include<stack>
#include<queue>
#include<cstring>
#include<vector>
typedef long long int ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
#define MIN -93193111451418101
#define INF 931931114518101
using namespace std;
typedef pair<ll, ll>P;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}
#define MAX_NUM 50
long long comb[MAX_NUM + 1][MAX_NUM + 1];

ll par[100000], depth[100000];
static void calc_comb()
{
	for (uint32_t i = 0; i <= MAX_NUM; i++) {
		for (uint32_t j = 0; j <= i; j++) {
			if ((j == 0) || (i == j)) {
				comb[i][j] = 1;
			}
			else {
				comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
			}
		}
	}
}


//------------------変数-----------------------//
//-------------------関数----------------------//

int main() {
	ll n, p[100001] = {};
	cin >> n; REP(i, n) { cin >> p[i]; }
	ll cnt = 0;
	REP(i, n-1) {
		if (p[i] ==i+1&& p[i + 1]==i+2) {
			i++;
			cnt--;
		}
	}
	REP(i, n) { if (p[i] == i + 1) { cnt++; } }
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using ll = int64_t;
using ld = long double;
using namespace std;


multiset<int> ms;

int main() {
#ifdef PAUNSVOKNO
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(20);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        ms.insert(x);
    }

    int m;
    cin >> m;
    for (int i = 0; i < m; i++) {
        int x;
        cin >> x;
        auto it = ms.lower_bound(x);
        if ((it == ms.end()) || (*it != x)) {
            cout << "NO\n";
            return 0;
        }

        ms.erase(it);
    }

    cout << "YES\n";
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  
  int seki;
  seki = a*b;
  
  int amari;
  amari = seki%2;
 
  if (amari == 0) {
    cout << "Even" << endl;
  }else{
    cout << "Odd" << endl;
  }
  
}

Measured memory_bytes: 256
S = input()
T = input()

for i in range(len(S) - len(T), -1, -1) :
    for j, t in enumerate(T) :
        if S[i + j] == '?' :
            continue
        if S[i + j] != t :
            break
    else :
        ans = list(S)
        ans[i: i + len(T)] = T
        print(''.join(ans).replace('?', 'a'))
        break
else :
    print('UNRESTORABLE')

Measured memory_bytes: 3064
n = gets.to_i
input = n.times.map{ gets.split.map(&:to_i) }
input.sort_by! { |arr| arr[0] }
input.each do |u, k, *v|
  arr = Array.new(n, 0)
  v.each do |i|
    arr[i-1] = 1
  end
  puts arr.join(' ')
end

Measured memory_bytes: 6124
from math import gcd
from collections import defaultdict
MOD = 10**9+7
n = int(input())
cnt = defaultdict(lambda: [0, 0])
zeros = 0
for _ in range(n):
    a, b = map(int, input().split())
    if a == b == 0:
        zeros += 1
        continue
    if a < 0:
        a *= -1
        b *= -1
    g = gcd(a, b)
    a //= g
    b //= g
    if b > 0:
        cnt[(a, b)][0] += 1
    else:
        if a == 0 and b < 0:
            cnt[(a, -b)][0] += 1
        else:
            cnt[(-b, a)][1] += 1

ans = 1
for v, v2 in cnt.values():
    ans *= 1+pow(2, v, MOD)-1+pow(2, v2, MOD)-1
    ans %= MOD
ans = (ans+zeros-1) % MOD
print(ans)


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

using namespace std;

typedef pair<int, int> P;
#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 1234567890



//initialization here
//
const int maxn = 1e5 + 10;
ll f[1<<16];
//
//initialization finish


// your function is here
//



//
// your function finished



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// your code is here
	//
	ll x, y; cin >> x >> y;

	ll cnt = 0;
	while (x <= y)
	{
		cnt++;
		x *= 2;
	}

	Print(cnt);
	//
	// your code finished

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
typedef double DB;
const int N=100005;
struct node
{
    DB x,y;
}a[N],O;
int n;
DB r;
inline DB power(DB x)
{
    return x*x;
}
inline DB dis(node a,node b)
{
    return sqrt(power(a.x-b.x)+power(a.y-b.y));
}
inline bool in_circle(node a)
{
    return dis(a,O)<=r?1:0;
}
inline int calc(DB a,DB b,DB c,DB d,DB e,DB f)
{
    O.x=(b*f-d*e)/(b*c-a*d);
    O.y=(c*e-a*f)/(b*c-a*d);
}
inline void min_cover_circle(void)
{
    register int i,j,k;
    random_shuffle(a+1,a+n+1);
    for (i=1;i<=n;++i)
    if (!in_circle(a[i]))
    {
        O=a[i]; r=0;
        for (j=1;j<i;++j)
        if (!in_circle(a[j]))
        {
            O.x=(a[i].x+a[j].x)/2.0; O.y=(a[i].y+a[j].y)/2.0; r=dis(a[i],O);
            for (k=1;k<j;++k)
            if (!in_circle(a[k])) calc(a[i].x-a[j].x,a[i].y-a[j].y,a[i].x-a[k].x,a[i].y-a[k].y,
            ((power(a[i].x)-power(a[j].x))-(power(a[j].y)-power(a[i].y)))/2.0,
            ((power(a[i].x)-power(a[k].x))-(power(a[k].y)-power(a[i].y)))/2.0),r=dis(a[i],O);
        }
    }
    printf("%.10lf\n",r);
}
int main()
{
    register int i; scanf("%d",&n);
    for (i=1;i<=n;++i)
    scanf("%lf%lf",&a[i].x,&a[i].y);
    min_cover_circle();
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<vector>
#include<algorithm>
#include<random>
#include<string>
#include <stdio.h>
#include <time.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define INF 1000000000

int main()
{
    int N;
	cin>>N;
	vector<int>a(N);
	int f=0;
	REP(i,N){
		cin>>a[i];
		if(a[i]%2==1)f=1;
	}
	if(f==1)
	cout<<"first"<<endl;
	else
	cout<<"second"<<endl;
	
	return 0;
}

Measured memory_bytes: 640
// AtCoder Grand Contest 010
// B - Boxes

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;


const int MAX_N = 100000;

int N;
ll a[MAX_N];

bool can() {
    ll sum_a, sum_n;
    ll k, k_a, d;

    sum_a = 0;
    for (int i = 0; i < N; i++) {
        sum_a += a[i];
    }
    sum_n = ((ll)N + 1) * N / 2;
    if (sum_a % sum_n != 0) {
        return false;
    }
    k = sum_a / sum_n;

    k_a = 0;
    for (int i = 0; i < N; i++) {
        d = k - (a[(i + 1) % N] - a[i]);
        if (d < 0 || d % N != 0) {
            return false;
        }
        k_a += d / N;
    }

    return (k == k_a);
}

int main() {

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

    cout << (can() ? "YES" : "NO") << endl;

    return 0;

}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <stdio.h>

int main(void){
  int d,t,s;
  std::cin >> d >> t >> s;
  if((double)(t-(double)d/s)>=0){
    std::cout << "Yes";
  }else{
    std::cout << "No";
  }
  return 0;
}

Measured memory_bytes: 3632
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        
        AtCoder problem = new AtCoder(sc);
        problem.solve(out);
        
        out.flush();
    }
    
}

class AtCoder {
    final String S, T;
    AtCoder(FastScanner sc) {
        S = sc.next();
        T = sc.next();
    }
    
    void solve(PrintWriter out) {
        int ans = 0;
        for (int i = 0; i < S.length(); i++) {
            if (S.charAt(i) == T.charAt(i)) ans++;
        }
        out.println(ans);
    }
    
}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {
    
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    
    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }
    
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }
    
    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    
    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 23508