akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

int n,ans=0;

int main(){
	cin>>n;
	for(int i=1;i<=n;i++) ans+=i;
	cout<<ans<<endl;
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007
#define rev(v) reverse(v.begin(), v.end());

bool comp(int a, int b){
    return (a<b);
}

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

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <numeric>
#include <string>
#include <map>
#include <queue>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;
typedef long long ll;


int main(){
        ll N;
        cin >> N;
        vector<ll> A(N);
        for(ll i=0; i<N; i++){
                cin >> A[i];
        }
        ll Count =0;
        A.push_back(0);
        for(ll i=0; i<N; i++){
                if(A[i] == i+1){
                        if(A[i+1] == i+2){
                                i+= 1;
                        }
                        Count += 1;
                }
        }
        cout << Count;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,ac,as,af;
	cin>>n;
	vector<int> c,s,f;
	for(int i=0;i<n-1;i++) 
	{
		cin>>ac>>as>>af;
		c.push_back(ac);
		s.push_back(as);
		f.push_back(af);
	}
	for(int k=0;k<n-1;k++)
	{
		int now=k;
		int time=0;
		for(int i=k;i<n-1;i++)
		{
			if(time<=s[now])
			time=s[now]+c[now];
            else
			{
				int best=s[i];
				while(1)
				{
					best+=f[i];
					if(time<=best)
					{
						time=best+c[i];
						break;
					}   
                }   
        	}   
        	now++;
    	}   
    	cout<<time<<endl;
    }   
    cout<<0<<endl;
	return 0; 
}

Measured memory_bytes: 256
S = input()
alpo = 'abcdefghijklmnopqrstuvwxyz'
alp = [False for _ in range(26)]
if len(S) < 26:
    for i in S:
        alp[ord(i)-97] = True
    for k,j in enumerate(alp):
        if not j:
            ans = S + chr(k+97)
            break
elif S == 'zyxwvutsrqponmlkjihgfedcba':
    ans = -1
else:
    candi = [0]
    for i in range(26):
        if ord(S[-1-i]) < max(candi):
            for j in sorted(candi):
                if j > ord(S[-1-i]):
                    ans = S[:25-i]+chr(j)
                    break
            break
        candi.append(ord(S[-1-i]))
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <vector>
using namespace std;

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

Measured memory_bytes: 128
#include <iostream>
#include <string>

int main() {
    int n, q;
    std::string s;
    std::cin >> n >> q >> s;

    int counts[n]; // 累積和

    for (int i = 0; i < n; i++) {
        char current = s[i];
        char before;
        int count = 0;

        if (i == 0) {
            count = 0;
            before == '/0';
        } else {
            count = counts[i - 1];
            before = s[i - 1];
        }

        if (current == 'C' && before == 'A') {
            count++;
        }

        counts[i] = count;
    }

    for (int i = 0; i < q; i++) {
        int l, r;
        std::cin >> l >> r;
        std::cout << counts[r - 1] - counts[l - 1] << std::endl;
    }
}

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

#define ff        first
#define ss        second
#define int       long long
#define pb        push_back
#define mp        make_pair
#define vi        vector<int>
#define pii       pair<int,int>
#define mii       map<int,int>
#define w(x)      int x; cin>>x; while(x--)
#define all(x)      (x).begin(),(x).end()
#define rep(i,a,b)  for(int i=(a);i<(b);i++)
#define mod       1000000007

int dp[101][100001],val[101],wt[101];

void c()
{
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}

int32_t main() {

    //c();
    int n,w; cin>>n>>w;
    int maxval=0;
    rep(i,0,n)
    {
        cin>>wt[i]>>val[i];
        maxval+=val[i];

    }
    
    rep(i,0,n+1) dp[i][0]=0;
    rep(j,1,maxval+1) dp[0][j]=INT_MAX;

    rep(j,1,maxval+1)
    {
        if(j%val[0]==0 && (j/val[0])==1)
            dp[1][j] = wt[0];
        else
            dp[1][j]=INT_MAX;
    }
    //dp[i][j] - min weight required to get exactly 
    //j value considering first i items in array
    rep(i,2,n+1)
        rep(j,1,maxval+1)
        {
            if(val[i-1]<=j)
                dp[i][j] = min(wt[i-1]+dp[i-1][j-val[i-1]],dp[i-1][j]);
            else
                dp[i][j]=dp[i-1][j];
        }

    // rep(i,0,n+1)
    // {
    //     rep(j,0,maxval+1)
    //         cerr<<dp[i][j]<<" ";
    //     cerr<<"\n";
    // }
    
    int ans=0;
    rep(j,1,maxval+1)
    {
        if(dp[n][j]<=w)
            ans=j;
    }
    cout<<ans<<"\n";
            
    return 0;
}

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

vector<int> x(3);

// a,bの偶奇を判定する
bool isOK(int a, int b) {
  if (a % 2 == b % 2) {
    return true;
  } else {
    return false;
  }
}

int solve() {
  int ans = 0;

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

  if (isOK(x[2], x[0]) && isOK(x[2], x[1])) {
    return (x[2] - x[0]) / 2 + (x[2] - x[1]) / 2;
  } else if (isOK(x[0], x[1])) {
    return (x[2] - (x[0] + 1)) / 2 + (x[2] - (x[1] + 1)) / 2 + 1;
  } else if (!isOK(x[2], x[0]) && isOK(x[2], x[1])) {
    return (x[2] - (x[0] + 1)) / 2 + (x[2] - x[1]) / 2 + 2;
  } else {
    return (x[2] - x[0]) / 2 + (x[2] - (x[1] + 1)) / 2 + 2;
  }
}

int main() {
  cin >> x[0] >> x[1] >> x[2];
  cout << solve() << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

string x;

void input(){
    cin >> x;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    int n = x.size();
    vector<int> s, t;
    for(int i=0;i<n;i++){
        if(x[i] == 'S') s.push_back(i);
        else t.push_back(i);
    }
    int cnt = 0;
    for(int i=0;i<s.size();i++){
        auto index = upper_bound(t.begin(), t.end(), s[i]);
        if(index != t.end()){
            t.erase(index);
            cnt++;
        }
    }
    cout << n - 2*cnt << endl;
    return 0;
}

Measured memory_bytes: 1680
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
int divr[maxn];
/*ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}*/
void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
 
 
 
 
 












int main()
{
     int x,n;
     cin>>x>>n;
     int ct[1005]={0};
     int a[n];
     for(int i=0;i<n;i++){cin>>a[i];
     ct[a[i]]=1;}
     if(ct[x]==0)cout<<x;
     else
     {
          if(x==1)cout<<0;
          else{
               int t=abs(0-x),num=0;
               for(int i=1;i<=105;i++)
               {
                    if(ct[i]==0){
                         if(abs(i-x)<t){
                              t=abs(i-x);num=i;
                         }
                    }
               }
               cout<<num;
          }
          
     }

     
}







 
 

















Measured memory_bytes: 3636
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
A,B,M = map(int,input().split())
arrA = list(map(int,input().split()))
arrB = list(map(int,input().split()))
times = M
table = []
for _ in range(times):
    x,y,c = list(map(int,input().split())) # 行列の場合
    table.append(arrA[x-1]+arrB[y-1]-c)

simplelow = min(arrA)+min(arrB)
ans = min(simplelow,min(table))

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Measured memory_bytes: 18684
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
    string s; cin>>s;
    int n=s.size();
    ll ans=0;
    for(int i=0; i<n; i++){
        if(s[i]=='A'){
            ll cnt=0;
            while(i<n){
                if(s[i]=='A'){
                    i++;
                    cnt++;
                }else if(s[i]=='B' && i+1<n && s[i+1]=='C'){
                    i+=2;
                    ans+=cnt;
                }else{
                    break;
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
typedef long long lld;
const int MAXN = 1e5+5;
int A[MAXN], B[MAXN];
lld ret;
int N;

void dec(int i, int j) {
    int val = std::min(A[i], B[j]);
    A[i] -= val;
    B[j] -= val;
    ret += val;
}

int main() {
  scanf("%d", &N);
  for (int i = 0; i <= N; ++i) {
    scanf("%d", &A[i]);
  }
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &B[i]);
  }
  ret = 0LL;
  for (int i = 1; i <= N; ++i) {
    dec(i-1, i);
    dec(i, i);
  }
  printf("%lld\n", ret);
  return 0;
}

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

struct Vec {
  int x;
  int y;
};

Vec add(Vec v1, Vec v2) {
  Vec u;
  u.x = v1.x + v2.x;
  u.y = v1.y + v2.y;
  return u;
}

Vec subtract(Vec v1, Vec v2) {
  Vec u;
  u.x = v1.x - v2.x;
  u.y = v1.y - v2.y;
  return u;
}

Vec rotate(Vec p1, Vec p2) {
  Vec u, v;
  u = subtract(p2, p1);
  v.x = -u.y;
  v.y = u.x;
  return v;
}

int main() {
  Vec p1, p2, p3, p4;
  cin >> p1.x >> p1.y >> p2.x >> p2.y;
  Vec v = rotate(p1, p2);
  p3 = add(p2, v);
  p4 = add(p1, v);
  cout << p3.x << " " << p3.y << " ";
  cout << p4.x << " " << p4.y << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long 

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int n, m; cin >> n >> m;
	int x[n], y[m];
	rep(i, n) cin >> x[i];
	rep(i, m) cin >> y[i];

	int sumx = 0;
	int sumy = 0;
	rep(i, n) sumx = (sumx + (i * 2 + 1 - n) * x[i]) % mod;
	rep(i, m) sumy = (sumy + (i * 2 + 1 - m) * y[i]) % mod;
	cout << (sumx * sumy) % mod << endl;



    return 0;
}


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
pii mazai[125252];

int main(){
  scanf("%d%d",&n,&m);
  REP(i,n){
    int a,b;
    scanf("%d%d",&a,&b);
    mazai[i] = pii(a,b);
  }
  sort(mazai, mazai+n);
  ll ans = 0;
  int cur = 0;
  REP(i,n){
    int buy = min(mazai[i].second, m-cur);
    ans += 1ll * buy * mazai[i].first;
    cur += buy;
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 1024
package main

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

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	M1, _, M2, _ := sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt()
	if M1 != M2 {
		fmt.Println(1)
	} else {
		fmt.Println(0)
	}
}


Measured memory_bytes: 640
import sys

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()

N, K = nm()


def solve():
    return N - K + 1


if __name__ == "__main__":
    print(solve())


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

vector<long long int>v;
long long int dp[100005];
long long int inf=10000000000;
int main()
{
    long long int j,n,i,a,k;
    cin >> n >> k;
    for(i=0; i<n; i++)
    {
        cin >> a;
        v.push_back(a);
        dp[i]=inf;
        dp[i+1]=inf;
    }
    dp[0]=0;
    for(i=0; i<n; i++)
    {
        for(j=1; j<=k; j++)
        {
            if(i+j<n)
            {
               dp[i+j]=min((abs(v[i]-v[i+j])+dp[i]),dp[i+j]);
               //fo=min(fo,dp[i+j]);
            }
        }
    }
    cout << dp[n-1] << endl;
}
*/

#define     ll      long long int

#include <bits/stdc++.h>
using namespace std;

vector<int>v;
ll dp[100005];
ll inf=100000000000;
ll calculate(ll i,ll n,ll k)
{
    if(i==n-1) return 0;
    if(i>n-1) return inf;
    if(dp[i]!=-1) return dp[i];
    ll first=0,second=inf;
    first=calculate(i+1,n,k)+abs(v[i]-v[i+1]);
    for(ll j=2;j<=k;j++)
    {
        ll temp=inf;
        temp=calculate(i+j,n,k)+abs(v[i]-v[i+j]);
    second=min(temp,second);
    }
//    cout << i << " ";
//    cout << first << " " << second << endl;
    return dp[i]=min(first,second);
}

int main()
{
    ll n,i,a,k;
    cin >> n >> k;
    for(i=0;i<n;i++)
    {
        cin >> a;
        v.push_back(a);
    }
    memset(dp,-1,sizeof(dp));
    cout << calculate(0,n,k) << endl;
}


Measured memory_bytes: 13852
#! /usr/bin/python3
# こだわり者いろはちゃん / Iroha's Obsession
# 参考 : https://abc042.contest.atcoder.jp/submissions/3419872

"""
    1≦N<10000
    1≦K<10
    0≦D1<D2<…<DK≦9
    {D1,D2,…,DK}≠{1,2,3,4,5,6,7,8,9}
"""

N, K = map(int, input().split())
D = set(list(input().split()))

test_mode = False


def check_num(x, d):
    """
    金額xの中に中の文字があるか確認する関数。
    x : 現在の金額（N, x+1 を想定）
    d : 嫌いな数字のリスト（D を想定）
    文字列 x にリスト d 中の要素が含まれているか、d の要素 num を順に確認し、
    含まれていたら1円足して再試行する。
    """
    if test_mode:
        print('x =', x)
    while len(set(list(str(x))) & d) != 0:
        x += 1
    return x


def main():
    """
    金額を算出して出力
    """
    amount = check_num(N, D)
    print(amount)


if __name__ == '__main__':
    main()


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

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

typedef long long ll;

//#define INF 0x3fffFFFF
//#define INF_NEG (INF * -1)

//int isFirst = 1;
//template <class T> void print(T t) { if (isFirst) cout << t, isFirst = 0; else cout << " " << t; }

signed main()
{
    int n,k; cin >> n >> k;
    vector<int> snk(n,1);
    rep(i,k){
        int d; cin >> d;
        rep(j,d){
            int sk; cin >> sk;
            snk[sk-1] = 0;
        }
    }
    int ans = 0;
    rep(i,n) ans += snk[i];

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int num;
  cin >> num;
  int s1 = num / 100,
      s2 = (num % 100)/ 10,
  	  s3 = num % 10;
  cout << s1 + s2 + s3;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

int N; int h[100010];

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

	cin >> N;
	int ans = 0;
	for (int i = 0; i < N; i++)cin >> h[i];
	for (int i = 1; i < N; i++) {
		int cnt = 0;
		if (h[i - 1] >= h[i]) {
			while (i < N && h[i - 1] >= h[i]) {
				cnt++;
				i++;
			}
			ans = max(ans, cnt);
		}
	}
	cout << ans;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <set>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
 
int main() {
    int N;
    cin >> N;
    vector<int>a;
    vector<int>b;
    rep(i, 0, N){
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    rep(i, 0, N){
        int tmp2;
        cin >> tmp2;
        b.push_back(tmp2);
    }
    int ans = 0;
    int acount = 0;
   rep(i, 0, N){
       acount += a[i];
       int tmp = acount;
       rep(j, i, N) {
           
        tmp += b[j];
       }
       ans = max(ans, tmp);
   }
    cout << ans << endl;
}


Measured memory_bytes: 256
N,A,B,C = map(int,input().split())
l = [int(input()) for i in range(N)]
inf = float('inf')

def dfs(depth=0, a=0, b=0, c=0):
    if depth == N:
        if a*b*c != 0:
            return abs(a-A) + abs(b-B) + abs(c-C) - 30
        return inf
    res0 = dfs(depth+1,a,b,c)
    res1 = dfs(depth+1,a+l[depth],b,c) + 10
    res2 = dfs(depth+1,a,b+l[depth],c) + 10
    res3 = dfs(depth+1,a,b,c+l[depth]) + 10
    return min([res0,res1,res2,res3])

print(dfs())

Measured memory_bytes: 3064
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	s := getNextString(scanner)
	fmt.Fprintln(writer, fmt.Sprintf("%s %s", s[0:4], s[4:]))
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int a[5];
    cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
    sort(a,a+5);
    cout<<a[4]<<" "<<a[3]<<" "<<a[2]<<" "<<a[1]<<" "<<a[0]<<endl;         
    return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>

using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	std::vector<int> a(4);
	for (int i = 0; i < 4; ++i)
	{
		cin >> a[i];
	}
	
	sort(a.begin(), a.end());
	if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
s=list(input().split())
a=int(s[0])
b=int(s[1])
count=0
for i in range(a,b+1):
    number=list(str(i))
    antinumber=list(reversed(number))
    if int(''.join(number))-int(''.join(antinumber))==0:
        count+=1
print(count)

Measured memory_bytes: 41580
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
typedef pair<int,int> P;
const int INF = 1001001001;


int main() {
  int a; cin >> a;
  int ans = a + a*a + a*a*a;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3672
//package Qe
import java.util.*
import java.math.*
import java.lang.Math.*

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = {readLine()!!.toInt()}
private val readLong: ()->Long = {readLine()!!.toLong()}
private val readIntArray: ()->IntArray = {readLine()!!.split(' ').map{it.toInt()}.toIntArray()}
private val readLongArray: ()->LongArray = {readLine()!!.split(' ').map{it.toLong()}.toLongArray()}
private val errPrintln: (String)->Unit = {msg -> System.err.println(msg)}
private val MOD = 1e9.toLong()+7
private val INF = Int.MAX_VALUE/2
private val LINF = Long.MAX_VALUE/2


fun main(args: Array<String>) {
    val N = readInt()
    val S = readString()

    val bits = Array(26){LongBIT(N)}
    for (i in 0 until N) {
        bits[S[i] - 'a'].add(i, 1)
    }

    val Q = readInt()
    var ca = S.toCharArray()
    for (q in 0 until Q) {
        val (type, a, b) = readString().split(" ")

        when (type) {
            "1" -> {
                val I = a.toInt()-1
                val C = b[0]
                if (ca[I] != C) {
                    bits[ca[I] - 'a'].add(I, -1)
                    bits[C - 'a'].add(I, 1)
                    ca[I] = C
                }
            }
            "2" -> {
                val L = a.toInt()-1; val R = b.toInt()
                var ans = 0
                for (bit in bits) {
                    if (bit.sum(L, R) > 0) ans++
                }
                println(ans)
            }
        }
    }
}


class LongBIT(val N: Int) {
    var sg = LongArray(0)
    init {
        sg = LongArray(N+1){0L}
    }
    private fun add1(I: Int, X: Long) {
        var i = I
        while(i <= N) {
            sg[i] += X
            i += i and -i
        }
    }
    private fun sum1(I: Int): Long {
        var res = 0L
        var i = I
        while (i > 0) {
            res += sg[i]
            i -= i and -i
        }
        return res
    }
    private fun sum1(i: Int, j: Int): Long {
        if (i>j) return 0L
        return sum1(j) - sum1(i-1)
    }
    fun add(I: Int, X: Long) {
        var i = I+1
        while(i <= N) {
            sg[i] += X
            i += i and -i
        }
    }
    fun sum(i: Int): Long {
        return sum1(i)
    }
    fun sum(i: Int, j: Int): Long {
        return sum1(j) - sum1(i)
    }
    operator fun get(i: Int): Long {
        return sum(i, i+1)
    }
}


Measured memory_bytes: 186324
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  char a , b , c ;
  int ans , aws ;
  int i , j , h;
  string st ;
  cin >> st ;
  h = st.size();
  ans = 0;
  aws = 0;
  
  for(i=1;i<((h+1)/2);i++){
    if(st.at(i-1) == st.at(i-1+(h+1)/2))
      ans=ans+1;
  }
   
  	for(i=1;i<=(h-1)/4;i++){
      if(st.at(i-1) == st.at(((h-1)/2)-i))
    	aws=aws+1;
   }
   
   if((ans == ((h-1)/2)) && (aws == ((h-1)/4)))
     cout << "Yes" ;
   else
     cout << "No" ;
   
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long A, long long B){
  cout<<A*B/gcd(A,B)<<endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


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

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long N, long long M, std::vector<long long> X){
  sort(X.begin(), X.end());
  vector<ll> v;
  for(ll i=0; i+1<M; i++) {
    v.push_back(X[i+1]-X[i]);
  }
  sort(v.rbegin(), v.rend());
  ll ans = 0;
  for(ll i=N-1; i<v.size(); i++)
    ans+=v[i];
  std::cout << ans << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  long long M;
  scanf("%lld",&M);
  std::vector<long long> X(M);
  for(int i = 0 ; i < M ; i++){
    scanf("%lld",&X[i]);
  }
  solve(N, M, std::move(X));
  return 0;
}



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

int main() 
{

    	ios_base::sync_with_stdio(0);   cin.tie(0);     cout.tie(0);
    	int A[3];		cin >> A[0] >> A[1] >> A[2];
    	sort(A, A + 3);
    	cout << (A[0] + A[1] + A[2] * 10);
    	return 0;
}


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

using namespace std;

typedef pair<int, long> P;
typedef vector< vector<int> > V;

void bfs(queue<P>& q, V& to, V&ans) {
    while (!q.empty()) {
        P p = q.front();
        q.pop();
        int u = p.first;
        int c = p.second + 1;
        for (auto i : to[u]) {
            if (ans[c%3][i] != -1) continue;
            ans[c%3][i] = c;
            q.push(P(i, c));
        }
    }
}

int main() {
    int n, m, s, t;
    cin >> n >> m;
    V to(n+1);
    V ans(3, vector<int>(n+1, -1));
    for (int i=0; i<m; i++) {
        int u, v;
        cin >> u >> v;
        to[u].push_back(v);
    }
    cin >> s >> t;

    queue<P> q;
    q.push(P(s, 0));

    bfs(q, to, ans);

    if (ans[0][t] != -1) ans[0][t] /= 3;

    cout << ans[0][t] << endl;
}


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

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;
typedef pair<lli, lli> pii;

map<lli, int> mp;
lli mod = 1e9+7;

lli bigmod(lli a, lli b, lli m)//a^b%m
{
    lli gg = a%m;
    lli ret = 1;
    while(b){
        if(b%2){
            ret = (ret*gg) % m;
        }
        gg = (gg*gg) % m;
        b/=2;
    }
    return ret;
}

int main()
{
    lli n;
    cin >> n;
    lli a[n];
    for(auto &x: a) cin >> x;
    for(auto x: a){
        map<lli, int> tmp;
        for(lli i=2; i*i<=x; i++){
            if(x%i == 0){
                int cnt = 0;
                while(x%i == 0){
                    x/=i;
                    cnt++;
                }
                tmp[i] = cnt;
            }
        }
        if(x != 1){
            tmp[x]++;
        }
        for(auto x: tmp){
            if(mp[x.first] < x.second){
                mp[x.first] = x.second;
            }
        }
    }
    lli lc = 1;
    for(auto x: mp){
        for(int i=0; i<x.second; i++){
            lc = (lc*x.first) % mod;
        }
    }
    lli ans = 0;
    for(auto x: a){

        lli cc = (lc*bigmod(x, mod-2, mod)) % mod;

        ans = (ans+cc)%mod;
    }
    cout << ans  << "\n";

    return 0;
}


Measured memory_bytes: 4140
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {

    double r;
    cin>>r;
    cout<<r*2*MATHPI<<endl;
}


Measured memory_bytes: 3784
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>

using namespace std;
#define REP(i,a,n) for(int i = a; i < n; ++i)
#define REPM(i,n,a) for(int i = n - 1; i >= a; --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFD 1.0e+308
typedef long long LL;
typedef unsigned long long ULL;

LL s[11] = { 1,2,3,4,5,6,7,8,9,0,0 };
int N;
LL p(int flg) {
	flg = flg * 2 + 1;
	LL sum = 0;
	LL now = 0;
	REP(i, 0, N) {
		now = now * 10 + s[i];
		if (flg & (1 << (N - 1 - i))) {
			sum += now;
			now = 0;
		}
	}
	return sum;
}
int main() {
	string buf;
	cin >> buf;
	N = buf.size();
	REP(i, 0, N) {
		s[i] = buf[i] - '0';
	}
	LL sum = 0;
	REP(i, 0, 1 << (N - 1)) {
		sum += p(i);
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int prime[] = {11, 31, 41, 61, 71, 101, 131, 151, 181, 191, 211, 241, 251, 271, 281, 311, 331, 401, 421, 431, 461, 491, 521, 541, 571, 601, 631, 641, 661, 691, 701, 751, 761, 811, 821, 881, 911, 941, 971, 991, 1021, 1031, 1051, 1061, 1091, 1151, 1171, 1181, 1201, 1231, 1291, 1301, 1321, 1361, 1381, 1451};
    int N;
    cin >> N;
    rep(i,0,N)cout << prime[i] << " ";
    
}

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

int main()
{
	int sx,sy,tx,ty,i;
	cin >> sx >> sy >> tx >> ty;
	for(i=0;i<(ty-sy);i++) cout << 'U';
	for(i=0;i<(tx-sx);i++) cout << 'R';
	for(i=0;i<(ty-sy);i++) cout << 'D';
	for(i=0;i<(tx-sx);i++) cout << 'L';
	cout << 'L';
	for(i=0;i<(ty-sy+1);i++) cout << 'U';
	for(i=0;i<(tx-sx+1);i++) cout << 'R';
	cout << 'D' << 'R';
	for(i=0;i<(ty-sy+1);i++) cout << 'D';
	for(i=0;i<(tx-sx+1);i++) cout << 'L';
	cout << 'U' << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 666666
map<string,int> mp;
signed main(){
	int sum=0;	string s;
	int n;cin>>n;
	for(int i=0;i<n;i++){
	cin>>s;
		if(!mp[s]) sum++;
		mp[s]=1;
	}cout<<sum;
	return 0;
}

Measured memory_bytes: 19148
#include <iostream>

using namespace std;

int main(void)
{
    int data[3], temp;
    
    cin >> data[0] >> data[1] >> data[2];
    
    for (int i = 0; i < 2; ++i) {
        if (data[i] > data[i + 1]) {
            temp = data[i];
            data[i] = data[i + 1];
            data[i + 1] = temp;
        }
    }
    if (data[0] > data[1]) {
        temp = data[0];
        data[0] = data[1];
        data[1] = temp;
    }
    cout << data[0] << " " << data[1] << " " << data[2] << endl;   
    
    return 0;
}


Measured memory_bytes: 3112
using System;
         
        namespace C
        {
            class Program
            {
                static int[] ToIntAry(string[]str)
                {
                    int len = str.Length;
                    int[] intary = new int[len];
                    for(int i = 0; i < len;i++)
                    {
                        intary[i] = int.Parse(str[i]);
                    }
                    return intary;
                }
                static void Main(string[] args)
                {
                    int[] NM = ToIntAry(Console.ReadLine().Split(' '));
                    int n = NM[0], m = NM[1];
                    int[] input = ToIntAry(Console.ReadLine().Split(' '));
                    int[] Hs = new int[n+1];
                    input.CopyTo(Hs,1);
                    bool[] Score = new bool[n+1];
                    Score[0] = true;
                    for(int i = 1; i <= n;i++)
                    {
                        Score[i] = default;
                    }
                    int Count = 0;
                    int a,b;
                    for(int i = 0;i < m;i++)
                    {
                        input = ToIntAry(Console.ReadLine().Split(' '));
                        a = input[0];
                        b = input[1];
                        if(Hs[a] < Hs[b])
                        {
                            Score[a] = true;
                        }else if(Hs[a] == Hs[b])
                        {
                            Score[a] = true;
                            Score[b] = true;
                        }else{
                            Score[b] = true;
                        }
                    }
         
                    foreach(bool s in Score)
                    {
                        if (!s)
                        {
                            Count++;
                        }
                    }
                    Console.WriteLine(Count);
                }
            }
        }

Measured memory_bytes: 48712
// ITP1_10 ­ C  Standard Deviation
// 2018.4.5

#include <stdio.h>
#include <math.h>
#include <string.h>

int
main ()
{
  int n, j;
  double s[1000], sum, m, dev2;

  while (1)
    {
      memset (s, 0, 1000);
      m = sum = dev2 = 0;
      
      scanf ("%d\n", &n);
      if (n == 0)
	{
	  break;
	}
      else
	{
	  for (j = 0; j < n - 1; j++)
	    {
	      scanf ("%lf ", &s[j]);
	    }
	  scanf ("%lf\n", &s[n - 1]);
	}
      
      for (j = 0; j < n; j++)
	{
	  sum = sum + s[j];
	}
      
      m = sum / n;
      
      for (j = 0; j < n; j++)
	{
	  dev2 = dev2 + ((s[j] - m) * (s[j] - m));
	}
      printf("%.8lf\n", sqrt (dev2 / n));
    }
  return 0;
}



Measured memory_bytes: 2104
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Main { //atcoder
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        int[] a = new int[n];
        for(int i =0 ;i<n;i++) a[i] = in.nextInt();
        shuffle(a);
        Arrays.sort(a);
        int length = 1;
        int l = 0;
        int r = 1;
        while(r<n){
            if(a[r]-a[l]<=2){
                length = Math.max(length,r-l+1);
                ++r;
            }
            else{
                ++l;
            }
        }
        out.println(length);
        out.close();
    }
    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public boolean hasNext() {
            String next = null;
            try {
                next = reader.readLine();
            } catch (Exception e) {
            }
            if (next == null) {
                return false;
            }
            tokenizer = new StringTokenizer(next);
            return true;
        }

        public BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
    }
}



Measured memory_bytes: 44356
#include <bits/stdc++.h>
using namespace std;
 
#define mod 1000000007
#define INF 1000000000

#define mp make_pair
#define pb push_back
#define mt make_tuple
#define eb emplace_back
#define all(x) begin(x), end(x)
#define len(x) ((int)(x).size())
#define contains(a, x) (a.find(x) != end(a))
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define F(i,a,b) for(int i = (int)(a); i < (int)(b); ++i)
#define RF(i,a,b)for(int i = (int)(a); i >= (int)(b); --i)

using dbl = double;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvl = vector<long long>;
using pi = pair<int,int>;

#define log(x) cout << x << endl;
#define fast() {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}


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

	set<char> chars;
	map<char,int> freq, fq, mn;

	rep (i, n) {
		cin >> s;
		chars={}, fq={};

		for (auto c: s)
			chars.emplace(c), fq[c] += 1;

		for (auto c: chars)
			freq[c] += 1;

		for (auto c: chars) {
			if (mn[c]==0) mn[c] = fq[c];
			else mn[c] = min(mn[c], fq[c]);
		}
	}

	string r = "";
	for (char c='a'; c<'a'+26; ++c) {
		if (freq[c] == n) {
			for (int i=0; i<mn[c]; ++i) r += c;
		}
	}

	log(r)

	return 0;
}




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

#define FOR(a,b,c) for (int a=(b);a<(c);++a)
#define REP(i,n) FOR(i,0,n)
#define ll long long
#define pii pair<int,int>
#define x first
#define y second
#define pb push_back
#define lf double

using namespace std;

const int MAX = (int)1e6 + 5;
const int MOD = 998244353;

inline int ADD(int a,int b){ return a+b>=MOD?a+b-MOD:a+b;}
inline int MUL(int a,int b){ return (ll)a*b%MOD;}
inline int SUB(int a,int b){ return a-b<0?a-b+MOD:a-b;}

int n,s;
int dp[MAX];

int main(){
	scanf ("%d%d",&n,&s);
	dp[0]=1;
	REP(i,n){
		int a;
		scanf ("%d",&a);
		for (int j=s;j>=0;--j){
			dp[j+a]=ADD(dp[j+a],dp[j]);
			dp[j]=MUL(dp[j],2);
		}
	}
	printf ("%d\n",dp[s]);
	
	
	return 0;
}


Measured memory_bytes: 3844
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template <typename T> lint gcd(T a, T b) {return b?gcd(b, a%b):a;}
template <typename T> lint lcm(T a, T b) {return a * b / gcd(a, b);};
template <typename T> inline void chmin(T &a, const T& b){if(a>b) a=b;}
template <typename T> inline void chmax(T &a, const T& b){if(a<b) a=b;}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  cout << s.substr(0, s.size() - 8) << '\n';
}


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

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

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

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

#define POS(cnt,LEN,L) ((((cnt)&1)*(n+1)+(LEN))*(n+1)+(L))

void run(void){
  char *s=(char *)calloc(301,sizeof(char));
  scanf("%s",s);
  const int n=strlen(s);
  int k;
  scanf("%d",&k);
  int *dp=(int *)calloc((n+1)*(n+1)*2,sizeof(int));
  for(int cnt=0;cnt<=k;cnt++){
    memset(dp+POS(cnt,0,0),0,sizeof(int)*(n+1)*(n+1));
    for(int l=0;l<n;l++){
      dp[POS(cnt,1,l)]=1;
    }
    for(int len=2;len<=n;len++){
      for(int l=0;l+len<=n;l++){
	if(s[l]==s[l+len-1]){
	  dp[POS(cnt,len,l)]=dp[POS(cnt,len-2,l+1)]+2;
	} else {
	  int a=cnt>0?dp[POS(cnt-1,len-2,l+1)]+2:0;
	  int b=dp[POS(cnt,len-1,l)];
	  int c=dp[POS(cnt,len-1,l+1)];
	  dp[POS(cnt,len,l)]=MAX(a,MAX(b,c));
	}
      }
    }
  }
  printf("%d\n",dp[POS(k,n,0)]);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

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

            if (x == 7 || x == 5 || x == 3)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


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


#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl


int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	long long int t; cin>>t;
	t = t*t*t;
	cout<<t<<endl;	
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		sc.close();
		if(N.contains("7")) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}

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

int main() {
  string s;
  cin >> s;
  sort(s.begin(),s.end());
  if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

typedef long long ll;
const int INF = 1e8;
// const ll INF = 1LL << 60;
typedef pair<int, int> P;

ll H, W, K;
vector<string> S;
int c[10][1005];
int main() {
    cin >> H >> W >> K;
    S.resize(H);
    rep(i, H) {
        cin >> S[i];
    }

    int ans = INF;
    for (int i = 0; i < 1 << (H - 1); i++) {
        int g = 0;
        vector<int> id(H);
        for (int k = 0; k < H; k++) {
            id[k] = g;
            if ((i >> k) & 1) {
                g++;
            }
        }
        g++;

        rep(i, g)rep(j, W) c[i][j] = 0;
        rep(i, H)rep(j, W) c[id[i]][j] += (S[i][j] - '0');

        // 初期値は横線の数
        int num = g - 1;
        vector<int> now(g);

        auto add = [&](int j) { 
            rep(i, g) now[i] += c[i][j];
            rep(i, g) if (now[i] > K) return false;

            return true;
        };

        rep(j, W) {
            if (!add(j)) {
                // 縦線を引いた
                num++;
                now = vector<int>(g);
                if (!add(j)) {
                    num = INF;
                    break;
                }
            }
        }

        ans = min(ans, num);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256