akhauriyash/Code-Regression huggingface dataset:
package main

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

func contains(base string, target string) bool {
	for _, str := range base {
		if string(str) == target {
			return true
		}
	}
	return false
}

func main(){
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	N, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	S := sc.Text()
	
	max := 0
	for i := 1; i < N; i++ {
		cnt := 0
		S1 := S[0:i]
		S2 := S[i:len(S)]
		for x := 'a'; x <= 'z'; x++ {
			if contains(S1, string(x)) && contains(S2, string(x)) {
				cnt++
			}
		}
		
		if max < cnt {
			max = cnt
		}
	}
	
	fmt.Println(max)
}



Measured memory_bytes: 640
n=int(input())
a=[int(x) for x in input().split()] 
if sum(a)%2==0:
  print(sum(a)//2)
else:
  s=0
  a.sort()
  for i in a:
    if i%2==1:
      s=i
      break
  print((sum(a)-s)//2)  


Measured memory_bytes: 5604
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for(int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    a[i] = x - y;
    b[i] = x + y;
  }
  int FX = *max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end());
  int FY = *max_element(b.begin(), b.end()) - *min_element(b.begin(), b.end());
  cout << max(FX, FY) << endl;
  return 0;
}

Measured memory_bytes: 4796
N = int(input())
K = [1, 9, 30, 76, 141, 267, 400, 624, 885, 1249, 1590, 2208, 2689, 3411, 4248, 5248, 6081, 7485, 8530, 10248, 11889, 13687, 15228, 17988, 20053, 22569, 25242, 28588, 31053, 35463, 38284, 42540, 46581, 50893, 55362, 61824, 65857, 71247, 76884, 84388, 89349, 97881, 103342, 111528, 120141, 128047, 134580, 146316, 154177, 164817, 174438, 185836, 194157, 207927, 218812, 233268, 245277, 257857, 268182, 288216, 299257, 313635, 330204, 347836, 362973, 383709, 397042, 416448, 434025, 456967, 471948, 499740, 515581, 536073, 559758, 583960, 604833, 633651, 652216, 683712, 709065, 734233, 754734, 793188, 818917, 846603, 874512, 909496, 933081, 977145, 1006126, 1041504, 1073385, 1106467, 1138536, 1187112, 1215145, 1255101, 1295142, 1342852, 1373253, 1422195, 1453816, 1502376, 1553361, 1595437, 1629570, 1691292, 1726717, 1782111, 1827492, 1887772, 1925853, 1986837, 2033674, 2089776, 2145333, 2197483, 2246640, 2332104, 2379085, 2434833, 2490534, 2554600, 2609625, 2693919, 2742052, 2813988, 2875245, 2952085, 3003306, 3096024, 3157249, 3224511, 3306240, 3388576, 3444609, 3533637, 3591322, 3693924, 3767085, 3842623, 3912324, 4027884, 4102093, 4181949, 4270422, 4361548, 4427853, 4548003, 4616104, 4718640, 4812789, 4918561, 5003286, 5131848, 5205481, 5299011, 5392008, 5521384, 5610705, 5739009, 5818390, 5930196, 6052893, 6156139, 6239472, 6402720, 6493681, 6623853, 6741078, 6864016, 6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897, 8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813, 10493367, 10611772, 10813692]

print(K[N-1])

Measured memory_bytes: 9384
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) (a).begin(),(a).end()

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

int main(){
    int n;
    cin >> n;
    
    vector<ll> t(n);
    bool flag = false;
    rep(i, n){
        cin >> t[i];
        if(t[i] == 1000000000000000000)flag = true;
    }
    if(flag){
        cout << 1000000000000000000;
        return 0;
    }
    ll lcm = t[0];
    for(int i = 1; i < n; i++){
        if(lcm > t[i])lcm = lcm/gcd(lcm, t[i])*t[i];
        else lcm = t[i]/gcd(t[i], lcm)*lcm;
    }
    cout << lcm << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N; cin >> N;
    vector<int> D(N);
    vector<int> Dcount(13);
    for (int i = 0; i < N; i++) {
        cin >> D[i];
        Dcount[D[i]]++;
    }
    
    for (int i = 0; i < 13; i++) {
        if (2 < Dcount[i] || Dcount[0]) {
            cout << 0 << endl;
            return 0;
        }
    }
    
    int ans = -1;    
    for (int i = 0; i < (1 << 12); i++) {
        vector<int> jikoku;
        int bits = i;
        int jisa_min = 13;
        for (int j = 0; j < 12; j++) {
            if (Dcount[j+1] == 0) continue;
            else if (Dcount[j+1] == 2) {
                jikoku.push_back(j+1);
                jikoku.push_back(24-j-1);
            } else if ((1 << j) & bits) {
                jikoku.push_back(j+1);
            } else {
                jikoku.push_back(24-j-1);
            }
        }
        for (int i = 0; i < jikoku.size(); i++) {
            jisa_min = min(min(jikoku[i], 24 - jikoku[i]), jisa_min);
        }
        for (int i = 0; i < jikoku.size(); i++) {
            for (int j = i+1; j < jikoku.size(); j++) {
                jisa_min = min(jisa_min, min(abs(jikoku[i] - jikoku[j]), abs(min(jikoku[i], jikoku[j]) + 24 - max(jikoku[i], jikoku[j]))));
            }
        }
        ans = max(jisa_min, ans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
s = input()
ans = 0
for i in range(10):
    a = s.find(str(i))
    if a != -1:
        for j in range(10):
            b = s[a+1:].find(str(j))
            if b != -1:
                for k in range(10):
                    c = s[a+1:][b+1:].find(str(k))
                    if c != -1:
                        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>

#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) {
        cin >> A[i];
    }
    int xored = A[0];
    for(int i=1; i<N; ++i) {
        xored ^= A[i];
    }

    //cout << xored << endl;
    rep(i, N) {
        int ret = xored ^ A[i];
        cout << ret << " ";
    } 
    cout << endl;


    return 0;
}


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

int main() {
  int n,count = 0,p;
  cin >> n;
  for(int i = 1; i <= n; i++){
    cin >> p;
    if(!(i == p)){
      count++;
    }
  }
  if(count >= 3){
    cout << "NO" << endl;
  }else{
    cout << "YES" << endl;
  }
}


Measured memory_bytes: 256
/*------------------------- Bism Allah Alruhmin Alrahim -------------------------------*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i > -1; i--)
#define forl(i, l, r) for (int i = l; i <= r; i++)
#define vc vector
#define f first
#define s second
#define pb(i) push_back(i)
#define mx(ar, n) (*max_element(ar, ar + n))
#define mn(ar, n) (*min_element(ar, ar + n))

using namespace std;

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


int main()
{
    int a, b , c = 1 ;
    int n ;
    cin >> n ; 
    cin >> a; 
    for (int i = 0; i < n-1; i++)
    {
        int x ; cin >> x; 
        if(x>=a){
            c++;
            a = x ;
        }
    }
    cout << c << endl ;
    return 0 ;
}

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

ll calc(ll a , ll d, ll l)
{
    return (l-a)/d;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
     
   // ll t;cin>>t;while(t--)
    {
        unordered_map<ll,ll> mp,p;
        ll n,k;
        cin>>n>>k;
        ll a[n];
        for(ll i=0;i<n;i++)
            cin>>a[i];
        
        for(ll i=0;i<n;i++)
        {
            for(ll j=0;j<n;j++)
            {
                if(a[i]>a[j])
                {
                    mp[i]++;   
                }
            }
            for(ll j=i+1;j<n;j++)
            {
                if(a[j]<a[i])
                {
                    p[i]++;
                }
            }
        }
        // for(ll i=0;i<n;i++)
        // {
        //     cout<<mp[i]<<" ";
        // }
        // cout<<endl;
        ll ans=0,mod=1e9+7;
        for(ll i=0;i<n;i++)
        {
            // cout<<p[i]<<" ";
            if(mp[i]==0)
                continue;
            ll l=p[i]+mp[i]*(k-1);
            ll a=(l%mp[i]);
            ll d= mp[i];
            ll n=calc(a,d,l)+1;
            
            ll sum=(((__int128)n*(a+l))/2)%mod;
            
            ans = ((__int128)ans + sum)%mod; 
            
        }
        cout<<ans<<endl;
        
        
    }
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int num=sc.nextInt();
        int min=0,max=0,x;
        Long sum=0L;
        
        for(int i=0;i<num;i++){
            x=sc.nextInt();
            if(i==0){
                min=x;
                max=x;
            }
            else{
                if(max<x){
                    max=x;
                }else if(min>x){
                    min=x;
                }else{
                    
                }    
            }
            sum=sum+x;
        }  
        System.out.println(min+" "+max+" "+sum);
    }    
}


Measured memory_bytes: 42324
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
n = int(input())
l = factorization(n)
ans = 0
for c in l:
    if c[0]==1:
        break
    lim = c[1]
    num = 1
    while lim >= num:
        lim -= num
        num += 1
    ans += num-1
print(ans)

Measured memory_bytes: 9488
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using vi = vector<int>;

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

#define P (1'000'000'007)

signed main() {
    int a, b;
    cin >> a >> b;

    int g = gcd(a, b);

    map<int, int> m;

    for (int i = 2; i <= sqrt(g); ++i) {
        while (g % i == 0) {
            g /= i;
            if (auto it = m.find(i); it != m.end()) {
                it->second++;
            } else {
                m.emplace(i, 1);
            }
        }
    }

    if (g > 1) {
        if (auto it = m.find(g); it != m.end()) {
            it->second++;
        } else {
            m.emplace(g, 1);
        }
    }

    cout << m.size() + 1;

    return 0;
}

Measured memory_bytes: 3200
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < n; i++)
const int INF = 1001001001;

int main() {
    string o, e;
    cin >> o >> e;
    int n = o.size();
    int m = e.size();
    if ((n+m) % 2 == 0) {
        rep(i, n) cout << o[i] << e[i];
        cout << endl;
    }
    else {
        rep(i, m) cout << o[i] << e[i];
        cout << o[n - 1] << endl;
    }
 	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod= 1e9+7;
const ll INF = 1LL<<40;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

main(){
  ll n,a,b,c,ans=1e9;
  string s;
  cin>>s;
  ll f=s.length();
  rep(i,0,f)cout<<"x";
  
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = [0]
for nums in A:
  B.append(B[-1]+nums)
d = {}
for nums in B:
  if nums in d:
    d[nums] += 1
  else:
    d[nums] = 1
ans = 0
for keys in d:
  ans += d[keys]*(d[keys]-1)//2
print(ans)

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

using namespace std;

// 1 から max までの重複しない 3 つの数字を選び、それらの合計が obj になるような組み合わせを探す.
// Input: 最大値 max と目的値 obj
// Output: 目的値 obj となる組み合わせの数
int calculateCombination(int max, int obj);

// 1 から n までの重複しない 3 つの数字の全組み合わせを作成する.
vector< vector< int > > numSelector(int n);

int main()
{
    int max, obj;

    while(true){
        cin >> max >> obj;
        if(max == 0) break;
        cout << calculateCombination(max, obj) << endl;
    }

}

int calculateCombination(int max, int obj)
{
    int count = 0;
    for (auto v : numSelector(max)){
        if (v[0] + v[1] + v[2] == obj) count++;
    }
    return count;
}

vector< vector< int > > numSelector(int n)
{
    vector< vector< int > > resultVector;

    for (int a1 = 1; a1 <= n - 2; a1++){
        for (int a2 = a1 + 1; a2 <= n - 1; a2++){
            for (int a3 = a2 + 1; a3 <= n; a3++){
                vector<int> v {a1, a2, a3};
                resultVector.push_back(v);
            }
        }
    }

    return resultVector;
}


Measured memory_bytes: 14800
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

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

int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	if(a*b >= c*d){
		cout << a*b << endl;
	}else{
		cout << c*d << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll	    long long
#define vi      vector <ll>
#define vii     vector <pair<int,int>>
#define ii      pair<int,int>
#define loop(n)	for(int i=0;i<n;i++)
#define pb      push_back
const ll mod=1e9+7;
void fast();
int main()
{
    fast();
    ll n,h,res=0;
    cin>>n>>h;
    vii a(n);
    vi v;
    loop(n)
        cin>>a[i].first>>a[i].second;
    sort(a.begin(),a.end());
    for(int i=0;i<n-1;i++)
        if(a[i].second>a[n-1].first)
            v.pb(a[i].second);
    sort(v.rbegin(),v.rend());
    for(int i=0;i<v.size()&&h>a[n-1].second;i++)
        h-=v[i],res++;
    if(h>=a[n-1].second){
        ll x=h-a[n-1].second;
        res+=x/a[n-1].first;
        if(x%a[n-1].first!=0)
            res++;
        res++;
    }
    else if(h>0)
        res++;
    cout<<res;
}
void fast(){
std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
/*

*/


Measured memory_bytes: 2168
#include <stdio.h>

int main() {
    int a, b, c;
    int tmp;
    
    scanf("%d %d %d", &a, &b, &c);
    
    if(a > b){
        tmp = a;
        a = b;
        b = tmp;
    }
    
    if(b > c) {
        tmp = b;
        b = c;
        c = tmp;
    }
    
    if(a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    printf("%d %d %d\n", a, b, c);
    
    return 0;
}


Measured memory_bytes: 2104
#if defined(LOCAL)
#define PROBLEM_NAME "b"
const double _max_double_error = 1e-9;
#include "testutils.h"
#define L(x...) (debug(x, #x))
#define I(x, ...) (x)
#define C(x...) CHECK(x)
#else
#define L(x, ...) (x)
#define I(x, ...) (x)
#define C(x, ...) ;
#include <bits/stdc++.h>
#endif

using namespace std;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ii = pair<int,int>; using lu = unsigned long long; using l = long long;
using vs = vector<string>; using vii = vector<ii>;
using vl = vector<l>; using vvl = vector<vl>; using vvvl = vector<vvl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
using mll = unordered_map<l, l>;
const l INF = numeric_limits<l>::max();
const double EPS = 1e-10; static constexpr auto PI = acos(-1);
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(c) - 1; a >= l(b); a--)
#define VVL(x, a, b, i) vvl x(a, vl(b, l(i)));
#define VVVL(x, a, b, c, i) vvvl x(a, vvl(b, vl(c, l(i))));

const l MOD = e9 + 7;

void solve(istream& cin, ostream& cout) {
  string a, b; cin >> a >> b;
  a += a;
  auto f = (a.find(b) != string::npos);
  cout << (f ? "Yes" : "No") << lf;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  // _generate_random_test = generate_random;
  // _solve_brute = solve_brute;
  // _player_b = player_b;
  // _custom_solution_checker = solution_checker;
  maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}


Measured memory_bytes: 256
s = str(input())
t = str(input())
slist = list(s)
tlist = list(t)
for item in slist:
    item.lower()
for item in tlist:
    item.lower()
judge = True
if len(slist) == len(tlist) == 3:
    for i in range(len(slist)):
        if slist[i] == tlist[2 - i]:
            continue
        else:
            judge = False
    if judge == True:
        print('YES')
    else:
        print('NO')
else:
    print('hoge!')

Measured memory_bytes: 3064
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a)//少数出力
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {
	int h, w;
	scanf("%d%d", &h, &w);
	int n = 10;
	vector<vector<int>> d(10, vector<int>(10));
	rep(i, n)rep(j, n)scanf("%d", &d[i][j]);
	for (int k = 0; k < n; k++) {       // 経由する頂点
		for (int i = 0; i < n; i++) {    // 始点
			for (int j = 0; j < n; j++) {  // 終点
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	ll cost = 0;
	int tmp;
	rep(i, h) {
		rep(j, w) {
			scanf("%d", &tmp);
			if (tmp == -1 || tmp == 1)continue;
			cost += d[tmp][1];
		}
	}
	printf("%lld\n", cost);
}

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

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return 1;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  int n, d;
  cin >> n >> d;
  cout << ((n+(d*2)) / (d*2+1)) << endl;
}


/*





















*/


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

using ll = long long;
using ld = long double;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()

int main()
{
    int n, ans = 0;
    cin >> n;
    vector<int> a(n);
    
    for(int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    
    sort(all(a));
    reverse(all(a));
    
    for(int i = 0; i < n; i++)
    {
        if(i%2==0)
        {
            ans+=a.at(i);
        }
        else
        {
            ans-=a.at(i);
        }
    }
    
    cout << ans << endl;

    return 0;
}

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

using namespace std;
/*
#define ll long long
#define vi vector<ll>
vi primeFactors(ll N) { // remember: vi is vector<int>, ll is long long
vi factors;
ll PF_idx = 0, PF = primes[PF_idx]; // primes has been populated by sieve
while (PF * PF <= N) { // stop at sqrt(N); N can get smaller
while (N % PF == 0) { N /= PF; factors.push_back(PF); } // remove PF
PF = primes[++PF_idx]; // only consider primes!
}
if (N != 1) factors.push_back(N); // special case if N is a prime
return factors; // if N does not fit in 32-bit integer and is a prime
} // then ‘factors’ will have to be changed to vector<ll>
// inside int main(), assuming sieve(1000000) has been called before
vi r = primeFactors(2147483647); // slowest, 2147483647 is a prime
for (vi::iterator i = r.begin(); i != r.end(); i++) printf("> %d\n", *i);
r = primeFactors(136117223861LL); // slow, 104729*1299709
for (vi::iterator i = r.begin(); i != r.end(); i++) printf("# %d\n", *i);
r = primeFactors(142391208960LL); // faster, 2^10*3^4*5*7^4*11*13
for (vi::iterator i = r.begin(); i != r.end(); i++) printf("! %d\n", *i);
*/
int main()
{
int a,b,ans=1;
scanf("%d %d",&a,&b);
while(a)
{
    (ans+b)<=(ans*2)?ans+=b:ans*=2;
    a--;
}
printf("%d",ans);
    /*
    int n,coun=0,ans=0;
    long long unsigned int fac=1;
    scanf("%d",&n);
    int c=1;
        int m=pow(2,c);
        while(m<n){
            c++;
            coun=n/m;
            ans+=coun;
            m=pow(2,c);
        }
        printf("%d",ans);
        */

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

//Anipero 2012
public class Main{

	int n, m, MIN = -(1<<29);
	int[] a, b, c;
	int[][][][] dp;
	
	int get(int k, int M, int L1, int L2){
		if(k==n)return 0;
		if(dp[k][M][L1][L2]!=MIN)return dp[k][M][L1][L2];
		int res = c[k] + get(k+1, M, L2, 0);
		for(int d=1;d<=8;d++){
			if(M<d)break;
			res = Math.max(res, c[k] + get(k+1, M-d, L2, d));
		}
		for(int u2=0;u2<=8;u2++){
			if(L2<u2)break;
			for(int u1=0;u1+u2<=8;u1++){
				if(L1<u1)break;
				if(u1==0 && u2==0)continue;
				for(int d=0;d<=8;d++){
					if(M<d)break;
					res = Math.max(res, u2*a[k] + u1*b[k] + get(k+1, M-d, L2, d));
				}
			}
		}
		return dp[k][M][L1][L2] = res;
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt(); m = sc.nextInt();
		a = new int[n]; b = new int[n]; c = new int[n];
		for(int i=0;i<n;i++){
			a[i] = sc.nextInt(); b[i] = sc.nextInt(); c[i] = sc.nextInt();
		}
		dp = new int[n][m+1][m+1][m+1];
		for(int i=0;i<n;i++)for(int j=0;j<=m;j++)for(int k=0;k<=m;k++)for(int l=0;l<=m;l++)dp[i][j][k][l] = MIN;
		int res = MIN+1;
		for(int d=0;d<=8;d++)if(d<=m)res = Math.max(res, get(0, m-d, 0, d));
		System.out.println(res);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 42000
#include <bits/stdc++.h>
using namespace std;
#define ll	    long long
#define vi      vector <ll>
#define vii     vector <pair<int,int>>
#define ii      pair<int,int>
#define loop(n)	for(ll i=0;i<n;i++)
#define pb      push_back
const ll mod=1e9+7;
void fast();
int main()
{
    ll n,res=0;
    cin>>n;
    if(n&1)
        return cout<<0,0;
    ll x=50;
    res=n/10;
    while(x<=n){
        res+=n/x;
        x*=5;
    }
    cout<<res;
}
void fast(){
std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
/// 20
/// 15 7 13 15 15 15 15 13 19
/*

*/


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
#include<stack>
#include<string.h>
#include<cstring>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

int main() {
	rep(i, 5) {
		int ai;
		cin >> ai;
		if (ai == 0) {
			cout << i + 1 << endl;
			return 0;
		}
	}
}

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

int main() {
	int K,N;
	cin >> K>>N;
	vector<int> House;
	vector<int> Distance;
	int a;
	int Ans = 0;
	for (int i = 0;i < N;i++) {
		cin >> a;
		House.push_back(a);
	}
	for (int i = 0;i < N - 1;i++) {
		a = House[i + 1] - House[i];
		Distance.push_back(a);
	}
	a = House[0] + K - House[N - 1];
	Distance.push_back(a);
	sort(Distance.begin(), Distance.end());
	
	for (int i = 0;i < N - 1;i++) {
		Ans += Distance[i];
	}
	cout << Ans<<"\n";
}

Measured memory_bytes: 2548
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int n =sc.nextInt();
		int k =sc.nextInt();
		int[] cities =new int[n];
		for (int i=0;i<k;i++) {
			int a =sc.nextInt();
			int b =sc.nextInt();
			for (int j=1;j<=n;j++) {
				if (j==a||j==b) {
					cities[j-1] ++;
				}
			}
		}
		for(int l=0;l<n;l++) {
			System.out.println(cities[l]);
		}
		
		//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
}

Measured memory_bytes: 21844
#include <iostream>

using namespace std;

int main () {
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && b == c) {
        cout << "No" << endl;
        return 0;
    }
    if (a != b && a != c && b != c) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sun May 31 11:25:07 2020

@author: NEC-PCuser
"""

N, K = map(int, input().split())

A = list(map(int, input().split()))

tentosu = 0

MOD = 1000000007

for i in range(0, N):
    a = 0
    d = 0
    """
    for j in range(0, N):
        if (i == j):
            continue
        if (i < j and A[i] > A[j]):
            a += 1
        if (A[i] > A[j]):
            d += 1
    """
    for j in range(0, N):
        if (A[i] > A[j]):
            d += 1
    for j in range(i, N):
        if (A[i] > A[j]):
            a += 1
    
    
    tentosu += a * K + (K - 1) * K * d // 2;
    
print(tentosu % MOD)

Measured memory_bytes: 3188
n = int(input())
p = list(map(int, input().split()))
i = 0
ans = 0
while True:
    if p[i] == i + 1:
        cnt = 0
        while p[i + cnt] == i + cnt + 1:
            cnt += 1
            if cnt + i == n:
                break
        ans += cnt//2 + cnt%2
        i += cnt
    else:
        i += 1
    if i == n:
        break
print(ans)

Measured memory_bytes: 84040
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int A = input.nextInt();
		int B = input.nextInt();
		int C = input.nextInt();
		int D = input.nextInt();
		
		takahasi(A,B,C,D);
		
	}
	public static void takahasi(int A,int B,int C,int D) {
		C-=B;
		if(C<=0) {
			System.out.println("Yes");
		}
		else {
			aoki(A,B,C,D);
		}
	}
	public static void aoki(int A,int B,int C,int D) {
		A-=D;
		if(A<=0) {
			System.out.println("No");
		}
		else {
			takahasi(A,B,C,D);
		}
	}
}


Measured memory_bytes: 35584
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
  string s;cin>>s;
  int i=0;
  int x=s.length();
  //Aの数を保存しながら進めていく
  ll tmp=0,ans=0;
  bool a=false;
  while(i<=x){
    if(a and s[i]=='B' and s[i+1]=='C'){
      ans+=tmp;
      i+=2;
    }
    else if(s[i]=='A'){
      tmp++;
      a=true;
      i++;
    }
    else{
      a=false;
      tmp=0;
      i++;
    }
 
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
int getcolor(int value){
	if(value <= 399) return 0;
	if(value <= 799) return 1;
	if(value <= 1199) return 2;
	if(value <= 1599) return 3;
	if(value <= 1999) return 4;
	if(value <= 2399) return 5;
	if(value <= 2799) return 6;
	if(value <= 3199) return 7;
	return -1;
}
int main(){
	int n;
	cin >> n;
	set<int> values;
	int fr = 0;
	for(int e = 0; e < n; e++){
		int x; cin >> x;
		if(x <= 3199) values.insert(getcolor(x));
		else fr++;
	}
	cout << max((int)values.size(), 1) << " " << (int)values.size() + fr << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;

int main() {

  int n, m; cin >> n >> m;
  vector<int> x(m);
  for(int i=0; i<m; i++) cin >> x[i];
  if (n >= m){
    cout << 0 << endl;
    return 0;
  }
  sort(x.begin(), x.end());

  vector<int> a;
  for(int i=0; i<m-1; i++){
    a.push_back(abs(x[i+1]-x[i]));
  }
  sort(a.begin(), a.end());
  int b = 0;
  for(int i=0; i<a.size()-n+1; i++){
    b += a[i];
  }
  cout << b << endl;


  return 0;
}

//


Measured memory_bytes: 1276
import numpy as np
import scipy.sparse.csgraph as graph

N = int(input())
G = np.array([list(map(int, input().split())) for i in range(N)])

G2 = graph.floyd_warshall(G, directed=False)

if np.any(G != G2):
    print(-1)
    exit()
else:
    c = [2*10**9]*N
    d = np.diag(c)
    G += d
    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            two = np.min(G[i]+G[j])
            if two != G[i,j]:
                ans += G[i,j]

print(ans)


Measured memory_bytes: 26868
(* O(n log n) *)
let n, k = Scanf.scanf " %d %d" @@ fun a b -> a, b
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let rec gcd a b = if b = 0 then a else gcd b (a mod b)
let g = Array.fold_left gcd 0 a_s
let _ =
  Array.iter (fun a -> if a >= k && (a - k) mod g = 0 then (print_endline "POSSIBLE"; exit 0)) a_s;
  print_endline "IMPOSSIBLE"

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  map<int,bool> mp;
  int n;
  cin >> n;
  bool flag = true;
  rep(i, n) {
    int a;
    cin >> a;
    if (mp[a]) {
      flag = false;
    } else {
      mp[a] = true;
    }
  }

  cout << ((flag) ? "YES" : "NO") << endl;
}


Measured memory_bytes: 9600
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

const int MAX = 100100;

char s[MAX];
vector<int> v[MAX], g[MAX];

int main(void) {
  scanf("%s", s);
  int M;
  scanf("%d", &M);
  vector<int> a(M), b(M);
  REP(i, M) {
    scanf("%d %d", &a[i], &b[i]);
    --a[i], --b[i];
  }
  
  int N = strlen(s);
  if (N % 2) {
    int mid = N / 2;
    rotate(s + mid, s + mid + 1, s + N);
    N--;

    REP(i, M) {
      if (a[i] > mid) a[i]--;
      if (b[i] >= mid) b[i]--;
    }
  }

  assert(N % 2 == 0);
  int m = N / 2;
  REP(i, M) {
    if (a[i] > b[i]) continue;
    
    if (a[i] < m && b[i] >= m) {
      int na = N-a[i];
      int nb = N-b[i]-2;

      if (na <= b[i]) {
        a[i] = na;
      } else if (nb >= a[i]) {
        b[i] = nb;
      } else {
        continue;
      }
    }

    if (a[i] >= m) {
      int nb = N-a[i]-1;
      int na = N-b[i]-1;
      a[i] = na;
      b[i] = nb;
    }

    assert(0 <= a[i] && a[i] <= b[i] && b[i] < m);
    v[a[i]].push_back(b[i]);
    //    TRACE(a[i] _ b[i]);
  }

  vector<int> p_inc(m+1, 0);
  int cur_inc = 0;
  REP(i, m) {
    int need = (s[i] - s[N-i-1] + 26) % 26;
    assert(0 <= need && need < 26);
    cur_inc += p_inc[i];
    cur_inc %= 26;
    if (cur_inc < 0) cur_inc += 26;

    need = (need - cur_inc + 26) % 26;

    if (v[i].size() > 0) {
      sort(v[i].begin(), v[i].end());
      v[i].erase(unique(v[i].begin(), v[i].end()), v[i].end());
      for (int j = 1; j < (int)v[i].size(); ++j) {
        v[v[i][j-1] + 1].push_back(v[i][j]);
      }

      int j = v[i][0];
      cur_inc += need;
      p_inc[j+1] -= need;
    } else {
      if (need != 0) {
        puts("NO");
        return 0;
      }
    }
  }

  puts("YES");
  return 0;
}


Measured memory_bytes: 9472
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<ld> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const int MOD = 1000000009;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };
int ddx[] = { -1,-2,1,-2,2,-1,2,1 }, ddy[] = { -2,-1,-2,1,-1,2,1,2 };

int main() {
	int n,m;
	scanf("%d%d",&n,&m);
	if(n&1)
	{
		fup(i,1,m,1)
		{
			printf("%d %d\n",i,n-i);
		}
		return 0;
	}
	else
	{
		int t=n/2;
		t=t/2;
		fup(i,1,min(m,t),1)printf("%d %d\n",i,n+1-i);
		m-=t;
		t++;
		while(m>0)
		{
			t++;
			printf("%d %d\n",t,n+2-t);
			m--;
		}
		return 0;
	}
}

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

#define all(v) v.begin(),v.end()
#define rep(i,a,n) for(auto i=a;i<=n;i++)
#define f(i,n) for(auto i=0;i<n;i++)
#define frev(i,n) for(auto i=n;i>=0;i--)
#define fr first
#define sc second
#define pb emplace_back
#define pf push_front
#define mp make_pair
#define ll long long
#define endl "\n"
#define digit(n) floor(log10(n))+1
#define mod 1000000007
#define maxn 100001
#define mem(a,val) memset(a,val,sizeof(a))
#define pow(a,b) (ll)(pow(a,b)+0.5)
#define inf 1000000000000000001
#define FASTIO std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
vector<ll> v(102),w(102);
ll dp[102][maxn];
ll func(ll i,ll W,ll n){
    if(i>=n)return 0;
    if(W==0)return 0;
    if(dp[i][W]!=-1)return dp[i][W];
    ll ret;
    if(w[i]<=W){
        ret=max(v[i]+func(i+1,W-w[i],n),func(i+1,W,n));
    }
    else ret=func(i+1,W,n);
    return dp[i][W]=ret;
}
int main()
{
    FASTIO
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll x=0,f=0,j,q=1,i,m,k,n;
    //cin>>q;
    while(q--)
    {
        ll W;
        cin>>n>>W;
        mem(dp,-1);
        f(i,n)cin>>w[i]>>v[i];
        cout<<func(0,W,n);
        cout<<endl;    
    }        
}

Measured memory_bytes: 80000
#include<bits/stdc++.h>
using namespace std;
int n;
int a[200100];
int b[200100];
int moda[200100];
int modb[200100];
int powe[31];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		cin>>b[i];
	powe[0]=1;
	for(int i=1;i<=30;i++){
		powe[i]=powe[i-1]*2;
	}
	int res=0;
	for(int i=0;i<=29;i++){
		for(int j=1;j<=n;j++)
			moda[j]=a[j]%powe[i+1];
		for(int j=1;j<=n;j++)
			modb[j]=b[j]%powe[i+1];
		sort(modb+1,modb+n+1);
		int TOT=0;
		for(int j=1;j<=n;j++){
			int CUR1=lower_bound(modb+1,modb+n+1,powe[i]*2-moda[j])-lower_bound(modb+1,modb+n+1,powe[i]*1-moda[j]);
			int CUR2=lower_bound(modb+1,modb+n+1,powe[i]*4-moda[j])-lower_bound(modb+1,modb+n+1,powe[i]*3-moda[j]);
			TOT+=CUR1+CUR2;
			TOT%=2;
		}
		if(TOT%2==1)
			res+=powe[i];
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 3328
#include<iostream>
using namespace std;
int w;
main()
{
    while(cin>>w,w>=0)
    {
        int ans=4280-1150;
        w-=10;
        if(w>0)
        {
            if(w<=10)ans-=w*125;
            else ans-=1250;
            w-=10;
        }
        if(w>0)
        {
            if(w<=10)ans-=w*140;
            else ans-=1400;
            w-=10;
        }
        if(w>0)ans-=w*160;
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 3072
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);


int main(){
  FAST_IO  
  
  int N; cin >> N;
  cout << (int) N / 3 << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define int long long
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define MAXN 200100
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<pll> vpl;
typedef vector<int> vi;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);

}
const int M = 1e9 + 7;
vector<int> adj[MAXN];
int res[MAXN];
int dp[MAXN];
int sz[MAXN];
int fat[MAXN],inv[MAXN];
void dfs(int v,int p=-1){
    sz[v] = 1;
    for(int x : adj[v]){
        if(x==p)continue;
        dfs(x,v);
        sz[v]+=sz[x];
    }
}
int solve(int v,int p){
    int ways = fat[sz[v] - 1];
    for(int x : adj[v]){
        if(x==p)continue;
        ways = mod(ways*mod(solve(x,v)*inv[sz[x]],M),M);
    }
    return dp[v] = ways;
}
int n;
void solve2(int v,int p){
    if(p==-1){
        res[v] = dp[v];
     
    }else{
        int dpp = mod(res[p],M);
        dpp = mod(dpp*fat[sz[v]],M);
        dpp = mod(dpp*exp(dp[v],M-2,M),M);
        dpp = mod(dpp*fat[n-sz[v]-1],M);
        dpp = mod(dpp*inv[n-sz[v]],M);
        res[v] = mod(dpp,M);
       
        for(int x : adj[v]){
            if(x!=p){
                res[v] = mod(res[v]*mod(dp[x]*inv[sz[x]],M),M);
            }
        }

    }
    for(int x : adj[v]){
        if(x==p)continue;
        solve2(x,v);
    }
}

int32_t main(){
    fastio;
    fat[0] = inv[0] = 1;
    for(int i=1;i<MAXN;i++){
        fat[i] = mod(fat[i-1]*i,M);
        inv[i] = exp(fat[i],M-2,M);
    }
    cin>>n;
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    dfs(1,-1);
    solve(1,-1);
    solve2(1,-1);
    for(int i=1;i<=n;i++)cout<<res[i]<<endl;
    // Math -> gcd it all
	//did you check N=1? Did you mix up N,M?
}

Measured memory_bytes: 22512
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define INF 1e9+7
#define roop(i,m,n) for(int i=m;i<n;i++)
#define mroop(i,m,n) for(int i=m;i<n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;

//(int)'a'は97 (int)'A'は65
//おまじない



int main() {

	int k;
	cin >> k;

	if (k % 2 == 1) {
		cout << (k + 1) / 2 * (k - 1) / 2 << endl;
	}
	else {
		cout << k * k / 4 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
s = []
prev = "-"
cnt = 0
for i in input():
    if prev!=i:
        s.append(cnt)
        cnt = 0
    else:
        cnt += 1
    prev = i
s.append(cnt)
print(sum(s)+min(2*k, len(s)-2))

Measured memory_bytes: 3956
#include<bits/stdc++.h>
#define F first
#define S second
#define REP(i, a, b, c) for(int i = a; i <= b; i+=c)
#define pb push_back
#define int long long int
#define MOD 1000000007
using namespace std;

int a[3005];
int dp[3005][3005][2];

int solve(int i, int j, int turn) {
  if (i > j)
    return 0;
  if (dp[i][j][turn] != -1)
    return dp[i][j][turn];
  if (turn == 1)
    return dp[i][j][turn] = max(a[i] + solve(i + 1, j, 0), a[j] + solve(i, j - 1, 0));
  else
    return dp[i][j][turn] = min(solve(i + 1, j, 1), solve(i, j - 1, 1));

}

int32_t main()
{
  ios :: sync_with_stdio(false); cin.tie(0);
  int t = 1;
  //cin >> t;
  for (int i9 = 1; i9 <= t; i9++)
  {
    int n, sum = 0;
    cin >> n;
    memset(dp, -1, sizeof(dp));
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      sum += a[i];
    }
    int X = solve(1, n, 1);
    cout << (-1) * (sum - 2 * X) << endl;
  }
}



Measured memory_bytes: 144964
#include<bits/stdc++.h>
using namespace std;
long long a=1,x,n,l[1000],b,i,now,t;
int main()
{
	cin>>n>>x;
	for(i=1;i<=n;i++)
	{
		cin>>l[i];
		now+=l[i];
		if(now<=x)
		{
			a++;
		}
	}
	cout<<a;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
 int x,y,d,m,q;
 scanf("%d %d",&x,&y);
 if(x<y){
  m=x;
  x=y;
  y=m;
 }
 while(1){
  q=x%y;
  if (q==0){
    printf("%d\n",y);
    break;
  }
  x=y;
  y=q; 
 }

}

Measured memory_bytes: 2680
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    int n, m;
    cin >> n >> m;
    map<string, int> mp;
    for(int i=0; i<n; i++){
        int k; cin >> k;
        for(int j=0; j<k; j++){
            string a; cin >> a;
            mp[a]++;
        }
    }

    int cnt = 0;
    for(auto a: mp){
        if(a.second == n){
            cnt++;
        }
    }
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 256
import itertools,math
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
l=list(itertools.permutations(range(1,n+1)))
for i in range(math.factorial(n)):
    if all(l[i][j]==p[j] for j in range(n)):
        pj=i
    elif all(l[i][j]==q[j] for j in range(n)):
        qj=i
    elif p==q:
        pj=0
        qj=0
        break
print(abs(pj-qj))

Measured memory_bytes: 53084
from sys import stdin, stdout
from math import sqrt
from collections import defaultdict
#t = int(stdin.readline().strip())
#R, L, C, Vin = [float(x) for x in stdin.readline().strip().split()]
D, N = [int(x) for x in stdin.readline().strip().split()]
D = 100 ** D
print(D * (N + (N//100)))


Measured memory_bytes: 3444
package main

import (
	"fmt"
)

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func deleteDup(nums []int) (uniq []int) {
	m := make(map[int]struct{})
	//uniq = make([]int, 0)
	for _, num := range nums {
		if _, ok := m[num]; !ok {
			m[num] = struct{}{}
			uniq = append(uniq, num)
		}
	}
	return
}

func main() {
	var n int
	fmt.Scan(&n)
	nums := scanNums(n)
	nums = deleteDup(nums)
	fmt.Println(len(nums))
}

Measured memory_bytes: 512
#include <iostream>
#include<string>
#include<string.h>
#include <iostream>
#include <algorithm>
#include <cstdlib>
//#include <vector.h>
//#include <malloc.h>
#include <math.h>
using namespace std;
#include<stdlib.h>
#include<stdio.h>


int main(){
    
    int n;
    cin>>n;
    
    long long sum=0;
    for(int i=1;i<=n;i++){
        if(i%3!=0 && i%5!=0){
            sum+=i;
        }
    }
    cout<<sum<<"\n";
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
//#define _GLIBCXX_DEBUG


signed main() {
  string X; cin >> X;
  
  int ans = 0;
  int k = 0;
  rep(i, X.size()) {
    if(X[i] == 'T') {
      if(k == 0) ans++;
      else k--;
    } else {
      k++;
    }
  }
  ans += k;
  cout << ans << endl;
}


Measured memory_bytes: 640