akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
int N;
int A[100000];
int main(){
  int i, j, k, x, y, z;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  sort(A, A+N);
  if(A[0]==A[N-1] && A[N-1]==0){
    wt_L("Yes");
    wt_L('\n');
    return 0;
  }
  if(N%3){
    wt_L("No");
    wt_L('\n');
    return 0;
  }
  if(A[0]==A[N/3-1] && A[N/3]==A[2*N/3-1] && A[2*N/3]==A[N-1]){
    x = A[0];
    y = A[N/3];
    z = A[2*N/3];
    if((x^y^z)==0){
      wt_L("Yes");
      wt_L('\n');
      return 0;
    }
  }
  wt_L("No");
  wt_L('\n');
  return 0;
}
// cLay varsion 20190714-1

// --- original code ---
// int N, A[1d5];
// {
//   int i, j, k;
//   int x, y, z;
//   
//   rd(N,A(N));
//   sort(A, A+N);
// 
//   if(A[0]==A[N-1]==0){
//     wt("Yes");
//     return 0;
//   }
// 
//   if(N%3){
//     wt("No");
//     return 0;
//   }
// 
//   if(A[0]==A[N/3-1] && A[N/3]==A[2N/3-1] && A[2N/3]==A[N-1]){
//     x = A[0];
//     y = A[N/3];
//     z = A[2N/3];
//     if((x^y^z)==0){
//       wt("Yes");
//       return 0;
//     }
//   }
// 
//   wt("No");
// }


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bitset<4000010> f;
int main() {
	long long a,c,j,e=0,b,i,k=0;
	scanf("%d\n",&a);
	f[0]=1;
	for(i=1; i<=a; i++) {
		scanf("%d",&j);
		f|=f<<j;
		k+=j;
	}
	for(i=(k+1)/2;!f[i]; i++);
	cout<<i;
	return 0;
}

Measured memory_bytes: 1664
let () =
    try
        while true do
            let x, y   = Scanf.scanf "%d %d\n" (fun x y -> x, y) in
            let total  = x + y in
            let digits = String.length (string_of_int total) in
            Printf.printf "%d\n" digits
        done
    with
        End_of_file -> ()

Measured memory_bytes: 2408
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
using namespace std;


int main(){
  long long  n,m;
  cin >>n>>m;

  if(n==1 && m==1){ cout <<1<<endl; return 0;}

  if(n==1 || m==1){cout<< max(n,m)-2<<endl;}
  else {cout << (m-2)*(n-2)<<endl;}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
#define OUT(n) cout << (n) << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    while(true) {
        int n, m;
        cin >> n >> m;
        if (n == 0) break;
        vector<vector<pii>> utime(m);
        vector<int> pcount(m);
        int r; cin >> r;
        REP(i,r) {
            int t,p,s,l;
            cin >> t >> p >> s >> l;
            s--;
            if (l == 1) {
                if (pcount[s] == 0) utime[s].push_back({t,0});
                pcount[s]++;
            } else {
                if (pcount[s] == 1) utime[s].back().second = t;
                pcount[s]--;
            }
        }

        int q; cin >> q;
        REP(i,q) {
            int s, e, st;
            cin >> s >> e >> st;
            st--;
            int ans = 0;
            for(auto p:utime[st]) {
                int s2 = s < p.first ? p.first : s;
                int e2 = e > p.second ? p.second : e;
                ans += max(0,e2 - s2);
            }
            cout << ans << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3400
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(final String[] args) {
        final FastScanner scanner = new FastScanner(System.in);
        System.out.println(Math.abs(scanner.nextInt() - 1));
    }

    private static class FastScanner {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(final InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

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

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

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

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

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (final IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }
    }
}


Measured memory_bytes: 32724
#include <cstdio>
#include <cstring>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1e18) + 1;

struct factorial
{
    vector<ll> fac, finv, inv;

    factorial(int n) : fac(2, 1), finv(2, 1), inv(2, 1)
    {
        int i;

        rep(i, 2, n + 1)
        {
            fac.push_back(fac[i - 1] * i % MOD);
            inv.push_back(MOD - inv[MOD % i] * (MOD / i) % MOD);
            finv.push_back(finv[i - 1] * inv[i] % MOD);
        }
    }

    ll comb(int n, int k)
    {
        if (n < k)
        {
            return 0;
        }

        if (n < 0 || k < 0)
        {
            return 0;
        }

        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    ll perm(int n, int k)
    {
        if (n < k)
        {
            return 0;
        }

        if (n < 0 || k < 0)
        {
            return 0;
        }

        return fac[n] * finv[n - k] % MOD;
    }
};

int main(void)
{
    int x, y;
    int i, j;
    int a, b;
    int ans;
    factorial f(1000010);

    cin >> x >> y;

    if ((x + y) % 3 != 0)
    {
        cout << 0 << endl;
        return 0;
    }

    a = (2 * y - x) / 3;
    b = (2 * x - y) / 3;

    cout << f.comb(a + b, a) << endl;
}

Measured memory_bytes: 25020
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

ll GCD(ll a, ll b) {
    return (b > 0) ? GCD(b, a % b) : a;
}

ll LCM(ll a, ll b) {
    return a / GCD(a, b) * b;
}

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n)cin >> a[i];
    int g = a[0];
    int mx = 0;
    rep(i, n){
        mx = max(mx, a[i]);
        g = GCD(g, a[i]);
    }
    if(mx < k){
        cout << "IMPOSSIBLE" << endl;
    }else{
        if(k % g == 0)cout << "POSSIBLE" << endl;
        else cout << "IMPOSSIBLE" << endl;
    }
    
}

Measured memory_bytes: 3792
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin>>n;
  double a[n+1]={};
  double sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }

  double m=sum/n;
  double sa=sum;
  int ans=0;
  for(int i=0;i<n;i++){
    if(abs(a[i]-m)<sa){
      sa=abs(a[i]-m);
      ans=i;
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}

#[allow(unused_macros)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let n = read!(usize);
    let h: Vec<i32> = read![[i32]];

    let mut dp = vec![0; n];
    dp[0] = 0;
    dp[1] = (h[0] - h[1]).abs();

    for i in 2..n {
        let prev2 = dp[i - 2] + (h[i - 2] - h[i]).abs();
        let prev1 = dp[i - 1] + (h[i - 1] - h[i]).abs();
        dp[i] = min(prev1, prev2);
    }

    println!("{}", dp[n - 1]);
}


Measured memory_bytes: 4352
#include <iostream>
#include <set>

using namespace std;

const int MAX_N = 2e5;
int a[MAX_N];

const int MAX_VAL = 1e6;
int f[MAX_VAL + 1];
int s[MAX_VAL + 1];

int main() {
    int n, x;
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> x;
        f[x]++;
    }

    long long ans = 0;
    for (int i = 1; i <= MAX_VAL; i++) {
        ans += (f[i] == 1 && !s[i]);
        for (int j = 1; i * j <= MAX_VAL; j++)
            s[i * j] += f[i];
    } 

    cout << ans;

    return 0;
}


Measured memory_bytes: 11432
#B
strings = input().split(' ')
A = int(strings[0])
B = int(strings[1])
K = int(strings[2])

if A >= K:
    print('{0} {1}'.format(A - K, B))
    
elif A + B > K:
    temp = K - A
    print('0 {0}'.format(B + A - K))
    
else:
    print('0 0')

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

signed main() {
	int h, w, k;
	cin >> h >> w >> k;
	char c[305][305];
	vector<P> a;
    int ans[305][305];
	rep(i, h) {
		rep(j, w) {
			cin >> c[j][i];
			if (c[j][i] == '#') {
				a.push_back({ j,i });
			}
          ans[305][305]=INF;
		}
	}
    if(a[a.size()-1].second!=h-1){
		rep(i,a.size()){
			if(a[i].second==a[a.size()-1].second){
             	c[a[i].first][a[i].second]='.';
				a[i].second=h-1;
            }
          	c[a[i].first][a[i].second]='#';
        }
    }
	int now = 0;
	P nv = { 0,0 };
	rep(i, k) {
		P nnv = nv;
        /*rep(y, h) {
		  	rep(x, w) {
				cout << ans[x][y] + 1 << " ";
			}	
			cout << endl;
		}*/
		for (int y = nv.second; y <= a[now].second; y++) {
			for (int x = nv.first; x <=a[now].first; x++) {
				ans[x][y] = now;
			}
		}
		nnv.first = a[now].first + 1;
		for (int x = a[now].first+1; x < w; x++) {
			bool bou = true;
			for (int y = nv.second; y <= a[now].second; y++) {
				if (c[x][y] == '#') {
					bou = false;
					break;
				}
			}
			if (bou) {
				for (int y = nv.second; y <= a[now].second; y++) {
					ans[x][y] = now;
				}
				nnv.first++;
				if (x == w - 1) {
					nnv.second = a[now].second + 1;
					nnv.first = 0;
				}
			}
			if (!bou) break;
		}
        if(nnv.first>=w){
			nnv.first=0;
            nnv.second=a[now].second+1;
        }
		now++;
		nv = nnv;
      	
	}
	rep(i, h) {
		rep(j, w) {
			cout << ans[j][i] + 1 << " ";
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3056
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <numeric>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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 (b<a) { a=b; return 1; } return 0; }
inline bool Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+" ";
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e17;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,q;
    cin >> n >> q;
    set<ll> num;
    vector<vector<ll>> event;
    ll s,t,x;
    rep(i,n){
        cin >> s >> t >> x;
        vector<ll> a1{s-x,1,x},a2{t-x,-1,x};
        event.push_back(a1);
        event.push_back(a2);
    }
    SORT(event);
    vector<ll> d(q);
    ll index = 0;
    cins(all(d));
    rep(i,2*n){
        while(d[index] < event[i][0] && index < q){
            if (num.empty()) PRINT(-1);
            else PRINT(*num.begin());
            index++;
        }
        if (index == q) break;
        if (event[i][1] == 1) num.insert(event[i][2]);
        if (event[i][1] == -1) num.erase(event[i][2]);
    }
    rep(_,index,q) PRINT(-1);
    return 0;
}


Measured memory_bytes: 35496
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
auto fl = [](auto a, auto b) { assert(b != 0); return a / b - (a % b != 0 && ((a >= 0) != (b >= 0)) ? 1 : 0); };
auto ce = [](auto a, auto b) { assert(b != 0); return a / b + (a % b != 0 && ((a >= 0) == (b >= 0)) ? 1 : 0); };
auto mo = [](auto a, auto b) { assert(b != 0); a %= b; if(a < 0) { a += abs(b); } return a; };
LL gcd(LL a, LL b) { return (b == 0 ? a : gcd(b, a % b)); }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)

// ---- ----

int main() {
	int a, b;
	cin >> a >> b;
	
	cout << 6 - a - b << endl;
	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_5
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string[] strArray = Console.ReadLine().Split(' ');
                int height = int.Parse(strArray[0]);
                int width = int.Parse(strArray[1]);

                if (height == 0 && width == 0)
                {
                    break;
                }

                for (int i = 0; i < height; ++i)
                {
                    // ??????????????????????±???????
                    bool outputSharp = true;
                    if (i % 2 == 0) 
                    {
                        outputSharp = true;
                    }
                    else {
                        outputSharp = false;
                    }

                    // 1?????????
                    for (int h = 0; h < width; ++h)
                    {
                        if (outputSharp)
                        {
                            Console.Write('#');
                        }
                        else
                        {
                            Console.Write('.');
                        }

                        outputSharp = !outputSharp;
                    }
                    Console.WriteLine();
                }

                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 5288
import numpy as np
h, w = map(int, input().split())

A = []
for i in range(h):
    s = list(input())
    if len(set(s)) == 1 and s[0] == ".":
        continue
    else:
        A.append(s)
B = A
c = 0
for i in range(w):
    s = []
    for j in range(len(A)):
        s.append(A[j][i])
    if len(set(s)) == 1 and s[0] == '.':
        B = np.delete(B, i-c, 1)
        c += 1


for i in B:
    a = ""
    for j in i:
        a += j
    print(a)

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

public class Main {

    void solve() {
	int N = sc.nextInt();
	int L = sc.nextInt();

	String[] s = new String[N];

	for (int i = 0; i < N; i++) {
	    s[i] = sc.next();
	}

	Arrays.sort(s);

	for (int i = 0; i < N; i++) {
	    System.out.print(s[i]);
	}
    }

    void print(int[] a) {
	out.print(a[0]);
	for (int i = 1; i < a.length; i++) out.print(" " + a[i]);
	out.println();
    }

    public static void main(String[] args) throws Exception {
	new Main().run();
    }

    MyScanner sc = null;
    PrintWriter out = null;
    public void run() throws Exception {
	sc = new MyScanner(System.in);
	out = new PrintWriter(System.out);
	for (;sc.hasNext();) {
	    solve();
	    out.flush();
	}
	out.close();
    }

    class MyScanner {
	String line;
	BufferedReader reader;
	StringTokenizer tokenizer;

	public MyScanner(InputStream stream) {
	    reader = new BufferedReader(new InputStreamReader(stream));
	    tokenizer = null;
	}
	public void eat() {
	    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
		try {
		    line = reader.readLine();
		    if (line == null) {
			tokenizer = null;
			return;
		    }
		    tokenizer = new StringTokenizer(line);
		} catch (IOException e) {
		    throw new RuntimeException(e);
		}
	    }
	}
	public String next() {
	    eat();
	    return tokenizer.nextToken();
	}
	public String nextLine() {
	    try {
		return reader.readLine();
	    } catch (IOException e) {
		throw new RuntimeException(e);
	    }
	}
	public boolean hasNext() {
	    eat();
	    return (tokenizer != null && tokenizer.hasMoreElements());
	}
	public int nextInt() {
	    return Integer.parseInt(next());
	}
	public long nextLong() {
	    return Long.parseLong(next());
	}
	public double nextDouble() {
	    return Double.parseDouble(next());
	}
	public int[] nextIntArray(int n) {
	    int[] a = new int[n];
	    for (int i = 0; i < n; i++) a[i] = nextInt();
	    return a;
	}
    }
}

Measured memory_bytes: 8148
#include <bits/stdc++.h>
#define int long long
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define inout(s) freopen((string(s) + ".inp").c_str(), "r", stdin),\
		freopen((string(s) + ".out").c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 1e5 + 5, LIM = 1e6 + 5;
int n, m, a[N];
map<int, int> cnt;
signed main() {
	#ifdef BLU
	//in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	fw (i, 0, n) cin >> a[i];
	cnt[0]++;
	int sum = 0, ans = 0;
	fw (i, 0, n) {
		sum += a[i];
		sum %= m;
		ans += cnt[sum];
		cnt[sum]++;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 4992
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
import random
import time
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def score(t):
        n = 26
        v = 0
        minus = sum_ = sum(c)
        last = [0]*n
        for i in range(d):
            ti = t[i]-1
            minus -= (i+1-last[ti])*c[ti]
            v += s[i][ti]-minus
            minus += sum_
            last[ti] = i+1
        return v
    start = time.time()
    d = I()
    c = LI()
    s = LIR(d)
    n = 26
    t = [(i%n)+1 for i in range(d)]
    v = score(t)
    while time.time() < 1.5+start:
        nt = [None]*d
        for i in range(d):
            nti = t[i]
            r = random.random()
            if r > 0.8:
                if r > 0.9:
                    if nti < n:
                        nti += 1
                else:
                    if nti > 1:
                        nti -= 1
            nt[i] = nti
        nv = score(nt)
        if v < nv:
            t = [i for i in nt]
    for i in t:
        print(i)
    return

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


Measured memory_bytes: 80284
#include<iostream>

using namespace std;

int main(){
int a,b,c,x,y,z;
cin>>a;
cin>>b;
cin>>c;

x=a+b;
y=b+c;
z= a+c;
int arr[ ] = {x,y,z};
for(int j=0;j<=3;j++){
for(int k=j+1;k<=2;k++){
if(arr[j]>arr[k]){
int temp = arr[k];
arr[k]=arr[j];
arr[j]=temp;
}
}
}
cout<<arr[0];

return 0;

}

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

using namespace std;
#define ll long long int
stack < char > st;
char str[100005];

int main()
{
    int i,j,len;
    scanf("%s",str);
    len=strlen(str);
    int ans=0;

    for(i=0; i<len; i++)
    {
        if(str[i]=='0')
        {
            if(!st.size()) st.push('0');
            else
            {
                if(st.top()=='1')
                {
                    st.pop();

                    ans+=2;
                }
                else
                {
                    st.push(str[i]);
                }
            }
        }
        else
        {
            if(!st.size()) st.push('1');
            else
            {
                if(st.top()=='0')
                {
                    st.pop();

                    ans+=2;
                }
                else
                {
                    st.push(str[i]);
                }
            }

        }

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


}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
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(b<a){a=b;return 1;}return 0;}

void solve(){
    ll n;cin>>n;
    while(n--){
        string s,t;cin>>s>>t;
        ll l1=s.size(),l2=t.size();
        vvl dp(l1+1,vl(l2+1));
        rep(i,l1)rep(j,l2){
            dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
            if(s[i]==t[j])dp[i+1][j+1]=dp[i][j]+1;
        }
        cout<<dp[l1][l2]<<endl;
    }
}

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



Measured memory_bytes: 10892
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <tuple>
#include <map>
#include <ctime>
#include <cstdlib>
#include <random>
using namespace std;

#define int long long

int N;

void dfs(string s, char mx){
	if(s.length() == N){
		printf("%s\n", s.c_str());
	}
	else{
		for(char c = 'a'; c <= mx; c++){
			dfs(s + c, ((c == mx)?(char(mx+1)):mx));
		}
	}
}

signed main(){
	cin >> N;
	dfs("", 'a');
	return 0;
}

Measured memory_bytes: 1536
k=int(input())

from math import gcd

gcd_sum=[0]*201
ans=0

for i in range(1,k+1):
    for j in range(1,k+1):
        gcd_sum[i]+=gcd(i,j)

for a in range(1,k+1):
    for b in range(1,k+1):
        g=gcd(a,b)
        ans += gcd_sum[g]

print(ans)        

Measured memory_bytes: 9180
#include<iostream>
#include<vector>
#include<algorithm>
#include <tuple>
#include <utility>
#include<string>
#define ll long long
using namespace std;

typedef pair<int, int> pair;

int main(){
    int N=0,M=0;
    int a=0,b=0;
    cin >> N >> M;
    vector<ll> H(N,0);
    vector<ll> A(N,0);
    for(int i = 0; i < N; i++){
        cin >> H[i];
    }
    for(int i = 0; i < M; i++){
        cin >> a >> b;
        A[a-1] = max(A[a-1],H[b-1]);
        A[b-1] = max(A[b-1],H[a-1]);
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
        // cout << A[i]<<endl;
        if(A[i] < H[i])ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1e9,MOD=1e9+7;

int main(){
	long long N; cin>>N;
	for(int n=1;n<=3500;n++){
		for(int w=1;w<=3500;w++){
			long long ue=N*n*w;
			long long sita=4*n*w-N*(w+n);
			if(sita>0){
				if(ue%sita==0){
					long long h=ue/sita;
					cout<<h<<" "<<n<<" "<<w<<endl;
					return 0;
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>                            
#include <algorithm>                           
using namespace std;                           
                                               
int main(){                                    
  int A, B;                                    
  cin >> A >> B;                               
  int x;                                       
  x =( max(A,B) - min(A, B));                  
  if (x%2 == 0) cout << x/2 + min(A,B) << endl;
  else cout << "IMPOSSIBLE" << endl;           
}                                              

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

class Main {

	void solve() {

		char[] a = incharar();
		Arrays.sort(a);
		out.println(String.valueOf(a).equals("abc")? "Yes" : "No");

	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public String instr() {
		return in.next();
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

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

using namespace std;

#define all(x) (x).begin(),(x).end()

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


int main(void){

    ll n, k;
    cin >> n >> k;

    ll ans = 0;
    for(ll i = k; i <= n+1; ++i){
        ans += n * (n+1) / 2 - (n-i) * (n-i+1) / 2 - (i-1) * i / 2 + 1;
        ans %= MOD;
    }

    cout << ans << "\n";

    return 0;
}


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

#define ll long long
#define EPS (ll)1e-9
#define N (ll)(2*1e5)
#define M (ll)(1e9+7)

using namespace std;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    srand(time(NULL));

    string s;

    cin >> s;

    int ones = 0, zeroes = 0;
    for(auto c : s) {
        ones += c == '1' ? 1 : 0;
        zeroes += c == '0' ? 1 : 0;
    }

    cout << 2 * min(ones, zeroes) << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

void solve(){
 ll a,b;
  cin >> a >> b;
  cout << a*b <<endl;
  
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}  

Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
const long long INF = 1LL<<60;

int H, W;
vector<vector<char>> grid(1010, vector<char>(1010));
vector<vector<long long>> numberOfOperation(1010, vector<long long>(1010,INF));
vector<int> dx = {1,0};
vector<int>  dy = {0,1};

long long solve(){
    
    if (grid[0][0] == '#') numberOfOperation[0][0] = 1;
    else numberOfOperation[0][0] = 0;
    
    for(int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            for (int k = 0; k < 2; k++){
                
                int nx = i + dx[k];
                int ny = j + dy[k];
                if (nx >= H || ny >= W) continue;
                
                if (grid[i][j] == '.' && grid[nx][ny] == '#') numberOfOperation[nx][ny] = min(numberOfOperation[nx][ny], numberOfOperation[i][j] + 1);
                else numberOfOperation[nx][ny] = min(numberOfOperation[nx][ny], numberOfOperation[i][j]);
            }
        }
    }
    
    return numberOfOperation[H-1][W-1];
}

int main(void){
    cin >> H >> W;
    
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++) cin >> grid[i][j];
    }
    
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
#define l_ength size
using ll = long long;
const ll infll = (1ll<<60);
const int mod = 1000000007;
using namespace std;

struct edge{
	int from;
	int to;
	ll cost;
};

int main(){
	int n, m; cin >> n >> m;
	ll dist[n][n];
	vector<edge> graph;
	for( int i = 0; i < n; ++i ){
		for( int j = 0; j < n; ++j ){
			dist[i][j] = ( i == j ) ? 0 : infll;
		}
	}
	for( int i = 0; i < m; ++i ){
		int a, b; ll c; cin >> a >> b >> c; --a; --b;
		dist[a][b] = dist[b][a] = c;
		graph.push_back( ( edge ){ a, b, c } );
	}
	for( int k = 0; k < n; ++k ){
		for( int i = 0; i < n; ++i ){
			for( int j = 0; j < n; ++j ){
				dist[i][j] = min( dist[i][j], dist[i][k]+dist[k][j] );
			}
		}
	}
	int ans = 0;
	for( auto e : graph ){
		bool flag = false;
		for( int i = 0; i < n; ++i ){
			for( int j = i+1; j < n; ++j ){
				// この条件は「i → j の最短距離に辺 e が使われる」と同値
				if( dist[i][e.from]+e.cost+dist[e.to][j] == dist[i][j] || dist[i][e.to]+e.cost+dist[e.from][j] == dist[i][j] ){
					flag = true;
				}
			}
		}
		if( !flag ) ++ans;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
# cook your dish here
n,kk = map(int,input().split())	
a = list(map(int,input().split()))
a.sort()

ans = []
k = a[0]
c = 0
for i in range(n):
    if k == a[i]:
        c += 1
    else:
        ans.append(c)
        c = 1
        k = a[i]
    if i == n-1:
        ans.append(c)

ans.sort()
ans = ans[::-1]

if len(ans)<=kk:

    print(0)
else:
    ass = 0
    for i in range(kk,len(ans)):
        ass += ans[i]
    print(ass)


Measured memory_bytes: 24996
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int gcd = 0;
		int[] xDifference = new int[n];
		// 整数nの数だけ標準入力
		for(int i = 0; i < n; i++) {
			xDifference[i] = Math.abs(x - sc.nextInt());
			if(i == 0) {
				gcd = xDifference[i];
			} else {
				gcd = gcd(gcd, xDifference[i]);				
			}
		}
		System.out.println(gcd);
		sc.close();
	}
	// 最大公約数を求めるgcdメソッド
	private static int gcd(int m, int n) {
		if(m < n) {
			return gcd(n, m);
		}
		if(n == 0) {
			return m;
		}
		return gcd(n, m % n);
	}
}

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

using namespace std;

long long digitSum(long long x) {
	long long result = 0;
	while(x != 0) {
		result += x % 10;
		x /= 10;
	}
	return result;
}

int main(void) {
	long long N;
	cin >> N;
	long long result = 10000000000;
	for(long long A = 1; A < N; ++A) {
		long long B = N - A;
		long long t = digitSum(A) + digitSum(B);
		if(t < result) result = t;
	}
	cout << result << '\n';
	return 0;
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    W, a, b = mi()
    if a+W < b:
        print(b-a-W)
    elif b+W < a:
        print(a-b-W)
    else:
        print(0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61508
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

int main() {
	int n;
	while (cin >> n, n) {
		vector<int> a(n);
		for (int& i : a) cin >> i;
		int ans = INT_MAX, b = pow(2.0, n);
		for (int i = 0; i < b; i++) {
			bitset<20> c = i;
			int d = 0;
			for (int j = 0; j < n; j++) {
				if (c[j]) d += a[j];
				else d -= a[j];
			}
			ans = min(abs(d), ans);
		}
		cout << ans << endl;
	}
}


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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    s = S()
    fm = {}

    a = []
    for c in s:
        if '0' <= c <= '9':
            ci = int(c)
            if len(a) > 0 and isinstance(a[-1], int):
                a[-1] = a[-1] * 10 + ci
            else:
                a.append(ci)
        else:
            a.append(c)

    def f(a):
        key = tuple(a)
        if key in fm:
            return fm[key]
        if len(a) == 2:
            fm[key] = [inf,-inf]
            return [inf,-inf]
        for i in range(len(a)):
            if a[i] != '(':
                if i > 0:
                    a = a[i:]
                break
        for i in range(len(a)-1,-1,-1):
            if a[i] != ')':
                a = a[:i+1]
                break
        if len(a) == 1:
            r = [a[0],a[0]]
            fm[key] = r
            return r

        ri = [inf]
        ra = [-inf]
        l = len(a)
        for i in range(1,len(a)-1):
            if not a[i] in ['+','-'] or (i > 1 and a[i-2] == '(') or (i+2 < l and a[i+2] == ')'):
                continue
            fl = f(a[:i])
            fr = f(a[i+1:])
            if a[i] == '+':
                ri.append(fl[0]+fr[0])
                ra.append(fl[1]+fr[1])
            else:
                ri.append(fl[0]-fr[1])
                ra.append(fl[1]-fr[0])

        r = [min(ri), max(ra)]
        fm[key] = r
        return r

    r = f(a)
    # print(r)
    # for k in sorted(fm.keys(), key=lambda x: [len(str(x)), str(x)]):
    #     print('k,fm[k]', ''.join(map(str,k)),fm[k])
    return r[1]


print(main())



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

double pi = 3.141592653589;
double area;
double circum;
double r;

void calc(double *r){
    area = *r * *r * pi;
    circum = 2.0 * *r * pi;
}

int main(int argc, const char * argv[]) {
    cin >> r;
    calc(&r);
    cout << fixed << setprecision(6) << area << " " << fixed << setprecision(6) << circum << endl;

    return 0;
}


Measured memory_bytes: 3300
#include <stdio.h>
int main(){
  int i,j,k,tmp,A[100],n,count=0;

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

for(i=0;i<n-1;i++){
  for(j=n-1;j>i;j--){
    if(A[j]<A[j-1]){
      tmp = A[j];
      A[j] = A[j-1];
      A[j-1] = tmp;
      count++;
    }
    }
  }

  for(k=0;k<n-1;k++){
    printf("%d ",A[k]);
  }
  printf("%d\n",A[n-1]);
  printf("%d\n",count);
  return 0;
}


Measured memory_bytes: 2140
#pragma region

#ifdef LOCAL
#define debug cout
#else
#define debug \
    if (0) cout
#endif

#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
using ll = long long;

template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "[ ";
    for (auto e : v) os << e << " ";
    return os << "]";
}

template <typename T, typename V>
ostream& operator<<(ostream& os, set<T, V> v) {
    os << "{ ";
    for (auto e : v) os << e << " ";
    return os << "}";
}

template <typename T, typename V, typename S>
ostream& operator<<(ostream& os, map<T, V, S> v) {
    os << "{ ";
    for (auto e : v) os << e << " ";
    return os << "}";
}

template <typename T, typename V>
ostream& operator<<(ostream& os, pair<T, V> x) {
    return os << "( " << x.first << ", " << x.second << " )";
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (auto& e : v) is >> e;
    return is;
}

template <typename T, typename V>
istream& operator>>(istream& is, pair<T, V>& x) {
    return is >> x.first >> x.second;
}

void solve();

int main() {
#ifdef LOCAL
    freopen("data.txt", "r", stdin);
#else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    solve();
}

#pragma endregion

void solve() {
    int n, s;
    cin >> n >> s;
    vector<int> a(n);
    cin >> a;
    vector<int> dp(s + 1, 0);
    for (int i = 1; i < dp.size(); ++i) {
        for (int r : a) {
            if (i - r >= 0) {
                dp[i] |= dp[i - r] ^ 1;
            }
        }
    }
    if (dp.back() == 1)
        cout << "First\n";
    else
        cout << "Second\n";
}

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

int main(){
    vector<vector<int>> A(3, vector<int> (3));
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> A[i][j];
        }
        
    }
    int N;
    cin >> N;
    int b[N];
    for (int i = 0; i < N; i++)
    {
        cin >> b[i];
    }
    vector<vector<bool>> select(3, vector<bool> (3, false));
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            for (int k = 0; k < N; k++)
            {
                if (b[k] == A[i][j])
                {
                    select[i][j] = true;
                }
                
            }
            
        }
        
    }
    

    if (select[0][0] && select[0][1] && select[0][2])
    {
        cout << "Yes" << endl;
        return 0;
    }
    if (select[1][1])
    {
        if ((select[0][0] && select[2][2]) || (select[0][2] && select[2][0])
            || (select[1][0] && select[1][2]) || (select[0][1] && select[2][1]))
        {
            cout << "Yes" << endl;
            return 0;
        }
        
    }
    if (select[2][0] && select[2][1] && select[2][2])
    {
        cout << "Yes" << endl;
        return 0;
    }
    if (select[0][0] && select[1][0] && select[2][0])
    {
        cout << "Yes" << endl;
        return 0;
    }
    if (select[0][2] && select[1][2] && select[2][2])
    {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
    
}

Measured memory_bytes: 256
# n= 人数　p = 最初に入っている個数

def solve(n, p):
    tmp = p
    i = 0
    person = [0] * n
    while(1):
        if tmp != 0:
            person[i] += 1
            tmp -= 1
            if person[i] == p:
                return i
        else:
            tmp = person[i]
            person[i] = 0

        i += 1
        if i == n:
            i = 0

ans = []
while(1):
    n, p = map(int,input().split())
    if n == 0 and p == 0:
        for i in ans:
            print(i)

        break
    else:
        ans.append(solve(n, p))



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

#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

ll mpow(ll a, ll b) {
  ll r = 1;
  while (b) {
    if (b & 1) r = r * a;
    a = a * a;
    b >>= 1;
  }
  return r;
}

ll f(ll a) { return pow(a, 1 / 5); }

int main() {
  ll x, t;
  cin >> x;
  set<ll> st;
  unordered_map<ll, ll> mp;
  rep(i, 200) {
    t = pow(i, 5);
    st.insert(t);
    st.insert(t * -1);
    mp[t] = i;
    mp[t * -1] = i * -1;
  }
  for (ll aa : st) {
    for (ll bb : st) {
      if (aa == x + bb && aa != bb) {
        cout << mp[aa] << " " << mp[bb] << endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 4152
#include <bits/stdc++.h>
 using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
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; } 
using ll=long long;
 int main(){
int k,a,b;
   cin>>k>>a>>b;
   for(int i=a;i<b+1;i++){
    if(i%k==0){
    cout<<"OK"<<endl;
      return 0;
    }
   }
   cout<<"NG"<<endl;
}

Measured memory_bytes: 3624
n = int(input())
A = [[0 for i in range(n)] for i in range(n)]
for _ in range(n):
    u, k, *v = [int(i) for i in input().split()]
    for vi in v:
        A[u-1][vi-1] = 1

for i in range(n):
    print(*A[i])


Measured memory_bytes: 6388
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner s=new Scanner(System.in);
		while(s.hasNext()){
			char [][] a=new char[20][20];
			for(int i=0;i<20;i++)
				for(int j=0;j<20;j++)
					a[i][j]='0';
			for(int i=0;i<8;i++){
				String now=s.next();
				for(int j=0;j<8;j++)
					a[i][j]=now.charAt(j);
			}
			char ans=' ';
			
			for(int i=0;i<8;i++){
				for(int j=0;j<8;j++){
					if(a[i][j]=='1'&&a[i][j+1]=='1'&&a[i+1][j]=='1'&&a[i+1][j+1]=='1')ans='A';
					if(a[i][j]=='1'&&a[i+1][j]=='1'&&a[i+2][j]=='1'&&a[i+3][j]=='1')ans='B';
					if(a[i][j]=='1'&&a[i][j+1]=='1'&&a[i][j+2]=='1'&&a[i][j+3]=='1')ans='C';
					if(a[i][j+1]=='1'&&a[i+1][j+1]=='1'&&a[i+1][j]=='1'&&a[i+2][j]=='1')ans='D';
					if(a[i][j]=='1'&&a[i][j+1]=='1'&&a[i+1][j+1]=='1'&&a[i+1][j+2]=='1')ans='E';
					if(a[i][j]=='1'&&a[i+1][j]=='1'&&a[i+1][j+1]=='1'&&a[i+2][j+1]=='1')ans='F';
					if(a[i][j+1]=='1'&&a[i][j+2]=='1'&&a[i+1][j+1]=='1'&&a[i+1][j]=='1')ans='G';
				}
			}
			System.out.println(""+ans);
		}
	}
}

Measured memory_bytes: 11000
// 2011/01/11 Tazoe

#include <iostream>
using namespace std;

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

	for(int x=1; x<=n; x++){
		int s;
		cin >> s;

		cout << "Case " << x << ":" << endl;

		for(int i=0; i<10; i++){
			s = s*s;
			s = (s/100)%10000;
			cout << s << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vi vector<int>
#define vb vector<bool>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
#define mx 500001
using namespace std;
ll mi(ll n,ll m){ll pw=n;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans;}
ll pw(ll a,ll n){ll pw=a;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw;pw = pw*pw;ex>>=1;}return ans;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
void show(ll x){cout<<x<<" ";}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define mkp make_pair
//#define d double
void solve(){
ll h,n;
cin>>h>>n;
ll sum=0,x;
rep(i,0,n) cin>>x,sum+=x;
if(sum>=h) cout<<"Yes";
else cout<<"No";

}
int32_t main(){
FIO;
int t=1;
//cin>>t;
while(t--){
	solve();
}
}



Measured memory_bytes: 256
def divisors(n, sort=False):
    """
    nの約数をO(√n)で列挙する
    """
    d = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            d.append(i)
            if i != n // i:
                d.append(n//i)
    if sort:
        d.sort()
    return d


N = int(input())

cnt = 0
for i in range(1, N + 1):
    if i % 2 == 0:
        continue
    if len(divisors(i)) == 8:
        cnt += 1

print(cnt)

Measured memory_bytes: 3316