akhauriyash/Code-Regression huggingface dataset:
#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>
using namespace std;

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)  cout << #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; }
#define int long long

void solve() {
	ll n, m; cin >> n >> m;
    vector<LP> se[100100];
    rep(i, m) {
        ll l, r; ll c;
        cin >> l >> r >> c;
        --l; --r;
        se[l].pb(make_pair(r ,c));
    }
    priority_queue<LP, vector<LP>, greater<LP>> pque;
    ll dp[100100];
    rep(i, 100100) {
        dp[i] = 0;
    }
    for(auto q: se[0]) {
        ll r = q.fr, c = q.sc;
        pque.push(make_pair(c, r));
    }
    for(int i = 1; i < n; ++i) {
        while(true) {
            if(pque.empty()) {
                cout << -1 << endl;
                return;
            }
            LP s = pque.top();
            if(s.sc <= i) pque.pop();
            if(s.sc < i) continue;
            dp[i] = s.fr;
            break;
        }
        for(auto q: se[i]) {
            ll r = q.fr, c = q.sc;
            pque.push(make_pair(dp[i] + c, r));
        }
    }
    if(dp[n - 1] == 0) {
        cout << -1 << endl;
        return;
    }
    cout << dp[n - 1] << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 8056
#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";

lli ans[100100];
bool vis[100100];

vector<lli> G[100100];

void func(long long N, long long M, std::vector<long long> A, std::vector<long long> B){

    queue<lli> q;
    q.push(1);
    ans[1]=0;
    REP(i,0,100100)ans[i]=INF;
    ans[1] = 0;

    while(q.size()){
        lli top = q.front();
        q.pop();

        for(auto e:G[top]){
            if(ans[e] != INF)continue;
            ans[e] = top;
            q.push(e);
        }
    }

    REP(i,1,N+1){
        if(ans[i]==INF){
            cout<<"No"<<endl;
            return;
        }
    }

    cout<<"Yes"<<endl;
    REP(i,2,N+1){
        cout<<ans[i]<<endl;
    }

}

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

    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
    }
    func(N, M, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 15932
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);

  int n;
  cin >> n;
  vector<int> p(n);
  rep(i, n) { cin >> p[i]; }

  sort(p.begin(), p.end());
  p.back() /= 2;
  cout << accumulate(p.begin(), p.end(), 0) << endl;
  return 0;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int h, w;cin >> h >> w;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            string s;cin >> s;
            if(s == "snuke"){
                cout << char('A'+j) << i+1 << endl;
                return 0;
            }
        }
    }
    return 0;
}


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

#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;

#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)

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

typedef unsigned long long ll;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    rep(i, N) {
        if (A[i] == 0) {
            cout << "0" << endl;
            return 0;
        }
    }
    ll ans = 1;
    rep(i, N) {
        if (A[i] >= ((ll)INF + 1) / ans + 1) {
            cout << "-1" << endl;
            return 0;
        }
        ans *= A[i];
        if (ans >= (ll)(INF) + 1) {
            cout << "-1" << endl;
            return 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4016
import numpy as np

N = int(input())
a = np.array([list(map(int,input().split())) for _ in range(N)])
dp=np.zeros([N+1,3])

for i in range(1,N+1):
    for j in range(3):
        dp[i][j] = a[i-1][j]+max(dp[i-1][(1+j)%3],dp[i-1][(2+j)%3])
print(int(max(dp[N])))

Measured memory_bytes: 50484
import java.util.*;

class Main {

    static boolean isLeapYear (int year) {
        
        boolean result = false;

        if ( year % 4 == 0 ) {
            result = true;
            if ( year % 100 == 0 ) {
                result = false;
                if (year % 400 == 0) {
                    result = true;
                }
            }
        }
        
        return result;
    }

    static void solve (int a, int b) {
        boolean e = false;
        for(int y = a; y <= b; y++) {
            if ( isLeapYear(y) ) {
                System.out.println(y);
                e = true;
            }
        }

        if (!e) System.out.println("NA");
    }

    public static void main (String [] args) {

        Scanner sc = new Scanner(System.in);
        boolean first = true;

        while(true) {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if ( a == 0 && b == 0) break;

            if (!first) System.out.println("");
            else        first = false;

            solve(a, b);
            
        }

    }
}

Measured memory_bytes: 12000
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdio>
using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<double> x(N), y(N);
    for (int i=0; i<N; i++)
        cin>>x[i]>>y[i];

    auto f1 = [&](double ox, double oy)
    {
        double r = 0;
        for (int i=0; i<N; i++)
            r = max(r, hypot(x[i]-ox, y[i]-oy));
        return r;
    };

    auto f2 = [&](double ox)
    {
        double l = 0;
        double r = 1000;
        for (int i=0; i<100; i++)
        {
            double m1 = (2*l+r)/3;
            double m2 = (l+2*r)/3;
            if (f1(ox, m1) < f1(ox, m2))
                r = m2;
            else
                l = m1;
        }
        return f1(ox, l);
    };

    auto f3 = [&]()
    {
        double l = 0;
        double r = 1000;
        for (int i=0; i<100; i++)
        {
            double m1 = (2*l+r)/3;
            double m2 = (l+2*r)/3;
            if (f2(m1) < f2(m2))
                r = m2;
            else
                l = m1;
        }
        return f2(l);
    };

    printf("%.10f\n", f3());
}


Measured memory_bytes: 256
import math

a, b = map(int, input().split())
fa = math.factorial(a)
fb = math.factorial(b)
mod = 10**9 + 7
fa %= mod
fb %= mod
k = fa*fb

if abs(a-b) >= 2:
  print(0)
elif abs(a-b) == 1:
  print(k%mod)
elif abs(a-b) == 0:
  print((2*k) % mod)

Measured memory_bytes: 47580
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const ll MOD = 1e9 +7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin>>n>>k;
    vector<ll> t(n),d(n);
    vector<pair<ll,ll> > v(n);
    rep(i,n){
        cin>>t[i]>>d[i];
        v.pb(make_pair(d[i],t[i]));
    }
    sort(v.begin(),v.end(),greater<pair<ll,ll> >());
    ll ans=0;
    set<ll> st;
    priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > > q;
    for(int i=0;i<k;i++){
        ans +=v[i].first;
        if(st.count(v[i].second)) q.push(v[i]);
        st.insert(v[i].second);
    }
    ll s=(ll)st.size();
    ans += s*s;
    vector<ll> res(n);
    res.pb(ans);
    for(int i=k;i<n;i++){
        if(!q.empty() && !st.count(v[i].second)){
            ans=ans-q.top().first+v[i].first-s*s+(s+1)*(s+1);
            res.pb(ans);
            q.pop();
            s++;
            st.insert(v[i].second);
        }
    }
    sort(res.begin(),res.end(),greater<ll>());
    cout <<res[0]<<endl;
    return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int A,B,C,X; cin >> A >> B >> C >> X;
    int ans = 0;
    REP(i,A+1){
        REP(j,B+1){
            REP(k,C+1){
                if(500*i + 100*j + 50*k == X) ans ++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
import math
from collections import deque

N = int(input())

def prime(n):
    if(n == 1):
        return False
    for i in range(2, int(math.sqrt(n))+1):
        if(n % i == 0):
            return False
        
    return True
A = []
cnt = 0
for i in range(2, 55556):
    if(prime(i)):
        if(i % 5 == 1):
            A.append(i)
            cnt += 1
            if(cnt == N):
                break
                
for i in range(N):
    print(A[i], end=' ')

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,tg,smin=100000;
  cin >> n;
  vector<int> w(n);
  for(int i=0;i<n;i++){
    cin >> w[i];
  }
  for(int t=0;t<n;t++){
    int s1 = 0;
    int s2 = 0;
    tg = w[t];

    for(int i=0;i<n;i++){
      if(i<=t) s1+= w[i];
      else s2 += w[i];

    }

    int sa = s1-s2;

    if(sa<0) sa *= -1;

    smin = min(smin,sa);
  }
  cout << smin << endl; 
}




  
  


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

using namespace std;

typedef long long int64;

const int64 INF = 1LL << 58;

int main()
{
  int64 N, K, A[15];

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

  int64 ret = INF;
  for(int i = 0; i < 1 << N; i++) {
    if(__builtin_popcount(i) < K) continue;
    int64 cost = 0, last = 0;
    for(int j = 0; j < N; j++) {
      if((i >> j) & 1) {
        last = max(last + 1, A[j]);
        cost += last - A[j];
      } else if(A[j] > last) {
        cost = INF;
      }
    }
    ret = min(ret, cost);
  }

  cout << ret << endl;
}



Measured memory_bytes: 256
#include <stdio.h>


int main(void){
    
    char s[200001],t[200001];
    long int ans= 0;;
    scanf("%s\n",s);
    scanf("%s",t);

    for(int i = 0;s[i] != '\0';i++)
        if(s[i] != t[i]) ans ++;


    printf("%ld",ans);

    return 0;
}

Measured memory_bytes: 2116
#include <iostream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
long long cum[200005],k,ans;
int main()
{
	tree<long long,null_type,less_equal<long long>,rb_tree_tag,tree_order_statistics_node_update> t;
	t.insert(0);
	int n;
	scanf("%d%lld",&n,&k);
	for (int i=1;i<=n;i++)
	{
		int a;
		scanf("%d",&a);
		cum[i]=cum[i-1]+a;
		ans+=t.order_of_key(cum[i]-k*i+1);
		t.insert(cum[i]-k*i);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 14336
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
ll n;
ll a[100001];
int main() {
	cin >> n;
	ll t;
	rep(i, n) {
		cin >> t;
		a[t]++;
	}
	ll ans = 1;
	if (n % 2 == 0) {
		for (int i = 1; i < n; i += 2) {
			if (a[i] != 2) {
				cout << 0 << endl;
				return 0;
			}
		}
		ll tp = n / 2;
		rep(i, tp) {
			ans = ans * 2 % mod;
		}
		cout << ans << endl;
	}
	else {
		if (a[0] != 1) {
			cout << 0 << endl;
			return 0;
		}
		for (int i = 2; i < n; i += 2) {
			if (a[i] != 2) {
				cout << 0 << endl;
				return 0;
			}
		}
		ll tp = n / 2;
		rep(i, tp) {
			ans = ans * 2 % mod;
		}
		cout << ans<< endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
struct Task
{
    int time;
    int deadline;
    bool operator<(const Task &o)const{return deadline<o.deadline;}
};
int main()
{
    int n;
    cin>>n;
    vector<Task> tasks(n);
    for(int i=0;i<n;++i)cin>>tasks[i].time>>tasks[i].deadline;
    sort(tasks.begin(),tasks.end());
    int acc = 0;
    for(auto t:tasks)
    {
        if(t.time + acc <= t.deadline)
            acc += t.time;
        else{
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
}

Measured memory_bytes: 1792
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int main() {

    int N; cin >> N;
    vector < ll > a(N), b(N);
    REP(i,N) cin >> a[i];
    REP(i,N) cin >> b[i];

    vector < pair < ll,ll > > order;
    REP(i,N) {
        order.push_back(make_pair(b[i] - a[i], i));
    }

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

    ll prea = 0;
    REP(idx,N) {
        ll i = order[idx].second;
        ll diff = abs(a[i] - b[i]);
        if (a[i] > b[i]) {
            prea += diff;
        } else {
            ll minus = min(prea * 2, diff);
            prea -= minus / 2;
        }
    }

    if (prea > 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main(){
  string A,B,C;
  cin >> A >> B >> C;
  long long x=0,y=0,z=0,a=0;
  while(1){
    if(a==0){
      if(x==A.size()){
        cout << 'A' << endl;
        return 0;
      }
      if(A[x]=='a'){
        a=0;
      }else if(A[x]=='b'){
        a=1;
      }else if(A[x]=='c'){
        a=2;
      }
      x++;
    }else if(a==1){
      if(y==B.size()){
        cout << 'B' << endl;
        return 0;
      }
      if(B[y]=='a'){
        a=0;
      }else if(B[y]=='b'){
        a=1;
      }else if(B[y]=='c'){
        a=2;
      }
      y++;
    }else if(a==2){
      if(z==C.size()){
        cout << 'C' << endl;
        return 0;
      }
      if(C[z]=='a'){
        a=0;
      }else if(C[z]=='b'){
        a=1;
      }else if(C[z]=='c'){
        a=2;
      }
      z++;
    }
  }
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int N;
    cin >> N;
    int ans;

    int i = 0;
    int A[100001] = {0};
    int a;
    while(i<N){
        cin >> a;
        A[a]++;
        i++;
    }

    int j=0;
    for(i=1;i<100001;i++){
        if(A[i]>0){
            j++;
        }
    }

    if(j%2==1){
        ans=j;
    }else{
        ans=j-1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
sx,sy,tx,ty = map(int,input().split())
ans = ""

ans += "U" * abs(ty-sy)
ans += "R" * abs(tx-sx)
ans += "D" * abs(ty-sy)
ans += "L" * (abs(tx-sx)+1)
ans += "U" * (abs(ty-sy)+1)
ans += "R" * (abs(tx-sx)+1)
ans += "D"
ans += "R"
ans += "D" * (abs(ty-sy)+1)
ans += "L" * (abs(tx-sx)+1)
ans += "U"

print(ans)

Measured memory_bytes: 9100
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.util.*;
public class Main
{   
static class FastReader 	
{		
BufferedReader br; 		
StringTokenizer st; 		
public FastReader() 		
{ 			
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; 		
		 } 	
	 }
	
	 public static void main(String[] args){
		 FastReader scan=new FastReader();
		 int t = scan.nextInt();
		 if(t%1000 == 0)System.out.println(0);
		 else System.out.println(1000 - t%1000);
	} 
} 


Measured memory_bytes: 32412
package main

import "fmt"

func main() {
	var people, days, modNum int

	fmt.Scanf("%d", &people)
	fmt.Scanf("%d %d", &days, &modNum)

	var data int
	var eatedChoco int
	var eatedChocoTotal int = 0
	for i := 0; i < people; i++ {
		eatedChoco = 0
		fmt.Scanf("%d", &data)

		var counter int = 0
		for {
			if counter*data+1 <= days {
				eatedChoco++
			} else {
				break
			}
			counter++
		}
      	// デバッグ文消し忘れたぁぁぁぁぁぁぁぁぁぁぁx
		// fmt.Println(eatedChoco)

		eatedChocoTotal += eatedChoco
	}

	fmt.Print(eatedChocoTotal + modNum)
}


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

using namespace std;

int main() {
  int n;
  while( cin >> n, n ) {
    vector<int> vec(n);
    for(int i=0;i<n;++i) cin >> vec[i];
    sort(vec.begin(),vec.end());
    int mini = INT_MAX;
    for(int i=0;i<n-1;++i) {
      mini = min(mini,vec[i+1]-vec[i]);
    }
    cout << mini << endl;
  }
  return 0;
}

Measured memory_bytes: 3104
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

# import numpy as np
# from scipy.special import perm
# from scipy.special import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

########
X = input()

cnt = 0
sum_cnt = 0
for xi in X:
    if xi == "S":
        cnt += 1
    else:
        if cnt > 0:
            cnt -= 1
            sum_cnt += 1

print(len(X) - sum_cnt*2)

Measured memory_bytes: 41564
n = int(input())
a = [int(i) for i in input().split()]
flag = False
cnt = 0
for i in range(n-1):
    if flag: break
    flag = True
    for j in range(n-1,i,-1):
        if a[j] < a[j-1]:
            a[j],a[j-1] = a[j-1],a[j]
            cnt += 1
            flag = False
print(" ".join(map(str,a)))
print(cnt)


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

using namespace std;

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

void dfs (vector<int> A) {
    if ( A.size() == N + 1 ) {
        /* 出来上がった数列のスコアを計算 */
        int now = 0;
        for ( int i=0; i<Q; i++ ) {
            if ( A.at(b.at(i)) - A.at(a.at(i)) == c.at(i) )
                now += d[i];
        }
        ans = max(ans, now);
        return;
    }

    A.push_back(A.back());
    while ( A.back() <= M ) {
        dfs(A);
        A.back()++;
    }
}

int main (void) {
    cin >> N >> M >> Q;
    a = b = c = d = vector<int>(Q);
    for ( int i=0; i<Q; i++ )
        cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);

    ans = 0;
    dfs(vector<int>(1, 1));
    cout << ans << endl;

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N + 2), DP(N + 2, 1e9);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  DP.at(0) = 0;
  for (int i = 0; i < N; i++) {
    DP.at(i + 1) = min(DP.at(i + 1), DP.at(i) + abs(A.at(i + 1) - A.at(i)));
    DP.at(i + 2) = min(DP.at(i + 2), DP.at(i) + abs(A.at(i + 2) - A.at(i)));
  }
  cout << DP.at(N - 1) << "\n";
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
 
void A()
{
    // 入力
    int A, B;
    cin >> A >> B;
    
    // 出力
    cout << A * B << endl;
}

void B()
{
    // 入力
    int N;
    cin >> N;
    
    vector<unsigned long long int> A(N);
    for( int i = 0; i < N; ++i )
        cin >> A[i];
    
    // 0があるかチェック
    for( auto i : A ){
        if( i == 0 ){
            cout << 0 << endl;
            return;
        }
    }
    
    // 全部かける
    unsigned long long int mul = 1;
    unsigned long long int tmp = 1;
    for( int i = 0; i < N; ++i ){
        tmp = mul * A[i];

        // 10^18を超えたかチェック
        if( tmp < mul || 1000000000000000000 < tmp ){
            cout << -1 << endl;
            return;
        }
        
        mul = tmp;
    }
    
    // 出力
    cout << mul << endl;
}

int main()
{
    //A();
    B();
    
    return 0;
}


Measured memory_bytes: 3996
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"
#define fcout cout << fixed << setprecision(18)

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926535
/*
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
*/
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1
#define LINF 1000000000000000001 // 1e18+1

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  string s;cin>>s;
  ll k;cin>>k;
  int num=1;
  int index;
  for(int i=0;i<(int)s.size();i++){
    if(s[i]!='1'){
      num=s[i] - 48;
      index=i+1;
      break;
    }
  }
  if(k<index){
    P(1);
  }else{
    P(num);
  }
  return 0;
}


Measured memory_bytes: 256
def main():
    s = list(input())
    t = list(input())

    for i in range(len(s)-len(t), -1, -1):
        flag = 1
        for j in range(len(t)):
            if s[i+j] == t[j] or s[i+j] == "?":
                flag = flag * 1
            else:
                flag = 0
        if flag:
            ans = ["a" if x == "?" else x for x in s]
            for k in range(len(t)):
                ans[i+k] = t[k]
            print("".join(ans))
            exit()
    print("UNRESTORABLE")

if __name__ == "__main__":
    main()

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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

typedef complex<double> P;
typedef vector<P> G;
#define here(g, i) g[i]
#define next(g, i) g[(i + 1) % g.size()]
#define prev(g, i) g[(i - 1 + g.size()) % g.size()]
const double EPS = 1e-10;
const double INF = 1e12;

struct L {
    P a, b, v;
    L(){}
    L(P _a, P _b) : a(_a), b(_b), v(b - a) {}
    L(double _ax, double _ay, double _bx, double _by) : L(P(_ax, _ay), P(_bx, _by)) {}
};

double cross(P a, P b) {
    return imag(conj(a) * b);
}

double dot(P a, P b) {
    return real(conj(a) * b);
}

int ccw(P p0, P p1, P p2) {
    if (cross(p1 - p0, p2 - p0) > 0) return +1; // counter-clockwise
    if (cross(p1 - p0, p2 - p0) < 0) return -1; // clockwise
    if (dot(p1 - p0, p2 - p0) < 0) return +2;   // online_back
    if (dot(p0 - p1, p2 - p1) < 0) return -2;   // online_front
    return 0;                                   // on_segment
}

bool isConvex(G g) {
    int n = g.size();
    rep(i, n) {
        if (ccw(prev(g, i), here(g, i), next(g, i)) == -1) {
            return false;
        }
    }
    return true;
}

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

    int n;
    cin >> n;
    G g;
    while (n--) {
        double x, y;
        cin >> x >> y;
        g.emplace_back(x, y);
    }

    cout << isConvex(g) << endl;
}

Measured memory_bytes: 3240
#pragma GCC optimize("Ofast",3,"inline")
#include <bits/stdc++.h>
using namespace std;
int h[100000],n;
bool whether(int m){
	if(m==0) return 1;
	if(h[m-1]-h[m]>1) return 0;
	if(h[m-1]-h[m]==1)h[m-1]--;
	return (whether(m-1));
}
int main(){
	ios_base::sync_with_stdio(false);
	cin>>n;
	for(int i=0;i<n;i++) cin>>h[i];
	if(whether(n-1))cout<<"Yes";
	else cout<<"No";
	return 0;
}



Measured memory_bytes: 640
using namespace std;

#include <bits/stdc++.h>

int main(){
    int N;
    cin >> N;
    stack< char > a;
    stack< char > b;
    for ( int i = 0; i < N; i ++ ){
        char k;
        cin >> k;
        a.push( k );
    }
    while ( a.size() > 1 ){
        char c1 = a.top();
        a.pop();
        char c2 = a.top();
        a.pop();
        if ( c1 == c2 ) a.push( c1 );
        else{
            b.push( c1 );
            a.push( c2 );
        }
    }
    if ( !a.empty() ) cout << b.size() + 1;
    else cout << b.size();
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	if(n<1200){
		cout<<"ABC"<<endl;
		return 0;
	}
	if(n<2800){
		cout<<"ARC"<<endl;
		return 0;
	}
	cout<<"AGC"<<endl;
	return 0;
}


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

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ll long long unsigned
#define pii pair<int,int>
#define tii tuple <int,int,int>
#define N 1000005
#define mod 2000003
#define X first
#define Y second
#define eps 0.0000000001
#define all(x) x.begin(),x.end()
#define tot(x) x+1,x+n+1
using namespace std;
bool b[110][110];
int sol,n,m,k,i,j,x,y,a;
int main() {
    cin.sync_with_stdio(0);
    cout.sync_with_stdio(0);
    cin>>n>>m>>k;
    for(; k; k--) {
        cin>>x>>y>>a;
        if(a==1)
            for(i=1; i<=x; i++)
                for(j=1; j<=m; j++)
                    b[i][j]=1;
        if(a==2)
            for(i=x+1; i<=n; i++)
                for(j=1; j<=m; j++)
                    b[i][j]=1;
        if(a==3)
            for(i=1; i<=y; i++)
                for(j=1; j<=n; j++)
                    b[j][i]=1;
        if(a==4)
            for(i=y+1; i<=m; i++)
                for(j=1; j<=n; j++)
                    b[j][i]=1;
    }
    for(i=1; i<=n; i++)
        for(j=1; j<=m; j++)
            if(!b[i][j])
                sol++;
    cout<<sol;
    return 0;
}




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

int main() {
    int N, num = 0; cin >> N;
    vector<string> a(N);
    vector<pair<int, string>> n;
    for (int i = 0; i < N; i++) cin >> a.at(i);
    sort(a.begin(), a.end());
    for (int i = 0; i < N; i++) {
        if (i == 0) n.push_back(make_pair(0, a.at(i)));
        else {
            if (n.at(num).second == a.at(i)) {
                n.at(num).first--;
            } else {
                n.push_back(make_pair(0, a.at(i)));
                num++;
            }
        }
    }
    sort(n.begin(), n.end());
    for (int i = 0; i < n.size(); i++) {
        if (n.at(0).first == n.at(i).first) cout << n.at(i).second << endl;
    }
}

Measured memory_bytes: 18548
#28 ABC131C
a,b,c,d=map(int,input().split())
a-=1

def gcd(a,b):
	while b:
		a,b=b,a%b
	return a
def lcm(a,b):
	return a*b//gcd(a,b)

x=b-b//c-b//d+b//lcm(c,d)
y=a-a//c-a//d+a//lcm(c,d)
print(x-y)

Measured memory_bytes: 38384
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<iostream>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

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

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

ll lcm(ll a,ll b)
{
   return a/gcd(a,b)*b;
}

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}
//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(true){
        ll c;
        cin>>c;
        if(c==0) break;
        else{
            vec<ll> dp(c+10,0);
            dp[0]=0;
            dp[1]=1;
            dp[2]=2;
            dp[3]=4;
            for(ll j=4;j<=c;j++){
                dp[j]=dp[j-1]+dp[j-2]+dp[j-3];
            }
            cout<<ceil((double)dp[c]/3650)<<endl;
        }
    }
    return 0;
}



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

int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    vector<int> commonDivisorList;
    for (int c = 1; c <= min(a, b); c++)
    {
        if (a % c == 0 && b % c == 0)
        {
            commonDivisorList.push_back(c);
        }
    }
    cout << commonDivisorList.at(commonDivisorList.size() - k) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
template<class T> constexpr bool in_range(T y, T x, T H, T W) { return 0<=y&&y<H&&0<=x&&x<W; }

int N;
int score[6];

void drop(vector<vector<int>>& a) {
  rep(j, 5) {
    deque<int> d;
    rep(i, 5) {
      if(a[i][j] != -1) {
        d.push_back(a[i][j]);
      }
    }

    int dsize = d.size();
    for(int i=4; i>=0 && !d.empty(); i--) {
      a[i][j] = d.back();
      d.pop_back();
    }
    rep(i, 5-dsize) {
      a[i][j] = -1;
    }
  }
}

int dist(vector<vector<int>> const& a, int num, int i, int j, int dy, int dx, int sum = 0) {
  i += dy, j += dx;
  if(!in_range(i, j, 5, 5)) return sum;
  if(a[i][j] != num) return sum;
  return dist(a, num, i, j, dy, dx, sum + 1);
}

int simulate(vector<vector<int>>& a) {
  int ret = 0;
  int bonus = 1;

  while(1) {
    set<int> used;
    rep(i, 5) rep(j, 5) {
      if(a[i][j] == -1) continue;
      int movel = dist(a, a[i][j], i, j, 0, -1);
      int mover = dist(a, a[i][j], i, j, 0, +1);
      int movet = dist(a, a[i][j], i, j, -1, 0);
      int moveb = dist(a, a[i][j], i, j, +1, 0);
      if(mover - movel + 1 >= 3) {
        REP(x, j - movel, j + mover + 1) {
          assert(a[i][x] != -1);
          assert(a[i][x] == a[i][j]);
          used.insert(i*5+x);
        }
      }
      if(moveb - movet + 1 >= 3) {
        REP(y, i - movet, i + moveb + 1) {
          assert(a[y][j] != -1);
          assert(a[y][j] == a[i][j]);
          used.insert(y*5+j);
        }
      }
    }

    for(auto && e: used) {
      ret += score[a[e/5][e%5]] * bonus;
      a[e/5][e%5] = -1;
    }

    bonus ++;
    if(!used.size()) break;
    drop(a);
  }

  return ret;
}



int dfs(vector<vector<int>> a, int y, int x, int idx = 0) {
  auto aa = a;
  int ret = simulate(a);
  if(idx < N) {
    rep(k, 4) {
      int ny = y + dy[k], nx = x + dx[k];
      if(!in_range(ny, nx, 5, 5)) continue;
      a = aa;
      swap(a[y][x], a[ny][nx]);
      maximize(ret, dfs(a, ny, nx, idx + 1));
    }
  }
  return ret;
}

int solve(vector<vector<int>>& a) {
  int ret = 0;
  rep(i, 5) rep(j, 5)  {
    maximize(ret, dfs(a, i, j));
  }
  return ret;
}

int main() {

  for(; cin >> N && N >= 0;) {
    vector<vector<int>> a(5, vector<int>(5));
    rep(i, 5) rep(j, 5) cin >> a[i][j];
    rep(i, 5) cin >> score[i+1];
    cout << solve(a) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3156
N,Y = map(int, input().split())
yukichi = -1
higuchi = -1
noguchi = -1

for a in range(N+1):
    for b in range(N-a+1):
        c = N -a-b
        total = 10000*a + 5000 * b + 1000*c
        if (Y == total):
            yukichi = a
            higuchi = b
            noguchi = c
print("%d %d %d"%(yukichi,higuchi,noguchi))

Measured memory_bytes: 3064
_, _, x, y = gets.chomp.split.map(&:to_i)
xl = gets.chomp.split.map(&:to_i).sort
yl = gets.chomp.split.map(&:to_i).sort

def judge(x, y, xmax, ymin)
  range = [xmax+1, ymin]
  range[0] = [range[0], x+1].max
  range[1] = [range[1], y].min
  return false if range[0] > range[1]

  return true
end

xs = xl.max
ys = yl.min

puts judge(x, y, xs, ys) ? 'No War' : 'War'



Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include <math.h>
#define lli long long int
#include <limits.h>
#include <fstream>

using namespace std;

/*lli gcd(lli a,lli b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}*/

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli i,j,tt=1;
    //cin>>tt;
    while(tt--)
    {
        int h,w,k,total=0,ans=0;
        cin>>h>>w>>k;
        string grid[h];
        for(i=0;i<h;i++)
            cin>>grid[i];
        for(i=0;i<h;i++)
        {
            for(j=0;j<w;j++)
            {
                if(grid[i][j]=='#')
                {
                    total++;
                }
            }
        }
        for(i=0;i<(1<<h);i++)
        {
            for(j=0;j<(1<<w);j++)
            {
                int temp=total;
                int tempi=i;
                for(int row=0;row<h;row++)
                {
                    int tempj=j;
                    for(int col=0;col<w;col++)
                    {
                        if(tempi%2 || tempj%2)
                        {
                            if(grid[row][col]=='#')
                                temp--;
                        }
                        tempj/=2;
                    }
                    tempi/=2;
                }
                //cout<<temp<<" "<<i<<" "<<j;
                if(temp==k)
                    ans++;
            }
        }
        cout<<ans<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3648
N, K, Q = input().split(" ")
N = int(N)
K = int(K)
Q = int(Q)

ans = [0 for xi in range(N)]
l = []
for yi in range(Q):
    Ain = input()
    Ain = int(Ain)
    ans[Ain-1] = ans[Ain-1]+1

for yi in range(N):
    if Q-K<ans[yi]:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 4636
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=50;
int a[N],b[N],as=0,bs=0;
inline void solve(lint n){
	if(n==1){
		return;
	}
	solve(n>>1);
	a[as]=as+bs+1,as++;
	if(n&1){
		b[bs]=as+bs+1,bs++;
	}
}
int main(){
	lint n=next_num<lint>();
	solve(n+1);
	printf("%d\n",(as+bs)<<1);
	for(int i=bs-1;i>=0;i--){
		printf("%d ",b[i]);
	}
	for(int i=0;i<as;i++){
		printf("%d ",a[i]);
	}
	for(int i=1,ti=as+bs;i<=ti;i++){
		printf("%d ",i);
	}
	putchar('\n');
	return 0;
}

Measured memory_bytes: 256
"use strict"
function Main(input){
  input=input.split(/\s+/);
  var N=parseInt(input.shift());
  var sum=0;
  for(let i=0;i<N;i++){
    input[2*i]=parseFloat(input[2*i]);
    if(input[2*i+1]==="BTC")input[2*i]*=380000;
    sum+=input[2*i];
  }
  console.log(sum);
}

Main(require('fs').readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 21064
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    n = int(input())
    A = list(map(int, input().split()))

    mod = 10**9 + 7
    s = sum(A)
    ans = 0
    for i in range(n):
        s -= A[i]
        ans += A[i]*s
    print(ans%mod)


if __name__ == '__main__':
    main()


Measured memory_bytes: 93604
n,m,x,y = map(int,input().split())
x_in = list(map(int,input().split()))
y_in = list(map(int,input().split()))

x_in.append(x)
y_in.append(y)

x_in.sort()
y_in.sort()

x_max = x_in[-1]
y_min = y_in[0]

if x_max < y_min:
    print("No War")
else:
    print("War")

Measured memory_bytes: 3064
N = int(input())
A = input()
B = input()
C = input()

ret = 0
for i in range(N) :
  s = set([A[i], B[i], C[i]])
  if len(s) == 3 :
    ret += 2
  elif len(s) == 2 :
    ret += 1
  
print(ret)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }


int n, m;
vector<double> dp(700);
vector<vector<int> > v(700);
int flg;
int cut = -1;

double dfs(int now) { // 返り値intにしてたorz
    if (dp[now]) return dp[now];
    if (now == n - 1) return 0;
    double ret = 0;
    double mmax = 0;
    for (int nxt : v[now]) {
        double tmp = dfs(nxt);
        if (tmp == 0 && nxt != n - 1) flg = 1;
        ret += tmp;
        chmax(mmax, tmp);
    }
    if (now == cut) ret -= mmax;
    int div = sz(v[now]) - (cut == now ? 1 : 0);
    if (div == 0) flg = 1;
    ret /= div;
    ret++;
    return dp[now] = ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n >> m;
    vector<int> s(m), t(m);
    rep(i, m) {
        cin >> s[i] >> t[i];
        s[i]--; t[i]--;
        v[s[i]].eb(t[i]);
    }
    double ans = dfs(0);
    // rep(j, n) cout << dp[j] << " "; cout << endl;
    rep(i, n) { // 消す辺全探索
        cut = i;
        rep(j, n) dp[j] = 0;
        flg = 0;
        dfs(0);
        if (flg) continue;
        if (dp[0] == 0) continue;
        // cout << dp[0] << endl;
        chmin(ans, dp[0]);
        // rep(j, n) cout << dp[j] << " "; cout << endl;
    }
    cout << fixed << setprecision(7) << ans << endl;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define s(x, n) memset(x, n, sizeof(x));
#define pb(x) push_back(x)
#define NIL -1
#define MAXN 11

void solve()
{
    int n, k;
    cin >> n >> k;
    int arr[n + 1];
    for (int i = 1; i <= n; i++)
        cin >> arr[i];
    bool dp[k + 1];
    s(dp, false);
    for (int i = 0; i <= k; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            if (i - arr[j] >= 0 && !dp[i - arr[j]])
            {
                dp[i] = true;
            }
        }
    }
    cout << (dp[k] ? "First" : "Second")
         << "\n";
}
int main()
{
#ifdef WIN32
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

#ifndef WIN32
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#endif
    int t;
    t = 1;
    /// cin >> t;
    for (int I = 1; I <= t; I++)
    {
        solve();
    }
    return 0;
}

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

using namespace std;


int main() {
  ios_base::sync_with_stdio(false);
  int n, d, i = 0, s;
  cin >> n >> d;
  s = d*2 + 1;
  while (n > 0){
    n -= s;
    i++;
  }
  cout << i << endl;
}


Measured memory_bytes: 256
use strict;
use warnings;

my ($max, $prev) = (1, 0);
my @num = ();
my $r = "Yes";

while(<>){
	chomp;
	@num = split(/ /) if($. == 2);
}

foreach my $now (@num){
	$max = $now if($now > $max);
	if($max - $now > 1){
		$r = "No";
		last;
	}
	if($now >= $prev){
		$prev = $now;
	}
	elsif($now - 1 >= $prev){
		$prev = $now - 1;
	}
	elsif($prev - 1 >= $now){
		$prev--;
	}
	else{
		$r = "No";
		last;
	}
}

print $r;


Measured memory_bytes: 17444
import java.util.Scanner;

public class Main {
	
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        String S = sc.nextLine();
        
        if (S.length() == 1) {
        	System.out.println(S);
        	return;
        }
        
        char[] string = S.toCharArray();
       
        long ans = 0;
        for (int i = 0; i < Math.pow(2, S.length()-1); i++) {
        	String binary = Integer.toBinaryString(i);
        	binary = new StringBuffer(binary).reverse().toString();
        	String sub = "";
        	for (int j = 0; j < binary.length(); j++) {
        		if (binary.charAt(j) == '1') {
        			sub = sub + string[j];
        			ans+= Long.parseLong(sub);
        			sub = "";
        		} else {
        			sub = sub + string[j];
        		}
        	}
        	
        	if (binary.length() != S.length()) {
        		sub += new String(string, binary.length(), S.length() - binary.length());
        		ans+= Long.parseLong(sub);
        	}
        	
        }
       
        
        System.out.println(ans);
    }
}	

Measured memory_bytes: 21844
#include<stdio.h>
#include<string.h>
int main()
{
    char st[10];
    int len,i;
    scanf("%s",&st);
    len=strlen(st);
    for(i=0;i<len;i++)
    {
        if(i==3)
        st[3]='8';
    }
    printf("%s\n",st);


    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <queue>

using namespace std;

int main() {
    
    
    int n, x;
    cin >> n >> x;
    int c = 0;
    vector<int> m(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> m[i];
        c += m[i];
    }
    
    sort(m.begin(), m.end());
    
    int rem = x - c;
    
    cout << n + rem / m[0] << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int a;
	cin >> a;
	int b[a];
	int tmp;
	for(int i=0; i<a; i++){
		b[i]=0;
	}
	
	for(int i=0; i<a-1; i++){
		cin >> tmp;
		b[tmp-1]++;
	}
	for(int i=0; i<a; i++){
		if(i!=a-1) cout << b[i] << endl;
		else cout <<b[i];
	}
    return 0;
}

Measured memory_bytes: 4440
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int numberOfDivisor(int n){
    int cnt = 0;
    for(int i=1;i<=n;i++){
        if (n%i==0)cnt++;
    }
    return cnt;
}
int main() {
    int N; cin >> N;
    int res = 0;
    for (int i=1;i<=N;i+=2) if (numberOfDivisor(i)==8) res++;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
int main()
{
    string s;
    cin >> s;
    int w;
    cin >> w;
    int n = s.size();
    vector<char> b[1005];
    rep(i, n)
    {
        b[i % w].push_back(s[i]);
    }
    rep(i, 1)
    {
        for (auto c : b[i]) {
            cout << c;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  vector<ll> b(n);
  rep(i,n){
    b[i] = -(i+1)+a[i];
  }
  sort(b.begin(), b.end());
  ll bb = b[n/2];
  ll ans = 0;
  rep(i,n){
    ans += abs(a[i]-(bb+i+1));
  }
  cout << ans << endl;
}

Measured memory_bytes: 3328
INT_MAX=10**11+7
MOD=10**9+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]
GETA=123
###############################################################################
from decimal import *
a,b=map(Decimal,input().split())
print(int(a*b))

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

int main(){
 int a,b,c,d,e,k;
 cin>>a>>b>>c>>d>>e>>k;

 if(e-a<=k){
     cout<<"Yay!"<<endl;
 }
 else{
     cout<<":("<<endl;
 }
}


Measured memory_bytes: 256