akhauriyash/Code-Regression huggingface dataset:
program test
implicit none

integer :: n,i,j,is_prime(100)=1,i_temp,kosuu(100)=1,ans=0,rank(5)=0
integer :: kijyun(5)=(/75,25,15,5,3/)

read(*,*) n

!素数かどうか調べる
is_prime(1)=0
do i=2,100
	do j=2,10
		if( i/j >= 2 .and. mod(i,j) == 0) then
			is_prime(i) = 0
		endif
	enddo
enddo

!Nの階乗を素因数分解
do i=2,n
	do j=2,i
		if(is_prime(j) == 1) then
			i_temp = i
			do while(mod(i_temp,j) == 0)
				kosuu(j) = kosuu(j) + 1
				i_temp = i_temp/j
			enddo
		endif
	enddo
enddo

!75,25,15,5,3以上の個数
do i=2,n
	do j=1,5
		if(kosuu(i)>=kijyun(j))then
			rank(j) = rank(j) + 1
		endif
	enddo
enddo

!75
ans = ans + rank(1)

!25*3
ans = ans + rank(2)*max(0,rank(5)-1)

!15*5
ans = ans + rank(3)*max(0,rank(4)-1)

!5*5*3
if(rank(4)>=2) then
	ans = ans + rank(4)*(rank(4)-1)/2*(rank(5)-2)
endif

write(*,*) ans

end program


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll N; cin >> N;
  map<ll,ll> count;
  for (ll i = 0; i < N; i++) {
    ll a; cin >> a; count[a]++;
  }
  ll res = 0;
  for (ll i = 0; i <= 1e5; i++) {
    res = max(res, count[i]+count[i+1]+count[i+2]);
  }
  cout << res << endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long       ll;
#define pb                emplace_back
#define mp              make_pair
#define sz(a)           a.size()
#define mods(a, m)          ((a % m + m) % m)   
#define md(a)               mods(a, MOD)
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define f first
#define s second
#define fore(i, b, e)     for (int i = b; i < e; i++)
#define forr(i, b, e)     for (int  i = b; i < e; i++)
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;
typedef long double       ld;

typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int INF = int(1e7 + 7);
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1);
#define tam 1230456
int arr[tam];
int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    int n,k;
    cin>>n>>k;
    forr(i,0,n)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    reverse(arr,arr+n);
    ll tot=0;
    forr(i,k,n)
    {
        tot+=arr[i];
    }
    cout<<tot<<endl;

}
// PLUS ULTRA!


Measured memory_bytes: 1024
//2017-10-15
//miaomiao
//
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define For(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define Forr(i, a, b) for(int i = (a); i >= (int)(b); --i)

#define N (100000+5)

LL a[N], cnt[N], suf[N], ans[N];

int main(){
	int rn, n, Q, an = 0;
	LL rt, len, cs;

	scanf("%d%d", &n, &Q);

	a[++an] = 1ll * n;
	For(i, 1, Q){
		scanf("%lld", &rt);
		while(an && a[an] >= rt) --an;
		a[++an] = rt;
	}

	rn = n; n = min((int)a[1], n);	
	cnt[an] = 1;
	
	Forr(i, an, 2){
		len = a[i];

		while(len >= a[1]){
			int tp = lower_bound(a+1, a+i, len) - a - 1;
			if(tp == 0) tp = 1;
			
			cnt[tp] += (cs = len / a[tp]) * cnt[i];
			len -= cs * a[tp];
		}

		suf[len] += cnt[i];
	}

	LL sum = 0;
	Forr(i, n, 1) sum += suf[i], ans[i] = cnt[1] + sum;	
	For(i, 1, rn) printf("%lld\n", ans[i]);

	return 0;
}

Measured memory_bytes: 4864
#!/usr/bin/env python3
import sys


def solve(n: int, v: "List[int]"):
    from collections import Counter
    a = sorted(Counter(v[::2]).items(), key=lambda x: (x[1], x[0]))
    b = sorted(Counter(v[1::2]).items(), key=lambda x: (x[1], x[0]))
    if a[-1][0] != b[-1][0]:
        return n - a[-1][1] - b[-1][1]
    a = [(0, 0)] + a
    b = [(0, 0)] + b
    return n - max(a[-1][1] + b[-2][1],
                   a[-2][1] + b[-1][1])


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    v = [int(next(tokens)) for _ in range(n)]  # type: "List[int]"
    print(solve(n, v))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


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

int dfs(string &s, int goal, int cur, int mask, int res)
{
    // cout << cur << " " << mask << " " << res << endl;
    // base case
    if (cur == s.size() - 1)
    {
        if (res == goal)
        {
            return mask;
        }
        else
        {
            return -1;
        }
    }

    int ret_mask;

    // +ルート
    ret_mask = dfs(s, goal, cur + 1, mask | (1 << cur), res + (s.at(cur + 1) - '0'));
    if (ret_mask != -1)
    {
        return ret_mask;
    }

    // -ルート
    ret_mask = dfs(s, goal, cur + 1, mask, res - (s.at(cur + 1) - '0'));
    if (ret_mask != -1)
    {
        return ret_mask;
    }

    return -1;
}

string calc(string &s)
{
    int mask = dfs(s, 7, 0, 0, s.at(0) - '0');
    if (mask == -1)
    {
        return "";
    }

    string res;
    res = s.at(0);
    for (int i = 0; i < s.size() - 1; ++i)
    {
        if ((mask >> i) & 1)
        {
            res += "+";
        }
        else
        {
            res += "-";
        }
        res += s.at(i + 1);
    }
    res += "=7";
    return res;
}

int main()
{
    string s;
    cin >> s;
    cout << calc(s) << endl;
    return 0;
}

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

using namespace std;

int main()
{
  int n; 
  long a, b, c;
  cin >> n >> a >> b >>c;
  string s[n];
  for(int i = 0;i<n;++i) cin >> s[i];
  char add[n];
  bool able = true;
  for(int i = 0;i<n;++i){
    if(s[i] == "AB"){
      if(a==1 &&b==1 && c==0 && i < n-1 &&s[i+1] == "AC"){
        a++;
        b--;
        add[i] = 'A';
      }else if(a >= b){
        a--;
        b++;
        add[i] = 'B';
      }else{
        a++;
        b--;
        add[i] = 'A';
      }
    }else if(s[i] == "BC"){
      if(a==0 &&b==1 && c==1 && i < n-1 &&s[i+1] == "AB"){
        b++;
        c--;
        add[i] = 'B';
      }else if(b >= c){
        b--;
        c++;
        add[i] = 'C';
      }else{
        b++;
        c--;
        add[i] = 'B';
      }
    }else{
      if(a==1 &&b==0 && c==1 && i < n-1 &&s[i+1] == "BC"){
        c++;
        a--;
        add[i] = 'C';
      }else if(c >= a){
        c--;
        a++;
        add[i] = 'A';
      }else{
        c++;
        a--;
        add[i] = 'C';
      }
    }
    if(a < 0 || b < 0 || c < 0){
      able = false;
      break;
    }
  }
  if(able){
    cout << "Yes" << endl;
    for(int i = 0;i<n;++i) cout << add[i] << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 6832
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

const int timeLimit = 1985;

i64 xor128()
{
  static i64 x = 123456789, y = 362436069, z = 521288629, w = 88675123;
  i64 t = (x ^ (x << 11));
  x = y;
  y = z;
  z = w;
  return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

i64 D;
i64 c[26];
i64 s[365][26];
vector<i64> ans;
vector<i64> ts;

i64 eval(vector<i64> &ans, i64 t = -1)
{
  i64 score = (t == -1 ? 0 : ts[t]);
  i64 last[26] = {};
  t = max(t, 0LL);
  for (i64 i = 0; i < t; i++)
    last[ans[i]] = i + 1;
  for (i64 i = t; i < D; i++)
  {
    score += s[i][ans[i]];
    last[ans[i]] = i + 1;
    for (i64 j = 0; j < 26; j++)
      score -= c[j] * (i + 1 - last[j]);
    ts[i] = score;
  }
  return score;
}

void solve()
{
  chrono::system_clock::time_point start = chrono::system_clock::now();
  double C = timeLimit * 100, forceLine;
  i64 currentTime;
  vector<i64> now = ans;
  i64 bestScore = -1e18, nowScore = eval(now), loop = 0;
  while ((currentTime = chrono::duration_cast<chrono::microseconds>(chrono::system_clock::now() - start).count() / 1000) < timeLimit)
  {
    i64 t[3] = {xor128() % D, xor128() % 26};
    t[2] = now[t[0]];
    now[t[0]] = t[1];
    i64 score = eval(now, t[0]);
    forceLine = (timeLimit - currentTime) / C;
    if (bestScore < score)
    {
      ans = now;
      bestScore = score;
    }
    if (nowScore < score || forceLine * 1000 > rand() % 1000)
    {
      nowScore = score;
    }
    else
    {
      now[t[0]] = t[2];
    }
    loop++;
  }
  cerr << "score: " << bestScore + (i64)(1e6) << endl
       << "loop: " << loop << endl;
}

void init()
{
  for (i64 i = 0; i < D; i++)
  {
    i64 m = -1e9;
    for (i64 j = 0; j < 26; j++)
    {
      if (m < s[i][j])
      {
        m = s[i][j];
        ans[i] = j;
      }
    }
  }
}

void input()
{
  cin >> D;
  for (i64 i = 0; i < 26; i++)
    cin >> c[i];
  for (i64 i = 0; i < D; i++)
    for (i64 j = 0; j < 26; j++)
      cin >> s[i][j];
  ans.resize(D);
  ts.resize(D);
}

void output()
{
  for (i64 i = 0; i < D; i++)
    cout << ans[i] + 1 << endl;
}

int main()
{
  input();
  init();
  solve();
  output();
  return 0;
}


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

typedef int_fast64_t ll;
typedef long double ld;
typedef int_fast32_t intt;
typedef int_fast32_t tmp_m;
#define deb(x) cout << #x << ' ' << x << endl
#define rep(i, cmp1, cmp2) for (tmp_m i = cmp1; i < cmp2; ++i)
#define repp(i, cmp1, cmp2) for (tmp_m i = cmp1; i >= cmp2; --i)
#define pb push_back
#define st stack
#define pa pair
#define vc vector
#define qu queue
#define pq priority_queue
#define fr first
#define sc second
#define mp map
const ld pi = acos(-1.0);
const intt mod = 1e9 + 7;

struct pr {
  intt x;
  intt y;
  intt dst;
  pr() {}
  pr(intt x, intt y, intt dst) : x(x), y(y), dst(dst) {}
  inline bool operator<(const pr& cmp2) const {
    if (dst != cmp2.dst) return dst < cmp2.dst;
    if (x != cmp2.x) return x < cmp2.x;
    return y < cmp2.y;
  }
  inline bool operator==(const pr& cmp2) const {
    return (cmp2.dst == dst) && (cmp2.x == x) && (cmp2.y == y);
  }
  inline bool operator>(const pr& cmp2) const {
    if (dst != cmp2.dst) return dst > cmp2.dst;
    if (x != cmp2.x) return x > cmp2.x;
    return y > cmp2.y;
  }
};

struct point {
  intt x;
  intt y;
  point() {}
  point(intt x, intt y) : x(x), y(y) {}
  inline bool operator<(const point& cmp2) const {
    if (cmp2.x != x) return cmp2.x < x;
    return cmp2.y < y;
  }
  inline bool operator==(const point& cmp2) const {
    return (cmp2.x == x) && (cmp2.y == y);
  }
  inline bool operator>(const point& cmp2) const {
    if (cmp2.x != x) return cmp2.x > x;
    return cmp2.y > y;
  }
};

class prHash {
 public:
  size_t operator()(const pr& cmp1) const {
    return (hash<intt>()(cmp1.x)) ^ (hash<intt>()(cmp1.y)) ^
           (hash<intt>()(cmp1.dst));
  }
};

class pointHash {
 public:
  size_t operator()(const point& cmp1) const {
    return (hash<intt>()(cmp1.x)) ^ (hash<intt>()(cmp1.y));
  }
};

inline bool spoint(const point& cmp1, const point& cmp2) {
  // swap(cmp1, cmp2);
  if (cmp1.x != cmp2.x) return cmp1.x < cmp2.x;
  return cmp1.y < cmp2.y;
}

inline bool spr(const pr& cmp1, const pr& cmp2) {
  // swap(cmp1, cmp2);
  if (cmp1.dst != cmp2.dst) return cmp1.dst < cmp2.dst;
  if (cmp1.x != cmp2.x) return cmp1.x < cmp2.x;
  return cmp1.y < cmp2.y;
}

void solve() {
  intt n;
  cin >> n;
  set<string> s;
  rep(i, 0, n){
    string a;
    cin >> a;
    s.insert(a);
  }
  cout << s.size() << endl;
}

void init() {
  // remove if interactive
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(0));
  // memset(dp, -1, sizeof dp);
}

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


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

using namespace std;

typedef long long lint;

lint cautBin(lint nr)
{
    if(nr == 1)
        return 1;

    if(nr == 2)
        return 2;

    if(nr == 3)
        return 2;

    if(nr == 4 || nr == 5)
        return 3;

    lint cr = 2;
    lint i = 2;
    lint pas = 1LL << 31;
    while(pas != 0)
    {
        if(cr + (i + pas) * (i + pas + 1) - 2 <= nr)
            i += pas;

        pas >>= 1;
    }

   // cout << nr << " AVEM " << i << "\n";
    lint rez = 2 * i;
    if(cr + i * (i + 1) - 2 + (i + 1) <= nr)
        rez ++;

    return rez;
}

lint getDel(lint a, lint b)
{
    lint prod = 1LL * a * b - 1;

    if(a == 1 || b == 1)
        return 1;

    lint del = 0;
    lint na0 = prod / (a - 1);
    lint na1 = prod / a;
    lint na2 = prod / (a + 1);

    if(na0 != na1 && na1 != na2)
        del = 1;

    lint nb0 = prod / (b - 1);
    lint nb1 = prod / b;
    lint nb2 = prod / (b + 1);

    if(nb0 != nb1 && nb1 != nb2)
        del = 1;

    return del;
}

void solve(lint a, lint b)
{
    if(a == 1 && b == 1)
    {
        cout << 0 << "\n";
        return;
    }

    lint prod = 1LL * a * b - 1;
    lint cat = cautBin(prod);

    lint rez = cat - getDel(a, b);

    cout << rez << "\n";
}

int main()
{
    lint t;
    cin >> t;
    lint a, b;
    while(t > 0)
    {
        cin >> a >> b;

        solve(a, b);

        t --;
    }

    return 0;
}


Measured memory_bytes: 256
person,okasi = map(int,input().split())
have = []
ans = 0

for i in range(okasi):
    a = int(input())
    b = input().split()
    for j in range(a):
        have.append(int(b[j]))
#print(have)
for k in range(person):
    if k+1 in have:
        ans = ans
    else:
        ans = ans + 1
    #print(ans)
print(ans)

Measured memory_bytes: 9188
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
	int n,sum=0,ans=0;
	cin>>n;
   
    vector<long long int>a(10000000);
    vector<long long int>b(10000000);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
    	for(int j=0;j<n;j++){
    		if(i>j){
    			sum+=a[j];
    		}
    		else if(i==j){
    			sum+=a[j]+b[j];
    		}
    		else{
    			sum+=b[j];
    		}
    	}
    	if(ans<sum){
    		ans=sum;
    	}
    	sum=0;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 156544
H,W = map(int,input().split())
S = [list(input()) for _ in range(H)]
for i in range(H):
    for l in range(W):
        if S[i][l] == ".":
            s = 0
            if l <= W-2:
                if S[i][l+1] == "#":
                    s += 1
            if l >= 1:
                if S[i][l-1] == "#":
                    s += 1
            if i >= 1 and l <= W-2:
                if S[i-1][l+1] == "#":
                    s += 1
            if i >= 1:
                if S[i-1][l] == "#":
                    s += 1
            if i >= 1 and l >= 1:
                if S[i-1][l-1] == "#":
                    s += 1
            if i <= H-2 and l <= W-2:
                if S[i+1][l+1] == "#":
                    s += 1
            if i <= H-2:
                if S[i+1][l] == "#":
                    s += 1
            if i <= H-2 and l >= 1:
                if S[i+1][l-1] == "#":
                    s += 1
            S[i][l] = str(s)
for i in range(H):
    print("".join(S[i]))





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

int main(){
  int n,mx=0;
  cin>>n;
  vector<int>l(n);
  vector<int>r(n);
  for(int i=0;i<n;i++){
    cin>>l[i]>>r[i];
  }
  for(int i=0;i<n;i++){
    mx+=r[i]-l[i]+1;
  }
  cout<<mx<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	  public static void main(String args[]){
      	Scanner scan = new Scanner(System.in);
            
        int a = scan.nextInt();
        int b = scan.nextInt();
            
        if( a+b < 10 )System.out.println(a+b);
        else System.out.println("error");
	  }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pi pair<int ,int >
#define pl pair<ll ,ll >
#define pb push_back
#define vl vector <long long int >
#define vi vector <int >
#define vp vector <pi>
#define mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define _ <<" "<<
#define forn(x,	n) for(int x = 0; x < n ;++ x) 
#define forn1n(x,n) for(int x = 1; x <= n ;++ x)
#define forn1(x,n) for(int x = 1; x < n ;++ x)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#pragma GCC optimize ("Ofast")
void scan(){}
template<typename F, typename... R> void scan(F &f,R&... r){cin>>f;scan(r...);}
int di_; string dnms_, co_ = ",";
void debug_(){cout<<endl;}
template<typename F, typename... R> void debug_(F &f, R&... r){while(dnms_[di_] != ',')cout<<dnms_[di_++];di_++;cout<<": "<<f<<",";debug_(r...);}
#define debug(...) dnms_=#__VA_ARGS__+co_,di_=0,debug_(__VA_ARGS__)

template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}

int main(){
	IOS

	string s;
	cin>>s;

	bool flag = true;

	forn(i,s.size())
	{
		if((i+1)%2==0&&s[i]=='R')
		{
			flag = false;
			break;
		}
		else if((i+1)%2==1&&s[i]=='L')
		{
			flag = false;
			break;
		}
	}
	if(flag)
		cout<<"Yes";
	else
		cout<<"No";
 
	return 0;	
}

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

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

  double a,b,c;
  b=L/3;
  a=L/3;
  c=L/3;
  double ret=double(L*L*L)/27;

  printf("%8.10lf\n",ret);
  return 0;
}


Measured memory_bytes: 256
'''

                            Online Python Compiler.
                Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.

'''

n = int(input()) 
  
a = list(map(int,input().strip().split()))[:n] 
x=1
flag=0
flag1=0
for i in range(n):
    if a[i]==0:
        x*=0
        flag1=1
        break
if flag!=1: 
    for i in range(n):
        if x*a[i]>1000000000000000000:
            flag=1
            break
        else:
            x*=a[i]
        
if flag1==1:
    print(0)
elif flag==1:
    print(-1)
else:
    print(x)
    


Measured memory_bytes: 21636
import sys
from collections import deque
input = sys.stdin.readline
sys.setrecursionlimit(10**5)
N, H, W = map(int, input().split())
RCA = []

class UF(object):
    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def root(self, v):
        if v == self.parent[v]:
            return v
        else:
            self.parent[v] = self.root(self.parent[v])
            return self.parent[v]
    
    def unite(self, u, v):
        u, v = self.root(u), self.root(v)
        if (u == v):
            return
        self.parent[u] = v

for _ in range(N):
    r, c, a = map(int, input().split())
    r, c = r-1, c-1
    RCA.append((a, r, c))

RCA.sort(reverse=True)
RCA = deque(RCA)

uf = UF(H+W+1)  # r0, r1, ..., rH, c0, c1, ..., cW, loopflag

cnt, ans = 0, 0
while RCA and cnt < H+W:
    a, r, c = RCA.popleft()
    c += H
    if uf.root(r) == uf.root(c):
        if uf.root(r) == uf.root(H+W):  # loop?
            continue
        uf.unite(r, H+W)
    ans += a
    cnt += 1
    uf.unite(r, c)

print(ans)


Measured memory_bytes: 48440
function Main(input) {
    const lines = input.split(/\n/);
    const limit = parseInt(lines[0].split(/\s/)[1], 10);
    var changeNums = 0;
    var numList = {};
    lines[1].split(/\s/).forEach(num => {
        if (numList[num]) {
            numList[num] = numList[num] + 1;
        } else {
            numList[num] = 1;
        }
    });
    Object.keys(numList).sort((a,b) =>{
        if (numList[a] > numList[b]) return -1;
        if (numList[a] < numList[b]) return 1;
        return 0;
    }).slice(limit).forEach(key=>{
        changeNums += numList[key];
    });
    console.log(changeNums);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 48856
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n, m;cin >> n >> m;
  vector<int> A(n);
  vector<pair<int, int>> BC(m);
  rep_i(i, n){
    cin >> A[i];
  }
  sort_v(A);
  int b, c;
  rep_i(i, m){
    cin >> b >> c;
    // c優先でソートしたので;
    BC[i] = make_pair(-c, b);
  }

  sort(BC.begin(), BC.end());
  vector<int> points;
  ll times_sum = 0;
  for (auto i = BC.begin(); i != BC.end(); i++){
    int point = -(i->first), times = i->second;
    times_sum += times;
    
    for (int v = 0; v < times; v++){
      points.push_back(point);
    }
    if(times_sum >= n){
      break;
    }
  }

  int a_ind = 0;
  for (int i = 0; i < points.size(); i++){
    if(a_ind == n)break;
    if(A[a_ind] <= points[i]){
      A[a_ind] = points[i];
      ++a_ind;
    }else{
      break;
    }
  }

  ll sum = accumulate(A.begin(), A.end(), 0LL);
  say(sum);
}

Measured memory_bytes: 2552
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(int i=0;i<N;++i)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(15);
  int N;cin >> N;
  vector<PLL> v(N);
  REP(i,N) cin >> v[i].first >> v[i].second;
  map<PLL,int> memo;
  REP(i,N){
    REP(j,N){
      ll p = v[i].first - v[j].first;
      ll q = v[i].second - v[j].second;
      if(p!=0||q!=0){
        if(memo.count(PLL(p,q))==0)memo[PLL(p,q)] = 1;
        else memo[PLL(p,q)]++;
      }
    }
  }
  int maximum = 0;
  for(auto it = memo.begin(), m_end = memo.end(); it != m_end; ++it){
    maximum = max(maximum, it->second);
  }
  cout << N-maximum << endl;
  return 0;
}


Measured memory_bytes: 384
n = int(input())
a = list(map(int, input().split()))
cnt = dict()

for ai in a:
    if ai not in cnt.keys():
        cnt[ai] = 1
    else:
        cnt[ai] += 1

ans = 0
for k in cnt.keys():
    if cnt[k] > k:
        ans += cnt[k] - k
    elif cnt[k] < k:
        ans += cnt[k]
print(ans)


Measured memory_bytes: 21752
/*{{{*/
#include<bits/stdc++.h>

typedef long long ll;

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

#define vl vector<ll>
#define pll pair<ll,ll>

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;
/*}}}*/

int main() {
  string s,t;
  cin >> s >> t;
  ll count = 0;
  REP(i,s.length()){
    if(s[i]!=t[i])count++;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 3912
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pld pair<long double, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define ff first
#define ss second
#define SZ(x) ((int)(x).size())
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

string s, t;

void read(){
    cin >> s >> t;
}

void solve(){
    read();
    int N = SZ(s), M = SZ(t);
    int ans = M;
    for(int i = 0; i + M - 1 < N; i++){
        int ans2 = 0;
        for(int j = 0; j < M; j++){
            if(s[i+j] != t[j])
                ans2++;
        }
        ans = min(ans, ans2);
    }
    cout << ans;
}

int main(){
    ios_base::sync_with_stdio(false);
    solve();
    return 0;
}



Measured memory_bytes: 3656
//Heaplax
//别让自己后悔
#include<bits/stdc++.h>
#define N 300001
#define int long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;
}
using namespace std;
int n,ans,a[N];
main()
{
	re(n);
	for(int i=1;i<=3*n;++i)re(a[i]);
	sort(a+1,a+3*n+1);
	for(int i=3*n-1;i>n;i-=2)
		ans+=a[i];
	printf("%lld\n",ans);
}


Measured memory_bytes: 2560
import sys

#f = open("input.txt", 'r')
f = sys.stdin
i, k = f.readline().split()
k = int(k)

arr = []

for line in f:
    arr.append(int(line.split()[0]))

def chkCanLoad(arr, k, P):
    tmpW = 0
    k -= 1

    for w in arr:
        tmpW += w
        if tmpW > P:
            k = k - 1
            if k < 0:
                return False
            else:
                tmpW = w
                if tmpW > P:
                    return False
    return True

P = 1
maxP = -1
minP = -10
cof = 2 
while maxP != minP + 1:
    chk = chkCanLoad(arr, k, P)  
    if chk:
        maxP = P
        newP = int(minP + (maxP - minP)/cof)
        P = newP
    else:
        minP = P
        if maxP < 0:
            P *= cof
        else:
            newP = int(minP + (maxP - minP)/cof)
            P = newP 

print(maxP)




Measured memory_bytes: 9564
#include <iostream>
#include <string>
#include <cmath>
#include<iomanip>
using namespace std;
int main()
{
	int a, b, x;
	cin >> a >> b;
	if (a >= 13) {
		x = b;
	}
	else if (a >= 6) {
		x = b / 2;
	}
	else {
		x = 0;
	}
  	cout << x << endl;
	return(0);
}

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

using namespace std;

bool primep(int num){
  if(num == 2) return true;
  else if(num % 2 == 0) return false;
  else {
    for(int i = 3; i <= ceil(sqrt(num)); i += 2)
      if(num % i == 0) return false;
  
    return true;
  }
}

int main(){
  int n;
  int count = 0;
  cin >> n;


  for(int i = 0; i < n; i++){
    int a;
    cin >> a;    
    if(primep(a)) count++;      
  }
  
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 3068
import std.stdio;
import std.math;
import std.conv;

void main() {
	int n_, k_;
	scanf("%d %d", &n_, &k_);
	auto k = k_.to!double;
	auto n = n_.to!double;
	double total = 0.0;
	foreach(i; 0..n_) {
		if (i+1 >= k)
			total += 1.0 / n;
		else {
			auto m = log2(k / (i+1)).ceil.to!long;
			total += 1.0 / pow(2, m) / n;
		}
	}
	writef("%.12f", total);
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
    bool abc[3] = {false, false, false};

    for(int i = 0; i < 3; ++i)
    {
        char c;
        cin >> c;
        if(abc[c - 'a'])
        {
            cout << "No" << endl;
            return 0;
        }
        abc[c - 'a'] = true;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
N=gets.to_i
v=gets.split.map(&:to_f).sort

(N-1).times do
  a = v.shift
  b = v.shift
  c = (a+b)/2
  
  index = v.bsearch_index {|x| x <= c} || 0
  v.insert(index, c)
end
p v[0]

Measured memory_bytes: 1788
#include<iostream>
#include<stdio.h>
using namespace std;

void static func(){
    int a,b;
    cin >> a >> b;
    if ( (a*b) % 2 == 0 ) {
        printf("Even");
    } else {
        printf("Odd");
    }
}

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main (){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    cout<<a[n-1]-a[0]<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        while (true)
        {
            int tableLength = int.Parse(Console.ReadLine());
            if (tableLength == 0)
            {
                return;
            }

            var table = new Dictionary<char, char>();
            for (int i = 0; i < tableLength; i++)
            {
                string line = Console.ReadLine();
                table[line[0]] = line[2];
            }

            int dataLength = int.Parse(Console.ReadLine());
            var outputChars = new List<char>();
            for (int i = 0; i < dataLength; i++)
            {
                char input = Console.ReadLine()[0];
                if (table.ContainsKey(input))
                {
                    outputChars.Add(table[input]);
                }
                else
                {
                    outputChars.Add(input);
                }
            }

            Console.WriteLine(new string(outputChars.ToArray()));
        }
    }
}

Measured memory_bytes: 10612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << (a + b >= c ? "Yes" : "No") << endl;
}


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

using namespace std;

typedef long long lint;
const lint N = 2e5+5, mod = 1e9+7;
lint n, a[N];

int main(){
#ifdef LOCAL
	freopen("input", "r", stdin);
#endif
	
	scanf("%lld", &n);

	for (int i = 0; i < n; i++)
		scanf("%lld", &a[i]);

	lint sum = a[n-1], ans = 0;

	for (int i = n-2; i >= 0; i--){
		int add = (a[i] * sum)%mod;
		ans = (ans + add)%mod;
		sum = (sum + a[i])%mod;
	}

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

	return 0;
}

Measured memory_bytes: 5308
def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [A, B, C] = list(map(lambda x: int(x), inputs[0].split()))
    first_state = A % B
    state = None
    if first_state == C:
        return "YES"

    sum = A
    while state != first_state:
        sum += A
        sur = sum % B
        if sur == C:
            return "YES"
        state = sur

    return "NO"


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


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

using namespace std;


long long dp[110][100010];

int main(){
    long long N, W;
    cin >> N >> W;

    long long w,v;
    for (int i = 0; i < N; i++){
        cin >> w >> v;
        for (int sum_w = 0; sum_w <= W; sum_w++){
            if (sum_w - w >= 0)
                dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - w] + v);

            dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w]);
            }
    }

    cout << dp[N][W] << endl;
}







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

using namespace std;
using ll = long long;

using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

const long long INF = 1LL<<60;
const int mod = 1000000007;

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; }



using Matrix = vector<vector<ll>>;
ll N;

Matrix matmul(Matrix &A, Matrix &B) {
   Matrix res(N, vector<ll>(N, 0));
   for (int i = 0; i < N; i++) {
       for (int j = 0; j < N; j++) {
           for (int k = 0; k < N; k++) {
               res.at(i).at(j) = (res.at(i).at(j) + A.at(i).at(k) * B.at(k).at(j)) % mod;
           }
       }
   }
   return res;
}

Matrix matpow(Matrix M, ll k) {
   Matrix res(N, vector<ll>(N, 0));
   for (int i = 0; i < N; i++) res.at(i).at(i) = 1;

   while (k > 0) {
       if (k & 1) res = matmul(res, M);
       M = matmul(M, M);
       k >>= 1;
   }
   return res;
}

ll K;
Matrix a;

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

    cin >> N >> K;

    a.assign(N, vector<ll>(N));

    REP(i, N) REP(j, N) {
        cin >> a[i][j];
    }

    a = matpow(a, K);

    ll ans = 0;

    REP(i, N) REP(j, N) {
        ans += a[i][j];
        ans %= mod;
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let k: i32 = sc.read();
    let n: usize = sc.read();
    let a: Vec<i32> = sc.vec(n);
    let mut ans: i32 = a[n - 1] - a[0];
    for i in 0..n - 1 {
        ans = std::cmp::min(ans, k - (a[i + 1] - a[i]));
    }
    println!("{}", ans);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

Measured memory_bytes: 4352
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=Integer.parseInt(sc.next());
        Integer A[]=new Integer[n];
        for (int i=0;i<n;i++){
            A[i]=Integer.parseInt(sc.next());
        }
        Arrays.sort(A,Comparator.reverseOrder());
        int Alice=0;
        int Bob  =0;
        for (int i=0;i<n;i+=2){
            Alice+=A[i];
        }
        for (int i=1;i<n;i+=2){
            Bob+=A[i];
        }
        System.out.println(Alice-Bob);
    }
}

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

ll N;
ll M;
ll mat[Max][Max];
ll ret = 0;

void input() {
    cin >> N >> M;
    for(ll i=0;i<N+1;i++){
        cin >> mat[i][0];
        // cout << mat[i][0];
        for(ll j=1;j<mat[i][0]+1;j++){
            cin >> mat[i][j];
            // cout << mat[i][j];
        }
        // cout << endl;
    }
}

void solve() {
    ll arr[M+1];
    for(int i=0;i<M+1;i++){
        arr[i] = 0;
    }
    for(ll i=0;i<N+1;i++){
        for(ll j=1;j<mat[i][0]+1;j++){
            arr[mat[i][j]]++;
        }
    }
    for(int i=0;i<M+1;i++){
        // cout << arr[i] << " ";
        if(arr[i]==N){
            ret++;
        }
    }
}

int main(void){
    input();
    solve();
    cout << ret << endl;
}


Measured memory_bytes: 384
n, k = map(int, input().split())
v = list(map(int, input().split()))


ans = 0
for k1 in range(k+1):
    for k2 in range(k+1):
        if k1 + k2 > k or k1 + k2 > n or k1 > n or k2 > n:
            continue

        w = v[:k1] + v[n-k2:]
        w.sort()
        ans = max(ans, sum(w))
        # print(k1, k2, max(0, k-k1-k2), len(w), w)
        for k3 in range(1, max(0, k-k1-k2)+1):
            ans = max(ans, sum(w[k3:]))

print(ans)


Measured memory_bytes: 3064
#include <stdio.h> 
int main()
{
 int n; 
 int card[110]; 
 char t; int i; 
 int x;
 scanf("%d\n",&n); 
 for(i=0;i<110;i++)
 {
  card[i]=0; 
 } 
 for(i=0;i<n;i++)
 {
  scanf("%c %d\n",&t,&x); 
  x-=1; 
  if(t=='H') x+=13; 
  else 
  if(t=='C') x+=26; 
  else 
  if(t=='D') x+=39; 
  card[x]=1; 
 } 
 for(i=0;i<52;i++)
 {
  if(card[i]==0)
  {
   if(i<13) printf("S "); 
   else 
   if(i<26) printf("H "); 
   else 
   if(i<39) printf("C "); 
   else 
   printf("D "); 
   printf("%d\n",(i%13)+1); 
  } 
 } 
 return 0; 
}


Measured memory_bytes: 2072
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n,m;
    string s;
    cin >> s;
    string a,b,c;
    a = s.substr(0,4);
    b = s.substr(5,2);
    c = s.substr(9,2);
    if(stoi(a) < 2019 ) cout << "Heisei" << endl;
    else if(stoi(a) == 2019 and stoi(b) < 4)  cout << "Heisei" << endl;
    else if(stoi(a) == 2019 and stoi(b)  == 4 and stoi(c) <= 30)cout << "Heisei" << endl;
    else cout << "TBD" << endl;
}



Measured memory_bytes: 256
import copy

N = int(input())
A = list(map(int,input().split()))

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

# 1つの数値を順に取り除いて、残りの最大公約数を求める
l_gcd_list = [A[0]]
r_gcd_list = [A[-1]]
gcd_list = []

# 左右端を抜く場合は後で計算
for i in range(1,N-1):
    l_gcd_list.append(gcd(l_gcd_list[-1], A[i]))
    r_gcd_list.append(gcd(r_gcd_list[-1], A[-i-1]))

# 左右端以外のi番目の数値を抜いた場合
for i in range(1,N-1):
    gcd_list.append(gcd(l_gcd_list[i-1],r_gcd_list[-i-1]))

# 左右どちらかの端の数値を抜いたとき
gcd_list.append(l_gcd_list[-1])
gcd_list.append(r_gcd_list[-1])
    
print(max(gcd_list))

Measured memory_bytes: 14844
#include<cstdio>
#include<cstring>
char s[101];int len=0;
bool apr[101];
int main(){
	scanf("%s",s);len=strlen(s);
	if(s[0]=='C')apr[0]=1;
	for(int i=1;i<len;i++){
		apr[i]=apr[i-1];
		if(apr[i]){
			if(s[i]=='F'){
				printf("Yes\n");
				return 0;
			}
		}else{
			if(s[i]=='C')apr[i]=1;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void){
	int c;
	int diff = 'A' - 'a';
	while(1){
		c = getchar();
		if(c == EOF){break;}
		if('a' <= c && c <= 'z'){c += diff;}
		putchar(c);
	}

	return 0;
}

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

int main() {
	int n, m;

	while (cin >> n >> m && n != 0 && m != 0) {
		int date[1024]; memset(date, 0, sizeof(date));
		for (int i = 0; i < n; ++i) {
			cin >> date[i];
		}
		int me;
		int point = 0;
		int ans;
		bool flg = true;
		for (int i = 0; i < m; ++i) {
			cin >> me;
			if (flg) {
				point += me;
				point += date[point];
				if (point >= n - 1) { ans = i + 1; flg = false; }
			}
		}
		cout << ans << endl;
	}
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl

const int MOD = 1000000007;

inline void add(int &a, int b) {
    a += b;
    if (a >= MOD) {
       a -= MOD;
   }
}

inline void sub(int &a, int b) {
    a -= b;
    if (a < 0) {
       a += MOD;
   }
}

inline int mul(int a, int b) {
    return (long long) a * b % MOD;
}

inline int power(int a, int b) {
    int res = 1;

    while (b > 0) {
        if (b & 1) res = mul(res, a);
        b >>= 1;
        a = mul(a, a);
    }

    return res;
}

inline int inverse(int x) {
    return power(x, MOD - 2);
}

int N;
int a[21][21];
int dp[1 << 21];

int main() {
    cin >> N;
    rep(i, N) {
        rep(j, N) {
            cin >> a[i][j];
        }
    }
    dp[0] = 1;

    rep(i, N) {
        rep(j, 1 << N) {
            if (__builtin_popcount(j) != i) continue;
            rep(k, N) if (!((j >> k) & 1) && a[i][k]) {
                add(dp[j | (1 << k)], dp[j]);
            }
        }
    }
    cout << dp[(1 << N) - 1] << endl;
	return 0;
}

Measured memory_bytes: 8448
param_n, param_d = map(int, input().split())

param_count = 0
for i in range(param_n):
    param_a, param_b = map(int, input().split())
    
    if (param_a)*(param_a) + (param_b)*(param_b) <= (param_d)*(param_d):
        param_count = param_count + 1
        
print(param_count)

Measured memory_bytes: 9188
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <typeinfo>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> s(N);
  int sum=0;
  for(int i=0;i<N;i++){
    cin >> s.at(i);
    sum+=s.at(i);
  }

  if(sum%10!=0) cout << sum << endl;
  else{
    int mi=100;
    for(int i=0;i<N;i++){
      if(s.at(i)%10!=0) mi=min(mi,s.at(i));
    }
    if(mi==100) cout << 0 << endl;
    else  cout << sum-mi << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin >> s;
  int n = s.size();
  int i;
  for(i=0;i<n;i++)
  {
    if(s[i] == 'L' && (i%2==0))
    {
      cout << "No" << endl;
      return 0;
    }
    if(s[i] == 'R' && (i%2==1))
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

int main(){
	int m;
	scanf("%d",&m);
	rep(i,m){
		set<string> ss;
		string in; cin>>in;
		REP(i,1,in.size()){
			string s1 = in.substr(0,i);
			string s2 = in.substr(i);
			string rs1 = string(s1.rbegin(),s1.rend());
			string rs2 = string(s2.rbegin(),s2.rend());
			ss.insert( s1+s2 ); ss.insert( s1+rs2 );
			ss.insert( rs1+s2 ); ss.insert( rs1+rs2 );
			ss.insert( s2+s1 ); ss.insert( s2+rs1 );
			ss.insert( rs2+s1 ); ss.insert( rs2+rs1 );
		}
		cout << ss.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 1028
def comb(n, r, mod):
    x, y = 1, 1
    for i in range(n, n - r, -1):
        x *= i
        y *= i + r - n
        x %= mod
        y %= mod
    return pow(y, mod - 2, mod) * x % mod

s = int(input())
mod = pow(10, 9) + 7
ans = 0
for i in range(s // 3):
    t = s - 3 * (i + 1)
    ans += comb(i + t, min(i, t), mod)
    ans %= mod
print(ans)

Measured memory_bytes: 9224
#include<iostream>
using namespace std;
 
bool is_prime(int x){
if(x<=1) return false;
for(int i=2;i*i<=x;i++)
if(x%i==0) return false;
return true;}
 
signed main(){
int x;
cin>>x;
 
int p=x;
while(!is_prime(p)) p++;
 
cout<<p<<endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <vector>
#include <cstdlib>
#include <set>
#include <cmath>
using namespace std;
int a[105][105],b[10050];
int main ()
{
    int h,w;
    while(scanf("%d %d",&h,&w)!=EOF)
    {
        int i,j,t,k=0;
        cin>>t;
        for(i=0;i<t;i++)
            scanf("%d",&b[i]);
        for(i=0;i<h;i++)
        {
            if(i%2==0)
                for(j=0;j<w;j++)
                {
                    a[i][j]=k+1;
                    b[k]--;
                    if(b[k]==0)
                        k++;
                }
            if(i%2==1)
                for(j=w-1;j>=0;j--)
                {
                    a[i][j]=k+1;
                    b[k]--;
                    if(b[k]==0)
                        k++;
                }
        }
        for(i=0;i<h;i++)
        {
            for(j=0;j<w-1;j++)
                printf("%d ",a[i][j]);
            printf("%d\n",a[i][w-1]);
        }
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  int n,t;
  cin>>n>>t;
  vector<int> ComeTime(n+1);
  rep(i,n) cin>>ComeTime[i];
  ComeTime[n]=1e10;
  int SumTime=0;
  rep(i,n){
    int WhileTime=ComeTime[i+1]-ComeTime[i];
    SumTime+=min(t,WhileTime);
    //cout<<SumTime<<endl;
  }
  cout<<SumTime<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
//const int INF = 1e9 + 5;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int n;
	cin >> n;
	vector<int> dp(3);
	for(int day = 1; day <= n; day++)
	{
		vector<int> arr(3);
		vector<int> new_dp(3, 0);
		for(int i = 0; i < 3; i++)
			cin >> arr[i];
			
		for(int i = 0; i < 3; i++)
		{
			for(int j = 0; j < 3; j++)
			{
				if(i != j)
					new_dp[j] = max(new_dp[j], dp[i] + arr[j]);
			}
		}
		dp = new_dp;
	}
	
	cout << max({dp[0], dp[1], dp[2]}) << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const ll INF=1e18;
const int MOD=1e9+7;
const double pi=acos(-1);


int main(){
  int h,w;
  cin >> h >> w;
  int sum=0;
  rep(i,h){
    rep(j,w){
      char c;
      cin >> c;
      if(c=='#')sum++;
    }
  }
  if(sum==h+w-1)cout<<"Possible"<<endl;
  else cout<<"Impossible"<<endl;
      
}


Measured memory_bytes: 256