akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    int64_t x;
    mint(int64_t x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(int64_t t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    //for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) {return mint(*this) /= a;}
};

istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) {
        cin >> a[i];
    }   

    sort(all(a));

    mint ans;

    if(n&1) {
        vi aa(1);
        rep(i, n/2) {
            aa.push_back(i*2+2);
            aa.push_back(i*2+2);
        }
        if(aa == a) {
            ans = mint(2).pow(n/2);
        }
    } else {
        vi aa;
        rep(i, n/2) {
            rep(fjnlk, 2) {
                aa.push_back(i*2+1);
            }
        }
        if(aa == a) {
            ans = mint(2).pow(n/2);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1276
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll Long = 1000000000000000000;
const int N = 100005;
ll a[N];
int main() {
    ll n, ans = 1;
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i];
    }

    sort(a+1,a+1+n);

    for(int i = 1; i <= n; ++i) {
        if( ( a[i] && ans > ceil(Long/a[i]) ) || (ans && a[i] > ceil(Long/ans))) {
            printf("-1\n");
            return 0;
        } else ans = ans*a[i];
    }
    cout << ans << '\n';
return 0;
}

Measured memory_bytes: 4392
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
long long  mod = 1000000007;
int N, A[100000];
int main()
{
	int count[100010] = { 0 };
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
		count[A[i]]++;
	}
	int kind = 0, c = 0;
	for (int i = 1; i <= 100000; i++) {
		if (count[i] != 0) {
			kind++;
			if (count[i] % 2 == 0) {
				count[i] = 2;
			}
			else {
				count[i] = 1;
			}
		}
		if (count[i] == 2) {
			c++;
		}
	}
	if (c % 2 == 0) {
		printf("%d", kind);
	}
	else {
		printf("%d", kind - 1);
	}
	return 0;
}

Measured memory_bytes: 896
//
//AtCoder Beginner Contest 126
//B
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    string s;
    cin >> s;
    
    int i1 = stoi(s.substr(0,2));
    int i2 = stoi(s.substr(2,2));

    if ((1<=i1) && (i1<=12)){
        if ((1<=i2) && (i2<=12)){
            cout << "AMBIGUOUS" << endl;
        }else{
            cout << "MMYY" << endl;
        }
    }else{
        if ((1<=i2) && (i2<=12)){
            cout << "YYMM" << endl;
        }else{
            cout << "NA" << endl;
        }
    }

    return 0;
}


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

int main() {
  string n;
  cin >> n;
  int k, l;
  cin >> k;
  l = n.size();
  
  int dp[105][5][2] = {};
  dp[0][0][0] = 1;
  int d;
  for(int i=0; i<l; i++){
    d = n.at(i) - '0';
    for(int j=0; j<=k; j++){
      for(int smaller=0; smaller<2; smaller++){
        for(int x=0; x <= (smaller ? 9 : d); x++){
          dp[i+1][x ? j+1 : j][smaller || x < d] += dp[i][j][smaller];
        }
      }
    }
  }
  cout << dp[l][k][0] + dp[l][k][1] << endl;
}

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

int main() {
	cin.tie(nullptr); ios::sync_with_stdio(false);
	string N;
	cin >> N;
	bool ans = regex_match(N, regex("\\d?(\\d)\\1{2}\\d?"));
	cout << (ans ? "Yes" : "No") << endl;
}


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

using namespace std;

int main(void)
{
	string s;
	int ccnt=0;
	bool jud=false,font=true;;

	cin>>s;

	if(s[0]=='A'){
		for(int i=1;i<s.size();i++){
			if(isupper(s[i])){
				if(s[i]!='C'||i==1||i==s.size()-1) font=false;
				else ccnt++;
			}
		}
	}

	if(ccnt==1) jud=true;

	if(jud&&font) cout<<"AC"<<endl;
	else cout<<"WA"<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;

int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    vector<int> dx = {1,   1,  0, -1, -1, -1, 0, 1};
    vector<int> dy = {0, -1, -1, -1,  0,   1, 1, 1};
    rep(i, H) {
        cin >> S.at(i);
    }

    rep(i, H){
        rep(j, W) {
            if (S[i][j] == '#') {
                cout << '#';
                continue;
            } 
            int ans = 0;
            rep(k, 8) {
                int ti = i, tj = j;
                ti += dx[k];
                tj += dy[k];
                if(ti < 0 || ti >= H || tj < 0 || tj >= W){
                    continue;
                }
                if (S[ti][tj] == '#') {
                    ans++;
                }
            }
            cout << ans;
        }
        cout << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100

int main(){

  int num,i,j,array[MAX],tem,count=0;

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

  for(i=0;i<=num-1;i++){
    for(j=num-1;j>i;j--){
      if(array[j]<array[j-1]){
	tem = array[j];
	array[j] = array[j-1];
	array[j-1] = tem;
	count++;
      }
    }
  }
  for(i=0;i<num-1;i++){
    printf("%d ",array[i]);
      }
  printf("%d\n",array[num-1]);
      

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


}

Measured memory_bytes: 2704
#include <iostream>
#include <cstring>
#define MOD 1000000007
using namespace std;

int a, b;

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>a>>b;
	
	if(a<=0&&b>=0)cout<<"Zero";
	else if(a<0&&(b-a+1)%2==1)cout<<"Negative";
	else cout<<"Positive";
	

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using i64 = int64_t;
using ll = long long;
const ll MAX = 1e15 + 1;
int main() {
  int H,W,K;
  cin >> H >> W >> K;
  vector<vector<int>> sq(H,vector<int>(W));
  vector<vector<int>> sq_2(H,vector<int>(W));
  int all = 0;//黒の全枚数
  rep(i,H){
    string S;
    cin >> S;
    rep(j,W){
      if(S.at(j) == '#'){
        sq.at(i).at(j) = 1;
        all ++;
      }
    }
  }
  int ans = 0;
  for(int bit_h = 0; bit_h < (1 << H); ++bit_h){//塗る行選ぶ
    int red_h = 0;//赤く塗った黒をカウント
    rep(i,H){
      if(bit_h & (1<<i)){//選んだら塗っていく
        rep(j,W){
          if(sq.at(i).at(j) == 1){
            red_h ++;
            sq_2.at(i).at(j) = 1;//1を0にしたらカウント
          }
        }
      }
    }//行塗り終わり
    
    for(int bit_w = 0; bit_w < (1 << W); ++ bit_w){
      int red_w = 0;
      rep(j,W){
        if(bit_w & (1<<j)){
          rep(i,H){
            if(sq.at(i).at(j) == 1 && sq_2.at(i).at(j) == 0){
              red_w ++;
            }
          }
        }
      }
      //ここで塗りが終わったので処理
      if(all - red_h - red_w == K){
        ans ++;
      }
    }
    sq_2 = vector<vector<int>>(H,vector<int>(W,0));//初期化
  }
  cout << ans << endl;
  return 0;
}



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

// int/long:            -2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:      -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define MOD 1000000007

#define Rep0(i, n)      for (auto i=0; i<n; i++)
#define Rep1(i, n)      for (auto i=1; i<=n; i++)
#define Sort(P) sort(P.begin(), P.end())
#define Rev(P)  reverse(P.begin(), P.end())

int     main() {
        int N;
        cin >>N;
        int AC=0;
        int WA=0;
        int TLE=0;
        int RE=0;
        Rep0(i, N) {
                string S;
                cin >>S;
                if ("AC"==S)
                        AC++;
                else if ("WA"==S)
                        WA++;
                else if ("TLE"==S)
                        TLE++;
                else
                        RE++;
        }
        cout <<"AC x " <<AC <<endl;
        cout <<"WA x " <<WA <<endl;
        cout <<"TLE x " <<TLE <<endl;
        cout <<"RE x " <<RE <<endl;
        return 0;
}

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

#ifdef _XCODE_DEBUG
    #include <fstream>
#endif
static const int INF = 1e9;

void warshall_floyd(int n, std::vector<std::vector<int>>& vec) {
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            for (int k = 0; k < n; ++k) {
                vec[j][k] = std::min(vec[j][k], vec[j][i] + vec[i][k]);
            }
        }
    }
}

int main(){
    #ifdef _XCODE_DEBUG
        std::ifstream in("input.txt");
        std::cin.rdbuf(in.rdbuf());
    #endif
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    // input data
    int N, M, R, a, b, c;
    std::cin >> N >> M >> R;
    int r[R];
    for (int i=0; i<R; ++i) {
        std::cin >> r[i];
        --r[i];
    }

    std::vector<std::vector<int>> graph(N, std::vector<int>(N, INF));
    for (int i=0; i<N; ++i) graph[i][i] = 0;
    for (int i=0; i<M; ++i) {
        std::cin >> a >> b >> c;
        graph[a-1][b-1] = c;
        graph[b-1][a-1] = c;
    }

    warshall_floyd(N, graph);
    std::sort(r, r+R);
    int ans = INF;
    do {
        int sumd = 0;
        for (int i=0; i<R-1; ++i) sumd += graph[r[i]][r[i+1]];
        ans = std::min(ans, sumd);
    } while (std::next_permutation(r, r + R));
    std::cout << ans << "\n";
    return 0;
}

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

using namespace std;

int main(){
  int N;
  cin >> N;
  int A[N+1];
  int n = 1;
  while(n <= N){
    cin >> A[n];
    n++;
  }
  sort(A+1,A+n);
  /*n = 1;
  while(n <= N){
    cout << A[n];
    n++;
  }*/
  int k = 1;
  int B[N+1];
  n = 1;
  while(n <= N){
    B[n] = 1;
    n++;
  }
  int count = 1;
  while(k <= N-1){
    if(A[k] == A[k+1]){
      B[count]++;
      k++;
      continue;
    }
    k++;
    count++;
  }
  k = 1;
  int dcount = 0;
  while(k <= count){
    if(B[k] % 2 == 0){
      B[k] = 2;
      dcount++;
    }else B[k] = 1;
    k++;
  }

  if(count == 1){
    cout << 1 << endl;
  }else if (dcount % 2 == 0){
    cout << count << endl;
  }else cout << count - 1 << endl;


}


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

using namespace std;

#define ll long long
#define ini(arr, val) memset(arr, (val), sizeof(arr))
#define loop(i,n)  for(ll i=0; i<n; i++)
#define loop1(i,n)  for(ll i=1; i<=n; i++)

#define all(a)      (a).begin(),(a).end()
#define dupli(a)     unique(all(a)),(a).end()
#define exist(s,e)  (s.find(e)!=s.end())
#define dbg(x)  cout << #x << " is " << x << endl;
#define pt(x) cout<<x<<"\n"
#define pts(x) cout<<x<<" "

#define mp make_pair
#define pb push_back
#define F first
#define S second


#define inf (int)1e9
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007


#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test   int t; cin>>t; while(t--)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef set<int> si;

typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<pll> vpll;
typedef vector<vl> vvl;
typedef map<ll,ll> mll;
typedef set<ll> sl;


//////////////////////////////////////////////////////////////////////////////////////////
//                      main starts
//////////////////////////////////////////////////////////////////////////////////////////
int const lmt=1e5+5;


int main(){

 //    #ifndef ONLINE_JUDGE
 //    freopen("../input.txt", "r", stdin);
 //    freopen("../output.txt", "w", stdout);
	// #endif
 //    fast

    ll n,a,b;
    cin>>n>>a>>b;
    ll ans,rem;
    ans=n/(a+b)*a;
    rem=n%(a+b);
    ans+=min(rem,a);
    pt(ans);
    
    
    

}


/*

// 

*/

Measured memory_bytes: 3616
long a[3001],p[3001][3001];j;
main(i){
	for(;~scanf("%d",a-i--);)for(j=-i;j--;)p[-i][j]=fmax(a[-i-1]-p[-i-1][j],a[j]-p[-i][j+1]);
	printf("%ld",*p[-i-1]);
}

Measured memory_bytes: 68864
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        if (n % k == 0) {
            System.out.println(0);
        } else {
            System.out.println(1);
        }
    }
}

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

int N, X;
const int MAX_N = 100 + 10;
int m[MAX_N];

int main() {
    cin >> N >> X;
    for (int i = 0; i < N; i++) cin >> m[i];

    int ans = N;
    for (int i = 0; i < N; i++) {
        X -= m[i];
    }

    sort(m, m+N);
    
    ans += (X / m[0]);

    cout << ans << endl;

    return 0;
}


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

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

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const int int_inf = 100000000;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
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; }

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

    long double a, b, c;
    cin >> a >> b >> c;

    if (c- (a+b) < 0) {
        cout << "No" << endl;
        return 0;
    } 
    if (4.0*a*b < (c*c - 2.0*(a+b)*c + (a+b)*(a+b))) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

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

const int MOD = 1000000007;

int main() {
    int n,m; cin >> n >> m;
    int f[n][m];
    for(int i = 0;i < n;i++){
        for(int j = 0;j < m;j++){
            int a; cin >> a;
            f[i][j] = a;
        }
    }
    int ans = 0;
    
    for(int i = 0;i < n-1;i++){
        for(int j = i+1;j < n;j++){
            int total = 0;
            for(int k = 0;k < m;k++){
                //cout << abs(f[i][k]-f[j][k]);
                total += pow(abs(f[i][k]-f[j][k]),2);
            }
            double total2 = sqrt(total);
            if(floor(total2) == total2) ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 3528
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <cstring>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int main(){
    string l;
    cin >> l;
    if (l[0] == l[1] && l[1] == l[2]) {
        printf("No");
        return 0;
    }
    printf("Yes");
    
    
    
    
    return 0;
    
}


Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main(){
    long long int N;
    string A, B, C;
    cin >> N;
    cin >> A;
    cin >> B;
    cin >> C;
    long long int __ccout = 0;
    for(long long int i = 0; i < N; i++){
        int count = 0;
        if(A[i] == B[i]){
            count ++;
        }
        if(B[i] == C[i]){
            count ++;
        }
        if(A[i] == C[i]){
            count ++;
        }

        if(count == 1){
            __ccout+=1;
        }else if(count == 0){
            __ccout+=2;
        }
    }
    cout << __ccout << endl;

    return 0;
}

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

int main(void){
    int i,j;
    char S[50];
    int m,f,r;
    int sum;
    
    i=0;
    while(1){
        scanf("%d %d %d",&m,&f,&r);
        sum=m+f;
        if(m==-1&&f==-1&&r==-1){
            break;
        }
        else if(m>50||f>50||r>100){
            printf("error\n");
        }
        else if(m==-1||f==-1||sum<30){
            S[i]='F';
        }
        else if(sum>=80){
            S[i]='A';
        }
        else if(65<=sum&&sum<80){
            S[i]='B';
        }
        else if(50<=sum&&sum<65){
            S[i]='C';
        }
        else if(30<=sum&&sum<50){
            if(r>=50){
                S[i]='C';
            }
            else{
                S[i]='D';
            }
        }
        else{}
        i++;
    }
    
    for(j=0;j<i;j++){
        printf("%c\n",S[j]);
    }
    
    return 0;
}


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

int main() {
    int n, t;
    cin >> n >> t;
    vector<P> a(n);
    rep(i, n)cin >> a[i].first >> a[i].second;
    sort(a.begin(), a.end());
    vector<vector<int>> dp(n, vector<int>(t, 0));
    rep(i, n-1){
        for(int j = 1; j < t; j++){
            dp[i+1][j] = max(dp[i+1][j-1], dp[i][j]);
            if(j >= a[i].first){
                dp[i+1][j] = max(dp[i+1][j], dp[i][j-a[i].first] + a[i].second);
            }
        }
    }
    int ans = 0;
    rep(i, n){
        ans = max(ans, dp[i][t-1] + a[i].second);
    }
    cout << ans << endl;
}

Measured memory_bytes: 35584
import numpy as np
N, C = map(int, input().split())
D = []
for i in range(C):
    D.append(list(map(int, input().split())))
M = []
for i in range(N):
    M.append(list(map(int, input().split())))

L = [[0]*C, [0]*C, [0]*C]
for i in range(N):
    for j in range(N):

        L[(i+j)%3][M[i][j]-1] += 1

D = np.array(D)
L = np.array(L)
P = np.dot(L, D)

ans = 999999999999999999999999999999999
"""
for i in range(3):
    c = np.argmin(P[i])
    for j in range(3):
        if i==j:
            continue
        else:
            c2 = np.argmin(P[j][])
            ans = min(ans, )
            """
for i in range(C):
    for j in range(C):
        if i==j: continue
        for h in range(C):
            if i==h or j==h: continue
            ans = min(ans, P[0][i] + P[1][j] + P[2][h])

print(ans)

Measured memory_bytes: 14936
#include<stdio.h>
int n, F[46];

int fibonacci(int n){
  if(n == 0 || n == 1)    return F[n] = 1;
  if(F[n] != -1)         return F[n];
  return F[n] = fibonacci(n - 2) + fibonacci(n - 1);
}

int main(){
  int i;
  for(i = 0; i < 46; i++)
    F[i] = -1;

  scanf("%d", &n);
  printf("%d\n", fibonacci(n));
  
  return 0;
}

Measured memory_bytes: 596
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define ORDER_MAX 500000
#define KEY_MAX 2000000000
#define KEY_MIN -2000000000
#define NIL KEY_MIN-1


typedef struct node{
  int key;
  struct node *l;
  struct node *r;
  struct node *p;
}Node;

void inorder(Node *);
void preorder(Node *);
void insert(int);
void find(int);

Node *root;

int main(){
  int i,m,j = 0,a;
  char *str_print = "print";
  char *str_insert = "insert";
  char *str_find = "find";
  char str[7];
  int k,f[ORDER_MAX];

  scanf("%d",&m);
  root = NULL;

  for(i = 0; i < m; i++){//入力
    scanf("%s",str);
    if(strcmp(str,str_print) == 0){//print
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if(strcmp(str,str_insert) == 0){//insert
      scanf("%d",&k);
      insert(k);
    }
    else if(strcmp(str,str_find) == 0){
      scanf("%d",&f[j]);
      find(f[j]);
      j++;
    }
  }
  return 0;
}

void inorder(Node *x){
  if(x != NULL){
    inorder(x->l);
    printf(" %d",x->key);
    inorder(x->r);
  }
}

void preorder(Node *x){
  if(x == NULL)return;
  printf(" %d",x->key);
  preorder(x->l);
  preorder(x->r);
}

void insert(int k){
  Node *x,*y,*z;

  y = NULL;
  x = root;

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->l = z->r = z->p = NULL;

  while(x != NULL){
    //printf("test");
    y = x;
    if(z->key < x->key){
      x = x->l;
    }
    else x = x->r;
  }
  z->p = y;

  if(y == NULL)root = z;
  else if(z->key < y->key)y->l = z;
  else y->r = z;

}

void find(int k){
  Node *fn;
  int flag = 0;

  fn = root;
  while(fn != NULL){
    if(fn -> key == k){
      flag = 1;
      break;
    }
    else if(fn -> key < k)fn = fn -> r;
    else if(fn -> key > k)fn = fn -> l;
  }

  if(flag == 1)printf("yes\n");
  else printf("no\n");
  
}


Measured memory_bytes: 20864
data = []
for _ in range(int(input())) :
    data.append(int(input()))
    
max_diff = -1000000000
min_data = data[0]

for value in data[1:] :
    max_diff = max(max_diff, value - min_data)
    min_data = min(min_data, value)

print(max_diff)


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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;

ll burger[51];
ll patty[51];

ll solve(int N, ll X){
    //レベルNバーガーの下からX層を食べる
    if(X == 0) return 0;
    else if(N == 0) return 1;
    else{
        ll eval = burger[N]/2;
        if(X <= eval) return solve(N-1, X-1);
        else return (patty[N-1] + 1) + solve(N-1, X - (eval+1));
    }
}

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; ll X; cin >> N >> X;
    //レベルNバーガーに含まれるパティの数patty[N];
    burger[0] = patty[0] = 1;
    for(int i = 1; i <= N; i++){
        burger[i] = burger[i-1]*2 + 3;
        patty[i] = patty[i-1]*2 + 1;
    }
    cout << solve(N, X) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

bool checkA(char st[1001]){
	int len = strlen(st);
	if(len<4)return false;
	if(st[len-1]!='~')return false;
	if(len%2 == 1)return false;
	st[len/2-1] = '=';
	for(int i = 0; i < len-1; i++){
		if(st[i] !='=')return false;
	}
	return true;
	
}
bool checkB(char st[1001]){
	if(strlen(st)<4)return false;
	if(st[strlen(st)-1] != '~' || st[strlen(st)-2] != '~')return false;
	for(int i = 0 ; i < strlen(st)-2; i+=2){
		if(!(st[i]=='Q' && st[i+1] =='='))return false;
	}
	return true;
}


int main(void){
	int n;
	scanf("%d",&n);
	for(int i = 0; i < n ;i++){
		char str[1001];
		scanf("%s",str);
		
		bool Af = false;
		bool Bf = false;
		
		if(str[1] == '\''){
			Af = checkA(str+2);
		}else {
			Bf = checkB(str+2);
		}
		if(str[0] != '>'){
			puts("NA");
		}else if(Af == Bf){
			puts("NA");
		}else if(Af == true){
			puts("A");
		}else{
			puts("B");
		}
	}
	return 0;
}

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

using namespace std;

int main() {
	string str;
	cin >> str;

	int ans = 0, Scnt = 0;
	for (int i = 0; i < str.size(); i++) {
		if (str[i] == 'S') {
			ans ++;
			Scnt ++;
		} else {
			if (Scnt > 0) {
				ans --;
				Scnt --;
			} else {
				ans ++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 644
import java.util.*;
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer;

public class Main {
	static class IO 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public IO() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
        int [] readarray(int sz){
            int [] ret = new int[sz];
            for(int i = 0; i<sz; i++)ret[i] = nextInt();
            return ret;
        }
    }
    public static class power{
        long x;long y;long mod;
        power(long a,long b){
            this.x = a;this.y = b;
        }
        power(long a,long b,long c){
            this.x = a;this.y = b;this.mod = c;
        }
        long power_without_mod(){
            long res = 1;
            while(y>0){
                if(y%2 == 1)res = (res*x);
                y>>=1;
                x = x*x;
            }
            return res;
        }
        long power_with_mod(){
            long res = 1;
            while(y>0){
                if(y%2 == 1)res = (res*x)%mod;
                y>>=1;
                x = (x*x)%mod;
            }
            return res;
        }
    } 
    public static void main(String[] args){
        IO fs = new IO();
        int n = fs.nextInt(),k = fs.nextInt(),x = fs.nextInt(),y = fs.nextInt();
        if(n<=k)System.out.println(n*x);
        else{
            System.out.println(k*x+(n-k)*y);
        }
    }
}


Measured memory_bytes: 25408
N = int(input())
a = [int(x) for x in input().split()]

A = a[0]
asum = [A]
if A == 0:
    ansp,ansm,tempp,tempm = 1,1,1,-1
elif A < 0:
    ansp,ansm,tempp,tempm = -A + 1, 0, -A + 1, 0
else:
    ansp,ansm,tempp,tempm = 0, A + 1, 0, -A - 1

for i in range(1,N):
    A = asum[i-1] + a[i]
    asum += [A]

    A1 = A + tempp
    if A1 == 0:
        ansp += 1
        tempp += ((i%2)*2-1)
    elif i%2==0 and A1 < 0:
        ansp += -A1 + 1
        tempp += -A1 + 1
    elif i%2!=0 and A1 > 0:
        ansp += A1 + 1
        tempp += -A1 - 1

    A2 = A + tempm
    if A2 == 0:
        ansm += 1
        tempm += -((i%2)*2-1)
    elif i%2!=0 and A2 < 0:
        ansm += -A2 + 1
        tempm += -A2 + 1
    elif i%2==0 and A2 > 0:
        ansm += A2 + 1
        tempm += -A2 - 1

print(min(ansp,ansm))

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

int main(){
    int n, k, s;
    std::cin >> n >> k >> s;

    if (s < std::pow(10, 9))
    {
        for (int i = 0; i < k; i++)
        {
            std::cout << s << " ";
        }
        for (int i = 0; i < n - k; i++)
        {
            std::cout << s + 1 << " ";
        }
        std::cout << std::endl;
    }
    else
    {
        for (int i = 0; i < k; i++)
        {
            std::cout << s << " ";
        }
        for (int i = 0; i < n - k; i++)
        {
            std::cout << 1 << " ";
        }
    }
    
    return 0;
}

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


int main(void) {
    using namespace std;

    string s;
    cin >> s;
    int n = s.size();

    int tx, ty;
    cin >> tx >> ty;

    constexpr int M = 10000;
    bitset<20000> x;
    bitset<20000> y;
    int d = 0;
    x[M] = 1;
    y[M] = 1;

    int i = 0;
    {
        int c = 0;
        while(i < n && s[i] == 'F') i++, c++;

        if(d == 0)
            x = x << c;
    }
    while(i < n) {
        int c = 0;
        while(i < n && s[i] == 'F') i++, c++;

        if(d == 0)
            x = x << c | x >> c;
        else
            y = y << c | y >> c;

        if(i < n && s[i] == 'T') i++, d ^= 1;
    }

    cout << (x[M+tx] && y[M+ty] ? "Yes" : "No") << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <set>
#define lli long long int
#define vi vector<int> 
#define pb push_back
#define Brock_Lesnar ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;

int main(){
    Brock_Lesnar;
    int n , m;
    cin >> n >> m;
    cout << n * m << endl;
}


Measured memory_bytes: 3624
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){

        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();

        ArrayList<Integer> list = new ArrayList<Integer>();

        if(a <= b){
            for(int i = a; i < (b+1); i++){
                if(c%i == 0){
                    list.add(i);
                }
            }
        }
        System.out.println(list.size());

    }
}



Measured memory_bytes: 26336
#![allow(non_snake_case)]

use std::io;

fn print_vec(a: &[i32]){
    let s = a.iter()
        .map(|e| e.to_string())
        .collect::<Vec<String>>()
        .join(" ");
    println!("{}", s);
}

fn selection_sort(a: &mut [i32]) -> i32 {
    let mut cnt = 0;
    let n: usize = a.len();

    for i in 0..n {
        let mut min_idx = i;
        for j in (i+1)..n {
            if a[j] < a[min_idx] {
                min_idx = j;
            } 
        }

        if min_idx != i {
            cnt += 1;
        }
        a.swap(min_idx, i);
    }
    cnt
}

fn main() {
    let sin = io::stdin();
    let mut buf = String::new();
    sin.read_line(&mut buf).unwrap();
    let _n = buf.trim().parse::<i32>().unwrap();

    let mut buf = String::new();
    sin.read_line(&mut buf).unwrap();
    let mut a: Vec<i32> = buf.split_whitespace()
        .map(|v| v.parse().unwrap())
        .collect();

    // let mut a = vec![5,6,4,2,1,3];
    // print_vec(&a);

    let cnt = selection_sort(&mut a);
    print_vec(&a);
    println!("{}", cnt);
}



Measured memory_bytes: 5040
#include <stdio.h>

int main(void)
{
	int a,b;
	
	scanf("%d %d",&a,&b);
	
	if(a < b)
		printf("a < b\n");
		
	if(a > b)
		printf("a > b\n");
			
	if (a == b)
		printf("a == b\n");
				
	return 0;
	
}

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

int isprime(int);

int count = 0;

/*ここからがmain関数*/
int main()
{
  int n, flag = 0;
  int i;
  int data[10000];

  scanf("%d", &n);

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

  for(i = 0; i < n; i++){
  flag = isprime(data[i]);
  if(flag == 1)
    count++;
  }

  printf("%d\n", count);
  
  return 0;
}

/*ここからがisprime関数*/
int isprime(x)
{
  int i;
  
  if(x == 2)
    return 1;

  if(x < 2 || x % 2 == 0)
    return 0;

  i = 3;
    while(i <= sqrt(x)){
      if(x % i == 0)
	return 0;
      i = i + 2;
    }
    
  return 1;
}



Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	int N, A, B;
	cin >> N >> A >> B;

	int sum=0;
	for (int i = 1; i <= N;i++) {
		int ma, se, hy, ju, ic, ds;
		ma = i / 10000;
		se = i / 1000 - 10 * ma;
		hy = i / 100 - 100 * ma - 10 * se;
		ju = i / 10 - 1000 * ma - 100 * se - 10 * hy;
		ic = i - 10000 * ma - 1000 * se - 100 * hy - 10 * ju;
		ds = ma + se + hy + ju + ic;
		if (A <= ds && ds <= B) sum += i;
	}
	cout << sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n,ans;
int main(){
	//freopen("input.txt","r",stdin);
	scanf("%lld",&n);
	long long to = sqrt(n);
	while((to + 1)*(to + 1) <= n)to++;
	for(int i = 1;i <= to;i++)
		if((n - i)/i > 0 && (n - i)%i == 0 && n%((n - i)/i) == i)ans+=(n - i)/i;
	printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll mul(ll a, ll b){
    return ((a%mod) * (b%mod))%mod;
}
ll power(ll a, ll b){
    ll z = 1; ll x = a;
    while(b>0){
        if (b&1)z = mul(z, x);
        x = mul(x, x);
        b >>= 1;
    }
    return z;
}
int main()
{
    ll n; cin>>n;
    vector<ll> a(n);
    for (int i=0; i<n; i++)cin>>a[i];
    sort(a.begin(), a.end());
    if (n&1){
        int s = 0;
        int cnt = 0;
        if (a[0]!=0){
            cout<<0<<endl; return 0;
        }
        cnt++; s = 2;
        int flag  = 0;
        for (int i=1; i<n; i+=2){
            if (a[i] == s && a[i+1] == s){
            }
            else {
                flag = 1;
                break;
            }
            s += 2;
        }
        if (flag == 1){
            cout<<0<<endl;
            return 0;
        }
        //ans
    }
    else{
        int flag = 0, s = 1;
        for (int i=0; i<n; i+=2){
            if (a[i] == s && a[i+1] == s){
            }
            else {
                flag = 1;
                break;
            }
            s += 2;
        }
        if (flag == 1){
            cout<<0<<endl;
            return 0;
        }
    }
    ll x = n/2;
    ll ans = power(2, x);
    cout<<ans<<endl;
}

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

#define int long long

signed main()
{
  int a[4];
  int n, copy;

  cin >> a[0] >> a[1] >> a[2] >> a[3];
  cin >> n;
  copy = n;

  a[0] = a[0] * 4;
  a[1] = a[1] * 2;

  int kanade = 0;

  kanade += n / 2 * a[3];
  n -= (n / 2) * 2;

  int m = a[0];
  for (int i = 1; i < 3; i++) {
    if (m > a[i]) {
      m = a[i];
    }
  }
  
  kanade += m * n;
  cout << min(kanade, m * copy) << endl;
}

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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    cout << setprecision(20) << ((n + 1) / 2) / (double)n;

    return 0;
}

Measured memory_bytes: 384
h,w=map(int,input().split())
l=[list(input()) for _ in range(h)]
l=[i for i in l if i!=["."]*w]
h=len(l)
m=[]
for (i,j) in enumerate(zip(*l)):
  if j==tuple("." for _ in range(h)):
    m.extend([i])
for i in range(h):
  for j in range(w):
    if not j in m:
      print(l[i][j],end="")
  print()

Measured memory_bytes: 4596
int fibonacci(int *, int);
 
int main(){
  int f[45];
  int n, i;
 
  scanf("%d", &n);
  for(i = 0; i < 45; i++) f[i] = 0;
  printf("%d\n",fibonacci(f, n));
 
  return 0;
}
 
int fibonacci(int *f, int n){
   
  if(n == 0 || n == 1){
    return f[n] = 1;
  }
  else if(f[n] != 0) return f[n];
  else return f[n] = fibonacci(f, n - 2) + fibonacci(f, n - 1);
}



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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
const int rev2 = 5e8 + 4;

int main() {
  int N, Q, A[3000];
  cin >> N >> Q;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
  }

  int64 dp[3000][3000] = {{}};
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      dp[i][j] = A[i] > A[j];
    }
  }
  for(int i = 0; i < Q; i++) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    for(int j = 0; j < N; j++) {
      if(j != x && j != y) {
        dp[j][x] = dp[j][y] = (dp[j][x] + dp[j][y]) * rev2 % mod;
        dp[x][j] = dp[y][j] = (dp[x][j] + dp[y][j]) * rev2 % mod;
      }
    }
    dp[x][y] = dp[y][x] = (dp[x][y] + dp[y][x]) * rev2 % mod;
  }
  int64 ret = 0;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < i; j++) (ret += dp[j][i]) %= mod;
  }
  for(int i = 0; i < Q; i++) (ret *= 2) %= mod;
  cout << ret << endl;
}




Measured memory_bytes: 70656
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1010;
char s[SIZE][SIZE];
int main(){
    int h,w,A,B; R(h,w,A,B);
    REP(i,h){
        REP(j,w){
            if((i<h-B)^(j<A))s[i][j]='1';
            else s[i][j]='0';
        }
    }
    REP(i,h)W(s[i]);
    return 0;
}


Measured memory_bytes: 2176
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define rep(i,st,ed) for (int i=st;i<=ed;++i)

typedef long long LL;

int main(void) {
	LL A,B,C,X,Y;
	scanf("%lld%lld%lld%lld%lld",&A,&B,&C,&X,&Y);
	LL d=std:: min(X,Y);
	LL ans1=std:: max(X,Y)*C*2;
	LL ans2=d*C*2+(X-d)*A+(Y-d)*B;
	LL ans3=X*A+Y*B;
	printf("%lld\n", std:: min(ans3,std:: min(ans1,ans2)));
	return 0;
}

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

namespace ConsoleApp1
{
    class ABC117D
    {
        // https://atcoder.jp/contests/abc177/tasks/abc177_d

        static int[] ls;

        static void Main(string[] args)
        {
            var NM = Console.ReadLine().Split();
            int N = Int32.Parse(NM[0]);
            int M = Int32.Parse(NM[1]);

            ls = new int[N];

            for (int i = 0; i < M; i++)
            {
                var AB = Console.ReadLine().Split();
                int A = Int32.Parse(AB[0]);
                int B = Int32.Parse(AB[1]);

                bool a = hasFriend(A);
                bool b = hasFriend(B);

                int C = A;
                int D = B;

                if (a && b)
                {
                    C = getParent(A);
                    D = getParent(B);

                    if (C == D)
                    {
                        continue;
                    }
                }
                else if (a)
                {
                    C = getParent(A);
                }
                else if (b)
                {
                    C = getParent(B);
                    D = A;
                }

                ls[C - 1] += ls[D - 1] - 1; // 人数加算
                setParent(D, C);
            }

            int max = 1;
            for (int i = 0; i < N; i++)
            {
                if (ls[i] < 0)
                {
                    max = Math.Max(max, -ls[i] + 1);
                }
            }

            Console.WriteLine(max);
        }

        static int getParent(int A)
        {
            if (ls[A - 1] > 0)
            {
                ls[A - 1] = getParent(ls[A - 1]);
                return ls[A - 1];
            }
            return A;
        }

        static void setParent(int A, int B)
        {
            ls[A - 1] = B;
        }

        static bool hasFriend(int A)
        {
            return (ls[A - 1] != 0);
        }
    }
}


Measured memory_bytes: 41308
#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;

int main() {
    ll n,a,b;
    cin >> n >> a >> b;
    if(n%(a+b)>=a) cout << a*(n/(a+b)) + a << endl;
    else cout << a*(n/(a+b)) + n%(a+b) << endl;
}

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

int main() {
  int N , M;
  cin >> N >> M;
  
  vector<int> H (N), A (M), B (M);
  vector<int> Count (N), C (M);
  
  for (int i = 0; i < N; i++){
    //Hに値の入力
    cin >> H.at(i);
  }
  
  for (int i = 0; i < M; i++){
    //AとBに値の入力
    cin >> A.at(i) >> B.at(i);
    
    if (H.at(A.at(i) - 1) == H.at(B.at(i) - 1)){
      Count.at(A.at(i)-1) = 1;
      Count.at(B.at(i)-1) = 1;
    }
    
    else if (H.at(A.at(i) - 1) < H.at(B.at(i) - 1)){
      C.at(i) = A.at(i);
      A.at(i) = B.at(i);
      B.at(i) = C.at(i);
    }
  }
    
  for (int i = 0; i < M; i++){
    Count.at(B.at(i)-1) = 1;
  }
  
  int sum = N;
  for (int i = 0; i < N; i++){
    sum -= Count.at(i);
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 5112
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

n,m,x=map(int,input().split())
A=list(map(int,input().split()))
i=bisect.bisect_left(A,x)
print(min(i,m-i))

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

int main() {
    double s = 0;
    int    n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        double a;
        cin >> a;
        s += 1 / a;
    }
    cout << fixed << setprecision(10) << (1 / s) << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
  int k,x;
  cin >>  k >> x;
  for (int i = x-k+1;i <= x+k-1;i++){
    cout << i << " ";
  }
  cout << endl;


    
  return 0;
}


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

int* h;
int num;
int doN;

bool wator()
{
  	int i;
  
  	int s = -1;

   	bool flg = false;
  
	for(i=0;i<num;i++)
    {
    	if(h[i]!=0)
        {
			flg = true;
          s = i;
          break;
        }
    }
  
  	if(!flg)
    {
    	return false;
    }
      	
  	for(i = s+1; i<num; i++)
    {
    	if(h[i] == 0)
        {
        	break;
        }
    }
  
  	for(int j=s;j<i;j++)
    {
    	h[j]--;
    }
  
  doN++;
  
  return true;
}


int main()
{
 	cin >> num;
	h = new int[num];
  	for(int i=0;i<num;i++)
    {
    	cin >> h[i];
    }
  
  	doN = 0;  	
  	while(wator());
  
  	printf("%d",doN);

	return 0;
}


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

using namespace std;

typedef long long int ll;


ll gcd(ll a, ll b)
{
    if(a*b == 0)
    {
        return 0;
    }

    if(a < b)
    {
        swap(a,b);
    }

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

    return a;
}

int main()
{
    ios::sync_with_stdio(0);
    std::cin.tie(0);
    ll n, k, d;
    cin >> n >> k;
    string s, t;
    cin >> s >> t;

    const char* ss = s.c_str();
    const char* tt = t.c_str();

    ll g = gcd(n, k);
    ll n_g = n/g;
    ll k_g = k/g;

    bool is_good = true;
    for(int i = 0; i < g; i++)
    {
        if(ss[i*n_g] != tt[i*k_g])
        {
            is_good = false;
            break;
        }
    }

    ll sum = (n_g * k);
    if(is_good)
    {
        cout << sum;
    }
    else
    {
        cout << -1;
    }








    return 0;
}


Measured memory_bytes: 640
import sys
for line in sys.stdin:
	inpt = map(int, line.split(','))
	rail = []
	for i in range(0, 10):
		rail.append(inpt[i])
	speed1 = inpt[10]
	speed2 = inpt[11]
	sum = 0
	for i in range(0, 10):
		sum += rail[i]
	time = float(sum)/float(speed1+speed2)
	point = time*float(speed1)
	tmp = 0
	for i in range(0, 10):
		tmp += rail[i]
		if point <= float(tmp):
			print i+1
			break


Measured memory_bytes: 4668
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		int[] counts = new int[n];
		
		for(int i = 0; i<counts.length; i++) {
			counts[i] =0;
		}
		
		for(int i = 0; i<m; i++) {
			counts[sc.nextInt()-1]++;
			counts[sc.nextInt()-1]++;
		}
		
		for(int count:counts) {
			System.out.println(count);
		}
		
		sc.close();

	}

}


Measured memory_bytes: 23636