akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    map<int , int> mp;
    rep(i, n) {
        int a; cin >> a;
        if (mp[a]) mp[a]--;
        else mp[a]++;
    }
    int sum = 0;
    for (auto e : mp) {
        if (e.second) sum++;
    }
    cout << sum << endl;
}
    


Measured memory_bytes: 4992
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
 
#define MOD 1000000007

long long d[1000001];
long long t[1000001];

int main(){
  int n;
  cin>>n;
  clr(d,0);
  clr(t,0);
  rep(i,0,n){
    int a;
    cin>>a;
    d[a]++;
  }
  rep(i,1,1000001){
    t[i] += t[i-1];
    t[i] += d[i]*i;
  }
  int m;
  cin>>m;
  vector<int> v;
  rep(i,0,m){
    int b;
    cin>>b;
    v.pb(b);
  }
  rep(i,0,m){
    long long c;
    cin>>c;
    if(t[v[i]]>=c){
      cout << "Yes" << endl; // YES?????§?????????
    }
    else{
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 18744
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> A(N) ;
    for(int i=0;i<N;i++){
        cin >> A.at(i) ;
    }
    int diff ;
    int max_diff=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if((A.at(i)) > (A.at(j))){
                diff = (A.at(i)) - (A.at(j));
                if(diff > max_diff){max_diff = diff ;}
            }
            else{
                diff = (A.at(j)) - (A.at(i));
                if(diff > max_diff){max_diff = diff ;}
            }
        }
    }
    cout << max_diff << endl;
}

Measured memory_bytes: 3612
import sys
input = sys.stdin.readline

L, R = map(int, input().split())
min = 2019
for i in range(L, R):
  for j in range(i+1, R+1):
    ans = (i*j) % 2019
    if ans == 0:
      print(0)
      exit()
    elif ans < min:
      min = ans

print(min)

Measured memory_bytes: 3060
package main

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

func main() {
	n := nextInt()
	var count int
	var slice []int

	for i := 0; i < n; i++ {
		a := nextInt()
		slice = append(slice, a)
	}

	for {
		for i := 0; i < n; i++ {
			if slice[i]%2 != 0 {
				goto RESULT
			}
			slice[i] = slice[i] / 2
		}
		count++
	}
RESULT:
	fmt.Println(count)
}

// 以下がテンプレート

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}

Measured memory_bytes: 640
using System;

namespace _1_5_D
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            int f = 0;

            for(int i = 1; i <= n; i++)
            {
                f = i;
                if (i % 3 == 0 | i % 10 == 3)
                {
                    Console.Write(" " + i);
                }
                else
                {
                    while (f > 10)
                    {
                        f /= 10;
                        if (f % 10 == 3)
                        {
                            Console.Write(" " + i);
                            break;
                        }
                    }
                }
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 9320
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	int x;
	for(int i=1;i<=5;i++)
	{
		cin>>x;
		if(i!=x)
			cout<<i<<'\n';
	}
}


Measured memory_bytes: 3620
/*
　　　　　　 ＿＿
　　　　　／＞　　 フ
　　　　　|   _　 _l  
　 　　　／` ミ＿x ノ   Zzz..
　　 　 /　 　 　 |   コード見ちゃだめ！！
　　　 /　 ヽ　　  ﾉ
　 　 │　　|　|  |   
　／￣|　　 |　|  |
　| (￣ヽ＿_ヽ_)_ _)
　＼二つ
*/

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) reverse((a).begin(),(a).end())
#define REP(i, n) for(int i = 0; i < n; i++)
const int MOD = 1e9+7;
typedef long long ll;


int main(){
  int n;
  cin>>n;
  vector<ll>a(n);
  vector<ll>b(n);
  for(int i=0;i<n;i++) cin>>a[i]>>b[i];
  ll total=0;

  for(int i=n-1;i>=0;i--){
    if((a[i]+total)%b[i]==0) ;
    else total+=(b[i]-(a[i]+total)%b[i]);
  }
  cout<<total<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;
ll mod=1e9+7;

ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)res=res*a %mod;
        a=a*a %mod;
        b/=2;
    }
    return res;
}

ll cd(ll a,ll b){
    ll res=1;
    for(ll i=1;i<=b;i++)res=res*(a-i+1)*power(i,mod-2) %mod;
    return res;
}

int main(){
    ll n,k;cin>>n>>k;
    vector<vector<ll> > c(n+1,vector<ll> (n+1,0));
    c[0][0]=1;
    for(int i=1;i<n+1;i++){
        c[i][0]=1;
        for(int j=1;j<n+1;j++){
            c[i][j]=(c[i-1][j-1]+c[i-1][j]) %mod;
        }
    }
   ll r=n-k,b=k;
    for(ll i=1;i<=k;i++){
        ll bb=c[b-1][i-1];
        if(r<i-1){cout<<0<<endl;continue;}
        if(r==i-1){cout<<bb<<endl;continue;}
        ll rr=c[r+1][i];
        cout<<bb*rr%mod<<endl;
        
    }
    
}

Measured memory_bytes: 31616
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
a = na()
a.sort()
b = [0]*1000001

s = set()

for i in a:
    if b[i]:
        continue
    if i in s:
        b[i] = 1
    s.add(i)
    for j in range(2, 1000001):
        if i*j > 10 ** 6:
            break
        b[i*j] = 1

ans = 0
for i in a:
    if b[i] == 0:
        ans += 1

print(ans)


Measured memory_bytes: 122708
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file
#else

#endif

const LL mod = 998244353;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Togliere nei problemi con query online

    int N, S;
    cin >> N >> S;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    vector<vector<LL>> sf(N+1);
    for (int i = 0; i <= N; i++) sf[i].resize(S+1, 0);
    sf[0][0] = 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= S; j++) {
            sf[i+1][j] = 2*sf[i][j] % mod;
            if (A[i] <= j) sf[i+1][j] += sf[i][j-A[i]];
            sf[i+1][j] %= mod;
            //~ cout << i << " " << j << " " << sf[i+1][j] << endl;
        }
    }
    //~ LL res = 0;
    //~ for (int i = 1; i <= N; i++) res += sf[i][S], res %= mod; 
    cout << sf[N][S] << "\n";
}


Measured memory_bytes: 73688
#include <iostream>
#include <limits>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[])
{
    string s, t;
    cin >> s >> t;
    int minimum = numeric_limits<int>::max();
    int diff = s.length() - t.length();
    for(int i = 0 ; i <= diff ; ++i){
        // place t at position i and count mismatch
        int mismatch = 0;
        for(int j = i, counter = 0 ; counter < t.length() ; ++j, ++counter){
            if(s[j] != t[counter]) ++mismatch;
        }
        minimum = min(minimum, mismatch);
    }
    cout << minimum << '\n';
    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 25, M = 1e6 + 25, oo = 1e9+7, mxmsk = 1 << 16;
const long long OO = 1e18+25;
#define par pair<pair<int,int>, int>
#define f first
#define s second
    
char s1[5], s2[5];
int n;

int main()
{
    scanf("%s%s",s1,s2);
    int i=0;
    while(s1[i])
    {
        n += (s1[i] == s2[i]);
        i++;
    }
    printf("%d",n);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll Q,n,a,b,ans;
priority_queue<ll> que;
priority_queue<ll,vector<ll>,greater<ll>> que2;
int main(void){
    cin>>Q;
    while(Q--){
        cin>>n;
        if(n==1){
            cin>>a>>b;
            ans+=b;
            que.push(a);
            que2.push(a);
            ll q1=que.top();
            ll q2=que2.top();
            ans+=abs(q1-q2);
            if(q1>q2){
                que.pop();
                que2.pop();
                que.push(q2);
                que2.push(q1);
            }
        }
        else{
            cout<<que.top()<<" "<<ans<<endl;
        }
    }
}


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



int main()
{
	int m, f, r;
	int i = 0;
	char ans;
	while (1)
	{
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1) break;
		else
		{
			if (m == -1 || f == -1)
			{
				ans = 'F';
			}
			else if (m + f >= 80)
			{
				ans = 'A';
			}
			else if (m + f >= 65)
			{
				ans = 'B';
			}
			else if (m + f >= 50)
			{
				ans = 'C';
			}
			else if (m + f >= 30 && r >= 50)
			{
				ans = 'C';
			}
			else if (m + f >= 30 && r < 50)
			{
				ans = 'D';
			}
			else
			{
				ans = 'F';
			}
			cout << ans << endl;
		}
	}	
	return 0;
}

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

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

int gcd(int x, int y){
	return y ? gcd(y,x%y) : x;
}

int main(){
	int d[10],v1,v2;
	while(~scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",d,d+1,d+2,d+3,d+4,d+5,d+6,d+7,d+8,d+9,&v1,&v2)){
		int dis=0;
		rep(i,10)dis+=d[i];
		int j;
		//printf("dis:%d  k:%lf\n",dis,k);
		int sum = 0;
		for(j=0; j<10; j++){
			sum += d[j];
			if( sum*(v1+v2)>=dis*v1 ){
				printf("%d\n",j+1);
				break;
			}
		}
		
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>

using namespace std;
void insertSort(int a[], int n);
void printOut(int a[], int n);

int main() {
    const int MAX = 100;
    int n, a[MAX];
    cin >> n;
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    printOut(a, n);
    insertSort(a, n);
    return 0;
}

void printOut(int a[], int n) {
    for (int k = 0; k < n; k++) cout << a[k] << (k < n - 1 ? " " : "\n");
}


void insertSort(int a[], int n) {
    int i, j, key;
    for (i = 1; i < n; i++) {
        key = a[i];
        j = i - 1;
        while (j >= 0 && a[j] > key) {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = key;
        printOut(a, n);
    }
}




Measured memory_bytes: 3216
#include <stdio.h>
#include <math.h>

int main()
{char s[1001],t[1001];scanf("%s",s);scanf("%s",t);int j;
int min=1000,ans[10001];for(j=0;j<=1000;j++)ans[j]=0;
for(j=0;s[j]!='\0';j++)
{
    int k=0,u=0;
    while(t[k]!='\0')
    {
        if(s[j+k]=='\0')
        {
            u++;break;
        }
        if(s[j+k]!=t[k])
            ans[j]++;
        k++;
    }
    if(u==1)
        break;
    else if(min>ans[j])
        min=ans[j];
}
printf("%d\n",min);
return(0);
}


Measured memory_bytes: 1744
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <stack>
#include <tuple>
#include <vector>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int i;
    stack<int> S;
    char a[100];

    while(scanf("%s", a) != EOF) {
        if(a[0] == '+') {
            if(S.size() > 1) {
                i = S.top();
                S.pop();
                S.top() += i;
            }
        } else if(a[0] == '-') {
            if(S.size() > 1) {
                i = S.top();
                S.pop();
                S.top() -= i;
            }
        } else if(a[0] == '*') {
            if(S.size() > 1) {
                i = S.top();
                S.pop();
                S.top() *= i;
            }
        } else {
            S.push(atoi(a));
        }
    }
    cout << S.top() << endl;
}


Measured memory_bytes: 3280
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

signed main() {

  int n;cin >>n;
  int ans = 0;
  rep(i,1,n)
  {
    if(i%2==0)continue;
    int cnt = 0;
    rep(j,1,i)
    {
      if(i%j==0)cnt++;
    }
    if(cnt==8) ans++;
  }
  cout << ans << endl;
     
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

constexpr ll LNF = 1e15+7;

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h,w; cin >> h >> w;
    rep(i,0,h){
      rep(j,0,w){
        string s; cin >> s;
        if(s=="snuke"){
          cout << char('A'+j) << i+1 << endl;
        }
      }
    }
}

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

int main(){
  int n, a, i, b;
  int c=1;
  cin >> n;
  int d[n];
  
  for(i=0;i<n;i++){
    cin >> d[i];
  }
  sort(d, d+n, greater<int>());
  b=d[0];
  for(i=1;i<n;i++){
    a=d[i];
    if(b!=a){
      c++;
    }
    b=a;
  }
  cout << c << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N = int(input())
    abc = [None] * N

    for i in range(N):
        abc[i] = list(map(int, input().split()))
    
    dp = [[0]*3 for _ in range(N+1)]# a,b,c

    for i in range(N):
        for j in range(3):
            dp[i+1][j] = max(dp[i][(j+1)%3]+abc[i][(j+1)%3], dp[i][(j+2)%3]+abc[i][(j+2)%3])
    print(max(dp[N]))

if __name__ == "__main__":
    main()


Measured memory_bytes: 50600
import java.util.Scanner

object Main {
  def solve(sc: => Scanner): Unit = {
    val N, T = sc.nextInt
    val A = Array.fill[Int](T + 2)(0)
    for (_ <- 0 until N) {
      val r, l = sc.nextInt
      A(r) += 1
      A(l) -= 1
    }
    for (i <- 0 to T) {
      A(i + 1) += A(i)
    }
    println(A.max)
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Measured memory_bytes: 191796
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=998244353;
const LL LINF=1LL<<62;
const int INF=1<<20;


int main(){
    int n;
    while(cin >> n,n){
        string s[n];
        for (int i = 0; i < n; i++) {
            cin >> s[i];
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if(s[i].find(s[j])!=string::npos&&i!=j){
                    s[j]="";
                }
            }
        }
        int cost[n][n];
        memset(cost,0,sizeof(cost));
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                for (int k = 1; k <= s[i].length() && k <= s[j].length(); k++) {
                    for (int l = 0; l < k; l++) {
                        if(s[i][s[i].length()-k+l]!=s[j][l]) break;
                        if(l==k-1) cost[i][j]=k; 
                    }
                }
            }
        }
        int sum=0;
        for (int i = 0; i < n; i++) {
            sum+=s[i].length();
        }
        int dp[(1<<n)][n];
        memset(dp,-1,sizeof(dp));
        for (int i = 0; i < n; i++) {
            dp[1<<i][i]=0;
        }
        for (int bit = 1; bit < (1<<n); bit++) {
            for (int i = 0; i < n; i++) {
                if(dp[bit][i]==-1) continue;
                for (int j = 0; j < n; j++) {
                    if(bit&(1<<j)) continue;
                    int nx=bit|(1<<j);
                    dp[nx][j]=max(dp[nx][j],dp[bit][i]+cost[i][j]);
                }
            }
        }
        int ans=0;
        for (int i = 0; i < n; i++) {
            ans=max(ans,dp[(1<<n)-1][i]);
        }
        cout << sum-ans << endl;
    }
    return 0;
}




Measured memory_bytes: 4064
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
const unsigned long long h = 1e9+7;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MAX = 100010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    Yes(a*b%2);
}    


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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

signed main() {
  ll N;
  cin >> N;
  vll X(N), Y(N);
  rep(i, N) {
    cin >> X[i] >> Y[i];
  }

  vll p(N);
  rep(i, N) {
    p[i] = i;
  }

  ld sum = 0;
  ld count = 0;
  do {
    rep(i, N) {
      if (i == 0) {
        continue;
      }

      ll x1 = X[p[i]];
      ll y1 = Y[p[i]];
      ll x2 = X[p[i - 1]];
      ll y2 = Y[p[i - 1]];
      sum += sqrtl((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    }
    count++;
  } while (next_permutation(ALL(p)));
  COUTF(sum / count);
  return 0;
}

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

#define ll long long
#define eb emplace_back
#define fi first
#define se second

using namespace std;

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	int n;
	cin >> n;
	int res = 0;
	for (int i = 1; i <= n; ++i) {
		int x;
		cin >> x;
		if (i % 2 == 1 && x % 2 == 1) {
			res++;
		}
	}
	cout << res << "\n";
}


Measured memory_bytes: 3620
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define all(x) x.begin(),x.end()
#define endl '\n'
#define read(FILE)  freopen(FILE, "r", stdin);
#define out(FILE) freopen(FILE, "w", stdout);
#define all(x) x.begin(),x.end()
#define clr(v,val) memset(v,val,sizeof(v))
#define rep(i,m,n) for(int i=m ; i<n ; i++)
#define forr(i,m,n) for(int i=m ; i<=n ; i++)
#define pb push_back
#define pff push_front
#define re return
#define gcd __gcd
#define bit __builtin_popcountll
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e5 + 10;
using namespace std;
int cnt=1;
bool isPrime(ll x){
    //Prime Check
    if(x==2)
        return 1;
    if(x%2==0||x==1)
        return 0;
    for(ll i=3;i<=sqrt(x);i+=2){
        if(x%i==0)
            return 0;
    }
return 1;}

void divisors(ll n) {
    for(ll i=1; i*i<=n; i++)
        if(n%i==0)
        {
            if(isPrime(i))
                cnt++;
            if(n/i!=i)
                if(isPrime(n/i))
                    cnt++;
        }

}
int main(){
    IO;
    ll a,b,g=0; cin>>a>>b;
    g=gcd(a,b);
    divisors(g);
    cout<<cnt;

}


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

using namespace std;

typedef long long ll;

ll n;
char s[15];
vector<string> vs;

int main()
{
    cin>>n;
    for(ll i = 0; i < n; i++)
    {
        scanf("%s", s);
        vs.push_back(s);
    }
    sort(vs.begin(), vs.end());
    vs.erase(unique(vs.begin(), vs.end()), vs.end());
    printf("%lld", (ll)vs.size());
    return 0;
}


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

int main() {
  int a,b;
  cin >> a >> b;
  1 <= a,b <=10000;
    if (a * b % 2 == 0) {
    cout << "Even" << endl;
    }
  else {
  cout << "Odd" << endl;
  }
}

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

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


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

using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> ab(M);
    for (int i = 0; i < M; i++)
    {
        cin >> ab[i].second >> ab[i].first;
        ab[i].second--, ab[i].first--;
    }

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

    long long int ans = 0;
    int t = -1;
    for (int i = 0; i < M; i++)
    {
        if (t <= ab[i].second)
        {
            ans++;
            t = ab[i].first;
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	int ans = 0;
	for(auto o = 0; o <= 1; ++o){
		for(auto p = 0; p <= 9; ++p){
			for(auto q = 0; q <= 9; ++q){
				for(auto r = 0; r <= 9; ++r){
					for(auto s = 0; s <= 9; ++s){
						int t = o * 10000 + p * 1000 + q * 100 + r * 10 + s;
						int u = o + p + q + r + s;
						if(t <= n && a <= u && u <= b) ans += t;
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=a;
	}
	return res;
}
lint modpow(lint a,unsigned int b,unsigned int mod){
	lint res(1),now(a%mod);
	while(b){
		if(b&1){
			res*=now;
			res%=mod;
		}
		b>>=1;
		now*=now;
		now%=mod;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
lint a[55],b[55];
lint sum(lint n,lint m){
	if(m==0)return 0;
	if(n==0)return 1;
	if(m<=a[n]/2)return sum(n-1,m-1);
	return b[n-1]+sum(n-1,m-2-a[n-1])+1;
}
int main(){
	lint n,x;
	std::cin>>n>>x;
	a[0]=1;b[0]=1;
	REP(i,n){
		a[i]=a[i-1]*2+3;
		b[i]=b[i-1]*2+1;
	}
	std::cout<<sum(n,x)<<std::endl;
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

int n, k;
vvi DP(1002, vi(1002, -1));

int dp(int ind, int last) {
    if (ind == n) return 1;
    if (DP[ind][last] != -1) return DP[ind][last];
    int ans = 0;
    for (int i = 0; i < k; ++i) {
        if (i == last) continue;
        ans += dp(ind+1, i);
    }
    return DP[ind][last] = ans;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> k;
    cout << dp(0, 1001) << "\n";
    return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
int main(){
int64_t N,K;
  cin>>N>>K;
  vector<int64_t> p(N);
  int64_t S=0;
  for(int i=0;i<N;i++){
    cin>>p[i];
    S+=p[i];
  }
  priority_queue<int64_t> pq;
  for(int i=1;i*i<=S;i++){
    if(S%i==0){
      pq.push(i);
      pq.push(S/i);
    }
  }
  while(true){
    int64_t a=pq.top();
    pq.pop();
    int64_t A=0;
    vector<int64_t> q(N,-1);
    for(int i=0;i<N;i++){
      A+=p[i]%a;
      q[i]*=p[i]%a;
    }
    sort(q.begin(),q.end());
    int64_t B=A/a;
    for(int i=0;i<B;i++){
      A+=q[i];
    }
    if(K>=A){
      cout<<a<<endl;
      break;
    }
  }
}

Measured memory_bytes: 3632
S = input()
T = input()
ans = 0
for i in range(len(S)):
    cnt = 0
    if (i+len(T)-1)==len(S):
        break
    for j in range(len(T)):
        if T[j]==S[i+j]:
            cnt += 1
    ans = max(ans,cnt)

print(len(T)-ans)


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

int main()
{
	ll x;
	cin >> x;
	ll ans = 0;
	ans += x/11*2;
	x %= 11;
	if(x>6)ans += 2;
	else if(x>0)ans +=1;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,m;
    cin >> n >> m;
    vl x(n),y(n),z(n);
    rep(i,n) cin >> x[i] >> y[i] >> z[i];
    ll ans = 0;
    rep(bit,1<<3) {
        ll nans = 0;
        vector<ll> v;
        rep(i,n) {
            ll nx = x[i],ny = y[i],nz = z[i];
            if(bit&1) nx = -nx;
            if(bit>>1&1) ny = -ny;
            if(bit>>2&1) nz = -nz;
            v.pb(nx+ny+nz);
        }
        sort(rall(v));
        rep(i,m) nans += v[i];
        chmax(ans,nans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
function Main(S) {
  const K = parseInt(S.split("\n")[0]);
  const A = parseInt(S.split("\n")[1].split(" ")[0]);
  const B = parseInt(S.split("\n")[1].split(" ")[1]);
  let ans = '';
  for (let i = A; i <= B; i++) {
      if (i % K === 0) {
          ans = 'OK'
      }
  }

  console.log(ans === '' ? 'NG' : 'OK');
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29996
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <iomanip>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
 
#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define PI acos(-1.0)
const int N=1e5 + 5;
const int M=1e7 + 5;
 
 
int main()
{
    ios_base::sync_with_stdio(false);
    int n,i;
    ll s[N],d[N];
    cin>>n;
    ll tot = 0;
    for(i=0;i<n;i++){
        cin>>s[i];
        tot += s[i];
        if(i>0) d[i]=s[i]-s[i-1];
    } 
    d[0]=s[0]-s[n-1];
    ll t;
    ll lu = ((ll)n*(n+1))/2;
    if(tot%lu != 0){
        cout << "NO\n";
        return 0;
    }
    t = tot/lu;
    for(i=0;i<n;i++){
        d[i]=d[i]-t;
        //cout << d[i] << endl;
    }

    bool ok = true;
    ll cnt = 0;
    ll foo = n;
    for(i=0;i<n;i++){
        if(d[i]>0){
            ok=false;
            break;
        }
        d[i]*=-1;
        if(d[i]%foo!=0){
            ok=false;
            break;
        }
        cnt += d[i]/foo;
    }
    if(!ok || cnt!=t){
        cout << "NO\n";
        return 0;
    }
    cout << "YES\n";



 
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
#define rep(i,N) for(int i=0;i<N;i++)

long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;

int main(){
long long ans=0;
int N;
cin>>N;
long long  member[5]={};
rep(i,N){
    char c;
    string s;
    cin>>s;
    c=s[0];
    if(c=='M')member[0]++;
    if(c=='A')member[1]++;
    if(c=='R')member[2]++;
    if(c=='C')member[3]++;
    if(c=='H')member[4]++;
}

long long t=member[0]*member[1];
rep(i,3){
    ans+=t*member[2+i];
}
t=member[0]*member[2];
rep(i,2)ans+=t*member[3+i];

ans+=member[0]*member[3]*member[4];

t=member[1]*member[2];
rep(i,2)ans+=t*member[3+i];

t=member[3]*member[4];
rep(i,2)ans+=t*member[1+i];

cout<<ans<<endl;

 return 0;
}
/*
5
MASHIKE
RUMOI
OBIRA
HABORO
HOROKANAI

2

4
ZZ
ZZZ
Z
ZZZZZZZZZZ

0

5
CHOKUDAI
RNG
MAKOTO
AOKI
RINGO

7
*/

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <queue>

#define pb push_back
     
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
     
bool debug = false;
     

struct state
{
    ll a,b,c;

    state(ll a, ll b, ll c) : a(a), b(b), c(c)
    {

    }

  bool operator==(const state &other) const
  { return (a == other.a
            && b == other.b
            && c == other.c);
  }
};


struct KeyHasher
{
    size_t operator()(const state& k) const
  {
    //using std::size_t;
    //using std::hash;
    //using std::string;

    return ((hash<ll>()(k.a)
               ^ (hash<ll>()(k.b) << 1)) >> 1)
               ^ (hash<ll>()(k.c) << 1);
  }
};  


void solve(ll casen)
{
    ll res = 0;
    
    cout << "Case #" << casen << ": " << res << endl;
}

int main()
{
    // $ g++ -std=c++14 -Wshadow -Wall -o c C.cpp

    // !!! Here, unordered map was too slow!!!
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    string s, res = "";
    cin >> s;

    for (int i = 0; i < s.length(); i++)
    {
    	if (s[i] != '?')
    		res += s[i];
    	else
    		res += 'D';
    }

    cout << res << endl;


    return 0;
}

Measured memory_bytes: 3892
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def dfs(x,f):
        dx = d[x]
        for y,c in v[x]:
            if not f[y]:
                nd = dx+c
                if d[y] < nd:
                    d[y] = nd
                    f[y] = 1
                    dfs(y,f)
                    f[y] = 0
            else:
                nd = dx+c
                if nd > d[y]:
                    d[y] = float("inf")
                    dfs(y,f)
    n,m,p = LI()
    v = [[] for i in range(n)]
    for _ in range(m):
        a,b,c = LI()
        a -= 1
        b -= 1
        w = c-p
        v[a].append((b,w))
    d = [-float("inf")]*n
    d[0] = 0
    f = [0]*n
    f[0] = 1
    dfs(0,f)
    ans = d[n-1]
    if ans == float("inf") or ans == -float("inf"):
        print(-1)
    else:
        print(max(0,ans))
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 9844
MOD = 10**9 + 7
S = input()

s = [0]*4

s[0] = 1

for c in S:
    if c == "?":
        s = [s[0]*3,s[1]*3+s[0],s[2]*3+s[1],s[3]*3+s[2]]
        for i in range(4):
            s[i] %= MOD
    else:
        i = "ABC".find(c)
        s[i+1] += s[i] % MOD
print(s[3]%MOD)

Measured memory_bytes: 42092
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>
#include <stack>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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 rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n;
  cin >> n;
  vector<ll> a(n+1, 1);
  for (int i = 2; i <= n; ++i) {
    int k = 1;
    while (i*k <= n) {
      ++a[i*k];
      ++k;
    }
  }
  // printvec(a);

  ll ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += i*a[i];
  }

  cout << ans << endl;
}


Measured memory_bytes: 81340
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007

void solve() {
        string str; cin >> str;
        if (str[2]== str[3]&& str[4]== str[5]) cout << "Yes\n";
        else cout << "No\n";
}

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int t = 1;
        //cin >> t;
        while ( t-- ) {
                solve();
        }
return 0;
}




Measured memory_bytes: 256
function main(input){
  const args = input.split('\n');
  const N = args[0],
        nums = args.slice(1, args.length - 1);
  //filterによるindex番号と元の配列のindex番号が一致している場合のみを返す
  //そうすることで、重複している値を削除することができる
  var count = nums.filter(function(n,i,j){
    return j.indexOf(n) === i;
  }).length;
  console.log(count);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
 
        Scanner scan = new Scanner(System.in);

        int i;
        int j;
 
        while(true){
            int H = scan.nextInt();
            int W = scan.nextInt();
            if(H == 0 && W == 0 || H > 300 || W > 300)break;
            for(j = 0; j < H; j++){
                for(i = 0; i < W; i++){
                    System.out.print("#");
                }
            System.out.println();
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 26860
#include<iostream>
#include<stdio.h>
#define mx 200007
using namespace std;
typedef long long int LL;
int main() {
	ios_base::sync_with_stdio(false);
	int a, b, c;
	cin >> a >> b >> c;
	if(a + b + c >= 22) {
		cout << "bust" << endl;
	} else {
		cout << "win" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
N = int(input())
sum_money = 0

for i in range(N):
    x = input().split()
    if x[1]=='JPY':
        sum_money = sum_money + int(x[0])
    else :
        sum_money = sum_money + float(x[0])*380000
    x=[]

print(sum_money)

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

int main() {
    std::string str;
    std::cin >> str;
    if(str == "Sunny") std::cout << "Cloudy" << std::endl;
    else if(str == "Cloudy") std::cout << "Rainy" << std::endl;
    else if(str == "Rainy") std::cout << "Sunny" << std::endl;
    return (0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
int main(){
FASTIO	
ll n;
cin>>n;
ll k;
cin>>k;
int a[n];
for(int i=0;i<n;i++)
   cin>>a[i];
ll l1=0,l2=0;   
for(int i=0;i<n;i++){
	for(int j=0;j<=i-1;j++){
		if(a[j]>a[i])
		   l1++;
	}
	for(int j=i+1;j<n;j++){
		if(a[j]>a[i])
		   l2++;
	}
}  
if(k==1){
	cout<<l1;
	return 0;
} 
//cout<<l1<<'\n';
ll ans;
if((k%2)==0){
	ans = ((((k/2)%mod*(k+1)%mod)%mod)*l1)%mod;
}
else if(((k+1)%2)==0){
	ans = (((k%mod*((k+1)/2)%mod)%mod)*l1)%mod;
}
if((k%2)==0){
	ans = (ans + ((((k/2)%mod*(k-1)%mod)%mod)*l2)%mod)%mod;
}
else if(((k-1)%2)==0){
	ans = (ans + (((k%mod*((k-1)/2)%mod)%mod)*l2)%mod)%mod;
}
cout<<ans;
return 0;
}

Measured memory_bytes: 256
a,b,c,d = map(int,input().split())
a -= 1

# 最大公約数＜ユークリッドの互除法＞
def gcd(a,b):
  while b != 0:
    a, b = b, a % b
  return a
# 最小公倍数
def lcm(a,b):
    return a // gcd(a,b) * b


a_f = a // c + a // d - a // lcm(c,d)
b_f = b // c + b // d - b // lcm(c,d)

print((b-b_f) - (a-a_f))



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>

#ifdef _MSC_VER
#include <Windows.h>
#else
#include <unistd.h>
#endif

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD=(LL)1e9+7;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

#define INF 1LL << 50

LL A[100003];
int main(){
    int N;
    cin>>N;
    REP(i,N){
        cin>>A[i];
    }
    LL sum=0;
    REP(i,N){
        if(i!=N-1&&A[i]%2==1&&A[i+1]>0){
            sum++;
            A[i]--;A[i+1]--;
        }
        if(i!=0&&A[i]%2==1&&A[i-1]>0){
            sum++;
            A[i]--;A[i-1]--;
        }
    }
    REP(i,N)sum+=A[i]/2;
    cout<<sum<<endl;
    return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	vector<ll> A=vecin<ll>(N);
	vector<ll> B(N),C(N);

	map<ll,ll> MB,MC;
	REP(i,N){
		if(A[i]>=N) continue;
		B[i] = i-A[i];
		C[i] = A[i]+i;
		MB[B[i]]++;
		MC[C[i]]++;
	}

	ll sum=0;
	for(auto& x:MB){
		ll V=x.first;
		sum += x.second * MC[V];
	}
	out(sum);
	return 0;
}


Measured memory_bytes: 33924
M=2**61-1;eval"N,*A="+`dd`.split*?,;C=[0,N].map{|z|y=A[z+N-1];(A[z,N]*3).map{|x|y^y=x}};e,f=C.map{|z|z[b=0,N].map{|x|b=b*9+x&M};b};q=1-9**N&M;N.times{|i|e==f&&p(i,A[i]^A[N]);e=e*9+C[0][i]*q&M}

Measured memory_bytes: 121104