akhauriyash/Code-Regression huggingface dataset:
/**Bismillahir Rahmanir Rahim.**/

/**
 *    author:  nasimnoob
**/

#include<bits/stdc++.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<cstring>
#include<cstdio>

using namespace std;

//----------------------------------------------------------//

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

//-----------------------------------------------------------//
#define      test                       int t; cin>>t;  while(t--)

#define      cube(x)                    (x*x*x)
#define      sqr(x)                     (x*x)

#define      sc1(x)                     scanf("%lld",&x);
#define      sc2(x,y)                   scanf("%lld %lld", &x, &y)
#define      scf1(x)                    scanf("%lf",&x)
#define      scf2(x,y)                  scanf("%lf %lf", &x, &y)

#define      srev                       reverse(s.begin(),s.end())
#define      sortstr                    sort(s.begin(), s.end());
#define      gtl(x)                     getline(cin, (x))

#define      PI                         acos(-1) // 3.1415926535897932
#define      MIN                        9999999

#define      Faster                     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

//scanf("%[^\n]%*c", str);
//sort(s,s+n,greater<int>());
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);


//-----------------------------------------------------------//

int main()
{
    Faster;

    int a;
    cin >> a;
    int sum =  a + sqr(a) + cube(a);
    cout << sum << endl;
    return 0;
}






Measured memory_bytes: 3632
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define REP(i,n) for(i=0;i<(n);++i)

using namespace std;

int main() {
	int N, i, j;
	vector<string> str(100);
	char end;
	cin >> N;
	cin >> str[0];
	end = str[0][str[0].length() - 1];
	FOR(i, 1, N) {
		cin >> str[i];
		if (end != str[i][0]) {
			cout << "No" << endl;
			return 0;
		}
		REP(j, i) {
			if (str[j] == str[i]) {
				cout << "No" << endl;
				return 0;
			}
		}
		end = str[i][str[i].length() - 1];
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
// __uint128_t
//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}




int main(){
    ll N; cin >> N;
    if(isPrime(N)){
        cout << 1 << endl;
        return 0;
    }
    map<ll, ll> M;
    for(ll i = 2; i <= min((ll)1e6+5, N); i++ ){
        if(!isPrime(i)) continue;
        //cout << i << endl;
        bool flag = false;
        while(N % i == 0){
            N /= i;
            M[i]++;
            flag = true;
        }
        if(flag && isPrime(N)) {
            M[N]++;
            N = 1;
            break;
        }
        else if(N == 1) break;
    }
    ll ans = 0;
    if(N != 1){
        cout << N << endl;
        if(ceill(sqrt(N)) * ceill(sqrt(N)) == N) ans++;
        else if(isPrime(N)) ans++;
        else ans+=2;
        
    }
    for(auto m : M){
        ll cnt = 1;
        while(1){
            if(m.second >= cnt) {
                m.second -= cnt;
                cnt++;
                ans++;
            }
            else break;
            
        }
    }
    cout << ans << endl;


}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin >> A >> B;
  int ans = 0;
  for(int i = A; i <= B; i++){
    string s = to_string(i);
    string k = s;
    reverse(s.begin(), s.end());
    if(s==k){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
 
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
 
long double a, b, x;
 
void input() {
    cin >> a >> b >> x;
}
 
long double f(long double a, long double b, long double theta) {
    if(theta > PI / 2.0 - EPS) {
        return 0.0;
    }
    long double ret;
    if(a * tan(theta) <= b) {
        ret = a * a * b - a * a * a * tan(theta) / 2.0;
    } else {
        ret = b * b / tan(theta) * a / 2.0;
    }
    return ret;
}
 
void solve() {
    input();
    long double ok = PI / 2.0;
    long double ng = 0.0;
    for(int _ = 1; _ <= 100000; _++) {
        long double mid = (ok + ng) / 2.0;
        if(f(a, b, mid) < x) ok = mid;
        else ng = mid;
    }
    cout << fixed << setprecision(10) << ok / PI * 180 << endl;
    return;
}
 
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
void trace(int A[],int N)
{
    int i;
    for( i=0;i<N;i++)
    {
        if(i>0)printf(" ");
        printf("%d",A[i]);
        
    }
    printf("\n");
    
    
}

void insertionsort(int A[], int N){
    int j,i,v;
    for(i=1;i<N;i++)
    {
        v=A[i];
        j=i-1;
        while(j>=0 &&A[j]>v){
        A[j+1]=A[j];
        j--;
    }
    A[j+1]=v;
    trace(A,N);
        
    }
     }   
        
        int main(){
            int N,i,j;
            int A[100];
            
            scanf("%d",&N);
            for(i=0;i<N;i++)scanf("%d",&A[i]);
            trace(A,N);
            insertionsort(A,N);
            return 0;
            
            
            
            
        }


Measured memory_bytes: 1996
package main

import (
  "fmt"
)

var lucas = make([]int, 87) 
func createLucas() {
  lucas[0] = 2
  lucas[1] = 1
  for i := 2; i < 87; i++ {
    lucas[i] = lucas[i-1] + lucas[i-2]
  }
}

func main() {
  createLucas()
  var n int 
  fmt.Scan(&n)
  fmt.Println(lucas[n])
  
}

Measured memory_bytes: 512
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <fstream>

using namespace std;
using ll=long long;

#define PRI(n) cout << n <<endl;
#define PRI2(n, m) cout << n << " " << m << endl;
#define PRI3(n, m, o) cout << n << " " << m<< " " << o << endl;

#define REP(i, n)  for(int i = 0; i < (int)n; ++i)
#define REPInv(i, n)  for(int i = n-1; i >= 0; --i)

#define FOR(i, t, n)  for(int i = t; i <= (int)n; ++i)
#define FORInv(i, t, n)  for(int i = t; i >= (int)n; --i)

const char alphabet[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                           's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
const ll MOD = 1e9 + 7;

ll GCD(ll a, ll b) {
    if (b == 0)return a;
    return GCD(b, a % b);
}

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

ll nCr(int n, int r) {
    vector<ll> C(r + 1);
    C[0] = 1;
    FOR(i, 1, n) FORInv (j, min(i, r), 1)C[j] = (C[j] + C[j - 1]) % MOD;
    return C[r];
}

struct edge {
    int to, cost;
    bool flag = false;
};
double N, M;
int A;
string S;
vector<edge> X[100010];
bool B[100010];
int D[100010];

int main() {
    cin >> S;
    char c = S[0];
    int cnt = 0;
    FOR(i,1, S.length()-1) {
        if(c == S[i])continue;
        c = S[i];
        cnt ++;
    }
    PRI(cnt)
    return 0;

}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll LL_INF = 1e17 + 10;
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 1e6 + 5;

ll dp[MAXN];
ll f[MAXN], f_sum[MAXN];

void solve(){
	int n, h, d;
	scanf("%d%d%d", &n, &h, &d);
	f[0] = 1, f_sum[0] = 0;
	REPN(i, 1, n) {
		f[i] = (f[i - 1] * i) % MOD;
		f_sum[i] = (f_sum[i - 1] + f[i]) % MOD;
	}
	dp[0] = f[n];
	ll dp_sum = f[n];
	ll ans = 0ll;
	REP(i, 1, h) {
		dp[i] = (dp_sum * f_sum[n]) % MOD;
		dp_sum = (dp_sum + dp[i]) % MOD;
		if (i >= d) {
			dp_sum = (dp_sum + MOD - dp[i - d]) % MOD;
		}
	}
	/*REP(i, 0, h) {
		printf("%lld\n", dp[i]);
	}*/
	cout << dp_sum << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 23680
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, V: "List[int]", C: "List[int]"):
    ans = 0
    for v, c in zip(V, C):
        if v-c > 0:
            ans += v-c
    print(ans)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    V = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    C = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, V, C)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cout << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

namespace std {
template <typename A, typename B> struct hash<pair<A, B>> {
  size_t operator()(const pair<A, B> &p) const {
    const static size_t rand_seed = random_device()() + 0x9e3779b9;
    size_t seed = rand_seed;
    seed ^= hash<A>()(p.first) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
    seed ^= hash<B>()(p.second) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
    return seed;
  }
};
}

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(void) {}
  Edge(int src, int dst) : src(src), dst(dst) {}
  Edge(int src, int dst, Weight weight) : src(src), dst(dst), weight(weight) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void edges_to_graph(Graph &graph, const Edges &edges, const int vertices, const bool directed = true) {
  graph.clear(), graph.resize(vertices);
  for (const auto &e : edges) graph[e.src].emplace_back(e);
  if (!directed) for (const auto &e : edges) graph[e.dst].emplace_back(Edge(e.dst, e.src, e.weight));
}

void dfs(Graph &g, int v, int p, int prev_col, unordered_map<pair<int, int>, int> &cmap) {
  int col = 0;
  for (const auto &e : g[v]) {
    if (e.dst == p) continue;
    ++col;
    if (col == prev_col) ++col;
    cmap[{ v, e.dst }] = col;
    dfs(g, e.dst, v, col, cmap);
  }
}

void bfs(Graph &g, unordered_map<pair<int, int>, int> &cmap) {
  queue<tuple<int, int, int>> que;
  que.push(make_tuple(0, -1, 0));
  while (!que.empty()) {
    int v = get<0>(que.front()), p = get<1>(que.front()), pc = get<2>(que.front());
    que.pop();
    int col = 1;
    for (const auto &e : g[v]) {
      if (e.dst == p) continue;
      if (col == pc) ++col;
      cmap[{ v, e.dst }] = col;
      que.push(make_tuple(e.dst, v, col));
      ++col;
    }
  }
}

Graph graph;
int main(void) {
  int n;
  cin >> n;
  Edges edges(n - 1);
  rep (i, n - 1) {
    int a, b;
    cin >> a >> b;
    edges[i] = {--a, --b, 0};
  }
  edges_to_graph(graph, edges, n, false);
  int maxi = 0;
  rep (i, n) maxi = max(maxi, (int)graph[i].size());
  unordered_map<pair<int, int>, int> cmap;
  dfs(graph, 0, -1, 0, cmap);
  // bfs(graph, cmap);
  cout << maxi << "\n";
  rep (i, n - 1) cout << cmap[{ edges[i].src, edges[i].dst }] << "\n";
  return 0;
}

Measured memory_bytes: 13860
#include <stdio.h>
#include <string.h>
int main (){
int ha,b[100]={0},c,d,k=0,i,n,sum=0,j;
scanf ("%d%d%d",&c,&d,&n);
for (i=0;i<d;i++){
scanf ("%d",&b[i]);
}
for (j=0;j<c;j++){
for (i=0;i<d;i++){
scanf ("%d",&ha);
  sum=sum+(ha*b[i]);

}  
sum = sum +n;

  if (sum>0){
k++;
sum=0;
ha=0;
}
  sum=0;
}
printf ("%d",k);
return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
#define Max 1000001
#define inf INT_MAX
#define llinf LONG_LONG_MAX
#define rep(i,a,b) for(i=a;i<=b;i++)
#define rrep(i,a,b) for(i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pb push_back
#define pf push_front
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979311599796346854418516159057617187500
const ll N=1e5+5,mod=1000000007;
ll f(ll n)
{
	ll ans=0;
	while(n)
	{
		n/=10;
		ans++;
	}
	return ans;
}
signed main()
{
    fast;
    ll pro=1,temp,t,n,m,k,i,j,l,r,mid,x,y,z,rem,carry=0,ind,ans=0,mx=-llinf,mn=llinf,cnt=0,curr=0,prev,sum=0,flag=1,i1=-1,i2=-1;
    string s;
    cin>>s;
    n=s.length();
    ll L[n+1],R[n+1];
    x=y=0;
    rrep(i,n-1,0)
    {
    	if(s[i]=='L')
    	{
    		ind=i;
    	}
    	L[i]=ind;
    }
    rep(i,0,n-1)
    {
    	if(s[i]=='R')
    	{
    		ind=i;
    	}
    	R[i]=ind;
    }
    ll val[n]={0};
    rep(i,0,n-1)
    {
    	if(s[i]=='R')
    	{
    		ind=L[i];
    		x=abs(i-ind);
    		if(x & 1)
    		{
    			val[ind-1]++;
    		}
    		else
    		{
    			val[ind]++;
    		}
    	}
    	else
    	{
    		ind=R[i];
    		x=abs(ind-i);
    		if(x & 1)
    		{
    			val[ind+1]++;
    		}
    		else
    		{
    			val[ind]++;
    		}
    	}
    }
    rep(i,0,n-1)
    {
    	cout<<val[i]<<' ';
    }
    cout<<endl;
	return 0;
} 

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

int weight[105], value[105];
int dp[100100];

#undef int
int main()
{
#define int long long
    int n, i, j, k, curr, m, ans;
    int tc;
    int w;
    scanf("%d %d",&n,&w);
    for(i=1;i<=n;i++)
    {
        scanf("%lld %lld",&weight[i], &value[i]);
    }
    for(i=1;i<=100000;i++)
        dp[i] = 1e15;
    dp[0] = 0;
    for(i=1;i<=n;i++)
    {
        for(j=100000-value[i];j>=0;j--)
        {
            dp[j+value[i]] = min(dp[j+value[i]], dp[j] + weight[i]);
        }
    }
    for(i=100000;i>=0;i--)
    {
        if(dp[i] <= w)
        {
            printf("%d\n",i);
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 1024
import math

N = int(input())
# A = [int(x) for x in input().split()]


C = [1]
for i in range(math.floor(math.log(N,9)) + 2):
    if i !=0 :
        C.append(9 ** i)
for i in range(math.floor(math.log(N,6)) + 2):
    if i != 0:
        C.append(6 ** i)


INF = 10**10
dp = [INF] * (N+1)
dp[0] = 0

for i in range(1,N+1):
    for c in C:
        if i - c >= 0:
            dp[i] = min(dp[i], dp[i - c] + 1)

print(dp[N])



Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    string s;
    int n;
    cin >> n >> s;
    int max = 0;
    int ans = 0;
    rep(i,n){
        if(s[i] == 'I'){
            ans++;
            if(ans > max) max = ans;
        }else{
            ans--;
        }
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 3580
ONE = '1'.freeze
MOD = (10**9) + 7

N, K = gets.split(" ").map(&:to_i)

def inv(x)
    res = 1 # 最終的に x^(MOD-2) になる変数です
    beki = x # x^2^n を格納する変数です
    # MOD-2の２進数展開を下位のbitから見ていきます。
    (MOD - 2).to_s(2).reverse.chars do |digest|
      # bitが立っている <=> digest == ONE 
      # なら resにbekiを掛けます。
      # ここで、掛け算は計算の都度MODを取れます
      res = (beki * res) % MOD if digest == ONE
      # 次のループに備えて、自乗を計算します。
      # 計算の都度MODを取れます(とても大事なので二回言います)
      beki = (beki * beki) % MOD
    end
    res
  end

  #順列
def fact(s, e)
    (s..e).reduce(1) { |r, i| (r * i) % MOD }
end

#組み合わせ
def nCk(n, k)
    (fact(k + 1, n) * inv(fact(1, n - k) % MOD)) % MOD
end

K.times do |i|
    if (N - K) >= i 
    puts nCk(N - K + 1, i + 1) * nCk(K - 1, i) % MOD
    else
        puts 0
    end
end


Measured memory_bytes: 1788
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#

"""
GC027 C
"""

n,m = map(int,input().split())
s = bytes(input(),'utf-8')
ali = [0 for i in range(n)]
bli = [0 for i in range(n)]
import array as ar
remain = ar.array('b',[1 for i in range(n)])
from collections import defaultdict
graphAB = defaultdict(list)

for i in range(m):
    u,v=map(int,input().split())
    graphAB[u].append(v)
    graphAB[v].append(u)



def incrementAB(node,adj):
    if s[adj-1] == 65:
        ali[node-1]+=1
    if s[adj-1] == 66:
        bli[node-1]+=1

def decrementAB(node,adj):
    if s[adj-1] == 65:
        ali[node-1]-=1
    if s[adj-1] == 66:
        bli[node-1]-=1


def adjAB(node):
    if ali[node-1] and bli[node-1]:
        return(True)
    else:
        return(False)

graphvers = set(graphAB.keys())
visitset = set()
for i in range(1,n+1):
    if not i in graphvers:
        remain[i-1] = 0
    else:
        for j in graphAB[i]:
            incrementAB(i,j)
        if not adjAB(i):
            visitset.add(i)
            remain[i-1] = 0

#print(s)
while bool(visitset):
    i = visitset.pop()
    for j in filter(lambda x:remain[x-1],graphAB[i]):
        #print('loop')
        decrementAB(j,i)
        if not adjAB(j):
            visitset.add(j)
            remain[j-1] = 0

if set(remain)=={0}:
    print('No')
else:
    print('Yes')





Measured memory_bytes: 56968
#include <iostream>
using namespace std;
int main(void){

    int E, year;
    cin >> E >> year; //E:0 西暦 1:明治 2:大正 3:昭和 4:平成
    if(E == 0){
        if(year>=1868 && year<=1911){ //明治で出力
            cout << "M" << year-1867 << endl;
        }
        else if(year>=1912 && year<=1925){ //大正で出力
            cout << "T" << year-1911 << endl;
        }
        else if(year>=1926 && year<=1988){ //昭和で出力
            cout << "S" << year-1925 << endl;
        }
        else if(year>=1989 && year<=2016){ //平成で出力
            cout << "H" << year-1988 << endl;
        }
    }
    else if(E == 1){
        cout << year+1867 << endl;
    }
    else if(E == 2){
        cout << year+1911 << endl;
    }
    else if(E == 3){
        cout << year+1925 << endl;
    }
    else if(E == 4){
        cout << year+1988 << endl;
    }
    return 0;
}

/*
　入力の値によって場合分けをする。
*/



Measured memory_bytes: 3116
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
using namespace std;

int main() {
    int a, b, c; cin >> a >> b >> c;
    if (b - a == c - b) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

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

using namespace std;

int main () {
	int n;
	cin >> n;
	vector <int> dp(n + 1);
	for (int i = 1; i <= n; i++) {
		int cnt = 0;
		for (int j = 0; j < 20; j++)
			if (i & (1 << j)) cnt++;
		dp[i] = dp[i % cnt] + 1;
	}
	int modulo = 0;
	vector <int> x(n);
	for (int i = 0; i < n; i++) {
		char c;
		cin >> c;
		x[i] = c - '0';
		if (x[i]) modulo++;
	}
	reverse(x.begin(), x.end());
	int modulo1 = modulo - 1;
	int modulo2 = modulo + 1;
	if (modulo1 <= 0) modulo1 = 1;
	vector <int> p1(n);
	vector <int> p2(n);
	p1[0] = 1 % modulo1;
	p2[0] = 1 % modulo2;
	for (int i = 1; i < n; i++) {
		p1[i] = p1[i - 1] * 2 % modulo1;
		p2[i] = p2[i - 1] * 2 % modulo2;
	}
	int sum1 = 0;
	int sum2 = 0;
	for (int i = 0; i < n; i++) {
		sum1 = (sum1 + p1[i] * x[i]) % modulo1;
		sum2 = (sum2 + p2[i] * x[i]) % modulo2;
	}
	vector <int> ans(n);
	for (int i = 0; i < n; i++) {
		if (x[i] == 0) {
			int tmp = sum2;
			tmp = (tmp + p2[i]) % modulo2;
			ans[i] = 1 + dp[tmp];
			continue;
		}
		if (modulo == 1) {
			ans[i] = 0;
			continue;
		}
		int tmp = sum1;
		tmp = (tmp - p1[i] + modulo1) % modulo1;
		ans[i] = 1 + dp[tmp];
	}
	reverse(ans.begin(), ans.end());
	for (auto &now : ans)
		cout << now << '\n';
	return 0;
}

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

int main()
{
  unsigned long long n, a, b;
  cin >> n >> a >> b;
  if(a + b == 0)
  {
    cout << 0 << endl;
    return 0;
  }
  
  unsigned long long cnt = (n / (a + b)) * a;
  cnt += (n % (a + b) >= a) ? a : n % (a + b);
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3632
//K-OS WITH THE OCDE

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

#include <iostream>
#include <numeric>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <deque>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <climits>

using namespace std;

typedef long long int ll;
typedef long double db;


#define TEST ll t; cin>>t; while(t--)
#define vell vector<ll>
#define pl pair<ll,ll>
#define all(v) v.begin(),v.end()
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define dbg(x)  cerr << #x << ": "<< x <<endl
#define dbg2(x,y) cerr<< #x <<": "<< x <<" || "<< #y << ": " << y << endl

#define endl "\n"
#define MAX 1e18
#define MIN INT_MIN
#define mod 1000000007



void solve()
{
    ll n;
    cin >> n;
    ll a[n] , g = 0;

    vell f(1000002 , 0);
    bool ok = true;
    for (ll i = 0 ; i < n ; ++i) {
        cin >> a[i];
        g = __gcd(g , a[i]);

        ll x = a[i];

        for (ll j = 2 ; j * j <= x ; ++j) {

            ll c = 0;
            while (x % j == 0) {
                c++;
                x /= j;
            }

            if (c > 0) {
                if (f[j] > 0) {
                    ok = false;
                }

                f[j] += c;
            }
        }

        if (x > 1) {
            if (f[x] > 0)
                ok = false;
            f[x]++;
        }
    }


    if (ok)  {
        cout << "pairwise coprime";
        return;
    }

    if (g == 1) {
        cout << "setwise coprime";
        return;
    }

    cout << "not coprime";

}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0); cin.tie(0);
    //TEST
    solve();
}



Measured memory_bytes: 18776
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <iomanip>
#define endl "\n"
#define debug(x) cout << #x << " : " << x << endl;
#define debug2(x, y) cout << #x << " : " << x  << ", " << #y << " : " << y << endl;
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0);
typedef long long ll;
using namespace std;

#define mod 1000000007

ll fastExp(ll base, ll exp)
{
	ll res = 1;
	while(exp)
	{
		if(exp % 2 == 1)
			res = ((res % mod) * (base % mod)) % mod;
		base = ((base % mod) * (base % mod)) % mod;
		exp /= 2;
	}

	return res;
}

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

	if(n == 1)
	{
		cout << "0" << endl;
		return 0;
	}

	ll ans = fastExp(10, n) + fastExp(8, n);
	ll toSub = 2 * fastExp(9, n) % mod;

	ans = (ans - toSub + mod) % mod;
	cout << ans << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define inar ll ar[n];for(ll i=0;i<n;i++) cin>>ar[i];
#define loop for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL);
  #define endl "\n"
  #define inf ll(1e19)
  #define mod int(1e9 +7)
typedef long long int ll;
using namespace std;

#define INFI LLONG_MAX
int32_t main()
{
	int a;
	int n;
	cin>>a>>n;
	if(a<10)
	{
		cout<<n+(100*(10-a));
	}
	else
	cout<<n;
	
	
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define mii map<int,int>
#define io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main() {
	io;
	int n;
	cin>>n;
	vector<int> v(n);
	for(int i=0;i<n;i++) cin>>v[i];
	int ans=0;
	for(int i=0;i<n;i++){
	    for(int j=i+1;j<n;j++) ans+=v[i]*v[j];
	}
	cout<<ans;
	return 0;
	
}

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

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

Measured memory_bytes: 256
import java.util.*;
 
class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
     int a,b;
      a = sc.nextInt();
      b = sc.nextInt();

       int sum = a * b;

       int arr [] = {1,2,3};
       boolean flg = false;

for(int i = 0; i < arr.length; i++) {
                if((sum * arr[i]) % 2 == 1) {
                           flg = true;
           
        } else {
                flg = false;
         }
}

if(flg == true) {
  System.out.println("Yes");
} else {
     System.out.println("No");
}

  }
}

Measured memory_bytes: 21972
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>

using namespace std;
using ll = long long;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<int>;

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

bool solve()
{
	int n; cin >> n;
	if (n == 0)return false;

	vector<string> S(n);

	int maxK = 0;
	
	for (int i = 0; i < n; ++i)
	{
		string s;
		cin >> s;

		S[i].push_back(s[0]);
		for (int j = 0; j < s.length()-1; ++j)
		{
			if (s[j] == 'a' || s[j] == 'i' || s[j] == 'u' || s[j] == 'e' || s[j] == 'o')
			{
				S[i].push_back(s[j + 1]);
			}
		}
		maxK = max(maxK, (int)S[i].length());
	}

	for (int k = 1; k <= maxK; ++k)
	{
		unordered_map<string, int> mp;
		bool flag = true;
		for (auto & s : S)
		{
			
			if (mp.find(s.substr(0,k))!=mp.end())
			{
				flag = false;
				break;
			}
			mp[s.substr(0, k)] = 1;
		}

		if (flag)
		{
			cout << k << endl;
			return true;
		}
	}

	cout << -1 << endl;

	return true;
}

int main()
{
	while (solve());

	return 0;
}


Measured memory_bytes: 3164
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <set>
#include <map>
#include <list>

using namespace std;

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

const ll MOD = 1000000007;
const ll inf = (ll) 1e18;

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

  int a, b;
  cin >> a >> b;

  int l = max(0, a - b * 2);

  cout << l << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

constexpr int n = 100;
int freq[n];
int main(){
  int a;
  while(cin >> a){
    freq[a-1]++;
  }
  int maxi,maxval=-1;
  for(int i=0;i<n;++i){
    if(maxval<freq[i]){
      maxi = i;
      maxval = freq[i];
    }
  }

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

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
int n, m, k, ans;
int a[N];

int main() {
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    a[n] = m;
    sort(a, a + n + 1);
    int d = a[1] - a[0];
    for (int i = 1; i <= n; ++i) {
        d = __gcd(d, a[i] - a[i - 1]);
    }
    cout << d << endl;
    return 0;
}


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

using namespace std;

const int inf = 1e9;

signed main() {
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    vector<int> dp(n, inf);
    
    dp[0] = 0;
    
    for (int i = 1; i < n; i++) {
        for (int j = 1; j <= k; j++) {
            if (i - j >= 0) {
                dp[i] = min(dp[i], dp[i - j] + abs(a[i] - a[i - j]));
            }
        }
    }
    
    cout << dp[n - 1];
    
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007
using namespace std;
typedef pair<llint, llint> P;
typedef pair<llint, P> E;

llint n, m;
vector<llint> G[100005];
vector<P> ans;
llint id[100005];
bool parity[100005];

llint nid = 1;
void dfs(int v, int p)
{
	id[v] = nid++;
	for(int i = 0; i < G[v].size(); i++){
		llint u = G[v][i];
		if(u == p) continue;
		if(id[u]){
			if(id[u] >= id[v]) continue;
			ans.push_back(P(v, u));
			parity[v] = !parity[v];
			continue;
		}
		dfs(u, v);
	}
	if(p != -1){
		if(parity[v]){
			ans.push_back(P(v, p));
			parity[v] = !parity[v];
		}
		else{
			ans.push_back(P(p, v));
			parity[p] = !parity[p];
		}
	}
}

int main(void)
{
	cin >> n >> m;
	llint u, v;
	for(int i = 1; i <= m; i++){
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	if(m%2){
		cout << -1 << endl;
		return 0;
	}
	dfs(1, -1);
	
	for(int i = 0; i < ans.size(); i++){
		cout << ans[i].first << " " << ans[i].second << endl;
	}
	
	return 0;
}


Measured memory_bytes: 18800
open System

let n = stdin.ReadLine() |> int
let S = [for _ in 1..n -> stdin.ReadLine().ToCharArray() |> Array.countBy id |> Map ]

let a = "abcdefghijklmnopqrstuvwxyz"

for c in a do
    let count = List.min [ for counter in S -> if counter.ContainsKey c then Map.find c counter else 0 ]
    Array.init count (fun _ -> c)
    |> String
    |> printf "%s"

printfn ""

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

int main()
{
	int n,m,mx=0;
	string str;
	cin>>str;
	for(int i=0;i<str.length();i++)
	{
		int x=0;
		while(str[i]=='R')
		{

			i++;
			x++;
		}
		if(x>mx)
			mx=x;
	}
	cout<<mx<<endl;

	return 0;
}


Measured memory_bytes: 3584
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	k := scanInt()

	arr := []int{}
	for i := 1; i*i <= n; i++ {
		arr = append(arr, i, n/i)
	}
	sort.Ints(arr)
	// debug(len(arr))
	// debug(arr)
	dp := make([][]int, k+1)
	dp[0] = make([]int, len(arr))
	dp[0][0] = 1
	for i := 0; i < k; i++ {
		dp[i+1] = make([]int, len(arr))
		pre := 0
		sum := 0
		for j := 0; j < len(arr); j++ {
			num := arr[j] - pre
			sum += (dp[i][j] * num) % MOD
			sum %= MOD
			dp[i+1][len(arr)-1-j] = sum
			pre = arr[j]
		}
		// debug(dp[i+1])
	}
	ans := 0
	pre := 0
	for i := 0; i < len(arr); i++ {
		num := arr[i] - pre
		ans += dp[k][i] * num
		ans %= MOD
		pre = arr[i]
	}

	fmt.Fprintln(wr, ans)

}

// MOD constant
const MOD = 1000000007


Measured memory_bytes: 52864
import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
a = set([I() for _ in range(M)])
dp = [0]*(N+1) #1_indexed
dp[0] = 1
dp[1] = 0 if 1 in a else 1
for i in range(N+1):
    if i in a:
        dp[i] = 0
        continue
    if i-2>=0:
        dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
print(dp[-1])


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

typedef long long LL; 
typedef pair<int, int> pii; 
typedef pair<LL, LL> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<LL> vl; 
typedef vector<vl> vvl;
typedef queue<int> qi;
typedef queue<char> qc;
typedef stack<int> si;
typedef stack<char> sc;
#define F first
#define S second
#define PB push_back

int costs[1000001];
int dp[1000001];


int frog(int i, int n){

    if(i == n) return dp[i] = 0;
    if(dp[i] != -1) return dp[i];
    int cost = abs(costs[i] - costs[i + 1]) + frog(i+1, n);
    if(i + 2 <= n){
        cost = min(cost, abs(costs[i] - costs[i+2]) + frog(i + 2, n));
    }

    return dp[i] = cost;
}

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

    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> costs[i];
    } //cost for a jump = abs(h.i - h.j)
      //find minimum cost

    memset(dp, -1, sizeof(dp));
    cout << frog(1, n)<<endl;

    return 0;
}

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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

template <typename T>
class range_add_range_sum {
	const int n;
	const T id;
	vector<T> data, data2;
	int size(int n) {
		int res = 1;
		while (res < n) res <<= 1;
		return res;
	}
	T sub(int l, int r, int node, int lb, int ub) {
		if (ub <= l || r <= lb) return id;
		if (l <= lb && ub <= r) return data[node] + data2[node] * (ub - lb);
		return data2[node] * (min(r, ub) - max(l, lb))
			+ sub(l, r, node * 2, lb, (lb + ub) / 2)
			+ sub(l, r, node * 2 + 1, (lb + ub) / 2, ub);
	}
	void suc(int l, int r, int node, int lb, int ub, T val) {
		if (ub <= l || r <= lb) return;
		if (l <= lb && ub <= r) {
			data2[node] += val;
			return;
		}
		data[node] += val * (min(r, ub) - max(l, lb));
		suc(l, r, node * 2, lb, (lb + ub) / 2, val);
		suc(l, r, node * 2 + 1, (lb + ub) / 2, ub, val);
	}
public:
	range_add_range_sum(int n_) : n(size(n_)), id(0), data(n * 2, id), data2(n * 2, id) {}
	void add(int l, int r, T val) {
		suc(l, r + 1, 1, 0, n, val);
	}
	T getsum(int l, int r) {
		return sub(l, r + 1, 1, 0, n);
	}
};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  LL N,Q;
  cin >> N >> Q;
  range_add_range_sum<LL> rars(N+1);

  REP(i,Q){
		LL y;
		cin >> y;
		if(y==0){
			LL s,t, x;
			cin >> s >> t >> x;
			rars.add(s, t, x);
		}
		else
		{
      LL s;
      cin >> s;
      cout << rars.getsum(s, s) << endl;
    }
	}
}



Measured memory_bytes: 7064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <typeinfo>
using namespace std;
using ll = long long;

int main() {

	int n, k;
	cin >> n >> k;
	vector<ll> h(n);
	ll ans = 1000000000;

	for (int i = 0; i < n; i++)
		cin >> h[i];
	sort(h.begin(), h.end());

	for (int i = 0; i < n-k+1; i++)
	{
		ans = min(h[i+k-1] - h[i], ans);
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
#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;

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

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

	int i = 0;
	int sum = 0;

	while (1){
		sum += i;
		if (sum >= x){
			cout << i << endl;
			return 0;
		}
		i++;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
    out << '(' << p.first << ',' << p.second << ')';
        return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
    in >> p.first >> p.second;
        return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
    for (T &x : v)
        in >> x;
    return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
    for (const vector<T> &x : v)
        out << x << '\n';
    return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
    for (const T &x : v)
        out << x << ' ';
    return out;
}
 
template <class T>
ostream& operator << (ostream& out,const set<T> &s)
{
    for (const T &x : s)
        out << x << ' ';
    return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define epsilon 0.00000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl "\n"
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

int main()
{
    fast();
    ll n;
    cin>>n;
    string s="";
    for(ll i=0;i<n;i++)
    {
        s+="ACL";
    }
    cout<<s<<nl;
}


Measured memory_bytes: 3536
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define sz size
#define se second
#define fe first
#define mper make_pair
#define all(x) x.begin(), x.end()
#define mal ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
#define saken string
#define erba continue
using namespace std;

ll a, b, c;

int main(){

cin >> a >> b >> c;

int ans = 0;

while(1) {

    if(a % 2 != 0 || c % 2 != 0 || b % 2 != 0) {break;}
    ans++;

    ll nexta, nextb, nextc;

    nexta = (b / 2) + (c / 2);
    nextb = (a / 2) + (c / 2);
    nextc = (b / 2) + (a / 2);

    if(nexta == a && nextb == b && nextc == c) {cout << -1;return 0;}

    a = nexta;
    b = nextb;
    c = nextc;

}

cout << ans;

return 0;
}



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

int main() {
    int n;
    cin >> n;
    
    long long ans = -1e10, mn = 1e10;
    long long r_mn;
    cin >> r_mn;
    for (int i = 1; i < n; i++) {
        long long r;
        cin >> r;
        if (r - r_mn > ans) ans = r - r_mn;
        if (r < r_mn) r_mn = r;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3116
import java.util.*;
import java.lang.*;

class Main
{
    public static void main (String[] args) throws java.lang.Exception
	{
     	Scanner in = new Scanner(System.in);

		while(in.hasNext()) {
			int ans = in.nextInt();
			int sum = 0;
			int cnt = 0;
			
			for (int a = 0; a < 10; a++) {
				for (int b = 0; b < 10; b++) {
					for (int c = 0; c < 10; c++){
						for (int d = 0; d < 10; d++) {
							sum = a + b + c + d;
							if (sum == ans) {
								cnt++;
							}
						}
					}
				}
			}
			
			System.out.println(cnt);
		}		
	}
}

Measured memory_bytes: 17024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <functional>
#include <climits>
#include <string>
#include <map>
#include <iomanip>

int main() {
	int m, k; std::cin >> m >> k;
	if (m == 0 && k == 0) {
		std::cout << 0 << ' ' << 0 << std::endl;
		return 0;
	}
	if (m == 1 && k == 0) {
		std::cout << "0 0 1 1\n";
		return 0;
	}
	if ((1 << m) <= k || (m == 1 && k == 1)) {
		std::cout << -1 << std::endl;
		return 0;
	}
	std::vector<int> x;
	for (auto i = 0; i < m; ++i) {
		if (((1 << i) & k) != 0 && ((1 << i) != k)) {
			x.push_back(1 << i);
		}
	}
	std::vector<int> result;
	result.push_back(k);
	for (auto i = 0; i < (1 << m); ++i) {
		auto right = (((i - 1) ^ (-1)) & i);
		if (i != k && (right != i || ((i & k) == 0))) {
			result.push_back(i);
		}
	}
	for (const auto i: x) {
		result.push_back(i);
	}
	if (x.empty()) result.push_back(k);
	for (auto j = 1; j <= (1 << m); ++j) {
		auto i = (1 << m) - j;
		auto right = (((i - 1) ^ (-1)) & i);
		if (i != k && (right != i || ((i & k) == 0))) {
			result.push_back(i);
		}
	}
	if (!x.empty()) result.push_back(k);
	for (auto i = 1; i <= x.size(); ++i) {
		result.push_back(x[x.size() - i]);
	}
	for (auto i = 0; i < result.size(); ++i) {
		if (i != 0) {
			std::cout << ' ';
		}
		std::cout << result[i];
	}
}


Measured memory_bytes: 2932
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef vector<vector<P>> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<ll> vec;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}

int gcd(int x, int y) { return y ? gcd(y, x%y) : x; }
int lcm(int x, int y) { return x/gcd(x, y)*y; }
int mod_pow(int x, int y) { int res = 1; while (y > 0) { if (y & 1) { res = res * x % MOD; } x = x * x % MOD; y >>= 1; } return res; }
int comb(int n, int k) { k = min(k, n - k); int nnn = 1; for (int i = n - k + 1; i <= n; i++) { nnn *= i; nnn %= MOD; } int kkk = 1; for (int i = 1; i <= k; i++) { kkk *= i; kkk %= MOD; } return (nnn * mod_pow(kkk, MOD - 2)) % MOD; }
int to_int(string s) { int n = s.size(); int ans = 0; for (int i = 0; i < n; i++) { ans = ((ans * 10) + (s[i] - '0')) % MOD; } return ans; }
bool is_prime(int n) { for(int i = 2; i*i <= n; i++) { if (n % i == 0) return false; } return n != 1; }
int extgcd(int a, int b, int& x, int& y) { // ax+by = gcd(a,b) >> gcd(a, b)
    int d = a;
    if(d != 0) { d = extgcd(b, a%b, y, x); y -= (a/b)*x; }
    else { x = 1, y = 0; }
    return 0;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    sort(all(a));
    int g=0;
    rep(i,n-1){
        if(a[i]==a[i+1]){
            g++;
        }
    }
    if(g==0){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 1792
import sys

INF = sys.maxsize
N, M = map(int, input().split())
costs = []
keys = []
for _ in range(M):
    a, b = map(int, input().split())
    cs = list(map(int, input().split()))
    costs.append(a)
    # 鍵を2進化で表す
    # e.g. N=5, cs={1,2,5} => key = 10011
    key = 0
    for c in cs:
        key |= 1<<(c-1)
    keys.append(key)

dp = [INF]*(2**N)
dp[0] = 0
for m in range(M):
    a = costs[m]
    key = keys[m]
    for i in range(2**N):
        # keyを追加した場合と追加しない場合のコストを比較
        dp[i|key] = min(dp[i|key], dp[i]+a)
ans = dp[-1]
if ans == INF:
    print(-1)
else:
    # dp[-1] = dp[2**N-1] = dp[0b11...11] = 全ての宝箱が開いたときの最小コスト
    print(dp[-1])



Measured memory_bytes: 46296
#include <bits/stdc++.h>
using namespace std;
long long n, h[200000], a[200000];
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
	cin >> n;
	for (int i=0;i<n;i++) cin >> h[i];
	a[0]=0;
	a[1]=abs(h[0]-h[1]);
//	cout << a[0] << " " << a[1] << " ";
	for (int i=2;i<n;i++){
		a[i]=min(a[i-2]+abs(h[i]-h[i-2]),a[i-1]+abs(h[i]-h[i-1]));
//		cout << a[i] << " ";
	}
	cout << endl << a[n-1];
return 0;
}

// 6 30 10 60 10 60 50

Measured memory_bytes: 1792
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

def main():
    N = int(input())
    S = [input() for _ in range(N)]

    res = ['AC','WA','TLE','RE']

    for ans in res:
        print(ans + ' x ' + str(S.count(ans)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 17608
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  std::vector<std::tuple<int, int, int>> tuples;

  int L, l = 0;

  std::cin >> L;

  int x = 31 - __builtin_clz(L), y = 1 << x;

  for (int i = 0; i < x; i ++) {
    tuples.emplace_back(i, i + 1, 1 << i);
    tuples.emplace_back(i, i + 1, 0);
  }

  l = y;

  while (l < L) {
    for (int i = x - 1; i >= 0; i --) {
      if ((1 << i) > L - l)
        continue;

      tuples.emplace_back(i, x, l);
      
      l += 1 << i;
      
      break;
    }
  }

  assert(l == L);

  std::cout << x + 1 << ' ' << tuples.size() << std::endl;
  
  for (const auto& t : tuples)
    std::cout <<
      std::get<0>(t) + 1 << ' ' <<
      std::get<1>(t) + 1 << ' ' <<
      std::get<2>(t)     << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
 

int32_t main()
{
	IOS
	int k , n ; cin >> k >> n;
	vector<int>a(n);
	for(int i=0;i<n;i++)
	cin>>a[i];
	sort(a.begin(),a.end());
	int ans = k;
	for(int i=0;i<n-1;i++)
	{
		ans=min(ans, k  - abs( a[i] - a[i+1] ) );
	}
	ans=min(ans,k-(abs(k-a[n-1])+a[0]));
	cout << ans << endl;
	
}


Measured memory_bytes: 1792