akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, y;
    cin >> n >> y;
    y /= 1000;
    for(int i = 0; i <= n; ++i){
        for(int j = 0; j <= n; ++j){
            int k = n - i - j;
            if(i+j+k != n) continue;
            if(k < 0) continue;
            int yen = 10*i + 5*j + k;
            if(yen == y){
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}


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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  for (ll i = 0; i < N; i++) {
    ll a; cin >> a;
    if (a % 2 == 1) continue;
    if (a % 3 == 0) continue;
    if (a % 5 == 0) continue;
    cout << "DENIED\n";
    return 0;
  }
  cout << "APPROVED\n";

  return 0;
}



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

using namespace std;

#define pb push_back
#define pp pop_back
#define mp make_pair
#define F first
#define S second
#define xmax(x,y) ((x) = max((x),(y)))
#define xmin(x,y) ((x) = min((x),(y)))
#define all(x) (x).begin(),(x).end()
#define mem(x) memset(x , 0 , sizeof(x))
#define _ ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define FP(a , b , c)  for(ll (a) = (b) ; (a) < (c) ; (a++));
#define FM(a , b , c)  for(ll (a) = (b) ; (a) >= (c) ; (a--));
#define connect(a , b , c) a[b].pb(c) , a[c].pb(b)

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

const ll Maxn3 = 1e3 + 10;
const ll Maxn4 = 1e4 + 10;
const ll Maxn5 = 1e5 + 10;
const ll Maxn6 = 1e6 + 10;
const ll Maxn7 = 1e7 + 10;
const ll Maxn8 = 1e8 + 10;
const ll Maxn9 = 1e9 + 10;
const ll Maxn18 = 1e18 + 10;
const ll Mod1 = 1e7 + 7;
const ll Mod2 = 1e9 + 7;
const ll LLMax = LLONG_MAX;
const ll LLMin  = LLONG_MIN;
const ll INTMax = INT_MAX;
const ll INTMin  = INT_MIN;

ll mn = LLMax , mx = LLMin;
bool mark[3];
int main()
{_
    string s; cin >> s;
    for(ll i = 0 ; i < s.size() ; i++)
    {
        if(s[i] == 'a')
            mark[0] = 1;
        if(s[i] == 'b')
            mark[1] = 1;
        if(s[i] == 'c')
            mark[2] = 1;
    }
    return cout << (mark[0] and mark[1] and mark[2] ? "Yes" : "No") , 0;
}
///SAliB


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

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		while(in.hasNextInt()){
			int n=in.nextInt(),sum=0;
			for(int i=n;i<600;i+=n)sum+=i*i*n;
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 11000
import std.stdio, std.conv, std.string, std.array, std.algorithm, std.math;

void main()
{
    auto ns = readln.chomp;
    auto ret = ns.count;
    auto n = ns.to!ulong;

    for (ulong a = 2; a^^2 <= n; ++a) {
        if (n%a) continue;

        auto b = n/a;
        int i = 1;
        for (; b > 9; ++i) b /= 10;

        if (i < ret) ret = i;
    }

    writeln(ret);
}

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

int main(){
int n;
cin >> n;
vector<int> a(n);
for(int i = 0; i< n;i++)cin >> a[i];
double ans = 0.0;
for(int i = 0; i< n;i++)ans += (double)(1.0 / a[i]);
ans =  (double)(1.0 / ans);
printf("%.10f\n",ans);
return 0;
}

Measured memory_bytes: 3744
package main

import "fmt"

func main()  {
	var W, H, x, y float64
	fmt.Scan(&W, &H, &x, &y)
	fmt.Printf("%f ", W*H/2)

	if W/2 == x && H/2 == y {
		fmt.Println(1)
	} else {
		fmt.Println(0)
	}
}

Measured memory_bytes: 512
A, B, C, K = map(int, input().split())

count = 0

if K >= A:
    count += A
    K -= A
else:
    count = K
    K = 0

if K != 0:
    if K>=B:
        K -= B
    else:
        K= 0
if K != 0:
    count -= K

print(count)

Measured memory_bytes: 9184
inputted = list(map(int, input().split()))
N = inputted[0]
M = inputted[1]

LR = [list(map(int, input().split())) for i in range(M)]

left = 0
right = N
for LRi in LR:
    left = max(left, LRi[0])
    right = min(right, LRi[1])

    if left > right: break
    
answer = max(0, right - left + 1)
print(answer)


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

int main(){
    string w;
    bool ans=true;
    int n=1;
    cin >> w;
    sort(w.begin(), w.end());
    for (int i = 1; i < w.size(); i++) {
        if (w[i-1] != w[i] & n%2!=0) {
                ans=false;
                n = 0;
        }
        n += 1;
    }
    if (n%2!=0) ans=false;
    if (ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
const ll mod=1e9+7;

int main(){
  int x;
  cin>>x;
  if(x>=30) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

using namespace std;

class Date{
    public:
  int year, month, day;
  Date( int year=0, int month=0, int day=0 ): year(year), month(month), day(day){}

    bool operator < ( const Date &date ) const{
	if ( year < date.year ){
	    return true;
	} else if ( year == date.year ) {
	    if ( month < date.month ){
		return true;
	    } else if ( month == date.month ){
		return ( day < date.day );
	    } else return false;
	} else return false;
    }

    bool operator == ( const Date &date ) const{
	return ( year == date.year && month == date.month && day == date.day);
    }

    void print( string prefix, int jyear ){
      cout << prefix << " " << jyear << " " << month << " " << day << endl;
    }
};

static Date meijiLow = Date( 1868, 9, 8 );
static Date meijiUpper = Date( 1912, 7, 29 );
static Date taishoLow = Date( 1912, 7, 30 );
static Date taishoUpper = Date( 1926, 12, 24 );
static Date showaLow = Date(1926, 12, 25 );
static Date showaUpper = Date(1989, 1, 7);
static Date heiseiLow = Date( 1989, 1, 8 );


main(){
    int year, month , day; 
    while( cin >> year >> month >> day ){
      Date date = Date( year, month, day );
      if ( date < meijiLow ) {
	cout << "pre-meiji" << endl;
      } else if ( date == meijiLow || date == meijiUpper ||
		  meijiLow < date && date < meijiUpper ) {
	date.print("meiji", year - meijiLow.year + 1 );
      } else if ( date == taishoLow || date == taishoUpper ||
		  taishoLow < date && date < taishoUpper ){
	date.print("taisho", year - taishoLow.year + 1 );
      } else if ( date == showaLow || date == showaUpper ||
		  showaLow < date && date < showaUpper ){
	date.print("showa", year - showaLow.year + 1 );
      }else{
	date.print("heisei", year - heiseiLow.year + 1 );
      }
    }
}

Measured memory_bytes: 0
# 最大公約数なきがするけど。
def gcd(n, m):
    # 最大公約数
    a = max(n,m)
    b = min(n,m)
    while b:
        a, b = b, a % b
    return a

N, X = map(int,input().split())
xs = [int(i) for i in input().split()]

xs.append(X)
xs = sorted(xs)
if len(xs) == 2:
    print(abs(xs[0]-xs[1]))
else:
    diffs = [xs[i]-xs[i-1] for i in range(1,len(xs))] #差を取る
    gcd_min = gcd(diffs[0],diffs[1])
    for i in range(2,len(diffs)):
        gcd_min = gcd(gcd_min, diffs[i])

    print(gcd_min)

Measured memory_bytes: 14480
#include <iostream>
#include <vector>
#include <algorithm>
#include <initializer_list>

using lli=long long int;

int mod;

template<size_t N>
class matN{
  public:
  lli m[N][N] = {};
  matN(){}
  matN(std::initializer_list<lli> init){
    auto it = init.begin();
    for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        m[i][j] = (((*it)%mod)+mod)%mod;
        ++it;
      }
    }
  }
};

template<size_t N>
const matN<N> operator*(const matN<N>& lhs, const matN<N>& rhs){
  matN<N> ans;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      for(int k = 0; k < N; k++){
        ans.m[i][j] += lhs.m[i][k]*rhs.m[k][j];
        ans.m[i][j] %= mod;
      }
    }
  }
  return ans;
}

int main(){
  lli L,A,B;
  std::cin >> L >> A >> B >> mod;

  std::vector<lli> ns_d(1);
  lli tmp = 9;
  while(A+B*(L-1)>tmp){
    if(A>tmp){
      ns_d.push_back(0);
    }else{
      ns_d.push_back((tmp-A)/B+1);
    }
    tmp = tmp*10+9;
  }
  ns_d.push_back(L);

  matN<3> mat_total = {1,0,0,0,1,0,0,0,1};
  for(int i = 1; i < ns_d.size(); i++){
    lli ipow = 1;
    for(int j = 0; j < i; j++){
      ipow = (ipow*10)%mod;
    }
    lli isize = ns_d[i]-ns_d[i-1];
    matN<3> mat_last = {ipow,1,0,0,1,B,0,0,1};
    int nb = 0;
    while((isize>>nb)!=0){
      if((isize>>nb)&1){
        mat_total = mat_last*mat_total;
      }
      mat_last = mat_last*mat_last;
      nb++;
    }
  }

  lli ans = ((mat_total.m[0][1]*(A%mod))%mod+mat_total.m[0][2])%mod;
  std::cout << ans << std::endl;

  return 0;
}



Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int bit = 0;
	for(int i = 0; i < n; i++) {
	    bit |= sc.nextInt();
	}
	System.out.println(Integer.numberOfTrailingZeros(bit));
    }
}


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

int main(){
  	ios_base::sync_with_stdio(0);
  	cin.tie(NULL);
	int n,k;
  	cin>>n>>k;
  	vector<int>a(n);
  	for(int& x:a) cin>>x;
  	sort(a.begin(),a.end());
  	long long ans=0;
  	for(int i = 0;i<n-k;i++){
    	ans+=a[i];
    }
  	cout<<ans;
}

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

#define PI 3.14159265

using namespace std;

void func_A() {

    double r;
    cin >> r;

    cout << 2 * PI * r;
}

void func_B() {

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

    for (int i = 0; i < m; ++i) {
        n -= a[i];
        if (n < 0) {
            cout << -1;
            return;
        }
    }

    cout << n;
}

void func_C() {

}

int main() {

    //func_A();
    func_B();
    //func_C();

    return 0;
}


Measured memory_bytes: 3704
/**
 * author: said_v15
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <__msvc_all_public_headers.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
 
typedef long long  ll;

#define press_F_to_pay_respect ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn for(int i=0;i<n;i++) 
#define fore(i,a,b) for(int i = a; i < (b); i++)
#define pb push_back 
#define pob pop_back()
#define mp make_pair 
#define sc second 
#define f first 
#define th third
#define ld long double
#define kek cout<<"\n"; 
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(v) ((v).begin()), ((v).end()) 
#define halt {cout<<"NO"; return 0;}


const ll MOD = 1e9 + 7;
const ll MOD1 = 998244353;
const int MAXN = 1000100;
const int INF = 1e8;
const ll LL_INF=1e10;
const double pi=3.1415926535;
using namespace std;
int divide(int a, int b)
{
          return (a+b-1)/b;
}

int main()
{
    #if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
    #endif
 press_F_to_pay_respect;
 // cout << fixed << setprecision(12) << ans;
 // string al = "abcdefghijklmnopqrstuvwxyz";
 int questions=1;
// cin>>questions;
 while(questions--)
 {
  int x;
  cin>>x;
  cout<<!x;
    
       
 }
 
 
 // !!! LOOK AT NUMBER OF QUESTIONS IN A PROBLEM !!! (cin>>questions)
 

  // cout <<"Runtime is:"<<clock() * 1.0 / CLOCKS_PER_SEC <<endl;
   return 0;
   
}

Measured memory_bytes: 3644
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] tmp = Console.ReadLine().Split();
            int[] array = tmp.Select(int.Parse).ToArray();

            int count = 0;

            for(int i=0; i<array.Length-2;i++)
            {
                if(array[i] < array[i + 1] && array[i + 1] < array[i + 2])
                {
                    count++;
                }
                else if(array[i] > array[i + 1] && array[i + 1] > array[i + 2])
                {
                    count++;
                }
            }

            Console.WriteLine(count);

            
        }
    }
}


Measured memory_bytes: 13268
import sys

def main():
  input = sys.stdin.readline
  n = int(input())
  l = [int(a) for a in input().split()]
  m = max(l)
  s = sum(l) - m
  if s > m:
    print('Yes')
  else:
    print('No')


if __name__ == '__main__':
  main()

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

using i64 = int_fast64_t;
using f64 = double;

void solve() {
    i64 n, a, b;
    cin >> n >> a >> b;
    i64 d = b - a;
    cout << (d % 2 == 0 ? d / 2 : min(n - b, a - 1) + (d + 1) / 2) << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
using namespace std;

int main() {
  string s;
  cin >> s;
  
  if (s[0] == s[1] && s[1] == s[2]) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 3600
N = gets.to_i
A = 2.times.map{[0] + gets.split.map(&:to_i)}
N.times{|i|
    A[0][i+1] += A[0][i]
    A[1][i+1] += A[1][i]
}
ans = 0
1.upto(N){|i|
    ans = [ans, A[0][i] + A[1][N] - A[1][i-1]].max
}
puts ans

Measured memory_bytes: 1788
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char s[200001][11];
int a[200000];
int cmpstr(const void* a, const void* b) { return strcmp((char*)a, (char*)b); }
int main() {
	int n, max = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", s[i]);
	}
	qsort(s, n, sizeof(s[0]), cmpstr);
	for (int i = 0; i < n; i++) {
		if (strcmp(s[i], s[i + 1]) == 0) {
			a[i]++;
			a[i + 1] = a[i] + 1;
		}
	}
	for (int i = 0; i < n; i++) {
		if (a[i] > max) max = a[i];
	}
	for (int i = 0; i <= n; i++) {
		if (a[i] == max) printf("%s\n", s[i]);
	}
	return 0;
}


Measured memory_bytes: 4476
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1L<<60
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define int long long 
int n,w;
vector<vector<pair<int,int> > >  g;
vector<int> nex;
vector<int>  dep;
vector<ll> p;
ll cost[200][200];
int dfsssss(int id,int pre){
    int mx = 0;
    for(auto x:g[id]){
        if(x.first !=pre){
            int k = dfsssss(x.first,id);
            k++;
            if(mx < k){
                nex[id] = x.first;
                mx = max(k,mx);
            }
        }
    }
    return dep[id] = mx;
}

vector<ll> ans;

void dfs(int id,int pre,vector<ll>&dp,vector<ll> &dp2,bool flag){
    // dpは更新する奴  dp2は今の状態
    if(!flag){//連結いらない 
        vector<ll> dp3(w+1,-inf);
        dp3[0] = p[id];
        if(pre!=-1&&nex[pre]==id){
            for(int i=cost[id][pre];i<=w;i++){
                dp3[i] = dp2[i-cost[id][pre]] + p[id];
            }
        }
        for(auto x:g[id]){
            if(x.first == pre)continue;
            if(x.first == nex[id])continue; 
            vector<ll> dp4(w+1,-inf);
            dfs(x.first,id,dp4,dp4,0);
            dfs(x.first,id,dp3,dp3,1);
        }
        // cerr << id << endl;
        // rep(i,w+1){
        //     cerr << dp[i] << endl;
        // }
        rep(i,w+1){
            ans[i] = max(ans[i],dp3[i]);
        }
        if(nex[id]!=-1){
            dfs(nex[id],id,dp3,dp3,0);
        }
    }else{//連結
        vector<ll> dp3(w+1,-inf);
        for(int i=w;i>=cost[id][pre];i--){
            dp3[i] = dp2[i-cost[id][pre]] + p[id];
        }
        // rep(i,w+1){
        //     dp[i] = max(dp[i],dp3[i]);
        // }
        
        for(auto x:g[id]){
            if(x.first == pre)continue;
            vector<ll> dp4 = dp3;
            if(x.first!=nex[id])dfs(x.first,id,dp3,dp4,1);
        }
        rep(i,w+1){
            dp[i] = max(dp[i],dp3[i]);
        }
        if(nex[id]!=-1){
            dfs(nex[id],id,dp,dp3,1);
        }
    }
}

signed main(){
    
    cin >> n >> w;
    p.resize(n);
    rep(i,n)cin >> p[i];
    g.resize(n);
    dep.resize(n);
    ans.resize(w+1);
    nex.resize(n,-1);
    rep(i,n-1){
        int u,v;
        int c;
        cin >> u >> v >> c;
        u--;v--;
        g[u].push_back(MP(v,c));
        g[v].push_back(MP(u,c));
        cost[u][v] = c;
        cost[v][u] = c;
    }
    dfsssss(0,-1);
    vector<ll> dp(w+1,-inf);
    //rep(i,n)cerr << nex[i] << endl;
    dp[0] = 0;
    dfs(0,-1,dp,dp,0);
    ll ma = 0;
    rep(i,w+1){
        ma = max(ma,ans[i]);
    }
    cout << ma << endl;
    return 0;
}


Measured memory_bytes: 63188
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
#define maxn 25000010
#define ll long long
#define ull unsigned long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define pii pair<int, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define IL inline
#define ss system
using namespace std;

int a[3], b[3];
ll f[maxn], n;
template <class T> void read(T &x) {
  char ch = x = 0;
  bool fl = false;
  while (!isdigit(ch))
    fl |= ch == '-', ch = getchar();
  while (isdigit(ch))
    x = x * 10 + ch - '0', ch = getchar();
  x = fl ? -x : x;
}
int main() {
  cin >> n;
  for (int i = 0; i < 3; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 3; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < 3; i++) {
    if (a[i] < b[i]) {
      for (int j = a[i]; j <= n; j++) {
        f[j] = max(f[j], f[j - a[i]] + b[i]);
      }
    }
  }
  ll tmp = n;
  for (int i = n; i; i--) {
    n = max(n, tmp - i + f[i]);
  }
  memset(f, 0, sizeof(f));
  for (int i = 0; i < 3; i++) {
    if (b[i] < a[i]) {
      for (int j = b[i]; j <= n; j++) {
        f[j] = max(f[j], f[j - b[i]] + a[i]);
      }
    }
  }
  tmp = n;
  for (int i = n; i; i--) {
    n = max(n, tmp - i + f[i]);
  }
  cout << n << endl;
  return 0;
}

Measured memory_bytes: 195584
n = list(str(input()))


if n[-1] == '2' or n[-1] == '4' or n[-1] == '5' or n[-1] == '7' or n[-1] == '9':
    print('hon')
elif n[-1] == '0' or n[-1] == '1' or n[-1] == '6' or n[-1] == '8':
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9128
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;
typedef long long ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

void Main() {
  Cin(int, s);
  auto f = [](int n) {
    if (n % 2 == 0)
      return n / 2;
    else
      return 3 * n + 1;
  };
  set<int> si;
  si.insert(s);
  for(int i=2;;++i){
    s=f(s);
    if(si.count(s)){
      cout<<i<<endl;
      return;
    }
    si.insert(s);
  }
}

int main() {
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    int A,B,K;cin>>A>>B>>K;
    for(int i=min(A,B);i>=1;i--){
        if(A%i==0 && B%i==0){
            K--;
            if(K==0){
                cout<<i<<endl;return 0;
            }
        }
    }
}

Measured memory_bytes: 3624
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
over = 0
rate = set()
for x in a:
    if 399>=x>=1:
        rate.add(1)
    elif 799>=x>=400:
        rate.add(2)
    elif 1199>=x>=800:
        rate.add(3)
    elif 1599>=x>=1200:
        rate.add(4)
    elif 1999>=x>=1600:
        rate.add(5)
    elif 2399>=x>=2000:
        rate.add(6)
    elif 2799>=x>=2400:
        rate.add(7)
    elif 3199>=x>=2800:
        rate.add(8)
    else:
        over += 1

if len(rate)>0:
    print(len(rate),len(rate)+over)
else:
    print(1,over)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(all(a));
    int ans = a[1] - a[0];
    ans = ans + a[2] - a[1];
    cout << ans << '\n';
}

int main(void){ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    //int t; cin >> t; while (t--)
        solve();
}

Measured memory_bytes: 3616
#include<iostream>
#include<queue>
using namespace std;
struct Puzzle { char p[10][10]; };
queue<pair<Puzzle, int>>Q;
queue<pair<int, int> >Q2;
int blute_force(int h, int w, Puzzle x) {
	while (!Q.empty())Q.pop();
	Q.push(make_pair(x, 0));
	while (true) {
		Puzzle y = Q.front().first; int V = Q.front().second; Q.pop();
		int a[3] = { 0,0,0 };
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (y.p[i][j] == 'R')a[0]++;
				if (y.p[i][j] == 'G')a[1]++;
				if (y.p[i][j] == 'B')a[2]++;
			}
		}
		if (a[0] == h*w || a[1] == h*w || a[2] == h*w)return V;
		char F[3] = { 'R','G','B' };
		for (int i = 0; i < 3; i++) {
			if (F[i] == y.p[0][0])continue;
			int dx[4] = { 0,1,0,-1 };
			int dy[4] = { 1,0,-1,0 };
			Puzzle v = y; Q2.push(make_pair(0, 0)); v.p[0][0] = F[i];
			while (!Q2.empty()) {
				int cx = Q2.front().first, cy = Q2.front().second; Q2.pop();
				for (int j = 0; j < 4; j++) {
					int ex = cx + dx[j], ey = cy + dy[j];
					if (ex < 0 || ey < 0 || ex >= h || ey >= w)continue;
					if (y.p[ex][ey] == y.p[0][0] && v.p[ex][ey] == y.p[ex][ey]) {
						Q2.push(make_pair(ex, ey)); v.p[ex][ey] = F[i];
					}
				}
			}
			Q.push(make_pair(v, V + 1));
		}
	}
}
int main() {
	while (true) {
		Puzzle x; int H, W; cin >> W >> H;
		if (W + H == 0)break;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cin >> x.p[i][j];
			}
		}
		cout << blute_force(H, W, x) << endl;
	}
	return 0;
}

Measured memory_bytes: 29588
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>


int main()
{
    double p1[2], p2[2];
    scanf("%lf %lf %lf %lf", &p1[0], &p1[1], &p2[0], &p2[1]);
    double diff = (p1[0]-p2[0])*(p1[0]-p2[0]) + (p1[1]-p2[1])*(p1[1]-p2[1]);

    printf("%lf\n", sqrt(diff));

    return 0;
}


Measured memory_bytes: 2036
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(e,r){e.exports=function(e){for(var r=Number(e[0]),t=e[1].split(" ").map(function(e){return Number(e)}),n=new Array(r+1).fill(0),o=1;o<r+1;o++)n[o]=n[o-1]+t[o-1];n.sort(function(e,r){return e-r});for(var u=0,i=1,f=0;f<r+1;f++)f==r||n[f]!=n[f+1]?(i>=2&&(u+=i*(i-1)/2),i=1):i++;console.log(u)}},function(e,r){e.exports=require("fs")}]);

Measured memory_bytes: 40568
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for (int i=(a);i<=(b);i++)
#define per(i,a,b) for (int i=(a);i>=(b);i--)
#define Rep(i,a,b) for (int i=(a);i<(b);i++)
#define Per(i,a,b) for (int i=(a);i>(b);i--)
void read(int &x){
    x=0;int f=1;char ch=getchar();
    while ((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if (ch=='-')f=-1,ch=getchar();
    while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    x*=f;
}

#define maxn 1000005
int n,ans;
char s[maxn],t[maxn];int rch[maxn];
vector<pi>que;
int find(int L,int R){
    //printf("find %d\n",R+1);
    int now=R+1;
    while (L<=R){
        int mid=(L+R)>>1;
        //printf("%d %d %d\n",L,R,mid);
        if (que[mid].fi-(now-mid)>=que[now].se)L=mid+1;
        else R=mid-1;
    }
    return now-R;
}
bool check(){rep(i,1,n)if (s[i]!=t[i])return false;return true;}
int main(){
    read(n);scanf("%s",s+1);scanf("%s",t+1);
    if (check()){printf("0\n");return 0;}
    int lst=n,i=n;que.pb(mp(lst+1,i+1));
    while (i>0){
        while (i>1&&t[i]==t[i-1])i--;lst=min(lst,i);
        while (lst>=1&&s[lst]!=t[i])lst--;
        if (lst==0){printf("-1\n");return 0;}
        que.pb(mp(lst,i));i--;lst--;
    }
    //Rep(i,0,que.size())printf("%d %d\n",que[i].fi,que[i].se);
    
    Rep(i,1,que.size()){
        if (que[i].fi==que[i].se)rch[i]=0;
        else rch[i]=find(0,i-1);
    }
    // Rep(i,0,que.size())printf("%d ",rch[i]);printf("\n");
    
    Rep(i,1,que.size())ans=max(max(rch[i-1],rch[i])+1,ans);
    printf("%d\n",ans);return 0;
}


Measured memory_bytes: 14444
#include <iostream>

using namespace std;

int main() {
    int N;

    cin >> N;

    long long int mod = 1000000000 + 7;
    long long int result = 1;
    long long int result1 = 1;
    long long int result2 = 1;
    for (int i = 0; i < N; i++) {
        result *= 10;
        result = result % mod;
        result1 *= 9;
        result1 = result1 % mod;
        result2 *= 8;
        result2 = result2 % mod;
    }

    result = (result - 2 * result1 + result2) % mod;
    
    if (result < 0) {
        result += mod;
    }

    if (result < 0) {
        result += mod;
    }

    cout << result << endl;

    return 0;
}

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

//a[n]=a[n-1]+a[n-2]+a[n-3]を求める関数

int f(int n){  //再帰関数
    if(n==1) return 1;
    if(n==2) return 2;
    if(n==3) return 4;
    //f(n)=f(n-1)+f(n-2)+f(n+3);
    return f(n-1)+f(n-2)+f(n-3);
}

int main(void){
    while(true){
        int n;
        cin >> n;
        if(n==0)break;
        cout << (f(n)/3650)+1 << endl;
    }
}


Measured memory_bytes: 2980
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;
int fast_mod(const int input, const int ceil);

int fast_mod(const int input, const int ceil) {
    // apply the modulo operator only when needed
    // (i.e. when the input is greater than the ceiling)
    return input >= ceil ? input % ceil : input;
    // NB: the assumption here is that the numbers are positive
}
int main()
{
    long t,s,j,i,cnt=0,l=1,k=1;
    bool flag=false;
 cin>>t;
    vector <long> v;

    for(j=0;j<t;j++){
       cin>>s;
       v.push_back(s);

    }
     //sort(v.begin(), v.end());
     long maxe=*max_element(v.begin(), v.end());
     long temp[maxe+1]={0};
     long image[maxe+1]={0};

     for(j=0;j<v.size();j++){
            l=3;
            k=v.at(j);
            //cout<<k<<" "<<temp[k];
            if(temp[k]==1)
            {
                cnt=cnt+2;
                image[k]=1;
                temp[k]=2;
                //cout<<" "<<cnt<<" "<<maxe<<" ";
            }
            else if(temp[k]==0)
            {

                 //cout<<" "<<cnt<<" "<<maxe<<" a";
                if(image[k]==1)
                 cnt++;

                   else
                {
                    temp[k]=1;
                    //image[k]=1;
                }
                //cout<<cnt<<" 2";
            }
            else
            {
              //   cout<<" "<<cnt<<" "<<maxe<<" b";
              if(image[k]==1)
                 cnt++;
            }


            k=v.at(j)*2;

           while(k<=maxe)
           {
               //if(v.at(j)==2)
               //cout<<k<<" "<<temp[k];
               if(temp[k]==1)
               {
                   cnt++;
                   temp[k]=0;
               }

               image[k]=1;
               k=v.at(j)*l;
               l++;
           }
            //cout<<v.size()<<" Upper";


     }

/*
         i=j+1;
         while(i<v.size())
         {
            //cout<<fast_mod(v.at(i),v.at(j));
            if(fast_mod(v.at(i),v.at(j))==0)
            {

                if(v.at(i)==v.at(j))
                flag=true;

                cnt++;
                //cout<<cnt;
                v.erase(v.begin()+i);
                //cout<<cnt<<" T";


            }
            else
                i++;

         }
         if(flag)
                {

                    cnt++;
                    //cout<<cnt<<" G";
                    flag=false;

                }


     }*/
     cout<<t-cnt;

}


Measured memory_bytes: 20588
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
    scanf("%d%d",&a,&b);
    if(a>0)
	  cout<<"Positive";
	  else if(b>=0)
	         puts("Zero");            
             else if((a&1)^(b&1))
			        puts("Positive"); 
                    else puts("Negative");
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

using Graph = std::vector<std::vector<int>>;
using WGraph = std::vector<std::vector<std::pair<int, long long>>>;
using ll = long long;
using namespace std;
 
int main() {
    int n = 0;
    cin >> n;
    vector<pair<int, int>> p(n);
    for (int i=0; i<n; i++) {
        cin >> p.at(i).first >> p.at(i).second;
    }
    double dis = 0;
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            dis += sqrt(pow(p.at(i).first - p.at(j).first, 2) + pow(p.at(i).second - p.at(j).second, 2));
        }
    }
    cout << fixed << setprecision(10);
    cout << dis / n << endl;
    return 0;
}


Measured memory_bytes: 256
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

T = input()

ans = T.replace('?', 'D')
print(ans)


Measured memory_bytes: 9416
using System;
class Program
{
  static void Main(string[] args)
  {
    string[] st = Console.ReadLine().Split(' ');
    int n = int.Parse(st[0]);
    int m = int.Parse(st[1]);

    int left = 1;
    int right = n;

    for (int i = 0; i < m; i++)
    {
      st = Console.ReadLine().Split(' ');
      int l = int.Parse(st[0]);
      int r = int.Parse(st[1]);

      if (left < l) left = l;
      if (right > r) right = r;
    }

    if (right < left) Console.WriteLine(0);
    else Console.WriteLine(right - left + 1);

    Console.ReadLine();
  }
}

Measured memory_bytes: 17224
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  int na, nb, m;
  cin >> na >> nb >> m;
  vector<int> a(na), b(nb);
  rep(i,na) cin >> a[i];
  rep(i,nb) cin >> b[i];
  vector<int> x(m), y(m), c(m);
  rep(i,m) cin >> x[i] >> y[i] >> c[i];
  rep(i,m) x[i]--, y[i]--;
  int ans = INF;
  rep(i,m) {
    ans = min(ans, a[x[i]] + b[y[i]] - c[i]);
  }
  sort(ALL(a));
  sort(ALL(b));
  ans = min(ans, a[0] + b[0]);
  cout << ans << endl;
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 5096
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";}

// #define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
typedef long long ll;
typedef double ld;
#define pll pair<ll,ll>
#define pii pair<int, int>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()
   
const ll Mod = 1e9 + 7;
int main(){
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
   int a , b; cin >> a >> b;
   if(a >= 13)
    cout << b << endl;
    else if(a >= 6 && a <= 12)
        cout << b/2 << endl;
    else 
    cout << 0 << endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    int N;
    cin >> N;
    int temp, B[200000];
    for(int i=0;i<N;i++){
        cin >> temp;
        B[i] = temp - (i+1);
    }
        
    
    // 中央値を求める    
    sort(B, B + N);   // 昇順ソート
    int b;
    b = B[N/2];
    // 和を求める
    ll ans = 0;
    for(int i=0;i<N;i++)
        ans += abs(B[i] - b);
        
    cout << ans << endl;
    return 0;
}

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

class UnionFind{
public:
    vector<ll>data;
    UnionFind(ll n):data(n,-1){}
    bool Union(ll a,ll b){
        a=root(a);b=root(b);
        if(a==b)return 1;
        if(data[a]>data[b])swap(a,b);
        data[a]+=data[b];
        data[b]=a;
        return 0;
    }
    bool Find(ll a,ll b){return root(a)==root(b);}
    ll root(ll a){return data[a]<0?a:root(data[a]);}
};

signed main(){
    ll h,w;
    cin>>h>>w;
    UnionFind uf(h*w);
    vector<string>s(h);
    for(auto&i:s)cin>>i;
    rep(i,h)rep(j,w){
        if(i+1<h&&s[i][j]!=s[i+1][j])uf.Union(i*w+j,(i+1)*w+j);
        if(j+1<w&&s[i][j]!=s[i][j+1])uf.Union(i*w+j,i*w+j+1);
    }
    vector<pair<ll,ll>>cnt(h*w);
    rep(i,h)rep(j,w){
        if(s[i][j]=='#')cnt[uf.root(i*w+j)].first++;
        else cnt[uf.root(i*w+j)].second++;
    }
    ll ans=0;
    rep(i,h*w)ans+=cnt[i].first*cnt[i].second;
    cout<<ans;
}


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

int main()
{
    int x;
    cin >> x;
    if (x < 1200)
    {
        cout << "ABC" << endl;
    }
    else
    {
        cout << "ARC" << endl;
    }
}

Measured memory_bytes: 256
import sys
import io, os
#input = sys.stdin.buffer.readline
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

n, m, Q = map(int, input().split())
C = [[0]*n for _ in range(n)]
for i in range(m):
    l, r = map(int, input().split())
    l, r = l-1, r-1
    C[l][r] += 1

s = [[0]*(n+1) for _ in range(n+1)]
for i in range(n):
    for j in range(n):
        s[i+1][j+1] = s[i+1][j] + s[i][j+1] - s[i][j] + C[i][j]

for i in range(Q):
    p, q = map(int, input().split())
    p, q = p-1, q-1
    ans = s[q+1][q+1]-s[q+1][p]-s[p][q+1]+s[p][p]
    print(ans)


Measured memory_bytes: 84108
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define li 100005
#define mp make_pair
#define lo long long 
#define pb push_back
#define inf 1000000000
#define md 1000000007
int n;
int main(){
	scanf("%d",&n);
	if(n==1) printf("Hello World");
	else{
		int a,b;
		cin>>a>>b;
		cout<<a+b<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
import sys;
Dic={'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,'m':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,'y':0,'z':0 }
while True:
	lit=sys.stdin.readline().rstrip().lower()
	if not lit: break
	for i in lit:
		if ord('a')<=ord(i)<=ord('z'):
			Dic[i]+=1
Key=Dic.keys()
Key.sort()
for key in Key:
	print key, ":" ,Dic[key]

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

int main() {
  long int a,v,b,w,t;
  cin >> a >> v ;
  cin >> b >> w ;
  cin >> t;
  string ans;
  long int k,m,n;
  k=v - w;
  m=a - b;
  n=b - a;
  if (a > b){
    if(k*t >= m){
      ans ="YES";
    }
    else{
      ans = "NO";
    }
  }
  else{
    if(k*t >= n){
      ans="YES";
    }
    else{
      ans="NO";
    }
  }
    cout << ans << endl;
}
      


Measured memory_bytes: 3624
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k = LI()
a = LI()
for i in range(k, n):
    if a[i] > a[i-k]:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 92376
#include <iostream>
#include <complex>
#include <vector>
#include <algorithm>
using namespace std;
typedef complex<double> Point;
 
int n;
int lx, ly, rx, ry;
 
double area(vector<Point> poly) {
    double ret = 0;
    for (int i = 0; i < n; i++) {
        int ni = (i + 1) % n;
        ret += poly[i].real() * poly[ni].imag() - poly[ni].real() * poly[i].imag();
    }
    ret /= 2;
    return ret;
}
 
int main() {
    int i;
     
    while (cin >> n) {
        if (n == 0) break;
         
        vector<Point> poly;
        for (i = 0; i < n; i++) {
            int x, y;
            cin >> x >> y;
            poly.push_back(Point((double)x, (double)y));
        }
         
        lx = ly = 50000;
        rx = ry = -50000;
        for (i = 0; i < 4; i++) {
            int x, y;
            cin >> x >> y;
            lx = min(lx, x);
            ly = min(ly, y);
            rx = max(rx, x);
            ry = max(ry, y);
        }
         
        vector<Point> poly2;
        for (i = 0; i < n; i++) {
            double x, y;
            x = min((double)rx, max((double)lx, poly[i].real()));
            y = min((double)ry, max((double)ly, poly[i].imag()));
            poly2.push_back(Point(x, y));
        }
         
        cout << (int)(area(poly) - area(poly2)) << endl;
    }
    return 0;
}


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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[n + 1];
		int[] b = new int[n + 1];
		int[] c = new int[m + 1];
		int[] d = new int[m + 1];
		for(int i = 1; i <= n; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}
		for(int i = 1; i <= m; i++) {
			c[i] = sc.nextInt();
			d[i] = sc.nextInt();
		}
		int min, op;
		for(int i = 1; i <= n; i++) {
			min = Math.abs(a[i] - c[1]) + Math.abs(b[i] - d[1]);
			op = 1;
			for(int j = 2; j <= m; j++) {
				if(min > Math.abs(a[i] - c[j]) + Math.abs(b[i] - d[j])) {
					min = Math.abs(a[i] - c[j]) + Math.abs(b[i] - d[j]);
					op = j;
				}
				
			}
			System.out.println(op);
		}
		
	}
}

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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif


int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	int n;
	cin >> n;
	int t, a;
	cin >> t >> a;
	int h[n];
	for(int i=0;i<n;i++)
	{
		cin >> h[i];
	}	
	vector<pair<double, int>> v(n);
	for(int i=0;i<n;i++)
	{
		v[i].first = abs(t - h[i]*0.006-a);
		v[i].second = i;
	}
	sort(v.begin(), v.end());
	cout << v[0].second+1 << "\n";
	return 0;
}

Measured memory_bytes: 256
let () = Scanf.scanf "%d\n" @@ fun n ->
    let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
    Array.sort (fun x y -> if x > y then 1 else if x < y then -1 else 0) as_;
    let max_num = 1000001 in
    let exists = Array.make (max_num + 1) 0 in
    let rec set_val m n =
        if m == 1 && (Array.get exists n) > 0 then
            if (Array.get exists n) == 2 then (
                Array.set exists n 1; -1;
            ) else 0
        else if m * n <= max_num then (
            Array.set exists (m * n) (if m > 1 then 1 else 2);
            set_val (m + 1) n;
        ) else 1 in

    Printf.printf "%d\n" @@ Array.fold_left (+) 0 @@ Array.map (set_val 1) as_ 



Measured memory_bytes: 17060
#include<iostream>
#include<iostream>
#include<string>
#include<sstream>
#include<vector>
#include<algorithm>
#include<math.h>
#include"boost/algorithm/string.hpp"

using namespace std;


typedef struct{
	long param;//座標
	long delta;//次の値との差分
}mass;

int main(){

	int n, m;
	int love[30] = {0};

	cin >> n >> m;	

	int ret[30]={0};

	int ans = m;

	for (int i = 0; i < m; ++i){
		ret[i] = 1;
	}


	int k = 0;
	int in = 0;
	//全員分集計
	for (int i = 0; i < n; ++i){
		cin >> k;//個数
		memset(love, 0, sizeof(int) * 30);
		for (int j = 0; j < k; ++j){
			cin >> in;
			love[in-1] = 1;
		}

		//除算
		for (int j = 0; j < m; ++j){
			if (love[j] == 0 && ret[j] == 1){
				ret[j] = 0;
				ans--;
			}
		}
	}
	

	cout << ans << endl;

	return 0;
	/*Q1*/
	//typedef
	/*

	int a, b = 0;
	
	cin >> a >> b;

	cout << (b % a == 0 ? a + b : b - a) << endl;

	return 0;

	/*Q2*/

	/*Q3*/

		/*Q4*/

		//return 0;
}


Measured memory_bytes: 256
N, Ma, Mb = map(int, input().split())
a, b, c = [0] * N, [0] * N, [0] * N
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())

S = 411
MAX_N = 10
MAX_SIZE = 400
INF = int(1e9)
dp = [[INF] * S for i in range(S)]
dp[0][0] = 0
for i in range(N):
    for j in range(MAX_SIZE, -1, -1):
        for k in range(MAX_SIZE, -1, -1):
            dp[j+a[i]][k+b[i]] = min((dp[j+a[i]][k+b[i]], dp[j][k] + c[i]))

ans = INF
for i in range(1, MAX_N):
    ans = min((ans, dp[i*Ma][i*Mb]))
if ans == INF:
    print(-1)
else:
    print(ans)

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

int main() {
    int N,M,P,X;
    int T[N];
    cin >> N;
    for(int i = 0;i < N;i++) cin >> T[i];
    cin >> M;
    int o[M] = {0};
    for(int i = 0;i < M;i++) {
        cin >> P >> X;
        for(int t = 0;t < N;t++) o[i] += t+1 == P ? X : T[t];
    }
    for(int i = 0;i < M;i++) cout << o[i] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
using namespace std;

typedef long long ll;

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

    int *h = new int[n + 1];
    FOR(i, 1, n)
    {
        cin >> h[i];
    }

    int *dp = new int[n + 1];
    dp[1] = 0;
    dp[2] = abs(h[1] - h[2]);
    FOR(i, 3, n)
    {
        dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]));
    }

    cout << dp[n] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

typedef struct SRunner runner;
struct SRunner{
	int id;
	double time;
	int elected;
};

int main( void ){
	int i, j, counter;
	runner r[ 3 ][ 8 ];
	runner *first, *second;
	
	// input
	for( i = 0; i < 3; i++ ){
		for( j = 0; j < 8; j++ ){
			scanf( "%d%lf", &r[ i ][ j ].id, &r[ i ][ j ].time );
			r[ i ][ j ].elected = 0;
		}
	}

	// elect 1st, 2nd
	for( i = 0; i < 3; i++ ){
		first = NULL;
		second = NULL;
		for( j = 0; j < 8; j++ ){
			if( j == 0 ){
				first = &r[ i ][ j ];
			}else if( j == 1 ){
				if( r[ i ][ j ].time < first -> time ){
					second = first;
					first = &r[ i ][ j ];
				}else{
					second = &r[ i ][ j ];
				}
			}else{
				if( r[ i ][ j ].time < first -> time ){
					second = first;
					first = &r[ i ][ j ];
				}else if( r[ i ][ j ].time < second -> time ){
					second = &r[ i ][ j ];
				}
			}
		}
		printf( "%d %5.2lf\n", first->id, first->time );
		printf( "%d %5.2lf\n", second->id, second->time );
		first -> elected = 1;
		second -> elected = 1;
	}
	
	//elect 3rd-
	counter = 0;
	first = NULL;
	second = NULL;
	for( i = 0; i < 3; i++ ){
		for( j = 0; j < 8; j++ ){
			if( r[ i ][ j ].elected ){ continue; }
			if( counter == 0 ){
				first = &r[ i ][ j ];
			}else if( counter == 1 ){
				if( r[ i ][ j ].time < first -> time ){
					second = first;
					first = &r[ i ][ j ];
				}else{
					second = &r[ i ][ j ];
				}
			}else{
				if( r[ i ][ j ].time < first -> time ){
					second = first;
					first = &r[ i ][ j ];
				}else if( r[ i ][ j ].time < second -> time ){
					second = &r[ i ][ j ];
				}
			}
			counter++;
		}
	}
	printf( "%d %5.2lf\n", first->id, first->time );
	printf( "%d %5.2lf\n", second->id, second->time );
	first -> elected = 1;
	second -> elected = 1;
	
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>


int main(void) {
  char a[256];

  int i,j,l,m,n;
  int ans=0;
  int cnt=0;
  int flag=0;

  scanf("%s",a );

  for ( i = 0; a[i]!='\0'; i++) ;

  for ( j = 0;  a[j]!='\0'; j++) {
    for ( m = j;  a[m]!='\0'; m++) {
      if (a[m]=='A'||a[m]=='T'||a[m]=='C'||a[m]=='G') {
        cnt++;
      }
      else {
        break;
      }
    }
    if (ans<cnt) {
        ans=cnt;
    }
    cnt=0;
  }

printf("%d\n",ans );

  return 0;
}

Measured memory_bytes: 128