akhauriyash/Code-Regression huggingface dataset:
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

/* see https://github.com/pllk/cphb/ */
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
    tree_order_statistics_node_update> indexed_set;

typedef unsigned int uint;
typedef long long ll;
//typedef __int128 lll;

#define fori(n) for(ll i=0; i<(n); i++)
#define forn(i, n) for(ll i=0; i<(n); i++)
#define forn3(i, x, n) for(ll i=(x); i<(n); i++)

int main() {
cin.tie(nullptr);
std::ios::sync_with_stdio(false);
    int n, x;
    cin>>n>>x;

    vector<int> l(n);

    int ans=1;
    ll d=0;
    fori(n) {
        cin>>l[i];
        d+=l[i];
        if(d<=x)
            ans++;
    }

    cout<<ans<<endl;

}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a;
    cin >> a;
    int b;
    cin >> b;
  	
  	int i;
  	i = (a * b) % 2;

  	if (i){
    	cout << "Odd" ;
    }
  	else{
    	cout << "Even";
    }

	return 0;
}


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

#define N_MAX 200000
#define INF 2000000000

long cnt;

void merge(long A[], long left, long mid, long right) {
    long n_left = mid - left;
    long n_right = right - mid;
    long L[N_MAX / 2 + 2], R[N_MAX / 2 + 2];
    for (long i = 0; i < n_left; i++) {
        L[i] = A[left + i];
    }
    L[n_left] = INF;
    for (long i = 0; i < n_right; i++) {
        R[i] = A[mid + i];
    }
    R[n_right] = INF;

    long idx_L = 0;
    long idx_R = 0;
    for (long i = left; i < right; i++) {
        if (L[idx_L] <= R[idx_R]) {
            A[i] = L[idx_L];
            idx_L++;
        }
        else {
            A[i] = R[idx_R];
            cnt += mid + idx_R - i;
            idx_R++;
        }
    }
}

void mergeSort(long A[], long left, long right) {
    if (right - left > 1) {
        long mid = (left + right) / 2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main() {
    long n;
    cin >> n;
    long A[N_MAX];
    for (long i = 0; i < n; i++) {
        cin >> A[i];
    }

    cnt = 0;
    mergeSort(A, 0, n);

    cout << cnt << endl;
    // for (long i = 0; i < n; i++) {
    //     if (i > 0) {
    //         cout << " ";
    //     }
    //     cout << A[i];
    //     if (i == n - 1) {
    //         cout << endl;
    //     }
    // }
}



Measured memory_bytes: 6180
#Buffet

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
sum = 0

for i in range(N):
    sum += B[A[i]-1]
    if i >0 and A[i] == 1 + A[i-1]:
        sum += C[A[i-1]-1]
        
print (sum)


Measured memory_bytes: 3060
/*
 *  author : Atul Anand   
 *  created on : Wed Apr 01 2020
 */

import java.io.*;
import java.util.*;

public class Main{

    public static void main(String[] args) throws IOException {
        int N = in.nextInt();
        int K = in.nextInt();
        int H[] = new int[N];
        for(int i = 0; i < N; i++){
            H[i] = in.nextInt();
        }
        if(K >= N){
            println(0);
        }
        else{
            Arrays.sort(H);
            long sum = 0;
            for(int i = 0; i < N-K; i++){
                sum += H[i];
            }
            println(sum);
        }

        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);

    static void read(int arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextInt(); 
    	} 
    }
    
    static void read(long arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextLong(); 
    	} 
    }
    
    static void read(String arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.next(); 
    	} 
    }
    
    static void print(Object O) {  
    	out.print(O); 
    }
    
    static void println(Object O) { 
    	out.println(O); 
    }
    
    static void println(int arr[]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		print(arr[i]+" "); 
    	} 
    	println(""); 
    }

    static void println(int arr[][]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		println(arr[i]); 
    	}
    }
    
    static void debug(Object O) { 
    	System.out.println(O); 
    }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}

Measured memory_bytes: 58436
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG

 // 深さ優先探索
vector<bool> seen;
int dfs(const Graph &G, ll v) {
    seen[v] = true; // v を訪問済にする
    int score = 0; 

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー

        // 負荷さ優先探索中の処理



        dfs(G, next_v); // 再帰的に探索, 毎回mat渡してええの？
    }
    return score;
} 

/*
//桁数の計算
ll keta(ll num){
  ll ans= 0 ;
  ll rem;

  for (ll i = 4; i >= 0 ; i--){
    rem = pow(10,i);
    ans += (num / rem); 
    num = num % rem;
  }
  return ans;
}
*/

ll Lucas(ll N){
  if (N == 0){
    return 2;
  }else if(N == 1){
    return 1;
  }
  ll ans;
  ans = Lucas(N-1) + Lucas(N-2);

  return ans;

}


int main() {
  ll N;
  cin >> N;
  vector<ll> ans(N+1);
  ans[0] = 2LL;
  ans[1] = 1LL;


  for(ll i =2 ; i <= N; i++){
    ans[i] = ans[i-1] + ans[i-2];
  }

  cout << ans.at(N) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<map>
#include<functional>
using namespace std;
typedef long long int llint;
typedef bool izryt;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int big=1e9;
vector<vector<int>>cost;
vector<pair<int,int>>taxi;//???????????????????????¨?????¢
vector<vector<int>>road;//????????????
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> que;
const int maxR=5000;//?????§???R ?????´?????§???15
int n,k;
void dfs(int ter,int NCS,int met){//ter??? NCS?????? met
	int i,ok=1;
	if(met<0){return;}
	//cout<<"a2";
	if(cost[ter][met]<=NCS){return;}//?????????
	for(i=met;i>=0;i--){if(cost[ter][i]<=NCS){ok=0;break;}cost[ter][i]=NCS;}//??°??????
	if(ok==1){que.push(mp(NCS+taxi[ter].fir,ter));}
	for(i=0;i<road[ter].size();i++){dfs(road[ter][i],NCS,met-1);}
	return;
}
int main(void){
	cin>>n>>k;
	int i,j,a,b;
	//?????????????????????
	cost.res(n);
	taxi.res(n);
	road.res(n);
	for(i=0;i<n;i++){cost[i].res(maxR+1);for(j=0;j<=maxR;j++){cost[i][j]=big;}}
	for(i=0;i<n;i++){cin>>a>>b;taxi[i]=mp(a,b);}
	for(i=0;i<k;i++){cin>>a>>b;a--;b--;road[a].pub(b);road[b].pub(a);}
	que.push(mp(taxi[0].fir,0));//?????????0??????????????§
	while(!que.empty()){
		int town=que.top().sec;
		int now=que.top().fir;
		que.pop();
		dfs(town,now,taxi[town].sec);
	}
	cout<<cost[n-1][0]<<endl;
	return 0;
}

Measured memory_bytes: 101336
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
using namespace std;

int main() {
	string s;
	int ans=0;
	cin>>s;
	for(int i=1;i<s.size();i++){
		if(s[i]!=s[i-1])ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include<algorithm>
using namespace std;
long long n,a1,a2;
long long a[200001],b[200001];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        b[i]=a[i];
    }

    sort(a+1,a+n+1);
    a1=a[n/2+1];
    a2=a[n/2];
    for(int i=1;i<=n;i++)
       if(b[i]<=a2)
            cout<<a1<<endl;
       else if(b[i]>=a1)
            cout<<a2<<endl;
    return 0;
}


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

template <typename T>
void print_vec(const vector<T>& v, bool is_reverse=false, ll num=0){
  if(num == 0) num = (ll)v.size();
  cout << endl; cout << "i=  ";for(ll i=0; i<num; i++) cout << i << "   ";cout << endl;  
  cout << "    ";
  if(is_reverse) for(ll i=num-1; i>=0; i--){ cout<<v[i]; if(i!=0) cout<<"   ";}
  else for(ll i=0; i<num; i++){ cout<<v[i]; if(i!=num-1) cout<<"   ";}
  cout << endl;
}

// template <typename T>
// void print_pairvec(const vector<T> &v, ll num=0){
//   if(num == 0) num = (ll)v.size();
//   cout << endl; for(ll i=0; i<num; i++){ cout << v[i].first << " " << v[i].second << endl;}
// }
template <typename T>
void print_pairvec(const T &_pair, ll num=0){
  cout << endl; for(pair<ll, int> x: _pair){ cout << x.first << " " << x.second << endl;}
}

template <typename T>
void print_vec2(const vector<vector<T>>& v){
  cout << endl; cout << "       ";
  for(ll i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(ll i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(ll j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

const int INF = 1e+5;
int op(int a, int b){return max(a, b);}
// int e(){return -INF;}
int e(){return 0;}
int main(){
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin >> a[i];
  
  const int A_MAX = 3e5 + 5;
  segtree<int, op, e> seg(A_MAX+5);
  // dp[j]: 最後がjであるときのaの部分列の最大長
  for(int i=0; i<n; i++){
    int j = a[i];
    int l = max(0, j-k);
    int r = min(j+k, A_MAX);
    seg.set(j,  seg.prod(l, r+1)+1);
  }

  // int ans = seg.all_prod();
  int ans = seg.prod(0, A_MAX);
  cout << ans <<endl;
  return 0;
  // cout << fixed;//小数点を確実に10桁で表示するためのもの
  // cout << setprecision(10); 
}


Measured memory_bytes: 9584
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    a, b, c = map(int, readline().split())
    if a + b + c - max(a, b, c) == max(a, b, c):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007; // 998244353

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int H,W; cin >> H >> W;
    int c[10][10]; REP(i,10)REP(j,10) cin >> c[i][j];
    int A[H][W]; REP(i,H)REP(j,W) cin >> A[i][j];

    REP(k,10)REP(i,10)REP(j,10) chmin(c[i][j], c[i][k]+c[k][j]);

    int ans = 0;
    REP(i,H)REP(j,W){
        if(A[i][j] == -1) continue;
        ans += c[A[i][j]][1];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

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

//prototype declaration
int iin();
long long llin();
double din();
char cin();
void stin(char *s);
void iout(int i);
void llout(long long i);
void dout(double i);
void cout(char c);
void stout(char *s);
int gcd(int a, int b);
int lcm(int a, int b);
long long llgcd(long long a, long long b);
long long lllcm(long long a, long long b);
int asc(const void *a, const void *b);
int desc(const void *a, const void *b);

//main function
int main() {
    char a[1024], b[1024];
    stin(a);
    stin(b);
    cout(a[0] == b[0] ? 'H' : 'D');
    return 0;
}

//body function
int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

/*
    int型の最大公約数
*/

int gcd(int a, int b) {
    int r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    int型の最小公倍数
*/

int lcm(int a, int b) {
    int r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    long long型の最大公約数
*/

long long llgcd(long long a, long long b) {
    long long r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    long long型の最小公倍数
*/

long long lllcm(long long a, long long b) {
    long long r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    int型の昇順用比較関数
*/

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

/*
    int型の降順用比較関数
*/

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define MOD ((int)(1e9+7))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double

int32_t main()
{
	IOS
	int n,k;cin>>n>>k;
	int ans=0;
	for(int i=1;i<=n-k+1;i++)ans++;
	cout<<ans<<endl;
	
}
	
			
	
	
	
	
	

	

	

	
		


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

public class CSharp
{
    public static void Main()
    {
        Kyopuro chokudai = new Kyopuro();
        chokudai.AtCoder();
    }
}

public class Kyopuro
{
    public void AtCoder()
    {
        int n = int.Parse(Console.ReadLine());
        string[] s = Console.ReadLine().Split(' ');
        int[] b = new int[n];
        for (int i = 0; i < n; i++) b[i] = int.Parse(s[i]);
        int[] a = new int[n];
        int[] x = new int[n];
        bool[] f = new bool[n];
        for(int i=0; i<n; i++)
        {
            for(int j=i; j<n; j++)
            {
                if (b[j] < b[i]) x[i]++;
            }
        }
        int c = n - 1;
        int d = 0;
        bool ans = true;
        for(int i=0; i<n; i++)
        {
            c = n - 1;       
            while (c > -1)
            {
                ans = true;
                d = 0;
                if (!f[c])
                {
                    for (int j = 0; j < c; j++)
                    {
                        if (f[j]) d++;
                    }
                    if (d < b[c] - 1)
                    {
                        ans = false;
                    }
                    d = 0;
                    for(int j=c; j<n; j++)
                    {
                        if (f[j]) d++;
                    }
                    if (d < x[c])
                    {
                        ans = false;
                    }
                }
                else ans = false;
                
                if(ans)
                {
                    a[i] = b[c];
                    f[c] = true;
                    c = 0;
                }
                c--;
            }
        }
        ans = true;
        for (int i = 0; i < n; i++) if (!f[i]) ans = false;
        if (ans)
        {
            for (int i = 0; i < n; i++)
            {
                Console.WriteLine(a[i]);             
            }
        }
        else Console.WriteLine(-1);

    }
    public static void DebugWL(object x) { System.Diagnostics.Debug.WriteLine(x); }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<long long>())
using namespace std;
int main()
{
    speed_up;
    ll a, b, x;
    cin>>a>>b>>x;
    ll c, d;
    a--;
    if(a>=0) c = a/x + 1;
    else c = 0;

    if(b>=0) d = b/x + 1;
    else d = 0;

    cout<<d - c<<endl;




    return 0;

}


Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <queue>
#include <utility>
using namespace std;

int main(void){
   int N,K;
   cin >> N >> K;
   if(N >= 6 && N <=12){
      cout <<  K/2 << endl;
   }else if(N < 6){
     cout << K*0 << endl;
   }else{
     cout << K << endl;
   }
   
 return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  int x=a;
  a=b;
  b=x;
  int y=a;
  a=c;
  c=y;
  cout<<a<<" "<<b<<" "<<c;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    long long n, a[10], i, min, ans;
    cin >> n ;
    for(i=0;i<5;i++){
        cin >> a[i];
        if(i==0) min=a[i];
        else if(a[i]<min) min=a[i];
    }
    if(n%min==0) ans=(n/min)+4;
    else ans=(n/min)+5;
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int N;
	int num[100000]={0};
	cin>>N;
	int jishu=0,oushu=0,numfour=0;
	for(int i=0;i<N;i++){
		cin>>num[i];
		if(num[i]%4==0){
			numfour++;
		}else if(num[i]%2==0){
			oushu++;
		}else{
			jishu++;
		}
	}
	if(oushu){
		jishu++;
	}
	if(jishu-1>numfour){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int n = int.Parse(Console.ReadLine());
			string s = Console.ReadLine();
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			HashSet<int> ans = new HashSet<int>();
			bool[,,] dp = new bool[n + 1, 4, 1000];
			dp[0, 0, 0] = true;
			for (int i = 0; i < n; i++) {
				int x = s[i] - 0x30;
				System.Diagnostics.Debug.WriteLine($"{i + 1}:{x}");
				for (int j = 0; j < 3; j++) {
					for (int k = 0; k < 100; k++) {
						if (dp[i, j, k]) {
							if (!dp[i + 1, j, k]) {
								//System.Diagnostics.Debug.WriteLine($"  dp[{i},{j},{k}] -> dp[{i + 1},{j},{k.ToString().PadLeft(j, '0')}]");
								dp[i + 1, j, k] = true;
							}
							if (!dp[i + 1, j + 1, k * 10 + x]) {
								//System.Diagnostics.Debug.WriteLine($"  dp[{i},{j},{k}] -> dp[{i + 1},{j + 1},{(k * 10 + x).ToString().PadLeft(j + 1, '0')}]");
								dp[i + 1, j + 1, k * 10 + x] = true;
								if (j + 1 == 3) {
									ans.Add(k * 10 + x);
								}
							}
						}
					}
				}
			}
			Console.WriteLine(ans.Count);


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 129376
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


N, X = map(int, input().split())
P = list(map(int, input().split()))

D = set()
for p in P:
    D.add(abs(p - X))

S = sorted(D)

ans = S[0]
for s in S:
    ans = gcd(ans, s)

print(ans)


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

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

    double area;
    area = (double) W * H / 2;
    cout << area << " ";

    if (W == x * 2 && H == y * 2) {
        cout << 1 << endl;
    }
    else {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int main(){
  ll n, m, k;
  cin >> n >> m >> k;
  vector<ll> a(n), suma(n+1);
  rep(i, n) cin >> a[i];
  suma[0] = 0;
  rep(i, n) suma[i+1] = suma[i] + a[i];
  vector<ll> b(m), sumb(m+1);
  rep(i, m) cin >> b[i];
  sumb[0] = 0;
  rep(i, m) sumb[i+1] = sumb[i] + b[i];

  ll ma = 0;
  rep(i, n+1){
    if(suma[i] > k) break;
    ll l = k - suma[i];
    ll j = upper_bound(all(sumb), l) - sumb.begin() - 1;
    chmax(ma, i+j);
  }

  cout << ma << endl;

  return 0;
}


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

int main() {
  int number_n, temp_1, temp_2, i;
  scanf("%d", &number_n);
  int height[number_n];
  for(i = 0; i< number_n; i++) {
    scanf("%d", &height[i]);
  }
  int sum_cost[number_n];
  sum_cost[0] = 0;
  sum_cost[1] = abs(height[0] - height[1]);
  for(i = 2; i < number_n; i++) {
    temp_1 = sum_cost[i-1] + abs(height[i-1] - height[i]);
    temp_2 = sum_cost[i-2] + abs(height[i-2] - height[i]);
    sum_cost[i] = ((temp_1 <= temp_2)? temp_1 : temp_2);
  }
  printf("%d\n", sum_cost[number_n-1]);
  return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int LLI;

string check(int arr[], int n)
{
	for(int j = 0; j < n-1; j++)
		for(int i = 0; i < n-1; i++)
			if( arr[ i*n + j ] - arr[ i*n + j + 1 ] != arr[ (i+1)*n + j ] - arr[ (i+1)*n + j + 1])
				return "No";
	return "Yes";
}
int main()
{
	int arr[9];
	for(int i = 0; i < 3; i++)
		for(int j = 0; j < 3; j++)
			cin >> arr[i*3+j];
	cout << check(arr,3);
}

Measured memory_bytes: 3632
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
int fa[MAXN],a[MAXN],b[MAXN];
int n,m;
int main(){
    SF("%d%d",&n,&m);
    int cnt=0;
    for(int i=1;i<=m;i++){
        SF("%d",&a[i]);
        if(a[i]%2==1)
            cnt++;
    }
    if(m==1){
        PF("%d\n",a[1]);    
        if(a[1]==1)
            PF("1\n1");
        else
            PF("2\n%d %d",a[1]-1,1);
        return 0;
    }
    if(cnt>2){
        PF("Impossible");
        return 0;   
    }
    for(int i=1;i<=m;i++)
        if(a[i]%2==1){
            swap(a[i],a[1]);
            break;
        }
        
    for(int i=m-1;i>1;i--)
        if(a[i]%2==1){
            swap(a[i],a[m]);
            break;  
        }
    for(int i=1;i<=m;i++)
        PF("%d ",a[i]);
    b[1]=a[1]+1;
    for(int i=2;i<m;i++)
        b[i]=a[i];
    b[m]=a[m]-1;
    
    if(b[m]==0)
        m--;
    PF("\n%d\n",m);
    for(int i=1;i<=m;i++)
        PF("%d ",b[i]);
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
#define TEMP(type,x,y) do {temp temp=x,x=y,y=temp}while(0)
const ll INF = (1LL << 50);

int main() {

	int n;
	cin >> n;

	vector<ll>A(n+1);

	ll sum = 0;
	ll even_sum = 0;
	for (int i = 1; i <= n; i++) {
		cin >> A[i];
		if (i % 2 == 0) {
			even_sum += A[i];
		}
		sum += A[i];
	}

	ll x = sum - 2 * even_sum;

	for (int i = 1; i <= n; i++) {
		if (i < n) cout << x << " ";
		else cout << x << endl;
		x = 2 * A[i] - x;
	}

	return 0;

}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
int main(){
    string s, inv, s2, s3;
    cin >> s;
    inv = s;
    bool check = true;
    reverse(inv.begin(), inv.end());
    if (s != inv) check = false;
    s2 = s.substr(0, (s.size() - 1) / 2);
    inv = s2;
    reverse(inv.begin(), inv.end());
    if (s2 != inv) check = false;
    s3 = s.substr((s.size() + 3) / 2 - 1);
    inv = s3;
    reverse(inv.begin(), inv.end());
    if (inv != s3) check = false;
    if (check) cout << "Yes" <<endl;
    else cout << "No" <<endl;
    return 0;
}

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

int N, M, Q;
vector<int> a, b, c, d;

int compute(int prev_pos, vector<int> prev_val) {
    // cout << prev_pos << " / ";
    // for (int i = 0;i < N;i++) {
    //     cout << prev_val[i];
    // }cout << endl;

    if (prev_pos==-1) {
        prev_val[0] = 1;
        return compute(0, prev_val);
    }
    if (prev_pos==N-1) {
        return 0;
    }
    vector<int> val_to_score (M+1, 0);
    for (int i = 0; i < Q;i++) {
        if (b[i]==prev_pos+1) {
            int next_value = prev_val[a[i]] + c[i];
            if (next_value <= M) {
                val_to_score[next_value] += d[i];
            }
        }
    }
    int max_score = 0;
    for (int i = prev_val[prev_pos]; i<=M;i++) {
        if (val_to_score[i] == 0 && i!= prev_val[prev_pos]) continue;
        prev_val[prev_pos+1] = i;
        int score = val_to_score[i] +  compute(prev_pos+1, prev_val);
        if (max_score < score) {
            max_score = score;
        }
    }
    return max_score;
}

int main()
{
    cin >> N >> M >> Q;
    for (int i = 0;i < Q;i++) {
        int ia, ib, ic, id;
        cin >> ia >> ib >> ic >> id;
        a.push_back(ia-1);
        b.push_back(ib-1);
        c.push_back(ic);
        d.push_back(id);
    }
    cout << compute(-1, vector<int>(N, -1))<< endl;
}


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

const int maxn = 100010;
int n, A, B, h[maxn];

int main() {
    scanf("%d %d %d", &n, &A, &B), A -= B;
    for (int i = 1; i <= n; i++) {
        scanf("%d", &h[i]);
    }
    int l = 0, r = 1e9, ans;
    auto chk = [&](int x) {
        long long sum = 0;
        for (int i = 1; i <= n; i++) {
            int r = max(0LL, h[i] - 1LL * x * B);
            sum += (r + A - 1) / A;
        }
        return sum <= x;
    };
    while (l <= r) {
        int mid = (l + r) >> 1;
        chk(mid) ? r = (ans = mid) - 1 : l = mid + 1;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 640
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int A,B,C,D,left=0,right=0;
        A=sc.nextInt();
        B=sc.nextInt();
        C=sc.nextInt();
        D=sc.nextInt();
        left = A+B;
        right = C+D;

        if(left>right) System.out.println("Left");
        else if(right>left) System.out.println("Right");
        else System.out.println("Balanced");

    }
}


Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main() {
	// your code goes here
	int d,n;
	cin>>d>>n;
	if(d==0 && n<100)
	{
	   cout<<n<<endl;
	}
	else if(d==0 && n==100)
	  cout<<"101"<<endl;
	else if(d==1 && n<100)
	  cout<<n*100<<endl;
	else if(d==1 && n==100)
	  cout<<101*100<<endl;
	else if(d==2 && n<100)
	  cout<<n*100*100<<endl;
	else if(d==2 && n==100)
	cout<<101*100*100<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>


using namespace std;

int main(){

  int sum[4]={0,0,0,0}, in;
  char trash;
  string blood;


  while(cin >> in >> trash >> blood){
    if(blood == "AB"){
      sum[0]++;
    }else if(blood == "A"){
      sum[1]++;
    }else if(blood == "B"){
      sum[2]++;
    }else{
      sum[3]++;
    }
  }

  cout << sum[1] << endl << sum[2] << endl << sum[0] << endl << sum[3] << endl;

  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
 int main (void){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if(a!=b&&b!=c){
    if(a!=c){
    printf("No");
    }else{
        printf("Yes");
    }
}else if(a==b&&b==c){
    printf("No");
}else{
    printf("Yes");
}
 }

Measured memory_bytes: 128
# @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-08-14 17:33
# @url:https://atcoder.jp/contests/abc048/tasks/arc064_a
import sys,os
from io import BytesIO, IOBase
import collections,itertools,bisect,heapq,math,string
from decimal import *
# region fastio

BUFSIZE = 8192

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# ------------------------------
def main():
    n,x=map(int,input().split())
    a=list(map(int,input().split()))
    s=a[0]
    ans=0
    for i in range(1,len(a)):
        if s+a[i]>x:
            temp=s+a[i]-x
            ans+=temp
            if temp>=a[i]:
                # ans+=(temp-a[i])
                a[i]=0
            else:
                a[i]=a[i]-temp
        s=a[i]
    print (ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 97412
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

// Morris-Pratt
// https://youtu.be/9MphwmIsO7Q?t=7283
template<typename T>
struct MP {
    int n;
    T t;
    vector<int> a;
    MP() {}
    MP(const T& t): t(t) {
        n = t.size();
        a = vector<int>(n+1);
        a[0] = -1;
        int j = -1;
        for (int i = 0; i < n; ++i) {
            while (j != -1 && t[j] != t[i]) j = a[j];
            j++;
            a[i+1] = j;
        }
    }
    int operator[](int i) { return a[i];}
    vector<int> findAll(const T& s) {
        vector<int> res;
        int j = 0;
        for (int i = 0; i < s.size(); ++i) {
            while (j != -1 && t[j] != s[i]) j = a[j];
            j++;
            if (j == n) {
                res.push_back(i-j+1);
                j = a[j];
            }
        }
        return res;
    }
};

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    
    vector<ll> ax(n);
    vector<ll> bx(n);
    rep(i, n) {
        ax[i] = a[i]^a[(i+1)%n];
        bx[i] = b[i]^b[(i+1)%n];
    }
    ax.insert(ax.end(), ax.begin(), ax.end());
    
    MP<vector<ll>> mp(bx);
    vector<int> match = mp.findAll(ax);
    for (int e:match) {
        if (e>=n) continue;
        ll x = a[e] ^ b[0];
        cout << e << " " << x << endl;
    }
    
    
   
    //cout << ans << endl;
    return 0;
}


Measured memory_bytes: 15460
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n = read_as_vec::<usize>()[0];
    let mut a = read_as_vec::<i64>();

    a.sort();
    a.reverse();

    let mut alice: i64 = 0;
    for i in 0..n{
        if i%2 == 0{
            alice += a[i];
        }else{
            alice -= a[i];
        }
    }

    println!("{}", alice);
}


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

ll po(ll a,ll b) {
	ll res=1;
	while(b>0) {
		if(b&1) res=(res*a)%z;
		b/=2;
		a=(a*a)%z;
	}
	return res;
}
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n,i,f[200000],a[200000],last,ans,tmp;
	cin>>n;
	for(i=0;i<n;i++) f[i]=0;
	for(i=0;i<n;i++) {
		cin>>a[i];
		f[a[i]]++;
	}
	for(i=n-1;i>=0;i--)
		if(f[i]>0) {
			last=i;
			break;
		}
	if(a[0]==0 && f[0]==1) {
		ans=1;
		for(i=0;i<last;i++) {
			tmp=po(f[i],f[i+1]);
			ans=(ans*tmp)%z;
		}
		cout<<ans;
	} else cout<<0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
using namespace std;
using namespace atcoder;
using ll = long long;
template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}
__attribute__((constructor))
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

void solve() {
    int n, m, a, b;
    cin >> n >> m >> a >> b;
    cout << floor_sum(n, m, a, b) << '\n';
}

int main() {
    int t;
    cin >> t;
    while (t--) solve();
}


Measured memory_bytes: 3700
n = int(input())
a = [0] + [int(i) for i in input().split()] + [0]
total = 0
for i in range(n + 1):
    total += abs(a[i]-a[i+1])

for i, v in enumerate(a):
    if i != 0 and i != n + 1:
        h = abs(a[i-1]-a[i]) + abs(a[i] - a[i+1])
        u = abs(a[i-1] - a[i+1])
        print(total - (h-u))


Measured memory_bytes: 14048
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

ll d = 1e9 + 7;
int main(void){
    ll n; cin >> n;
    ll k; cin >> k;
    ll ans = 0;
    for(int i=k; i<=n+1; i++){
        ans += (n+1-i)*i + 1;
        ans %= d;
    }
    cout << ans << endl;
    return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define int long long
#define endl "\n"
const int mod=998244353;

int32_t main()
{
    IOS;
    
    string str;
    cin>>str;
    if(str[2]==str[3] && str[4]==str[5])
        cout<<"Yes";
    else
        cout<<"No";
    
    return 0;
}

Measured memory_bytes: 384
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        int sLen = S.length();
        int tLen = T.length();
        char[] s = S.toCharArray();
        char[] t = T.toCharArray();
        boolean found = false;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < sLen; i++) sb.append('z');
        String res = sb.toString();

        for (int i = 0; i <= sLen - tLen; i++) {
            if (checkSub(i, tLen, s, t)) {
                StringBuilder asb = new StringBuilder();
                for(int j = 0; j < i; j++) {
                    if(s[j] == '?') asb.append('a');
                    else asb.append(s[j]);
                }

                for (int j = i; j < i + tLen; j++) {
                    if(s[j] == '?') asb.append(t[j - i]);
                    else asb.append(s[j]);
                }

                for (int j = i + tLen; j < sLen; j++) {
                    if(s[j] == '?') asb.append('a');
                    else asb.append(s[j]);
                }
                String ans = asb.toString();
                found = true;
                if (res.compareTo(ans) > 0) res = ans;
            }
        }
        if (found) System.out.println(res);
        else System.out.println("UNRESTORABLE");
    }

    public static boolean checkSub(int idx, int tLen, char[]s, char[] t) {
        boolean res = true;
        for(int i = 0; i < tLen; i++) {
            if (s[idx + i] != t[i] && s[idx + i] != '?') {
                res = false;
                break;
            }
        }
//        System.out.println("in st: " + idx + " point: " + res);
        return res;
    }

}


Measured memory_bytes: 21844
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

typedef pair<int,int> P;
typedef long long ll;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
#define MOD 1000000007
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")



/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main() { 
  long long a,b,k;cin>>a>>b>>k;
  if(a < k){
    cout << 0 << " " << max(0LL,b-(k-a)) << endl;
  }else{
    cout << a-k << " " << b << endl;
  }
}

Measured memory_bytes: 256
n, k, q = map(int, input().split())
a = [0] * q

for i in range(q):
    a[i] = int(input())

arr = [0] * n
for i in range(q):
    arr[a[i]-1] += 1

count = 0
for i in range(n):
    score = k - q + arr[i]
    if score > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 8632
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int Q;
    cin>>Q;
    rep(x,0,Q){
        ll A,B;
        cin>>A>>B;
        if(A==B) cout <<A+B-2<<"\n";
        else{
            if(A>B) swap(A,B);
            if(B==A+1){
                cout <<2*A-2<<"\n";
                continue;
            }
            ll t=ll(sqrt(A*B));
            if(A*B==t*t) t--;
            if(t*(t+1)<A*B){
                if(t==A) cout <<A-1+t<<"\n";
                else cout <<A-1+t+1+t-A-1<<"\n";
            }
            else{
                if(t==A)  cout <<A-1+t-1<<"\n";
                else cout <<A-1+t+t-A-1<<"\n";
            }
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll     long long int 
#define pb     push_back
#define umap   unordered_map
#define mod    1000000007
#define all(x) (x).begin(), (x).end()
//__builtin_popcount(x)
//__builtin_parity(x)   =(number of set bits)%2
//__builtin_clz(x)      to count the number of leading  zeroes 
//__builtin_ctz(x)      to count the number of trailing zeroes 
//__gcd(a,b)
using namespace std;
int main()
{
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
 int x;cin>>x;
 if(x>=30)cout<<"Yes";
 else     cout<<"No";
}

Measured memory_bytes: 3648
n,a,b = map(int,input().split())

def add(n,a,b):
    ls = list(str(n))
    pl = sum([int(i) for i in ls])
    if a<= pl and pl<= b:
        return n
    else:
        return 0

flg = 0
for i in range(n+1):
    flg += add(i,a,b)

print(flg)

Measured memory_bytes: 42844
#include "iostream"
#include "math.h"
#include "algorithm"
#include "string"
#include "vector"
#include "iostream"
#include "math.h"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "numeric"
#include "iomanip"
using namespace std;
typedef long long ll;



int main() {
	int n, m;
	cin >> n >> m;
	int problem[100005];
	bool AC[100005] = {};
	int cnt[100005] = {};
	string result[100005];
	for (int i = 1; i <= m; i++) {
		cin >> problem[i] >> result[i];
	}
	ll ac = 0;
	ll wa = 0;
	for (int i = 1; i <= m; i++) {
		if (result[i] == "AC") {
			AC[problem[i]] = 1;
		}
		else {
			if (AC[problem[i]] == 0) {
				cnt[problem[i]]++;
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		if (AC[i] == 1) {
			ac++;
			wa += cnt[i]++;
		}
	}
	cout << ac << " " << wa << endl;
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
template<class T, class T2> inline void chkmax(T &x, const T2 &y) { if(x < y) x = y; }
template<class T, class T2> inline void chkmin(T &x, const T2 &y) { if(x > y) x = y; }
const int MAXN = (1 << 20);
const int inf = (int)1e9;

struct node
{
	int mx, lazy;

	node() { mx = -inf; lazy = -inf; }
	node(int val)
	{
		mx = val;
		lazy = -inf;
	}
};

node temp, broken;

node merge(node l, node r)
{
	temp.mx = max(l.mx, r.mx);
	temp.lazy = -inf;
	return temp;
}

struct segment_tree
{
	node tr[4 * MAXN];

	void push(int l, int r, int idx)
	{
		if(tr[idx].lazy != -inf)
		{
			chkmax(tr[idx].mx, tr[idx].lazy);

			if(l != r)
			{
				chkmax(tr[2 * idx + 1].lazy, tr[idx].lazy);
				chkmax(tr[2 * idx + 2].lazy, tr[idx].lazy);
			}

			tr[idx].lazy = -inf;
		}
	}

	void init(int l, int r, int idx)
	{
		if(l == r)
		{
			tr[idx] = node(-inf);
			return;
		}

		int mid = (l + r) >> 1;
		init(l, mid, 2 * idx + 1);
		init(mid + 1, r, 2 * idx + 2);

		tr[idx] = merge(tr[2 * idx + 1], tr[2 * idx + 2]);
	}

	void update(int qL, int qR, int val, int l, int r, int idx)
	{
		push(l, r, idx);

		if(qL > r || l > qR)
			return;

		if(qL <= l && r <= qR)
		{
			tr[idx].lazy = val;
			push(l, r, idx);
			return;
		}

		int mid = (l + r) >> 1;
		update(qL, qR, val, l, mid, 2 * idx + 1);
		update(qL, qR, val, mid + 1, r, 2 * idx + 2);

		tr[idx] = merge(tr[2 * idx + 1], tr[2 * idx + 2]);
	}

	node query(int qL, int qR, int l, int r, int idx)
	{
		push(l, r, idx);

		if(l > qR || r < qL)
			return broken;

		if(qL <= l && r <= qR)
			return tr[idx];

		int mid = (l + r) >> 1;
		return merge(query(qL, qR, l, mid, 2 * idx + 1), query(qL, qR, mid + 1, r, 2 * idx + 2));
	}
};

template <class T>
struct fenwick
{
	int sz;
	T tr[MAXN];

	void init(int n)
	{
		sz = n + 1;
		memset(tr, 0, sizeof(tr));
	}

	T query(int idx)
	{
		T ans = 0;
		for(; idx >= 1; idx -= (idx & -idx))
			chkmax(ans, tr[idx]);

		return ans;
	}

	void update(int idx, T val)
	{
		if(idx <= 0) return;
		for(; idx <= sz; idx += (idx & -idx))
			chkmax(tr[idx], val);
	}
};


int n, q;
int a[MAXN];
pair<int, int> li[MAXN];

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

	cin >> q;
	for(int i = 0; i < q; i++)
		cin >> li[i].first >> li[i].second;
}

int psum[MAXN];

fenwick<int> t1;
segment_tree t2;

void solve()
{
	auto cmp = [](pair<int, int> f, pair<int, int> s) { return f.second < s.second; };
	sort(li, li + q, cmp);

	t1.init(n + 1);
	t2.init(1, n, 0);

	int answer = 0;
	int cnt = 0;
	
	for(int i = 1; i <= n; i++) cnt += a[i];
	for(int i = 1; i <= n; i++) psum[i] = psum[i - 1] + ((a[i] == 1) ? 1 : -1);

	for(int i = 0; i < q; i++)
	{
		int dp = -inf, l = li[i].first, r = li[i].second;
		chkmax(dp, psum[r] - psum[l - 1] + t1.query(l - 1));
		chkmax(dp, psum[r] + t2.query(l, l, 1, n, 0).mx);

		chkmax(answer, dp);
		t1.update(r, dp);
		t2.update(l, r, dp - psum[r], 1, n, 0);
	}

	cout << cnt - answer << endl;
}

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

	read();
	solve();
	return 0;
}



Measured memory_bytes: 43392