akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	int row, col;
	cin >> row >> col;
	vector<vector<int>> tab(row + 1, vector<int>(col + 1));
	rep(r, row + 1) {
		rep(c, col + 1) {
			if (c == col)
				tab[r][c] = accumulate(all(tab[r]), 0);
			else if (r == row) {
				int sum_col = 0;
				rep(i, row + 1)
					sum_col += tab[i][c];
				tab[r][c] = sum_col;
			} else {
				cin >> tab[r][c];
			}
		}
	}
	rep(r, row + 1) {
		rep(c, col + 1) {
			printf("%d%c", tab[r][c], c == col ? '\n' : ' ');
		}
	}
}



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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl
#define mp make_pair
#define pb push_back

const long long MOD = 1000000007;
const long long INF = 1LL<<60;


int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(12);
    string s;
    cin >> s;
    if(s == "SUN"){cout << 7 << endl;}
    if(s == "MON"){cout << 6 << endl;}
    if(s == "TUE"){cout << 5 << endl;}
    if(s == "WED"){cout << 4 << endl;}
    if(s == "THU"){cout << 3 << endl;}
    if(s == "FRI"){cout << 2 << endl;}
    if(s == "SAT"){cout << 1 << endl;}

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            list.add(sc.nextInt());
        }
        Collections.sort(list, Collections.reverseOrder());
        int aliceSum = IntStream.range(0, list.size()).filter(i -> i % 2 == 0).mapToObj(t -> list.get(t)).mapToInt(e -> e).sum();
        int bobSum = IntStream.range(0, list.size()).filter(i -> i % 2 == 1).mapToObj(t -> list.get(t)).mapToInt(e -> e).sum();
         System.out.println(aliceSum - bobSum);
    }
}


Measured memory_bytes: 28628
// -*- coding:utf-8-unix -*-

use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        n: u32,
        mut c: Chars,
    }

    let num_of_red = c.iter().filter(|&a| *a == 'R').count();
    let mut ans = 0;
    for i in 0..num_of_red {
        if c[i as usize] == 'W' {
            ans += 1;
        }
    }

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


Measured memory_bytes: 3032
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int sum = 0;
		int[] T = new int[N];
		for(int i = 0; i < N; i++) {
			T[i] = sc.nextInt();
			sum += T[i];
		}
		int M = sc.nextInt();
		for(int i = 0; i < M; i++) {
			int P = sc.nextInt(), X = sc.nextInt();
			System.out.println(sum - T[P - 1] + X);
		}
	}
}

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

#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9

using namespace std;

/**
 * calculate GCD(greatest common divisor)
 * @param a
 * @param b
 * @return
 */
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

/**
 * change minimum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMinimum(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * change maximum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMaximum(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * output answer
 * @tparam T
 * @param answer
 * @return
 */
template<typename T>
T output(T answer) {
    cout << answer << endl;
    return 0;
}

/** ----from here ---------------------------------------------------------- */

ll X;

int cal(ll a, ll b) {
    ll t = a - b;
    if (X % t == 0) {
        return X / t;
    }
}

int main() {


    cin >> X;

    ll A, B;


    for (int i = -200; i < 200; ++i) {
        for (int j = -200; j < 200; ++j) {
            if (pow(i, 5) - pow(j, 5) == X) {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }

    
    return 0;

}

Measured memory_bytes: 4068
#pragma GCC target ("avx2")
#pragma GCC optimize "trapv"
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define input(a,n) for(ll i1=0;i1<n;i1++)cin>>a[i1]
#define ll long long
#define pi 2 * acos(0.0)
#define vll vector<ll>
#define mll map<ll,ll>
#define pll pair<ll,ll>
#define ull unordered_map<ll,ll>
#define S second
#define sz size()
#define all(v) v.begin(),v.end()
#define Y cout<< "YES"<< "\n"
#define N cout<< "NO"<< "\n"
#define F first
#define mp make_pair
#define pb push_back
#define ld long double
#define mod 1000000007
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
       ll n,d,ans=0;
       cin>>n>>d;
       ll a[n][2];
       for(ll i=0;i<n;i++)
       {
           for(ll j=0;j<2;j++)
           {
               cin>>a[i][j];
           }
           ld p=(ld)sqrt(((ld)pow(a[i][0],2)+(ld)pow(a[i][1],2)));
           if(p<=d)
            ans++;
       }
       cout<<ans<< "\n";
    return 0;
}


Measured memory_bytes: 6760
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<set>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const int INF = 2000000000;

    ll N,K;
    ll A,B,C;
    ll ans=0;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>A>>B>>C>>K;
    REP(i,A+1){
        REP(j,B+1){
            REP(k,C+1){
                int a=i,b=j,c=k;
                if(A==0)a=0;
                if(B==0)b=0;
                if(C==0)c=0;
                if(500*a+100*b+50*c==K)ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  double a,cnt=0;
  int n;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a;
    cnt+=1/a;
  }
  cout << fixed << setprecision(10) << 1/cnt << endl;
}

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

int main() {
    int N; cin >> N;
    vector<long long> tall(N);
    for(int i=0; i<N; i++){
        cin >> tall.at(i);
    }
    long long ans=0;
    
    for(int i=0; i<N-1; i++){
        if(tall.at(i)>tall.at(i+1)){
            ans=ans+(tall.at(i)-tall.at(i+1));
            tall.at(i+1)=tall.at(i);
            
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4820
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>


using namespace std;

using ll = long long;


vector<int> n(3);


int main()
{
	cin >> n[0] >> n[1] >> n[2];

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

	int ans = 0;

	ans += n[2] - n[1];

	n[0] += n[2] - n[1];

	if ((n[2] - n[0]) % 2 == 1) { n[2]++; ++ans; }

	ans += (n[2] - n[0]) / 2;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    // 整数の入力
    int a, b, x;
    cin >> a >> b >> x;
    if (a + b < x)
        cout << "NO" << endl;
    else if (a > x)
        cout << "NO" << endl;
    else
        cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(v) ((ll)v.size())
#define mp make_pair
#define all(a) a.begin(),a.end()
#define F first
#define S second
//#define pii pair<ll,ll> 
const ll mod = 1000000007;
const ll mod1= 1000000009;
const ll base= 2323233;
const ll base1=3424424;
#define MAXN 2000002
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll a[1002][1002],p[1002][1002];
vector<ll> v[2000002];
inline ll nod(ll i,ll j){
  return (1002*min(i,j)+max(i,j));
}
ll vis[2000002],vispar[2000002];
ll dp[2000002];
vector<ll> tops;
void dfs(ll i){
   vis[i]=1;
   vispar[i]=1;
   for(auto it: v[i]){
    if(vispar[it]){
      cout<<-1;
      exit(0);
    }
    if(!vis[it])
    dfs(it);
   }
   vispar[i]=0;
   tops.pb(i);
}
int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);
   ll n,k,i,j;
   cin>>n;
   for(i=1;i<=n;i++){
       for(j=1;j<=n-1;j++){
        ll x;
        cin>>a[i][j];
        p[i][a[i][j]]=j;
       }
   }
   for(i=1;i<=n;i++)
    for(j=1;j<n-1;j++)
          v[nod(i,a[i][j])].pb(nod(i,a[i][j+1]));
   for(i=1;i<=n;i++)
   for(j=1;j<n-1;j++)
   if(!vis[nod(i,a[i][j])])
   dfs(nod(i,a[i][j]));
   set<ll> s;
   ll ans=0;
   for(auto it: tops){
    dp[it]=1;
    for(auto yt: v[it]){
      dp[it]=max(dp[it],dp[yt]+1);
    }
    ans=max(ans,dp[it]);
   }
   cout<<ans;
   

}

 

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

int main() {
    int N;
    cin >> N;
    vector<int> L(N);
    for(int i = 0; i < N;i++)cin >> L[i];
    sort(L.begin(),L.end());
    int con;
    int ans = 0;
    for(int i = 0; i < N;i++){
        for(int j = i + 1; j < N; j++){
            con = lower_bound(L.begin(),L.end(),L[i]+L[j])-L.begin() - 1;
            ans += max(0,con - j);
        }
    }
    cout << ans << endl;
}

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

const int INF = 1e7;

int n, a[55];

int main(){
  
  cin>>n;
  
  int mina = INF, maxa = -INF;
  
  for(int i=0;i<n;i++){
    
    cin>>a[i];
    
    mina = min( mina, a[i] );
    maxa = max( maxa, a[i] );
  }
  
  int idx1, idx2;

  for(int i=0;i<n;i++){
    if( mina == a[i] ) idx1 = i;
    if( maxa == a[i] ) idx2 = i;
  }
  
  vector<int> A, B;
  
  if( mina > 0 && maxa > 0 ){
    
    for(int i=1;i<n;i++){
      A.push_back(i);
      B.push_back(i+1);
    }
        
  }
  else if( mina < 0 && maxa < 0 ){
    
    for(int i=n-2;i>=0;i--){
      A.push_back(i+2);
      B.push_back(i+1);
    }    
    
  }
  else{
    
    if( abs(mina) < abs(maxa) ){
      
      for(int i=0;i<n;i++){
	A.push_back(idx2+1);
	B.push_back(i+1);
      }
      
      for(int i=1;i<n;i++){
	A.push_back(i);
	B.push_back(i+1);
      }
      	
    }else{

      for(int i=0;i<n;i++){
	A.push_back(idx1+1);
	B.push_back(i+1);
      }
      
      for(int i=n-2;i>=0;i--){
	A.push_back(i+2);
	B.push_back(i+1);
      }    
      
    }
    
  }
  
  cout<<(int)A.size()<<endl;

  for(int i=0;i<(int)A.size();i++) cout<<A[i]<<' '<<B[i]<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main(){
   int n;
   cin>>n;
   if(n%2==0) cout<<n/2-1<<endl;
   else cout<<n/2<<endl; 
   
    return 0;
}

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

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


Measured memory_bytes: 512
N = int(input())
a = [int(x) for x in input().split()]
# st=["non","inc","dec"]
st = "non"
ans = 1
for i in range(1, N):
    if st == "non":
        if a[i-1] < a[i]:
            st = "inc"
        if a[i-1] > a[i]:
            st = "dec"
    elif st == "inc":
        if a[i-1] > a[i]:
            st = "non"
            ans += 1
    elif st == "dec":
        if a[i-1] < a[i]:
            st = "non"
            ans += 1
print(ans)


Measured memory_bytes: 14252
#include<stdio.h>

int main(){
	int la = 0, lb = 0, lc = 0, ld = 0, ra = 0, rb = 0, rc = 0, rd  = 0;
	double left, right;
	while(scanf("%lf %lf", &left, &right) != EOF){
		if(left < 0.2) ld++;
		else if(left < 0.6) lc++;
		else if(left < 1.1) lb++;
		else la++;
		if(right < 0.2) rd++;
		else if(right < 0.6) rc++;
		else if(right < 1.1) rb++;
		else ra++;
	}
	printf("%d %d\n%d %d\n%d %d\n%d %d\n", la, ra, lb, rb, lc, rc, ld, rd);
	return 0;
}

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

using namespace std;

class HASH {
    int mod, base;
    vector<int> p = {1} , hashes;

    int mul(int a , int b) {
        return a * 1ll * b % mod;
    }

    int add(int a , int b) {
        a += b;
        while (a >= mod) a -= mod;
        while (a < 0) a += mod;
        return a;
    }

public:
    HASH(int _mod , int _base) : mod(_mod), base(_base) {}

    void push_back(int x) {
        int h = hashes.size() ? hashes.back() : 0;
        hashes.push_back(add(mul(h , base) , x));
        p.push_back(mul(p.back() , base));
    }

    int get(int l , int r) {
        assert(l <= r && r < hashes.size());
        if (!l) return hashes[r];
        return add(hashes[r] , -mul(p[r - l + 1] , hashes[l - 1]));
    }
};

struct D_HASH {
    const int B1 = 256;
    const int B2 = 128;
    const int MOD1 = 2000000011;
    const int MOD2 = 1000000007;

    array<HASH , 2> h;
    D_HASH() : h{HASH(MOD1 , B1) , HASH(MOD2 , B2)} {}
    
    void push_back(int x) {
        h[0].push_back(x);
        h[1].push_back(x);
    }

    array<int , 2> get(int l , int r) {
        assert(l <= r);
        return {h[0].get(l , r) , h[1].get(l , r)};
    };
};


int n;
bool good(int len , D_HASH &dh) {
    map<array<int , 2> , int> exist;
    vector<array<int , 2> > v(n);

    for (int i = 0 ;i + len - 1 < n ;i++)
        v[i] = dh.get(i , i + len - 1);

    for (int i = len ;i + len - 1 < n ;i++)
        exist[v[i]]++;

    if (exist[v[0]])
        return 1;

    int r = len;
    while (r < n) {
        exist[v[r]]--;
        if (exist[v[r - len + 1]])
            return 1;
        r++;
    }

    return 0;
}

int main() {
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
   
    string s;
    cin >> n >> s;

    D_HASH dh;
    for (char &c : s)
        dh.push_back(c);

    int l = 1 , r = n , ans = 0;
    while (l <= r) {
        int mid = (l + r) / 2;
        if (good(mid , dh)) {
            ans = mid;
            l = mid + 1;
        } else {
            r = mid - 1;
        }
    }

    cout << ans;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1 LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
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 (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    LL N;cin >> N;
    vector<LL> L(N);
    rep(i,N)cin >> L[i];

    sort(all(L));
    LL ct = 0;
    rep(i,N)for(int j = i+1;j < N;j++)for(int k = j+1;k < N;k++){
        if(L[k] < (L[i]+L[j]) && (L[i] != L[j]) && (L[j] != L[k]) && (L[i] != L[k]))ct++;
    }
    cout << ct << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define ALL(a) a.begin(), a.end()
#define REP(i,a) for(ll i(0), _##i(a); i < _##i; ++i)
#define FOR(i,a,b) for(ll i(a), _##i(b); i <= _##i; ++i)
using namespace std;
using ll = long long;

void solve(){
    string s;
    cin >> s;
    cout << (s[2] == s[3] && s[4] == s[5] ? "Yes\n" : "No\n");
}

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

    int T = 1;
    //cin >> T;
    FOR(i,1,T){
        solve();
    }
}


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

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)
typedef long long ll;

// 配列初期化テンプレ
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}


vector<int> c;
vector<vector<int>> s;

int calc_score(vector<int> &schedule) {
	int score = 0;
	vector<int> last_d(27, 0);
	for (int i = 1; i < schedule.size(); i++) {
		score += s[i][schedule[i]];
		last_d[schedule[i]] = i;
		for (int j = 1; j < 27; j++) {
			score -= c[j] * (i - last_d[j]);
		}
		cout << score << endl;
	}
	return score;
}


int main() {

	int D;
	cin >> D;

	c.resize(27);
	for (int i = 0; i < 26; i++) {
		cin >> c[i+1];
	}

	s.resize(D+1);
	for (int i = 0; i < D; i++) {
		s[i + 1].resize(27);
	}

	for (int i = 0; i < D; i++) {
		for (int j = 1; j < 27; j++) {
			cin >> s[i+1][j];
		}
	}


	vector<int> schedule(D+1);
	for (int i = 0; i < D; i++) {
		cin >> schedule[i+1];
	}

	calc_score(schedule);

	return 0;
}


Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main(){
    int n,a,b,kokunai=0,kaigai=0;
    cin>>n>>a>>b;
    string s;
    cin>>s;
    for(int i = 0; i < n ; i++)
    {
        switch (s[i])
        {
            case 'a':
                if(kokunai+kaigai<a+b){cout<<"Yes"<<endl;kokunai++;}
                else cout<<"No"<<endl;
                break;
            case 'b':
                if(kokunai+kaigai<a+b&&kaigai<b){cout<<"Yes"<<endl;kaigai++;}
                else cout<<"No"<<endl;
                break;
            default:cout<<"No"<<endl;break;
        }
    }
    return 0;
}

Measured memory_bytes: 896
N = int(input())
a = list(map(int,input().split()))

import numpy as np
mean = np.mean(a)
lst = []
for i in range(N):
  lst.append(np.abs(a[i]-mean))

min_val = np.min(lst)
for i in range(N):
  if lst[i] == min_val:
    print(i)
    break

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

int main(){
	long n,tmp;
  	long count=0;
	cin >> n;
  	vector<long> a(n);
  	vector<long> s(n+1);
  	for(int i = 0; i < n;i++) {
    	cin >> a[i];
      	s[i+1] = s[i] + a[i];
    }
	sort(s.begin(),s.end());
  	tmp = 1;
  	for(int i = 1; i < n+1; i++) {
    	if(s[i] != s[i-1]) {
        	count += (tmp-1)*tmp/2;
          	tmp = 1;
    	} else {
          	tmp++;
        }
    }
  	count += (tmp-1)*tmp/2;
  	cout << count << endl;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    string s; cin >> s;

    ll ans = 0, b = 0;
    rep(i, s.size()) {
        if (s[i] == 'B') b++;
        else ans += b;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;


stack<int> st;

int main(){
    string s;
    int a,b;
    while(cin >> s){
        if(s=="+"){
            a=st.top();st.pop();
            b=st.top();st.pop();
            st.push(a+b);
        }
        else if(s=="-"){
            a=st.top();st.pop();
            b=st.top();st.pop();
            st.push(b-a);
        }
        else if(s=="*"){
            a=st.top();st.pop();
            b=st.top();st.pop();
            st.push(a*b);
        }
        else st.push(stoi(s));
    }
    cout << st.top() << endl;
    return 0;
}


Measured memory_bytes: 3156
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<set>
#include<queue>
#include<string>
#include<sstream>
#include<iostream>
#include<sstream>
#include<stack>
#include<map>
#include<vector>
#include<math.h>
using namespace std;
char s[110000];
int main()
{
	int i,n;
	scanf("%s", s);
	for (i = 0; s[i] != '\0'; i++);
	n = i; 
	int num = 1,maxs=999999999;
	for (i = 0; s[i]!='\0'; i++)
	{
		if (s[i] != s[i +1])
		{
			maxs=min(maxs, max(i+1, n - i-1));
		}
	}
	printf("%d", maxs);
}

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


signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

    int n;
    cin>>n;
    vector<int> a(n+1);
    for (int i=1; i<=n; i++){
        for (int j=0; j<=n; j+=i){
            a[j]++;
        }
    }

    int ans = 0;
    for (int i=1; i<n; i++){
        ans += a[i];
    }

    cout<<ans<<endl;


    return 0;
}





Measured memory_bytes: 11060
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <iomanip>
using std::cin;
using std::cout;
using std::endl;

int main(void)
{
    cout << std::fixed << std::setprecision(10);
    int n;
    long long answer=0;
    cin>>n;
    int m1;
    for(int i=0;i<n;i++){
        scanf("%d",&m1);
        answer+=(m1-1);
    }
    cout<<answer<<endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum=0;
        for(int i=1;i<=n;i++){
            sum=sum+i;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 20052
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<long> xs(N, 0), ys(N, 0), zs(N, 0);
  for (int i = 0; i < N; ++i) {
    cin >> xs[i] >> ys[i] >> zs[i];
  }

  long ans = 0;
  for (int b = 0; b < (1 << 3); ++b) {
    vector<long> sums;
    for (int i = 0; i < N; ++i) {
      long tmp = 0;

      if ((b & 1) > 0) {
        tmp += xs[i];
      } else {
        tmp -= xs[i];
      }

      if ((b & (1 << 1)) > 0) {
        tmp += ys[i];
      } else {
        tmp -= ys[i];
      }

      if ((b & (1 << 2)) > 0) {
        tmp += zs[i];
      } else {
        tmp -= zs[i];
      }

      sums.push_back(tmp);
    }

    sort(sums.begin(), sums.end(), greater<long>());
    long tmp_ans = 0;
    for (int i = 0; i < M; ++i) {
      tmp_ans += sums[i];
    }

    ans = max(ans, tmp_ans);
  }

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

Measured memory_bytes: 256
using System;

namespace abc147B
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int A = S.Length;
            string r,l;
            if (A % 2 == 1)
            {
                r = S.Substring(0, (A / 2));
                l = S.Substring((A / 2 + 1), (A / 2));
            }
            else
            {
                r = S.Substring(0, (A / 2));
                l = S.Substring((A / 2 ), (A / 2));
            }
            string[] str = new string[A / 2];
            string[] stl = new string[A / 2];
            int Ans = 0;
            for(int i = 0; i < A / 2; i++)
            {
                str[i] = r.Substring(i, 1);
                stl[i] = l.Substring(i, 1);
            }
            for(int i =0; i < A / 2; i++)
            {
                
                if (str[i] != stl[(A / 2 - 1) - i])
                    Ans = Ans + 1;
            }
            Console.WriteLine(Ans);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

int bit[300010][70];

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n)
    {
        int tmp = a[i], cnt = 0;
        while (tmp > 0)
        {
            if (tmp % 2)
                bit[i][cnt] = 1;
            tmp /= 2;
            cnt++;
        }
    }
    int ans = 0, num = 1;
    rep(i, 70)
    {
        int cnt = 0;
        rep(j, n) cnt += bit[j][i];
        int sum = (cnt * (n - cnt)) % mod;
        (ans += (num * sum) % mod) %= mod;
        (num *= 2) %= mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 166656
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val length: Int = sc.nextInt()
    val list = mutableListOf<Int>()

    for (x in 0 until length) {
        list.add(sc.nextInt())
        //println("$x : ${list[x]}")
    }
    list.sort()

    for (x in 0 until length) {

        //println("$x : ${list[x]}")

    }

    println(list[length / 2] - list[length / 2 - 1])
}

Measured memory_bytes: 53688
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	iv, _ := strconv.Atoi(scanString())
	return iv
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 100001), 100001*100)
}

func main() {
	n, m := scanInt(), scanInt()
	a := make([]string, n)
	for i := range a {
		a[i] = scanString()
	}
	b := make([]string, m)
	for i := range b {
		b[i] = scanString()
	}

	for ai := 0; ai < n-m+1; ai++ {
		for aj := 0; aj < n-m+1; aj++ {
		L:
			for bi := 0; bi < m; bi++ {
				for bj := 0; bj < m; bj++ {
					if a[ai+bi][aj+bj] != b[bi][bj] {
						break L
					}
					if bi == m-1 && bj == m-1 {
						fmt.Println("Yes")
						return
					}
				}
			}
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int r = in.nextInt();
            int g = in.nextInt();
            int b = in.nextInt();

            int number = r * 100 + g * 10 + b;

            if (number % 4 == 0) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}


Measured memory_bytes: 21844
#include<cstdio>

const int MAX_N = 1e5, MAX_M = 1e5;
int rank[MAX_N], par[MAX_N], nv[MAX_N];

void init(int n) {
    for (int i = 0; i < n; i++) {
        par[i] = i;
        nv[i] = 1;
    }
}

int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
}

int unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return 0;
    int nr = static_cast<long>(nv[x]) * nv[y];
    if (rank[x] < rank[y]) {
        par[x] = y;
        nv[y] += nv[x];
    }
    else {
        if (rank[x] == rank[y]) rank[x]++;
        par[y] = x;
        nv[x] += nv[y];
    }
    return nr;
}

bool same(int x, int y) {
    return find(x) == find(y);
}

int n, m;
int e[MAX_M][2];
long ans[MAX_M];

int main() {
    scanf("%d %d", &n, &m);
    init(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        e[i][0] = a - 1;
        e[i][1] = b - 1;
    }
    ans[m - 1] = static_cast<long>(n) * (n - 1) / 2 ;
    for (int i = m - 2; i >= 0; i--) {
        ans[i] = ans[i + 1] - unite(e[i + 1][0], e[i + 1][1]);
    }
    for (int i = 0; i < m; i++) printf("%ld\n", ans[i]);
    return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i,n) for(int i = 0;i < n; i++)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e18;

#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
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;}
template<typename T>vector<T>
make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}

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

signed main(){
	//IOS();
	vector<pair<int,pair<double,string>>>ans;
	int loop = 0;
	while(1){
		int N;
		cin>>N;
		if(!N)break;
		rep(i,0,N){
		int p,a,b,c,d,e,f,s,m;
		string l;
		cin>>l>>p>>a>>b>>c>>d>>e>>f>>s>>m;
		int me = a+b;
		int ha = c+d+e+f;
		int time = (a+b+c)+m*(d+e);
		int uriage = s*m*f;
		uriage -= p;
		double t = (double)uriage / time;
		ans.push_back({loop,{-t,l}});
		}
		ans.push_back({loop,{INF,"#"}});
		loop++;
	}
	sort(all(ans));
	for(auto e:ans){
		cout<<e.se.se<<endl;
	}
}


Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N;
	cin>>N;
	int M,sum;
	M=N;
	sum =0;
	for(int i=0;i<M;i++){
//i<Nがそもそも違う
	
		sum += N%10;
		N /=10;
		if(N==0) break;
	}
	//数字の和がsumなので,一番最初のNがsumで割り切れたらYes
	
	if (M%sum ==0){
		cout <<"Yes"<<endl;
	}
	else {
		cout <<"No"<<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 repp(i, n) for(int i = 1; i <= (int)(n); i++)
#define co(x) cout<<x<<endl
typedef long long int lint;

int main(){
  int S,W;
  cin >> S >> W;
  if(S > W){co("safe");}
  else{co("unsafe");}
}

Measured memory_bytes: 3624
#include<stdio.h>
#include<string.h>
int main(){
	int i,j,a[9],f[20],y;
	while(scanf("%d,%d,%d,%d,%d",&a[0],&a[1],&a[2],&a[3],&a[4])!=EOF){
		memset(f,0,sizeof(f));
		for(i=0;i<5;i++)f[a[i]]++;
		y=1;
		for(i=1;i<14;i++){
			if(f[i]==4)y=7;
			else if(f[i]==3 && y<4){
				y=4;
				for(j=1;j<14;j++)if(f[j]==2)y=6;
			}
			else if(f[i]==2 && y<2){
				y=2;
				for(j=1;j<14;j++)if(i!=j && f[j]==2)y=3;
			}
		}
		for(i=1;i<11;i++){
			if(f[i]==1 && f[i+1]==1 && f[i+2]==1 && f[i+3]==1 && f[(i+4)%13]==1 && y<5)y=5;
		}
		
		if(y==1)printf("null\n");
		else if(y==2)printf("one pair\n");
		else if(y==3)printf("two pair\n");
		else if(y==4)printf("three card\n");
		else if(y==5)printf("straight\n");
		else if(y==6)printf("full house\n");
		else if(y==7)printf("four card\n");
	}
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main(void)
{
    int max,a,x[101]={0};
    int i;

    while(scanf("%d",&a)!=EOF){
        x[a]++;
        if(max<x[a])max=x[a];
    }
    for(i=0;i<101;i++){
        if(max==x[i])printf("%d\n",i);
    }
    return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);

	public void run() {
		int H, W = 0;
		String s = null;
		
		while (true) {		
			H = sc.nextInt();
			W = sc.nextInt();
			if (H == 0 && W == 0) {
				break;
			}
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					if (i % 2 == 0) { // 奇数行
						ln((j % 2 == 0) ? "#" : ".");
					} else { // 偶数行
						ln((j % 2 == 0) ? "." : "#");						
					}
				}
				System.out.printf("%n");
			}
			System.out.printf("%n");
		} 
		sc.close();
	}

	public static void main(String[] srgs) {		
	    Main main = new Main();
		main.run();
	}
	
	public static void ln(String s) {
		System.out.printf("%s", s);
	}
}




Measured memory_bytes: 101576
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<vector>
using namespace std;
#define INF (1<<28)
#define MAX 105
struct edge{int to,cost;};
struct state{
  int pos,cost;
  bool operator < (const state &p)const{
    return cost > p.cost;
  }
};
 
vector<edge> G[MAX];
int n,m,p;
 
void init(){
  for(int i=0;i<MAX;i++){
    G[i].clear();
  }
}
 
long long d[MAX][MAX];
double cnt[MAX][MAX];
void dijkstra(int si){
  for(int i=0;i<MAX;i++)d[si][i]=INF,cnt[si][i]=0;
  priority_queue<state> Q;
  d[si][si]=0;
  cnt[si][si]=1;
  Q.push((state){si,0});
  while(!Q.empty()){
    state s=Q.top();Q.pop();
    if(s.cost>d[si][s.pos])continue;
    for(int i=0;i<(int)G[s.pos].size();i++){
      edge e=G[s.pos][i];
      if(d[si][e.to]<s.cost+e.cost)continue;
      else if(d[si][e.to]==s.cost+e.cost){
    cnt[si][e.to]+=cnt[si][s.pos];
      }else{
    cnt[si][e.to]=cnt[si][s.pos];
    d[si][e.to]=s.cost+e.cost;
    Q.push((state){e.to,d[si][e.to]});
      }
    }
  }
}
 
int main(){
  while(1){
    cin>>n>>m>>p;
    if(n==0&&m==0&&p==0)break;
    init();
    for(int i=0;i<m;i++){
      int a,b,c;
      scanf("%d%d%d",&a,&b,&c);
      G[a].push_back((edge){b,c});
      G[b].push_back((edge){a,c});
    }
    for(int i=0;i<n;i++)
      dijkstra(i);
 
    for(int i=0;i<p;i++){
      int a;
      scanf("%d",&a);
      if(d[0][a]+d[a][n-1]!=d[0][n-1]){
    cout<<"0.0"<<endl;
      }else{
    double x=cnt[0][a],x2=cnt[a][n-1],y=cnt[0][n-1];
    printf("%.8f\n",x/y*x2);
      }
 
 
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1600
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
using ll = long long int;
const ll INF = 1e18;

template<typename Monoid>
struct SegmentTree {
  using F = function<Monoid(Monoid, Monoid)>;
 
  int sz;
  vector< Monoid > seg;
 
  const F f;
  const Monoid M1;
 
  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }
 
  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }
 
  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }
 
  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }
 
  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }
 
  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }
};

int main(){
    ll n, x; cin >> n >> x;
    vector<ll> a(n);
    SegmentTree<ll> seg(n*2, [](ll a, ll b) {return min(a, b);}, INF);
    for(int i=0; i<n; i++){
        cin >> a[i];
        seg.update(i, a[i]);
        seg.update(i+n, a[i]);
    }
    ll ans = INF;
    for(int k=0; k<n; k++){
        ll val = 0;
        for(int i=0; i<n; i++){
            val += seg.query(n+i-k, n+i+1);
        }
        ans = min(ans, val + x*k);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main()
{
    string s;
    cin>>s;
    int ss = s.size();
    if(ss%2 == 1)
        ss--;
    else
        ss-=2;
    int i=ss;
    for(; i>0; i-=2){
        bool a = true;
        for(int j=0; j<i/2; ++j){
            if(s[j] != s[i/2+j]){
                a = false;
                break;
            }
        }
        if(a)
            break;
    }
    cout<<i<<"\n";
    return 0;
}

Measured memory_bytes: 256
b=input()
a=[]
e=[]
for i in range(len(b)):
    for j in range(len(b)):
        c=b[i:j+1]
        if len(c) >0:
            a.append(c)

    
for j in a:     
    total=0
    for k in 'ACGT':
        d=j.count(k)
        total +=d
        if total == len(j):
            e.append(total)    

if e == []:
    print(0)
else:    
    print(max(e))

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
ll solve(vector<ll> vec){
  ll n=vec.size();
  vector<ll> perm;
  for(int i=1;i<=n;i++) perm.push_back(i);
  ll cnt=1;
  do{
    bool f=true;
    for(int i=0;i<n;i++) if(vec[i]!=perm[i]) f=false;
    if(f) return cnt;
    cnt++;
  }while(next_permutation(perm.begin(),perm.end()));
}
int main(){
  ll n;
  cin>>n;
  vector<ll> p,q;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    p.push_back(a);
  }
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    q.push_back(a);
  }
  cout<<abs(solve(p)-solve(q))<<endl;
}


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

using namespace std;

typedef pair<int,int> pii;

int main()
{
	for(int m;cin>>m,m;){
		vector<pii> stars(m);
		for(int i=0;i<m;i++)
			cin>>stars[i].first>>stars[i].second;
		int n; cin>>n;
		vector<pii> skys(n);
		for(int i=0;i<n;i++)
			cin>>skys[i].first>>skys[i].second;
		
		sort(skys.begin(),skys.end());
		for(int i=0;i<n;i++){
			pii d(skys[i].first-stars[0].first,skys[i].second-stars[0].second);
			bool ok=true;
			for(int j=0;j<m;j++){
				pii p(stars[j].first+d.first,stars[j].second+d.second);
				if(!binary_search(skys.begin(),skys.end(),p))
					ok=false;
			}
			if(ok)
				cout<<d.first<<" "<<d.second<<endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 916
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)


void solve(long long A, long long B){
    lint res = max(A+B, A-B);
    res = max(res, A*B);
    cout << res << endl;

}

int main(){

    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}



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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define sz(c) int(c.size())
#define clr(v, d)   memset(v, d, sizeof(v))
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define INF             INT64_MAX
#define NINF            INT64_MIN
#define ROW 1001
#define COL 1001

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<pll> vll;
typedef vector<ll> vl;



int main(void) {

    ll n ,b,r,t;

    cin>>n>>b>>r;
    //13 3 4
    ll answer = b * (n/(b+r)) + min(n%(b+r),b);
    cout<<answer<<endl;

    return 0;
}


Measured memory_bytes: 256
N, A, B = map(int, input().split())
S = str(input())
a = b = 0
for i in range(N):
    
    if S[i] == 'a':
        a += 1
        if a + b <= A + B:
            print('Yes')
        else:
            print('No')
            a -= 1
    elif S[i] == 'b':
        b += 1
        if a + b <= A + B and b <= B:
            print('Yes')
        else:
            print('No')
            b -= 1
    else:
        print('No')


Measured memory_bytes: 75484
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
#define MOD 1000000007
#define ALL(obj) (obj).begin(),(obj).end()
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;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}


int main(){
    ll n;
    cin>> n;
    ll a[n],b[n];
    for (ll i=0;i<n;i++){
        cin >> a[i] >> b[i];
    }
    ll ans=0;
    for (ll i=n-1;i>=0;i--){
        a[i]=a[i]+ans;
        a[i]=a[i]%b[i];
        if (a[i]==0)continue;
        ans+=b[i]-a[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5176
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
void vout(vl V) {
	for (ll i = 0; i < (ll)V.size(); i++) cout << V[i] << " ";
	cout << endl;
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color; vll path; vl A; vl dp; vl Ans;
vl divisor(ll n) {
	vl ret;
	for (ll i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i != 1 && i * i != n) ret.push_back(n / i);
		}
	}
	ret.push_back(n);
	return ret;
}

int main() {
	cin >> X;
	vl D = divisor(X);
	//debug(D);
	for (k = 0; k < D.size(); k++) {
		for (i = -1000000; i <= 1000000; i++) {
			ll B = i;
			ll A = i + D[k];
			if (A*A*A*A*A - B*B*B*B*B == X) {
				cout << A << " " << B;
				exit(0);
			}
		}
	}
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

struct State
{
    int time;
    int x, y;

    int Distance(const State &other) const
    {
        return abs(x - other.x) + abs(y - other.y);
    }
};

State ReadState()
{
    State state;
    cin >> state.time >> state.x >> state.y;
    return state;
}

bool CanMove(const State &start, const State &end)
{
    if (end.time < start.time) {
        return false;
    }

    auto needed = start.Distance(end);
    auto left = end.time - start.time - needed;

    return left >= 0 && left % 2 == 0;
}

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

    auto state = State{ .time = 0, .x = 0, .y = 0 };
    auto valid = true;

    for (int i = 0; i < n && valid; i += 1) {
        auto next = ReadState();
        valid = CanMove(state, next);
        state = next;
    }

    cout << (valid ? "Yes" : "No") << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void maxheapify(int);

int n,a[2000001];

int main(){
  int i;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }
  
  for(i=n/2;i>=1;i--) maxheapify(i);
  
  for(i=1;i<=n;i++){
    printf(" %d",a[i]);
  }

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

void maxheapify(int x){
  int r,l,largest;
  int tmp;
  l=2*x;
  r=2*x+1;

  if(l<=n&&a[l]>a[x]) largest=l;
  else largest=x;

  if(r<=n&&a[r]>a[largest]) largest=r;

  if(largest!=x){
    tmp=a[x];
    a[x]=a[largest];
    a[largest]=tmp;

    maxheapify(largest);
  }
}



Measured memory_bytes: 3652