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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	ll x[1252], y[1252], z[1252], xyz0[1252], xyz1[1252], xyz2[1252], xyz3[1252], xyz4[1252], xyz5[1252], xyz6[1252], xyz7[1252];
	cin>>n>>m;
	REP(i, n){
		cin>>x[i]>>y[i]>>z[i];
		xyz0[i]=x[i]+y[i]+z[i];
		xyz1[i]=x[i]+y[i]-z[i];
		xyz2[i]=x[i]-y[i]+z[i];
		xyz3[i]=-x[i]+y[i]+z[i];
		xyz4[i]=x[i]-y[i]-z[i];
		xyz5[i]=-x[i]+y[i]-z[i];
		xyz6[i]=-x[i]-y[i]+z[i];
		xyz7[i]=-x[i]-y[i]-z[i];
	}
	sort(xyz0, xyz0+n, greater<ll>());
	sort(xyz1, xyz1+n, greater<ll>());
	sort(xyz2, xyz2+n, greater<ll>());
	sort(xyz3, xyz3+n, greater<ll>());
	sort(xyz4, xyz4+n, greater<ll>());
	sort(xyz5, xyz5+n, greater<ll>());
	sort(xyz6, xyz6+n, greater<ll>());
	sort(xyz7, xyz7+n, greater<ll>());
	ll ans=0;
	ll tmp=0;
	REP(i, m){
		tmp+=xyz0[i];
	}
	ans=max(ans, tmp);
	// DEBUG(ans);
	tmp=0;
	REP(i, m){
		tmp+=xyz1[i];
	}
	ans=max(ans, tmp);
	// DEBUG(ans);
	tmp=0;
	REP(i, m){
		tmp+=xyz2[i];
	}
	ans=max(ans, tmp);
	// DEBUG(ans);
	tmp=0;
	REP(i, m){
		tmp+=xyz3[i];
	}
	ans=max(ans, tmp);
	// DEBUG(ans);
	tmp=0;
	REP(i, m){
		tmp+=xyz4[i];
	}
	ans=max(ans, tmp);
	// DEBUG(ans);
	tmp=0;
	REP(i, m){
		tmp+=xyz5[i];
	}
	ans=max(ans, tmp);
	// DEBUG(ans);
	tmp=0;
	REP(i, m){
		tmp+=xyz6[i];
	}
	ans=max(ans, tmp);
	// DEBUG(ans);
	tmp=0;
	REP(i, m){
		tmp+=xyz7[i];
	}
	ans=max(ans, tmp);
	// DEBUG(ans);
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 384
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
//#define         ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         mp(a,b)                     make_pair(a,b)
#define         UNIQUE(v)                   v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define         mod                         1000000007
#define         INF                         2e18
#define         EPS                         1e-15
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;
//int dx[]={0,0,1,-1,1,1,-1,-1};
//int dy[]={1,-1,0,0,1,-1,1,-1};

ll MAP[100005];
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll n,x,sum=0;
    sfl(n);
    FOR(i,n){
        sfl(x);
        sum += x;
        MAP[x]++;
    }
    ll q,u,v;
    sfl(q);
    //cout << sum << endl;
    while(q--){
        sfl(u),sfl(v);
        sum -= MAP[u]*u;
        sum -= MAP[v]*v;
        MAP[v] += MAP[u];
        sum += MAP[v]*v;
        //cout << sum << endl;
        MAP[u]=0;
        pfl(sum);
    }
    return 0;
}


Measured memory_bytes: 4608
A, B, C, X, Y = map(int, input().split())
min_num = min(X, Y)
max_num = min(X, Y)
min_price = min(A + B, C * 2)
max_price = min(A + B, C * 2)
answer = min_num * min_price
# print(answer)

if X >= Y:
    answer += (X - min_num) * min(A, C * 2)
else:
    answer += (Y - min_num) * min(B, C * 2)

print(answer)

Measured memory_bytes: 3064
/*

*/
#include<bits/stdc++.h>

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

int main(){
	short n,k;
	vector<short>d;
	
	cin>>n>>k;
	d=vector<short>(k);
	rep(i,k)cin>>d[i];
	
  //$B5v2D(B
	vector<bool>allow(10,true);
	rep(i,k)allow[d[i]]=false;
	
	int ans,hoge;
	for(ans=n;;ans++){
	  for(hoge=ans;hoge>0&&allow[hoge%10];hoge/=10);
    //cout<<hoge<<" "<<ans<<endl;
	  if(hoge==0)break;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    h,w=MI()
    n=int(input())
    aa=LI()
    i=j=0
    ans=[[0]*w for _ in range(h)]
    for c,a in enumerate(aa,1):
        for _ in range(a):
            ans[i][j]=c
            if i%2:j-=1
            else:j+=1
            if j==-1:
                i+=1
                j=0
            if j==w:
                i+=1
                j=w-1
    for ar in ans:
        print(*ar)
main()

Measured memory_bytes: 3916
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 2000000
#define NIL (-1)

int parent(int );
int left(int );
int right(int );
void buildMaxHeap(int []);
void maxHeapify(int [], int);
void maxHeapInsert(int [], int );
void heapIncreaseKey(int [], int, int);
int heapExtractMax(int []);

int n;

int main(void){
  
  int key;
  int Tree[MAX];
  char com[10];
  
  while(1){ 
    scanf("%s",com);
    if(com[0] == 'i'){
      scanf("%d",&key);
      maxHeapInsert(Tree, key);
    }
    
    else if(com[0] == 'e'){
      if(strlen(com) == 7)
	printf("%d\n",heapExtractMax(Tree));
      else 
	break;
    }
  }
  
  return 0;
}

int parent(int i){
  return i / 2;
}

int left(int i){
  return 2 * i;
}

int right(int i){
  return 2 * i + 1;
} 

void buildMaxHeap(int Tree[]){
  int i;

  for(i = n/2;i >= 1;i--)
    maxHeapify(Tree, i);
}

void maxHeapify(int Tree[], int i){
  int l = left(i);
  int r = right(i);
  int largest;
  int tmp;

  if(l <= n && Tree[l] > Tree[i])
    largest = l;

  else
    largest = i;

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

  if(largest != i){
    tmp = Tree[largest];
    Tree[largest] = Tree[i];
    Tree[i] = tmp;
    maxHeapify(Tree, largest);
  }
}

void maxHeapInsert(int Tree[], int key){
  n = n + 1;
  Tree[n] = NIL;
  heapIncreaseKey(Tree, n, key);
}

void heapIncreaseKey(int Tree[], int i, int key){

  int tmp;

  if(key < Tree[i])
    exit(1);

  Tree[i] = key;

  while(i > 1 && Tree[parent(i)] < Tree[i]){
    tmp = Tree[parent(i)];
    Tree[parent(i)] = Tree[i];
    Tree[i] = tmp;
    i = parent(i);
  }
}


int heapExtractMax(int Tree[]){
  int max;
  
  if(n < 1)
    exit(2);
  
  max = Tree[1];
  Tree[1] = Tree[n];
  n = n - 1;
  maxHeapify(Tree, 1);
  return max;
}

Measured memory_bytes: 5372
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

int main(){
    uint64 a , b;
    cin >> a >> b;
    vector<int> a2(32,0);
    vector<int> b2(32,0);
    int i = 0;
    while( a > 0 ){
        a2[i] = a % 2;
        a /= 2;
        ++i;
    }
    i = 0;
    while( b > 0 ){
        b2[i] = b % 2;
        b /= 2;
        ++i;
    }
    reverse(a2.begin(),a2.end());
    reverse(b2.begin(),b2.end());
    rep(i ,32){
        if(a2[i] == b2[i]) cout << a2[i];
        else cout << 0;
    } 
    cout << endl;
    rep(i ,32){
        if(a2[i] == 1 || b2[i] == 1) cout << 1;
        else cout << 0;
    }
    cout << endl;
    rep(i ,32){
        if((a2[i] == 1 && b2[i] == 0 )||(a2[i] == 0 && b2[i]== 1)) cout << 1;
        else cout << 0;
    }
    cout << endl;
}


Measured memory_bytes: 3092
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

double ans;
ll N;

int main() {
	scanf("%lld", &N);
	ll X = N / 2;
	ll Y = N % 2;
	ll temp = X + Y;
	// cout << temp << " " << X << " " << Y << "\n";
	ans = (temp) / (N * 1.0);
	printf("%0.12lf\n", ans);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;

int main(){
  int x,y,z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << endl;
  
  return 0;
}


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

int N;
int memo[50];

int fibo(int n) {
    if (n <= 1) return 1;
    if (memo[n] == -1) memo[n] = fibo(n - 1) + fibo(n - 2);
    return memo[n];
}

int main(void) {

    cin >> N;

    for (int i = 0; i < 50; ++i) memo[i] = -1;

    cout << fibo(N) << endl;

    return 0;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

const ll N = 3010;
ll a[N], dp[N][N];

ll rec(ll i, ll j) {
	if (i == j) return a[i];
	if (dp[i][j] != oo) return dp[i][j];
	return dp[i][j] = max(a[i] - rec(i+1,j), a[j] - rec(i,j-1));
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	memset(dp,0x3f,sizeof dp);

	ll n; cin >> n;
	FOR(i,0,n) cin >> a[i];
	cout << rec(0,n-1) << endl;
}



Measured memory_bytes: 71168
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m,i,j;
    cin >> n >> m;
    int A[100][100]={{}};
    int B[100]={};
    int C[100]={};
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            cin >> A[i][j];
        }
    }
    for(i=0;i<m;i++)cin >> B[i];
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            C[i] += A[i][j]*B[j];
        }
    }
    for(i=0;i<n;i++)cout << C[i] << endl;
    return 0;
}


Measured memory_bytes: 3152
import sys,heapq
input = sys.stdin.readline
def main():
    n,u,v = map(int,input().split())
    u,v = u-1,v-1

    edge = [[] for _ in range(n)]

    for _ in [0]*(n-1):
        a,b = map(int,input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)

    #cost:vからの距離
    cost = [0]*n
    new = [v]
    c = 1
    while len(new):
        tank = []
        for e in new:
            for go in edge[e]:
                if go != v and cost[go] == 0:
                    cost[go] = c
                    tank.append(go)
        c += 1
        new = tank

    if cost[u]%2 == 1:
        res = cost[u]//2
        now = u
        for _ in [0]*res:
            for e in edge[now]:
                if cost[now] > cost[e]:
                    now = e
        
        new = [now]
        while len(new):
            tank = []
            for e in new:
                for go in edge[e]:
                    if cost[go] > cost[e]:
                        tank.append(go)
            res += 1
            new = tank
        
        print(res-1)

    else:
        res = cost[u]//2-1
        now = u
        for _ in [0]*res:
            for e in edge[now]:
                if cost[now] > cost[e]:
                    now = e
        
        new = [now]
        while len(new):
            tank = []
            for e in new:
                for go in edge[e]:
                    if cost[go] > cost[e]:
                        tank.append(go)
            res += 1
            new = tank
        
        print(res)



if __name__ == '__main__':
    main()

Measured memory_bytes: 58672
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a;
    std::deque<int> deq;
    cin >> n;
    for (int x=0;x<n;x++) {
        cin >> a;
        deq.emplace_back(a);
    }
    for (int k=0;k<deq.size();k++) {
        if (k==deq.size()-1) {
            cout << deq[k] << endl;
        } else {
            cout << deq[k] << " ";
        }
    }
    for (int i=1;i<n;i++) {
        int v = deq[i];
        int j = i - 1;
        while (j>=0 && deq[j] > v) {
            deq[j+1] = deq[j];
            j--;
        }
        deq[j+1] = v;
        for (int l=0;l<deq.size();l++) {
        if (l==deq.size()-1) {
            cout << deq[l] << endl;
        } else {
            cout << deq[l] << " ";
        }
    }
    }
}



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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    int N;
    std::cin >> N;

    double ans = 0;
    REP(i, N) {
        double a;
        std::cin >> a;
        ans += 1 / a;
    }

    std::cout << setprecision(20) << 1 / ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;

public class Main {

  private static void solve() {
    int A = ni();
    int B = ni();
    int m = ni();
    int[] a = na(A);
    int[] b = na(B);
    int[][] p = ntable(m, 3);

    int amin = Arrays.stream(a).min().getAsInt();
    int bmin = Arrays.stream(b).min().getAsInt();

    int ret = amin + bmin;
    for (int i = 0; i < m; i++) {
      int s = p[i][0] - 1;
      int t = p[i][1] - 1;
      int now = a[s] + b[t] - p[i][2];

      ret = Math.min(ret, now);
    }
    System.out.println(ret);

  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string x;
  cin >> x;
  int n = x.size();
  int s = 0, res = 0;
  for (int i = 0; i < n; i++) {
    if (x[i] == 'S') s++;
    else {
      if (s == 0) res += 2;
      else s--;
    }
  }
  cout << res << "\n"; 
  return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for (int i=a; i<b; ++i)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,last="";
    cin >> s;
    int n=s.length();
    last+=s[0];
    int ans=1;
    for (int i=1; i<n; i++)
    {
        if (last.length()>1)
        {
            last=s[i];
            ans++;
            // cout << last << "    " <<  ans << endl;
        }
        else
        {
            if (last[0]==s[i])
            {
                if (i==n-1) break;
                else
                {
                    last=s[i];
                    last+=s[i+1];
                    // cout << last << endl;
                    i++;
                    ans++;
                    // cout << last << "  " <<  ans << endl;
                }
            }  
            else {last=s[i]; ans++;}  
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    int h,w;
    cin >> h >> w;
    vector<vi> c(10,vi(10));
    rep(i,10) rep(j,10) cin >> c[i][j];
    vi a(10);
    /*rep(i,h) rep(j,w){
        int b;
        cin >> b;
        if(b==-1) continue;
        a[b]++;
    }*/
    rep(k,10) rep(i,10) rep(j,10){
        if(c[i][j] > c[i][k] + c[k][j]) c[i][j] = c[i][k] + c[k][j];
    }
    ll ans = 0;
    rep(i,h) rep(j,w){
        int b;
        cin >> b;
        if(b>=0) ans += c[b][1];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main()

{
    int d,t,s;
    scanf("%d%d%d",&d,&t,&s);
    double a = (double)d/(double)s;
    if(a<=t){
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    
    return 0;
}

Measured memory_bytes: 1624
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> m(n);
  int sum = 0;
  rep(i, n) {
    int num;
    cin >> num;
    sum += num;
    m.at(i) = num;
  }
  x -= sum;
  sort(m.begin(), m.end());
  cout << n + x/m.at(0) << endl;
}

      


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<string, ll> mstrll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << x
#define print(x) cout << x << '\n'
#define debug(x) cerr << #x << ": " << x << '\n'
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
ll a, b, c, n, m, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF;
string s, t;
vll dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
//vll dx = {-1, 0, 1, -1, 1, -1, 0, 1}, dy = {-1, -1, -1, 0, 0, 1, 1, 1};

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> n >> m){
        ll pre[m], time[m];
        vll list[n + 1];
        rep(i, m){
            cin >> pre[i] >> time[i];
            list[pre[i]].pb(time[i]);
        }
        rep(i, 1, n + 1){
            sort(all(list[i]));
        }
        rep(i, m){
            printf("%012lld\n", pre[i] * 1000000 + lower_bound(all(list[pre[i]]), time[i]) - list[pre[i]].begin() + 1);
        }
    }
}



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

using namespace std;
int main()
{  
    string s;
    cin >> s;
    for(int i=0; i<s.length(); i++) {
        if(s[i]=='7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

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

    vector<int> m(n);
    int sum = 0;
    int mini = 1002003004;

    rep(i,n){
        cin >> m[i];
        sum += m[i];
        mini = min(mini,m[i]);
    }

    int ans = n;
    x -= sum;
    ans += x/mini;

    dunk(ans);
}

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

int main() {
  long n,m; cin >>n >>m;
  long ans = 0;
  
  if (n*2>m) ans = m/2;
  else ans = n + (m-2*n)/4;
  
  cout <<ans <<endl;
  
  //if (ans) cout <<"YES" <<endl;
  //else cout <<"NO" <<endl;
  
}


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

int main()
{
    string s; cin>>s;
    int n=s.size();
    string t(n+1, '0');
    for(int i=1; i<=n; i+=2) t[i]++;

    int res=n;
    for(int x=0; x<2; ++x) {
        int cnt=0;
        for(int i=0; i<n; ++i) cnt+=s[i]!=t[i+x];
        res=min(res, cnt);
    }
    cout<<res<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m,x,y;
    int hantei = 0;
    cin >> n >> m >> x >> y;
    int X[n],Y[m];
    for(int i=0;i<n;i++){
        cin >> X[i];
        if(X[i] == y || X[i]>y){
            hantei = 1;
            break;
        }
    }
    for(int i=0;i<m;i++){
        cin >> Y[i];
        if(Y[i] == x || Y[i]<x){
            hantei = 1;
            break;
        }
    }
    if(hantei == 1) cout << "War" << endl;
    else{
        sort(X,X+n);
        sort(Y,Y+m);
        if(Y[0]-X[n-1] > 0) cout << "No War" << endl;
        else cout << "War" << endl;
    }
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf 1000000005
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define mod 1000000007
#define sz(a) ((ll)(a).size())

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcnt(s);}
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define eps 1e-12
typedef pair<int, int> II;
typedef pair<ll, ll> LL;
template<class T> T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;}
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define PI (2 * acos((ld)0))
#define linf (1ll << 60)
#define y1 y32432
#define y0 y435346

#define maxn 1005

int n, m, N, M;
int a[maxn][maxn];

int main()
{
//	freopen("in.txt", "r", stdin);

	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> m >> N >> M;
	if(n % N == 0 && m % M == 0){
		cout << "No" << endl;
		return 0;
	} else if(n % N){
		For(j, 1, m){
			For(i, 1, n){
				if(i % N) a[i][j] = 1000;
				else a[i][j] = -(1000 * (N - 1) + 1);
			}
		}
	} else{
		For(i, 1, n){
			For(j, 1, m){
				if(j % M) a[i][j] = 1000;
				else a[i][j] = -(1000 * (M - 1) + 1);
			}
		}
	}
	cout << "Yes" << endl;
	For(i, 1, n){
		For(j, 1, m){
			cout << a[i][j];
			if(j == m) cout << "\n";
			else cout << " ";
		}
	}

	return 0;
}


Measured memory_bytes: 3584
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if (a < c) {
    cout << max(0, (min(b, d) - c)) << endl;
  } else {
    cout << max(0, (min(b, d) - a)) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

S = sys.stdin.buffer.readline().decode().rstrip()
i = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'].index(S)
print(7 - i)




Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  int cnt = 0;
  if (h > w) swap(h, w); // h <= w
  for (int i = 0; i < h; i++) {
    cnt += w;
    if (cnt >= n) {
      cout << i + 1 << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<list>
using namespace std;
vector<int> v[10000];
int dep[10000];
int n,m;
void solve() {
	queue<int>q;
	for (int i = 0; i < n; i++) {
		if (v[i].empty()) {
			q.push(i);
			dep[i] = 1;
		}
	}
	while (!q.empty()) {
		int k = q.front();
		q.pop();
		cout << k << endl;
		for (int i = 0; i < n; i++) {
			if (dep[i]) continue;
			for (vector<int>::iterator it = v[i].begin(); it != v[i].end(); it++) {
				if (*it == k) {
					v[i].erase(it);
					if (v[i].empty()) {
						q.push(i);
						dep[i] = 1;
					}
					break;
				}
			}
		}
	}
}
int main(void) {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		v[b].push_back(a);
	}
	solve();
}


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

using namespace std;
#define rep(i, n) for(int i = 0 ; i < (int)(n) ; i++)
typedef long long ll;
typedef long double Double;

#ifndef INPUTS_DIR
#define INPUTS_DIR "./"
#endif

using namespace std;
map<ll, ll> h;
map<ll, bool> done;

int isBin(ll x) {
    return (x & (x - 1)) == 0;
}


int dfs(ll p, ll prev) {
    if (!h.count(p)) return 0;
    if (done[p]) return 0;
    done[p] = true;

    int ans = 0;
    for (int i = 0; i <= 30; i++) {
        ll nxt = (1ll << i) - p;
        if (nxt != p) ans += dfs(nxt, p);
    }
    while (prev != -1 && h[p] > 0 && h[prev] > 0) {
        h[p]--;
        h[prev]--;
        ans++;
    }

    while (h[p] >= 2 && isBin(p)) {
        h[p] -= 2;
        ans++;
    }

    return ans;
}


int func(vector<ll> A) {
    vector<int> dp((1 << A.size()), 0);

    int ans = 0;
    for (int i = 0; i < (1 << A.size()); i++) {
        for (int j = 0; j < A.size(); j++) {
            for (int k = 0; k < A.size(); k++) {
                if (j != k && !(i >> j & 1) && !(i >> k & 1) && isBin(A[j] + A[k])) {
                    ans = max(ans, dp[i | (1 << j) | (1 << k)] = max(dp[i] + 1, dp[(1 << j) | (1 << k)]));
                }
            }
        }
    }
    return ans;
}

int solve2(ll N, vector<ll> A) {
    h.clear();
    done.clear();
    for (int i = 0; i < N; i++) h[A[i]]++;

    int ans = 0;


    for (int i = 0; i <= 30; i++)
        ans += dfs(1ll << i, -1);

    for (int i = 0; i < N; i++) {
        ans += dfs(A[i], -1);
    }

    return ans;
}

int solve(ll N, vector<ll> A) {
//    while (true) {
//        vector<ll> a;
//        for (int i = 0; i < 10; i++) a.push_back(rand() % 10 + 1);
//        if (func(a) != solve2(10, a)) {
//            for (auto i : a) cout << i << " ";
//            cout << endl;
//            cout << "[" << func(a) << " " << solve2(10, a) << endl;
//        }
//    }
    cout << solve2(N, A) << endl;

}


void main_(istream &cin) {

    ll N;
    cin >> N;
    vector<ll> A(N - 1 + 1);
    for (int i = 0; i <= N - 1; i++) {
        cin >> A[i];
    }
    solve(N, A);
}

int main() {
#ifdef INTELLIJ
    ifstream ifs(string(INPUTS_DIR) + "in_1.txt");
    if (ifs.is_open()) {
        main_(ifs);
        ifs.close();
    } else {
        cerr << "Error: no input." << endl;
    }
#else
    ios::sync_with_stdio(false);
    cin.tie(0);
    main_(cin);
#endif
}





Measured memory_bytes: 29952
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 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...));
}

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

    vector<int> x(4), y(4);
    cin >> x.at(0) >> y.at(0) >> x.at(1) >> y.at(1);

    int xd = x[1] - x[0];
    int yd = y[1] - y[0];
    x[2] = x[1] - yd;
    y[2] = y[1] + xd;
    x[3] = x[0] - yd;
    y[3] = y[0] + xd;

    cout << x[2] << " ";
    cout << y[2] << " ";
    cout << x[3] << " ";
    cout << y[3];

    return 0;
}


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

int main() {
  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; ++i) cin >> a[i];
  bool odd = false;
  int ans = 0;
  while(true){
    for(int i = 0; i <n; ++i){
    if(a[i] % 2 != 0){
      odd = true;
    }
    }
    if(odd) break;
    for(int i = 0;i < n; ++i){
      a[i] /= 2;
    }
    ans++;
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
	Scanner in = new Scanner(System.in);
	int a = in.nextInt();
	int sol = 0;
	for (int i = 1; i <= a; i++) {
	    for (int j = 1; j<= a; j++) {
		if (i%2 == 0 && j%2 != 0)
		    sol++;
	    }
	}
	System.out.println(sol);
    }
}


Measured memory_bytes: 21972
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	int n;
	cin>>n;
	int a[n];
	rep(i,n)cin>>a[i];
	map<int,int> mp;
	int pre[n];
	rep(i,n){
		if(!mp.count(a[i]))pre[i]=-1;
		else pre[i]=mp[a[i]];
		mp[a[i]]=i;
	}
	vector<ll> dp(n+1);
	dp[0]=1;
	rep(i,n){
		dp[i+1]=dp[i];
		if(pre[i]!=-1&&pre[i]!=i-1)dp[i+1]+=dp[pre[i]+1];
		dp[i+1]%=mod;
	}
	cout<<dp[n]<<endl;
	return 0;
}

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

int main(){
  int n,m; cin >> n >> m;
  pair<int,int> AB[n];
  for(int i = 0; i < n; i++){
    cin >> AB[i].first >> AB[i].second;
  }
  sort(AB,AB+n);
  int k = 0;
  long long int ans = 0;
  for(int i = 0; i < m; i++){
    if(AB[k].second == 0) k++;
    AB[k].second--;
    ans +=AB[k].first;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int a,b,c;
	cin >> a >> b >> c;
	int d=c/2;
	cout << (a+b)*d;
	return 0;
}

Measured memory_bytes: 256
import collections

N=int(input())  
a=list(map(int,input().split()))
b= collections.Counter(a)
c= b.most_common()

L=len(b)

total=0
for i in range(L):
    total += c[i][1]*(c[i][1]-1)//2

for i in a:
    ans = total - (b[i]-1)
    print(ans)
    

Measured memory_bytes: 30140
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) begin(V), end(V)
#define ALLR(V) rbegin(V), rend(V)
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;

#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

const size_t MAX_N = 201;
const size_t MAX_W = 1e4 + 10;
ll dp[MAX_W];
const ll mod = 1e9 + 7;

ll solve() {

    ll N, W;
    cin >> N >> W;
    V<ll> wv(N);
    for (ll &e : wv) cin >> e;

    sort(ALLR(wv));
    dp[0] = 1;
    ll sum = accumulate(ALL(wv), 0ll);
    if (sum <= W) return 1;

    auto update_dp = [&](ll pw) {
        if (W < pw) return;
        for (ll i = W - pw; 0 <= i; i--) (dp[i + pw] += dp[i]) %= mod;
    };

    ll ans = 0;
    for (ll i = 0; i < N; i++) {
        ll w = wv[i];
        sum -= w;
        if (i) update_dp(wv[i - 1]);
        ll bound = W - w + 1;
        ll must = N - (i + 1);
        for (ll j = bound; j <= W; j++) {
            if (j < sum) continue;
            ll p = dp[j - sum];
            ans += p;
        }
        DEBUG(ans);
        for (ll i = 0; i <= W; i++) DEBUG(make_tuple(i, dp[i]));
    }

    return ans % mod;
}

int main() {
    cout << solve() << endl;
    return 0;
}



Measured memory_bytes: 3276
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
 
public class Main {
    private static  BufferedReader  br = null;
 
    static {
        br   = new BufferedReader(new InputStreamReader(System.in));
    }
 
    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        String  strin = null;
        int     lines = 0;
 
        while ((strin = parseNum()) != null) {
            lines = Integer.parseInt(strin);
            System.out.println(lines * (lines + 1) / 2 + 1);
        }
    }
 
    private static String parseNum() {
        String  strNum = null;
 
        try {
            String line = br.readLine();
            if (line != null) {
                if (!line.isEmpty()) {
                    strNum = line;
                }
            }
        }
        catch (IOException e) {}
 
        return strNum;
    }
}

Measured memory_bytes: 16936
def resolve():
	from statistics import median
	import sys
	input = sys.stdin.readline
	n = int(input())
	ab = [list(map(int, input().split())) for i in range(n)]
	mina = median(i[0] for i in ab)
	maxb = median(i[1] for i in ab)
	abrange = maxb - mina
	if n%2 == 0:
		print(int(abrange*2 + 1))
	else:
		print(int(abrange + 1))
resolve()

Measured memory_bytes: 49412
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; //10^9
using ll = long long;
using P = pair<int, int>;
//加算代入演算子は+=！！！！！
//int 2^31 10^9まで
int main()
{
    int n;
    cin >> n;
    vector<int> t(n);
    rep(i, n) cin >> t.at(i);
    int m;
    cin >> m;
    vector<int> sum(m);
    rep(i, m)
    {
        int a, b, temp = 0;
        cin >> a >> b;
        vector<int> temp_t(n);
        temp_t = t;
        temp_t.at(a - 1) = b;
        rep(i, n) temp += temp_t.at(i);
        sum.at(i) = temp;
    }
    rep (i, m) cout << sum.at(i) << endl;
    return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
a = [list(input()) + ["."] for _ in range(h)]
a.append(["."] * (w + 1))


i = 0
j = 0

while True:
    if a[i+1][j] == "#":
        a[i][j] = "."
        i += 1
    elif a[i][j+1] == "#":
        a[i][j] = "."
        j += 1
    else:
        break
a[i][j] = "."
bl = True
for row in a:
    if "#" in row:
        bl = False

ans = "Possible" if bl else "Impossible"
print(ans)


Measured memory_bytes: 3064
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n);
    for(auto &i:a){cin>>i;}
    vector<ll> dp(k+1,0);
    for(ll i=k-1;i>=0;i--){
        for(auto &t:a){
            if(i+t>k){continue;}
            if(dp[i+t]==0){dp[i]=1;}
        }
    }
    cout<<(dp[0]==0?"Second":"First")<<endl;
    
    
    return 0;
}


Measured memory_bytes: 1024
# 整数の入力
A, B, C, K = list(map(int, input().split(" ")))

if abs(A-B) > 10 ** 18:
    print("Unfair")

else:
    if K % 2 == 0:  # Kが偶数
        print(A-B)
    else:
        print(B-A)


Measured memory_bytes: 2940
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    h, n = list(map(int, readline().split()))
    a = sum(list(map(int, readline().split())))
    print("Yes" if a >= h else "No")


if __name__ == '__main__':
    solve()


Measured memory_bytes: 52464
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {

    int  N,i,score;
    string A,B,C;
    std::cin >> N;
    std::cin >> A;
    std::cin >> B;
    cin >> C;
    
    score=0;
    for(i=0;i<N;i++){
        if(A[i]==B[i]){
            if(A[i]!=C[i]){
                score++;
            }
        }else{
            if(C[i]==A[i]){
                score++;
            }else if(C[i]==B[i]){
                score++;
            }else{
                score +=2;
            }
        }
    }
    cout << score << endl;
    return 0;
}


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

// requiredstring contains stringlist ?(yes:1,no:0)
template <class T>
bool strcontain(const string stringlist,
                const T& requiredstring) {
  return stringlist.find(requiredstring) != string::npos;
}

string s;
bool x = 0, y = 0;

int main() {
  cin >> s;
  x = strcontain(s, 'N') ^ strcontain(s, 'S');
  y = strcontain(s, 'E') ^ strcontain(s, 'W');
  if((x | y) == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<assert.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define fd(i,b,a) for(int i=(b);i>=(a);--i)
#define bfo(i,v,u) for(int i=BB[v],u=B[i][1];i;u=B[i=B[i][0]][1])
#define mset(a,x) memset(a,x,sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(b))
template<typename T> bool chkmin(T &a,const T &b) {return b<a?a=b,1:0;}
template<typename T> bool chkmax(T &a,const T &b) {return b>a?a=b,1:0;}
using namespace std;
typedef long long ll;
int read(){int n=0,p=1;char ch;for(ch=getchar();ch<'0' || ch>'9';ch=getchar())if(ch=='-') p=-1;for(;'0'<=ch && ch<='9';ch=getchar()) n=n*10+ch-'0';return n*p;}
const int N=2e5+5;
int n,fa[N],B0,BB[N],B[N<<1][2],ans[N];
void link(int u,int v){B[++B0][1]=v,B[B0][0]=BB[u],BB[u]=B0;}
int c[N],p[N],sp[N],d[N],sd[N];
void dfs1(int v,int fr=0,int y=0,int mx=0)
{
	fa[v]=fr,sp[v]=y;
	int x = v > p[v] ? v : y;
	++c[x];
	if(mx<p[p[v]]) ++d[y];
	bfo(i,v,u) if(u!=fr)
	{
		p[u]=max(p[v],v);
		if(p[u]==v) dfs1(u,v,u,u);
		else dfs1(u,v,y,max(mx,u));
	}
}
void dfs2(int v,int fr=0)
{
	bfo(i,v,u) if(u!=fr) sd[v]+=d[u];
	if(v>p[v]) ans[v]=sd[v]+1+ans[fa[v]];
	else ans[v]=c[sp[v]]+1+sd[p[v]]-d[sp[v]]+ans[fa[p[v]]];
	bfo(i,v,u) if(u!=fr) dfs2(u,v);
}
int main()
{
	int x,y;
	n=read();
	fo(i,1,n-1) x=read(),y=read(),link(x,y),link(y,x);
	dfs1(1);
	dfs2(1);
	fo(i,2,n) printf("%d ",ans[i]-1);
	return 0;
}

Measured memory_bytes: 22656
# https://atcoder.jp/contests/abc155/tasks/abc155_c



N = gets.to_i
Ss = Array.new(N) { gets.chomp }

string_counts = Hash.new(0)

count_strings = Hash.new {|hash, key| hash[key] = []}
Ss.each do |s|
  string_counts[s] += 1
  count_strings[string_counts[s]] << s
end

max_appear = string_counts.values.max
puts count_strings[max_appear].sort


Measured memory_bytes: 45928
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int H,W;
  cin >> H >> W;
  v(string) G(H);
  vvi yokoN(H,vi(W,0));
  vvi tateN(H,vi(W,0));
  rep(i,H) {
    cin >> G[i];
  }
  rep(i,H) {
    int x = -1;
    rep(j,W) {
      if(G[i][j] == '#') {
        yokoN[i][j] = -1 * W;
        srep(k,x+1,j) {
          yokoN[i][k] = j-x-1;
        }
        x = j;
      }
    }
    if(x != W-1) {
      srep(k,x+1,W) {
        yokoN[i][k] = W-x-1;
      }
    }
  }
  
  rep(j,W) {
    int x = -1;
    rep(i,H) {
      if(G[i][j] == '#') {
        tateN[i][j] = -1 * H;
        srep(k,x+1,i) {
          tateN[k][j] = i-x-1;
        }
        x = i;
      }
    }
    if(x != H-1) {
      srep(k,x+1,H) {
        tateN[k][j] = H-x-1;
      }
    }
  }
  int ans = 0;
  rep(i,H) {
    rep(j,W) {
      ans = max(ans, yokoN[i][j] + tateN[i][j]-1);
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 35712
N = int(input())
S = input()

l1 = l2 = length = 0

while l2 + length < N:
    if S[l1:l2] in S[l2:]:
        length = l2 - l1
        l2 += 1
    else:
        l1 += 1
        l2 = l1 + length + 1
        
print(length)

Measured memory_bytes: 3064
k = int(input())

def gcd(x, y): 
    while(y): 
        x, y = y, x % y 
  
    return x

mat = [[0 for i in range(201)] for j in range(201)]

for i in range(201):
    for j in range(201):
        mat[i][j] = gcd(i, j)

sm = 0
for a in range(1, k + 1):
    for b in range(1, k + 1):
        for c in range(1, k + 1):
            sm += mat[mat[a][b]][c]

print(sm)

Measured memory_bytes: 74136
n = int(input())
s1 = input()
s2 = input()
mod = 10**9+7
b = 0
did = 0
ans = 0
if s1[0] == s2[0]:
  b = 1
  ans += 3
else:
  did = 1
  ans = 6
for i in range(1,n):
  if s1[i] == s2[i]:
    if b:
      ans = ans*2%mod
    b = 1
  elif not did:
    if b:
      ans = ans*2%mod
    else:
      ans = ans*3%mod
    did = 1
    b = 0
  else:
    did = 0
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{

	int ei, tr;
	scanf("%d" ,&ei);
	scanf("%d", &tr);
	if (ei == tr)
	{
		printf("a == b");




printf("\n");

	}


	if (ei > tr)
	{
		printf("a > b");




printf("\n");
	}

	if (ei < tr)
	{
		printf("a < b");




printf("\n");

	}


	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;


int main() {
    int n; cin>>n;
    int mi = iinf;
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        int a; cin>>a;
        if (a < mi) ++ans;
        mi = min(mi, a);
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256