akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int a = sc.nextInt();
        pw.println(10-a/200);
        pw.flush();
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

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

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

    public int nextInt() {
        return Integer.parseInt(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;
    }

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


Measured memory_bytes: 25380
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final long a = in.nextLong();
        final long b = in.nextLong();
        final long c = in.nextLong();
        final long d = in.nextLong();

        final long gcd = gcd(c, d);
        final long target = (c / gcd) * (d / gcd) * gcd;

        final long c1 = (a - 1) / c;
        final long c2 = b / c;

        final long d1 = (a - 1) / d;
        final long d2 = b / d;

        final long t1 = (a - 1) / target;
        final long t2 = b / target;
        System.out.println(b - a + 1 - ((c2 - c1) + (d2 - d1) - (t2 - t1)));
    }

    private static long gcd(long c, long d) {
        if (d > c) {
            return gcd(d, c);
        }

        final long mod = c % d;
        if (mod == 0) {
            return d;
        }
        return gcd(d, mod);
    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string a;
  cin >> a;
  cout << 700 + count(all(a), 'o') * 100 << endl;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    int64_t sum = 0;
    vector<int64_t> d(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
        sum += A.at(i);
    }

    vector<int64_t> x(N);

    x.at(0) = sum;
    for (int j = 1; j < N; j += 2)
    {
        x.at(0) -= A.at(j) * 2;
    }
    for (int i = 1; i < N; i++)
    {
        x.at(i) = 2 * A.at(i - 1) - x.at(i - 1);
    }
    for (int i = 0; i < N; i++)
    {
        cout << x.at(i) << " ";
    }
    cout << endl;
}

Measured memory_bytes: 3328
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize,
    }

    let ans = (1..9 + 1).any(|i| (1..9 + 1).any(|j| i * j == n));

    println!("{}", if ans { "Yes" } else { "No" });
}


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

int main(){
  int N, M;
  cin >> N >> M;
  
  int ans = 0;
  for(int i = 0; i < N+M; i++){
    for(int j = 0; j < N+M; j++){
      if(i != j && ((i < N && j < N) || (i >= N && j >= N))) ans++;
    }
  }
  ans /= 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
using System;

namespace AtCoder{
    public static class AtCoder{
        public static void Main(){
            var input = Console.ReadLine().Split(' ');
            int x = int.Parse(input[0]);
            int y = int.Parse(input[1]);

            for(int i = 0; i <= x; i++){
                if(i * 2 + (x - i) * 4 == y){
                    Console.WriteLine("Yes");
                    return;
                }
            }
            Console.WriteLine("No");
        }
    }
}

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


int main (){   
    int N;
  	ll M;
 	cin >> N >> M;
    vector<ll> A(N);
    for (auto& x : A) cin >> x;
    sort(A.begin(), A.end());
    ll pass = 0, fail = 2 * 1e5 + 10;
    while (fail - pass > 1) {
      ll X = (pass + fail) / 2;
      ll cnt = 0;
      for (int i = 0, j = N - 1; i < N; i++) {
        while (j >= 0 && A[i] + A[j] >= X) --j;
        cnt += N - j - 1;
      }
      if (cnt >= M) {
        pass = X;
      } else {
        fail = X;
      }
    }
    ll res = 0;
    ll sum = 0, rem = M;
    for (int i = 0, j = N - 1; i < N; i++) {
      while (j >= 0 && A[i] + A[j] > pass) {
        sum += A[j];
        --j;
      }
      ll c = N - j - 1;
      rem -= c;
      res += sum + c * A[i];
    }
    res += pass * rem;
    cout << res << endl;
  
 
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n,i,j,flag,ans=1,tmp;
    cin>>n;
    set<int> p;
  	cin>>tmp;
  	p.insert(tmp);
    for(i=1;i<n;i++){
        cin>>tmp;
      	if(tmp <= *p.begin()) ans++;
        p.insert(tmp);
    }
    cout<<ans;
}
 


Measured memory_bytes: 9600
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    
    if (A <= 8 && B <= 8) {
      System.out.println("Yay!");
    } else {
      System.out.println(":(");
    }
  }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
int main(){
	int K, T; cin >> K >> T;
	vector<int> a(T);
	for(int i = 0; i < T; i++) cin >> a[i];
	sort(a.begin(), a.end());
	if(T == 1) cout << a[0] - 1 << endl;
	else {
		int s = 0;
		for(int i = 0; i < T - 1; i++) s += a[i];
		cout << max(a[T - 1] - s - 1, 0) << endl;
	}
	return 0;
}


Measured memory_bytes: 256
n = input()
n_length = len(n)

ans = -1
if int(n) < 10:
    ans = int(n)
else:
    flg = True
    for i in range(1, n_length):
        if n[i] != '9':
            flg = False
            break
    if flg:
        ans = sum(map(int, list(n)))
    else:
        ans = 9 * (n_length - 1) + int(n[0]) - 1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
//#include <stack>
#include <climits>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

int n,X;
int x[100010];
int d[100010];

int euc(int a,int b){
    if(a%b==0){
        return b;
    }else if(b%a==0){
        return a;
    }else if(a>b){
        return euc(b,a%b);
    }else{
        return euc(a,b%a);
    }
}

int main() {
    /*put(euc(10,5));
    return 0;*/
    cin >> n >> X;
    REP(i,n){
        cin >> x[i];
        d[i] = abs(X-x[i]);
    }
    int res;
    if(n==1){
        res = d[0];
    }else{
        res = euc(d[0],d[1]);
        FOR(i,2,n){
            res = euc(res,d[i]);
        }
    }
    put(res);
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
long long x=2,y=2;
int n,ans[100010];
int main()
{
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>ans[i];
    }
    for(int i=n; i>=1; i--)
    {
        x=((x-1)/ans[i]+1)*ans[i];
        y=y/ans[i]*ans[i]+ans[i]-1;
    }
    if(x>y)
    {
        cout<<-1;
    }
    else
    {
        cout<<x<<" "<<y;
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

int main() {
    int N;
    cin >> N;
    priority_queue<P, vector<P>, greater<P>> Q;
    for(int i=0; i<N; ++i) {
        int A, B;
        cin >> A >> B;
        Q.push(P(B, A));
    }

    int t = 0;
    for(int i=0; i<N; ++i) {
        P next = Q.top();
        Q.pop();
        if(t + next.second <= next.first) {
            t += next.second;
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 2420
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 310000
ll MOD=998244353;
ll inv[N];

vector<vec> G(N);
main(){
    int r=in(),g=in(),b=in();
    int n=in();
    int ans=0;
    rep(i,3001)rep(j,3001){
        int res=n-i*r-j*g;
        if(res>=0&&res%b==0){
            ans++;
        }
    }
    cout<<ans;
}



Measured memory_bytes: 7552
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD1 1000000007

int main() {
  ll N;
  cin >> N;
  ll A[N + 1], B[N];
  rep(i, N + 1) cin >> A[i];
  rep(i, N) cin >> B[i];

  ll ans = 0;
  rep(i, N) {
    if (A[i] >= B[i]) {
      ans += B[i];
    }
    else if (A[i] + A[i + 1] >= B[i]) {
      ans += B[i];
      A[i + 1] = A[i + 1] - (B[i] - A[i]);
    }
    else {
      ans += A[i] + A[i + 1];
      A[i + 1] = 0;
    }

  }

  cout << ans << endl;

}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int a[1010000];
int main()
{
    int N, x;
    cin >> N >> x;
    if(N==1)
    {
        cout << "Yes" << endl << 1 << endl;
        return 0;
    }
    if(x==1 || x == 2*N-1)
    {
        cout << "No" << endl;
        return 0;
    }
    if(N==2)
    {
        cout << "Yes" << endl << 1 << endl << 2 << endl << 3 << endl;
        return 0;
    }
    if(x==2)
    {
        a[N-2] = 2; a[N-1] = 1;
        a[N-3] = 3; a[N] = 4;
        int cnt = 5;
        for(int i=0; i<N-3; ++i)
            a[i] = cnt++;
        for(int i=N+1; i<2*N-1; ++i)
            a[i] = cnt++;
    }
    else
    {
        a[N-2] = x; a[N-1] = x+1;
        a[N-3] = 1; a[N] = 2;
        int cnt = 3; if(cnt==x) cnt = x+2;
        for(int i=0; i<N-3; ++i)
        {
            a[i] = cnt;
            if(cnt==x-1) cnt = x+2;
            else ++cnt;
        }
        for(int i=N+1; i<2*N-1; ++i)
        {
            a[i] = cnt;
            if(cnt==x-1) cnt = x+2;
            else ++cnt;
        }
    }
    cout << "Yes" << endl;
    for(int i=0; i<2*N-1; ++i)
        cout << a[i] << endl;
}

Measured memory_bytes: 2304
<?php
$file = fopen('php://stdin', "r");
fscanf($file, "%d", $n);
fscanf($file, "%s", $s);
$ans = 0;

for ($i = 1; $i < $n; $i++) {
    $cnt = 0;

    for ($c = "a"; $c != "aa"; $c++) {
        $left = false;
        $right = false;

        for ($j=0;$j<$i;$j++) {
            if ($s[$j]==$c) {
                $left = true;
            }
        }
        for ($j=$i;$j<$n;$j++) {
            if ($s[$j]==$c) {
                $right = true;
            }
        }
        if($left && $right) {
            $cnt++;
        }
    }
    if($ans<$cnt) {
        $ans = $cnt;
    }
}
echo $ans.PHP_EOL;
?>

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

int main(void) {
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;

  if (0 <= x-r && x+r <= W) {
    if (0 <= y-r && y+r <= H) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;
  return 0;

}


Measured memory_bytes: 3112
#include <map>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int N=405,Mod=1e9+7;
#define ll long long
map <ll ,int > ma;
struct Node{
	int c0,c1,c2,c3;
}a[N];
inline void nxt(Node&a){
	a=(Node){a.c1,a.c2,a.c3,a.c0};
}
inline ll Hash(Node a){
	return (((a.c0*1000ll+a.c1)*1000ll+a.c2)*1000ll+a.c3)*1000ll;
}
inline void insert(Node a,int t){
	for (int i=0;i<4;i++){
		ma[Hash(a)]+=t;
		nxt(a);
	}
}
inline ll q(Node a){
	return ma[Hash(a)];
}
int main (){
	int n;scanf ("%d",&n);ll ans=0;
	for (int i=1,x,y,z;i<=n;i++)
		scanf ("%d%d%d%d",&a[i].c0,&a[i].c1,&a[i].c2,&a[i].c3),insert(a[i],1);
	for (int i=1;i<=n;i++){
		insert(a[i],-1);
		for (int j=i+1;j<=n;j++){
			insert(a[j],-1);
			for (int t=0;t<4;t++){
				Node a1=(Node){a[j].c1,a[i].c0,a[i].c3,a[j].c2};
				Node a2=(Node){a[i].c1,a[j].c0,a[j].c3,a[i].c2};
            	Node a3=(Node){a[j].c1,a[j].c0,a[i].c1,a[i].c0};
    	        Node a4=(Node){a[i].c3,a[i].c2,a[j].c3,a[j].c2};
            	nxt(a[j]);
            	if (q(a1)==0||q(a2)==0||q(a3)==0||q(a4)==0) continue;
				ll re=1;
            	re*=q(a1);insert(a1,-1);
            	re*=q(a2);insert(a2,-1);
            	re*=q(a3);insert(a3,-1);
            	re*=q(a4);
            	insert(a1,1);insert(a2,1);insert(a3,1);
            	ans+=re;
        	}
        	insert(a[j],1);
		}
	}
	printf ("%lld",ans);
	return 0;
}


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

int main(){
    int n;
    cin>>n;
    vector<int>l(n);
    for(int i=0;i<n;i++)cin>>l[i];
    sort(l.begin(),l.end());

    ll sum = 0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            for(int k = j+1;k<n;k++){
                int a = l[i],b = l[j],c = l[k];
                if(a<b+c&&b<c+a&&c<a+b){
                    sum++;
                }
            }
        }
    }
    cout<<sum<<endl;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;


signed main()
{
	int X, Y;
	cin >> X >> Y;

	cout << (X + Y / 2) << endl;
}








Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>



using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}
int abs(int x){
  if(x>=0){
    return x;
  }else{
    return -x;
  }
}

int moji(char in)
{
    int ans = (int)in-(int)'a'+1;
    if((in < 1) || (in > 26)){
        ans = 100;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}





int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);
  int saidai=a[n-1];
  int max=0;
  int erabu=0;
  for(int i=0;i<n;i++){
    int x=min(a[i],saidai-a[i]);
    if(x>max){
      max=x;
      erabu=a[i];

    }

  }
  printf("%d %d\n",saidai,erabu);

  



}


  
  


Measured memory_bytes: 640
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	k := make([]int, m)
	s := make([][]int, m)
	p := make([]int, m)
	for i := range k {
		fmt.Scan(&k[i])
		s[i] = make([]int, k[i])
		for j := range s[i] {
			fmt.Scan(&s[i][j])
			s[i][j]--
		}
	}

	for i := range p {
		fmt.Scan(&p[i])
	}

	ans := 0
	for i := 0; i < (1 << uint(n)); i++ {
		ok := true
		for j := 0; j < m; j++ {
			cnt := counter(i, len(s[j]), s[j])
			if cnt%2 != p[j] {
				ok = false
				break
			}
		}
		if ok {
			ans++
		}
	}
	fmt.Print(ans)
}

func counter(i int, sjLen int, sj []int) int {
	cnt := 0
	for k := 0; k < sjLen; k++ {
		if i&(1<<uint(sj[k])) != 0 {
			cnt++
		}
	}
	return cnt
}


Measured memory_bytes: 512
a,b,c,d = map(int,input().split())

k = 100

la = [0]*(k+1)
lb = [0]*(k+1)

for i in range(a,b+1):
	#print(i)
	la[i] = la[i] + 1

for i in range(c,d+1):
	#print(i)
	lb[i] = lb[i] + 1

ans = 0
for i in range(k+1):
	#print(i)
	if la[i]==lb[i]==1:
		ans = ans + 1

print( ans-1 if ans!=0 else 0)



Measured memory_bytes: 3060
/*
    Created by Ezio112
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define inf ll(10e16)
#define mod ll(10e8+7)
#define ff first
#define ss second
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {
        ll x,year=0,sum=100;
        cin>>x;
        while(sum<x)
        {
            sum=sum+(sum/100);
            ++year;
        }
        cout<<year;
    }
    return 0;
}


Measured memory_bytes: 3644
from heapq import heappush, heappop
import re
from collections import deque
import sys
import math
input = sys.stdin.readline


def int_raw():
    return int(input())


def ss_raw():
    return input().split()


def ints_raw():
    return tuple(map(int, ss_raw()))


DIV = 10**9+7


def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def ncr(n, r, mod=DIV):
	r = min(r, n-r)
	ret = 1
	for i in range(1, r+1):
		ret = ret * (n-i+1) % mod
		ret = ret * mod_inv(i, mod) % mod
	return ret


def main():
    S = input().rstrip("\n")
    dp = [[0 for i in range(13)] for i in range(len(S)+1)]
    dp [0][0] = 1
    modi = 1%13
    for i in range(1,len(S)+1):
        
        s = S[len(S)-i]
        if s!= '?':
            mod_q = (int(s)*modi)%13
            for k in range(13):
                dp[i][(k+mod_q) % 13] = (dp[i][(k+mod_q) % 13]+dp[i-1][k]) % DIV
        else:
            for j in range(10):
                mod_q = (j*modi) % 13
                for k in range(13):
                    dp[i][(k+mod_q) % 13] = (dp[i]
                                             [(k+mod_q) % 13]+dp[i-1][k]) % DIV
        modi = (modi*10)%13
    return dp[len(S)][5]
print(main())


Measured memory_bytes: 66012
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ll n,sum=0;
    cin>>n;
    vec A(n),B(n);
    rep(i,n) cin>>A[i],B[i]=A[i];
    rep(i,1000){
        if(*max_element(all(B))<n){
            cout<<i<<"\n";
            return 0;
        }
        *max_element(all(B))-=n+1;
        rep(j,n) B[j]++;
    }
    rep(i,n) sum+=A[i],A[i]%=n+1;
    ll ans=0;
    rep(i,n+1){
        ll a=0,z=1;
        rep(j,n){
            if((A[j]+i)%(n+1)==n) z=0;
            a+=(A[j]+i)%(n+1);
        }
        if(z) ans=max(a,ans);
    }
    cout<<max(ll(0),sum-ans)<<"\n";
}


Measured memory_bytes: 256
N=int(input())
a=[list(map(int,input().split())) for i in range(N)]
flag=False
for cx in range(101):
    if flag:
        break
    for cy in range(101):
        count=0
        if flag:
            break
        for i in range(N):
            if a[i][2]!=0:
                if count==0:
                    H=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1])
                    count+=1
                if H!=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1]):
                    break
            if i==N-1:
                x=cx
                y=cy
                flag=True
                for k in range(N):
                    if a[k][2]!=max(H-abs(x-a[k][0])-abs(y-a[k][1]),0):
                        flag=False
print(x,y,H)

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

int main() {
	int H,W;
	cin>>H>>W;
	vector<string> a(H);
	vector<bool> row(H),col(W);
	rep(i,H)cin>>a[i];
	rep(i,H){
		rep(j,W){
			if(a[i][j] == '#'){
				row[i] = true;
				col[j] = true;
			}
		}
	}
	rep(i,H){
		if(row[i]){
			rep(j,W){
				if(col[j]){
					cout<<a[i][j];
				}
			}
			cout<<endl;
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){

	int a, b, c, d;
  	cin >> a >> b >> c >> d;
  	if(abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d))
      cout << "Yes" << endl;
  	else
      cout << "No" << endl;
  
	return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int64 a = 0;
  int64 res = 0;
  REP(i, s.size()-1) {
    if (s[i] == 'B' && s[i+1] == 'C') {
      res += a;
      i++;
    } else if (s[i] == 'A') {
      a++;
    } else {
      a = 0;
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 720
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void) {
    int X, Y, Z;
    cin >> X >> Y >> Z;
    swap(X, Y);
    swap(X, Z);
    cout << X << ' ' << Y << ' ' << Z << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;

signed main(){
    int a, b;
    cin >> a >> b;
    if(a + b >= 10) cout << "error" << endl;
    else cout << a + b << endl;
}

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

vector<int> a[10010];

int q(int a, int b) {
	cout << "? " << a << " " << b << endl;
	cout.flush();
	cin >> a;
	return a;
}

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

	int N;
	cin >> N;

	deque<int> d;
	d.push_back(1);
	for(int i = 2; i <= N; i++) {
		int dist = q(1, i);
		a[dist].push_back(i);
	}

	for(int i = 1; i <= N; i++) {
		if(a[i].size() == 0) break;
		if(a[i].size() == 1) {
			int x = a[i][0];
			if(q(d.front(), x) == 1) d.push_front(x);
			else d.push_back(x);
		}
		else {
			int x = a[i][0], y = a[i][1];
			if(q(d.front(), x) == 1) {
				d.push_front(x);
				d.push_back(y);
			}
			else {
				d.push_front(y);
				d.push_back(x);
			}
		}
	}
	cout << "!";
	for(int i = 0; i < d.size(); i++) {
		cout << " " << d[i];
	}
	cout << endl;
	cout.flush();
}

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

using namespace std;

using ll=long long;

void solve() {
    int n; cin >> n;
    int a[3], b[3];
    cin >> a[0] >> a[1] >> a[2];
    cin >> b[0] >> b[1] >> b[2];
    vector<ll> dp(n+1, 0);
    vector<int> v(3);
    for (int i = 0; i < 3; i++) {
        v[i] = b[i] - a[i];
    }
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j < 3; j++) {
            if (a[j] <= i) {
                dp[i] = max(dp[i], dp[i-a[j]] + v[j]);
            }
        }
    }
    int m = n + dp[n];
    dp.assign(m+1, 0);
    for (int i = 0; i <= m; i++) {
        for (int j = 0; j < 3; j++) {
            if (b[j] <= i) {
                dp[i] = max(dp[i], dp[i-b[j]] - v[j]);
            }
        }
    }
    ll res = m + dp[m];
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 195584
#include <bits/stdc++.h>
 
using namespace std;
using LL = long long int; 

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.st <<","<<P.nd <<")";
}

#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int main() {
  string s;
  cin >> s;
  if (s.size() % 2 == 1) {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 0; i < (int)s.size(); i += 2) {
    if (s.substr(i, 2) != "hi") {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 
 ll dp[3005][3005][4] ;
 int main(){
   ll r,c,k ; cin>>r>>c>>k ;
   ll ma[r][c] ;
   rep(i,r){
     rep(j,c) ma[i][j]=0 ;
   }
   rep(i,k){
     ll a,b,c ;cin>>a>>b>>c ;
     a-- ;b-- ;
     ma[a][b]=c ;
   }
 
  rep(i,r+5){
    rep(j,c+5){
      rep(k,4) dp[i][j][k]=0 ;
    }
  }
  
  rep(i,r){
    rep(j,c){
      rep(k,4){ ll base =0 ;
        rep(ww,4) chmax(base,dp[i][j+1][ww]) ;

      if(ma[i][j]==0){
       
        if(k==0) dp[i+1][j+1][k]=max(base,
        dp[i+1][j][k]) ;
        else dp[i+1][j+1][k]=dp[i+1][j][k] ;
      }
       
       else{
         if(k==0) dp[i+1][j+1][k]=max(base,
         dp[i+1][j][k]) ;
         else if(k==1) dp[i+1][j+1][k]=max(base
         +ma[i][j],max(dp[i+1][j][k-1]+ma[i][j],dp[i+1][j][k])) ;
         else dp[i+1][j+1][k]=max(dp[i+1][j][k],dp[i+1][j][k-1]+ma[i][j]) ;

       }

      }
    }
  }
  ll ans=0 ;
  rep(i,4) chmax(ans,dp[r][c][i]) ;
  cout<<ans<<endl ;
  
   return 0 ;
 }



Measured memory_bytes: 356064
import java.util.Scanner;

/**
 * https://beta.atcoder.jp/contests/abc049/tasks/abc049_a
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		char c = sc.next().charAt(0);
		sc.close();
		
		String ans = "consonant";
		switch(c){
		case 'a':
		case 'i':
		case 'u':
		case 'e':
		case 'o':
			ans = "vowel";
		}
		
		System.out.println(ans);

	}

}

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

int main(){
    double a,b,x;
    cin>>a>>b>>x;

    double ans,theta;
    /*
    傾けた水の体積が台形になるとき

    (ab-1/2a*a*tanθ)*a = x
    
    → tanθ = 2*(a*a*b-x)/a*a*a
        θ = arctan(2*(a*a*b-x)/a*a*a)
    */

    /*
    傾けた水の体積が三角形になるとき

    1/2*b*b/tanθ*a = x
    tanθ = ab*b/2*x
    θ = arctan(ab*b/2*x)
    */

    if(x >(a*a*b/2)){
        theta = atan(2*(a*a*b-x)/(a*a*a));
    }
    else{
        theta = atan((a*b*b)/(2*x));
    }

    double PI = M_PI;
    theta = theta*180/PI;

    cout<<setprecision(12)<<fixed<<theta<<endl;

    return 0;

}

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

int main(void)
{
	char b;
	cin >> b;
	if (b == 'A')cout << "T" << endl;
	else if (b == 'T')cout << "A" << endl;
	else if (b == 'G')cout << "C" << endl;
	else cout << "G" << endl;
	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            Println(48 - ReadInt());
        }


        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#define rep(i,n) for(int i=0; i<n;i++)

using namespace std;

int main(){
  int N; cin >> N;
  int D; cin >> D;
  
  int a = (D * 2) + 1;
  int ans = N / a;
  if((N % a) > 0) ans++;
  cout << ans << endl;
}

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

int main(){
  long long N;
  cin >> N;
  vector<long long> A(N);
  for(long long i=0; i<N; i++){
    cin >> A[i];
  }
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  long long ans = A[0];
  for(long long i=1; i<(N-1); i++){
    ans += A[(i+1)/2];
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 4836
using System;
using System.Collections.Generic;

class Problem
{
    public static void Main(string[] args)
    {
      var inputs = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
      int a = inputs[0], b = inputs[1], k = inputs[2];

      var set = new HashSet<int>();
      for (var i = a; i < a + k; i++)
      {
        if (a <= i && i <= b) set.Add(i);
      }
      for (var i = b - k + 1; i <= b; i++)
      {
        if (a <= i && i <= b) set.Add(i);
      }
      foreach (var num in set) Console.WriteLine($"{num}");
    }
}

Measured memory_bytes: 13396
import java.io.*;
import java.util.*;
 
public class Main{
    static class FastReader{
        BufferedReader br; 
        StringTokenizer st; 
        public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));} 
        String next(){while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}}return st.nextToken();} 
        int nextInt(){return Integer.parseInt(next());} 
        long nextLong(){return Long.parseLong(next());} 
        double nextDouble(){return Double.parseDouble(next());} 
        int[] readArray(int n){int[] a=new int[n];for (int i=0; i<n; i++) a[i]=nextInt();return a;}
        long[] readLongArray(int n){long[] a=new long[n];for (int i=0; i<n; i++) a[i]=nextLong();return a;}
        String nextLine(){String str = "";try{str = br.readLine();}catch (IOException e){e.printStackTrace();}return str;} 
    }
    static int getgcd(int n1,int n2){
        while(n1 != n2){
            if(n1 > n2) n1 -= n2;
            else n2 -= n1;
        }
        return n1;
    }
    static boolean isSorted(int[] arr, int n){
        for(int i=1;i<n;i++){
            if(arr[i]<arr[i-1]) return false;
        }
        return true;
    }
    static boolean isPrime(long n){
        if(n==2) return true;
        else if(n%2==0) return false;
        for(int i=3;i<=n/2;i+=2){
            if(n%i==0) return false;
        }
        return true;
    }
    static void printArray(int[] arr){
        for(int x:arr){
            System.out.print(x+" ");
        }
        System.out.println();
    }
    public static void main(String[] args) throws NumberFormatException, IOException {
        FastReader s=new FastReader(); 
        int x=s.nextInt();int n=s.nextInt();
        HashSet<Integer> hs = new HashSet<>();
        for(int i=0;i<n;i++){
            hs.add(s.nextInt());
        }
        boolean test = true;
        if(!hs.contains(x)) System.out.println(x);
        else{
            int i=x,j=x;
            while(test){
                if(!hs.contains(--i)){
                    System.out.println(i);test=false;break;
                }else if(!hs.contains(++j)){
                    System.out.println(j);test=false;break;
                }
            }
        }

    }
}

Measured memory_bytes: 25356
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define endl "\n"
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0)
#define go_t int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define trace2(x, y)         cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)      cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)   cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const ll inf = 1000000000000000000;
const int N = 300000 , mod = 1000000007;
int main()
{
    fastio;
    int n;
    cin>>n;
    ll a[n+1];
    for(int i=1;i<=n;i++)cin>>a[i];
    ll mn = *min_element(a+1,a+n+1);
    if(mn==0)
    {
        cout<<0<<endl;
        return 0;
    }
    ll ans = 1;
    double temp = 1.0;
    for(int i=1;i<=n;i++)
    {
        ans = ans*a[i];
        temp = 1.0*temp*a[i];
    }
    if(ans>inf || temp>inf)
    {
        cout<<-1<<endl;
    }
    else cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4388
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    x, y = map(int, input().split())
    for i1 in range(x + 1):
        if i1 * 2 + (x - i1) * 4 == y:
            print('Yes')
            sys.exit()
    print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 9020
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)

int main(){
	int n,d;
	cin >> n >> d;
	vector<vector<int>> x(n,vector<int>(d));
	
	
	FOR(i,0,n){
		FOR(j,0,d){
			cin >> x.at(i).at(j);
		}
	}
	
	/*
	FOR(j,0,d){
		tmp += (x.at(2).at(j)-x.at(1).at(j))*(x.at(2).at(j)-x.at(1).at(j));
	}	*/
	//cout << floor(sqrt(tmp)) << endl;
	int tmp;
	int ans = 0;
	FOR(i1,0,n){
		FOR(i2,i1+1,n){
			tmp = 0;
			FOR(j,0,d){
				tmp += (x.at(i1).at(j)-x.at(i2).at(j))*(x.at(i1).at(j)-x.at(i2).at(j));
			}
			/*
			cout << "tmp=" << tmp << endl;
			cout << "sqrt=" << sqrt(tmp) << endl;
			cout << "floor=" << floor(sqrt(tmp)) << endl;*/
			if(sqrt(tmp)-floor(sqrt(tmp))==0){
				//cout << "YES" << endl;
				ans++;
				}
			else{
				//cout << "NO" << endl;
			}
				
		 }
	}
	
	cout << ans << endl;
	
	return 0;	
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

    ll operator"" _64(unsigned long long x){ return ll(x); }
    ull operator"" _64u(unsigned long long x){ return ull(x); }

    template<typename T> vector<T> make_vector(size_t sz, T t){
        return vector<T>(sz, t);
    }

    template<typename T,typename... Ts>
    auto make_vector(size_t sz, Ts... ts){
        return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        for (auto &&x : v) { os << x << ' '; } return os ;
    }
}
using namespace utils;

class solver{

public:
    void run(istream &is, ostream& os){
        ll N, X;
        is >> N >> X;
        if(!is) return;
        ll D = 0;
        vector<ll> bounce(1000000, 0);
        bounce[D]++;
        for (int i = 0; i < N; ++i) {
            ll L; is >> L;
            D = D + L;
            bounce[D]++;
        } // end i
        ll ans = 0;
        for (int i = 0; i <= X; ++i) {
            ans += bounce[i];
        } // end i
        cout << ans << endl;

    }
};

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_B.txt";
    cerr << "DEBUG MODE" <<  endl;
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        solver().run(fs, cout);
    }
    cout << "------#" << endl;
    if(lp <= 1) {
        while(cin) solver().run(cin, cout);
    }
#else
    solver().run(cin, cout);
#endif
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+1;
int dp[N][4];
main()
{
    int n;
    scanf("%lld",&n);
    for(int j=1;j<=n;j++){
        for(int i=1;i<=3;i++){
            scanf("%lld",&dp[j][i]);
        }
    }
    for(int j=2;j<=n;j++){
        for(int i=1;i<=3;i++){
            int a=0,b=0,c=0;
            if(i!=1)a=dp[j-1][1];
            if(i!=2)b=dp[j-1][2];
            if(i!=3)c=dp[j-1][3];
            dp[j][i]+=max(a,max(b,c));
        }
    }int ans=0;
    for(int i=1;i<=3;i++){
        ans=max(ans,dp[n][i]);
    }
    printf("%lld",ans);
}


Measured memory_bytes: 3328
#include<stdio.h>
#include <stdlib.h>
int main(void){
    int n,k,x[2][50],y[2][50],d[2][50],a[100],b[100],c[100],i,j,h,m,z,count;
    long long int ans=0LL,surface;
    scanf("%d%d",&n,&k);
    for(i=0; i<n; i++){
        scanf("%d%d%d%d%d%d",&x[0][i],&y[0][i],&d[0][i],&x[1][i],&y[1][i],&d[1][i]);
    }
    for(i=0; i<n; i++){
        for(j=0; j<2; j++){
            a[i*2+j]=x[j][i];
            b[i*2+j]=y[j][i];
            c[i*2+j]=d[j][i];
        }
    }
    n*=2;
    for(i=0; i<n-1; i++){
        for(j=i+1; j<n; j++){
            if(a[i]>a[j]){
                z = a[i];
                a[i] = a[j];
                a[j] = z;
            }
            if(b[i]>b[j]){
                z = b[i];
                b[i] = b[j];
                b[j] = z;
            }
            if(c[i]>c[j]){
                z = c[i];
                c[i] = c[j];
                c[j] = z;
            }
        }
    }
    z = n-1;
    n/=2;
    for(i=0; i<z; i++){
        for(j=0; j<z; j++){
            for(h=0; h<z; h++){
                count=0;
                for(m=0; m<n; m++){
                    if(x[0][m]<=a[i] && x[1][m]>=a[i+1] && y[0][m]<=b[j] && y[1][m]>=b[j+1] && d[0][m]<=c[h] && d[1][m]>=c[h+1]){
                        count++;
                    }
                }
                if(count>=k){
                    surface  = (a[i+1]-a[i]);
                    surface *= (b[j+1]-b[j]);
                    surface *= (c[h+1]-c[h]);
                    ans += surface;
                }
            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 604