akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

bool ismatch(vector<ll> &v1, vector<ll> &v2)
{
	ll ok{true};
	for (ll i = 0;i < (ll)v1.size(); ++i)
	{
		if (v1[i] != v2[i]) ok = false;
	}
	return ok;
}

int main(int argc, char **argv)
{
	ll N; cin >> N;
	vector<ll> P(N), Q(N);
	for (ll i = 0; i < N; ++i) cin >> P[i];
	for (ll i = 0; i < N; ++i) cin >> Q[i];
	vector<ll> V(N);
	iota(V.begin(), V.end(), 1ll);
	ll i{1}, a, b;
	do
	{
		if (ismatch(V, P))
			a = i;
		if (ismatch(V, Q))
			b = i;
		++i;
	} while (next_permutation(V.begin(), V.end()));
	std::cout << abs(a-b) << std::endl;
}


Measured memory_bytes: 256
import itertools
n = int(input())
p = tuple(list(map(int, input().split())))
q = tuple(list(map(int, input().split())))
po = 0
qo = 0
l = sorted(list(itertools.permutations(range(1,n+1))))
for i in range(len(l)):
    if l[i] == p:
        po = i
    if l[i]== q:
        qo = i
print(abs(po-qo))

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

int main() {
    int n,m;
    cin >> n >> m;
    vector<int> l(m);
    vector<int> r(m);
    for(int i=0;i<m;++i){
        cin >> l.at(i);
        cin >> r.at(i);
    }
    sort(l.begin(),l.end(),greater<int>());
    sort(r.begin(),r.end());
    if(r.at(0)-l.at(0)+1<=0){
        cout << 0 << endl;
        return 0;
    }
    cout << r.at(0)-l.at(0)+1 << endl;
}

Measured memory_bytes: 1024
// luogu-judger-enable-o2
#include <bits/stdc++.h>
using namespace std;
char p[101000];
int S[101000],P[101000],n;
int main() {
    scanf("%d",&n);
    scanf("%s",p);
    int i,j;
    for(int i=0;p[i];i++) {
        if(p[i]=='o') P[i+1]=0;
        else P[i+1]=1;
    }
    P[n+1]=P[1];
    for(int i=0;i<8;i++) {
        S[0]=i&1;
        S[1]=(i>>1)&1;
        S[2]=(i>>2)&2;
        for(int j=2;j<=n+1;j++) {
            S[j+1]=S[j-2]^P[j];
        }
        if(S[0]^S[n]^S[1]^S[n+1] || S[1]^S[n+1]^S[2]^S[n+2]) continue ;
        for(int j=1;j<=n;j++) {
            printf("%c",(S[j]^S[j-1])?'W':'S');
        }
        cout<<endl;
 //       system("pause");
        return 0;
    }
    cout<<-1<<endl;
 //   system("pause");
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main()
{

int N,p=0;
cin>>N;
char S[N];

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

for(int i=0; i<N; i++){
        if ((S[i]=='A')&&(S[i+1]=='B')&&(S[i+2]=='C')){
            p++;
        }
}

cout<<p<<endl;
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int w,h,x,y;
    cin>>w>>h>>x>>y;
    double s,xs,ys;
    s=double(w)*double(h)/2.0;
    printf("%.10f ",s);
    if(x*2==w&&y*2==h) cout<<1<<endl;
    else cout<<0<<endl;
}

Measured memory_bytes: 504
#include<stdio.h>

int main(){
  
  int x,y,z,tmp;

  scanf("%d %d",&x,&y);
  
  if(x<y){
    tmp=x;
    x=y;
    y=tmp;
  }
  
  while((z=x%y)!=0){
    x=y;
    y=z;
  }

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

Measured memory_bytes: 592
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
// #define ll long long
typedef long long ll;
typedef pair<int, int> P;



int main(int argc, const char * argv[]) {

  // int w, h, x, y;
  // // cout << n << endl;
  // int flag = 0;

  // // x方向に切る
  // long x1 = w * (h-y); 
  // long x2 = w * (y);
  int n;
  cin >> n;
  vector<int> w(n);
  rep(i, n){
    cin >> w[i];
  }
  int sum1 = w[0];
  int sum2 = accumulate(w.begin()+1, w.end(), 0);


  vector<int> arr(n-1);
  arr[0] = abs(sum1 - sum2);
  for(int i=1; i<n-1; ++i){
    sum1 += w[i];
    sum2 -= w[i];
    // cout << sum1 << " " << sum2 << endl;
    arr[i] = abs(sum1 - sum2);
  }

  int minElement = *std::min_element(arr.begin(), arr.end());
  cout << minElement << endl;
  return 0;
}


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

using namespace std;

constexpr int64_t MOD = 1000000007;

// dp[x][upColor][downColor]: xの左側をcolorで塗った場合の数
int64_t dp[60][3][3];

int64_t Add(int64_t a, int64_t b) {
  a += b;
  if (a > MOD) {
    a -= MOD;
  }
  return a;
}

int main() {
  int N;
  string S1, S2;
  cin >> N >> S1 >> S2;

  vector<int> splitIndices;
  for (int i = 1; i < N; i++) {
    if (S1[i - 1] != S1[i]) {
      splitIndices.push_back(i);
    }
  }
  splitIndices.push_back(N);

  memset(dp, 0, sizeof(dp));

  int a = splitIndices[0];
  if (a == 1) {
    for (int c = 0; c < 3; c++) {
      dp[1][c][c] = 1;
    }
  } else {
    for (int colorUp = 0; colorUp < 3; colorUp++) {
      for (int colorDown = 0; colorDown < 3; colorDown++) {
        if (colorDown == colorUp) continue;
        dp[2][colorUp][colorDown] = 1;
      }
    }
  }

  for (int i = 1; i < splitIndices.size(); i++) {
    int interval = splitIndices[i] - splitIndices[i - 1];

    if (interval == 1) {
      for (int prevColorUp = 0; prevColorUp < 3; prevColorUp++) {
        for (int prevColorDown = 0; prevColorDown < 3; prevColorDown++) {
          for (int c = 0; c < 3; c++) {
            if (c == prevColorUp or c == prevColorDown) continue;
            dp[splitIndices[i]][c][c] =
                Add(dp[splitIndices[i]][c][c],
                    dp[splitIndices[i - 1]][prevColorUp][prevColorDown]);
          }
        }
      }
    } else {
      for (int prevColorUp = 0; prevColorUp < 3; prevColorUp++) {
        for (int prevColorDown = 0; prevColorDown < 3; prevColorDown++) {
          for (int colorUp = 0; colorUp < 3; colorUp++) {
            if (colorUp == prevColorUp) continue;
            for (int colorDown = 0; colorDown < 3; colorDown++) {
              if (colorDown == prevColorDown) continue;
              if (colorDown == colorUp) continue;
              dp[splitIndices[i]][colorUp][colorDown] =
                  Add(dp[splitIndices[i]][colorUp][colorDown],
                      dp[splitIndices[i - 1]][prevColorUp][prevColorDown]);
            }
          }
        }
      }
    }
  }

  int64_t total = 0;
  for (int colorUp = 0; colorUp < 3; colorUp++) {
    for (int colorDown = 0; colorDown < 3; colorDown++) {
      total = Add(total, dp[N][colorUp][colorDown]);
    }
  }
  printf("%ld\n", total);

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int main()
{
    int matrix[3][3];

    for(int i = 0; i <3; i++)
        for(int j = 0; j <3; j++)
            scanf("%d", &matrix[i][j]);

    int A[3];
    int B[3];

    A[0] = 0;
    B[0] = matrix[0][0] - A[0];
    B[1] = matrix[0][1] - A[0];
    B[2] = matrix[0][2] - A[0];
    A[1] = matrix[1][0] - B[0];
    A[2] = matrix[2][0] - B[0];

    int flag = 1;
    for(int i = 0; i < 3; i++)
        for(int j = 0; j < 3; j++)
            if(A[i] + B[j] != matrix[i][j])
                flag =0;
    if(flag==1)
    printf("Yes\n");
    else
    printf("No\n");
    return 0;
}

Measured memory_bytes: 128
//#define TEST

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Linq;
using static System.Math;

class Program
{
    static int N;
    static int[] h;

    static void Main()
    {
        N = int.Parse(Console.ReadLine());
        h = Console.ReadLine().Split().Select(int.Parse).ToArray();

        long[] dp = new long[N];
        for (int i = 1; i < N; i++)
        {
            dp[i] = dp[i - 1] + Abs(h[i] - h[i - 1]);
            try
            {
                dp[i] = Min(dp[i], dp[i - 2] + Abs(h[i - 2] - h[i]));
            }
            catch { continue; }
        }
#if TEST
        foreach (var c in dp)
            Console.Write("{0} ", c);
        Console.WriteLine();
#endif
        Console.WriteLine(dp[N - 1]);
    }
}

Measured memory_bytes: 18400
// Template
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;

#define REP(i, n) for(int i = 0;i < n;i++)
#define INF 1 << 30

int MOD = 1000000007;

int main(){
    std::ios_base::sync_with_stdio(false);

    int n; cin >> n;
    string s[3]; cin >> s[0] >> s[1] >> s[2];
    int cnt = 0;
    REP(i,n){
        int c =0;
        for(int j=0; j<2; ++j){
            if(s[j][i]!=s[j+1][i]){
                c+=1;
            }
        }
        if(s[0][i] != s[2][i]){
            c+=1;
        }
        if(c==3){
            cnt+=2;
        } else if(c==2){
            cnt+=1;
        } else if(c==1){
            cnt+=1;
        }
    }
    cout << cnt << endl;

}


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

int main() {
	int A, B, C, X,ans=0;
	cin >> A >> B >> C >> X;
	for (int i = 0; i <= A; i++) {
		for (int j = 0; j <= B; j++) {
			int a = i * 500;
			int b = j * 100;
			int rem = X - a - b;
			int c = rem / 50;
			if (0 <= c&&c <= C) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int n; cin >> n;
    string s; cin >> s;
    
    int ans = 0;
    int l=0,r=n-1;
    bool ok = true;
    while(true) {
        while(s[l] == 'R') {
            l++;
            if(l == r) { ok = false; break; }
        }
        if(!ok) break;
        while(s[r] == 'W') {
            r--;
            if(l == r) { ok = false; break; }
        }
        if(!ok) break;
        l++;
        r--;
        ans++;
        if(l>=r) break;
    }
    cout << ans <<endl;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};



int main(void) {
  int n;
  cin >> n;
  vi P(n);
  rep(i,n) cin >> P[i];
  int cnt = 0;
  int large = P[0];
  rep(i,n){
    if(P[i]<=large) cnt ++;
    large = min(large,P[i]);
  }
  cout << cnt << endl;
}

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


def resolve():
    N, K = [int(i) for i in input().split()]
    H = sorted([int(i) for i in input().split()])
    if N <= K:
        H = [0]
    else:
        # if K < (N - K):
        for i in range(K):
            H[len(H) - 1 - i] = 0
        # else:
        #     Hs = []
        #     for i in range(N - K):
        #         Hs.append(H[i])
        #     H = Hs
    print(sum(H))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 1
4 1 5"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """8 9
7 9 3 2 3 8 4 6"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """3 0
1000000000 1000000000 1000000000"""
        output = """3000000000"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 28568
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip	;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1<<30;
int main(){
	int n,m;
	int MOD=10000;
	cin>>n>>m;
	int dp[110][3][3]={0};
	vi in(n);
	while(m--){
		int a,b;
		cin>>a>>b;
		a--;
		in[a]=b;
	}
	rep(i,3)rep(j,3){
		dp[1][(in[1]?in[1]-1:i)][(in[0]?in[0]-1:j)]=1;
	}
	loop(i,2,n){
		if(in[i]){
			rep(j,3)rep(k,3)if(!(in[i]-1==j&&j==k))
				dp[i][in[i]-1][j]=(dp[i][in[i]-1][j]+dp[i-1][j][k])%MOD;
		}else{
			rep(q,3)rep(j,3)rep(k,3)if(!(q==j&&j==k))
				dp[i][q][j]=(dp[i][q][j]+dp[i-1][j][k])%MOD;
		}
	}
	int co=0;
	rep(i,3)rep(j,3)co=(co+dp[n-1][i][j])%MOD;
	cout<<co<<endl;
//	rep(i,3){rep(j,3)cout<<" "<<dp[1][i][j];cout<<endl;}
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n);++i)
using namespace std;
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 int INF = 2147483647;
const long long inf = 1ll << 60;
const long long mod = 1000000007;

int dx[4] = {1,0,-1,0};int dy[4] = {0,-1,0,1};
int main() {
    int n;cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    vector<int> dp(n,INF);
    for(int i=0;i<n;i++){
	vector<int>::iterator itr = lower_bound(dp.begin(),dp.end(),a[i]);
	*itr = a[i];
    }

    int ans = lower_bound(dp.begin(),dp.end(),INF)-dp.begin();
    cout << ans << endl;
    return 0;
}



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

using namespace std;

typedef long long ll;

const int N=1e5+5;

int a[N],sum[N];
int main()
{
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    for(int i=0;i<n-1;i++)
    {
        if(s[i]=='A'&&s[i+1]=='C') a[i]=1;
        else a[i]=0;
    }
    sum[0]=a[0];
    for(int i=1;i<n;i++) sum[i]=sum[i-1]+a[i];
    while(q--)
    {
        int l,r;
        cin >> l >> r;
        l--,r--;
        int ans=sum[r]-sum[l];
        if(a[r]) ans--;
        if(a[l]) ans++;
        cout << ans << endl;
    }
    return 0;
}


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

typedef vector <long long> vi;
typedef vector <vi> vvi;
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define ll long long

int main(void)
{
    ll n, k;
    cin >> n >> k;
    ll dp[k + 1][2];
    ll a[n];

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

    dp[0][0] = 1;
    dp[0][1] = 0;
    for (int i = 1; i < k + 1; i++)
    {
        for (int t = 0; t < 2; t++)
        {
            ll ans;
            if (t == 1)
                ans = 0;
            else
                ans = 1;
            
            for (int j = 0; j < n; j++)
            {
                if (i - a[j] >= 0)
                {
                    if (dp[i - a[j]][(t + 1) % 2] == t)
                        ans = t;
                }
            }

            dp[i][t] = ans;
        }
    }
    
    if (dp[k][1] == 1)
        cout << "First\n";
    else
        cout << "Second\n";
}


Measured memory_bytes: 1792
N,A,B = map(int,input().split())

if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    if A - 1 < N - B:
        B1 = B - A
        coll = (B1 + 1) // 2
        print(B - coll)
    else:
        A1 = A + (N - B) + 1
        coll = (A1 + N) // 2
        print(coll - A)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll long long
const int N=200005;
using namespace std;
int n,num;
map<string,int>a;
string s;
int main(){
    cin>>n;
    for(int i=0;i<n;i++)
	{
        cin>>s;
        if(a[s]==0) num++,a[s]++;
    }
    cout<<num;
    return 0;
}

Measured memory_bytes: 19176
// ----------------------- GOD BLESS YOU -----------------------------------
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e5+10;
int val[N];
int a[N]; int nx,totwt;
int dpx[105][N];

int kapsack(int i,int wt)
{
   if(i==nx or wt==0) return 0;
   int &dp=dpx[i][wt]; if(dp!=-1) return dp;
   if(a[i]>wt) return dp=kapsack(i+1,wt);
   else return dp=max(kapsack(i+1,wt),val[i]+kapsack(i+1,wt-a[i])); 
   
}


int32_t main() 
{
     cin>>nx>>totwt;
     memset(dpx,-1,sizeof(dpx));
     for(int i=0;i<nx;i++) cin>>a[i]>>val[i];
     int temp=kapsack(0,totwt);
     cout<<temp; return 0;
}

Measured memory_bytes: 82304
n=int(input())
a=list(map(int,input().split()))
a.sort()
jun=1
if n%2==0:
  for i in range(n//2):
    if a[2*i] != 2*i+1 or a[2*i+1] != 2*i+1:
      print(0)
      exit()
    jun = jun*2%1000000007
  print(jun)
else:
  if n==1:
    if a[0]==0:
      print(1)
    else:
      print(0)
  else:
    for i in range(n//2):
      if a[2*i+1] != 2*(i+1) or a[2*i+2] != 2*(i+1):
        print(0)
        exit()
      jun = jun*2%1000000007
    print(jun)

Measured memory_bytes: 14008
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
 
#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}
 
using namespace std;                                                                                  
 
mt19937 mrand(random_device{}()); 
const ll mod = 1e9 + 7;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;                                            
typedef pair < long long  , long long > pll ;
const int N = 2e5 + 123, K = 2e9 + 1 , L = 3e5;

int n, k, m;
vector < pii > gr[N];
bool was[N];
int val[N];
void dfs(int u){
	was[u] = 1;
	for(auto to : gr[u])
		if(!was[to.fi]){
			val[to.fi] = val[u] + to.se;
			dfs(to.fi);
		}
		else if(val[u] + to.se != val[to.fi])
			ret("No");
}
main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin >> n >> m;
	for(int i = 1; i <= m; i++){
		int u , v ,w;
		cin >> u >> v >> w;
		gr[u].pb({v,w});
		gr[v].pb({u,-w});
	}				

	for(int i = 1; i <= n; i++)
		if(!was[i])
			dfs(i);
	ret("Yes");	

}
 


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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    int n, m;
    cin >> n >> m;

    v_ll a(n), b(n);
    irep(i, n) {
        cin >> a[i] >> b[i]; 
    }

    v_int p(n);
    v_ll dist(n, LINF);

    v_ll c(m), d(m);
    irep(i, m) {
        cin >> c[i] >> d[i];
    }

    irep(i, n) {
        irep(j, m) {
            ll q = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if(q < dist[i]) {
                dist[i] = q;
                p[i] = j+1;
            }
            if(q == dist[i]) {
                p[i] = min(p[i], j+1);
            }
        }
    }
    irep(i, n) {
        cout << p[i] << endl;
    }
    return 0;
}   
/** atcoder **/


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll num=1e9+7;
ll mod(ll n)
{
    return (n%num+num)%num;
}
ll add(ll x,ll y)
{
    return mod(mod(x)+mod(y));
}
ll mult(ll x,ll y)
{
    return mod(mod(x)*mod(y));
}
ll sub(ll x,ll y)
 {
     return mod(mod(x)-mod(y));
 }
 ll pt(ll n,ll p)
 {
      if(p==0)
       return 1;
       if(p==1)
        return n%num;
        ll t=pt(n,p/2);
        if(p%2==0)
         return mult(t,t);
         else
          return mult(n,mult(t,t));
 }
 ll dp[2004];
 ll bc(ll n)
 {
    if(n==0)
     return 1;
     if(n==1 || n==2)
      return 0;
      if(n>=3 && n<=5)
       return 1;
       if(dp[n]!=-1)
        return dp[n];
        ll total=0;
        for(ll i=3;i<=2000;i++)
         {
             if(i<=n)
              total=add(total,bc(n-i));
         }
        return dp[n]=total;
 }
 void solve()
 {
    ll n;
    cin>>n;
   memset(dp,-1,sizeof(dp));
  // dp[0]=1;
   
   cout<<bc(n)<<endl;
  // cout<<dp[n]<<endl;
      
 }
int main(){
   ll t;
   t=1;
   while(t--)
   {
       solve();
   }
    
}


Measured memory_bytes: 3636
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: f64 = read();
    let m: f64 = read();
    let d: f64 = read();

    let x1;
    if d == 0.0 {
        x1 = 1. / n;
    } else {
        x1 = (n - d) * 2.0 / (n * n);
    }
    println!("{}", x1 * (m - 1.0));
}


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

typedef long long ll;


ll dev(ll a, ll x) {
  if (a == -1) {
    return 0;
  } else {
    return a / x + 1;
  }
}

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  ll ans = dev(b, x) - dev(a - 1, x);
  cout << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string
from functools import lru_cache
import heapq

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3,d + 1,2):
            if n % i == 0:
                return False
        return True


MOD = int(1e09) + 7

def main():
    X = cin.int()
    while not Math.isPrime(X):
        X +=1
    print(X)
    return

if __name__ == "__main__":
    main()


Measured memory_bytes: 38640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <utility>
#include <tuple>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;

int main(){
	int n;
	cin >> n;
	map<int,int> mp;
	vector<int> a(n);
	for(int i = 0;i < n;i++){
		cin >> a[i];
		mp[a[i]]++;
	}

	sort(a.begin(), a.end(), greater<int>());

	int ans = 0;
	for(int i = 0;i < n;i++){
		int now = 1;
		//今見ている数より大きい最小の2べき
		while(now <= a[i]){
			now *= 2;
		}

		if(mp[a[i]] == 0)continue;

		if(a[i] * 2 == now){
			if(mp[a[i]] >= 2){
				ans++;
				mp[a[i]] -= 2;
			}
		}
		else{
			if(mp[now - a[i]] > 0){
				ans++;
				mp[now-a[i]]--;
				mp[a[i]]--;
			}
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 22784
import numpy as np
 
N,M = map(int,input().split())
 
A = np.array([int(x) for x in input().split()],dtype=np.int64)
A.sort()
 
BC = np.array([[int(x) for x in input().split()] for _ in range(M)])
B = BC[:,0]
C = BC[:,1]
 
idx = C.argsort()
B = B[idx][::-1]
C = C[idx][::-1]
 
p = 0
for b,c in zip(B,C):
  A[p:p+b] = np.maximum(A[p:p+b],c)
  p += b
 
answer = A.sum()
print(answer)

Measured memory_bytes: 32776
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        if(!s.equals("AAA")&&!s.equals("BBB")){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23124
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn solve(N: usize) -> usize {
    if N % 2 == 1 {
        return 0;
    }

    let mut m = 10;
    let mut t = 0_usize;
    while m <= N {
        t += N / m;
        m *= 5;
    }

    t
}

fn main() {
    let N = read!(usize);

    println!("{}", solve(N))
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main()
#define ll long long int
{
	int t=1;
//	cin >> t;
	while(t--)
	{
		int n,m;
		cin>> n >> m;
		vector<ll>v(n+1);
		for(int i=1;i<=n;i++ )
		{
			cin>> v[i];
		}
		ll count=0;
		int arr[100005]={0};
        while(m--)
		{
			ll a,b;
			cin>> a >> b;
			if( v[a]>=v[b])
			{
				arr[b]++;
			}
			if(v[b]>=v[a])
			{
				arr[a]++;
			}

		}

		for(int i=1;i<=n;i++)
		{
			if(arr[i]==0)
			{
				count++;
			}
		}
		cout<< count<< endl;

	}
}


Measured memory_bytes: 4556
import java.io.*;
import java.util.*;

public class Main {
  private static int solve(int n, int k) {
    int answer = k;
    for (int i = 1; i < n; i++) {
      answer *= k - 1;
    }
    return answer;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    int k = reader.nextInt();
    out.println(solve(n, k));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


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

namespace C
{
	internal class Program
	{
		private static int n;
		private static List<int> sn;

		public static void Main(string[] args)
		{
			n = int.Parse(Console.ReadLine());
			sn = new List<int>(n);
			for (var i = 0; i < n; i++) { sn.Add(int.Parse(Console.ReadLine())); }

			var result = sn.Sum();
			if (result % 10 != 0)
			{
				Console.WriteLine(result);
				return;
			}

			sn.Sort();

			for (var i = 0; i < n; i++)
			{
				if (sn[i] % 10 != 0)
				{
					Console.WriteLine(result - sn[i]);
					return;
				}
			}

			Console.WriteLine(0);
		}
	}
}

Measured memory_bytes: 13268
n = int(input())

if n < 105:
    print(0)
    exit()

ans = 0
for i in range(105, n+1,2):
    cnt = 0
    for j in range(1,i+1):
        if i % j == 0:
            cnt += 1
        
        if cnt == 8:
            ans += 1

print(ans)

Measured memory_bytes: 9096
x, k, d = map(int, input().split())

if x == 0:
    print(d*(k%2))

else:
    x = abs(x)
    sho = x//d
    amari = x%d
    if sho >= k:
        print(x-k*d)
    else:
        if (k-sho)%2==0:
            print(amari)
        else:
            print(abs(amari-d))



Measured memory_bytes: 9172
x,n=map(int,input().split())
if n==0:
  print(x)
  exit()
p=list(map(int,input().split()))
p.sort()
t=0
while True:
  if x-t in p and x+t in p:
    t+=1
  elif x-t in p and x+t not in p:
    print(x+t)
    exit()
  elif x-t not in p:
    print(x-t)
    exit()

Measured memory_bytes: 61940
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;

const int MOD=1000000007;
int INF=100100100100100;

signed main(){
  int n;
  long double a[110],ans;
  cin>>n;
  rep(i,n){
    cin>>a[i];
    ans+=1/a[i];
  }
  cout<<setprecision(15)<<1/ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int MAX_N = 100010;
int n, u, v;
int T[MAX_N], A[MAX_N];
bool visited[MAX_N];
vector<vector<int>> tree;

void dfs(int i, int *dist) {
    visited[i] = true;
    for (int &j: tree[i]) {
        if (!visited[j]) {
            dist[j] = dist[i] + 1;
            dfs(j, dist);
        }
    }
}

int main() {
    cin >> n >> u >> v;
    u--; v--;

    tree.resize(n);
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        tree[a].pb(b);
        tree[b].pb(a);
    }

    dfs(u, T);
    rep(i, MAX_N) visited[i] = false;
    dfs(v, A);

    int ans = 0;
    rep(i, n) {
        if (T[i] < A[i]) ans = max(ans, A[i]-1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 10496
N = int(input())
h = list(map(int, input().split()))
INF = float('inf')
dp = [INF] * N
dp[0] = 0
for i in range(1, N):
    if i == 1:
        dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i-1]))
    else:
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
# print(dp)
print(dp[N - 1])

Measured memory_bytes: 13928
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader();    
        int n = r.i();
        int[] a = r.ii();
        int[] b = new int[n];
        int i = 0;
        int j;
        while((j = n-1-2*i) >= 0){
            b[i] = a[j];
            i++;
        }
        j = 2*i-n;
        while(i < n){
            b[i] = a[j];
            i++;
            j+=2;
        }           
        StringBuilder sb = new StringBuilder();
        for(int x : b)
            sb.append(x+" ");
        println(String.valueOf(sb));
    }

    static void print(Object o){
        System.out.print(o.toString());
    }

    static void println(Object o){
        System.out.println(o.toString());
    }

    static int Int(String s){
        return Integer.parseInt(s);
    }

    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s() throws IOException{
            return readLine();
        }

        String[] ss() throws IOException{
            return s().split(" ");
        }

        int i() throws IOException{
            return Int(s());
        }

        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }

        long l() throws IOException{
            return Long(s());
        }

        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 59340
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int a;
	long long c=0;
	cin >> a;
	vector<int> b(a);
	for (int i = 0;i < a;i++) {
		bool f = false;
		b[i] = i+1;
		if (b[i] % 3 == 0)f = true;
		if (b[i] % 5 == 0)f = true;
		if (!f)c += b[i];
	}
	cout << c;
}


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

int main() {
	int a, b, c;
	int ca=0, cb=0;
	while (scanf("%d, %d, %d", &a, &b, &c)+1) {
		if ((a*a) + (b*b) == c*c) { ca++; }

		if (a == b) { cb++; }
	}
	printf("%d\n%d\n", ca, cb);
	return 0;
}

Measured memory_bytes: 3196
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;


namespace atPra97a
{
    class Class1
    {
        static void Main()
        {
            int diff1, diff2, diff3;
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            int c = int.Parse(str[2]);
            int d = int.Parse(str[3]);

            diff1 = Math.Abs(a - b);
            diff2 = Math.Abs(b - c);
            diff3 = Math.Abs(c - a);

            if (diff1 <= d && diff2 <= d) Console.WriteLine("Yes");
            else if (diff3 <= d) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int N=52,M=(1<<18)|5;
int n,k,S,T;
int a[N],cnt[M],q[N];
ll f[N][N],ans;
void init(){
	For(i,1,M-1) cnt[i]=cnt[i/2]+(i&1);
	For(i,0,N-1) f[i][0]=1;
	For(i,1,N-1) For(j,1,i) f[i][j]=f[i-1][j]+f[i-1][j-1];
	For(i,0,N-1) For(j,2,N-1) f[i][j]+=f[i][j-1];
}
int main(){
	init();
	scanf("%d%d%d%d",&n,&k,&S,&T);
	For(i,1,n){
		scanf("%d",&a[i]);
		if ((a[i]&S)!=S||(a[i]|T)!=T)
			--i,--n;
	}
	if ((S&T)!=S||(S|T)!=T)
		return puts("0"),0;
	//cout<<233<<endl;
	T-=S;
	For(i,1,n) a[i]-=S;
	For(i,0,T) if ((T&i)==i){
		For(j,1,n) q[j]=a[j]&i;
		sort(q+1,q+n+1);
		int s=1;
		For(j,2,n+1)
			if (j==n+1||q[j]!=q[j-1])
				ans+=f[s][k]*(cnt[i]&1?-1:1),s=1;
			else ++s;
	}
	cout<<ans<<endl;
} 

Measured memory_bytes: 4804
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scan =new Scanner(System.in);
        int n = scan.nextInt();
        int[] A = new int[n];
        for(int i=0;i<n;i++){
            A[i]= scan.nextInt();
        }
        for(int i=n-1;i>=0;i--){
            System.out.printf("%d",A[i]);
            if(i!=0)System.out.printf(" ");
        }
        System.out.printf("\n");
    }
}


Measured memory_bytes: 26284
n,k,q = (int(i) for i in input().split())
A = []
for _ in range(q): A.append(int(input()))
P = [q for _ in range(n)]

for a in A:
    P[a-1] -= 1

for p in P:
    if k-p <= 0: print('No')
    else: print('Yes')


Measured memory_bytes: 10456
import * as fs from 'fs';

namespace AtCoder.abc092 {

    export class Program {
        args: string;

        constructor(args: string) {
            this.args = args;
        }

        /**
         * in
         *
         * out
         *
         */
        main(this: Program): void {
            const [a, b, c, d]: number[] = this.args.split('\n').map(Number);

            console.log(Math.min(a, b) + Math.min(c, d));
        }
    }
}

const args = fs.readFileSync('/dev/stdin', 'utf8').trim();
const prg = new AtCoder.abc092.Program(args);
prg.main();


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vl vector<ll>
#define pl pair<ll,ll>
#define TC int t;cin>>t;while(t--)
#define in(n) ll n;cin>>n;
#define inarr(n) ll n;cin>>n;vector<ll>arr;
int main(void){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    inarr(n);in(k);
    for(int i=0;i<n;i++){
        in(temp);arr.push_back(temp);
    }
    for(int i=k;i<n;i++){
        if(arr[i]>arr[i-k])
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 5312
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << a + b + c - max({a, b, c}) << endl;
    return 0;
}


Measured memory_bytes: 256
import heapq
n,m=map(int, input().split())
s = [list(map(int, input().split())) for i in range(n)]
q = []
ans=0
#ヒープソート
heapq.heapify(s)
for k in range(m-1,-1,-1):
    for i in range(n):
        if len(s)!=0:
            #最小値を返す
            p=heapq.heappop(s)
            if p[0]+k<=m:
                #heappush(list,item) listの葉にitemを追加して小さい要素を上に持ち上げる
                heapq.heappush(q,-p[1])
            else:
                heapq.heappush(s,p)
                break
        else:
            break
    if len(q)!=0:
            #最小値をヒープから取り出す
        p=heapq.heappop(q)
        ans += -p
print(ans)

Measured memory_bytes: 27880
#include <stdio.h>

#define X_MAX 1000000000
#define T_MAX 1000000000

int main(void)
{
	long int x, t;
	scanf("%ld %ld%*c", &x, &t);

	if(x <= t) {
		printf("0\n");
	}
	else {
		printf("%ld\n", x - t);
	}

	return 0;
}


Measured memory_bytes: 128
def main():
    N = int(input())
    p_list = [list(map(int, input().split())) for i in range(N)]

    z_list = []
    w_list = []
    for i in range(N):
        x = p_list[i][0]
        y = p_list[i][1]
        z_list.append(x + y)
        w_list.append(x - y)
    ans = max(max(z_list) - min(z_list), max(w_list) - min(w_list))
    print(ans)
    return


if __name__ == '__main__':
    main()

Measured memory_bytes: 61240
#include <iostream>

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

	if (a < b) {
		std::cout << "a < b" << std::endl;
	}
	else if (a == b) {
		std::cout << "a == b" << std::endl;
	}
	else {
		std::cout << "a > b" << std::endl;
	}

	return 0;
}


Measured memory_bytes: 3096
using System;
using System.Collections.Generic;
using System.Text;

class Program
{
	static void Main(string[] args)
	{
		string[] input = Read();
		int n = int.Parse(input[0]);
		string[] result = new string[]{"AC","WA","TLE","RE"};
		int[] count = new int[4];
		for(int i=0; i<n; i++)
		{
			string s = Read()[0];
			for(int j=0;j<4; j++)
			{
				if(s.Equals(result[j])) count[j]++;
			}
		}

		for(int i=0; i<4; i++) Write(result[i] + " x " + count[i]);
	}

	static string[] Read()
	{
		return Console.ReadLine().Split(' ');
	}

	static void Write(object o)
	{
		Console.WriteLine(o.ToString());
	}
}



Measured memory_bytes: 33820
#include<bits/stdc++.h>
using namespace std;
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define dbg(x) cerr<<#x" = "<<x<<endl
#define rep(i,a,b) for(register int i=(a),i##_end=(b);i<=i##_end;++i)
#define per(i,a,b) for(register int i=(a),i##_st=(b);i>=i##_st;--i)
#define rpg(i,x) for(register int i=fir[x];i;i=e[i].nxt)
#define ull unsigned long long
#define fi first
#define se second
#define pb push_back
#define bin(i) (1<<i)
#define cla(x) memset(x,0,sizeof x)
#define meminf(x) memset(x,127,sizeof x)
typedef pair<int,int> pa;
typedef long long LL;
const int INF = 0x7fffffff;
const int oo = 0x3f3f3f3f;
const int L = 100000;
char ibuf[L],*ih=ibuf+L;
inline char gc(){return (ih==ibuf+L?fread(ibuf,1,L,stdin),ih=ibuf:0),*ih++;}
//#define  getchar() gc()
template<typename T>
inline void rd(T &x)
{
    x = 0 ; int f = 1; char CH = getchar();
    while(CH<'0'||CH>'9') {if(CH=='-')f=0;CH=getchar();}
    while(CH>='0'&&CH<='9') {x=(x<<3)+(x<<1)+(CH-48);CH=getchar();}
    x = f ? x : -x;	return;
}
int main()
{
	const int MXN = 1e5 + 5; bool flg1=false,flg2=false; int cnt=0;
	char s[MXN];scanf("%s",s);int a[MXN],n=strlen(s); int ll,rr; rr=n; ll=1; 
	for(int i=(n>>1)+(n&1);i<n;++i)
	if(s[i]!=s[n-i-1]||s[i]!=s[i-1]) return printf("%d\n",i),0;
	cout<<n;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

struct Spell
{
	int power;
	int cost;
};

int h, n;
Spell sp[1010];
int f[10010];	//当前耗费 


int main()
{
	scanf("%d%d", &h, &n);
	
	for (int i = 0 ; i < n ; i++)
		scanf("%d%d", &(sp[i].power), &(sp[i].cost));
		
	f[0] = 0;
	
	for (int i = 1 ; i <= h ; i++) {
		f[i] = -1;
		int curCost;
		for (int j = 0 ; j < n ; j++) {
			int curPower = i - sp[j].power;
			if (curPower < 0)
				curPower = 0;	//0
				
			curCost = f[curPower] + sp[j].cost;
			if ((f[i] == -1) || (f[i] > curCost))
				f[i] = curCost;
		}
	}
	
	printf("%d\n", f[h]);
	
	
	return 0;
}



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

int main(void) {
    int N;
    set<int> D;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int d;
        cin >> d;
        D.insert(d);
    }
    cout << D.size() << endl;
}

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

int main(void){
    int N;
    std::string ans = "No";
    std::vector<int> A(9);
    std::vector<int> num(101, 1);
    std::vector<std::vector<int>> C = {
        {0, 1, 2},
        {3, 4, 5},
        {6, 7, 8},
        {0, 3, 6},
        {1, 4, 7},
        {2, 5, 8},
        {0, 4, 8},
        {2, 4, 6},
    };

    for (int i=0; i<9; ++i){
        std::cin >> A.at(i);
    }

    std::cin >> N;
    for (int i=0; i<N; ++i){
        int b;
        std::cin >> b;
        --num.at(b);
    }

    for (std::vector<int> c: C){
        if (num.at(A.at(c.at(0))) == 0 && num.at(A.at(c.at(1))) == 0 && num.at(A.at(c.at(2))) == 0){
            ans = "Yes";
            break;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> ls(n);
    int l_sum = 0;
    for (auto& l : ls) {
        cin >> l;
        l_sum += l;
    }
    for (auto& l : ls) {
        if (2*l >= l_sum) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256