akhauriyash/Code-Regression huggingface dataset:
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

// Required random number generators

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(D);
    READV(S);
    READV(T);
    if(D<=S*T)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    

//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define inchar			getchar
#define outchar(x)		putchar(x)
#define ll long long int
#define all(v) v.begin(), v.end()
#define SP outchar(' ')
#define LN outchar('\n')
using namespace std;
const ll MOD  = int(1e9 + 7);

template<typename T> void inpos(T &x){x=0;register T c=inchar();while(((c<48)||(c>57))&&(c!='-'))c=inchar();bool neg=0; if(c=='-')neg=1;for(;c<48||c>57;c=inchar());for(;c>47&&c<58;c=inchar())x=(x<<3)+(x<<1)+(c&15);if(neg)x=-x;}
template<typename T> void outpos(T n){if(n<0){outchar('-');n*=-1;}char snum[65];int i=0;do{snum[i++]=n%10+'0';n/=10;}while(n);i=i-1;while(i>=0)outchar(snum[i--]);}
inline void instr(char *str){register char c=0;register int i=0;while(c<33)c=inchar();while(c!='\n'&&c!=' '&&c!=EOF){str[i]=c;c=inchar();++i;}str[i]='\0';}
const int NAX = 1e5 + 5;
int dp[NAX] = {0};

int main () {
	int n; int k;
	cin >> n;
	cin >> k;
	int arr[n];
	
	for (int i = 0; i<n;i++) {
		cin >> arr[i];
	}
	// dp[0] = 1 ; // winning state for first
	for (int i = 0; i<arr[0];i++) { // 
		dp[i] = 2; // First nahi chal payega
					// Losing state for first
	}
	// ye saara hi losing states hai
	for (int i = arr[0] ; i<=k;i++) {
		bool ekAAYAYANAHI = false;
		for (int j = 0; j<n;j++) {
			if ( (i - arr[j]) >= 0 && (dp[i - arr[j]] == 2)) { // if saare hi winning then hi this loosing
				ekAAYAYANAHI = true;
				break;
			}
		}
		if (ekAAYAYANAHI) {
			dp[i] = 1;
		} else {
			dp[i] = 2;
		}
	}
	if (dp[k] == 1) {
		cout << "First" <<endl;
	} else {
		cout << "Second" << endl;
	}
	
	


}

Measured memory_bytes: 640
from copy import deepcopy


def main() -> None:
    n = int(input())
    red_points = [[int(r) for r in input().split()] for _ in range(n)]
    blue_points = [[int(b) for b in input().split()] for _ in range(n)]
    ans = 0

    for i in range(2):
        for j in range(2):
            red_points.sort(key=lambda x: x[i ^ 1])
            red_points.sort(key=lambda x: x[i])

            blue_points.sort(key=lambda x: -x[j ^ 1])
            blue_points.sort(key=lambda x: -x[j])

            rps = deepcopy(red_points)
            bps = deepcopy(blue_points)

            cnt = 0
            while len(rps) > 0:
                for k in range(len(bps) - 1, -1, -1):
                    if rps[-1][0] < bps[k][0] and rps[-1][1] < bps[k][1]:
                        rps.pop()
                        bps.pop(k)
                        cnt += 1
                        break
                    if k == 0:
                        rps.pop()
                ans = max(ans, cnt)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3540
#!/usr/bin/env python3
from collections import defaultdict, deque
N = int(input())
w = defaultdict(int)
edge = [[] for _ in range(N + 1)]

for _ in range(N - 1):
    a, b, c = map(int, input().split())
    w[str(a) + "_" + str(b)] = c
    w[str(b) + "_" + str(a)] = c
    edge[a].append(b)
    edge[b].append(a)

Q, K = map(int, input().split())

root = K
done = [True for _ in range(N + 1)]
done[root] = False
d = [0 for _ in range(N + 1)]
q = deque([root])

while q:
    parent = q.pop()
    for child in edge[parent]:
        if done[child]:
            key = str(parent) + "_" + str(child)
            done[child] = False
            d[child] = d[parent] + w[key]
            q.append(child)

for _ in range(Q):
    x, y = map(int, input().split())
    print(d[x] + d[y])

Measured memory_bytes: 114592
#include<stdio.h>
#include<string.h>
int main(){
char s[220],p[110],a[110];
scanf("%s\n%s",s,p);
strcpy(a,s);
strcat(s,a);
if(strstr(s,p)!=NULL){
printf("Yes\n");
}
else{
printf("No\n");
}
return 0;
}


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

const int64_t INF = 1001001001001001001;
int a[440];
int64_t su[440][440];
int64_t dp[440][440];

int main() {
    int n;
    cin >> n;
    rep(i,n) cin >> a[i];
    for (int lef = 0; lef < n; lef++) {
        su[lef][lef+1] = a[lef]; 
        for (int rig = lef + 2; rig <= n; rig++) {
            su[lef][rig] = su[lef][rig-1] + a[rig-1]; 
        }
    }

    for (int width = 2; width <= n; width++) {
        for (int lef = 0; lef+width <= n; lef++) {
            int rig = lef + width;
            dp[lef][rig] = INF;
            for (int m = lef + 1; m < rig; m++) {
                dp[lef][rig] = min(dp[lef][rig], dp[lef][m] + dp[m][rig] + su[lef][rig]);
            }
        }
    }
    cout << dp[0][n] << endl;
}

Measured memory_bytes: 2944
import java.util.*;
/*
NOTES:
-more than 10 digits (10^10), use long
-prefix sum of 1's and -1's to control flow of highlighting a region
-log(a)/log(b) = log base b of a
-create a position array if trying to see if elements show up next to each other sequentially
 i.e. elements 1,2,3 are within 3 spots of each other in an array
      arr[scannedInt - 1] = i; (position of i at p[i] in original)
- use a freq array when counting instances of an element occurring
- increment the counter first before simulating anything turn-based (two player game)

 */

public class Main {
    static long mod = (long)(Math.pow(10, 9) + 7);
    public static String alpha = "zabcdefghijklmnopqrstuvwxy";
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int t =1;
        while (t-- > 0) {
            int ans= 0;
            String a = scan.next();
            String b = scan.next();
            for(int i = 0; i<a.length(); i++){
                if(a.charAt(i) != b.charAt(i)) ans++;
            }
            System.out.println(ans);

        }
        scan.close();
    }

    static ArrayList factors(int n ){
        ArrayList<Integer> facts = new ArrayList<>();
        for(int i = 1; i<=(int)Math.sqrt(n); i++){
            if(n%i == 0){
                if( i == Math.sqrt(n)) facts.add(i);
                else{
                    facts.add(i);
                    facts.add(n/i);
                }
            }
        }
        Collections.sort(facts);
        return facts;
    }

    static boolean isPrime (int n){
        if(factors(n).size() ==2) return true;
        else return false;
    }





    static int GCD(int a, int b) {
        // Everything divides 0
        if (a == 0) return b;
        if (b == 0) return a;

        // base case
        if (a == b) return a;

        // a is greater
        if (a > b) return GCD(a-b, b);
        return GCD(a, b-a);
    }
    static int LCM(int a, int b){
        return (a*b)/(GCD(a,b));
    }
    static String rev(String s){
        char[] arr = s.toCharArray();
        for(int i = 0; i<(s.length()+1)/2; i++){
            char temp = arr[i];
            arr[i] = arr[s.length()-i-1];
            arr[s.length()-i-1] = temp;
        }
        String fin = new String(arr);
        return fin;
    }
    static long pow(long a, long N) {
        if (N == 0) return 1;
        else if (N == 1) return a;
        else {
            long R = pow(a,N/2);
            if (N % 2 == 0) {
                return R*R;
            }
            else {
                return R*R*a;
            }
        }
    }

    static long powMod(long a, long N) {
        if (N == 0) return 1;
        else if (N == 1) return a % mod;
        else {
            long R = powMod(a,N/2) % mod;
            R *= R;
            R %= mod;
            if (N % 2 == 1) {
                R *= a;
                R %= mod;
            }
            return R % mod;
        }
    }

}

Measured memory_bytes: 41268
#include <iostream>
#include <iomanip>

using namespace std;
int main()
{
  int N, K;
  cin >> N >> K;
  double E[N];
  E[0] = 0;
  double ans = 0.0;

  for (int i = 1; i <= N; i++) {
    cin >> E[i];
    E[i] = (E[i] + 1) / 2;
    E[i] += E[i-1];

    if (i >= K) {
      ans = max(ans, E[i] - E[i-K]);
    }
  }
       
  cout<<fixed<<setprecision(12)<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <time.h>
#include <stdlib.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ull unsigned long long
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define clr(x) x.clear()
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vi>
#define mp make_pair
#define hell 1000000007
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define all(a) a.begin(),a.end()
#define ign cin.ignore();

#define o_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define o_setll tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

using namespace std;
using namespace __gnu_pbds;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef MY_PROJECT
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

int main()
{
    IOS
    ll n;
    cin>>n;
    ll res=1;
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0){
            ll temp=n;
            while(temp%i==0){
                temp=temp/i;
            }
            if(temp%i==1){
                res++;
            }
        }
    }
    ll num=n-1;
    ll res2=1;
    for(ll i=2;i*i<=num;i++)
    {
        if(num%i==0){
            ll mult=1;
            while(num%i==0){
                num=num/i;
                mult++;
            }
            res2=res2*mult;
        }
    }
    if(num>1)
        res2=res2*2;
    ll finall=res+res2-1;
    cout<<finall;
    return 0;
}


Measured memory_bytes: 256
// Aizu Vol-1 0190: Eleven Puzzle
// 2017.8.23 bal4u@uu
// ???????????¢?´¢??????????????\??????????????§??¶????????§??????
// ????????????????????????16?????????????????§??§???OK???
// 1????????????????????§8??????4??????????????§4096????????¶??????

#include <stdio.h>

#define MAX 500000
typedef unsigned long long UL;

typedef struct { UL s; char m; } HASH;
typedef struct { UL s; char b1, b2; } QUE;
#define HASHSIZ 900001ULL
HASH hash[HASHSIZ + 5], *hashend = hash + HASHSIZ;
QUE Q[MAX + 5], *top, *end, *qmax = Q + MAX;

int lookup(UL s)
{
	HASH *p = hash + s % HASHSIZ;
	while (p->s) {
		if (p->s == s) return p->m;
		if (++p == hashend) p = hash;
	}
	return -1;
}

int insert(UL s, char m)
{
	HASH *p = hash + s % HASHSIZ;
	while (p->s) {
		if (p->s == s) return 0;
		if (++p == hashend) p = hash;
	}
	p->s = s, p->m = m;
	return 1;
}

int move[13][5] = {
	/*  0 */{ 2, -1 },
	/*  1 */{ 2, 5, -1 },
	/*  2 */{ 0, 1, 3, 6, -1 },
	/*  3 */{ 2, 7, -1 },
	/*  4 */{ 5, -1 },
	/*  5 */{ 1, 4, 6, 9, -1 },
	/*  6 */{ 2, 5, 7, 10, -1 },
	/*  7 */{ 3, 6, 8, 11, -1 },
	/*  8 */{ 7, -1 },
	/*  9 */{ 5, 10, -1 },
	/* 10 */{ 6, 9, 11, 12, -1 },
	/* 11 */{ 7, 10, -1 },
	/* 12 */{ 10, -1 } };

UL swap(UL s, int p, int sp)
{
	UL n;
	p = (12 - p) << 2, sp = (12 - sp) << 2;
	n = (s >> p) & 0xf;
	s &= ~(0xfULL << p);
	return s | (n << sp);
}

int sach(UL s, int b1, int b2, int mode, int lim)
{
	int i, j, x, b[2], step = 1;
	UL s2;

	top = end = Q, end->s = s, end->b1 = b1, end->b2 = b2, end++, end->s = 0, end++;
	while (top < end) {
		s = top->s, b[0] = top->b1, b[1] = top->b2, top++;
		if (!s) { step++, end->s = 0, end++; continue; }
		if (step > lim) break;
//	printf("%#15llx, b1 %2d, b2 %2d, step %2d\n", s, b[0], b[1], step);
		for (i = 0; i < 2; i++) {
			for (j = 0; (x = move[b[i]][j]) >= 0; j++) {
				if (x == b[0] || x == b[1]) continue;
				s2 = swap(s, x, b[i]);
				if (mode) { if (lookup(s2) >= 0) return step; }
				else if (!insert(s2, step)) continue;
				end->s = s2;
				if (i) end->b1 = b[0], end->b2 = x;
				else   end->b1 = x, end->b2 = b[1];
				end++;
			}
		}
	}
	return step;
}

int main()
{
	UL s;
	int i, ans, p, b1, b2;

	s = 0x123456789ab0ULL, insert(s, 0);
	sach(s, 0, 12, 0, 16);
	while (1) {
		for (b1 = 01, s = i = 0; i < 13; i++) {
			scanf("%d", &p);
			if (i == 0 && p < 0) return 0;
			if (!p) { if (b1 < 0) b1 = i; else b2 = i; }
			s = (s << 4) | p;
		}
		if ((ans = lookup(s)) < 0) {
			if ((ans = sach(s, b1, b2, 1, 4)) > 4) ans = -1;
			else ans += 16;
		}
		printf(ans < 0 ? "NA\n" : "%d\n", ans);	
	}
	return 0;
}

Measured memory_bytes: 22364
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long int ull;
#define base 31
#define MOD 1000000007
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORs(i, a, b) for(int i = a; i >= b; i--)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define __FOR(i, a, b, k) for(int i = a; i <= b; i+= k)
#define __REP(i, a, b, k) for(int i = a; i < b; i+= k)
#define pb push_back
#define _io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Read_ freopen("input.inp", "r", stdin)
#define Write_ freopen("output.out", "w", stdout);
using namespace std;
typedef pair <int, int> ii;
typedef vector <ii> vii;
#define fi first
#define se second
#define mp make_pair
#define N  200005
string s,t;
int main(){
    _io; 
    cin>>s;
    cin>>t;
    if (s==t){
        cout<<0;
        exit(0);
    }
    if (t.size()==1){
        REP(i,0,s.size()){
            if (s[i]==t[0]){
                cout<<0;
                exit(0);
            }
        }
        cout<<1;
        exit(0);
    }
    int start=0,res=-1;
    while(start<s.size()-t.size()+1){
        int i=start,j=0;
        while(i<start+t.size()-1){
            int d=0;
            while(j<t.size()){
                if (s[i]==t[j]){
                    ++d;
                }
                ++j;
                ++i;
            }
            res=max(res,d);
        }
        ++start;
    }
    cout<<t.size()-res;
}





Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

int a[5010] = {}, n, k;
bool dp[5010] = {};

bool c(int t){
	bool dp[5010] = {}; dp[0] = true;
	
	REP(i,0,n){
		if(i == t) continue;
		RREP(j,5000,0) if(j - a[i] >= 0) dp[j] |= dp[j - a[i]];
	}
	
	REP(i,max(0, k - a[t]), k) if(dp[i]) return false;
	return true;
}

int binary(){
	int ok = -1, ng = n;
	
	while(abs(ok - ng) > 1){
		int mid = (ok + ng) / 2;
		if(c(mid)) ok = mid;
		else ng = mid;
	}
	
	return ok + 1;
}

int main(){
	cin >> n >> k;
	REP(i,0,n) cin >> a[i]; sort(a, a+n);
	
	cout << binary() << endl;
	return 0;
}
//k-a[i] 以上 k 未満 の集合が作れる -> Need


Measured memory_bytes: 256
#include <stdio.h>
int min(int a,int b,int c){
  int x;
  if(a<b){
    if(a<c){
      x=a;
    }else{
      x=c;
    }
  }else{
    if(b<c){
      x=b;
    }else{
      x=c;
    }
  }
  return x;
}

int main(){
  int n,Min,gcd;
  long int sum=0;
  scanf("%d",&n);
  for(int a=1;a<=n;a++){
    for(int b=1;b<=n;b++){
      for(int c=1;c<=n;c++){
        Min=min(a,b,c);
        gcd=1;
        for(int i=1;i<=Min;i++){
          if(a%i==0 && b%i==0 && c%i==0){
            gcd=i;
          }        
        }
        sum=sum+gcd;
      }
    }
  }
  printf("%ld",sum);
  return 0;
}

Measured memory_bytes: 1728
def d():
    k = int(input())

    val = 0
    hits = 0
    hit_tails = {}
    while hits < k:
        val += 1
        if len(str(val)) == 1:
            hits += 1
            hit_tails[val] = int(str(val)[-1])
            # print('====', hits, val)
            pass
        else:
            lst = list(map(int, str(val)))
            # print('before:', lst)
            for i in range(len(lst) - 1):
                if lst[i] > lst[i+1] + 1:
                    lst[i+1] = lst[i] - 2
                    if(i < len(lst) - 2):
                        lst[i+2:] = [9] * len(lst[i+2:])
                    val = int(''.join(map(str, lst)))
                    # print('after1:', lst)
                    break
                elif lst[i] < lst[i+1] - 1:
                    lst[i+1:] = [9] * len(lst[i+1:])
                    val = int(''.join(map(str, lst)))
                    # print('after2:', lst)
                    break
                elif i == len(lst) - 2:
                    hits += 1
                    hit_tails[val] = int(str(val)[-1])
                    # print('====', hits, val)
                    pass

    print(val)


##########
if __name__ == "__main__":
    d()


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

long long INF = 1e18;

struct Edge{
    int from;
    int to;
    int cost;
};
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int ans = 0;
    if(a+b+c <=21){
        cout<<"win"<<endl;
    }else{
        cout<<"bust"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
h,w = map(int, raw_input().split())
m = [raw_input() for _ in range(h)]
possible = True
for y in range(h):
    for x in range(w):
        if m[y][x] == '#':
            p = 0
            if y > 0 and m[y-1][x] == '#':
                p += 1
            if x > 0 and m[y][x-1] == '#':
                p += 1
            if not(y == 0 and x == 0) and p != 1:
                possible = False
                break
            n = 0
            if y < h-1 and m[y+1][x] == '#':
                n += 1
            if x < w-1 and m[y][x+1] == '#':
                n += 1
            if not(y == h-1 and x == w-1) and n != 1:
                possible = False
                break
    if not possible:
        break
if possible:
    print 'Possible'
else:
    print 'Impossible'


Measured memory_bytes: 2696
#include<stdio.h>
long long MAX(long long a,long long b){return a<b?b:a;}
long long d[3010][3010][5]={},m[3010][3010];
int main(){
  int h,w,i,j,k,n,y,x,a;
  scanf("%d %d %d",&h,&w,&n);
  for(i=0;i<n;i++){
    scanf("%d %d %d",&y,&x,&a);
    m[y][x]=a;
  }
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      for(k=0;k<=3;k++){/*
	d[i+1][j][k+1]=MAX(d[i+1][j][k+1],d[i][j][k]+m[i][j]);
	d[i+1][j][k  ]=MAX(d[i+1][j][k  ],d[i][j][k]        );
	if(k<2)d[i][j+1][0  ]=MAX(d[i][j+1][0  ],d[i][j][k]+m[i][j]);
	d[i][j+1][0  ]=MAX(d[i][j+1][0],d[i][j][k]);/*/
	d[i][j+1][k+1]=MAX(d[i][j+1][k+1],d[i][j][k]+m[i][j]);
	d[i][j+1][k  ]=MAX(d[i][j+1][k  ],d[i][j][k]        );
	if(k<3)d[i+1][j][0  ]=MAX(d[i+1][j][0],d[i][j][k]+m[i][j]);
	       d[i+1][j][0  ]=MAX(d[i+1][j][0],d[i][j][k]);//*/
      }
    }
  }
  for(i=0;i<4;i++)d[h][w+1][0]=MAX(d[h][w+1][0],d[h][w+1][i]);
  printf("%lld\n",d[h][w+1][0]);
  return 0;
}


Measured memory_bytes: 425136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll H, W, m; cin >> H >> W >> m;
    ll h[m], w[m]; zep(i, 0, m)cin >> h[i] >> w[i];

    map<ll, ll> mph, mpw;
    set<P> s;

    zep(i, 0, m){
        if(mph.find(h[i]) == mph.end())mph[h[i]] = 0;
        if(mpw.find(w[i]) == mpw.end())mpw[w[i]] = 0;

        mph[h[i]]++;
        mpw[w[i]]++;
        s.insert(P(h[i], w[i]));
    }
    
    ll mxh = 0, mxw = 0;
    for(auto it = mph.begin(); it != mph.end(); it++)mxh = max(mxh, (*it).second);
    for(auto it = mpw.begin(); it != mpw.end(); it++)mxw = max(mxw, (*it).second);

    vector<ll> sh, sw;
    for(auto it = mph.begin(); it != mph.end(); it++)if((*it).second == mxh)sh.push_back((*it).first);
    for(auto it = mpw.begin(); it != mpw.end(); it++)if((*it).second == mxw)sw.push_back((*it).first);

    //printa(sh, 0, sh.size() - 1)
    //printa(sw, 0, sw.size() - 1)

    if(sh.size() * sw.size() > m){
        print(mxh + mxw)
    }else{
        zep(i, 0, sh.size()){
            zep(j, 0, sw.size()){
                if(s.find(P(sh[i], sw[j])) == s.end()){
                    print(mxh + mxw) return 0;
                }
            }
        }
        print(mxh + mxw - 1)
    }

    return 0;
}

Measured memory_bytes: 72536
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	int64 nn, xx, tt;
	cin >> nn >> xx >> tt;
	if(nn % xx == 0)
	{
		nn = nn / xx;
	}
	else
	{
		nn = nn / xx;
		nn++;
	}
	cout << (nn * tt) << endl;
	return 0;
}

Measured memory_bytes: 3616
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();
        int r = in.nextInt();

        if (n >= 10) {
            out.println(r);
        } else {
            out.println(r + 100 * (10 - n));
        }
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


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

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

  vector<int>A(N);
  int all=0;
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    all+=A.at(i);
  }
  int count=0;
  for(int i=0;i<N;i++){
    if(A.at(i)>=(double)all/(4*M)){
      count++;
    }
  }
  if(count>=M){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

const vector<int> ms = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

vector<int> as;
vector<int> dp;

inline int match_for(int x) {
    return ms[x];
}

int calc_max_digits(const int N, const vector<int> &as) {
    for (int i = 1; i <= N; i++) {
        for (auto &a : as) {
            int matches = match_for(a);
            if (i - matches >= 0 && dp[i - matches] >= 0) {
                chmax(dp[i], dp[i - matches] + 1);
            }
        }
    }
    return dp[N];
}

vector<int> solve(const int max_digits, const int N, const vector<int> &as) {
    vector<int> res;
    int cur_match = N;
    for (int i = 1; i <= max_digits; i++) {
        for (auto &a : as) {
            int req_match = match_for(a);
            if (cur_match - req_match >= 0 && dp[cur_match - req_match] == max_digits - i) {
                if (i == max_digits && cur_match - req_match != 0) {
                    // must consume all matches if this is the last digit.
                    continue;
                } else {
                    res.push_back(a);
                    cur_match -= req_match;
                    break;
                }
            }
        }
    }
    // assert(cur_match == 0);
    assert((int) res.size() == max_digits);
    return res;
}

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

    as.resize(M);
    for (int i = 0; i < M; i++) {
        cin >> as[i];
    }
    sort(as.begin(), as.end());
    reverse(as.begin(), as.end());

    dp.resize(N + 1, -1);
    dp[0] = 0;

    int max_digits = calc_max_digits(N, as);
    // printf("max_digits: %d\n", max_digits);

    vector<int> ans = solve(max_digits, N, as);
    for (auto &a : ans) {
        printf("%d", a);
    }
    printf("\n");

    return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int>vec(N);
    int ans = 0;
    for(int i = 0; i < N; i++) {
        cin >> vec[i];
    }
    for(int i = 1; i <= N; i++) {
        if(i != vec[i-1]) {
            ans++;
        }
    }
    if(ans/2 < 2 && ans%2 == 0) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}


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

const int N = 2333;

int n, m, q;
int se[N][N], sv[N][N];
int vert[N][N], diag[N][N];
char mp[N][N];

int check(int x, int y) {
    return mp[x][y] * ((x > 0 && mp[x - 1][y]) + (y > 0 && mp[x][y - 1]));
}

int main() {
    scanf("%d %d %d", &n, &m, &q);
    for (int i = 0; i < n; i++) {
        scanf("%s", mp[i]);
        for (int j = 0; j < m; j++) {
            mp[i][j] -= '0';
        }
    }

    for (int i = 0; i < n; i++) {
        int cnt = 0;
        for (int j = 0; j < m; j++) {
            cnt += mp[i][j];
            sv[i + 1][j + 1] = sv[i][j + 1] + cnt;
        }
    }

    for (int i = 1; i < n; i++) {
        int cnt = 0;
        for (int j = 0; j < m; j++) {
            if (mp[i][j] + mp[i - 1][j] == 2) {
                cnt++;
            }
            vert[i][j + 1] = cnt;
        }
    }

    for (int j = 1; j < m; j++) {
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (mp[i][j - 1] + mp[i][j] == 2) {
                cnt++;
            }
            diag[i + 1][j] = cnt;
        }
    }

    for (int i = 0; i < n; i++) {
        int cnt = 0;
        for (int j = 0; j < m; j++) {
            cnt += check(i, j);
            se[i + 1][j + 1] = se[i][j + 1] + cnt;
        }
    }

    for (int i = 0; i < q; i++) {
        int xa, ya, xb, yb;
        scanf("%d %d %d %d", &xa, &ya, &xb, &yb);
        int v = sv[xb][yb] + sv[xa - 1][ya - 1] - sv[xb][ya - 1] - sv[xa - 1][yb];
        int e = se[xb][yb] + se[xa - 1][ya - 1] - se[xb][ya - 1] - se[xa - 1][yb]
            - (vert[xa - 1][yb] - vert[xa - 1][ya - 1]) 
            - (diag[xb][ya - 1] - diag[xa - 1][ya - 1]);
        printf("%d\n", v - e);
    }
}

Measured memory_bytes: 87808
#include <iostream>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if ( a > b )
    cout <<"a > b"<< endl;
    else if ( a == b )
    cout <<"a == b"<< endl;
    else if ( a < b )
     cout << "a < b" << endl;
   
}


Measured memory_bytes: 3096
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
B.append(0)

sup = 0
count = 0
for i in range(len(B)):
	b = B[i]
	m = A[i]
	if m - sup >=  b:
		count += sup + b
		sup = 0
	elif m-sup < b:
		count += m
		sup =  b - max(0, m - sup)

print(count)



Measured memory_bytes: 19156
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define maxn 200300
using namespace std;
inline void read(int &x) {
    char ch;
    bool flag = false;
    for (ch = getchar(); !isdigit(ch); ch = getchar())if (ch == '-') flag = true;
    for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
    x = flag ? -x : x;
}
inline void write(int x) {
    static const int maxlen = 100;
    static char s[maxlen];
    if (x < 0) {   putchar('-'); x = -x;}
    if (!x) { putchar('0'); return; }
    int len = 0; for (; x; x /= 10) s[len++] = x % 10 + '0';
    for (int i = len - 1; i >= 0; --i) putchar(s[i]);
}

int n;
int a[maxn];

int main(){
    read(n);
    long long sum=0ll;
    for (int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        sum+=1ll*a[i];
    }
    long long ans=abs(sum-a[1]*2ll);
    long long now=0ll;
    for (int i=1;i<n;i++)
        {
            now+=1ll*a[i];
            ans=min(ans,1ll*abs(sum-now*2ll));
        }
    cout<<ans;
	return 0;
}


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

struct TCoordinate
{
	double x;
	double y;
};

bool IsSameSide(TCoordinate T1, TCoordinate T2, TCoordinate L1, TCoordinate L2)
{
	double CrossProductT1 = (L2.x - L1.x) * (T1.y - L1.y) - (L2.y - L1.y) * (T1.x - L1.x);
	double CrossProductT2 = (L2.x - L1.x) * (T2.y - L1.y) - (L2.y - L1.y) * (T2.x - L1.x);
	if(CrossProductT1 * CrossProductT2 > 0){
		return true;
	}else{
		return false;
	}
}

int main()
{
	while(true){
		TCoordinate A1, A2, A3, Ap;
		cin >> A1.x >> A1.y >> A2.x >> A2.y >> A3.x >> A3.y >> Ap.x >> Ap.y;
		if(cin.eof() == true) break;
		if(IsSameSide(A3, Ap, A1, A2) && IsSameSide(A1, Ap, A2, A3) && IsSameSide(A2, Ap, A3, A1)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3044
#include <iostream>

using namespace std;
typedef long long LL;

int n, k;
LL w[100000];

int check(LL P) {
    int i = 0;
    for (int j = 0; j < k; j++) {
        LL s = 0;
        while (s + w[i] <= P) {
            s += w[i];
            i++;
            if (i == n) return n;
        }
    }
    return i;
}

int solver() {
    LL left = 0;
    LL right = 100000 * 10000;
    LL mid;

    while (right > left) {
        mid = (left + right) / 2;
        int v = check(mid);
        if (v >= n) right = mid;
        else left = mid + 1;
    }
    return right;
}

int main()
{
    cin >> n >> k;
 
    for (int i = 0; i < n; i++)
        cin >> w[i];
 
    cout << solver() << endl;

    return 0;
}

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

using namespace std;

int main() {
    string s;
    int len;

    cin >> s;

    len = s.length();
    for (int i = 0; i < len; i++) {
        for (int j = i+1; j < len; j++) {
            if (s[i] == s[j]) {
                cout << "no" << endl;
                return 0;
            }
        }
    }
    cout << "yes" << endl;

    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int i,j,m,ni,na,mx,mi,p[200];
	while(1)	{
		scanf("%d %d %d",&m,&ni,&na);
		if(m==0 && ni==0 && na==0)	break;
		for(i=0;i<m;i++)	scanf("%d",&p[i]);
		sort(p,p+m,greater<int>() );
		mx=-1;
		for(i=ni-1;i<=na-1;i++)	{
			if(mx<=p[i]-p[i+1]){
				mx=p[i]-p[i+1];
				mi=i;
			}
		}
		printf("%d\n",mi+1);
	}
	return 0;
}


Measured memory_bytes: 2820
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

int main() {
  i64 H, W, N;
  cin >> H >> W >> N;
  vector<vector<i64>> Xs(H + 1);
  vector<vector<i64>> Ys(W + 1);
  for(int i = 0;i < N;i++) {
    i64 x, y;
    cin >> x >> y;
    Xs[x].push_back(y);
    Ys[y].push_back(x);
  }
  for(int i = 1;i <= H;i++) Xs[i].push_back(W + 1);
  for(int i = 1;i <= W;i++) Ys[i].push_back(H + 1);
  for(int i = 1;i <= H;i++) sort(all(Xs[i]));
  for(int i = 1;i <= W;i++) sort(all(Ys[i]));

  i64 h = 1;
  i64 w = 1;
  i64 ending = Ys[1].front();
  while(++h < ending) {
    if(*lower_bound(all(Xs[h]), w) == w + 1) {
    }
    else {
      w++;
      ending = min(ending, *lower_bound(all(Ys[w]), h));
    }
  }

  cout << ending - 1 << endl;
}


Measured memory_bytes: 24064
# C Tax Increase

from math import ceil

A, B = map(int, input().split())

a = [i for i in range(ceil(A*100/8), int((A+1)*100/8))]
b = [i for i in range(B*10, (B+1)*10)]

ans = list(set(a) & set(b))
if ans:
  print(min(ans))
else:
  print(-1)

Measured memory_bytes: 9156
#include<iostream>

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

int main() {
    int a, b;
    cin >> a >> b;

    // int x = (a + b) / 2;
    // if ((a + b) % 2 != 0) {
    //   x++;
    // }
    int x = (a + b + 1) / 2;

    cout << x << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define f first
#define s second

using namespace std;

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

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

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

    
    int n;
    cin>>n;

    int h[n];
    for(int i =0;i<n;i++)
    	cin>>h[i];

    int cnt[n];

    cnt[n-1] = 0;

    for(int i =n-2;i>=0;i--){
    	if(h[i+1] <= h[i])
    		cnt[i] = 1 + cnt[i+1];
    	else
    		cnt[i] = 0;
    }
    int maxi = cnt[0];
    for(int i =1;i<n;i++)
    	maxi = max(maxi,cnt[i]);

    cout<<maxi;

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
//#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const long long linf = 4523372036854775807;
const int inf = 1500000000;
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	int from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	int x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
int ari(int a, int b, int c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
int fact(int i) {
	ll sum = 1;
	for (int j = 2; j <= i; j++)
		sum = (sum* j) % Mod;
	return sum;
}//階乗(正）
 //---------------------------------------------------
 //+++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int n, s, sum = inf;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s;
		int res = 0;
		while (s % 2 == 0)
			s /= 2, res++;
		sum = min(sum, res);
	}
	cout << sum << endl;
	getchar(); getchar();
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;


int main(){
	int i,h[10];
	for(i = 0;i < 10;i++) scanf("%d",&h[i]);
	sort(h,h + 10);
	for(i = 9;i > 6;i--) printf("%d\n",h[i]);
	return 0;
}

Measured memory_bytes: 1044
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

sabun = []
for i in range(n):
    sabun.append([i + 1, abs((t- h[i] * 0.006) - a)])

res = float("inf")
for idx, j in sabun:
    if res > j:
        res = j
        ans = idx

print(ans)


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

using namespace std;

int main(){
  int n;
  cin >> n;
  
  vector<int> b(n);
  for(int i = 0; i < n; i++) cin >> b[i];
  
  vector<int> ans;
  
  for(int i = n - 1; i >= 0; i--){
    for(int j = i; j >= 0; j--){
      if(b[j] == j + 1){
        ans.push_back(j + 1);
        b.erase(b.begin() + j);
        break;
      }
    }
  }
  
  if(ans.size() == n){
    for(int i = n - 1; i >= 0; i--){
      cout << ans[i] << endl;
    }
  }else{
    cout << -1 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val S = readLine()!!

    println(if (S[0] == '0') {
        S.filterIndexed { index, c -> index % 2 == 0 }.count { it == '1' } + S.filterIndexed { index, c -> index % 2 != 0 }.count { it == '0' }
    } else {
        S.filterIndexed { index, c -> index % 2 == 0 }.count { it == '0' } + S.filterIndexed { index, c -> index % 2 != 0 }.count { it == '1' }
    })
}

Measured memory_bytes: 34236
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {

	int n,i;
	cin>>n>>i;
	cout<<n-i+1<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 100005;
ll A[MAX_N],M[MAX_N];

int main()
{
	int N,T;
	cin >> N >> T;
	rep(i,N)
	{
		cin >> A[i];
	}
	M[N-1] = A[N-1];
	for (int i = N-2; i >= 0; --i)
	{
		M[i] = max(M[i+1],A[i+1]);
	}
	/*
	rep(i,N)
	{
		cout << M[i] << " ";
	}
	cout << endl;
	*/
	int ans = 0, temp = 0;
	rep(i,N)
	{
		if (M[i] - A[i] > temp)
		{
			ans = 1; temp = M[i] - A[i];
		}
		else if (M[i] - A[i] == temp)
		{
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int x[100][100],H,W;
int main(){
	cin>>H>>W;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			char c;cin>>c;
			if(c=='W')x[i][j]=0;
			if(c=='B')x[i][j]=1;
			if(c=='R')x[i][j]=2;
		}
	}
	int maxn=H*W;
	for(int i=1;i<H;i++){
		for(int j=i+1;j<H;j++){
			int cnt=0;
			for(int k=0;k<H;k++){
				for(int l=0;l<W;l++){
					if(k<i){if(x[k][l]!=0)cnt++;}
					if(k>=j){if(x[k][l]!=2)cnt++;}
					if(k>=i && k<j){if(x[k][l]!=1)cnt++;}
				}
			}
			maxn=min(maxn,cnt);
		}
	}
	cout<<maxn<<endl;
	return 0;
}

Measured memory_bytes: 3116
#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
    N,A,B,C,X = map(int,input().split(" "))
    if N == 0 and A == 0 and B == 0 and C == 0 and X == 0:
        break
    Y = list(map(int,input().split(" ")))
    pointer = 0

    for i in range(10001):
        X = (A*X+B)%C if i != 0 else X
        if X == Y[pointer]:
            pointer += 1
            if pointer == len(Y):
                break

    if pointer != len(Y):
        print(-1)
    else:
        print(i)

Measured memory_bytes: 6720
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = Integer.parseInt(scan.next());
        int X = Integer.parseInt(scan.next());
        int[] M = new int[N];
        int tmp = 1000;
        int cou = N;
        for(int i = 0;i<N;i++){
            M[i] = Integer.parseInt(scan.next());
            X -= M[i];
            if(tmp>M[i]){
                tmp = M[i];
            }
        }
        int count = X/tmp;
        System.out.println(cou+count);
    }
}

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

using namespace std;


#define uniq(x)  x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Upper value search  >
#define lower(arr,n,fixed) lower_bound(arr,arr+n,fixed)-arr  //Lower value search  >=
#define FOR(i,a,n) for(int i=a; i<(int)n; i++)
#define FORI(i,a,n) for(int i=a; i>=(int)n; i--)
#define pii pair<int,int>
#define vpii vector<pii>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(a) int((a).size())
#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0)
#define endl "\n"
#define all(a) a.begin(), a.end()
#define MEMSET(p,i) memset(p,i,sizeof(p))

typedef long long LL;
typedef unsigned long long ULL;

int main(void)
{
	fastIO();
	int n, k;

	cin >> n >> k;
	vector<int> v(n);
	int dp[100010] = {0};



	
	FOR(i,0,n){
		cin >> v[i];
		dp[v[i]] = 1; // win
	}
	
	FOR(i,0,k+1){
		if(dp[i] == 1){
			for(auto j : v){
				if(i+j <= k){
					if(dp[i+j] == 0){
						dp[i+j] = 0; // lose
					}
				}
			}
		}
		else {
			for(auto j : v){
				if(i+j <= k){
					dp[i+j] = 1; // win
				}
			}
		}
		
	}
	
	if(dp[k] == 1)
		cout << "First\n";
	else
		cout << "Second\n";


	
	
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

ll dp[101][2][5];

int main() {
  string N;
  cin >> N;
  int K;
  cin >> K;

  dp[0][0][0] = 1;

  rep(i, N.size()) rep(ls, 2) rep(k, K + 1) if (dp[i][ls][k] != 0) {
    int v = N[i] - '0';
    int limit = ls ? 9 : v;
    rep(p, limit + 1) {
      int nls = ls || p != v;
      int nk = k + (p != 0);
      dp[i + 1][nls][nk] += dp[i][ls][k];
    }
  }

  cout << dp[N.size()][0][K] + dp[N.size()][1][K] << endl;
}


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

int main() {
	int a, b;
	cin >> a >> b;
	
	if(((a >= -1000) && (a <= 1000)) && ((b >= -1000) && (b <= 1000))) {
		if(a < b) {
			cout << "a < b";
		} else if(a > b) {
			cout << "a > b";
		} else {
			cout << "a == b";
		}
		cout << endl;
	}
}

Measured memory_bytes: 3124
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> v(n);
    for (int i = 0; i < n; ++i) {
        v[i] = make_pair(0, i+1);
    }
    for (int i = 0; i < m; ++i) {
        int x;
        scanf("%d", &x);
        v[x-1].first = -i-1;
    }
    sort(v.begin(),v.end());
    for (int i = 0; i < n; ++i) {
        printf("%d\n", v[i].second);
    }
    return 0;
}


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

#define MAX_N 100000

int main() {
    int N; cin >> N;
    vector<int> NUM(MAX_N + 1, 0);
    for (int i = 0; i < N; ++i) {
        ll a; cin >> a;
        NUM[a]++;
    }
    int Q; cin >> Q;
    ll sum = 0;
    for (int i = 1; i <= MAX_N; i++) {
        sum += (ll)NUM[i] * (ll)i;
    }
    while (Q--) {
        ll b, c; cin >> b >> c;
        sum += (c - b) * NUM[b];
        NUM[c] += NUM[b];
        NUM[b] = 0;
        cout << sum << endl;
    }
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
//#include "atcoder/all"
typedef long long int ll;
using namespace std;
// using namespace atcoder;
#define MAXN 300001
#define mod 1000000007
ll a[MAXN];
int main() {
    int n;
    cin >> n;
    ll co[60];
    for (int i = 0; i < 60; i++) co[i] = 0;
    for (int i = 1; i <= n; i++) {
        ll a;
        cin >> a;
        int count = 0;
        while (a) {
            co[count]+= a % 2;
            a /= 2;
            count++;
        }
    }
    ll ret = 0;
    int now = 1;
    for (int i = 0; i < 60; i++) {
        ret = (ret + (now * co[i] % mod)  * (n - co[i])) % mod;
        now = now * 2 % mod;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3632