akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

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


// std::vector Declaration
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...));
}

// std::vector Initialization
template<typename T>
void fill_all(T& arr, const T& v) { arr = v; }
template<typename T, typename U>
void fill_all(T& arr, const U& v) { for (auto& i : arr) fill_all(i, v); }

// std::vector Debug
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
   os << "[";
   bool a = 1;
   for (auto e : v ) {
      os << (a ? "" : " "); 
      os << e;
      a = 0;
   }
   os << "]";
   return os;
}

// std::pair Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
   os << "(" << p.first << " " << p.second << ")";
   return os;
}

// std::set Debug
template<typename T>
ostream& operator<<(ostream& os, const set<T>& st) {
   os << "{";
   bool a = 1;
   for (auto e : st) {
      os << (a ? "" : " ");
      os << e;
      a = 0;
   }
   os << "}";
   return os;
}

// std::map Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& mp) {
   os << "{";
   bool a = 1;
   for (auto e : mp) {
      os << (a ? "" : " ");
      os << e.first << ":" << e.second;
      a = 0;
   }
   os << "}";
   return os;
}

// std::tuple Debug
template<int N,class Tuple>
void out(ostream &os,const Tuple &t){}
template<int N,class Tuple,class H,class ...Ts>
void out(ostream &os,const Tuple &t){
   if(N)os<<" ";
   os<<get<N>(t);
   out<N+1,Tuple,Ts...>(os,t);
}
template<class ...Ts>
ostream& operator<<(ostream &os, const tuple<Ts...> &t){
   os<<"(";
   out<0,tuple<Ts...>,Ts...>(os,t);
   os<<")";
   return os;
}

// Debug
#define DUMP(x) cout<<#x<<" = "<<(x)<<endl

struct edge { int to, cost; };

const LL LINF = 1LL<<60;
const int IINF = 1<<30;
const LL MOD = 1e9+7;

int main()
{
   int r, D, x0; cin >> r >> D >> x0;
   for (int i = 0; i < 10; ++i) {
      x0 = r*x0 - D;
      cout << x0 << endl;
   }

   return 0;
}


Measured memory_bytes: 256
s = input()
line = int(input())

for i in range(line):
    param = input().split(" ")

    if len(param) == 4: ope, a, b, p = param
    else: ope, a, b = param

    a,b = int(a), int(b)

    if ope == "print":
        print(s[a:b+1])
    elif ope == "reverse":
        rev = s[a:b+1][::-1]
        s = (s[:a] + rev + s[b+1:])
    elif ope == "replace":
        s = (s[:a] + p + s[b+1:])

Measured memory_bytes: 7700
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define allof(a) (a).begin(),(a).end()
using lint = long long;
template< typename T > using Vec = vector< T >;

template< typename T > bool inRange(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool inRange(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }
template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }
inline int bitCount(int x) { return __builtin_popcount(x); }
inline int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//

int H, W;
string S[2003];
int near[4][2003][2003];

void preproc() {
	for_(y,0,H) {
		near[0][y][0] = -1; // left
		for_(x,0,W) {
			if (S[y][x] == '#') near[0][y][x] = x;
			else if (x > 0) near[0][y][x] = near[0][y][x-1];
		}
		near[2][y][W-1] = W; // right
		for (int x=W-1; x>=0; --x) {
			if (S[y][x] == '#') near[2][y][x] = x;
			else if (x < W-1) near[2][y][x] = near[2][y][x+1];
		}
	}
	
	for_(x,0,W) {
		near[1][0][x] = -1; // down
		for_(y,0,H) {
			if (S[y][x] == '#') near[1][y][x] = y;
			else if (y > 0) near[1][y][x] = near[1][y-1][x];
		}
		near[3][H-1][x] = H; // up
		for (int y=H-1; y>=0; --y) {
			if (S[y][x] == '#') near[3][y][x] = y;
			else if (y < H-1) near[3][y][x] = near[3][y+1][x];
		}
	}
	/*
	for_(y,0,H) {
		for_(x,0,W) cerr << near[3][y][x] << " ";
		cerr << endl;
	}
	*/
}

int main() {
	cin >> H >> W;
	for_(i,0,H) cin >> S[i];
	preproc();
	int ans = 0;
	for_(y,0,H) for_(x,0,W) {
		if (S[y][x] == '#') continue;
		int sum = 1;
		sum += x - near[0][y][x] - 1; // left
		sum += near[2][y][x] - x - 1; // right
		sum += y - near[1][y][x] - 1; // down
		sum += near[3][y][x] - y - 1;
		maxUpdate(ans, sum);
	}
	cout << ans << endl;
}
//--------------8---------------->> coding space <<-----------------8-------------//

Measured memory_bytes: 67200
#include<stdio.h>

int main(void)
{
	unsigned long int a[4] = { 0, 0, 0, 0 };
	long int b;
	char get[4];
	long int i;

	scanf("%ld", &b);

	for (i = 0; i < b; i++) {
		scanf("%s", &get);
		if (get[0] == 'A') {
			a[0]++;
		}
		if (get[0] == 'W') {
			a[1]++;
		}
		if (get[0] == 'T') {
			a[2]++;
		}
		if (get[0] == 'R') {
			a[3]++;
		}
	}

	printf("AC x %ld\n", a[0]);
	printf("WA x %ld\n", a[1]);
	printf("TLE x %ld\n", a[2]);
	printf("RE x %ld\n", a[3]);

	return 0;
}	

Measured memory_bytes: 1736
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
  return modpow(a, mod - 2, mod);
}

int main(){
  int N;
  scanf("%d", &N);
  std::vector<int > A(N);
  for (int i=0; i<N; i++){
    scanf("%d", &A[i]);
  }
  std::map<int, int > mp;
  for (int i=0; i<N; i++){
    int a=A[i];
    std::map<int, int > tmp;
    for (int j=2; j*j<=a; j++){
      while (a%j==0){
	a=a/j;
	tmp[j]++;
	mp[j]=std::max(mp[j], tmp[j]);
      }
    }
    if (a!=1) {
      tmp[a]++;
      mp[a]=std::max(mp[a], tmp[a]);
    }
  }
  long long sum = 1;
  long long mod = 1e9+7;
  for (auto &entry: mp){
    for (int i=0; i<entry.second; i++){
      sum *= entry.first;
      sum %= mod;
    }
  }
  long long ans = 0;
  long long temp;
  for (int i=0; i<N; i++){
    temp = sum;
    temp *= modinv((long long)A[i], mod);
    temp %= mod;
    ans += temp;
    ans %= mod;
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
typedef pair<P,int>P2;
#define fi first
#define se second


void END(){
  cout<<":("<<endl;
  exit(0);
}

signed main(){
  int n;
  cin>>n;
  int a[n];
  vector<P>ve;
  r(i,n){
    cin>>a[i];
    ve.push_back(P(a[i],i+1));
  }

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

  r(i,n){
    a[i]=ve[i].second;
  }

  stack<P>st1;
  stack<P>st2;

  int del=1;

  string s;

  r(i,n){

    s+="(";

    ///st1.push(P(a[i],i+1));
    st2.push(P(a[i],i+1));

    while(!st2.empty()){
      if(st2.top().first!=del)break;
      s+=")";
      st2.pop();
      del++;
    }

    //cout<<st1.size()<<' '<<st2.size()<<endl;
  }

  if(!st1.empty()) END();
  if(!st2.empty()) END();

  cout<<s<<endl;

}


/*
typedef unsigned long long ull;


struct RollingHash{
  typedef unsigned long long ull;
  string S;
  ull B;
  int len;
  vector<ull> hash,p;
  RollingHash(){}
  RollingHash(string S_,ull B_=1000000007LL):
    S(S_),B(B_),len(S.length()),hash(len+1),p(len+1){
    hash[0]=0;p[0]=1;
    for(int i=0;i<len;i++){
      hash[i+1]=hash[i]*B+S[i];
      p[i+1]=p[i]*B;
    }
  }
  //S[l,r)
  ull find(int l,int r){
    return hash[r]-hash[l]*p[r-l];
  }
};

signed main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  string t=s;

  RollingHash S(s);
  RollingHash T(t);

  for(int i=1;i<n;i++){

    int idx=0 , F=0 ;
    ull A=S.find(0,i);

    for(int j=0;;j++){
      if(j%2==0){
        if(S.find(idx+i) != A){
          F++;
          break;
        }
      }
      else{

      }

      idx+=i-1;
    }

    if(!F){

    }
  }

}

*/


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

int main(){
  int N;
  cin >> N;
  vector<int> vec(100);
  for(int i=2; i<=N; i++){
    int a = 2;
    int n = i;
    while(n >= a*a){
      if(n %a == 0){
        vec.at(a)++;
        n /= a;
      }
      else{
        a++;
      }
    }
    vec.at(n)++;
  }
  
  int x_75 = 0;
  int x_25 = 0;
  int x_15 = 0;
  int x_5 = 0;
  int x_3 = 0;
  for(int i=0; i<100; i++){
    if(vec.at(i) >= 74){
      x_75++;
    }
    if(vec.at(i) >= 24){
      x_25++;
    }
    if(vec.at(i) >= 14){
      x_15++;
    }
    if(vec.at(i) >= 4){
      x_5++;
    }
    if(vec.at(i) >= 2){
      x_3++;
    }
  }
  int ans = x_75 + x_25 *(max(x_3-1,0)) + x_15 *(max(x_5-1,0)) + x_5 * max(x_5-1,0) * max(x_3-2,0)/2;
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);	
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a * b / gcd(a,b);}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool isp(ll x){if(x < 2) return 0; for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;}
int n,a[105],b[105];
void solve(){
	memset(b,0x3f,sizeof(b));
	for(int i = 1;i < n;i++){
		int x = a[i];
		b[i] = min(b[i],x);
		b[i+1] = min(b[i+1],x);
	}
	int ans = 0;
	rep(i,1,n) ans += b[i];
	cout << ans << endl;
}
int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	rep(i,1,n-1) cin >> a[i];	
	solve();
	return 0;
}
//do smt instead of nothing! never give up!


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Switches solver = new Switches();
        solver.solve(1, in, out);
        out.close();
    }

    static class Switches {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int d = in.nextInt();
            if (d <= a || b <= c) {
                out.println(0);
                return;
            }
            int ans = Math.min(b, d) - Math.max(a, c);
            out.println(ans);
        }

    }

    static class FastReader {
        BufferedReader reader;
        StringTokenizer st;

        public FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21588
dp = [0]*50

def fib(n):
    if dp[n] != 0:
        return dp[n]
    if n==0:
        dp[n] = 1
    elif n==1:
        dp[n] = 1
    else:
        dp[n] = fib(n-1)+fib(n-2)
    return dp[n]

print(fib(int(input())))


Measured memory_bytes: 5600
#include <stdio.h>
#include <stdlib.h>
static int compare(const void* a, const void* b)
{
    int aNum = *(int*)a;
    int bNum = *(int*)b;

    return aNum-bNum;
}
int main(void)
{
    int n, i, ans=0, a[200001], cnt[200001]={0}, kind=0, k;
    scanf("%d%d", &n, &k);
    for(i=0;i<n;i++){
        scanf("%d", &a[i]);
    }

    for(i=0;i<n;i++){
        if(cnt[a[i]]==0) kind++;
        cnt[a[i]]++;
    }
    qsort(cnt, 200001, sizeof(int), compare);
    i=0;
    while(kind>k){
        if(cnt[i]>0){
        ans=ans+cnt[i];
        kind--;
        }
        i++;
    }

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


Measured memory_bytes: 2556
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll a,b,i,j,k,m,n,t;
	cin>>n;
	ll ar[n];
	ll s=0;
	for(i=0;i<n;i++)
	cin>>ar[i];
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		s+=ar[i]*ar[j];
	}
	cout<<s;
}

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

using namespace std;

int main() {
	int a, b, c;	cin >> a >> b >> c;
	if (a + b == c || a == b + c || a + c == b) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    string s;
    int k;
    cin>>s>>k;
    int n=s.size();
    rep(i,n){
        if(s[i]!='a'){
            int x=26-(s[i]-'a');
            if(k>=x){
                s[i]='a';
                k-=x;
            }
        }
        
    }
    

    k%=26;
    
    while(k>0){
        if(s[n-1]=='z' && k>1) s[n-1]='a';
        else s[n-1]++;
        k--;
    }


    cout<<s<<endl;
} 


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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


const string YES = "Yes";
const string NO = "No";

void func(long long X, long long Y){

    if((Y-2*X)>=0 && (Y-2*X)%2==0 && (4*X-Y)>= 0&&(4*X-Y)%2==0){
        cout<<YES<<endl;
    }
    else{
        cout<<NO<<endl;
    }

    

}

int main(){
    // cout << fixed << setprecision(5);

    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    func(X, Y);
    return 0;
}


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

string S, T, U; int maxn = -1, n;

int solve() {
	int g1[26], g2[26]; for (int i = 0; i < 26; i++) { g1[i] = 0; g2[i] = 0; }
	for (int i = 0; i < T.size(); i++) g1[T[i] - 'a']++;
	for (int i = 0; i < U.size(); i++) g2[U[i] - 'a']++;
	int cnt = 0;
	for (int i = 0; i < 26; i++) { if (g1[i] >= 1 && g2[i] >= 1) cnt++; }
	return cnt;
}

int main() {
	cin >> n >> S;
	for (int i = 1; i < S.size(); i++) {
		T = S.substr(0, i);
		U = S.substr(i, S.size() - i);
		maxn = max(maxn, solve());
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
typedef int64_t ll;
typedef uint64_t ull;
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)

#define MAXN (200001)
#define MOD (1000000007)

int main(void)
{
    double a,b,x;
    scanf("%lf %lf %lf",&a,&b,&x);

    double p = x/(a*a*b);

    if(p>=0.5)
    {
        double r = 2*b*(1-p);
        double d = atan2(r,a)*180/M_PI;
        printf("%0.8lf\n",d);
    }else
    {
        double r = 2*a*p;
        double d = atan2(b,r)*180/M_PI;
        printf("%0.8lf\n",d);
    }
    
    
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef long long ll;
const int m = 13;
const int MOD = 1e9+7;
//if 512%13 == 5 -> (51%13*10 + 2)%13 == 5
//i桁の整数 N を a で割った余りが b のとき、整数 N の上からi-1桁を a で割った
//余りに10をかけてi桁目をたしてaで割った余りもb 
int main(){
    string s;
    cin >> s;
    int n = s.length();
    vector<vector<ll> > dp(n+1,vector<ll>(m,0));//i桁目まで見たとき余りがjになる場合が何通りあるか
    //上から見ていく
    dp[0][0] = 1;
    rep(i,n){
        rep(j,m){
            if(s[i] == '?'){
                rep(k,10){
                    int j2 = (j*10+k)%m;
                    dp[i+1][j2] += dp[i][j];
                    dp[i+1][j2] %= MOD;
                }
            }else{
                int k = s[i] - '0';
                int j2 = (j*10+k)%m;
                dp[i+1][j2] += dp[i][j];
                dp[i+1][j2] %= MOD;
            }
        }
    }
    cout << dp[n][5] << endl;
    return 0;
}

Measured memory_bytes: 13696
#include<stdio.h>
int main(){
  int n,m;
  scanf("%d %d",&n,&m);
  int a[10010];
  int sum=0;
  int b;
  for (int i=1;i<=m;i++){
  	scanf("%d ",&a[i]);
  }
  for (int i=1;i<=m;i++){
  	sum=sum+a[i];
  }
  if(n>=sum){
  	  b=n-sum;
  	  printf("%d\n",b);
  }
  if(n<sum){
  	  printf("%d\n",-1);
  }
  return 0;
}

Measured memory_bytes: 1764
package main

import (
	"fmt"
	"regexp"
)

func main() {
	var S string

	fmt.Scan(&S)
	var validID = regexp.MustCompile(`^(hi)+$`)
	if validID.MatchString(S) == true {
		fmt.Printf("Yes\n")
	} else {
		fmt.Printf("No\n")
	}
}


Measured memory_bytes: 640
const N,M=map(x->parse(Int,x),split(readline()))
const G=[Int[] for _=1:N]
function init()
	for i=1:M
		u,v=map(x->parse(Int,x),split(readline()))
		push!(G[u],v)
	end
end
init()
const S,T=map(x->parse(Int,x),split(readline()))
const dis=[[2000000000 for _=1:3] for _=1:N]
function main()
	dis[S][3]=0
	P=Pair{Int,Int}[]
	push!(P,S=>3)
	while !isempty(P)
		(u,c)=shift!(P)
		for v=G[u]
			t=mod1(c+1,3)
			if dis[v][t]>dis[u][c]+1
				dis[v][t]=dis[u][c]+1
				push!(P,v=>t)
			end
		end
	end
end
main()
println(dis[T][3]%3==0 ? div(dis[T][3],3) : -1)


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

#define AB_MAX 12
#define N_MAX 102

using namespace std;

int A, B;

int d[AB_MAX][AB_MAX];

int a[N_MAX][N_MAX];

int n;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> A >> B;
    bool ok = true;
    for(int i = 1; i <= A; i++)
        for(int j = 1; j <= B; j++)
        {
            cin >> d[i][j];
            if(d[i][j] < d[i - 1][j] || d[i][j] < d[i][j - 1])
                ok = false;
        }
    if(ok == false)
    {
        cout << "Impossible\n";
        return 0;
    }
    n = 101;
    for(int i = 0; i <= n; i++)
        for(int j = 0; j <= n; j++)
        {
            for(int x = 1; x <= A; x++)
                for(int y = 1; y <= B; y++)
                    a[i][j] = max(a[i][j], d[x][y] - x * i - y * j);
        }
    for(int x = 1; x <= A; x++)
        for(int y = 1; y <= B; y++)
        {
            int mi = 1e9+1;
            for(int i = 0; i <= n; i++)
                for(int j = 0; j <= n; j++)
                    mi = min(mi, a[i][j] + x * i + y * j);
            if(mi != d[x][y])
            {
                cout << "Impossible\n";
                return 0;
            }
        }
    int cntX = 101;
    int cntY = 101;
    cout << "Possible\n";
    cout << cntX + cntY + 2 << " " << cntX - 1 + cntY - 1 + cntX * cntY + 2 << "\n";
    for(int i = 2; i < cntX + 1; i++)
        cout << i << " " << i + 1 << " X\n";
    for(int i = 2; i < cntY + 1; i++)
        cout << cntX + i << " " << cntX + i + 1 << " Y\n";
    cout << "1 2 0\n";
    for(int i = 2; i <= cntX + 1; i++)
        for(int j = 2; j <= cntY + 1; j++)
            cout << i << " " << cntX + j << " " << a[i - 2][cntY - j + 1] << "\n";
    cout << cntX + cntY + 1 << " " << cntX + cntY + 2 << " 0\n";
    cout << 1 << " " << cntX + cntY + 2 << "\n";
    return 0;
}


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

int selectionSort(int A[], int n) {

    int count = 0;
    for (int i = 0; i < n; i++) {
        int minj = i;
        for (int j = i; j < n; j++) {
            if (A[j] < A[minj]) {
                minj = j;
            }
        }
        if (i != minj) {
            swap(A[i], A[minj]);
            count++;
        }
    }

    return count;
}

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

    int count;
    count = selectionSort(A, n);

    for (int i = 0; i < n; i++) {
        if (i > 0) {
            cout << " ";
        }
        cout << A[i];
    }
    cout << endl;
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3096
#include <cstdio>
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)

int a[] = { 1, 5, 10, 50, 100, 500 };
int N[6];
int ret[666667];

int min(int x, int y) { return x < y ? x : y; }

int main()
{
	REP(p, 1, 666667) {
		int t = p;
		rep(i, 6) { int k=t/a[5-i]; ret[p]+=k; t-=k*a[5-i]; }
	}
	int P;
	while (scanf("%d", &P), P) {
		int s = 0;
		rep(i, 6) { scanf("%d", N+i); s += a[i] * N[i]; }

		int res = (1<<29);
		REP(p, P, min(P+500,s)+1) {
			int t = p;
			int pay = 0;
			rep(i, 6) {
				int k=min(N[5-i], t/a[5-i]);
				pay+=k;
				if (pay >= res) goto NEXT;
				t-=k*a[5-i];
			}
			if (!t) res = min(res, pay+ret[p-P]);
NEXT:;
		}
		printf("%d\n", res);
	}
	return 0;
}

Measured memory_bytes: 2908
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int q, a, b, c, d;
  cin >> q;
  for(int i = 0; i < q; i++){
    cin >> a >> b >> c >> d;
    int ans = 0;
    for(int i = a; i <= c; i++){
      for(int j = b; j <= d; j++){
	if(i % 2 == 0 || j % 2 == 1) ans++;
      }
    }
    cout << ans << endl;
  }
}



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

int main(){
    int a, b, c, d, train, bus;
    cin >> a >> b >> c >> d;
    if(a>b) train = b;
    else train = a;
    if(c>d) bus = d;
    else bus = c;
    cout << train + bus << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		while(true) {
			int D=in.nextInt(),C=in.nextInt();
			if(D==0)break;
			
			double min=(double)10000000;
			for(int i=0;i<=D;i++){
				double x=(double)(D-i),y=(double)i;
				
				double diff=Math.abs(Math.sqrt((x*x)+(y*y))-(double)C);
				//System.out.println(x+" "+y+" "+diff);
				min=Math.min(min, diff);
			}
			System.out.printf("%.10f\n",min);
		}
	}

}



Measured memory_bytes: 26824
#include <stdio.h>

#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

int main()
{
    int i, j, cnt, maxv;
    char str[16];

    scanf("%s", str);

    cnt = 0;
    maxv = 0;
    for (i = 0; str[i] != '\0'; ++i) {
        if (str[i] == 'A' || str[i] == 'C' || str[i] == 'G' || str[i] == 'T') {
            cnt++;
        } else {
            cnt = 0;
        }
        maxv = max(cnt, maxv);
    }

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

    return 0;
}


Measured memory_bytes: 128
from sys import stdin
n,m = map(int,input().split())
sen = list(map(int,input().split()))
count = 0
al = 0
for i in sen:
    al += i
for i in sen:
    if i >= al/(4*m):
        count += 1
if count >= m:
    print("Yes")
else:
    print("No") 


Measured memory_bytes: 3064
import java.util.*

fun main(args: Array<String>) {
    val argList = Scanner(System.`in`)


    val firstLine = argList.nextLine().split(" ")
    val l = firstLine[0].toLong()
    val r = firstLine[1].toLong()

    val e = RemainderMinimization2019()
    println(e.execute(l, r))

}

class RemainderMinimization2019 {
    private val r2019 = 2019
    fun execute(l: Long, r: Long): Long {

        val lMod = l % r2019
        val rMod = r % r2019

        if (lMod == 0L || rMod == 0L) return 0

        if (l + (r2019 - lMod)  <= r ) {
            // 2019以上離れている場合、
            // 2019の倍数を選べばよいので、modの最小値は0
            return 0
        }

        var ans: Long = 2018
        for (n in l..r) {
            for (i in n + 1..r) {
                val result = n * i % r2019

                if (result == 0L) return 0

                if (ans > result) {
                    ans = result
                }
            }
        }

        return ans
    }
}

Measured memory_bytes: 36212
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
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; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
const int MOD = 1000000007;

struct city{
    int id, p, year;
};

bool comp(city a, city b){
    if (a.p == b.p){
        return a.year < b.year;
    }
    else{
        return a.p < b.p;
    }
}

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

    vector<city> P;
    rep(i,M){
        int p, y;
        cin >> p >> y;
        city c = {i,p,y};
        P.push_back(c);
    }

    sort(P.begin(), P.end(), comp);


    int prev_pre = -1;
    int count = 0;
    vector<string> ans(M, "");
    rep(i,M){
        city c = P[i];
        
        string t = "";
        ostringstream sout;
        sout << setfill('0') << setw(6) << c.p;
        if(prev_pre == c.p){
            count++;
        }
        else{
            count = 1;
            prev_pre = c.p;
        }
        sout << setfill('0') << setw(6) << count;
        t = sout.str();

        ans[c.id] = t;

    }

    rep(i,M){
        cout << ans[i] << endl;
    }

}

Measured memory_bytes: 7720
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		int c = saori.saori_hayami();
		if(a <= c && c <= b){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 23380
#include <iostream>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <vector>
#include <string>

using namespace std;

int main()
{
    string input;

    cin >> input;

    std::istringstream stream(input);
    std::vector<std::string> result;
    std::string field;

    while (std::getline(stream,field,'/')) {
        result.push_back(field);
    }

    int year = std::atoi(result[0].c_str());
    int month = atoi(result[1].c_str());
    int day = atoi(result[2].c_str());
    if (month < 4) {
        cout << "Heisei";
    }
    else if (month==4) {
        if (day <= 30) {
            cout << "Heisei";
        }
        else {
            cout << "TBD";
        }
    }
    else {
        cout << "TBD";
    }
    return 0;
}

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

mt19937_64 llrand(random_device{}());

#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x, v) memset((x), (v), sizeof(x))
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define _ << ", " <<
#define gcd(x, y) __gcd((x), (y))

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> plll;
typedef vector<int> vi;
typedef vector<vi> vii;

const ld EPS = 1e-9, PI = acos(-1.);
const ll LINF = 0x3f3f3f3f3f3f3f3f, LMOD = 1011112131415161719ll;
const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 1e5+5;

int n, k, dp[N], a[N];

int mex (vi &states) {
    if (states.empty()) return 0;
    if (states[0] != 0) return 0;
    for (int i = 1; i < states.size(); i++) {
        if (states[i]-1 > states[i-1]) return states[i-1]+1;
    }
    return states.back()+1;
}

int main () {
    scanf("%d%d", &n, &k);
    cl(dp, 63);
    dp[0] = 0;

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

    for (int i = 0; i < N; i++) {
        vi states;
        for (int j = 0; j < n; j++) {
            if (i-a[j] >= 0) states.pb(dp[i-a[j]]);
        }
        sort(states.begin(), states.end());
        dp[i] = mex(states);
    }

    printf("%s\n", dp[k] ? "First" : "Second");

    return 0;
}

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

product = [-1*a for a in A]

import heapq

# ヒープ化
heapq.heapify(product)
# ヒープから取り出す

for _ in range(M):
    min_val = heapq.heappop(product)
    discount_val = int(min_val / 2)

    # ヒープに要素を追加する
    heapq.heappush(product, discount_val)
    
print(-1*sum(product))

Measured memory_bytes: 73196
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<random>
#include<ctime>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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 d;
vector<int> c;
vector<vector<int>> s;

//状態
struct STATE {
    vector<int> x;
};

// 状態の初期化
void init (STATE& state) {
    state.x.resize(d);
    rep(i, d) {
        state.x[i] = 0;
    }
}

// 状態遷移
void modify (STATE& state) {
    int j = rand() % d;
    state.x[j] = rand() % 26;
}

// 状態のスコア計算
int calc_score (STATE& state) {
    vector<int> last(26, 0);
    int res = 0;
    rep(i, d) {
        last[state.x[i]] = i + 1;
        res += s[i][state.x[i]];
    }
    rep(j, 26) {
        res -= c[j] * (d - last[j]);
    }
    return res;
}

const double TIME_LIMIT = 1.90;

// 山登り法
void mountain() {
    STATE state;
    init(state);
    double start_time = clock();; // 開始時刻
    while (true) { // 時間の許す限り回す
        double now_time = clock();; // 現在時刻
        if (now_time - start_time > TIME_LIMIT) break;

        STATE new_state = state;
        modify(new_state);
        int new_score = calc_score(new_state);
        int pre_score = calc_score(state);

        if (new_score > pre_score) { // スコア最大化の場合
            state = new_state;
        }
    }
    //出力
    rep(i, d) {
        cout << state.x[i] + 1 << endl;
    }
}

void solve() {
	cin >> d;
    c.resize(26);
    rep(i, 26) cin >> c[i];
    s.assign(d, vector<int>(26, 0));
    rep(i, d) {
        rep(j, 26) {
            cin >> s[i][j];
        }
    }
    mountain();
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3728
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;


public class Main {
    public static void main(String[] args) {
        FastScanner fsc = new FastScanner();
        int a=fsc.nextInt();
        int b=fsc.nextInt();
        int c=fsc.nextInt();
        System.out.println(a+b==c||b+c==a||c+a==b?"Yes":"No");
    }
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 21332
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{
    int n,x,y;
    cin >>n >>x >>y;

    vector<vector<int> > dist(n, vector<int>(n, 0));
    vector<vector<int> > dist2(n, vector<int>(n, 0));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            dist[i][j] = max(i, j) - min(i, j);
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            dist2[i][j] = min(dist[i][j], dist[i][x-1]+dist[y-1][j]+1);
            dist2[i][j] = min(dist2[i][j], dist[i][y-1]+dist[x-1][j]+1);
        }
    }

    vector<int> ct(n+1, 0);
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            ct[dist2[i][j]]++;
        }
    }

    for(int i = 1; i < n; i++){
        printf("%d\n", ct[i]);
    }

    return 0;
}

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

#ifdef LOCAL
#include "../../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int N;
  cin >> N;
  vector<int> s(N);
  rep(i, N) cin >> s[i];
  ll ans = 0;
  for (int c = 1; c <= N; c++) {
    ll score = 0;
    set<int> used;
    for (int x = 0; x < (N + c) / c; x++) {
      if (N < c * x) break;
      int A = (N - 1) - c * x;
      int B = A - c;
      if (B <= 0) break;
      if (used.find(c * x) != used.end()) break;
      used.insert(c * x);
      score += s[c * x];
      if (used.find((N - 1) - c * x) != used.end()) break;
      used.insert((N - 1) - c * x);
      score += s[(N - 1) - c * x];
      ans = max(ans, score);
    }
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 7168
import Foundation

let n = Int(readLine()!)!
let inputString = readLine()!

var split: [Int] = inputString.components(separatedBy: " ").map{Int(String($0))!}
var exp = split
split.sort { $0 < $1 }
var i = 1
var count = 0
for i in 1...n {
    if (split[i-1] != exp[i-1]) {
        count += 1
    }
    
    if (count == 3) {
        break
    }
}

if (count == 3) {
    print("NO")
} else {
   print("YES") 
}


Measured memory_bytes: 14156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace November30
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] preDate = Console.ReadLine().Split(' ');
			string[] nextDate = Console.ReadLine().Split(' ');

			var a = new DateTime(2019, int.Parse(preDate[0]), int.Parse(preDate[1]));
			var b = new DateTime(2019, int.Parse(nextDate[0]), int.Parse(nextDate[1]));
			
			if (a.CompareTo(b) == -1)
			{
				if (nextDate[1] == "1")
				{
					Console.WriteLine("1");
				}
				else
				{
					Console.WriteLine("0");
				}
			}
			else
			{
				Console.WriteLine("0");
			}
			Console.ReadKey(true);
		}
	}
}


Measured memory_bytes: 11092
from collections import deque
n=int(input())
a=list(map(int,input().split()))
ans=deque([a[0]])
for i in range(1,n):
    if (n-1)%2==i%2:
        ans.appendleft(a[i])
    else:
        ans.append(a[i])
print(" ".join(map(str,ans)))


Measured memory_bytes: 29252
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    long long K; cin >> K;
    int ans = -1;
    int a = 0;
    for (int i = 1; i <= K; i++) {
        a = a*10 + 7;
        a %= K;
        if (a % K == 0) {
            ans = i;
            break;
        }
    }

    cout << ans << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3644
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder_問題
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            if(str == "A")
            {
                Console.WriteLine("T");
            }
            else if (str == "T")
            {
                Console.WriteLine("A");
            }
            else if(str == "C")
            {
                Console.WriteLine("G");
            }
            else if(str == "G")
            {
                Console.WriteLine("C");
            }
            else
            {

            }
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;

#define pi acos(-1)
int main() {
  string s, t;
  cin >> s >> t;
  int i = 0;
  for (; i < s.size() && s[i] == t[i]; i++) ;
  if (i >= s.size()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

const int MAX_N = 2e5;
ll fac[MAX_N+1], ifac[MAX_N+1], inv[MAX_N+1];

//mpow(x,n)で(x^n)をO(log(n))で計算
ll mpow(ll x, ll n){
    ll res = 1, now = x;
    while(n > 0){
        if(n & 1) res *= now, res %= MOD;
        now *= now, now %= MOD;
        n >>= 1;
    }
    return res;
}

//setcomb()でfac,ifac,invを全て計算
void setcomb(){
    rep2(i, 1, MAX_N){
        inv[i] = mpow(i, MOD-2);
    }
    //i!とi!の逆元
    fac[0] = 1, ifac[0] = 1;
    rep2(i, 1, MAX_N){
        fac[i] = (fac[i-1]*i) % MOD;
        ifac[i] = (ifac[i-1]*inv[i]) % MOD;
    }
}

//comb(n, k)でnCk
ll comb(int n, int k){
    ll c = fac[n];
    c *= ifac[n-k], c %= MOD;
    c *= ifac[k], c %= MOD;
    return c;
}

//perm(n, k)でnPk
ll perm(int n, int k){
    return(fac[n]*ifac[n-k])%MOD;
}

ll N, K;
ll p[111111];

//[1,k]の長さNの数列を作るときに最大公約数が1となる組み合わせの総数
ll num(int k){
    ll sum = 0;
    rep2(i, 2, k){
        if(p[i] <= 0) continue;
        if(p[i]&1) sum += mpow(k/i, N);
        else sum += MOD-mpow(k/i, N);
        sum %= MOD;
    }
    ll ans = mpow(k, N)+MOD-sum;
    return ans%MOD;
}

int main(){
    cin >> N >> K;
    fill_n(p, K+1, 0);
    rep2(i, 2, K){
        if(p[i] == 0){
            rep2(j, 1, K/i){
                if(j%i == 0) p[i*j] = -1;
                if(p[i*j] == -1) continue;
                p[i*j]++;
            }
        }
    }
    ll ans = 0;
    rep2(i, 1, K){
        ans += i*num(K/i);
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4376
import java.io.*;

class Main{
    public static void main(String[] a){
        StringBuffer sb = new StringBuffer(1024*1024);
        for(int i=1; i<=9; i++)
            for(int j=1; j<=9; j++)
                sb.append(i).append("x").append(j).append("=").append(i*j).append("\n");
        System.out.print(sb);
    }
}

Measured memory_bytes: 25952
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int N;
        cin >> N;

        vector<int> v(N),w(N);
        rep(i,0,N){
            cin >> v[i];
        }
        for(int i = 0; i < N; ++i){
            cin >> w[i];
        }

        ll ans = 0ll;
        for(int i = 0; i < N; ++i){
            if(v[i] - w[i] > 0){
                ans += (v[i] - w[i]);
            }
        }
        cout << ans << endl;


    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888