akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> void Max(T &m, const T q) { if (m < q) m = q; }
template<typename T> void Min(T &m, const T q) { if (m > q) m = q; }
template<typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

int N;
vector<int> A;
set<int> A2;

int main()
{
    cin >> N;
    A.resize(N);
    cin >> A;
    for (int i = 0; i < N; i += 2) A2.insert(A[i]);
    sort(A.begin(), A.end());
    for (int i = 0; i < N; i += 2) A2.insert(A[i]);

    cout << A2.size() - (N + 1) / 2 << endl;
}


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

ll solve(ll H){
    if(H == 1){
        return 1;
    }else{
        return solve(H/2)*2 + 1;
    }
}

int main(){
    ll H;
    cin >> H;

//    solve(H);

    cout << solve(H)  << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
int N, M;
void func()
{
    cin >> N;
    string tmp;
    map<string, int> s;
    int max(0);
    rep(i, 0, N)
    {
        cin >> tmp;
        if (s.count(tmp))
            ++s[tmp];
        else
            s[tmp] = 1;
        if (s[tmp] > max)
            max = s[tmp];
    }
    for (auto itr = s.begin(); itr != s.end(); ++itr)
    {
        if (itr->second == max)
            cout << itr->first << '\n';
    }
}
int main()
{
    func();
}

Measured memory_bytes: 25216
#include<stdio.h>
#define MAX 100000

int A[MAX],n;

int partition(int p,int r){
	int x,i,j,t;
	x=A[r];
	i=p-1;
	for(j=p;j<r;j++){
		if(A[j]<=x){
			i++;
			t=A[i];A[i]=A[j];A[j]=t;
		}
	}
	t=A[i+1];A[i+1]=A[r];A[r]=t;
	return i+1;
}

int main(){
	int i,q;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&A[i]);
	
	q=partition(0,n-1);
	
	for(i=0;i<n;i++){
		if(i)printf(" ");
		if(i==q)printf("[");
		printf("%d",A[i]);
		if(i==q)printf("]");
	}
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 2156
package main

import (
	"fmt"
	"os"
	"strconv"
)

func main() {
	fmt.Println(B(os.Stdin))
}

func B(in *os.File) string {
	if in == nil {
		in = os.Stdin
	}
	var n int
	args := []int{}
	fmt.Fscanf(in, "%d", &n)
	for ; n > 0; n-- {
		var d int
		fmt.Fscanf(in, "%d", &d)
		args = append(args, d)
	}
	cnt := 0
	allEven := true
	for allEven {
		for i, d := range args {
			dd := (d >> 1) << 1
			if dd != d {
				allEven = false
				break
			}
			args[i] = d >> 1
		}
		cnt++
	}
	return strconv.Itoa(cnt - 1)
}


Measured memory_bytes: 1864
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
  	int n, q, a, b, c, d[100005] = {};
  	ll z = 0;
  	cin >> n;
  	for (int i = 1; i <= n; i++) cin >> a, z += a, d[a]++;
  	cin >> q;
  	while (q--) {
      	cin >> b >> c;
      	z += 1ll * d[b] * (c - b);
      	cout << z << '\n';
      	d[c] += d[b];
      	d[b] = 0;
    }
}


Measured memory_bytes: 3588
#include<stdio.h>
int main(){
  char s[4];
  int a=0,b=0,c=0,i;
  scanf("%s",&s);
  for(i=0;i<3;i++){
    if(s[i]=='a' && a==0){
      a=1;}
   if(s[i]=='b' && b==0){
      b=1;}
    if(s[i]=='c' && c==0){
      c=1; }
  }
  if(a==1&&b==1&&c==1){
    printf("Yes");
  }
  else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const double EPS = 1E-10;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}




int main(){
    int N; std::cin >> N;
    std::vector<std::pair<long long, int>> A(N);
    for(int i(0); i < N; ++i){
        std::cin >> A[i].first;
        A[i].second = i+1;
    }
    std::sort(A.rbegin(), A.rend());
    //dp[i][j] := i人配置、左側はj人
    std::vector<std::vector<long long>> dp(N+1, std::vector<long long>(N+1, 0));
    for(int i(1); i <= N; ++i){
        for(int j(0); j <= i; ++j){
            if(j) dp[i][j] = dp[i-1][j-1] + A[i-1].first*(A[i-1].second - j);
            if(j != i)chmax(dp[i][j], dp[i-1][j] + A[i-1].first*(N-i+j+1 - A[i-1].second));
        }
    }
    long long ans(0);
    for(int i(0); i <= N; ++i) chmax(ans, dp[N][i]);
    std::cout << ans << std::endl;
    return 0;
}


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

#define mod 1000000007
#define limit 200001
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(i = 0; i < n; i++)
#define max(a,b) {if(a>b){return a;}return b;}
#define min(a,b) {if(a<b){return a;}return b;}
int up_int(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_int(const void *a, const void *b){return *(int*)b - *(int*)a;}
int up_char(const void *left, const void *right) {return strcmp((char *)left,(char *)right);}
int down_char(const void *left, const void *right) {return strcmp((char *)right,(char *)left);}

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    printf("%d\n",a*b);
    return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}

int N;
int C[222222];

vint G[222222];

int sz[222222];
int par[222222];
void calcsz(int v,int p){
	sz[v]=1;
	par[v]=p;
	for(auto u:G[v]){
		if(u==p)continue;
		calcsz(u,v);
		sz[v]+=sz[u];
	}
}


int ans[222222];
int val[222222];
int pre[222222];
void dfs(int v,int p){
	int tmp;
	if(p!=-1){
		tmp=pre[C[p]];
		pre[C[p]]=v;
	}

	if(pre[C[v]]==-1){
		ans[C[v]]-=sz[v];
	}
	else{
		val[pre[C[v]]]-=sz[v];
	}


	for(auto u:G[v]){
		if(u==p)continue;
		dfs(u,v);
	}

	if(p!=-1){
		pre[C[p]]=tmp;
	}
}


signed main(){
	cin>>N;
	rep(i,N)cin>>C[i],C[i]--;
	rep(i,N-1){
		int a,b;
		cin>>a>>b;
		a--;b--;
		G[a].pb(b);G[b].pb(a);
	}

	calcsz(0,-1);
	
	memset(pre,-1,sizeof(pre));
	rep(i,N)ans[i]=N;
	rep(i,N)val[i]=sz[i];
	dfs(0,-1);

	rep(i,N)ans[i]=ans[i]*(ans[i]+1)/2;
	for(int i=1;i<N;i++){
		ans[C[par[i]]]+=val[i]*(val[i]+1)/2;
	}

	rep(i,N){
		ans[i]=N*(N+1)/2-ans[i];
	}

	rep(i,N)cout<<ans[i]<<endl;
    return 0;
}



Measured memory_bytes: 40212
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        
        public static long GCM(long x, long y)
        {
            var s = x;
            var t = y;
            if (x < y) GCM(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return s / x*t;
        }



        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var n = Read();
            var t = new long[n];
            t[0] = Read();
            if (n > 1)
            {
                t[1] = Read();
                var gcm = GCM(t[0], t[1]);
                for (int i = 2; i < n; i++)
                {
                    t[i] = Read();
                    gcm = GCM(gcm, t[i]);
                }

                Console.WriteLine(gcm);
            }
            else Console.WriteLine(t[0]);

            Console.Out.Flush();
        }
    }
}




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

int main() {
  int N;
  cin >> N;
  // ans = 1*2*...N % (10^9+7)
  int64_t A = 1;
  for (int i=1; i<=N; i++){
     A *= i;
    if (A>1000000007){
      A %= 1000000007;
    }
  }
  cout << A << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        in.nextLine();
        int answer = 0;
        char prev = '0';
        for (char chara : in.nextLine().toCharArray()) {
            if (chara != prev) {
                answer++;
                prev = chara;
            }
        }
        System.out.println(answer);
    }
}


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


template<typename T>
struct Kruskal {
    struct Edge {
        int from, to;
        T cost;
        bool used;
        Edge(int from, int to, T cost) : from(from), to(to), cost(cost), used(false){}
        bool operator<(const Edge& e) const {
            return cost < e.cost;
        }
    };
    struct UF {
        vector<int> r, p;
        UF() = default;
        UF(int sz) : r(sz, 1), p(sz){ iota(begin(p), end(p), 0LL); }
        int find(int x){
            return (x == p[x] ? x : p[x] = find(p[x]));
        }
        bool same(int x, int y){
            return find(x) == find(y);
        }
        void unite(int x, int y){
            x = find(x), y = find(y);
            if(x == y) return;
            if(r[x] < r[y]) swap(x, y);
            r[x] += r[y];
            p[y] = x;
        }
    };
    vector<Edge> es;
    UF uf;
    Kruskal() = default;
    Kruskal(int n) : uf(n){}
    void addEdge(int u, int v, T c){
        es.emplace_back(u, v, c);
    }
    T build(){
        sort(begin(es), end(es));
        T res = 0;
        for(auto& e : es){
            if(!uf.same(e.from, e.to)){
                res += e.cost;
                uf.unite(e.from, e.to);
                e.used = true;
            }
        }
        return res;
    }
    Edge operator[](int i) const {
        return es[i];
    }
    vector<Edge> edgeSet() const {
        return es;
    }
};


signed main(){
    int N, M;
    while(cin >> N >> M, N+M){
        Kruskal<int> g(N);
        for(int i = 0;i < M;++i){
            int a, b, c;
            cin >> a >> b >> c;
            g.addEdge(a, b, c);
        }
        cout << g.build() << endl;
    }
    return 0;
}


Measured memory_bytes: 3116
//
// Created by yamunaku on 2020/03/21.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repl(i, l, r) for(ll i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

vector<ll> fact, invfact;

ll mod;

ll modpow(ll x, ll a){
    ll ans = 1;
    while(a){
        if(a & 1) ans = ans * x % mod;
        a >>= 1;
        x = x * x % mod;
    }
    return ans;
}

ll inv(ll x){
    return modpow(x, mod - 2);
}

int main(){
    //CFS;
    ll n;
    cin >> n >> mod;
    mtl dp(3 * n + 1, vl(n + 1, 0));
    dp[0][0] = 1;
    repl(i, 1, 3 * n + 1){
        rep(j, n + 1){
            dp[i][j] = dp[i - 1][j];
        }
        if(i >= 2){
            repl(j, 1, n + 1){
                dp[i][j] = (dp[i][j] + dp[i - 2][j - 1] * (i - 1)) % mod;
            }
        }
        if(i >= 3){
            repl(j, 1, n + 1){
                dp[i][j] = (dp[i][j] + dp[i - 3][j - 1] * (i - 2) * (i - 1)) % mod;
            }
        }
    }
    ll ans = 0;
    rep(i, n + 1){
        ans = (ans + dp[3 * n][i]) % mod;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    ll n;   cin >> n;
    ll a, c4=0, c2=0, c1=0;
    string ans="No";
    for(ll i=0; i<n; i++){
        cin >> a;
        if(a%4==0) c4 += 1;
        else if(a%2==0) c2 += 1;
        else c1 += 1;
    }
    if(c4!=0)   c4 += 1;
    if(0<=c4-c2%2-c1) ans = "Yes";
    cout << ans << endl;
}

Measured memory_bytes: 256
S = [i for i in input()]
count=0
for s in range(len(S)):
    if s == 0:
       S = S[:len(S)-1]
       continue
    if "".join(S[:(len(S)//2)]) == "".join(S[(len(S)//2):]):
        count = len(S)
        break
    S = S[:len(S)-1]
print(count)

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

int main(){
    int n;
    cin >> n;
    int p;
    int num=200010;
    int count=0;
    for(int i=0; i<n; i++){
        cin >> p;
        if(p<=num){
            count++;
            num=min(num,p);
        }
    }
    cout << count << endl;
}

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


// typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>  ordered_set;
#define ll long long
 
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl
 
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
 
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
ll dp[100005];
#define INF 1000000000000000000
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout<<setprecision(11); 
    long double pi= 3.14159265358979323846;
    ll n,k;
    cin>>n>>k;
    ll ar[n];
    rep(i,n)
    {
        cin>>ar[i];
    }
    sort(ar,ar+n);
    dp[0]=-1;
    rep(i,k)
    {
        ll j=0;
        dp[i+1]=-1;
        ll ans=-1;
        while(j<n&&i+1-ar[j]>=0)
        {
            ans=max(ans,dp[i+1-ar[j]]*-1);
            j++;
        }
        dp[i+1]=ans;
    }
    if(dp[k]==1)
        cout<<"First";
    else
        cout<<"Second";
    return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define m_k make_pair
using namespace std;
const int N=1e6+100,M=2*1e5+100;
int n,t[27],root,cnt;
long long ans;
string s[M];
struct node
{
	int son[27],dp[27];
}sh[N];
void insert(int id)
{
	for (int i=0;i<26;i++) t[i]=0;
	for (int i=0;i<(int)s[id].size();i++) t[s[id][i]-'a']++;
	int x=root;
	for (int i=0;i<26;i++) sh[x].dp[i]+=(t[i]>0);
	for (int i=(int)s[id].size()-1;i>=0;i--)
	{
		int p=sh[x].son[s[id][i]-'a'];
		t[s[id][i]-'a']--;
		if (!p) p=++cnt;
		for (int j=0;j<26;j++) sh[p].dp[j]+=(t[j]>0);
		sh[x].son[s[id][i]-'a']=p;
		x=p;
	}
}
int query(int id)
{
	int x=root;
	for (int i=(int)s[id].size()-1;i>0;i--)
	{
		int p=sh[x].son[s[id][i]-'a'];
		if (!p) return 0;
		x=p;
	}
	return sh[x].dp[s[id][0]-'a'];
}
signed main()
{
	root=cnt=1;
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		cin>>s[i];
		ans+=(long long)query(i);
		insert(i);
	}
	for (int i=1;i<=cnt;i++) memset(sh[i].dp,0,sizeof(sh[i].dp)),memset(sh[i].son,0,sizeof(sh[i].son));
	root=cnt=1;
	for (int i=n;i>=1;i--)
	{
		ans+=(long long)query(i);
		insert(i);
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 222116
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ankur Dua
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

using cd = complex<double>;
using ll = long long;
const double PI = acos(-1);

void fft(vector<cd> & a, bool invert) {
    int n = a.size();

    for (int i = 1, j = 0; i < n; i++) {
        int bit = n >> 1;
        for (; j & bit; bit >>= 1)
            j ^= bit;
        j ^= bit;

        if (i < j)
            swap(a[i], a[j]);
    }

    for (int len = 2; len <= n; len <<= 1) {
        double ang = 2 * PI / len * (invert ? -1 : 1);
        cd wlen(cos(ang), sin(ang));
        for (int i = 0; i < n; i += len) {
            cd w(1);
            for (int j = 0; j < len / 2; j++) {
                cd u = a[i+j], v = a[i+j+len/2] * w;
                a[i+j] = u + v;
                a[i+j+len/2] = u - v;
                w *= wlen;
            }
        }
    }

    if (invert) {
        for (cd & x : a)
            x /= n;
    }
}

vector<ll> multiply(vector<ll> const& a, vector<ll> const& b) {
    vector<cd> fa(a.begin(), a.end()), fb(b.begin(), b.end());
    int n = 1;
    while (n < a.size() + b.size())
        n <<= 1;
    fa.resize(n);
    fb.resize(n);

    fft(fa, false);
    fft(fb, false);
    for (int i = 0; i < n; i++)
        fa[i] *= fb[i];
    fft(fa, true);

    vector<ll> result(n);
    for (int i = 0; i < n; i++)
        result[i] = round(fa[i].real());
    result.resize(a.size()+b.size());
    return result;
}

using namespace std;

ll sum[1000001];
ll sqs[1000001];
ll xxv[1000001];
ll mod=998244353;
ll inv(ll b){
    ll e=mod-2;
    ll ans=1;
    while(e){
        if(e&1){
            (ans*=b)%=mod;
        }
        e>>=1;
        (b*=b)%=mod;
    }
    return ans;
}
class CLCMs {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        for(int i=0;i<=1000000;i++)
            sum[i]=sqs[i]=xxv[i]=0;
        int n;
        cin>>n;
        for(int i=0;i<n;i++){
            ll x;
            cin>>x;
            sum[x]+=x;
            sqs[x]+=x*x;
            sum[x]%=mod;
            sqs[x]%=mod;
        }
        ll ans=0;
        for(int i=1;i<=1000000;i++){
            for(int j=2*i;j<=1000000;j+=i){
                (sum[i]+=sum[j])%=mod;
                (sqs[i]+=sqs[j])%=mod;
            }
        }
        for(int i=1000000;i>0;i--){
            //calculate answer for this value;

            ll v=sum[i]*sum[i];
            v-=sqs[i];
            v%=mod;
            if(v<0)
                v+=mod;
            for(int j=2*i;j<=1000000;j+=i){
                v-=xxv[j];
                if(v<0)
                    v+=mod;
            }
            xxv[i]=v;
            v*=inv(i);
            ans+=v;
            ans%=mod;
        }
        ans*=inv(2);
        ans%=mod;
        cout<<ans<<endl;
	}
};


int main() {
	CLCMs solver;
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 23680
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p = Mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	string s;
	cin >> s;
	int ans = 0;
	stack<char>st;
	for (int i = 0; i < s.size(); i++) {
		if (st.size() == 0) {
			st.push(s[i]);
			continue;
		}
		if (st.top() != s[i]) {
			st.pop();
			ans += 2;
		}
		else {
			st.push(s[i]);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
/*
-------関数一覧--------
arr1dto2d(Array) 一次元配列を二次元配列にします
pf(N)因数分解した結果をオブジェクトで返します
gcd(a,b)最大公約数を返します
lcm(a,b)最小公倍数を返します
num(a,b)a-bを返します。ソート用です
*/
function Main(input) {
  //write here!
  input = input.split(" ").map(Number);
  var flag = 0;
  for(var i=0;i<input[2];i++){
  if(flag==0){
  if(input[0]%2==1) input[0]--;
    input[0] /= 2
    input[1] += input[0]
    flag=1;
  }else{
    if(input[1]%2==1) input[1]--;
    input[1] /= 2
    input[0] += input[1];
    flag = 0;
  }
  }
  console.log(input[0],input[1]);
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
function arr1dto2d (arr){
	for(var i=0;i<arr.length;i++){
    arr[i]=arr[i].split(" ").map(Number);
    }
  return arr;
}
function pf(n) {
    var result = {};
    
    if (n === 1) {
        return {"1":1}
    }

    var init = 2;

    while (n !== 1) {
        var i = init;
        while (i < Number.MAX_SAFE_INTEGER) {
            if (n % i === 0) {
                n /= i;
                if (!(result[i] > 0)) {
                    result[i] = 0;
                }
                result[i]++;
                break;
            }
            i++;
        }
        init = i;
    }
    return result;
}
function gcd(a, b) {
    if (b === 0){
        return a
    }
    return gcd(b, a % b)
}
function lcm(a,b) {
    var g = (n, m) => m ? g(m, n % m) : n
    return a * b / g(a, b)
}
function num(a, b) {
  return a - b;
}


Measured memory_bytes: 7372
import math
  
a, b, t = map(int, input().strip().split())
  
t = math.radians(t)
h = b * math.sin(t)
l = a + b + math.sqrt(a*a + b*b - 2*a*b*math.cos(t))
s = a * h / 2
print(s)
print(l)
print(h)

Measured memory_bytes: 7972
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    string s;
    cin >> s;
    string days[] = {"SUN", "MON","TUE","WED","THU","FRI","SAT"};
    rep(i, 7) {
        if (s == days[i]) {
            cout << 7 - i << endl;
            return 0;
           }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;
/*
ordered_set(both these operations in log)
1. find_by_order : it returns iterator to the ith largest element.
2. order_of_key  : The number of items in a set that are strictly smaller than k.
*/

//memset(dp,-1,sizeof(dp));
//fill(v.begin(), v.end(), -1);
//priority_queue< pii, vector <pii> , greater<pii>> pq;
//vector<int> dist(V, INF);


#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define lb lower_bound
#define ub upper_bound

#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define pii                 pair<int,int>
#define vi                  vector<int>
#define vii                 vector<pii>
#define mi                  map<int,int>
#define mii                 map<pii,int>
#define all(a)              (a).begin(),(a).end()
#define fi                  first
#define se                  second
#define sz(x)               (int)x.size()
#define endl                '\n'
#define md                  1000000007
#define rep(i,a,b)          for(int i=a;i<b;i++)
#define pcout(x)	          cout<<fixed<<setprecision(x)
#define debug(x)            cout<<#x<<"::"<<x<<endl;
#define debug2(x,y)         cout<<#x<<"::"<<x<<"\t"<<#y<<"::"<<y<<endl;
#define boost               ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)



typedef long long ll;
typedef double ld;

inline ll prodm(ll a,ll b)  {return ((a%md)*(b%md))%md;}
inline ll summ(ll a,ll b)   {return ((a%md)+(b%md))%md;}
inline bool ispow2(ll x)    {return  x && (!(x&(x-1)));}

const int N = 1e5 + 5;
const ll  infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;

/**************************BounceBackBolt*********************************/
ll fastexpo(ll n,ll pwr)
{
  if(pwr==0)
    return 1;
  if(pwr==1)
    return n;
  ll ans=fastexpo(n,pwr/2);
  ans=prodm(ans,ans);
  if(pwr&1)
  {
      ans=prodm(ans,n);
  }
    return ans;
}

ll modInverse(ll base)
{return fastexpo(base,md-2);}


vector < int > g[N];
int d[N];
void dfs(int v, int p, int dd){
    d[v] = dd;
    for(int to : g[v]){
        if(to == p) continue;
        dfs(to, v, dd + 1);
    }
}

/*********************************************************************/
int main()
{
  boost;
  int T;
  T=1;
  while(T--)
  {
    int n;
    cin>>n;
    ll i;
    ll sum=0;
    for(i=1;i<=n;i++)
    {
      if(i%3!=0&&i%5!=0)
      sum+=i;
    }
    cout<<sum;

  }
  return 0;
}


Measured memory_bytes: 5988
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<int> a(n),b(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	for(int i=0;i<n;i++){
		cin >> b[i];
	}
	int ans=0;
	for(int v=(1<<28);v;v>>=1){
		for(int i=0;i<n;i++){
			a[i]&=(v*2-1);
			b[i]&=(v*2-1);
		}
		sort(a.begin(),a.end());
		sort(b.begin(),b.end());
		int t=0;
		for(int i=n-1,j=0,k=0,l=0;i>=0;i--){
			while(j<n&&a[i]+b[j]<v)j++;
			while(k<n&&a[i]+b[k]<2*v)k++;
			while(l<n&&a[i]+b[l]<3*v)l++;
			t+=(k-j)+(n-l);
			t&=1;
		}
		if(t)ans|=v;
	}
	cout << ans << endl;
	return 0;
}


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

typedef long long ll;
static const ll INF = 1ll<<60;
static const int MOD = 1e9+7;

int main(){
    ll a;
    cin>>a;

    cout<<(a+a*a+a*a*a)<<endl;
    
    return 0;
}

Measured memory_bytes: 3588
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#define lol(i,n) for(ll i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
ll gcd(ll a,ll b){
    if(a>b)swap(a,b);
    b%=a;
    if(b==0)return a;
    return gcd(a,b);
}
int main(){
    ll n,m;
    string s,t;
    cin>>n>>m>>s>>t;
    ll g=gcd(n,m),a=n/g,b=m/g;
    bool ok=1;
    for(ll i=0;i<g;i++){
	if(s[i*a]!=t[i*b])ok=0;
    }
    if(!ok){
	cout<<-1<<endl;
    }
    else cout<<g*a*b<<endl;
    return 0;
}


Measured memory_bytes: 512
// 30DTG
// 01072020
#include<bits/stdc++.h>
using namespace std;
#define bolt ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
typedef long long ll;
typedef long double ld;
const ld pi=3.1415926535897932384626433;
const int mod = 1e9+7;
const ll inf=3e18;
int main()
{
   bolt;
   ll n;
   cin>>n;
   cout<<n+n*n+n*n*n;
}


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

using namespace std;

vector<int> mul(vector<int> a,vector<int> b){
  vector<int> c(a.size());
  for(int i=0;i<c.size();i++){
    for(int j=0;j<=i;j++){
      c[i]=(c[i]+a[j]*1LL*b[i-j])%1000000007;
    }
  }
  return c;
}

int main(){
  for(long long N,D,X;cin>>N>>D>>X,N|D|X;){
    vector<int> dp(N+1);
    dp[0]=1;
    vector<int> po2(N+1);
    for(int i=0;i<min(X,N+1);i++){
      po2[i]=1;
    }
    for(long long i=1;i<=D;i<<=1){
      if(D&i){
	dp=mul(dp,po2);
      }
      po2=mul(po2,po2);
    }
    cout<<dp[N]<<endl;
  }
}

Measured memory_bytes: 1256
import math

N = int(input())

rs = []
ans = [0]*N

maxn = math.ceil(math.sqrt(N))

def f(x,y,z):
    return x**2+y**2+z**2+x*y+y*z+z*x

for i in range(1,maxn+1):
    for j in range(1,maxn+1):
        for k in range(1,maxn+1):
            result = f(i,j,k)
            if result>N:
                break
            ans[result-1]+=1
            # rs.append(i,j,k)

for a in ans:
    print(a)

Measured memory_bytes: 69748
import copy

n = int(raw_input())
a = [] 
        
for i in range(n):
    char, num = raw_input().split()
    num = int(num)
    a.append([char, num])

a_original = copy.copy(a)
    
def partition(A, p, r):
    x = A[r][1]
    i = p - 1
    for j in range(p, r):
        if A[j][1] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i+1], A[r] = A[r], A[i+1]
    return i+1

def quickSort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quickSort(A, p, q - 1)
        quickSort(A, q + 1, r)
        
quickSort(a, 0, n-1)
for i in range(n-1):
    if a[i][1] == a[i+1][1]:
        if a_original.index(a[i]) > a_original.index(a[i+1]):
            print 'Not stable'
            break
else:
     print 'Stable'       

for i in range(n):
    print a[i][0], a[i][1]

Measured memory_bytes: 23568
from collections import defaultdict
n, k = map(int, input().split())
a = list(map(int, input().split()))
d = defaultdict(int)

for i in range(n):
    d[a[i]] += 1

if len(d) <= k:
    print(0)
else:
    l = list(d.items())
    l = sorted(l, key=lambda x: x[1])
    res = 0
    for i in range(len(l) - k):
        res += l[i][1]
    print(res)


Measured memory_bytes: 40856
#include<bits/stdc++.h>
#include <ctime>
using namespace std;
#define ll long long
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define N 101
#define mod 1000000007
#define f(i,n) for(int i=0;i<n;i++)
#define in(i,arr) for(auto &i:arr)cin>>i;
#define all(x) (x).begin(), (x).end()   // sort(all(v)) instead sort(v.begin(),v.end())
int binary(vector<int> arr,int ele,int beg=1)
{   int l=arr.size()-1,mid;
    while(beg<=l)
    {
        mid=(beg+l)/2;
        if(arr[mid]==ele)
            return mid;
        else if(arr[mid]>ele)
            l=mid-1;
        else
            beg=mid+1;
    }
    return -1;

}
ll powe(ll base,ll pow)
{
    ll res=1;
    while(pow>0)
    {
        if(pow&1)
            res*=base;
        else
            base*=base,pow/=2;
    }
    return res;
}
int main() {
    fast;
    int ti = 1;
    //cin >> ti;

    while (ti--){
      string str;
      cin>>str;
      int c=0;
      f(i,str.size())
      {
          if(str[i]=='R')
              c++;
      }
      if(c==1||c==0||c==3)
          cout<<c;
      else if(c==2)
      {
          if(str[0]==str[1]||str[1]==str[2])
              cout<<c;
          else
              cout<<c-1;
      }



    }

}


Measured memory_bytes: 3648
S = raw_input()
T = raw_input()

def LCS(S, T) :
  dp = [[0 for t in range(len(T)+1)] for s in range(len(S)+1)]
  for s in range(1, len(S)+1) :
    for t in range(1, len(T)+1) : 
      if S[s-1] == T[t-1] : dp[s][t] = dp[s-1][t-1] + 1
      else : dp[s][t] = max(dp[s-1][t], dp[s][t-1])

  #print "      " + '  '.join(list(T))
  #for i in range(len(dp)) : print S[i-1] if i > 0 else " ", dp[i]

  res = ''
  s, t = len(S), len(T)
  while s > 0 and t > 0 :
    if S[s-1] == T[t-1] : 
      res = S[s-1] + res
      s, t = s-1, t-1
    else :
      if dp[s][t-1] > dp[s-1][t] : t -= 1
      else : s -= 1
  
  print res

LCS(S, T)

Measured memory_bytes: 102428
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w; cin >> h >> w;
    V< V<int> > c(10, V<int>(10)), a(h, V<int>(w));
    for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) cin >> c[i][j];
    for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) cin >> a[i][j];

    for (int k = 0; k < 10; k++)
    for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++) chmin(c[i][j], c[i][k] + c[k][j]);

    int ans = 0;
    for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) {
        ans += (a[i][j] == -1 ? 0 : c[a[i][j]][1]);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3756
#include<stdio.h>
#include<algorithm>
using namespace std;
char in[10];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)for(int j=0;j<b;j++){
		scanf("%s",in);
		if(in[0]=='s'&&in[1]=='n'&&in[2]=='u'&&in[3]=='k'&&in[4]=='e'){
			printf("%c%d\n",'A'+j,i+1);
		}
	}
}

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

vector<pair<int,int> > v;

main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		v.push_back(make_pair(a,b));
	}
	long long ans=0;
	for(int i=n-1;i>=0;i--)
	{
		long long a=v[i].first+ans,b=v[i].second;
		if(b==1||a==0)
		{
			continue;
		}
		if(a<=b)
		{
			ans+=b-a;
		}
		else
		{
			if(a%b!=0)
				ans+=b-(a%b);
		}
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define maxn 100086

using namespace std;

struct BIT{
	int a[maxn];
	inline void add(int x, int y){
		for(;x < maxn;x += x & -x) a[x] += y;
	}
	
	inline int query(int x){
		int sum = 0;
		for(;x;x -= x & -x) sum += a[x];
		return sum;
	}
}b[2];

int n;
int a[4][maxn];
int f[2], g[2];

int main(){
	scanf("%d", &n);
	for(int i = 1;i <= 3;i++) for(int j = 1;j <= n;j++) scanf("%d", &a[i][j]);
	for(int i = 1;i <= n;i++){
		if(a[1][i] % 3 == 1){
			if(a[2][i] != a[1][i] + 1 || a[3][i] != a[1][i] + 2) return printf("No"), 0;
			if((a[3][i] / 3 - i) & 1) return printf("No"), 0;
			f[i & 1] ^= (b[i & 1].query(n) - b[i & 1].query(a[3][i] / 3)) & 1;
			b[i & 1].add(a[3][i] / 3, 1);
		}else if(a[3][i] % 3 == 1){
			if(a[2][i] != a[3][i] + 1 || a[1][i] != a[3][i] + 2) return printf("No"), 0;
			if((a[1][i] / 3 - i) & 1) return printf("No"), 0;
			f[i & 1] ^= (b[i & 1].query(n) - b[i & 1].query(a[1][i] / 3)) & 1, g[i & 1] ^= 1;
			b[i & 1].add(a[1][i] / 3, 1);
		}else return printf("No"), 0;
	}
	printf(f[0] == g[1] && f[1] == g[0] ? "Yes" : "No");
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const int maxn=(2e6)+10;
const int mod=(1e9)+7;
int n,K,ans,tmp;
char s[maxn];
int jc[maxn],iv[maxn],ivjc[maxn];
int C(int x,int y) {
	if (x<y||y<0) return 0;
	return (ll)jc[x]*ivjc[y]%mod*ivjc[x-y]%mod;
}
int m25[maxn],m26[maxn];
void update(int &x,int y) {
	x+=y; if (x>=mod) x-=mod;
}
int main() {
	//freopen("1.txt","r",stdin);
	read(K); scanf("%s",s+1); n=strlen(s+1);
	iv[0]=jc[0]=ivjc[0]=iv[1]=jc[1]=ivjc[1]=1;
	m25[0]=m26[0]=1;
	for (int i=1;i<maxn;i++) m25[i]=(ll)m25[i-1]*25%mod,m26[i]=(ll)m26[i-1]*26%mod;
	for (int i=2;i<maxn;i++) {
		jc[i]=(ll)jc[i-1]*i%mod;
		iv[i]=(ll)(mod-mod/i)*iv[mod%i]%mod;
		ivjc[i]=(ll)ivjc[i-1]*iv[i]%mod;
	}
	for (int i=0;i<=K;i++) {
		tmp=(ll)C(n+K-i-1,n-1)*m25[K-i]%mod*m26[i]%mod;
		update(ans,tmp);
	}
	printf("%d\n",ans);
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 43856
#include<cstdio>

int a[105],n,b[105];

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


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <boost/math/common_factor_rt.hpp>
using namespace std;
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ll long long

int main(){
  ll N, M;
  cin >> N >> M;
  
  ll ma = M/N;
  
  for(ll i = ma; i>0; i--){
    if(M%i==0){
      cout << i << endl;
      break;
    }
  }
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

vector<vector<int>> dp(2000, vector<int>(2000));

void solve(string s, string t){
  int n = int(s.size());
  int m = int(t.size());

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if(s[i] == t[j]){
        dp[i+1][j+1] = dp[i][j] + 1;
      }else{
        dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
      }
    }
  }

  cout << dp[n][m] << endl;
}

int main(){
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    string s, t;
    cin >> s >> t;
    solve(s, t);
  }
}



Measured memory_bytes: 18720
import java.util.Scanner;

/**
 * Created by hiroshi on 2017/05/16.
 */
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double n = sc.nextInt();
   
    double n3 = Math.pow(n,3);//pow???double?????§????????????????????????
    int ans = (int)n3;

    System.out.println(ans);
  }
}

Measured memory_bytes: 26156
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<string>
#define gc getchar()
using namespace std;
#define kk putchar(32)
#define fup(i,a,b) for(int i=a,i##e=b;i<=i##e;++i)
#define fdn(i,a,b) for(int i=a,i##e=b;i>=i##e;--i)
#define hh putchar(10)
#define ll long long
struct zio {
	template<class T>inline zio & operator >>(T &x) {
		T f(1); char a;
		while((a=getchar())<48)if(a==45)f=-1;
		for(x=a^48;(a=getchar())>47;x=(x<<3)+(x<<1)+(a^48));
		x*=f; return *this;
	}
	template<class T>inline zio & operator <<(T x) {
		if(sizeof(x)==sizeof(char))putchar(x);
		else {
			if(x<0) x=-x,putchar(45);
			if(x>99) {
				static char za[20]; int i=0;
				while(x) za[i++]=x%10,x/=10;
				while(i--) putchar(za[i]+48);
			} else if (x>9) putchar(x/10+48),putchar(x%10+48);
			else putchar(x+48);
		}
	}
} io;

int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}
void Main()
{
	int k;
	cin>>k;
	ll ans=0;
	fup(i,1,k)fup(j,1,k)fup(x,1,k)
		ans+=gcd(gcd(i,j),x);
	cout<<ans;
}





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

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a=0;
	string s;
	cin>>s;
	for(int i=0;i<3;i++)
	{
		if(s[i]=='A')a++;
	}
	if(a==1||a==2)cout<<"Yes";
	else cout<<"No";
 } 

Measured memory_bytes: 256
n = int(input())
s_i = []
for i in range(n):
  s = input()
  s_i.append(s)

ac = s_i.count('AC')
wa = s_i.count('WA')
tle = s_i.count('TLE')
re = s_i.count('RE')

print("AC x {0}".format(ac))
print("WA x {0}".format(wa))
print("TLE x {0}".format(tle))
print("RE x {0}".format(re))


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

const int MAX = 1010000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long nCk(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(void) {
  ll x, y;
  cin >> x >> y;

  if ((x + y) % 3 != 0 || max(x, y) > min(x, y) * 2) {
    cout << 0 << endl;
    return 0;
  }

  COMinit();

  ll n = (x + y) / 3;
  ll r = x - n;


  cout << nCk(n, r) << endl;

  return 0;
}

Measured memory_bytes: 23936
#include <iostream>

using namespace std;

int main(){

    int N,K;
    string S;
    cin >> N >> K;
    cin >> S;
    for(int i = 0;i < S.size();i++){
        if(i == K-1){
            S[i] += 32;
        }
        cout << S[i];
    }
    cout << endl;
}

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

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int k;
    string s;
    cin >> k >> s;
    for (int i=0; i<min(k, (int)s.size()); i++) {
        cout << s[i];
    }
    if (s.size() > k) {
        cout << "...";
    }
    cout << endl;
}

Measured memory_bytes: 3128
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll t=1,i,j,k,n,m,x,y,z,a,b;
    // cin>>t;
    while(t--)
    {
        cin>>x>>y>>z>>n;
        while(n>0)
        {
            if(y<=x)
            {
                n--;
                y=y*2;
            }
            if(y>x)
            {
                break;
            }
        }
        while(n>0)
        {

            if(z<=y)
            {
                n--;
                z=z*2;
            }
            if(z>y)
            {
                break;
            }

        }
        if(z>y&&y>x)
        {
            cout<<"Yes"<<endl;
        }
        else
            cout<<"No"<<endl;



    }
    return 0;
}


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

using ll = long long;

#define for_(i, a, b) for(int i = (a);i < (b);++i)
#define rfor_(i, a, b) for(int i = (b)-1;i >= (a);--i)
#define rep(i, n) for_(i, 0, n)
#define rrep(i, n) rfor_(i, 0, n)

string N;
int t;

int main() {
  cin.tie(0);cout.tie(0);
  ios_base::sync_with_stdio(false);
  
  cin>>N;
  rep(i, N.length())t += N[i] - '0';
  
  cout<<(t==1?10:t)<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    int N,K;cin>>N>>K;
    if(K>(N-1)*(N-2)/2){
        cout<<-1<<endl;
        return 0;
    }
    else{
        vector<pair<int,int>> p;
        for(int i=2;i<=N;i++){
            p.push_back((pair<int,int>){1,i});
        }
        int k=0,l=2,r=3;
        while(k<(N-1)*(N-2)/2-K){
            p.push_back((pair<int,int>){l,r});
            k++;
            if(r==N){l++;r=l+1;}
            else{r++;}
        }
        cout<<p.size()<<endl;
        for(int i=0;i<p.size();i++){
            cout<<p[i].first<<" "<<p[i].second<<endl;
        }
        return 0;
    }
}

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

int main(void){
    long long int h = 0; 
    long long int cnt = 0, ans = 1, kaijo = 1;

    scanf("%lld", &h);

    while(h > 1){
        h /= 2;
        cnt++;
//        printf("h = %lld, cnt = %lld\n", h, cnt);
    }

    for(int i = 0; i < cnt; i++){
        kaijo *= 2;
        ans = ans + kaijo;
    }

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

} 


Measured memory_bytes: 256