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

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1;i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define INF 1000000000
#define PI 3.14159265358979

#define _CRT_SECURE_NO_WARNINGS

using namespace std;

// N, E, S, W
const int dx[4] = { -1, 0,  1,  0 };
const int dy[4] = { 0, 1,  0, -1 };

typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<LL> vll;
//==============================================

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

	list<int> li;
	int n;
	scanf("%d", &n);

	int x;
	char c[20];
	REP(i, n) {
		scanf("%s", &c);

		if (c[0] == 'i') {
			scanf("%d", &x);
			li.push_front(x);
		} else if (c[6] != 'F' && c[6] != 'L') {
			scanf("%d", &x);
			auto it = li.begin();
			while (it != li.end()) {
				if (*it == x) {
					it = li.erase(it);
					break;
				}
				it++;
			}
		} else if (c[6] == 'F') {
			li.pop_front();
		} else if (c[6] == 'L') {
			li.pop_back();
		}
	}

	auto it = li.begin();
	if (it != li.end()) {
		printf("%d", *it);
		it++;
	}
	while (it != li.end()) {
		printf(" %d", *it);
		it++;
	}

	printf("\n");
	return 0;
}

Measured memory_bytes: 34380
// #define int long long
// #define repeat(i, n) for (int i = 0; i < n; ++i)

#include <cmath> // cmath includes sqrt, abs
#include <iostream> // iostream includes cout, endl
#include <string> // string
#include <algorithm> // algorithm includes sort

#include <set>

using namespace std;

int main() {
  bool can = false;
  int num = 0;
  string S;
  string T = "";
  int N;

  int d[26];
  int L;

  cin >> S;
  
  // for (int i = 0; i < N; ++i) cin >> d[i];

  for (int i = 0; i < 26; ++i) d[i] = 0;
  
  for (int i = 0; i < S.length(); ++i) {
    d[S[i] - 'a'] += 1;
  }

  for (int i = 0; i < 26; ++i) {
    if (d[i] == 0) {
      char c = 'a' + i;
      cout << c << endl;
      return 0;
    }
  }

  cout << "None" << endl;
  return 0;
  
  // if (can) cout << "Yes" << endl;
  // else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <string>
#define int long long
#define REP(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define mp make_pair
#define Pii pair< int, int > 
#define Pid pair< int, double > 
#define Pdd pair< double, double > 
#define MOD 998244353
#define EPS 0.00000001

using namespace std;

signed main() {
    string s;
    cin >> s;
    int n = s.size();
    string ans = "Yes";
    REP(i,n/2) {
        if (s[i] != s[i + n/2 + 1]) ans = "No";
        if (s[i] != s[-i + n/2 - 1]) ans = "No";
    }
    cout << ans << "\n";
    return 0;
}

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

using namespace std;

int main(){
    int X;
    int max=1;
    double now;
    cin>>X;

     for(int lop=2; lop<X;lop++){
        for(int lop2=2; lop2<X;lop2++){
            now = pow(double(lop),double(lop2));
            if(now > X){
                break;
            }else{
                if(max < now){
                    //cout<<now<< " "<<lop<<" "<<lop2<<endl;
                    max = int(now);
                }
            }
        }
     }

    cout<<max<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	string tmp;
	while(cin>>tmp){
		rep(i,10){
			string s=tmp;
			int a,b;
			rep(j,s.size()){
				if(s[j]=='X')s[j]=(char)(i+'0');
				if(s[j]=='+')a=j;
				if(s[j]=='=')b=j;
			}
			//3 7
			vector<string>ss(3);
			ss[0]=s.substr(0,a);
			ss[1]=s.substr(a+1,b-a-1);
			ss[2]=s.substr(b+1);
			if(ss[0][0]=='0'&&ss[0].size()>1)continue;
			if(ss[1][0]=='0'&&ss[1].size()>1)continue;
			if(ss[2][0]=='0'&&ss[2].size()>1)continue;
			int keta=0;
 			rep(j,3){
				int t=ss[j].size();
				keta=max(keta,t);
			}
			keta++;
			rep(j,3)while(keta!=ss[j].size())ss[j]="0"+ss[j];
			for(int j=keta-1;j>=0;j--){
				ss[0][j]+=ss[1][j]-'0';
				if(ss[0][j]>'9'){ss[0][j]-=10;ss[0][j-1]++;}
			}
			if(ss[0]==ss[2]){cout<<i<<endl;break;}
			if(i==9)cout<<"NA"<<endl;
		}
	}
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Action<string, int> print = delegate(string s, int tp)
            {
                Console.WriteLine(s + " x " + tp);
            };
            int n;
            string[] line = Console.ReadLine().Split(' ');
            n = Int32.Parse(line[0]);
            var s = new string[n].ToList();
            int[] score = new int[] {0, 0, 0, 0};
            string[] table = new string[] {"AC", "WA", "TLE", "RE"};
            for (int i = 0; i < n; i++)
            {
                string[] line_ = Console.ReadLine().Split(' ');
                s[i] = line_[0];
            }
            
            s.ForEach(delegate(string st)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (st == table[j])
                    {
                        score[j]++;
                    }
                }
            });
            for (int j = 0; j < 4; j++)
            {
                print(table[j], score[j]);
            }

        }
    }
}

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<std::vector<char> > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std; 

int main(void)
{
    int n; cin >> n;
    
    v2_int a_kind(n), a_unkind(n);

    irep(i, n) {
        int a; cin >> a;
        irep(j, a) {
            int x, y; cin >> x >> y;
            if(y) { 
                a_kind[i].push_back(x-1);
            } else {
                a_unkind[i].push_back(x-1);
            }
        }
    }
    
    int ans = 0;
    irep(ai, (1<<n)) {
        v_int p(n, -1);
        queue<int> q;
        
        irep(i, n) {
            if(ai & (1<<i)) {
                q.push(i);
                p[i] = 1;
            }
        }
#if 0
        irep(i, a_kind[ai].size()) {
            //p[a_kind[ai][i]] = 1;        
            /q.push(a_kind[ai][i]);
        }

        irep(i, a_unkind[ai].size()) {
            p[a_unkind[ai][i]] = 0;        
        }
    #endif    
        bool lie = false;
        while(q.size() && lie == false) {
            int x = q.front(); q.pop();
            //cout << x << endl;
            if(p[x] == 0) { continue; }

            irep(i, a_kind[x].size()) {
                //if(p[a_kind[x][i]] == 1) { continue; }

                if(p[a_kind[x][i]] == 0) {
                    lie = true;    
                } 
                if(p[a_kind[x][i]] == -1) {
                    p[a_kind[x][i]] = 1; 
                    q.push(a_kind[x][i]);
                }
            }

            irep(i, a_unkind[x].size()) {
                if(p[a_unkind[x][i]] == 1) {
                    lie = true;    
                } else {
                    p[a_unkind[x][i]] = 0;        
                }
            }
        }
        int cnt = 0;
        irep(i, n) {
            if(p[i] == 1) { cnt++; }
        }
        if(!lie) {
            ans = max(ans, cnt);
        }
    }
    cout << ans << endl;
    return 0;
}
/** atcoder **/


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = 5;
		int na[] = new int[n];
		int ans = 0;
		int min = 10;
		for (int i = 0; i < n; i++)
		{
			na[i] = sc.nextInt();
			if(min > na[i]%10 && 0 != na[i]%10)
			{
				min = na[i]%10;
			}
			ans += (int)(Math.ceil(((double)na[i])/10) * 10);
		}
		if(min != 10) {
			ans = ans - 10 + min;
		}
		

		System.out.println(ans);

	}
}

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

const char YES[] = "Yes";
const char NO[] = "No";

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

  for (int i = 0; i <= X; i++) {
    int legs = i * 2 + (X - i) * 4;
    if (legs == Y) {
      cout << YES << endl;
      return 0;
    }
  }
  cout << NO << endl;

  return 0;
}


Measured memory_bytes: 3632
# https://atcoder.jp/contests/abc143/tasks/abc143_b

N = gets.to_i
ds = gets.split.map(&:to_i)

sum = ds.reduce(&:+)
sqsum = ds.map { |d| d**2 }.reduce(&:+)
ans = (sum**2 - sqsum) / 2

puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")

int main()
{
	fast();

	int N;
	cin >> N;
	vector<ll> a(N), ans(N);

	for (int i = 0; i < N; i++)
	{
		cin >> a[i];
		if (i % 2 == 1)
		{
			ans[0] -= a[i];
		}
		else
		{
			ans[0] += a[i];
		}
	}

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

	for (int i = 0; i < N; i++)
	{
		cout << ans[i] << (i == N - 1 ? "\n" : " ");
	}
}

Measured memory_bytes: 2944
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,L; cin >> N >> L;
    vector<string> S(N);
    REP(i,N) cin >> S[i];
    sort(S.begin(),S.end());

    REP(i,N){
        cout << S[i];
    }
    cout << endl;

}


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

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

const int N=105;
const int MOD=1e9+7;

int n;
int vis[N];
bool bpGraph2[N][N];
pair<int, int> a[N], b[N];

// M is number of applicants and N is number of jobs
#define M 105
#define N 105
 
// A DFS based recursive function that returns true if a
// matching for vertex u is possible
bool bpm(bool bpGraph[M][N], int u, bool seen[], int matchR[])
{
    // Try every job one by one
    for (int v = 0; v < n; v++)
    {
        // If applicant u is interested in job v and v is
        // not visited
        if (bpGraph[u][v] && !seen[v])
        {
            seen[v] = true; // Mark v as visited
 
            // If job 'v' is not assigned to an applicant OR
            // previously assigned applicant for job v (which is matchR[v]) 
            // has an alternate job available. 
            // Since v is marked as visited in the above line, matchR[v] 
            // in the following recursive call will not get job 'v' again
            if (matchR[v] < 0 || bpm(bpGraph, matchR[v], seen, matchR))
            {
                matchR[v] = u;
                return true;
            }
        }
    }
    return false;
}
 
// Returns maximum number of matching from M to N
int maxBPM(bool bpGraph[M][N])
{
    // An array to keep track of the applicants assigned to
    // jobs. The value of matchR[i] is the applicant number
    // assigned to job i, the value -1 indicates nobody is
    // assigned.
    int matchR[N];
 
    // Initially all jobs are available
    memset(matchR, -1, sizeof(matchR));
 
    int result = 0; // Count of jobs assigned to applicants
    for (int u = 0; u < n; u++)
    {
        // Mark all jobs as not seen for next applicant.
        bool seen[N];
        memset(seen, 0, sizeof(seen));
 
        // Find if the applicant 'u' can get a job
        if (bpm(bpGraph, u, seen, matchR))
            result++;
    }
    return result;
}
 
// Driver program to test above functions
int32_t main()
{
	IOS;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].first>>a[i].second;
	}
	for(int i=1;i<=n;i++)
	{
		cin>>b[i].first>>b[i].second;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(a[i].first<b[j].first && a[i].second<b[j].second)
			{
				bpGraph2[j-1][i-1]=1;
			}
		}
	}
 
    cout <<  maxBPM(bpGraph2);
 
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
const LL INF = 1e18;
const int MXN = 5e2;
const int MXV = 0;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define FOR(i, L, R) for (int i = L; i < (int)R; ++i)
#define FORD(i, L, R) for (int i = L; i > (int)R; --i)
#define IOS                                                                    \
    cin.tie(nullptr);                                                          \
    cout.tie(nullptr);                                                         \
    ios_base::sync_with_stdio(false);

int t, ti, n;
long long arr[MXN], dp[MXN][MXN];

int main()
{
    IOS;
    cin >> n;
    arr[0] = 0;
    FOR(i, 0, MXN) FOR(j, 0, MXN) { dp[i][j] = INF; }
    for (int i = 1; i <= n; i++)
    {
        cin >> arr[i];
        dp[i][i] = 0;
        arr[i] += arr[i - 1];
    }
    for (int i = 1; i < n; i++)
    {
        for (int j = 1; i + j <= n; j++)
        {
            for (int k = j; k < i + j; k++)
            {
                dp[j][i + j] = min((j != k) * dp[j][k] +
                                       (k + 1 != i + j) * dp[k + 1][i + j] +
                                       arr[i + j] - arr[j - 1],
                                   dp[j][i + j]);
            }
        }
    }
    cout << dp[1][n] << '\n';
}


Measured memory_bytes: 5548
// 

#include <stdio.h>
int main(void){
    long long int a,b,x,d;
    scanf("%lld %lld %lld\n",&a,&b,&x);
    
    d=b/x-a/x;
    if(a%x==0){
        d++;
    }
    
    printf("%lld\n",d);
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
  int N[10000], x, i, a=0, n, b=0;


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

  for(i=0;i<n;i++){
    for(x=2;x*x<=N[i];x++){
      if(N[i] % x == 0){
	a = 1;
	break;
      }
    }
    if(a==0){
      b++;
    }
    a=0;
  }

  printf("%d\n", b);

  return 0;
}
	
	



Measured memory_bytes: 2048
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm> 
#include<climits>
#include<stack>
#include<queue>
#include<set>
#include<cctype>
#include<bitset> 
using namespace std;

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef pair<int,int> P_ii;
typedef pair<double,double> P_dd;
typedef long long int ll;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

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

const int MOD = 1000000007;
const ll INF = (ll)1e12;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main() {
    int N;
    long long K;
    cin >> N >> K;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];

    ll dp[100][2];
    memset(dp,-1,sizeof(dp));

    dp[45][0] = 0;
    for(int i=44;i>=0;i--){
        ll mask = 1LL << i;

        int num = 0;
        for(int j=0; j < N; j++) if(A[j] & mask) num++;

        if(dp[i+1][1]>=0) chmax(dp[i][1],dp[i+1][1]+mask*max(num,N-num));
        if(dp[i+1][0]>=0) {
            if(K & mask) {
                chmax(dp[i][1],dp[i+1][0]+mask*num);
                chmax(dp[i][0],dp[i+1][0]+mask*(N-num));
            } else {
                chmax(dp[i][0],dp[i+1][0]+mask*num);
            }
        }
    }
    pl(max(dp[0][0],dp[0][1]))    
}

Measured memory_bytes: 1024
#include <cstdio>
#include <vector>
using namespace std;

bool al[26], ok;

int main()
{
	vector<char> vec;
	char S[27];
	int end;
	int i;
	
	scanf("%s", S);
	
	for(i=0; S[i]; i++)
	{
		al[S[i]-'a'] = true;
		vec.push_back(S[i]);
	}
	
	for(i=0; i<26; i++)
	{
		if(!al[i])
		{
			vec.push_back(i+'a');
			ok = true;
			break;
		}
	}
	
	if(!ok)
	{
		while(1)
		{
			end = vec[vec.size()-1];
			
			al[end-'a'] = false;
			vec.pop_back();
			
			if(vec.empty())
			{
				for(i=end-'a'+1; i<26; i++)
				{
					if(!al[i])
					{
						vec.push_back(i+'a');
						ok = true;
						break;
					}
				}
				
				break;
			}
			
			end = vec[vec.size()-1];
			
			for(i=end-'a'+1; i<26; i++)
			{
				if(!al[i])
				{
					vec.pop_back();
					vec.push_back(i+'a');
					ok = true;
					break;
				}
			}
			
			if(ok) break;
		}
	}
	
	if(ok)
	{
		for(i=0; i<vec.size(); i++)
			printf("%c", vec[i]);
	}
	else
	{
		puts("-1");
	}
	
	return 0;
}

Measured memory_bytes: 256
n,w=map(int,input().split())
dp=[[0 for i in range(w+1)] for j in range(n+1)]
for i in range(w):
	dp[0][i]=0
for i in range(n):
	dp[i][0]=0
l=[]
for k in range(n):
	l.append(list(map(int,input().split())))

for i in range(1,n+1):
	for j in range(1,w+1):
		dp[i][j]=dp[i-1][j]
		if(l[i-1][0]<=j):
			dp[i][j]=max(dp[i-1][j-l[i-1][0]]+l[i-1][1],dp[i][j])
print(dp[n][w])


Measured memory_bytes: 219032
#include<iostream>

using namespace std;

int main()
{
  int N, X;
  cin >> N >> X;

  int L[N];

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

  int l=0;
  int counter=1;
  for(int i=0;i<N;i++)
  {
    l += L[i];
    if(l > X)
    {
      break;
    }
    else
    {
      counter++;
    }


  }
  cout << counter;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)
typedef pair<int, string> P;


int main() {
    long long a, b, k;
    cin >> a >> b >> k;

    long long taka, ao;
    taka = 0;
    ao = 0;
    if (a >= k) {
        taka = a - k;
        ao = b;
    }
    else {
        taka = 0;
        ao = b - (k - a);
        if (ao < 0)ao = 0;
    }
    cout << taka << " " << ao << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdio.h>      /* printf */
#include <math.h> 
#include<iostream>
#include <bits/stdc++.h> 
using namespace std;

int main () {
	int n,k,a;
	
	cin>>n>>k;
	int arr[n+1];

	for(int i = 0;i<n;i++){
		cin>>arr[i];
		//cout<<arr[i]<<endl;
	}

	sort(arr,arr+n);

	long long ans = 0;
	for(int i = 0;i<n-k;i++){
		ans += arr[i];
		
	}
	cout<< ans;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int N;
    while(cin >> N){
        vector<long long> A(N);
        long long all = 0;
        for(auto& t : A){
            cin >> t;
            all ^= t;
        }
        int start = 0;
        for(int i=60;i>=0;i--){
            if(all&(1LL<<i)) continue;
            int idx = -1;
            for(int j=start;j<N;j++){
                if(A[j]&(1LL<<i)){
                    idx = j;
                    break;
                }
            }
            if(idx == -1) continue;
            swap(A[start], A[idx]);
            for(int j=0;j<N;j++){
                if(j != start && (A[j]&(1LL<<i))) A[j] ^= A[start];
            }
            ++start;
        }
        long long cur = 0;
        for(int i=0;i<start;i++) cur ^= A[i];
        cout << (2*(cur&~all) + all) << endl;
    }
}

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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

void solve(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    rep(i,0,1000){
        if(i%2==0) c-=b;
        else a-=d;
        if(c<=0){
            cout<<"Yes"<<endl;
            return;
        }
        if(a<=0){
            cout<<"No"<<endl;
            return;
        }
    }
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

vector<int> stones;
int k;

int fill(vector<int> &v, int x){
	if (x == 0){
		stones[x] = 0;
		return stones[x];
	}
	if (stones[x] == -1){
		int s = fill(v,x-1)+abs(v[x-1]-v[x]);
		for (int i = 2; i <= k && x-i >= 0; i++){
			s = min(s, fill(v,x-i)+abs(v[x-i] - v[x]));
		}
		stones[x] = s;
	}
	return stones[x];
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,x;
	cin >> n >> k;
	vector<int> v;
	stones.assign(n,-1);
	for (int i = 0; i < n; i++){
		cin >> x;
		v.push_back(x);
	}
	fill(v,n-1);
	cout << stones[n-1];
}

Measured memory_bytes: 12048
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n, p = map(int, input().split())

prime_factors = []
i = 2
while i ** 2 <= p:
    ext = 0
    while p % i == 0:
        ext += 1
        p //= i
    if ext:
        prime_factors.append((i, ext))
    i += 1
if p != 1:
    prime_factors.append((p, 1))

ans = 1
for pf, num in prime_factors:
    ans *= (pf ** (num // n))
print(ans)


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

int	main()
{
	int	V, E, r;
	cin >> V >> E >> r;
	vector<int64_t>	dist(V, -1);
	Graph	graph(V);
	int	s, t, d;
	for (int i = 0; i < E; ++i) {
		cin >> s >> t >> d;
		graph.at(s).push_back(make_pair(d, t));
	}
	dist.at(r) = 0;
	priority_queue<
		pair<int64_t, int>,
		vector<pair<int64_t, int>>,
		greater<pair<int64_t, int>>
	>	p_que;
	p_que.push(make_pair(0, r));
	int64_t dist_s, cur_dist;
	while (!p_que.empty()) {
		dist_s = p_que.top().first;
		s = p_que.top().second;
		p_que.pop();
		for (auto pr : graph.at(s)) {
			d = pr.first;
			t = pr.second;
			cur_dist = dist_s + d;
			if (dist.at(t) == -1 || dist.at(t) > cur_dist) {
				dist.at(t) = cur_dist;
				p_que.push(make_pair(dist.at(t), t));
			}
		}
	}
	for (int i = 0; i < V; ++i) {
		if (dist.at(i) == -1)
			cout << "INF" << endl;
		else
			cout << dist.at(i) << endl;
	}
}




Measured memory_bytes: 14400
#define _GLIBCXX_DEBUG
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < int(n); ++i)

void Main() {
    int n, q, ans = 0, v;
    cin >> n;
    vector<int> S(n);
    for (auto &e : S) {
        cin >> e;
    }
    cin >> q;
    rep(i, q) {
        cin >> v;
        for (auto &e : S) {
            if (e == v) {
                ++ans;
                break;
            }
        }
    }
    cout << ans << "\n";
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


Measured memory_bytes: 3260
N = int(input())
A = list(map(int, input().split()))

even_numbers = []
count = 0

for a in A:
    if a % 2 == 0:
        even_numbers.append(a)
for a in even_numbers:
    if a % 3 == 0 or a % 5 == 0:
        continue
    else:
        count +=1
if count >= 1:
    print('DENIED')
else:
    print('APPROVED')

Measured memory_bytes: 3060
// 2012/08/08 Tazoe

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
	string ans[10001];

	for(int i=1; i<=10000; i++)
		if(i%15==0)
			ans[i] = "FizzBuzz";
		else if(i%3==0)
			ans[i] = "Fizz";
		else if(i%5==0)
			ans[i] = "Buzz";
		else{
			ostringstream ost;
			ost << i;
			ans[i] = ost.str();
		}

	while(true){
		int m, n;
		cin >> m >> n;

		if(m==0&&n==0)
			break;

		int ply[1000];
		for(int i=0; i<m; i++)
			ply[i] = i+1;

		for(int p=0, i=1; i<=n; i++){
			string s;
			cin >> s;

			if(m==1)		// for AOJ
				continue;

			if(s==ans[i]){
				p = (p+1)%m;
			}
			else{
				for(int j=p; j<m-1; j++)
					ply[j] = ply[j+1];
				m--;
				p = p%m;
			}
		}

		for(int i=0; i<m; i++){
			cout << ply[i];
			if(i==m-1)
				cout << endl;
			else
				cout << ' ';
		}
	}

	return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
  #define debug(...) printf(__VA_ARGS__)
#else
  #define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

#define No() { puts("No"); continue; }
#define Yes() { puts("Yes"); continue; }


int main() {
  int T;
  cin >> T;
  while (T--) {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    if (A < B)
      No();
    if (D < B)
      No();
    //if (C + 1 >= B)
    //  Yes();
    ll g = __gcd(B, D);
    ll t = C + ((A - C) % g + g) % g;
    if (t == C)
      t += g;
    debug("t = %lld\n", t);
    if (t >= B)
      Yes()
    else
      No()
  }
  return 0;
}


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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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


int main()
{
    int N,M;
    cin >> N >> M;

    vector<set<int> > s;
    rep(i,M)
    {
        int k;
        cin >> k;

        set<int> tmp;

        rep(j,k)
        {
            int tmp2;
            cin >> tmp2;
            tmp.insert(tmp2);
        }
            
        s.push_back(tmp);
    }

    vector<int> p(M);
    rep(i,M) cin >> p[i];
    ll ans = 0;

    rep(bit,(1<<N))
    {
        vector<int> S;
        rep(i,N)
        {
            if (bit & (1<<i)) S.push_back(i);
        }

        bool flag = true;
        
        // 電球を確認
        rep(i,M)
        {
            int matched = 0;
            // ついてるスイッチを試す
            for (int j = 0; j < (int)S.size(); ++j)
            {
                if( s[i].find( S[j]+1 ) != s[i].end() ) matched++;
            }
            //cout << "match is " << matched << endl;
            if( ((matched+2)%2 != p[i]) || ((matched+2)%2 != p[i]) )
            {
                //rep(k, S.size()) cout << S[k] << " ";
                //cout << endl;
                flag=false;
            }
        }
        if(flag)ans++;
        //cout << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp> 	// Common file
#include <ext/pb_ds/tree_policy.hpp> 		// Including tree_order_statistics_node_update
#include<bits/stdc++.h>
#define int            		long long
#define x              		first
#define y              		second
#define all(aaa)       		(aaa).begin(),(aaa).end()
#define REP(i,sss,eee) 		for(int i=sss;i<=eee;++i)
#define pb             		push_back
#define pii            		pair<int,int>
#define vi             		vector<int>
#define speed          		ios_base::sync_with_stdio(0);cin.tie(0);
#define N              		1000000007
#define inf					1000000000000000000
using namespace __gnu_pbds;
using namespace std;
template <class T>
T MAX(T a, T b){return ((a>b)?a:b);}
template <class T>
T MIN(T a, T b){return ((a<b)?a:b);}
template <class T>
T MOD(T a){return ((a>=0)?a:(-1*a));}
template <class T>
void SWAP(T &a,T &b){T temp=a;a=b;b=temp;}

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

inline int ex(int a, int b){
	if(b==0||a==1){return 1;}
	if(a==0||b==1){return a;}
	int tmp=ex(a,(b/2));
	if(b%2){return ((((tmp*tmp)%N)*a)%N);}
	else{return ((tmp*tmp)%N);}
}
inline int inv(int k){
	if(k==1){return 1;}
	else{return ex(k,N-2);}
}
#define MAXN 100007
/*****************default********************/
int par[MAXN],size_tree[MAXN];
int pres;
int getPar(int a)
{
    while(par[a]!=a)
    {
        par[a]=par[par[a]];//makes complexity log(log(..(log(n))..))
        a=par[a];
    }
    return a;
}
int bang(int a, int b)
{
    int pa=getPar(a),pb=getPar(b);
    //cout<<a<<" "<<b<<" "<<pa<<" "<<pb<<" "<<size_tree[pa]<<" "<<size_tree[pb]<<"\n";
    if(pa==pb){return 0;}
    pres-=(size_tree[pa]*size_tree[pb]);
    if(size_tree[pa]<size_tree[pb])
    {
        par[pa]=pb;
        size_tree[pb]+=size_tree[pa];
    }
    else
    {
        par[pb]=pa;
        size_tree[pa]+=size_tree[pb];
    }
}
int solve()
{
	int n,m;cin>>n>>m;
	REP(i,0,MAXN-1)
	{
		par[i]=i;size_tree[i]=1;
	}
	std::vector<pii> inp(m);
	REP(i,0,m-1)
	{
		cin>>inp[i].x>>inp[i].y;
	}
	std::vector<int> ans(m);
	pres=((n*(n-1))/2ll);
	ans[m-1]=pres;
	for(int i=m-1;i>0;--i)
	{
		bang(inp[i].x,inp[i].y);
		ans[i-1]=pres;
	}
	for(auto it:ans)
	{
		cout<<it<<"\n";
	}
}
signed main(){
	speed
	int tt=1;
	//cin>>tt;
	while(tt--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 5248
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

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

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

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

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

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

int N, L, T;
int X[100001], W[100001];

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

	priority_queue<tuple<int, int, int>, vector<tuple<int, int, int>>, greater<tuple<int, int, int>>> pq;

	int ans[100001];
	int mini = 0;

	cin >> N >> L >> T;
	rep(i, 0, N)
	{
		cin >> X[i] >> W[i];
		if (W[i] == 1)
		{
			ans[i] = (X[i] + T) % L;
			if (L - X[i] <= T)
			{
				mini -= (T - (L - X[i]) + L) / L;
			}
		}
		else
		{
			ans[i] = (X[i] + (L - 1)*T) % L;
			if (X[i] <= T)
			{
				mini += (T - X[i] + L - 1) / L;
			}
		}
	}

	mini = ((mini%N) + N) % N;

	sort(ans, ans + N);

	rep(i, 0, N)
	{
		cout << ans[(i + (N - 1)*mini) % N] << endl;
	}

	return 0;
}

Measured memory_bytes: 3584
def distance(p1, p2):
    return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])

n, m = map(int, input().split())

student = []
checkpoint = []

for i in range(0, n):
    a, b = map(int, input().split())
    student.append((a, b))

for j in range(0, m):
    c, d = map(int, input().split())
    checkpoint.append((c, d))

for i in range(0, n):
    dist = 100000000000
    ans_num = 0
    for j in range(0, m):
        if distance(student[i], checkpoint[j]) < dist:
            dist = distance(student[i], checkpoint[j])
            ans_num = j + 1
    print(ans_num)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

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

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

vector<ll> fact,inv;

ll f(ll a,ll b, ll p)  // a^b mod pを求める
{
	if (b == 0)
	{
		return 1;
	}else if (b % 2 == 0)
	{
		ll d = f(a,b/2,p);  //a^b = a^(2k) = (a^k)^2  k = b / 2
		return d * d % mod;
	}else
	{
		return a * f(a,b-1,p) % mod;
	}
}

void init(ll n)
{
	fact.resize(n+1,1);
	inv.resize(n+1,1);

	for(int i = 2; i <= n; i++)  //　nまでの階乗を求める
	{
		fact[i] = fact[i-1] * i % mod;
	}
	for(int i = 2; i <= n; i++)  //a^(-1) mod p = a^(p-2) mod p  ここをもう少し早くできるぽい
	{
		inv[i] = f(fact[i],mod-2,mod) % mod;
	}
}

ll comb(ll n,ll k)  //n_C_k
{
	if (n < k)
	{
		return 0;
	}
	return (fact[n] * inv[k] % mod) * inv[n-k] % mod;
}


int main()
{
	ll h,w,a,b;
	cin>>h>>w>>a>>b;

	init(h+w+1);

	ll ans = 0;
	for(int x = 1; x <= h-a; x++){
		ans += comb(x-1+b-1,x-1) * comb(h-x+w-b-1,h-x);
		ans %= mod;
		//cout << ans << endl;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3456
// Problem : E - Coprime
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize("O2")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 1000000007
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
unordered_map<ll,ll> mp;
void primeFactors(ll n)  
{  
	ll flg = 0;
    while (n % 2 == 0)  
    {  
    	flg = 1;  
        n = n/2;  
    }  
    if(flg)
    	mp[2]++;
    for (ll i = 3; i <= sqrt(n); i = i + 2)  
    {  
    	flg = 0;
        while (n % i == 0)  
        {  
            flg = 1;
            n = n/i;  
        }  
        if(flg)
       		mp[i]++;
    }  
    if (n > 2)  
    	mp[n]++;
}
int main()
{
	fast;
	ll t = 1;
	// cin >> t;
	while (t--)
	{
		ll n;
		cin >> n;
		ll a[n];
		for(ll i=0;i<n;i++)
			cin>>a[i];
		ll gcd = a[0];
		for(ll i=1;i<n;i++)
		{
			gcd = __gcd(gcd,a[i]);
		}
		for(ll i=0;i<n;i++)
		{
			primeFactors(a[i]);
		}
		ll flg = 0;
		for(auto i:mp)
		{
			// cout<<i.first<<" "<<i.second<<"\n";
			if(i.second > 1 && i.first != 1)
			{
				flg = 1;
				break;
			}			
		}	
		if(flg == 0)
		{
			cout<<"pairwise coprime\n";
			continue;
		}
		if(gcd != 1)
		{
			cout<<"not coprime\n";
		}
		else
		{
			cout<<"setwise coprime\n";
		}
	}
	return 0;
}


Measured memory_bytes: 14472
import itertools
import math

n=int(input())
p=input().split()
q=input().split()

p0=int(p[0])
q0=int(q[0])

pn=[int(i) for i in p]
qn=[int(i) for i in q]

nums=list(range(1,n+1))

x=[i for i in nums if i!=p0]
p_s=sorted([list(i) for i in itertools.permutations(x, n-1)])
count_x=0
p=int(''.join(p))
for i in p_s:
  if i!=pn[1:]:
    count_x+=1
  else:
    break

y=[i for i in nums if i!=q0]
q_s=sorted([list(i) for i in itertools.permutations(y, n-1)])
count_y=0
q=int(''.join(q))
for i in q_s:
  if i!=qn[1:]:
    count_y+=1
  else:
    break

a=math.factorial(n-1)*(p0-1)+count_x
b=math.factorial(n-1)*(q0-1)+count_y
print(int(((a-b)**2)**0.5))



Measured memory_bytes: 41840
/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader stdReader =
        	new BufferedReader(new InputStreamReader(System.in));
      	String line;
      	
      	line = stdReader.readLine();
      	int x = Integer.parseInt(line);
      	
      	System.out.println(x * x * x);
      	
      	stdReader.close();
	}
}

Measured memory_bytes: 17028
#include <iostream>
#include <string>
#include <vector>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  string A;
  std::cin >> A;
  ll N = A.length(), ans =(N*(N-1))/2+1;
  std::vector<ll> count(26, 0);
  range(i, N) count[A[i]-'a']++;
  range(i, 26) ans -= (count[i]*(count[i]-1))/2;
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 832
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main() {
	int n;
	cin >> n;
	vector<int> h(n), dp(n);
	for(int i = 0; i < n; i++) cin >> h[i];
	dp[1] = abs(h[1] - h[0]);
	for(int i = 2; i < n; i++){
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	cout << dp[n - 1] << endl;
}


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

int main()
{ long long int sum=0,sum2=0;
	int n,i;
	scanf("%d",&n);
	long long int A[n],B[n];
	for(i=0;i<n;i++){scanf("%lld",&A[i]); sum+=A[i];}
	for(i=0;i<n;i+=2){sum2+=A[i];} for(i=1;i<n;i+=2){sum2-=A[i];}
	B[0]=sum2; //printf("%lld\n",sum2);
	for(i=1;i<n;i++){B[i]=2*A[i-1]-B[i-1]; }
	for(i=0;i<n;i++){printf("%lld ",B[i]); }
	

return 0;
}

Measured memory_bytes: 2816
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#include <cstring>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define sz(x) ((int)(x).size())
#define pii pair<int, int>
#define trav(a,x) for (auto& a : x)
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;



int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, d; cin >> n >> d;
    int c = 0;
    FOR(i, 0, n)
    {
        ll a, b; cin >> a >> b;
        double dist = sqrt(pow(a, 2) + pow(b, 2));
        if (dist <= d) c++;
    }
    cout << c;
    return 0;
}

Measured memory_bytes: 3668
A,B,C=map(int,input().split())
M=max(A,B,C)
tmp=M*3
Sum=A+B+C
Check=tmp-Sum
if Check%2==0:
  ans=(tmp-Sum)//2
else:
  tmp2=(M+1)*3
  ans=(tmp2-Sum)//2
print(ans)

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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

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

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

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll a, b, c;
  cin >> a >> b >> c;
  cout << ((a == b && b == c) ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 3580
# (c) midandfeed
n, m = [int(x) for x in input().split()]
a = []
b = []
for _ in range(n):
	z = [int(x) for x in input().split()]
	a.append(z)
	
for _ in range(m):
	b.append(int(input()))
	
for i in range(n):
	ans = 0
	for j in range(m):
		ans += a[i][j]*b[j]
	print(ans)

Measured memory_bytes: 8052
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 

int main(){
    fastio
    int n ; 
    cin >> n ;
    vector<pair<int,int> > v ; 
    int cur = 0 ; 
    for(int i=1;;i++){
    	if ( cur > 1e9 )break;
    	v.push_back({cur,cur+i});
    	cur = cur+i ; 
    }
    int m = (int) v.size() ;
    for(int i=0;i<m;i++){
    	if ( n <= v[i].second ){
    		cout << i + 1 << endl;
    		return 0 ; 
    	}
    }
    return 0 ;
}


Measured memory_bytes: 892
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cstdio>
#include<cstdlib>
using namespace std;


using ll = long long int;

/// <summary>
/// GCDを計算します
/// </summary>
template <typename NumType>
NumType calcGCD(NumType a, NumType b) {
	if (a < b) {
		NumType tmp = a;
		a = b;
		b = tmp;
	}

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

	return b;
}

/// <summary>
/// 約数を数えます
/// </summary>
template <typename NumType>
NumType cntDivisor(const NumType& num) {
	NumType cnt = 0;
	for (NumType i = 1; i * i <= num; ++i) {
		if (num % i == 0) {
			cnt++;
			if (i * i != num) cnt++;
		}
	}

	return cnt;
}

/// <summary>
/// [beg, end)の範囲を，添え字indexでループするfor文に置換します
/// </summary>
#define FOR_RANGE(index, beg, end)     for (ll index = beg; index < N; ++index)

#define DEBUG(x)     std::cout << #x << " : " << x << "\n"



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

	sort(N.begin(), N.end());

	cout << N[0] + N[1] << endl;
}

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll m,n;
    cin >> m >>n;
    if(n % m == 0)cout << n+m << endl;
    else cout << n-m << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int N,X;
  scanf("%d%d",&N,&X);

  int L[N];
  for (int i = 0; i < N; i++) {
    scanf("%d",&L[i]);
  }

  int sum = 0;
  int ans = N+1;
  for (int i = 0; i < N; i++) {
    sum += L[i];
    if(sum > X){
      ans = i+1;
      break;
    }
  }

  printf("%d\n",ans);

  return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
#define MAX 1000000

bool prime[MAX];

int countPrime(int n){
	if(n < 2) return 0;
	if(n == 2) return 1;

	int ret = 0;

	for(int i = 0; i < MAX; i++){
		prime[i] = true;
	}

	for(int i = 2; i * i <= n; i++){
		if(prime[i]){
			for(int j = i*i; j <= n; j += i){
				prime[j] = false;
			}
		}
	}
	for(int i = 2; i <= n; i++){
		if(prime[i]) ret++;
	}
	return ret;
}

int main(){
	int n;
	while(cin >> n){
		cout << countPrime(n) << endl;
	}
}

Measured memory_bytes: 2136