akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

string N;
lint dp[128][4][2];

lint F(int i, int k, int l)
{
    if (i == N.size())
        return k == 0;

    lint& ans = dp[i][k][l];
    if (ans >= 0)
        return ans;

    ans = 0;
    FOR(d, 0, 10) {
        if (l == 0 && d > N[i] - '0')
            continue;
        if (d > 0 && k == 0)
            continue;
        ans += F(i + 1, k - (d != 0), l | (d < N[i] - '0'));
    }

    return ans;
};

int main(int argc, char **argv)
{
    io_init();

    int K;
    cin >> N >> K;
    memset(dp, -1, sizeof dp);
    cout << F(0, K, 0) << endl;
    return 0;
};

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

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

    if(n % 4 == 0 || n % 7 == 0 || n % 11 == 0){
        cout << "Yes" << endl;
        return 0;
    }

    for(int i = 0; i < n/4; i++){
        for(int j = 0; j < n/7; j++){
            if(4*i + 7*j ==n){
                cout << "Yes" << endl;
                return 0;
            } else if(4*i + 7*j > n){
                break;
            }
        }
    }

    cout << "No" << endl;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $cityCount, $roadCount);
while($input = fgets(STDIN)) {
    list($num1, $num2) = explode(" ", $input);
    $nums[] = $num1;
    $nums[] = $num2;
}

for($i = 1; $i <= $cityCount; $i++) {
    $cityRoads[$i] = 0;
}

foreach($nums as $num) {
        for($i = 1; $i <= $cityCount; $i++) {
            if($num == $i) {
                $cityRoads[$i]++;   
            }
    }
}

for($i = 1; $i <= $cityCount; $i++) {
    echo $cityRoads[$i] . "\n";
}

Measured memory_bytes: 5240
function Main(input) {
  var len = parseInt(input.split("\n")[0]);
  var list = input.split("\n")[1].split(" ");
  if(len == 1){
     console.log("Yes");
    return;
  }else{
      for(var i = 0; i < list.length - 1; i++){
        var tmp1 = parseInt(list[i]);
        var tmp2 = parseInt(list[i + 1]);
        var tmp3 = tmp2 - 1;
        //console.log(tmp1 + "," + tmp2 + "," + tmp3);
        if(tmp1 <= tmp2 || tmp1 <= tmp3){
           if(tmp1 <= tmp3){
              list[i + 1] = tmp3;
           }
        }else{
           console.log("No");
        return;
        }
      }
    console.log("Yes");
  }
}

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


Measured memory_bytes: 17804
#include <stdio.h>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  for ( ; ; )
  {
    int h, m, s;
    int t;

    scanf ( "%d%d%d", &h, &m, &s );
    if ( h < 0 && m < 0 && s < 0 )  break ;

    t = 3600 * h + 60 * m + s;
    printf ( "%02d:%02d:%02d\n", ( 7200 - t ) / 3600,
             ( ( 7200 - t ) / 60 ) % 60, ( 7200 - t ) % 60 );
    printf ( "%02d:%02d:%02d\n", 3 * ( 7200 - t ) / 3600,
             ( 3 * ( 7200 - t ) / 60 ) % 60, 3 * ( 7200 - t ) % 60 );
  }

  return ( 0 );
}

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

signed main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  for( int i = 1; i <= B; i++ ){
    if( i*A % B == C ){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <bitset>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <sstream>
using namespace std;
#define MOD 1000000007
#define MAX 510000
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    ll n,m; cin >> n >> m;
    vl v(n);
    rep(i,m){
        ll a,b; cin >> a >> b;
        a--; b--;
        v[a]++;
        v[b]++;
    }
    rep(i,n) cout << v[i] << endl;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())[:-1]
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [list(input())[:-1] for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
n = int(input())
a = n % 10
n //= 10
b = n % 10
n //= 10
c = n % 10
n //= 10
d = n % 10
if a == b or b == c or c == d:
    print("Bad")
else:
    print("Good")

Measured memory_bytes: 5060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
    int A1,A2,A3 = 0;
    cin >> A1 >> A2 >> A3;

    if ((A1 + A2 + A3) >= 22 ){
        cout << "bust" << endl;
    }else{
        cout << "win" << endl;
    }
}

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

int main()
{
	int N;
	std::cin >> N;
	int p[N];
	int maxp = 0;
	int sump = 0;
	int maxnum = 0;

	for(int i=0;i<N;i++){
		std::cin >> p[i];
		if(p[i]>maxp){
			maxp = p[i];
			maxnum = i;
		}
	}

	for(int i=0;i<N;i++){
		if(i!=maxnum) sump += p[i];
		else sump += p[i]/2;
	}

	std::cout << sump << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

string s[101];
int ans[101][101];
int main(){
    int h,w;
    cin>>h>>w;
    rep(i,h) cin>>s[i];
    rep(i,h){
        int cur=1000;
        rep(j,w){
            if(s[i][j]=='c') cur=j;
            ans[i][j]=j-cur>=0?j-cur:-1;
        }
    }
    rep(i,h){
        rep(j,w){
            if(j<w-1)cout<<ans[i][j]<<" ";
            else cout<<ans[i][j];
        }
        cout<<endl;
    }
    return 0;
}


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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] L = new int[N];
		for(int i = 0; i < N; i++)
			L[i] = sc.nextInt();
		Arrays.sort(L);
		long ans = 0;
		for(int i = N-1; i >= 0; i--) {
			for(int j = i-1; j >= 0; j--) {
				for(int k = j-1; k >= 0; k--) {
					if(L[j]+L[k]>L[i])
						ans++;
					else
						break;
				}
			}
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 26704
import static java.lang.Math.atan2;
import static java.lang.Math.sqrt;
import static java.util.Arrays.deepToString;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	Scanner sc = new Scanner(System.in);
	public void run() {
		while (sc.hasNext()) {
			String[] ss = sc.nextLine().split(",");
			P a = new P(Double.parseDouble(ss[0]), Double.parseDouble(ss[1]));
			P b = new P(Double.parseDouble(ss[2]), Double.parseDouble(ss[3]));
			P p = new P(Double.parseDouble(ss[4]), Double.parseDouble(ss[5]));
			P o = footOfLP(a, b, p);
			P p2 = p.add(o.sub(p).mul(2));
			System.out.printf("%.8f %.8f\n", p2.x, p2.y);
		}
		
		
	}
	
	static class P implements Comparable<P> {
		double x, y;
		public P(double x, double y) {
			this.x = x;
			this.y = y;
		}
		public int compareTo(P o) {
			return x != o.x ? Double.compare(x, o.x) : Double.compare(y, o.y);
		}
		public String toString() {
			return "(" + x + "," + y + ")";
		}
		public double abs() {return sqrt(x * x + y * y); }
		public double abs2() {return (x * x + y * y); }
		public double arg() { return atan2(y, x); } // (-pi 〜 pi)
		public double dist(P o) {return this.sub(o).abs(); }
		public P mul(double k) {return new P(x * k, y * k);}
		public P div(double k) {return new P(x / k, y / k);}
		public P add(P o) {return new P(x + o.x, y + o.y);}
		public P sub(P o) {return new P(x - o.x, y - o.y);}
		public P mul(P o) {return new P(x * o.x - y * o.y,  x * o.y + y * o.x); }
		public P div(P o) {return new P(x * o.x + y * o.y, -x * o.y + y * o.x).div(o.abs2()); }
		public double dot(P o) {return x * o.x + y * o.y;} // a b sin(t)
		public double det(P o) {return x * o.y - y * o.x;} // a b cos(t)
		public P normal() { return this.div(this.abs()); }
		public P rot90() { return new P(-y, x); }
		public static P polar(double d, double rad) {return new P(d * Math.cos(rad), d * Math.sin(rad));}
	}
	P proj(P p, P b) {
		P t = b.mul(p.dot(b));
		double q = b.abs2();
		return new P(t.x / q, t.y / q);
	}
	P footOfLP(P a, P b, P p) {
		return a.add(proj(p.sub(a), b.sub(a)));
	}

}

Measured memory_bytes: 17208
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/icl/interval_map.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
namespace icl = boost::icl;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> A, B, C, K;
  
  REP(i, K) {
    if (B  <= A)
       B*= 2;
    else
      C*= 2;
  }


  return (B>A && C>B ? "Yes" : "No");
}

template<typename T> void plot(const T& func) { cout << setprecision(9) << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }

int main() {
  plot(solve);

  return 0;
}



Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    int X = 0;
    int Y = 1e9;
    for(int i = 0; i < N; i++) {
        int A,B;
        cin >> A >> B;
        X = max(X,A);
        Y = min(Y,B);
    }
    cout << X+Y << endl;
}

Measured memory_bytes: 256
/*

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

using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,a,n) for(int i=(a);i<(n);i++)
#define repe(i,a) for(auto &i:a)
#define be begin()
#define en end()
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;}
void flagfunc3(bool flag){cout<<(flag?"YES\n":"NO\n");}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int a,b,t;
  ll v,w;
  cin>>a>>v>>b>>w>>t;
  flagfunc3(abs(a-b)<=(v-w)*t);
}

Measured memory_bytes: 3604
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class ACalc {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            int a = s.nextInt();
            w.println(a + a * a + a * a * a);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 32532
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,m,a[101010]={},b[101010]={};
	cin>>n>>m;
	b[1]=1;
	FOR(i,1,n+1)a[i]=1;
	FOR(i,0,m){
		int x,y;
		cin>>x>>y;
		a[x]--;
		a[y]++;
		if(b[x]){
			b[y]|=b[x];
			if(a[x]==0)b[x]=0;
		}
	}
	int c=0;
	FOR(i,1,n+1)c+=b[i];
	cout<<c;
    return 0;
}


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

int main(){
    string S;  cin >> S;
    int N = S.length();
    reverse(S.begin(), S.end());
    vector<int> mod13(N, 0);
    mod13[0] = 1;
    for(int i=1; i<N; i++){
        mod13[i] = (mod13[i-1]*10)%13;
    }

    ll mod = 1e9 + 7;
    vector<vector<ll>> dp(N, vector<ll>(13, 0));
    if(S[0] == '?'){
        for(int i=0; i<10; i++){
            dp[0][i] = 1;
        }
    }else{
        dp[0][S[0]-'0'] = 1;
    }

    for(int i=1; i<N; i++){
        if(S[i]=='?'){
            for(int q=0; q<10; q++){
                int val = q*mod13[i]%13;
                for(int prev=0; prev<13; prev++){
                    dp[i][(val+prev)%13] = (dp[i][(val+prev)%13] + dp[i-1][prev])%mod;
                }
            }
        }else{
            int val = (S[i] - '0')*mod13[i]%13;
            for(int j=0; j<13; j++){
                dp[i][(j+val)%13] = (dp[i][(j+val)%13] + dp[i-1][j])%mod;
            }
        }

        for(int j=0; j<13; j++){
            dp[i][j]%=mod;
        }
    }

    cout << dp[N-1][5] << endl;
}


Measured memory_bytes: 14080
from collections import defaultdict
import sys

input = sys.stdin.readline

h,w,n = map(int,input().split())
d = defaultdict()
ans = [0]*10

for k in range(n):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    for i in range(-1,2):
        for j in range(-1,2):
            if (a+i,b+j) in d:
                d[(a+i,b+j)] += 1
            else:
                d[(a+i,b+j)] = 1

for k,v in d.items():
    if 0 < k[0] < h-1 and 0 < k[1] < w-1:
        ans[v] += 1

ans[0] = (h-2) * (w-2) - sum(ans)

for i in ans:
    print(i)


Measured memory_bytes: 190148
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;

int main(){
    string s;
    cin >> s;
    int ans = 0;
    string tmp = s;
    reverse(s.begin(), s.end());
    for(int i=0; i<s.size()/2; ++i) {
        if(s[i] != tmp[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}



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

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

 for(int i=0; i<str.size()/2; i++){
  char tmp = str[i];
  str[i] = str[str.size()-(i+1)];
  str[str.size()-(i+1)] = tmp;
 }

 cout << str << '\n';

 return 0;
}

Measured memory_bytes: 1156
#include <cstdio>
#include <algorithm>
using namespace std;
int n,a[105],ans=0,red=0,t[105];
int main(){
	scanf("%d",&n);for(int i=1;i<=n;i++){scanf("%d",&a[i]);if(a[i]>=3200) red++;else t[a[i]/400]=1;}
	for(int i=0;i<8;i++) if(t[i]) ans++;
	printf("%d %d\n",max(ans,1),ans+red);
	return 0;
}

Measured memory_bytes: 128
#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 ll long long int
#define pb push_back
#define endl "\n"
#define F first
#define S second

#define pq priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>
#define MAX  *max_element
#define MIN  *min_element
#define des_sort(v) sort(v.begin(),v.end(),greater<int>())
 
#define c_ones(number) __builtin_popcountll(number)
#define flip_bits(number) static_cast<unsigned>(~number)
 
#define all(X) X.begin(),X.end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(itr,n) for(itr=n.begin();itr!=n.end();itr++)
 
#define FLUSH fflush(stdout)
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb_ds tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define mod 1000000007
#define INF 1e18
 
const double PI = acos(-1);
 
bool compare(pair<int,int>a , pair<int,int>b){
	return a.first==b.first ? a.second<b.second : a.first < b.first;
}
 
struct hash_pair{ 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};


int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n);
    rep(i,n)cin>>a[i];
    int dp[k+1];
    memset(dp,0,sizeof(dp));
    sort(all(a));
    for(int i=1;i<=k;i++){
    	for(int j=0;j<n;j++){
    		if(i-a[j]<0)break;
    		if(!dp[i-a[j]]){
    			dp[i]=1;
    			break;
			}
		}
	}
	if(dp[k])cout<<"First"<<endl;
	else cout<<"Second"<<endl;
}

Measured memory_bytes: 4016
N, M  = [int(n) for n in input().split(' ')]
H = [int(n) for n in input().split(' ')]
dic = {}
for i in range(M):
  A,B = [int(n) for n in input().split(' ')]
  if H[A-1]>H[B-1]:
    dic[B]=A
  elif H[A-1]<H[B-1]:
    dic[A]=B
  else:
    dic[B]=A
    dic[A]=B
cnt = 0
for i in range(1,N+1):
  if i not in  dic.keys():
    cnt += 1

print(cnt)

Measured memory_bytes: 20712
/*
?????属????????????solve(p, t)???t==0????????贈?????????????????????
??即?則???????????????属??則???????????則????????卒??測??即??????????????????
 
???????????属??????????????????????????贈???????????????????????????
yes no??則???????????則,???t==0????????贈?????贈????????賊??????????????則?????????????????属?????????
*/
#include <iostream>
#include <cstdio>
#include <vector>
 
 
using namespace std;
 
// true ?????属??贈???????????即 yes
bool solve(int p, int t, int n, int *A){
    if(t==0) return true; //==0????????卒??贈???????其??????????
    if(p>=n) return false; // A???????卒???即??????????????????????????????(??賊???p?????則)
    if(t<0) return false; //?其????????????則?其?????????即???????????則?????????
    
    // + ???????????? or
    return solve(p+1, t-A[p], n, A) + solve(p+1, t, n, A);
    
}
 
int main() {
    int i,j;
    int A[21];
    int buf;
    int n,q,M;
    
    cin >> n;
    for(i=0; i<n; i++) {
        //scanf("%5d", &(A[i]));
        cin >> A[i];
    }
    
    cin >> q;
    for(i=0; i<q; i++){
        cin >> M;
        if(solve(0,M,n,A)) cout << "yes" << endl;
        else cout << "no" << endl;        
    }
        
        return 0;
}
 

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

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------


int main() {
  double d,t,s,time;
  cin>>d>>t>>s;
  time=d/s;
  if(time<=t)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}



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



int main()
{
    int n;
    cin>>n;
    int val;
    vector<long long> v;
    int i;
    for(i=0;i<n;i++)
    {
        cin>>val;
        v.push_back(val);
    }
    int long long ans=0;
    int j;
    long long sum=0;
    for(i=0;i<n;i++)
    {
        sum=sum+v[i];
        
    }
    for(i=0;i<n;i++)
    {
        sum=sum-v[i];
        ans=(ans+((sum)%1000000007*(v[i]%1000000007))%1000000007)%1000000007;
        
        
    }
    cout<<ans;
    
  return 0;
}

Measured memory_bytes: 5304
#include <iostream>
#include <cmath>
#define INF 1e9
#define MAXN 100005
using namespace std;

long long n, k, h[MAXN], dp[MAXN];

int main() {
	cin >> n >> k;
	for (int i=1; i<=n; i++) {
		cin >> h[i];
	}
	for (int i=2; i<=n; i++) {
		dp[i] = INF;
	}
	for (int i=1; i<=n; i++) {
		for (int j=1; j<=k; j++) {
			if (i - j < 1) continue;
			dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
		}
	}
	cout << dp[n] << "\n";
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stdlib.h>
#include <time.h>
#include <iomanip>
#include <math.h>
#include <bitset>
#include <string.h>

using namespace std;

#define taskname "A"
#define LL long long 
#define uLL unsigned long long 
#define FOR(i,l,r) for(int i = l; i <= r; ++i)
#define REP(i,l,r) for(int i = l; i < r; ++i)
#define FORD(i,r,l) for(int i = r; i >= l; --i)
#define REPD(i,r,l) for(int i = r; i > l; --i)
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) { cerr << #x << " = " << x << endl; }
#define sci(x) int x; scanf("%d", &x);
#define scii(x, y) int x, y; scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define _USE_MATH_DEFINES 
/* M_PI */
#define SetLength2(a, n, t) a=((t*) calloc(n, sizeof(t))) + (n)/2

const int maxN = 301;
const int MOD = 1e9 + 7;

int tcases = 1;

int N,M;
vector <pi> W[maxN];

int F[maxN][maxN][maxN],gmax[maxN][4],gmin[maxN][4],newColorState[4][4];

int mod(int x){
    while(x >= MOD) x -= MOD;
    return x;
}
void update(int i,int j,int k,int x){
    F[i][j][k] = mod(F[i][j][k] + x);
}
bool check(int i,int j,int k){
    bool c = 1;
    if(!(i >= gmax[i][1] && j < gmin[i][1])) c = 0;
    if(!(j >= gmax[i][2] && k < gmin[i][2])) c = 0;
    if(k < gmax[i][3]) c = 0;
    return c ;
}
void testcase(){
    // init 
    scanf("%d%d",&N,&M);

    FOR(i,0,N) FOR(j,1,3){
        gmax[i][j] = -MOD;
        gmin[i][j] = MOD;
    }

    FOR(i,1,M){
        sciii(l,r,x);
        gmax[r][x] = max(gmax[r][x],l);
        gmin[r][x] = min(gmin[r][x],l);
    }
    //
    F[0][0][0] = 1;

    REP(i,0,N){
        FOR(j,0,i)
        FOR(k,0,j)
        if(F[i][j][k] > 0 && check(i,j,k)){
            update(i + 1,j,k,F[i][j][k]);
            update(i + 1,i,k,F[i][j][k]);
            update(i + 1,i,j,F[i][j][k]);
        }
    }

    int res = 0;
    FOR(j,0,N) FOR(k,0,j) if(F[N][j][k] > 0 && check(N,j,k)) res = mod(F[N][j][k] + res);

    printf("%d",res);
}

int main(){

    FOR(i,1,tcases) testcase();

    return 0;
}

Measured memory_bytes: 104832
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)

using namespace std;

int main(){

	int N,W,v[105],w[105],dp[10005][100];
	cin>>N>>W;
	for(int i=0; i<N; i++){
		cin>>v[i]>>w[i];
		dp[0][i] = 0;
	}

	for(int i=0; i<=W; i++){
		if(w[0] <= i) dp[i][0] = v[0];
		else dp[i][0] = 0;
	}

	for(int i=1; i<=W; i++){
		for(int j=1; j<N; j++){
			if(w[j] <= i && 0 <= i-w[j] ){
				dp[i][j] = max(dp[i][j-1], dp[i-w[j]][j-1] + v[j]);
			}else{
				dp[i][j] = dp[i][j-1];
			}
		}
	}

	cout<<dp[W][N-1]<<endl;

	return 0;
}

Measured memory_bytes: 7012
<?php

    fscanf(STDIN,"%d%d",$A,$B);
    
    $A_sub = $A;
    $B_sub = $B;
    
    $A_count = 1;
    $B_count = 1;
    
    while($A_sub != $B_sub){
        
        $A_sub = $A * $A_count;
        $B_sub = $B * $B_count;
        
        if($A_sub > $B_sub){
            $B_count++;
        }else{
            $A_count++;
        }
    }
    echo $A_sub;
?>

Measured memory_bytes: 16156
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,d;
    vector< pair<int, int> >v;
    scanf("%lld%lld",&a,&b);
    for(long long int i=1; i<=a; i++)
    {
        scanf("%lld%lld",&c,&d);
        v.push_back(make_pair(c,d));
    }
    sort(v.begin(),v.end());
    long long int ans,sum=0;
    for(long long int i=0; i<a; i++)
    {

        sum+=v[i].second;
        if(sum>=b)
        {
            ans=v[i].first;
            break;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1400
#include<stdio.h>
#include<string.h>
int main(void)
{
    int n,t,min=1001,i;
    scanf("%i %i",&n,&t);
    int a[n],b[n];
    for(i=0;i<n;i++)
    {
        scanf("%i %i",&a[i],&b[i]);
        if(a[i]<min&&b[i]<=t)min=a[i];
    }
    if(min==1001)printf("TLE");
    else printf("%i",min);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 1000000000
#define MOD 1000000007
#define ll long long int
using namespace std;


int main(){
  ll N,A,B; cin>>N>>A>>B;
  if(N==1 and A==B) {cout<<1<<endl;return 0;}
  if(N==1) {l: cout<<0<<endl;return 0;}
  if(A>B) goto l;
  cout<<(N-2)*(B-A)+1<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    int ay[15]= {0};
    int n,k,a,tp;
    cin>>n>>k;
    tp=n;
    for(int i=0; i<k; ++i)
    {
        cin>>a;
        ay[a]++;
    }
    while(1)
    {
        bool flag=true;
        while(tp)
        {
            if(ay[tp%10])
            {
                n++;
                flag=false;
                break;
            }
            else
                tp/=10;
        }
        if(flag)
            break;
        tp=n;
    }
    cout<<n<<endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const int MAX_V=100;
vector<int> G[MAX_V];
vector<int> match1, match2;
bool used[MAX_V];
int n,m;

void add_edge(int u, int v){
    G[u].pb(v);
}

bool dfs(int v){
    if(used[v]) return false;
    used[v]=true;
    for(int &to : G[v]){
        if(match2[to]==-1||dfs(match2[to])){
            match1[v]=to;
            match2[to]=v;
            return true;
        }
    }
    return false;
}

int bipartite_matching(){
    int res=0;
    match1.resize(n,-1); match2.resize(m,-1);
    bool upd=true;
    while(upd){
        upd=false;
        rep(v,0,n) if(match1[v]==-1 && dfs(v)) upd=true, ++res;
        if(upd) fill(used,used+n,false);
    }
    return res;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin>>N;
    n=N; m=N;
    int a[N], b[N], c[N], d[N];
    rep(i,0,N) cin>>a[i]>>b[i];
    rep(i,0,N) cin>>c[i]>>d[i];
    rep(i,0,N){
        rep(j,0,N){
            if(a[i]<c[j]&&b[i]<d[j]) add_edge(i,j);
        }
    }
    cout <<bipartite_matching()<<"\n";
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long INF=INT_MAX/4;
const long long MOD=1'000'000'007;
const double EPS=1e-14;
const bool DEBUG=true;

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

template<class T>
void debug(T head){
    if(DEBUG){
        cout<<head<<endl;
    }
}

template <class Head, class... Body>
void debug(Head head, Body... body){
    if(DEBUG){
        cout<<head<<" ";
        debug(body...);
    }
}

/////
void answer(){
    unsigned long long N, K;
    cin>>N>>K;

    unsigned long long answer = K;
    for(int i=0; i<N-1; ++i){
        answer *= K-1;
    }
    cout<<answer;

    return;
}

/////

int main(int argc, char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.precision(16);

    answer();

    return 0;
}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);

int fastpow(int x, int n, int m){
    int a = 1;
    IREP(i, 64){
        a = (a * a) % m;
        if(((n >> i) & 1) == 1) a = (a * x) % m;
    }
    return a;
}

class Combination
{
public:

    vec fact, invfact;
    int MAX_N, mod;

    Combination(int MAX_N, int mod): MAX_N(MAX_N), mod(mod) {
        fact = vec(MAX_N + 1);
        invfact = vec(MAX_N + 1);
        fact[0] = 1;
        FOR(i, 1, MAX_N + 1){
            fact[i] = (fact[i - 1] * i) % mod;
        }
        invfact[MAX_N] = fastpow(fact[MAX_N], mod - 2, mod);
        IREP(i, MAX_N){
            invfact[i] = (invfact[i + 1] * (i + 1)) % mod;
        }
    }

    int comb(int n, int r){
        if(r > n || r < 0 || n < 0) return 0;
        int a = fact[n];
        a = (a * invfact[r]) % mod;
        a = (a * invfact[n - r]) % mod;
        return a;
    }
};

signed main(){

    int N; cin >> N;
    if(N == 2){
        cout << 1;
        return 0;
    }
    int mod = 1000000007;

    Combination C(N, mod);
    int ans = 0;

    vec F(N);
    REP(k, N){
        int tmp = C.fact[k] * C.fact[N - 1 - k];
        tmp %= mod;
        tmp *= C.comb(k - 1, N - 1 - k);
        tmp %= mod;
        F[k] = tmp;
    }

    FOR(k, 1, N){
        ans += k * (F[k] - F[k - 1] + mod);
        ans %= mod;
    }

    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  ll n;
  cin >> n;
  vll v(n);
  REP(i, n)
    cin >> v[i];

  sort(v.begin(), v.end());
  long double now = v[0];
  REP(i, n-1){
    now += v[i+1];
    now /= 2.0;
  }
  cout << Decimal;
  cout << now << endl;
}


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

int main() {
	int N, M, K;
	cin >> N >> M >> K;
	map<int,int> D;
	for (int i=0; i<M; ++i) {
		int d;
		cin >> d;
		D[d-1] = i;
	}
	vector<vector<int>> to(M);
	for (int i=0; i<N; ++i) {
		for (int j=0; j<K; ++j) {
			int v;
			cin >> v;
			if (D.count(i)) {
				to[D[i]].push_back(D.count(v-1) ? D[v-1] : -1);
			}
		}
	}

	vector<int> cost(1<<M, 1e8);
	queue<pair<int,int>> q; // (移動回数,ビット状態)
	q.emplace(0, (1<<M)-1);
	int t, bt;
	while ( ! q.empty()) {
		tie(t, bt) = q.front();
		q.pop();
		if ( ! bt) break;
		if (cost[bt] <= t) continue;
		cost[bt] = t;
		for (int i=0; i<K; ++i) {
			int bt2 = 0;
			for (int j=0; j<M; ++j) {
				if (~to[j][i] && ((bt>>j)&1)) {
					bt2 |= (1<<to[j][i]);
				}
			}
			q.push(make_pair(t+1, bt2));
		}
	}
	cout << t << endl;
}


Measured memory_bytes: 32604
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramB
    {
        static void Main(string[] args)
        {
            var a = long.Parse(Console.ReadLine());
            var result = 0;

            for (var i = 0; i < 10; i++)
            {
                if ((1 << i) <= a)
                {
                    result = 1 << i;
                }
                else
                    break;
            }

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 27504
#include <array>
#include <vector>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)

void solve(int p, int q)
{
    unordered_map<int, int> r_idx;

    int r = 10 * p;

    for(int i = 0; ; ++i) {
        r_idx[r] = i;

        int digit = r / q;
        printf("%d", digit);

        r = 10 * (r % q);

        if(r == 0) {
            puts("");
            return;
        }

        if(r_idx.find(r) != r_idx.end()) {
            puts("");

            int idx_begin = r_idx[r];
            REP(_, idx_begin) {
                putchar(' ');
            }
            REP(_, i+1 - idx_begin) {
                putchar('^');
            }
            puts("");

            return;
        }
    }
}

int main()
{
    char buf[1024];
    while(fgets(buf, sizeof(buf), stdin)) {
        int p, q;
        sscanf(buf, "%d %d\n", &p, &q);
        //printf("%d %d\n", p, q);

        solve(p, q);
    }

    return 0;
}

Measured memory_bytes: 2592
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <unordered_set>
#include <unordered_map>
#include <cassert>
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define mod 1000000007
#define mod1 1000000009
#define mod2 1000000021
#define INF 500001
#define MAX 1000000001
using namespace std;

/* 🐣🐥 */
double p[3000], ans;
double dp[3000][3001];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lf", &p[i]);
	}
	dp[0][0] = 1 - p[0], dp[0][1] = p[0];
	for (int i = 1; i < n; i++) {
		dp[i][0] = dp[i - 1][0] * (1 - p[i]);
		for (int j = 1; j <= i + 1; j++) {
			dp[i][j] += dp[i - 1][j - 1] * p[i] + dp[i - 1][j] * (1 - p[i]);
		}
	}
	for (int i = n / 2 + 1; i <= n; i++) {
		ans += dp[n - 1][i];
	}
	printf("%.10lf", ans);

	return 0;
}

Measured memory_bytes: 68864
#include <iostream>
using namespace std;
int main(void){
    int a;
    cin>>a;
    if(a<=111){
        cout<<111;
    }else if(a<=222){
        cout<<222;
    }else if(a<=333){
        cout<<333;
    }else if(a<=444){
        cout<<444;
    }else if(a<=555){
        cout<<555;
    }else if(a<=666){
        cout<<666;
    }else if(a<=777){
        cout<<777;
    }else if(a<=888){
        cout<<888;
    }else{
        cout<<999;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<set>
#include<math.h>
#include<map>
#include<iomanip>

using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(n,x) for(ll i=0;i<n;i++) cin>>x[i];


int main()
{
	ll n;
	cin >> n;
	vector<ll> h(n);
	rep(n, h);
	ll ans = 0;
	vector<bool> tf(n,false);

	for (ll i = 0; i < n-1; i++)
	{
		if (h[i+1] <= h[i])
		{
			tf[i] = true;
		}
	}
	ll p = 0;
	for (ll i = 0; i < n; i++)
	{
		if (tf[i])
		{
			p++;
		}
		else
		{
			if (ans < p)
			{
				ans = p;
			}
			p = 0;
		}
	}

	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3984
from collections import Counter, OrderedDict


n = int(input())
lst_v = list(map(int, input().split()))


if len(set(lst_v)) == 1:
    ans = n // 2
else:
    lst_odd = [lst_v[i] for i in range(n) if i%2==0]
    lst_even = [lst_v[i] for i in range(n) if i%2!=0]
    cnt_odd = sorted(Counter(lst_odd).items(), key=lambda x: -x[1])
    cnt_even = sorted(Counter(lst_even).items(), key=lambda x :-x[1])

    if cnt_odd[0][0] == cnt_even[0][0]:
        rem_number = max(cnt_odd[0][1] + cnt_even[1][1], cnt_odd[1][1] + cnt_even[0][1])
    else:
        rem_number = cnt_odd[0][1] + cnt_even[0][1]
    sum_odd = sum(t[1] for t in cnt_odd)
    sum_even = sum(t[1] for t in cnt_even)
    ans = sum_odd + sum_even - rem_number


print(ans)


Measured memory_bytes: 21076
import sys
from io import StringIO
import unittest

class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]

def resolve():
    int1 = lambda x: int(x) - 1
    readline=sys.stdin.readline

    n,m=map(int, readline().strip().split())

    uf = UnionFind(n)
    
    tb=[0]*n

    for i in range(m):
        a,b=map(int1, readline().strip().split())
        uf.Unite(a,b)
    for i in range(n):
        tb[uf.Find_Root(i)]=1
    print(sum(tb)-1)

if 'doTest' not in globals():
    resolve()
    sys.exit()

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

const int MOD = 1000000007;

int arr[63245];

int dp[63245][100];

void init(int n, int &m)
{
    int i = 1;
    int j = 1;
    arr[1] = 1;
    while (i != n)
    {
        i = n / (n / (i + 1));
        ++j;
        
        arr[j] = i;
    }
    m = j;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n, k;
    cin >> n >> k;
    
    int m;
    init(n, m);
    
    // cout << m << '\n';
    // for (int i = 1; i <= m; ++i)
    //     cout << arr[i] << '\n';
    
    for (int i = 1; i <= m; ++i)
        dp[i][0] = arr[i];
    
    for (int i = 1; i != k; ++i)
        for (int j = 1; j <= m; ++j)
            dp[j][i] = (dp[j - 1][i] + 1LL * dp[m - j + 1][i - 1] * (arr[j] - arr[j - 1])) % MOD;
    
    // int ans = 0;
    // for (int i = 1; i <= m; ++i)
    //     ans = (ans + dp[i][k - 1]) % MOD;
    // for (int i = 1; i <= m; ++i)
    //     ans = (ans + dp[i][0]) % MOD;
    
    cout << dp[m][k - 1] << '\n';
    
    return 0;
}

Measured memory_bytes: 25216
n = int(input())
word = []
for i in range(n):
  a = int(input())
  l = [list(map(int,input().split())) for _ in range(a)]
  word.append(l)

ans = 0
for i in range(2**n):
  flag = 0
  count = 0
  for j in range(n):
    if ((i>>j)&1)==1 and flag==0:
      for k,l in word[j]:
        if ((i>>(k-1))&1) != l:
          flag = 1 ## tell a lie
          break
  if flag==0:
    count = bin(i).count('1')
    ans = max(ans,count)
print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC179
{
    public class A
    {
        public static void Main(string[] args)
        {
            var s = Console.ReadLine().ToCharArray();
            if (s[^1] == 's')
            {
                Console.WriteLine($"{new string(s)}es");
            }
            else
            {
                Console.WriteLine($"{new string(s)}s");
            }
        }
    }
}


Measured memory_bytes: 25812
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mx = max(x)
my = min(y)
for z in range(-100, 101):
    if mx < z <= my and X < z < Y:
        print("No War")
        exit()
print("War")


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

using namespace std;
using ll = long long;

#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

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

int main()
{
    int K;
    string S;

    cin >> K >> S;

    string ans;
    if (S.length() <= K)
    {
        ans = S;
    }else{
        ans = S.substr(0, K) + "...";
    }

    cout << ans << endl;
}


Measured memory_bytes: 3640
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define INF 1<<25
 
typedef long long ll;

int dy[8]={1,1,1,0,0,-1,-1,-1};
int dx[8]={-1,0,1,-1,1,-1,0,1};
struct S{
	int a,b,c;
};
bool asc(const S& left,const S& right){
	return left.c > right.c;
}


int main(){
	int a,b,c,n,m;
	string S1,S2;
	cin>>S1>>S2;
	rep(i,S1.size()){
		if(S1[i]!=S2[S2.size()-i-1]){
			cout<<"NO"<<endl;
			return 0;
		}

	}
	cout<<"YES"<<endl;
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int i,num;
  int p,s,t;

  s=0;
  t=0;
  for(i=0;i<4;i++){
    scanf("%d",&p);
    s+=p;
  }
  for(i=0;i<4;i++){
    scanf("%d",&p);
    t+=p;
  }
  printf("%d\n",(s>=t)?s:t);

  return 0;
}

Measured memory_bytes: 0