akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;

int m, n;
int ma[300];
vector<int> g[300];
bool go[300], ba[300];

void iki(int x)
{


	int i;

	if (go[x]) return;
	go[x] = true;				//????????°??????
	if (x == n + 1) return;
	for (i = 1; i <= m; i++)
	{
		int y = x + i;
		if (y <= n + 1)
		{
			y = y + ma[y];
			if(y<0) y==0;
			if (y>=0)
			{
				if (y > n + 1) y = n + 1;

				g[y].push_back(x);
				iki(y);
			}
		}

	}
	return;
}

void kae(int x)
{

	int i;
	if (ba[x]) return;
	ba[x] = true;
	if (x == 0) return;
	for (i = 0; i<g[x].size(); i++)
	{
		kae(g[x][i]);
	}
	return;
}

int main()
{
	int i;
	while (cin >> m, m)
	{
		cin >> n;

		//---------------?????????--------------------//
		for (i = 0; i<300; i++)
		{
			g[i].clear();
			ma[i] = 0;
		}
		memset(go, 0, sizeof(go));
		memset(ba, 0, sizeof(ba));


		for (i = 1; i <= n; i++)
		{
			cin >> ma[i];
		}
		ma[0] = ma[n + 1] = 0;

		iki(0);
		kae(n + 1);


		for (i = 0; i <= n + 1; i++)
		{
			if (go[i])
			{
				if (ba[i] == 0)
				{
					cout << "NG\n";
					break;
				}
			}
			if (i == n + 1) cout << "OK\n";
		}
	}
	return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int P,Q,R;
    cin >> P >> Q >> R;
    int x=max(max(P,Q),R);
    cout << P+Q+R-x << endl;



}


Measured memory_bytes: 256
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>

using namespace std;

#define lint long long
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF (int)(1e9+10)
#define LLINF (lint)(1e18+10)

int main(){
    int x, a, b;
    cin >> x >> a >> b;
    x -= a;
    while(x >= b){
        x -= b;
    }
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 2e5 + 11;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;

int n, a[N], sum[N][2], ans, t[N << 2], add[N << 2];

int get (int l, int r, int i) {
	return sum[r][i] - sum[l - 1][i];
}

void push (int v) {
	if (add[v]) {
		add[v << 1] += add[v];
		add[v << 1 | 1] += add[v];
		t[v << 1] += add[v];
		t[v << 1 | 1] += add[v];
		add[v] = 0;
	}
}


void update (int l, int r, int x, int v = 1, int tl = 0, int tr = n + 1) {
	if (l > r || l > tr || tl > r)
		return;

	if (l <= tl && tr <= r) {
		t[v] += x;
		add[v] += x;
		return;
	}

	push(v);
	int tm = (tl + tr) >> 1;
	update(l, r, x, v << 1, tl, tm);
	update(l, r, x, v << 1 | 1, tm + 1, tr);
	t[v] = max(t[v << 1], t[v << 1 | 1]);	
}

main () {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i]; 
		for (int j = 0; j < 2; ++j) {
			sum[i][j] = sum[i - 1][j]; 
			if (i % 2 == j)
				sum[i][j] += a[i];
		}
	}

	if (n % 2 == 1) {
	    ans = sum[n - 1][1];
	    int j = n; 
		for (int i = n; i > 2; i -= 2) {
			update(0, j - 1, a[i]);
			update(j, n + 1, a[i - 1]);
			ans = max(ans, sum[i - 3][1] + t[1]);
			--j;
		}
	} else {
		ans = -INF;
		for (int i = 0; i <= n; i += 2)
			ans = max(ans, sum[i][1] + get(i + 1, n, 0));
	}	

	cout << ans << endl;	
}



Measured memory_bytes: 12508
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

int main()
{
	int k,a,b;
	scanf("%i %i %i",&k,&a,&b);
	ll ans=1;
	if(k<=a || b-a<=2) ans+=k;
	else
	{
		ans+=a-1;
		k-=a-1;
		int work=k/2;
		ans+=(ll)work*(b-a);
		if(k&1) ans++;
	}
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;

int N, M, Q, V[100000], D[100000], C[100000];
vector< int > g[100000];
bool done[100000][11];
int color[100000];

void mark(int idx, int dist, int c)
{
  if(dist < 0) return;
  if(color[idx] == 0) color[idx] = c;
  for(int i = dist; i <= 10; i++) if(done[idx][i]) return;
  done[idx][dist] = true;
  for(int to : g[idx]) mark(to, dist - 1, c);
}

int main()
{
  cin >> N >> M;
  for(int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    --A, --B;
    g[A].push_back(B);
    g[B].push_back(A);
  }
  cin >> Q;
  for(int i = 0; i < Q; i++) {
    cin >> V[i] >> D[i] >> C[i];
    --V[i];
  }

  for(int i = Q - 1; i >= 0; i--) {
    mark(V[i], D[i], C[i]);
  }

  for(int i = 0; i < N; i++) {
    cout << color[i] << endl;
  }
}

Measured memory_bytes: 9080
class BIT:
    def __init__(self, n):
        self.bit = [ 0 for _ in range(n+1) ]

    def add(self, x, w):
        i = x
        while i < len(self.bit)-1:
            self.bit[i] += w
            i |= (i+1)

    def sum_(self, x):
        ret, i = 0, x-1
        while i >= 0:
            ret += self.bit[i]
            i = (i & (i+1)) - 1

        return ret

    def sum(self, l, r):
        return self.sum_(r) - self.sum_(l)


n, k = map(int, input().split())
p = [ int(x) for x in input().split() ]

tree = BIT(n)
for i in range(n):
    tree.add(i, (p[i] + 1) / 2)

ans = 0
for i in range(n-k+1):
    ans = max(ans, tree.sum(i, i+k))

print(ans)

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

int main(){
    string s;
    cin >> s;

    int flag = 0;
    for(int i = 0; i < 3; i++){
        if(s[i] == '7'){
            flag = 1;
            break;
        }
    } 

    if(flag == 0){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <queue>
#include <sstream>

using namespace std;

typedef long long ll;

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


vector<ll> cost(100007,-1);
vector<ll> memo(100007,-1);
ll K,check=1e9+7;

ll dp(ll n){
    ll c=K;
    if(n==0) return 0;
    if(memo[n]!=-1) return memo[n];
    else memo[n]=check;
    if(n<K) c=n;
    for(ll i=1;i<=c;i++){
        memo[n]=min(dp(n-i)+abs(cost[n]-cost[n-i]),memo[n]);
    }
    return memo[n];
}

int main(){
    int N;
    cin>>N>>K;
    rep(i,N) cin>>cost[i];
    memo[0]=0;
    memo[1]=abs(cost[1]-cost[0]);
    cout<<dp(N-1)<<endl;
    return 0;
}

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

int main() {
	long long int a, b;
	int K;
	cin >> a >> b >> K;
	if(b - a < K * 2){
		for(int i = a;i <= b;i++){
			cout << i << endl;
		}
		return 0;
	}
	else{
		for(int i = a;i - a < K;i++){
			cout << i << endl;
		}
		for(int i = b - K + 1;i <= b;i++){
			cout << i << endl;
		}
		return 0;
	}
}

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

using namespace std;

int main(){
    int n,i;
    cin>>n;
    int a[n];
    for(i=0; i<n; i++){
        cin>>a[i];
    }
    for(i=n-1; i>=0; i--){
        if(i!=0){
            cout<<a[i]<<" ";
        }
        else{
            cout<<a[i];
        }
    }
    cout<<endl;
    return 0;
}



Measured memory_bytes: 3088
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

public class Main {
  public static void main(String[] args)throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    Set<Integer> st = new HashSet<>();
    for(int i=0; i<n; i++) {
      st.add(Integer.parseInt(str[i]));
    }
    System.out.println(st.size() == n?"YES":"NO");
  }
}

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

using namespace std;

const int MX = 100;

int a[MX], ans[MX];

int main() {
	int n;
	ignore = scanf("%d", &n);
	for (int i = 0; i < n; i++) ignore = scanf("%d", a + i);
	
	int N = n;
	
	while (n > 0) {
		int i = n - 1;
		while (i >= 0 && a[i] != i + 1) i--;
		
		if (i == -1) break;
		
		ans[n - 1] = a[i];
		for (int j = i; j + 1 < n; j++) a[j] = a[j + 1];
		n--;
	}
	
	if (n > 0) {
		printf("%d\n", -1);
		return 0;
	}
	
	for (int i = 0; i < N; i++) printf("%d\n", ans[i]);
	
	return 0;
}


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

using namespace std;
typedef long long ll ;
const int N =  1e5 ;
int main()
{
    ll n ;
    cin >> n ;
    int arr[n];
    int x=0 ;
    for(int i = 0 ; i < n ; i++)
    {
        cin >> arr[i] ;
        if(arr[i]==x+1)
        {
            x++;
        }
    }
    if(x==0)
    {
        cout << -1 ;
    }
    else cout <<n-x;
    return 0;
}


Measured memory_bytes: 1024
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

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

  cout << min(N*a, b) << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, K int
	fmt.Scan(&N, &K)
	h := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&h[i])
	}
	sort.Ints(h)

	ans := 1000000000
	for i := 0; i < N-(K-1); i++ {
		t := h[i+K-1] - h[i]
		if t < ans {
			ans = t
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
#include <iostream>
#include <vector>
using namespace std;
const int MAX = 7368791+1;

int main(){
    while(1){
        int m,n;
        cin >> m >> n;
        if(n==0) break;

        vector<bool> v(MAX,false);
        int count=0;
        for(int i=m; ; i++){
            if(count<n){
                if(!v[i]){
                    for(int j=i; j<MAX; j+=i){
                        v[j]=true;
                    }
                    count++;
                }
            }else{
                if(!v[i]){
                    cout << i << endl;
                    break;
                }
            }
        }
    }
    return 0;
}

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

namespace ABC110
{
    class Program
    {
        static long mod = 1000000007;
        static Dictionary<long, int> Factorize(long M)
        {
            Dictionary<long, int> res = new Dictionary<long, int>();
            long i = 2;
            while (M != 1)   
            {
                while (M % i == 0)
                {
                    if (!res.ContainsKey(i))
                    {
                        res[i] = 1;
                    }
                    else
                    {
                        res[i]++;
                    }
                    M /= i;
                }
                i++;
            }
            return res;
        }

        static long Modpow(long a, long n)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n = n >> 1;
            }
            return res;
        }

        static long Modinv(long a)
        {
            return Modpow(a, mod - 2);
        }

        static long Combination(long a, long b)
        {
            long top = 1, bottom = 1;
            for (long i = 1; i <= b; i++)
            {
                top *= a - i + 1;
                bottom *= i;
                top = top % mod;
                bottom = bottom % mod;
            }
            return (top * Modinv(bottom)) % mod;
        }

        public static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int N = int.Parse(s[0]);
            long M = long.Parse(s[1]);
            Dictionary<long, int> d = Factorize(M);
            long res = 1;
            foreach (long a in d.Keys)
            {
                res *= Combination(d[a] + N - 1, d[a]);
                res = res % mod;
            }
            Console.WriteLine(res);
        }
    }
}

Measured memory_bytes: 13152
# C
import numpy as np
N, M = list(map(int, input().split()))
X = np.array(list(map(int, input().split())))

if N >= M:
    re = 0
else:
    X = np.sort(X) # 小さい順に並べる
    diff = np.insert(X[1:], X.size - 1, 0) - X
    re = diff[0:X.size-1].sum()
    diff_sort = np.sort(diff[0:X.size-1])[::-1]
    for i in range(N - 1):
        re -= diff_sort[i]
        
print(re)

Measured memory_bytes: 23064
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(a > b) {
      System.out.println("a > b");
    }else if(a == b) {
      System.out.println("a == b");
    }else {
      System.out.println("a < b");
    }
  }
}

Measured memory_bytes: 26224
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  ll N,K; cin>>N>>K;
  if(K%2==1) cout<<(N/K)*(N/K)*(N/K)<<endl;
  else{
    ll ans=0;
    ans+=(N/K)*(N/K)*(N/K);
    N/=(K/2);
    N=(N+1)/2;
    ans+=N*N*N;
    cout<<ans<<endl;
  }
  
    
  return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main(){
  char ss;
  vector<char> hoge;
  vector<char> hoge2;
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i++){
    hoge.push_back(s[i]);
  }
  hoge2 = hoge;

  sort(hoge.begin(), hoge.end());
  
  hoge.erase(unique(hoge.begin(), hoge.end()), hoge.end());
  if (hoge.size() == 2){
    if (count(hoge2.begin(), hoge2.end(), hoge[0]) == 2 && count(hoge2.begin(), hoge2.end(), hoge[1]) == 2){
      cout << "Yes" << endl;
    }else
    {
      cout << "No" <<endl;
    }
    
  }else{
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] array = new long[n+1];
		array[0] = 2; array[1] = 1;
		for(int i = 2;i <= n;++i){
			array[i] = array[i-1] + array[i-2]; 
		}
		System.out.println(array[n]);
	}
}


Measured memory_bytes: 21588
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def main():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    
    dp = [0] * N
    for i in range(1, N):
        dp[i] = min(abs(h[i]-h[j])+dp[j] for j in range(max(0, i-K), i))
    
    print(dp[-1])
main()

Measured memory_bytes: 14012
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000000+7
#define MEM_SIZE = 1e5+5;


void solve(void)
{
  char X;
  cin>>X;
  cout<<char(X+1)<<endl;

  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // std::cout << std::fixed;
  // std::cout << std::setprecision(8);

  solve();

 
  return 0;
}

Measured memory_bytes: 256
//#pragma GCC         optimize("O3")
#include            <bits/stdc++.h>
#include            <ext/pb_ds/assoc_container.hpp>
#include            <ext/pb_ds/tree_policy.hpp>
#define FastIO      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define pb          push_back
#define mp          make_pair
#define mem(x,i)    memset(x,i,sizeof(x))
#define ff          first
#define ss          second
#define popcount(x) __builtin_popcount(x)
#define all(x)      x.begin(),x.end()
#define Case(t)     for(int ks=1;ks<=t;ks++)
#define fileout     freopen("output.txt","w",stdout)
#define filein      freopen("input.txt","r",stdin)
#define D(x)        cerr<< __LINE__ <<": "<< #x << " = "<<(x) <<'\n';
#define endl        '\n'

using namespace std;
using namespace __gnu_pbds;

using ll  = long long;
using ld  = long double;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;

const int INF    = 0x3f3f3f3f;
const ll LL_INF  = 0x3f3f3f3f3f3f3f3f;
const double PI  = acos(-1);
const double eps = 1e-4;
const int mod    = 1e9+7;
const int mx     = 2e3+5;
template <typename T>  using orderedSet =
    tree<T, null_type, less_equal<T>,
    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key*/

/*------------------------------Graph Moves----------------------------*/
//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

//ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(; b; b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
/*----------------------BitMask-----------------------------------------*/
//inline int setBit(int N,int pos){return N=N | (1<<pos);}
//inline int resetBit(int N,int pos){return N= N & ~(1<<pos);}
//inline bool checkBit(int N,int pos){return (bool) (N& (1<<pos));}

map<pair<int,string>,ll>dp;
int N;
char v[]={'A','C','G','T'};
bool ok(string str)
{
    string c1(str.begin(),str.end()-1);
    string c2(str.begin()+1,str.end());
    if(c1=="AGC" || c1=="ACG" || c1=="GAC") return 0;
    if(c2=="AGC" || c2=="ACG" || c2=="GAC") return 0;
    if(str[0]=='A' && str[2]=='G' && str[3]=='C')return 0;
    if(str[0]=='A' && str[1]=='G' && str[3]=='C')return 0;
    return 1;
}
ll call(int pos,string last3)
{
  //  cout<<pos<<' '<<cur<<endl;
    if(pos==N) return 1;
    if(dp.count({pos,last3})) return dp[{pos,last3}];
    ll &ret=dp[{pos,last3}];
    for(int i=0;i<4;i++)
    {
        string tp =last3+v[i];
        if(ok(tp))
        {
            string send(tp.begin()+1,tp.end());
            ret = (ret+call(pos+1,send))%mod;
        }
    }
    return ret;

}
int main()
{
    cin>>N;
    ll ans=call(0,"TTT");
    cout<<ans<<endl;
}


Measured memory_bytes: 4200
import sys
n = int(input())
s=[]
i=0
if n==0:
  print(0)
  sys.exit()
while n != 0:
  if n%(2**(i+1))!=0:
    a=1
  else:
    a=0
  s.append(a)
  n=n-a*(-2)**i
  i+=1

s.reverse()
m=""
for ss in s:
  m+=str(ss)
print(m)

Measured memory_bytes: 3060
<?php
  $N = trim(fgets(STDIN));
  $input = trim(fgets(STDIN));
  $input = str_replace(array("\r\n","\r","\n"), '', $input);
  $array = explode(" ", $input);
  
  $opeCnt = 0;
  $isEven = true;
  
  while(true){
    for( $i = 0; $i < $N; $i++) {
      if( $array[$i] % 2 == 1) {
        $isEven = false;
        break 2;
      }
    }
    if($isEven){
      for( $i = 0; $i < $N; $i++){
        $array[$i] = $array[$i] / 2;
        $opeCnt++;
      }
    }
  }
  echo $opeCnt / $N;
?>
  

Measured memory_bytes: 3576
#include <stdio.h>

int main(){
 int A,B,K;
  
  scanf("%d",&K);
  scanf("%d %d",&A,&B);
  
  int flag = 0;
  for(int i = K; i <= 1000; i+=K){
    if(A <= i && i <= B){
      flag = 1;
      break;
    }
  }
  
  if(flag == 1){
    printf("OK");
  }else{
    printf("NG");
  }
}

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

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

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int ans = a+b+c - max({a, b, c});
  cout << ans << endl;
}






Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    string S, T; cin >> S >> T;
    T.pop_back();
    cout << (S == T ? "Yes\n" : "No\n");
}

Measured memory_bytes: 3624
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    cout << n / 3 << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int Max=1e5+7;
ll a[Max];
ll temp[Max];
ll n,m,v,p;
bool check(ll x){
    ll cnt=0;
    for(int i=1;i<=n;i++){
        temp[i]=a[i];
    }
    for(int i=1;i<p;i++){
        temp[i]+=m;
        cnt++;
    }
    for(int i=x;i<=n;i++){
        temp[i]+=m;
        cnt++;
    }
    if(cnt>=v){
        return temp[p]<=temp[x];
    }else{
        ll left=1ll*(v-cnt)*m;
        for(int i=p;i<x;i++){
            if(temp[i]>temp[x]){
                return 0;
            }
            ll t=min(temp[x]-temp[i],1ll*m);
            left-=t;
        }
        return left<=0;
    }
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m>>v>>p;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+1+n,greater<ll>());
    ll l=p;
    ll r=n;
    while(l<r){
        ll mid=l+r+1>>1;
        if(check(mid)){
            l=mid;
        }else{
            r=mid-1;
        }
    }
    cout<<l<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<stdlib.h>
using namespace std;

int main(){
	int n,m,l;
	long a[100][100], b[100][100], c[100][100];
	cin>>n>>m>>l;

	//配列初期化
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			a[i][j]=0;
			b[i][j]=0;
			c[i][j]=0;
		}
	}

	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			cin>>a[i][j];
		}
	}
	for(int j=0; j<m; j++){
		for(int k=0; k<l; k++){
			cin>>b[j][k];
		}
	}

	for(int i=0; i<n; i++){
		for(int k=0; k<l; k++){
			for(int x=0; x<m; x++){
				c[i][k]+=a[i][x]*b[x][k];
			}
		}
	}

	for(int i=0; i<n; i++){
		for(int k=0; k<l; k++){
			cout<<c[i][k];
			if(k==l-1) cout<<endl;
			else cout<<" ";
		}
	}

	return 0;



}




Measured memory_bytes: 3348
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();

        sc.close();

        if (a + b > c + d) {
            System.out.println("Left");
        } else if (a + b == c + d) {
            System.out.println("Balanced");
        } else {
            System.out.println("Right");
        }
    }
}


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

int main() {
  int n;
  cin>>n;
  vector<int> x(50010);
  for(int i=1; i<=50000; i++){
    x[i]=(i*1.08);
  }
  for(int i=1;i<=50000; i++){
    if(x[i]==n){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<":("<<endl;
}

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

static const double EPS = 1e-10;

double sol_r(double x1, double y1, double x2, double y2, double x3, double y3) {
	
	double xc, yc; //x,y中心座標
	double a, b, c, d;
	double det;
	double lx1, lx2, lx3;
	double tmp1, tmp2;
	
	a = x1 - x2;
	b = y1 - y2;
	c = x2 - x3;
	d = y2 - y3;
	
	det = a * d - b * c;
	
	lx1 = pow(x1, 2) + pow(y1, 2);
	lx2 = pow(x2, 2) + pow(y2, 2);
	lx3 = pow(x3, 2) + pow(y3, 2);
	
	tmp1 = lx1 - lx2;
	tmp2 = lx2 - lx3;
	
	xc = (1 / (2 * det)) * (d * tmp1 - b * tmp2);
	yc = (1 / (2 * det)) * (-c * tmp1 + a * tmp2);
	
	//r
	return sqrt(pow((x1 - xc), 2) + pow((y1 - yc), 2));
	
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  vector<double> x(n), y(n);
  for (int i = 0; i < n; i++) cin >> x.at(i) >> y.at(i);
  
  double ans = 0;
  
  if (n == 2) {
    ans = sqrt(pow(x[0] - x[1], 2) + pow(y[0] - y[1], 2)) / 2;
  }
  
  for (int i = 0; i < n - 2; i++) {
    for (int j = i + 1; j < n - 1; j++) {
      for (int k = j + 1; k < n; k++) {
        vector<double> a(3);
        a[0] = pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2);
        a[1] = pow(x[j] - x[k], 2) + pow(y[j] - y[k], 2);
        a[2] = pow(x[k] - x[i], 2) + pow(y[k] - y[i], 2);
        sort(a.begin(), a.end());
        if (a[2] - (a[0] + a[1]) > EPS) {
          ans = max(ans, sqrt(a[2]) / 2);
        }
        else {
          ans = max(ans, sol_r(x[i], y[i], x[j], y[j], x[k], y[k]));
        }
      }
    }
  }
  
  cout << fixed << setprecision(10) << ans << '\n';
}

Measured memory_bytes: 3836
/*input
-10 -20
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int main(){
	IOS;
	int a,b;
	cin>>a>>b;
	int ans=0;
	if(abs(a)<abs(b)){
		if(a<0) ans++,a=-a;
		ans+=abs(b)-a;
		if(b<0) ans++; 
	}
	else if(abs(a)==abs(b)){
		if(a!=b) ans=1;
		else ans=0;
	}
	else{
		if(a>0) ans++,a=-a;
		ans+=-a-abs(b);
		if(b>0) ans++;
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        for (int i = a; i <= b; i++) {
            if (i % k == 0) {
                System.out.println("OK");
                return;
            }
        }
        System.out.println("NG");
    }

}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = 1001002003004005006ll;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	rep(i, n) cin >> v[i];
	int r = min(n, k);
	ll ans = -inf;
	rep(a, r + 1)rep(b, r + 1) {
		if (a + b > r) continue;
		ll tot = 0;
		priority_queue<int, vector<int>, greater<int>> pq;
		rep(i, a) {
			tot += v[i];
			if(v[i] < 0) pq.push(v[i]);
		}
		rrep(i, b + 1) {
			tot += v[n - i];
			if(v[n - i] < 0)pq.push(v[n - i]);
		}
		rep(i, k - (a + b)) {
			if (!pq.size()) break;
			int p = pq.top(); pq.pop();
			tot -= p;
		}
		maxs(ans, tot);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  string s;
  cin >> s;
  int ans = 0;
  int count = 0;
  rep (i, s.size()) {
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
      count++;
    } else {
      ans = max(ans, count);
      count = 0;
    }
  }
  ans = max(ans, count);
  P(ans);

  return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <map>
using namespace std;
string str;
int n;
int main() {
	cin >> n >> str;
	for (size_t i = 0;i < str.size();i++) printf("%c",(str[i]-'A'+n)%26+'A');
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define FOR(i, first, last) for (int i = (first); i < (last); ++i)
#define REP(i, n) FOR(i, 0, n)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) std::cerr << #x << " = " << (x) << std::endl;

inline int to_int(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string to_string(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

typedef unsigned long long ull;
typedef unsigned long ul;

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

  set<ull> s;
  while(N--){
    ull n;
    cin>>n;
    if(s.find(n) == s.end()) s.insert(n);
    else s.erase(n);
  }
  cout<<s.size()<<endl;

  return 0;
}


Measured memory_bytes: 4992
#include <stdio.h>


int main (){

int dataset=0;
int year[100];
int month[100];
int date[100];
int input=0;
int result[100]={};
int dataset_num=0;
int dataset_num2=0;
int count=0;
int buf;


scanf("%d",&dataset);
dataset_num = dataset;
dataset_num2 = dataset;


while( dataset != 0 ){
	scanf("%d %d %d",&year[input],&month[input],&date[input]);
	dataset--;
	input++;
}


while(dataset_num != 0){

	if(year[count]% 3 == 0){

		/*??\?????????????????????*/
		while ( 1 ){
			result[count]++;
			date[count]++;
	
			if(date[count]==21){
				month[count]++;
				break;
			}
		}	

		/*??????????????\?????????????????????*/
		while ( month[count] != 11){
			result[count] += 20;
			month[count]++;
		}	
	}

	else{

		if(month[count] % 2 == 1){
			buf = 21 - date[count];
			result[count] += buf;
				
		}

		else if(month[count] % 2 == 0 ){
			buf = 20 - date[count];
			result[count] += buf;
		}

		month[count]++;
		/*??????????????\?????????????????????*/
		while ( month[count] != 11){

			if(month[count] % 2 == 1){
				result[count] += 20;
			}

			else if(month[count] % 2 == 0 ){
				result[count] += 19;
			}
			month[count]++;
		}
	}

	year[count]++;
	while(1){

		if(year[count]==1000){
			break;
		}
		if(year[count] % 3 == 0){

			result[count] += 200;
		}
		else{
			result[count] += 195;
		}
		year[count]++;

		

	}

	count++;
	dataset_num--;
}

count=0;
while(1){
	printf("%d\n",result[count] );
	count++;

	if(count == dataset_num2){
		break;
	}

}
	

	return 0;
}

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

struct Operand {
    int l;
    int r;
};

Operand popOperand(vector<int> &vec) {
    int r = vec.back();
    vec.pop_back();
    int l = vec.back();
    vec.pop_back();

    Operand op;
    op.l = l;
    op.r = r;
    return op;
}

int main() {
    vector<int> vec;
    string s;
    while (cin >> s) {
        Operand op;
        int result;
        if (s == "+") {
            op = popOperand(vec);
            result = op.l + op.r;
            vec.push_back(result);
        } else if (s == "-") {
            op = popOperand(vec);
            result = op.l - op.r;
            vec.push_back(result);
        } else if (s == "*") {
            op = popOperand(vec);
            result = op.l * op.r;
            vec.push_back(result);
        } else {
            vec.push_back(stoi(s));
        }
    }
    cout << vec.back() << endl;
}

Measured memory_bytes: 3168
#include<cstdio>
using namespace std;
#define N 17
#define mod 1000000007
int dp[1<<N],fr[1<<N],ifr[1<<N],n,m,v[N],tp[1<<N];
int pw(int a,int b){int as=1;while(b){if(b&1)as=1ll*as*a%mod;a=1ll*a*a%mod;b>>=1;}return as;}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)scanf("%d",&v[i]);
	dp[0]=1;
	fr[0]=ifr[0]=1;
	for(int i=1;i<=1<<n;i++)fr[i]=1ll*fr[i-1]*i%mod,ifr[i]=pw(fr[i],mod-2);
	for(int i=m;i>=1;i--)
	for(int j=(1<<n)-1;j>=0;j--)
	for(int k=1;k<=n;k++)if(!(j&(1<<k-1)))
	if((1<<n)-j-v[i]-(1<<k-1)+1>=0)
	dp[j|(1<<k-1)]=(dp[j|(1<<k-1)]+1ll*dp[j]*fr[(1<<n)-j-v[i]]%mod*ifr[(1<<n)-j-v[i]-(1<<k-1)+1]%mod*(1<<k-1))%mod;
	int as=0;tp[0]=1;
	for(int i=0;i<1<<n;i++)tp[i]=tp[i>>1]*(i&1?-1:1),as=(as+1ll*tp[i]*dp[i]%mod*fr[(1<<n)-i-1]%mod*(1<<n))%mod;
	printf("%d\n",(as+mod)%mod);
}//

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

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

  vector<int> mochi(n);

  for (int i = 0; i < n; i++) {
    cin >> mochi.at(i);
  }

  sort(mochi.begin(), mochi.end());

  int mochi_dan = 1;
  for (int i = 1; i < n; i++) {
    if (mochi.at(i - 1) != mochi.at(i)) {
      mochi_dan++;
    }
  }

  cout << mochi_dan << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int n, height[101000], way[101000];
inline int cal(int i, int j){
	return height[i] - height[j] < 0 ? height[j] - height[i] : height[i] - height[j];
}
int main(){
	scanf("%d", &n);
	for( int i = 1; i <= n; ++i ){
		scanf("%d", &height[i]);
		way[i] = 0x3f3f3f3f;
	}
	way[1] = 0;
	way[2] = cal(1, 2);
	for( int i = 3; i <= n; ++i )
		way[i] = min(way[i], min(way[i-1]+cal(i-1, i), way[i-2]+cal(i-2, i)));
	printf("%d\n", way[n]);
	return 0;
}

Measured memory_bytes: 1024
import sys
for line in sys.stdin:
    a, b, c, d, e, f = map(int, line.rstrip('\n').split(' '))
    x = int((e*c - b*f) * 1000 / (a*e - b*d)) / 1000.0
    y = int((a*f - d*c) * 1000 / (a*e - b*d)) / 1000.0
    print '%.3f %.3f' % (x, y)

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
    i64 n, m;
    cin >> n >> m;
    vector<pair<i64, i64>> d(n);
    for (i64 i = 0; i < n; i++)
        cin >> d[i].first >> d[i].second;
    sort(d.begin(), d.end());
    i64 ans = 0, cnt = 0;
    for (pair<i64, i64> t : d)
    {
        if (cnt + t.second < m)
            ans += t.first * t.second;
        else
        {
            ans += t.first * max(0LL, (m - cnt));
            break;
        }
        cnt += t.second;
    }
    cout << ans << endl;
    return 0;
}


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

signed main() {
  int N;
  cin >> N;
  
  int ans = 0;
  int count;
  for( int i = 1; i <= N; i+=2 ){
    count = 0;
    for( int j = 1; j <= i; j++ ){
      if( i % j == 0 ) count++;
    }
    if( count == 8 ){
      ans++;
    }
  }
  cout << ans << endl;
}

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

const int M = 2;
const int mod = 998244353;
ll ans = 0;

int main(void) {
    int N,K; cin >> N >> K;
    vector<int> l(N+10,0);
    vector<int> r(N+10,0);
    vector<ll> dp(N+10,0);
    dp[1] = 1;
    vector<ll> dpsum(N+10,0);
    dpsum[1] = 1;
    for(int i=1; i<=K; i++) cin >> l[i] >> r[i];

    
    for(int i=2; i<=N; i++) {
        for(int j=1; j<=K; j++) {
            int li = i- r[j];
            if(li<=0) li = 1;
            int ri = i - l[j];
            if(ri<0) continue;
            dp[i] += dpsum[ri] - dpsum[li-1];
        }
        dp[i]%=mod;
        if(dp[i]<0) dp[i]+=mod;
        dpsum[i] = dpsum[i-1] + dp[i];
    }
    
    cout << dp[N] << endl;
}

Measured memory_bytes: 7972
N, C = map(int, input().split())

STC = []
for i in range(N):
    s, t, c = map(int, input().split())
    STC.append((s, t, c))

STC.sort()

rec = []
for i in range(N):
    found = False
    for j in range(len(rec)):
        if (rec[j][0] < STC[i][0] and rec[j][1] != STC[i][2]) or (rec[j][0] <= STC[i][0] and rec[j][1] == STC[i][2]):
            found, rec[j] = True, (STC[i][1], STC[i][2])
            break
    if not found:
        rec.append((STC[i][1], STC[i][2]))

print(len(rec))


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

using namespace std;

const int maxn = 100010;

int n,res,need[maxn];
vector<int> g[maxn];

void visit(int u,int pa) {
    for (int j=0;j<g[u].size();j++) {
        int v = g[u][j];
        if (v!=pa) {
            if (g[v].size() > 2) {
                need[v]++;
                return;
            }
            visit(v,u);
        }
    }
}

int main() {
    //freopen("in.txt","r",stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n;
    for (int i=1;i<n;i++) {
        int x,y;
        cin>>x>>y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
   // for (int j=0;j<g[4].size();j++) cout<<g[4][j]<<" ";
    for (int i=0;i<n;i++)
        if (g[i].size()==1) visit(i,-1);
    for (int i=0;i<n;i++) res+=max(need[i]-1,0);
    cout<<max(res,1)<<endl;
}


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

int main()
{
    char s[1000], c[10];
    int sum = 0;
    cin >> c;
    for (unsigned i = 0; i < strlen(c); i++)c[i] = tolower(c[i]);
    while (1)
    {
        cin >> s;
        if (strcmp(s, "END_OF_TEXT") == 0)break;
        for (unsigned i = 0; i < strlen(s); i++)s[i] = tolower(s[i]);
        if (strcmp(s, c) == 0)sum++;
    }
    cout << sum << endl;
    return 0;
}

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

using namespace std;

int main() {
  string S, T;
  cin >> S >> T;
  int S_size = S.size(), T_size = T.size();
  
  int ans = 1000;
  for (int i = 0; i <= S_size - T_size; i++) {
    int miss_count = 0;
    for (int j = 0; j < T_size; j++) {
      if (S[i+j] != T[j]) {
        miss_count++;
      }
    }
    ans = min(ans, miss_count);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  cout << ((n >= 30) ? "Yes" : "No") << endl;
}


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

const int MAX_N = 1e5+1;
int N, K;
pair<int, int> A[MAX_N]; //taste, type

set<int> used;

void solve()
{
	sort(A, A+N);
	reverse(A, A+N);
	priority_queue<ll, vector<ll>, greater<ll>> que; //min que
	ll ans = 0;
	ll sum = 0;
	ll sc = 0;
	for(int i=0;i<N;++i){
		if(used.count(A[i].second)){
			if(i >= K) continue;
			que.emplace(A[i].first);
		}else{
			if(i >= K){
				if(que.empty()) break;
				sum -= que.top();
				que.pop();
			}
			used.emplace(A[i].second);
			sc++;
		}
		sum += A[i].first;
		ans = max(ans, sum + sc * sc); 
	}
	cout << ans << endl;
}

int main()
{
	cin >> N >> K;
	for(int i=0;i<N;++i){
		cin >> A[i].second >> A[i].first;
	}
	solve();
	return 0;
}


Measured memory_bytes: 4348
program main
    use iso_fortran_env
    implicit none
    integer(int64) :: n, q
    integer(int64) :: an(100000)
    integer(int64),allocatable :: a(:), b(:), c(:)
    integer(int64) :: i
    integer(int64) :: s

    read *, n
    allocate(a(n))
    read *, (a(i), i = 1, n)
    read *, q
    allocate(b(q), c(q))
    read *, (b(i), c(i), i = 1, q)

    an = 0
    do i = 1, n
        an(a(i)) = an(a(i)) + 1
    enddo

    s = sum(a)

    do i = 1, q
        s = s + (c(i) - b(i)) * an(b(i))
        an(c(i)) = an(c(i)) + an(b(i))
        an(b(i)) = 0
        print *, s
    enddo

end program main

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

int main() {
    int N, D;
    cin >> N >> D;
    int X[N][D];
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < D; j++)
        {
            X[i][j] = 0;
            cin >> X[i][j];
        }
        
    }
    
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            long double dist = 0;
            for (int k = 0; k < D; k++)
            {
                dist += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }
            dist = sqrt(dist);
            if (floor(dist) == dist)
            {
                ans++;
            }
            

        }
        
    }
    cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define max4(a,b,c,d) max(max(a,d),max(b,c))
#define MAX   1e9
#define MIN  -1e9
#define PI 3.14159265358979
#define eps 1e-9
typedef map<int,int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(long long int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(long long int i = a; i >= (n); --i)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define trav(a, x) for(auto& a : x)
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl
#define inp(a,start,len) for(long long int i = start;i < len;i++) cin>>a[i]
struct Interval{ll start,end;};
bool compare(Interval i1, Interval i2) {return (i1.start < i2.start);}

ll mod = 1000000007;
ll dp[2001][2001];// dp[length][sum]

int main(){
	fio;
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ll T = 1;
	// cin>>T;
	while(T--){
		ll S;
		cin>>S;
		fill(dp,0);
		repA(i,3,S){
			dp[1][i] = 1;
		}
		ll maxLen = (S/3);
		repA(i,2,maxLen){
			ll c = 0;
			repA(j,3,S){
				dp[i][j] = (dp[i][j-1] + dp[i-1][c])%mod;
				c++;
			}
		}
		ll ans = 0;
		repA(i,1,maxLen)
		ans=(ans+dp[i][S])%mod;
		cout<<ans;
	}
	return 0;
}


Measured memory_bytes: 34956
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const ll Mod = 1e9 + 7;

ll n,m;
ll G[1010][1010];

ll Dp[1010][1010];

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

    for(ll i=1;i<=n;i++)
        for(ll j=1;j<=m;j++)
            scanf(" %c",&G[i][j]);

    Dp[n][m] = 1;

    for(ll i=n;i>0;i--)
        for(ll j=m;j>0;j--)
            if(G[i][j]=='.')
                Dp[i][j] += ( Dp[i+1][j] + Dp[i][j+1] )%Mod;

    cout<<Dp[1][1];
}


Measured memory_bytes: 16128
from itertools import accumulate

n,k=map(int,input().split())
p=list(map(int,input().split()))

exp={}
cum=[]

ans=0
cnt=0
for i in range(1,1001):
    sum=0
    for j in range(1,i+1):
        sum+=j
    exp[i]=sum/i

for i in p:
    cum.append(exp[i])

cumsum=list(accumulate(cum))
cumsum.insert(0,0)

for i in range(n-k+1):
    tmp = cumsum[i+k] - cumsum[i]
    if ans <= tmp:
        ans = tmp

print(ans)


Measured memory_bytes: 81288
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

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

	int n = 0;
	for (int i = 0; i < 26; i++) {
		for (int j = 0; j < 16; j++) {
			if ((4*i + 7*j) == x)n++;
		}
	}
	
	if (n > 0)cout << "Yes";
	else cout << "No";
}


Measured memory_bytes: 256