akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 1e3+5;

int n , m , a[N] , b[N] , num[N] , dp[N][1<<12];

int solve(int i , int msk)
{
    if (i > m)
    {
        int c = __builtin_popcount(msk);
        if (c==n) return 0;
        return (int)1e9;
    }

    if (dp[i][msk] != -1)
        return dp[i][msk];

    int ans = solve(i+1 , msk);
    ans = min(ans , a[i] + solve(i+1,msk|num[i]));
    return dp[i][msk] = ans;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for(int i=1; i<=m; i++)
    {
        cin >> a[i] >> b[i];
        for(int j=1; j<=b[i]; j++)
        {
            ll x;
            cin >> x;
            x--;
            num[i] |= (1<<x);
        }
    }

    memset(dp , -1 , sizeof(dp));

    int ans = solve(1,0);
    if (ans >= (int)1e9) cout << "-1\n";
    else cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 19744
#include<bits/stdc++.h>
using namespace std;
main(){
    int n;
    cin>>n;
    vector<vector<int>> acts;
    for(int i=0;i<n;i++){
        vector<int> dayActs;
        for(int j=0;j<3;j++){
            int temp;
            cin>>temp;
            dayActs.push_back(temp);
        }
        acts.push_back(dayActs);
    }
    vector<vector<int>> happiness(n,vector<int>(3,0));
    happiness[0][0]=acts[0][0];
    happiness[0][1]=acts[0][1];
    happiness[0][2]=acts[0][2];
    for(int i=1;i<n;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(j==k) continue;
                happiness[i][j]=max(happiness[i][j],happiness[i-1][k]+acts[i][j]);
            }
        }
    }
    cout<<max({happiness[n-1][0],happiness[n-1][1],happiness[n-1][2]});

}

Measured memory_bytes: 14088
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <cmath>
#include <cfloat>

#define REP(i,N) for(int i=0;i<N;i++)
#define debug(x) cout<<#x<<": "<<x<<endl

using namespace std;

typedef long long ll;

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

const int INF = INT_MAX/3;
const int MOD = 1000000007;
const double dINF = DBL_MAX/3;
///////////////////////////////////


int main() {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  if ((b - a) == (c - b)) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }

  return 0;
}


Measured memory_bytes: 256
s = input()
k =int(input())
sn = []
sa = []
num2alpha = lambda c: chr(c+64)
alpha2num = lambda c: ord(c) - ord('A') + 1

for c in s:
    sn.append(alpha2num(c))

for i in range(0,len(sn)-1):
    if sn[i] != 33 and 59 - sn[i] <= k:
        k -= 59 - sn[i]
        sn[i] = 33
    else:
        continue

sn[-1] = (sn[-1] + k-33) % 26 + 33

for c in sn:
    sa.append(num2alpha(c))

print("".join(sa))


Measured memory_bytes: 4980
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
 
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main() {
    string s; cin >> s;
    string ans = "";
    rep(i, s.size()) {
        ans += 'x';
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>; 

ll gcd1(ll a, ll b){
    return b == 0 ? a : gcd1(b, a % b);
}

ll gcd(ll a, ll b, ll c){
    ll d = gcd1(a, b);
    return gcd1(c, d);
}

int main() {
    ll K;
    cin >> K;
    ll ans = 0;
    for(int i = 1; i <= K; i++){
        for(int j = 1; j <= K; j++){
            for(int k = 1; k <= K; k++){
                ans += gcd(i, j, k);
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 3632
import collections

n = int(input())
s = []

while True:
  try:
    s.append(input())
    
  except:
    break
words = []
c = collections.Counter(s)
MAX = c.most_common()[0][1]
for i,j in c.most_common():
  if j==MAX:
    words.append(i)
  else:
    break

L = sorted(set(words))

for i in L:
  print(i)

Measured memory_bytes: 47456
#include<stdio.h>
 
int main(){
        int a,b,c[100]={0},i,cnt;
        while(1){
            scanf("%d",&a);
            if(a<0||a>1000000) break;
            cnt=0;
            while(1){
                b=a%4;
                if(a<4){
                    c[cnt]=a;
                    break;    
                }
                c[cnt]=b;
                cnt++;
                a/=4;        
            }
            for(i=cnt;i>=0;i--) printf("%d",c[i]);
            printf("\n");
        }
        return 0;
}

Measured memory_bytes: 604
#include<stdio.h>
#include<stdlib.h>

#define N 100000
#define INF 1000000

typedef struct{
  int g, b,  c; 
}Place;

int n, d[N];
Place a[500000];

void root(int);

int main(){
 int i, j;
 int x, y, count;
 count =0;
 scanf("%d",&n);
for(i=0;i<n;i++)
 for(i=0;i<n;i++){
 scanf("%d%d",&y,&x);
 for(j=0;j<x;j++){
 a[count].b =y;
 scanf("%d%d",&a[count].g,&a[count].c);
 count++;
}
}

 root(count);

 for(i = 0 ; i < n ; i++){
 printf("%d %d\n",i,d[i]);
 }

 return 0;
}

void root(int x){
  int i, flag;
   flag=1;

 for(i = 0 ; i < n ; i++) d[i] = INF;
 d[0] = 0;

 while(flag != 0){
 flag = 0;
 for(i = 0 ; i < x ; i++){
 if(a[i].c + d[a[i].b] < d[a[i].g]){
	d[a[i].g] = a[i].c + d[a[i].b];
	flag = 1;
 }
 }
}
}



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

bool isPalindrome(string s){
	string t = s;
  	reverse(t.begin(), t.end());
  	return s == t;
}

int main(){
	string s;
  	cin >> s;
  	
  	bool ans = true;
  	if(!isPalindrome(s)) ans = false;
  	if(!isPalindrome(s.substr(0, s.size() / 2))) ans = false;
       
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"
template<class T> void chmax(T &a, const T b){ a = max(a, b); }
template<class T> void chmin(T &a, const T b){ a = min(a, b); }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll inf = LONG_LONG_MAX / 2 - 1;
    string s;
    cin >> s;
    ll n = len(s);
    // dp[figre][0:just, 1:over]
    vector<vector<ll>> dp(n + 1, vector<ll>(2, inf));
    dp[0][0] = 0;
    dp[0][1] = 1;
    rep(i, n) {
        ll cv = s[i] - '0';
        chmin(dp[i + 1][0], dp[i][0] + cv);
        chmin(dp[i + 1][0], dp[i][1] + (10 - cv));
        chmin(dp[i + 1][1], dp[i][0] + (cv + 1));
        chmin(dp[i + 1][1], dp[i][1] + (10 - cv - 1));
    }
    ll ans = min(dp[n][0], dp[n][1] + 1);
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n;
	cin>>n;
	vector<int> a(n), b(n), c(n);
	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++){
		cin>>c[i];
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	vector<ll> cntb(n);
	for(int i = 0; i < n; i++){
		cntb[i] = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
		if(i)cntb[i] += cntb[i - 1];
	}
	ll ans = 0;
	for(int i = 0; i < n; i++){
		int ind = lower_bound(b.begin(), b.end(), c[i]) - b.begin(); ind--;
		if(ind >= 0)ans +=  cntb[ind];
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int a, b; cin >> a >> b;
    cout << (a + b) % 24 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
    int n, x, i, j, k;
    while(cin >> n >> x, n||x){
      int ans = 0;
        for (i=1;i<=n;i++){
            for(j=i+1;j<=n;j++){
                for(k=j+1;k<=n;k++){
                    if(i+j+k == x)
                        ans++;
                }
            }
        }
        cout << ans << endl;
    }
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}

int main() {
  int N;
  cin >> N;
  vector<pair<int,int>> X(N);
  rep(i,N) X[i].second = i;
  rep(i,N) cin >> X[i].first;
  sort(X.begin(),X.end());
  
  vector<int> A(N);
  rep(i,N){
    A[X[i].second] = i;
  }
  
  rep(i,N){
    if(A[i]<N/2) cout << X[N/2].first << endl;
    else cout<< X[N/2-1].first << endl;
  }
  
}
  



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

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define	IOS ios_base::sync_with_stdio(0);
#define en "\n"
#define FOR(i, j, n) for(int j = i; j < n; ++j)
#define forn(i, j, n) for(int j = i; j <= n; ++j)
#define nfor(i, j, n) for(int j = n; j >= i; --j)
#define sortv(vv) sort(vv.begin(), vv.end())
#define all(v) v.begin(), v.end()
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>


using namespace std;
const ll maxn=1e6+100,inf=1e18,LOG=23,mod=1e9+7;
int block = 300, timer = 0;
const ld EPS = 1e-7;

#define bt(i) (1 << (i))
#define int ll

main()
{
	int n;
	cin >> n;
	if(n % 10 == 7)
	{
		cout << "Yes";
		return 0;
	}
	if(n / 10 % 10 == 7)
	{
		cout << "Yes";
		return 0;
	}
	if(n / 100 == 7)
	{
		cout << "Yes";
		return 0;
	}
	cout << "No";
}

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

signed main() {
  string s,t;
  cin>>s>>t;
  sort(s.begin(),s.end());
  sort(t.rbegin(),t.rend());
  if(s<t)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char str[16];
	int n[16];
	int nn[16];
	int i, j;
	
	while (scanf("%s", str) != EOF){
		for (i = 0; i < 10; i++){
			n[i] = str[i] - '0';
		}
		for (i = 1; i < 10; i++){
			for (j = 0; j < 10 - i; j++){
				nn[j] = (n[j] + n[j + 1]) % 10;
//				printf("%d", nn[j]);
			}
//			printf("\n");
			for (j = 0; j < 10 - i; j++){
				n[j] = nn[j];
			}
		}
		printf("%d\n", nn[0]);
	}
	return (0);
}

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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var input = Console.ReadLine().ToCharArray();
            Dictionary<char, int> map = new Dictionary<char, int>();
            foreach(char c in input)
            {
                if (map.ContainsKey(c))
                {
                    map[c]++;
                }
                else
                {
                    map.Add(c, 1);
                }
            }
            if(map.Count == 2 && map[input[0]]==2 && map[input[1]] == 2 && map[input[2]] == 2)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

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

using namespace std;

int main()
{
    
    string s,t;
    cin>>s>>t;
    int n=s.length();
    int m=t.length();
    int flag=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]!=t[i])
        {
            flag=1;
            break;
        }
        
    }
    if(m=n+1&&flag==0)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    
    

    return 0;
}


Measured memory_bytes: 3564
#include<iostream>
using namespace std;
int mp[2][31][31]={};
int sai[7][4]= {{0,0,0,0},{3,5,4,2},{1,4,6,3},{1,2,6,5},{5,6,2,1},{3,6,4,1},{2,4,5,3}};
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

void die(int t,int f,int x,int y){
  int x2,y2,mx=3,f2,t2;
  mp[1][y][x]++;
  for(int i=0;i<4;i++){
    if(sai[t][i]==f){
      for(int j=i;j<i+4;j++){
	int m=j%4,x1=x+dx[j-i],y1=y+dy[j-i];
	if(mp[1][y][x]-1>mp[1][y1][x1]&&sai[t][m]>mx){
	  mx=sai[t][m];
	  x2=x1,y2=y1;
	  t2=7-mx;
	  if(j-i==2)f2=7-t;
	  else if(j-i==-0)f2=t;
	  else f2=f;
	}
      }
      break;
    }
  }
  if(mx!=3)mp[1][y][x]--,die(t2,f2,x2,y2);
  else mp[0][y][x]=t;
}

int main(){
  while(1){
    int n;cin>>n;if(n==0)break;
    int t,f,c[7]={};
    for(int i=0;i<n;i++){
      cin>>t>>f;
      die(t,f,15,15);
    }
    for(int i=0;i<31;i++){
      for(int j=0;j<31;j++){
	c[mp[0][i][j]]++;
	mp[0][i][j]=mp[1][i][j]=0;
      }
    }
    for(int i=1;i<6;i++)cout<<c[i]<<" ";cout<<c[6]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1168
h, w, k = map(int, input().split())
h += 1

if w == 1:
    print(1)
    exit()

mod = 1000000007
dp = [[0 for j in range(w)] for i in range(h)]
dp[0][0] = 1

memo_count_valid_patterns = [0 for i in range(w+1)]


def count_valid_patterns(n):
    # n本の縦棒×高さ1cmに存在するパターン数
    if n <= 1:
        return 1
    if n == 2:
        return 2
    if memo_count_valid_patterns[n] != 0:
        return memo_count_valid_patterns[n]

    memo_count_valid_patterns[n] = (count_valid_patterns(n - 1) + count_valid_patterns(n - 2)) % mod
    return memo_count_valid_patterns[n]


for i in range(1, h):
    for j in range(w):
        # from left
        if j > 0:
            dp[i][j] += dp[i-1][j-1] * (count_valid_patterns(j-1)*count_valid_patterns(w - j - 1))  # ...| |->| | ...
        
        # from up
        dp[i][j] += dp[i-1][j] * (count_valid_patterns(j) * count_valid_patterns(w - j - 1))  # ...| | | ...

        # # from right
        if j < w-1:
            dp[i][j] += dp[i-1][j+1] * (count_valid_patterns(j)*count_valid_patterns(w - j - 2))  # ...| |<-| | ...

        dp[i][j] %= mod

# for line in dp:
#     print(line)
print(dp[h-1][k-1])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <algorithm> //max
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    int s = 0, m = 0;
    for(int i=0; i<n; i++){
        cin >> p[i];
        s += p[i];
        m = max(m,p[i]);
    }
    int ans = s - m/2;
    cout << ans << endl;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long pi = 3.14159265358979323846264338327;
int n;
int main() {
	cin >> n;
	if(n % 2 == 1){
		n+=1;
	}cout << n / 2 << endl;
 	return 0;
}


Measured memory_bytes: 3620
(defun input (n)
  (let ((a (make-array n)))
    (loop for i below n do (setf (aref a i) (1- (read))))
    a)) 

(defmacro w-f (a n)
  `(dotimes (k ,n) (dotimes (i ,n) (dotimes (j ,n)
    (if (> (aref ,a i j) (+ (aref ,a i k) (aref ,a k j)))
      (setf (aref ,a i j) (+ (aref ,a i k) (aref ,a k j))))))))

(defun solve (n r rn dn)
  (let ((ans 1000000000000)
        (used (make-array r :initial-element nil)))
    (labels
      ((dfs (x k dist)
         (if (= k r)
           (when (< dist ans) (setf ans dist))
           (progn (setf (aref used x) t)
                  (loop for i below r
                        unless (aref used i)
                        do (dfs i (1+ k) (+ dist (aref dn (aref rn x) (aref rn i)))))
                  (setf (aref used x) nil)))))
      (dotimes (i r)
        (dfs i 1 0)))
    ans))

(let* ((n (read))
       (m (read))
       (r (read))
       (rn (input r))
       (d (make-array `(,n ,n) :initial-element 10000000000)))
  (loop repeat m
        for a = (1- (read)) for b = (1- (read)) for c = (read)
        do (setf (aref d a b) c)
        do (setf (aref d b a) c))
  (w-f d n)
  (princ (solve n r rn d)))

Measured memory_bytes: 70756
#include<bits/stdc++.h>
#define range(i,a,b) for(long long i = (a); i < (b); i++)
#define rep(i,b) for(long long i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;
 
template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}
template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

int m[10][10];

int outer(int ly, int lx, int ry, int rx){
	int mini = 1e9;
	range(i,ly,ry + 1){
		mini = min(mini, m[i][rx]);
		mini = min(mini, m[i][lx]);
	}
	range(i,lx,rx + 1){
		mini = min(mini, m[ry][i]);
		mini = min(mini, m[ly][i]);
	}
	return mini;
}

int inner(int ly, int lx, int ry, int rx, int out){
	int res = 0;
	range(i,ly, ry){
		range(j, lx, rx){
			if(m[i][j] >= out) return -1;
			res += out - m[i][j];
		}
	}
	return res;
}

int main(){
	int h, w;
	while(cin >> h >> w, h){
		int ans = 0;
		rep(i,h){
			rep(j,w){
				cin >> m[i][j];
			}
		}
		rep(ly,h){
			rep(lx,w){
				range(ry,ly + 2, h){
					range(rx,lx + 2, w){
						int out = outer(ly, lx, ry, rx);
						ans = max<int>(ans, inner(ly + 1, lx + 1, ry, rx, out));
					}
				}
			}
		}
		cout << ans << endl;
	}
}



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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> p(N);
    for (int i = 0; i < N; ++i) cin >> p[i];
    sort(p.begin(), p.end());
    int ans = 0;
    for (int i = 0; i < K; ++i) {
        ans += p.at(i);
    }

    cout << ans << endl;
}

Measured memory_bytes: 3572
#pragma region template
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <boost/foreach.hpp>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define brep(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define rrep(i,n) ll i=(n);ll now=-1;while(i--&&(now++||1))
#define Yes(n) cout<<((n)?Yes:No)
#define pb push_back
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vbl = vector<bool>;
using vint = vector<int>;
using vstr = vector<string>;
static inline void ignore_ret(int x){}
template<class T> inline bool chmax(T&a,const T&b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline map<T,T> factorize(T n){map<T,T>r;for(T i=2;i*i<=n;i++){while(n%i== 0){r[i]++;n/=i;}}if(n!=1)r[n]=1;return r;}
template<class T> inline T gcd_vec(vector<T>v){T r=v[0];for(T i=1;i<v.size();i++)r=gcd(r,v[i]);return r;}
template<class T> inline T lcm_vec(vector<T>v){T r=v[0];for(T i=1;i<v.size();i++)r=lcm(r,v[i]);return r;}
template<class T> inline T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> inline T nCr(T n,T k){if(n<k||n<0||k<0)return 0;T r=1;k=min(k,n-k);for(T i=n-k+1;i<=n;i++)r*=i;return r/factorial(k);}
template<class T> inline T dot_product(vector<T>u,vector<T>v){if(u.size()<v.size())return 0;T r=0;for(T i=0;i<u.size();i++)r+=u[i]*v[i];return r;}
template<class T> inline T sum(vector<T>v){return reduce(all(v),0LL);}
#pragma endregion template

void solve(ll N, vector<string> S) {
  map<string, int> mp;
  for (auto x: S) mp[x]++;
  
  ll most = 0;
  vector<string> ans;
  for (auto x: mp) {
    if (x.second == most) ans.pb(x.first);
    if (x.second > most) {
      most = x.second;
      ans = { x.first };
    }
  }

  for (auto x: ans) cout << x << '\n';
}

int main() {
  ll N;
  ignore_ret(scanf("%lld",&N));
  vector<string> S(N);
  for(int i = 0 ; i < N ; i++){
    cin >> S[i];
  }
  solve(N, move(S));
  return 0;
}

Measured memory_bytes: 28404
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
const int maxn=1e5+10;
int n;
pii a[maxn],b[maxn];
int fa[maxn];
inline int getfa(int x){return x==fa[x]?x:fa[x]=getfa(fa[x]);}
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i].first);
		a[i].second=i;
	}
	for(int i=0;i<n;i++)
	{
		scanf("%d",&b[i].first);
		b[i].second=i;
	}
	for(int i=0;i<n;i++)
		fa[i]=i;
	sort(a,a+n);
	sort(b,b+n);
	for(int i=0;i<n;i++)
	{
		if(a[i].first>b[i].first)
		{
			printf("No\n");
			return 0;
		}
	}
	for(int i=0;i<n;i++)
	{
		if(i&&a[i].first<=b[i-1].first)
		{
			printf("Yes\n");
			return 0;
		}
		int u=getfa(a[i].second);
		int v=getfa(b[i].second);
		if(u==v&&i!=n-1)
		{
			printf("Yes\n");
			return 0;
		}
		fa[u]=v;
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 3072
using System;

class Program
{
  static void Main(string[] args)
  {
    string[] input = Console.ReadLine().Split(' ');
    int a = int.Parse(input[0]);
    int b = int.Parse(input[1]);
    
    if((a + b) % 2 == 0) Console.WriteLine("{0}", (a + b) / 2);
    else Console.WriteLine("{0}", (a + b) / 2 + 1);
  }
}

Measured memory_bytes: 13140
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
d,x = li()
a = []
for _ in range(n):
    a.append(ni())

ans = x
for ai in a:
    ans += ((d-1)//ai + 1)
    
print(ans)

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

template <int MOD_> struct modnum {
	static constexpr int MOD = MOD_;
	static_assert(MOD_ > 0, "MOD must be positive");

private:
	using ll = long long;

	int v;

	static int minv(int a, int m) {
		a %= m;
		assert(a);
		return a == 1 ? 1 : int(m - ll(minv(m, a)) * ll(m) / a);
	}

public:

	modnum() : v(0) {}
	modnum(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int() const { return v; }
	friend std::ostream& operator << (std::ostream& out, const modnum& n) { return out << int(n); }
	friend std::istream& operator >> (std::istream& in, modnum& n) { ll v_; in >> v_; n = modnum(v_); return in; }

	friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
	friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }

	modnum inv() const {
		modnum res;
		res.v = minv(v, MOD);
		return res;
	}
	friend modnum inv(const modnum& m) { return m.inv(); }
	modnum neg() const {
		modnum res;
		res.v = v ? MOD-v : 0;
		return res;
	}
	friend modnum neg(const modnum& m) { return m.neg(); }

	modnum operator- () const {
		return neg();
	}
	modnum operator+ () const {
		return modnum(*this);
	}

	modnum& operator ++ () {
		v ++;
		if (v == MOD) v = 0;
		return *this;
	}
	modnum& operator -- () {
		if (v == 0) v = MOD;
		v --;
		return *this;
	}
	modnum& operator += (const modnum& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	modnum& operator -= (const modnum& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	modnum& operator *= (const modnum& o) {
		v = int(ll(v) * ll(o.v) % MOD);
		return *this;
	}
	modnum& operator /= (const modnum& o) {
		return *this *= o.inv();
	}

	friend modnum operator ++ (modnum& a, int) { modnum r = a; ++a; return r; }
	friend modnum operator -- (modnum& a, int) { modnum r = a; --a; return r; }
	friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
	friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
	friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }
	friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= b; }
};
using num = modnum<int(1e9)+7>;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N, M; cin >> N >> M;
	num vx = 0;
	for (int i = 0; i < N; i++) {
		int x; cin >> x;
		vx += num(x) * num(-(N-1) + 2 * i);
	}
	num vy = 0;
	for (int i = 0; i < M; i++) {
		int y; cin >> y;
		vy += num(y) * num(-(M-1) + 2 * i);
	}
	cout << vx*vy << '\n';

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>

const int N=3005;

int n,occa[N],occb[N],pos[N*2];
char str[N*2];
std::string ans[N];

int main()
{
	scanf("%d",&n);
	scanf("%s",str+1);
	int na=0,nb=0;
	for (int i=1;i<=n*2;i++)
		if (str[i]=='a') occa[++na]=i,pos[i]=na;
		else occb[++nb]=i,pos[i]=nb;
	std::string best;
	for (int i=n;i>=1;i--)
	{
		if (occa[i]<occb[i])
		{
			int k=i;
			for (int j=occa[i]+1;j<occb[i];j++) k=std::max(k,pos[j]);
			ans[i]="ab"+ans[k+1];
		}
		else
		{
			int k=i;
			while (k<n&&occb[k+1]<occa[k]) k++;
			for (int j=occb[i];j<=n*2;j++) if (pos[j]>=i&&pos[j]<=k) ans[i]+=str[j];
			ans[i]+=ans[k+1];
		}
		ans[i]=std::max(ans[i],ans[i+1]);
		best=std::max(best,ans[i]);
	}
	printf("%s",best.c_str());
	return 0;
}

Measured memory_bytes: 14592
#include<bits/stdc++.h>
#include <cmath>  
using namespace std;
#define endl "\n"
#define int long long 
#define reus ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int32_t main()
{
	reus;
	int a,b,d;
	char c;
	cin>>a>>b>>c>>d;
	int sec=(b*100)+d;
	cout<<(a*sec)/100;	
	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <math.h>

using namespace std;

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


Measured memory_bytes: 3100
<?php
list($n, $k) = ints();
$s = str();
$p = 0;
for($i = 0; $i < $n - 1; $i++){
  if($s[$i] == $s[$i+1]){
    $p++;
  }
}
echo min($n-1, $p + $k * 2);

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array:";
            echo implode(" ", $val)."\n";
        }else{
            echo "array:array\n";
            foreach($val as $row){
                echo implode(" ", $row)."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}


Measured memory_bytes: 4728
#include <cstdio>
#include<cmath>
#include <algorithm>
#include <cstring>
#include<iostream>
using namespace std;
double num[1005];
int main()
{
    int n;
    int flag=0;
    double maxn=0x7FFFFFFF;
    double t,a;
    cin>>n;
    cin>>t>>a;
    for(int i=0;i<n;i++){
        cin>>num[i];
        num[i]=t-num[i]*0.006;
        if(abs(num[i]-a)<maxn){
            flag=i;
            maxn=abs(num[i]-a);
        }
    }
    cout<<flag+1<<endl;
    return 0;
}


Measured memory_bytes: 632
#include <stdio.h>
#include <algorithm>
#include <cassert>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>

#define rep(i, l, r) for (ll i = (l); i <= (r); i++)
#define irep(i, r, l) for (ll i = (r); i >= (l); i--)
#define vec(t) vector<t>

using namespace std;
using ll = long long;
using vecint = vec(int);
using vecll = vec(ll);


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

    ll N;
    cin >> N;

    vecll T(5);
    rep(i,0,4) cin >> T[i];

    ll l = *min_element(T.begin(), T.end());
    ll t  = (N / l) + 4;

    if (N % l != 0) t++;

    cout << t << endl;

}


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

int main(void){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    long long money = 1000;
    for (int i = 1; i < N; i++) {
        if (A[i - 1] < A[i]) {
            money = money / A[i - 1] * A[i] + money % A[i - 1];
        }
    }
    cout << money << endl;
}


Measured memory_bytes: 3628
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int[] V = new int[N];
            for (int i = 0; i < N; i++) {
                V[i] = sc.nextInt();
            }

            Arrays.sort(V);

            BigDecimal d = new BigDecimal(V[0]);
            for (int i = 1; i < N; i++) {
                d = d.add(new BigDecimal(V[i])).divide(new BigDecimal(2));
            }

            System.out.println(d);
        }
    }

}


Measured memory_bytes: 23508
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>

#define reep(i,n,m) for(int i=(n);i<(m);i++)
#define rep(i,n) reep(i,0,n)

using namespace std;

int main(){
	string str;
	cin >> str;
	char a[] = {'C','F'};
	int c=0;
	rep(i,str.size()){
		if(str[i]==a[c]){
			c++;
		}
		if(c==2){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No\n";
}

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

int main(){
    string s;
    cin>>s;
    int ans=0;
    if(s.size()%2!=0){
        cout<<"No"<<endl;
        return 0;
    }
    if(s.size()%2==0){
        for(int i=0;i<s.size();i++){
            if(i%2==0){
                if(s[i]!='h'){
                    cout<<"No"<<endl;
                    return 0;
                }
            }
            if(i%2==1){
                if(s[i]!='i'){
                    cout<<"No"<<endl;
                    return 0;
                }
            }
        }
    }
     cout<<"Yes"<<endl;
     return 0;           
           
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn argsort<T: std::cmp::Ord + std::marker::Copy>(v: &Vec<T>) -> Vec<usize> {
    let mut sort_v = Vec::new();
    for i in 0..v.len() {
        sort_v.push((v[i], i));
    }
    sort_v.sort();
    sort_v.iter().map(|x| x.1).collect::<Vec<usize>>()
}

fn construct_usables(k: usize, min_candidate_a: u64, a: &Vec<u64>) -> Vec<u64> {
    let mut usables = Vec::new();

    let mut is_seeking = false;
    let mut start_seeking_index = 0usize;

    for j in 0..a.len() {
        if a[j] >= min_candidate_a {
            if !is_seeking {
                is_seeking = true;
                start_seeking_index = j;
            }
        }
        if is_seeking && (a[j] < min_candidate_a || j == a.len() - 1) {
            let mut end_idx = j;
            if j == a.len() - 1 {
                end_idx += 1;
            }
            is_seeking = false;
            if end_idx - start_seeking_index < k {
                continue;
            }

            let mut pocket_values = Vec::new();
            for ii in start_seeking_index..end_idx {
                pocket_values.push(a[ii]);
            }
            pocket_values.sort();

            let width = end_idx - start_seeking_index;
            for ii in 0..width + 1 - k {
                usables.push(pocket_values[ii]);
            }
        }
    }
    usables.sort();
    usables
}

fn main() {
    let v = read_vec::<usize>();
    let (n, k, q) = (v[0], v[1], v[2]);
    let a = read_vec::<u64>();

    let mut ans = std::u64::MAX;
    for i in 0..n {
        let min_candidate_a = a[i];
        let usables = construct_usables(k, min_candidate_a, &a);
        if usables.len() >= q {
            // assert_eq!(usables[0], min_candidate_a);
            ans = min(ans, usables[q - 1] - usables[0]);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
  
int main()
{
  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;

  int MIN = A*X+B*Y;
  REP(i,max(X,Y)+1){
    int a = max(X-i,0);
    int b = max(Y-i,0);
    MIN = min(MIN,2*i*C+A*a+B*b);
  }  
  cout << MIN << endl;
}

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

int main(){
    std::string S;
    std::cin>>S;

    int low = 0;
    for(auto i = S.begin();i != S.end();i++){
        if(*i >= 'a' && *i <= 'z'){
            low++;
        }
    }
    int c = 0;
    for(auto i = S.begin()+2;i != S.end()-1;i++){
        if(*i == 'C'){
            c++;
        }
    }
    if((S[0] == 'A') && (S.length()-2 == low) && c == 1){
        std::cout<<"AC"<<std::endl;
    }else{
        std::cout<<"WA"<<std::endl;
    }
    return 0;
}

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

using namespace std;

const int MAXN=15;

int d,p[MAXN],c[MAXN],G;
int ans=1<<30,tans,cur;

int main()
{
    cin>>d>>G;
    for(int i=1;i<=d;i++) cin>>p[i]>>c[i];
    for(int s=0;s<(1<<d);s++)
    {
        cur=tans=0;
        for(int i=0;i<d;i++) if((s>>i)&1) tans+=p[i+1],cur+=100*(i+1)*p[i+1]+c[i+1];
        if(cur>=G) {ans=min(ans,tans);continue;}
        for(int i=d-1;~i;i--) if(!((s>>i)&1)) 
        {
            if(G-cur>100*(i+1)*(p[i+1]-1)) tans+=p[i+1]-1,cur+=100*(i+1)*(p[i+1]-1);
            else {tans+=ceil(1.0*(G-cur)/((i+1)*100));cur=G;break;}
        }
        if(cur<G) continue;
        ans=min(ans,tans);
    }
    cout<<ans<<endl;
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(); 
		int b = sc.nextInt();
		System.out.println(Math.max(a+b, Math.max(a-b, a*b))); 
	}
}

Measured memory_bytes: 23892
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;
    cout << t + s;
}

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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 3005;

int mod;
int f[N][N];
int C[N][N];

void add(int &a,int b)  {
    a += b;
    if (a >= mod)
        a -= mod;
}
void sub(int &a,int b)  {
    a -= b;
    if (a <  0)
        a += mod;
}
int mul(int a,int b)    {   return  1ll * a * b % mod;  }
int inv(int a,int p)    {   return  a == 1 ? 1 : p - 1ll * p * inv(p % a,a) / a;    }

int Pow(int a,int b)    {
    int ans = 1;
    while  (b)  {
        if (b & 1)  ans = mul(ans,a);
        a = mul(a,a);   b >>= 1;
    }
    return  ans;
}
int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n;  cin >> n >> mod;

    for(int i = 0 ; i <= n ; ++i)
        f[i][0] = 1,
        C[i][0] = 1;

    for(int i = 1 ; i <= n ; ++i)
    for(int j = 1 ; j <= i ; ++j)
        add(f[i][j],mul(f[i - 1][j],j)),    //i is in one of given j group
        add(f[i][j],f[i - 1][j]),           //i is in no given group
        add(f[i][j],f[i - 1][j - 1]),       //i is in a new group

        add(C[i][j],C[i - 1][j]),
        add(C[i][j],C[i - 1][j - 1]);

    int ans = 0;

    for(int i = 0 ; i <= n ; ++i)   {
        mod--;  int E = Pow(2,n - i);
        mod++;  int F = Pow(2,n - i);

        int cur = 0;
        int val = 1;

        for(int j = 0 ; j <= i ; ++j)   {
            add(cur,mul(val,f[i][j]));
            val  =  mul(val,F);
        }

        cur = mul(cur,Pow(2,E));
        cur = mul(cur,C[n][i]);

        if (i & 1)  sub(ans,cur);
        else        add(ans,cur);
    }
    cout << ans << endl;
}

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

int main() {
    int n,m;cin>>n>>m;
    int a[n];
    for (int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    map<int,ll> mp;
    for (int i=0;i<m;i++) {
        int b,c;
        cin>>b>>c;
        mp[c]+=b;
    }
    ll ans=0;
    for (int i=0;i<n;i++) {
        auto it=mp.rbegin();
        if (mp.size()&&it->first>a[i]) {
            a[i]=it->first;
            it->second--;
            if (it->second==0)
                mp.erase(it->first);
        }
        ans+=a[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 10264
#include <iostream>
#include <string>
using namespace std;
int a[100005];
int main() {
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int rstart = 0;
  while (rstart < S.size()) {
    int lstart = rstart;
    while (S[lstart] == 'R') lstart++;
    int lend = lstart;
    while (lend < S.size() && S[lend] == 'L') lend++;
    int nr = lstart - rstart;
    int nl = lend - lstart;
    a[lstart-1] = (nr+1)/2 + nl/2;
    a[lstart] = nr/2 + (nl+1)/2;
    rstart = lend;
  }
  cout << a[0];
  for (int i=1; i<S.size(); i++) cout << ' ' << a[i];
  cout << endl;
}

Measured memory_bytes: 1104
#include <iostream>
#include <cstdio>
#include <string>
#include <bits/stdc++.h>
#include <set>
#include <list> //list<???> a; a.push_back ,insert(追加したい要素),a.sort(),参照できない
#include <vector> //vector<???> a; a.push_back,sort(a.begin(),a.end());a[i]
//配列 int a[N];a[i]=追加したい要素;sort(a,a+N);a[i]
using namespace std;
typedef long  ll;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod=1e9+7;


int main(){
  int N,M;
  cin>>N>>M;
  vector<int>oks(N+1,true);
  
  for(int i=0;i<M;i++){
    int a;
    cin>>a;
    oks[a]=false;
  }
  vector<int>dp(N+2);


  dp[N]=1;
  for(int i=N-1;0<=i;i--){
    if(oks[i]){
      dp[i]=(dp[i+1]+dp[i+2])%mod;
    }else{
      dp[i]=0;
    }
  }
  cout<<dp[0]<<endl;
  return 0;
}

Measured memory_bytes: 1024
#!/usr/bin python3
# -*- coding: utf-8 -*-

from bisect import bisect_left, bisect_right

def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    for i in range(1,N):
        A[i]+=A[i-1]
    for i in range(1,M):
        B[i]+=B[i-1]
    ret = 0
    for i in range(N):
        if A[i]<=K:
            l = bisect_right(B, K-A[i])    # 5が入るべき境目のうち最も右側の境目を返す
            ret = max(ret,i+l+1)
    ret = max(ret,bisect_right(B, K))
    print(ret)

if __name__ == '__main__':
    main()

Measured memory_bytes: 40368
#include "bits/stdc++.h"
using namespace std;

#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)


int main() {
	int N, T; cin >> N >> T;
	vector<int> c(N);
	vector<int> t(N);
	rep(i, N) {
		cin >> c[i] >> t[i];
	}
	int ans = 10000;
	rep(i, N) {
		if (t[i] <= T) {
			ans = min(ans, c[i]);
		}
	}
	if (ans == 10000) {
		cout << "TLE" << endl;


	}
	else {

		cout << ans << endl;
	}




}

Measured memory_bytes: 256
#include <cstdio> 
#include <cstdlib> 
#include <cmath> 
#include <cstring> 
#include <climits> 
#include <cfloat> 
#include <map> 
#include <utility> 
#include <set> 
#include <iostream> 
#include <memory> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <functional> 
#include <sstream> 
#include <complex> 
#include <stack> 
#include <queue> 
#include <numeric>
#include <cassert>

#define FOR(i, min, max) for (int i = (min); i < (max); ++i) 
#define FORE(i, min, max) for (int i = (min); i <= (max); ++i) 
#define REP(i, n) for (int i = 0; i < (n); ++i) 
#define REPV(vec, i) for (int i = 0; i < (int)(vec.size()); ++i) 
#define FOR_EACH(vec, it) for (typeof((vec).begin()) it = (vec).begin(); it != (vec).end(); ++it)

using namespace std; 
static const double EPS = 1e-12; 
typedef long long ll; 

template<typename T>
T gcd(T a, T b) {
    while(b) {
        T tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

int main(void)
{
    int K;
    cin >> K;
    ll ret = 0;
    FORE(a, 1, K) FORE(b, 1, K) FORE(c, 1, K) ret += gcd(gcd(a, b), c);
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace kyoupuro {

    class MainClass {

        static List<int>[] matrix;
        static int M;
        static int N;

        public static void Main() {
            N = Input.NextInt();
            M = Input.NextInt();
            matrix = new List<int>[N];

            for (int i = 0; i < N; i++) {
                matrix[i] = new List<int>();
            }

            for (int i = 0; i < M; i++) {
                var a = Input.NextInt() - 1;
                var b = Input.NextInt() - 1;

                matrix[a].Add(b);
                matrix[b].Add(a);
            }

            Console.WriteLine(Count(new[] { 0 }, 0));
        }

        static int Count(IEnumerable<int> list, int now) {
            if (list.Count() == N) return 1;

            return matrix[now].Where(x => !list.Contains(x)).Sum(x => Count(list.Concat(new[] { x }), x));
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

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

typedef long long ll;
typedef pair<int, int> P;

const ll mod =  1000000007;  //ansを出力する時は (ans % mod + mod) % mod とする(負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

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

int main()
{
    int a,b,c,d; cin >> a >> b >> c >> d;
    int dx = c-a, dy = d-b;
    rep(i,dy) cout << 'U';
    rep(i,dx) cout << 'R';
    rep(i,dy) cout << 'D';
    rep(i,dx) cout << 'L';

    cout << 'L';

    rep(i,dy+1) cout << 'U';
    rep(i,dx+1) cout << 'R';
    cout << 'D';
    cout << 'R';
    rep(i,dy+1) cout << 'D';
    rep(i,dx+1) cout << 'L';
    cout << 'U';
    cout<< endl;
}

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

int main(){
	int t[4],u,i,o,p,a,b,c,d;
	
	cin>>t[0]>>u;
	cin>>t[1]>>i;
	cin>>t[2]>>o;
	cin>>t[3]>>p;
	
	if(t[0]==1){
		a=6000*u;
		}
	else if(t[0]==2){
		a=4000*u;
		}
	else if(t[0]==3){
		a=3000*u;
		}
	else if(t[0]==4){
		a=2000*u;
		}

	if(t[1]==1){
		b=6000*i;
		}
	else if(t[1]==2){
		b=4000*i;
		}
	else if(t[1]==3){
		b=3000*i;
		}
	else if(t[1]==4){
		b=2000*i;
		}
	
	if(t[2]==1){
		c=6000*o;
		}
	else if(t[2]==2){
		c=4000*o;
		}
	else if(t[2]==3){
		c=3000*o;
		}
	else if(t[2]==4){
		c=2000*o;
		}

	if(t[3]==1){
		d=6000*p;
		}
	else if(t[3]==2){
		d=4000*p;
		}
	else if(t[3]==3){
		d=3000*p;
		}
	else if(t[3]==4){
		d=2000*p;
		}
		
	cout<<a<<endl;
	cout<<b<<endl;
	cout<<c<<endl;
	cout<<d<<endl;
	
	return 0;
	}
			

Measured memory_bytes: 1160
A, B = map(int, input().split())
s = input()
for i in range(len(s)):
    if i<A and s[i]=='-':
        print("No")
        exit()
    elif i==A and s[i]!='-':
        print("No")
        exit()
    elif A<i<=A+B and s[i]=='-':
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 3060
#include <assert.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#define MAX_LEN 100

int expr();
int term();
int fact();
int number();

const char *p;

int expr() {
	int result = term();
	while(*p == '+' || *p == '-') {
		const char operator = *p;
		++p;
		switch(operator) {
		case '+': result += term(); break;
		case '-': result -= term(); break;
		default: assert(false);
		}
	}
	return result;
}

int term() {
	int result = fact();
	while(*p == '*' || *p == '/') {
		const char operator = *p;
		++p;
		switch(operator) {
		case '*': result *= fact(); break;
		case '/': result /= fact(); break;
		default: assert(false);
		}
	}
	return result;

}

int fact() {
	if(*p == '-') {
		++p;
		return -fact();
	}
	else if(*p == '(') {
		++p;
		const int result = expr();
		assert(*p == ')');
		++p;
		return result;
	}
	else if(isdigit(*p)) {
		return number();
	}
	else {
		assert(false);
	}
}

int number() {
	int result = 0;
	while(isdigit(*p)) {
		result = result * 10 + (*p - '0');
		++p;
	}
	return result;
}

int main() {
	char input[MAX_LEN + 1];
	int i;
	int n;
	scanf("%d", &n);

	for(i = 0; i < n; ++i) {
		scanf("%s", input);
		p = input;
		const int ans = expr();
		assert(*p == '=');
		printf("%d\n", ans);
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 596
package main
 
import (
  "fmt"
)

func main() {
  
var a,b int
fmt.Scan(&a,&b)
  
  if 0 < a && a < 10 && 0 < b && b < 10 {
    fmt.Println(a * b)
  } else {
    fmt.Println("-1")
  }
}

Measured memory_bytes: 512
#include<iostream>

using namespace std;


int main(void){
	
	while(1){
		int n;
		cin>>n;
		
		if(n==0)break;
		
		
		int ans = 0;
		
		ans += n/5;
		ans += n/25;
		ans += n/125;
		ans += n/625; 
		ans += n/3125;
		ans += n/15625;
		
		cout<<ans<<endl;
	}
}

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

int main() {
  int n;
  cin >> n;
  
  if(n%2==0){
    double a =1;
    cout << a/2 << endl;
  }
  else{
    cout << (n+1)*0.500000/n << endl;
  }
}

Measured memory_bytes: 256