akhauriyash/Code-Regression huggingface dataset:
import numpy as np

def main():
    n, k = map(int,input().split())
    lst = list(map(int,input().split()))
    arr = np.array(lst)

    if np.any(arr == 0):
        if k == 1:
            print(0)
            exit()
        k -= 1

    plus = arr[np.where(arr>0)]
    len_plus = len(plus)
    plus = np.insert(plus,0,0)
    minus = arr[np.where(arr<0)][::-1]
    len_minus = len(minus)
    minus = np.insert(minus,0,0)

   # print(plus)
    #print(len_plus)
    #print(plus[len_plus])
    #print(minus)
    #print("#######")

    anslist = []
    ans = 100000000000000000000


    for i in range(k):
        if len_plus < k:
            try:
                ans = plus[len_plus-i] + (abs(minus[i+(k-len_plus)])*2)
                anslist.append(ans)
            except:
                break

        elif len_plus >= k:
            try:
                ans = plus[k-i] + (abs(minus[i])*2)
                #print(ans)
                anslist.append(ans)
            except:
                break

    for i in range(k):
        if len_minus < k:
            try:
                ans = abs(minus[len_minus-i]) + (plus[i+(k-len_minus)]*2)
                anslist.append(ans)
            except:
                break
        else:
            try:
                ans = abs(minus[k-i]) + (plus[i]*2)
                anslist.append(ans)
            except:
                break


    #print(anslist)
    print(min(anslist))



if __name__ == "__main__":
        main()


Measured memory_bytes: 23112
#include <cstdio>
#include <cstring>
int field[17][17];
bool point[17][17];
int main() {
	int a,b,n;
	while(scanf("%d %d",&a,&b),a|b) {
		scanf("%d",&n);
		memset(field,0,sizeof(field));
		memset(point,0,sizeof(point));
		for(int i=0;i<n;i++) {
			int x,y;
			scanf("%d %d",&x,&y);
			point[x][y]=true;
		}
		field[1][1]=1;
		for(int y=1;y<=b;y++) {
			for(int x=1;x<=a;x++) {
				if(point[x][y]!=1) {
					field[x][y]+=field[x-1][y]+field[x][y-1];
				}
			}
		}
		printf("%d\n",field[a][b]);
	}
}

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

struct Link {
    int from, to;
    ll cost;
    Link(int f, int t, ll c) {
        from = f;
        to = t;
        cost = c;
    }  
};

const ll INF = -(1e15);

// input
int N, M;
vector<int> A, B, C;

vector<Link> links;
vector<ll> cost;


void input() {
    cin >> N >> M;
    A = B = C = vector<int>(M);
    rep(i, M) cin >> A[i] >> B[i] >> C[i];
}


bool bellman_ford() {
    cost = vector<ll>(N, INF);
    ll a, b;
    cost[0] = 0;
    rep(i, N - 1) {
        for (Link x : links) {
            if (cost[x.from] != INF) {
                cost[x.to] = max(cost[x.to], cost[x.from] + x.cost);
            }
        }
    }
    a = cost[N - 1];
    rep(i, N - 1) {
        for (Link x : links) {
            if (cost[x.from] != INF) {
                cost[x.to] = max(cost[x.to], cost[x.from] + x.cost);
            }
        }
    }
    b = cost[N - 1];
    if (a < b) return true;
    else return false;
}


int main() {
    input();
    rep(i, M) links.push_back(Link(A[i] - 1, B[i] - 1, C[i]));
    if (bellman_ford()) {
        cout << "inf" << endl;
        return 0;
    }
    ll ans = cost[N - 1];
    cout << ans << endl;
}


Measured memory_bytes: 3680
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    A,B=map(int,input().split())
    print('Possible' if A%3==0 or B%3==0 or (A+B)%3==0 else 'Impossible')

resolve()

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
long long mod=1e9+7;
int ans,n,m,a[100005],b[100005],x;
int main(){
	cin>>n>>m;
	for(int i=1;i<=m;i++) cin>>a[i];
	if(a[1]==1&&a[2]!=2) b[1]=0,b[2]=1,x=2;
	else if(a[1]==2) b[1]=1,b[2]=0,x=2;
	else if(a[1]==1&&a[2]==2) {cout<<0;return 0;}
	else b[1]=1,b[2]=2,x=1;
	for(int i=3;i<=n;i++)
	{
		if(i==a[x])
		{
			if(a[x+1]==i+1) {cout<<0;return 0;}
			else {b[i]=0,b[i+1]=b[i-1],i++,x++;continue;}
		}
		b[i]=(b[i-2]+b[i-1])%mod;
	}
	cout<<b[n];
	return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<vector>
#include<algorithm>
 using namespace std;
 int main(){
     int n,k;
     cin>>n>>k;
     vector<int> t(n);
     vector<int> sub(n);
     sub[0]=0;
     cin>>t[0];
     for(int i=1;i<n;i++){
         cin>>t[i];
         sub[i]=t[i]-t[i-1]-1;
     }
     sort(sub.begin(),sub.end());
     k--;
     long long sum=0;
     long long ans=t[n-1]-t[0]+1;
     for(int i=0;i<k;i++){
         sum+=sub[n-1-i];
     }
     ans-=sum;
     cout<<ans<<endl;
     return 0;
 }


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

int main() {
  int N,A,r,count;
  cin>>N;
  count=0;
  r=10000000000;
  rep(i,N){cin>>A;
           if(A%r!=0){
             count=0;
             r=1;
             while(A%2==0){
               count=count+1;
               r*=2;
               A/=2;
             }
           }
          }
  cout<<count<<endl;
}


Measured memory_bytes: 384
/*
"Won't stop untill I'm Phenomenal"
- Phenomenal, EMINEM
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define get(a) fl(i,0,a.size())  cin>>a[i];
#define pra(a) fl(i,0,a.size()) cout<<a[i]<<" ";	cout<<endl;
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
const ll INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;

bool sorter(pair<ll,ll> a, pair<ll,ll> b){
    return a.ss<b.ss;
}


int main(){
    Shazam;
    int n; cin>>n;
    vector<pair<ll,ll>> ranges(n);
    for(pair<ll,ll> &pp : ranges){
        cin>>pp.ff>>pp.ss;
    }
    sort(all(ranges));
    vector<ll> lower, upper;
    for(auto pp : ranges){
        lower.push_back(pp.ff);
    }
    long double lower_limit = ((n&1)?lower[(n+1)/2-1]:(lower[n/2 - 1]+lower[n/2]));
    sort(all(ranges), sorter);
    for(auto pp : ranges){
        upper.push_back(pp.ss);
    }
    
    long double upper_limit = ((n&1)?upper[(n+1)/2-1]:(upper[n/2 - 1]+upper[n/2]));
    // cout<<upper_limit<<" "<<lower_limit<<endl;
   
        cout<<(ll)(upper_limit-lower_limit+1)<<endl;
    
    return 0;
}

Measured memory_bytes: 11096
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define INF ((1LL<<62)-(1LL<<31))
#define min(p,q)((p)<(q)?(p):(q))

ll dp[810][810];
char s[810][810];
int que[640010],quecnt;

int dir[5]={0,-1,0,1,0};

int main(){
	int h,w,xx;
	scanf("%d%d%d\n",&h,&w,&xx);
	rep(i,0,h)scanf("%s",s[i]);

	int si,sj;
	rep(i,0,h)rep(j,0,w)if(s[i][j]=='S'){
		si=i;
		sj=j;
	}
	
	dp[si][sj]=1;
	que[0]=si*1000+sj;
	quecnt=1;
	//bfs
	for(int qp=0;qp<quecnt;qp++){
		int ci=que[qp]/1000;
		int cj=que[qp]%1000;
		rep(k,0,4){
			int di=ci+dir[k];
			int dj=cj+dir[k+1];
			if(0<=di&&di<h&&0<=dj&&dj<w&&s[di][dj]=='.'&&!dp[di][dj]){
				dp[di][dj]=dp[ci][cj]+1;
				if(dp[di][dj]<=xx)que[quecnt++]=di*1000+dj;
			}
		}
	}

	ll ans=INF;
	rep(i,0,h)rep(j,0,w)if(dp[i][j]){
		//外周までの距離
		int d=min(min(llabs(i),llabs(h-1-i)),min(llabs(j),llabs(w-1-j)));
		ans=min(ans,1+(d+xx-1)/xx);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 8320
use std::cmp;
use whiteread::parse_line;

fn main() {
    let _n: usize = parse_line().unwrap();
    let heights: Vec<usize> = parse_line().unwrap();
    let mut sum = 0;
    let mut max = 0;
    for height in heights {
        max = cmp::max(max, height);
        // eprintln!("{}", max - height);
        sum += max - height;
    }
    println!("{}", sum);
}


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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, l, r;
  while ( cin >> n >> l >> r, n ) {
    vector<int> A(n);
    for ( int i = 0; i < n; i++ ) {
      cin >> A[i];      
    }

    int ans = 0;
    for ( int i = l; i <= r; i++ ) {
      int j;
      for ( j = 0; j < n; j++ ) {
	if ( i%A[j] == 0 ) break;	
      }
      if ( j%2 == 0 ) ans++;      
    }

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



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

typedef long long ll;

ll D(ll x) {
  ll rv = 0;

  ll i = 1;
  for (; i*i <= x; ++i) {
    rv += x/i;
  }

  rv *= 2;

  i--;
  rv -= i*i;
  return rv;
}

void solve(long long N){
  cout << D(N-1) << endl;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long N;
  std::cin >> N;
  solve(N);
  return 0;
}


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

using namespace std;

inline int read()
{
	int x=0,f=1;char ch=getchar();
	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return x*f;
}

const int maxn = (1<<20)+20;

struct Node{
	string blue,red;
};

Node f[maxn];
map<pair<string,string>,int> mp;
int n,m;
char s[1010];
char s1[1010];
int cnt;

int main()
{
    n=read();
    scanf("%s",s+1);
    for (int i=n+1;i<=2*n;i++) s1[i-n]=s[i];
    
    for (int i=0;i<(1<<n);i++)
    {
         string sb,sr;
         sb.clear();
         sr.clear();
         for (int j=1;j<=n;j++) if (i&(1<<(j-1))) sb=s[j]+sb; else sr+=s[j];
         f[++cnt].blue=sb;
         f[cnt].red=sr;
    }

    for (int i=0;i<(1<<n);i++)
    {
    	string sb,sr;
    	sb.clear();
    	sr.clear();
    	for (int j=1;j<=n;j++) if (i&(1<<(j-1))) sb=s1[j]+sb; else sr=sr+s1[j];
    	mp[make_pair(sb,sr)]++;
    }
    long long ans=0;
    for (int i=1;i<=cnt;i++)
    {
         if (mp[make_pair(f[i].red,f[i].blue)]) ans+=mp[make_pair(f[i].red,f[i].blue)]; 
    } 
    cout<<ans;
	return 0;
}

Measured memory_bytes: 102400
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

using ll = long long;
using namespace std;

#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define LFOR(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define FORR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LFORR(i,a,b) for(ll i = (int)(a); i >= (ll)(b); i--)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define LREP(i,n) LFOR(i,0,(ll)(n)-1)
#define REPR(i,n) FORR(i,(int)(n)-1,0)
#define LREPR(i,n) LFORR(i,(ll)(n)-1,0)

#define SIZ(v) int(v.size())
const int INF = 1e8;
const ll LINF = 1e15;





int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> ws;
  REP(i,n){
    int k;
    cin >> k;
    if (!i) ws.push_back(k);
    else ws.push_back(k+ws[i-1]);
  }
  int ans;
  REP(i,n-1){
    int dd = ws[n-1]-2*ws[i];
    ans = min(ans, max(dd,-dd));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include <limits>
#include <iomanip>

using namespace std;

int main(){
	int n,min = 200000,ans=0;
	cin >> n;
	
	vector<int> v(n);
	
	for(int i=0;i<n;i++){
		cin >> v[i];
	}
	
	for(int i=0;i<n;i++){
		if( min >= v[i] ){
			ans++;
			min = v[i];
		}
	}
	
	cout << ans << endl;
		
		
	
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());
#define usort(a) sort(a.rbegin(),a.rend());

using namespace::std;

int jo(ll int a, ll int b){//累乗
    ll int num=1;
    rep(i,0,b) num=num*a;
    return num;
}
char tobig(char s){//char大文字化
  return (s-0x20);
}
char tolow(char s){//char小文字化
  return (s+0x20);
}
int ctoi(char a){//char->int
  if('0'<=a&&a<='9') return (a-'0');
  return -1;
}

int gcd(ll int a,ll int b) {//最大公約数
  if(a<b) return gcd(b,a);
  int c;
  while ((c=a%b)) {
    a=b;
    b=c;
  }
  return b;
}
int lcm(ll int a,ll int b){//最小公倍数
 return (a*b)/gcd(a,b);
}


int main(){
  int A,B,C;
  string S,T,U;
  cin>>A>>B;
  cout<<6-A-B;
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート
//  sort(変数名.rbegin(),変数名.rend());//降順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順

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

using namespace std;

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

    int n, ans = 0;
    double d;
    cin >> n >> d;
    for (int i = 0; i < n; i++) {
        double x, y;
        cin >> x >> y;
        if (sqrt(x * x + y * y) <= d) ans++;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3856
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) v.begin(),v.end()
#define endll "\n"

#define fin             freopen("input.txt","r",stdin);
#define fout            freopen("output.txt","w",stdout);


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    int sum=0;
    for(int i=0;i<s.size();i++){
        sum+=(s[i]-48);
    }

    if(sum%9==0){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;

    return 0;
}



Measured memory_bytes: 3780
N = input()
N = int(N)

a_list = {}

ans = 0

for i in range(N):
    a = input()
    a = int(a)
    if a not in a_list:
        a_list[a] = 1
    else:
        a_list[a] = (a_list[a] + 1) % 2
    if a_list[a]:
        ans += 1
    else:
        ans -= 1

print(ans)

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    string s;
    cin >> s;

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

    for (int i = 0; i < n / 2; i++) {
        if (s[i] != s[i+n/2]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
n, m = map(lambda x: int(x), input().split())
a = [0] * m
b = [0] * m
c = [0] * m
for i in range(m):
    a[i], b[i], c[i] = map(lambda x: int(x), input().split())

def dijkstra(graph, start):
    cost = [1000*100 for _ in range(n+1)]
    fixed = [False for _ in range(n+1)]
    cost[start] = 0
    fixed[start] = True
    tmp_sta = start
    while True:
        tmp_min = 1000*100
        for i in graph[tmp_sta]:
            cost[i[0]] = min(cost[i[0]], cost[tmp_sta]+i[1])
        for i in range(1, n+1):
            if tmp_min > cost[i] and fixed[i] == False:
                tmp_min = cost[i]
                tmp_sta = i
        if tmp_min == 1000*100:
            return cost
        else:
            fixed[tmp_sta] = True
    
graph = {}
for i in range(1, n+1):
    graph[i] = []
for i in range(m):
    graph[a[i]].append((b[i], c[i]))
    graph[b[i]].append((a[i], c[i]))

cost2d = [[]]
for i in range(1, n+1):
    cost2d.append(dijkstra(graph, i))

ans = 0
for i in range(m):
    if c[i] > cost2d[a[i]][b[i]]:
        ans += 1
print(ans)

Measured memory_bytes: 3444
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;

lli mod197 = 1000000007LL;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

lli N;

int main(void) {

	cin >> N;

	map<string, lli> strs;

	vector<char> chars(10);

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> chars[j];
		}
		sort(chars.begin(),chars.end());

		string s = "";

		for (int j = 0; j < 10; j++) {
			s += chars[j];
		}

		strs[s]++;
	}

	lli ans = 0;

	for (auto itr = strs.begin(); itr != strs.end(); itr++) {
		ans += itr->second * (itr->second - 1) / 2;
	}

	COUT(ans);

	return 0;
}

Measured memory_bytes: 12800
def abc112_d():
    N, M = map(int, input().split())

    def divisor(n):
        ''' nの約数列挙 '''
        arr = []
        for i in range(1, int(n**0.5) + 1):
            if n % i == 0:
                arr.append(i)
                arr.append(n // i)
        return arr  # 戻り値はsortされていない

    ans = 1
    for d in divisor(M):
        if M // d >= N:
            ans = max(d, ans)
    print(ans)

abc112_d()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
typedef pair<int,int> P;
#define INF 1e9
#define rep(i,N) for(int i=0;i<N;i++)

unsigned euclidean_gcd(unsigned a, unsigned b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}

int main(){
    ll n,k;
    cin>>n>>k;
    ll a[n];
    rep(i,n)cin>>a[i];
    ll gcd_ = euclidean_gcd(a[0],a[1]);
    ll m = 0;
    rep(i,n){
        gcd_ = euclidean_gcd(gcd_,a[i]);
        m = max(m,a[i]);
    }
    if(m>=k&&k%gcd_==0){
        cout<<"POSSIBLE"<<endl;
    }else{
        cout<<"IMPOSSIBLE"<<endl;
    }
}

Measured memory_bytes: 1024
s = input()
n = len(s)

if s == s[::-1] and s[:(n-1)//2] == s[(n-1)//2-1::-1] and s[(n+3)//2-1:] == s[n-1:(n+3)//2-2:-1]:
    print("Yes")
else:
    print("No")

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;

const int MOD = 1000000007;

int main() {
    int A, B;
    cin >> A >> B;
    if (A < 10 && B < 10) {
        cout << A * B << endl;
    } else {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <math.h>

using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
static const ll maxLL = (ll)1 << 62;

//Prime Creator
bool Prime[100001] = {};
void createPrime() {
	ll n = 100001;
	rep(i, 0, n) Prime[i] = true;
	Prime[0] = false;
	Prime[1] = false;
	rep(i, 2, n) {
		if (Prime[i]) {
			rep(j, 2, n) {
				if (j*i >= n)break;
				Prime[j*i] = false;
			}
		}
	}
}

bool similarPrime[100001] = {};
ll s[100001] = {};
int main() {
	createPrime();

	rep(i, 1, 100001) {
		if (Prime[i] && Prime[(i + 1) / 2]) {
			similarPrime[i] = true;
		}
	}
	rep(i, 1, 100001) {
		s[i] += s[i - 1] + (similarPrime[i] ? 1 : 0);
	}

	ll Q; cin >> Q;
	rep(i, 0, Q) {
		ll l, r; cin >> l >> r;
		cout << s[r] - s[l-1] << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define SORT(v, n) sort(v, v+n)
#define vi vector<int>
#define pb push_back
#define P pair<int,int>


template <class T> void chmin(T&a, const T&b) { a = min(a,b); }
template <class T> void chmax(T&a, const T&b) { a = max(a,b); }

const double EPS =1e-9;
const long INF =999999999;
const long MOD =1000000007; //10^9+7
#define PI 3.14159265258979

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


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

	if(A/100==A%10) puts("Yes");
	else puts("No");
	return 0;
}



Measured memory_bytes: 256
import Control.Monad
import Data.Bool
import Data.List

readInt = readLn :: IO Int
readInts = map read . words <$> getLine :: IO [Int]
readNInts = flip replicateM readInts

main :: IO ()
main = do
  b <- getLine
  putStrLn $ f b

f "A" = "T"
f "T" = "A"
f "C" = "G"
f "G" = "C"

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

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    if(s == "SSS"){
        cout << ans << endl;
        return 0;
    }
    ans++;
    rep(i,2){
        if(s[i] == 'R' && s[i+1] == 'R'){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3684
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  int N;
  cin >> N;
  int a[N];
  for(int i = 0; i < N; i++) cin >> a[i];
  sort(a,a+N,greater<int>());
  int A=0, B=0;
  for(int i = 0; i < N; i++){
    if(i%2==0) A += a[i];
    else B += a[i];
  }
  printf("%d\n",A - B);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define x first
#define y second
using namespace std;

template<typename T>
void read(T& n){
	char ch; int sign = 1;
	while (!isdigit(ch = getchar())) if (ch == '-') sign = -1;
	n = ch - '0';
	while (isdigit(ch = getchar())) n = n * 10 + ch - '0';
	n *= sign;
}
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e18 + 7;
const int N = 122222;
struct node{ll x, p;} pos[N];
int n, m;
int to[N];

bool cmp(node a, node b){return a.x < b.x;}

int main(){
	read(n), read(m);
	rep(i, 1, n) read(pos[i].x), read(pos[i].p);
	pos[++n] = (node){m, INF};
	sort(pos + 1, pos + n + 1, cmp);
	int l = 1, r = n;
	while(l < r){
		if (pos[l].p < pos[r].p){
			pos[r].p += pos[l].p;
			if (!to[r]) to[r] = l;
			l++;
		} else {
			pos[l].p += pos[r].p;
			if (!to[l]) to[l] = r;
			r--;
		}
	}
	ll ans = 0;
	rep(i, 1, n) if (to[i])
		ans += abs(pos[to[i]].x - pos[i].x);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
// vim: shiftwidth=2 expandtab foldmethod=marker

// include {{{
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <utility>
#include <cstdlib>
// }}}

// debug(...) {{{
#ifdef LOCAL_DEBUG
#include "./debug.h"
#else
#define debug(...)
#endif
// }}}

// misc {{{
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

template<class T>
void sort(T& arr) {
  std::sort(arr.begin(), arr.end());
}
template<class T, class By>
void sort_by(T& arr, By by) {
  std::sort(arr.begin(), arr.end(), [by](auto l, auto r){return  by(l) < by(r); });
}

template<class T>
void reverse(T& arr) {
  std::reverse(arr.begin(), arr.end());
}

// }}}

// main {{{
void solve();
int main() {
  solve();
}
// }}}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
void solve() {
  ll N, K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i, N) {
    cin >> A[i];
  }
  ll sum = 0;
  ll mod = 1000LL * 1000 * 1000 + 7;
  ll two = modinv(2, mod);
  rep(i, N) {
    ll n1 = 0, n2 = 0;
    rep(j, N) {
      if(A[i] > A[j]) {
        if(j <= i) ++n1;
        else ++n2;
      }
    }
    ll x = (n1 + n2) * (K + 1) % mod * K % mod * two % mod - (K * n1) % mod;
    if(x < 0) x += mod;
    sum += x;
    sum %= mod;
    if(sum < 0) exit(1);
  }
  cout << sum << endl;;
}


Measured memory_bytes: 256
import Data.List.Split

main = do line <- getLine
          putStrLn . writeRect . calcRect . readRect $ line

readRect :: String -> [Int]
readRect x = map read $ splitOn " " x

calcRect :: [Int] -> [Int]
calcRect x = [a*b] ++ [2*(a+b)]
  where a = head x
        b = last x

writeRect :: [Int] -> String
writeRect x =
  show area ++ " " ++ show perimeter
  where area      = head x
        perimeter = last x

Measured memory_bytes: 3636
#include<stdio.h>
#include<algorithm>
using namespace std;
int w[2100], T, n, R[2100];
long long Res, S;
int main(){
    int i, j;
    scanf("%d%d",&n,&T);
    for(i=1;i<=n;i++){
        scanf("%d",&w[i]);
        R[i] = w[i];
    }
    Res = 1e18;
    for(i=0;i<=n;i++){
        for(j=1;j<=n;j++){
            R[j] = min(R[j], w[(j+n-i-1)%n+1]);
        }
        S = 0;
        for(j=1;j<=n;j++){
            S += R[j];
        }
        S += 1ll*i*T;
        Res = min(Res,S);
    }
    printf("%lld\n",Res);
}


Measured memory_bytes: 256
# frozen_string_literal: true

h, _ = gets.split.map(&:to_i)
s = Array.new(h) { gets.split }
l = [*'A'..'Z']

s.each_with_index do |row, idx|
  if tmp = row.index('snuke')
    puts "#{l[tmp]}#{idx + 1}"
    exit
  end
end

Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
using namespace std;
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<pin,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define sq(a) (a)*(a)
#define rev(s) reverse(s.begin(),s.end())
#define end_pr(s) cout << s <<endl;return 0
#define itn int
#define bs bitset<5001>

int kai_size = 1000001;
vel kai(kai_size, 1);
vel ink(kai_size, 1);
vel dist;
signed main() {
	int n, lim; cin >> n >> lim;
	if (lim % 2 == 1) { cout << 0 << endl; return 0; }
	lim /= 2;
	vvel dp(n + 1,vel( lim + 1,0));
	dp[0][0] = 1;
	rep(i, n) {
		vvel ndp(n+1,vel(lim+1,0));
		rep(j, n + 1) {
			for (int k = 0; k + j <= lim; k++) {
				int ans=(dp[j][k] % p);
				int mk = k + j;
				ndp[j][mk] += ans * (j + 1);
				if (j != 0) { ndp[j][mk] += ans*j; }
				if (j < n) { ndp[j + 1][mk] += ans; }
				if (0 < j) { ndp[j - 1][mk] += ans*((j*j)%p); }
			}
		}
		dp = ndp;
	}
	cout << dp[0][lim]%p << endl;
	return 0;
}

Measured memory_bytes: 16940
#include <stdio.h>
#include <stdlib.h>
int int_sort_up(const void * a, const void * b)
{
    if(*(int*)a<*(int*)b)
    {
        return -1;
    }
    else if(*(int*)a==*(int*)b)
    {
        return 0;
    }
    return 1;
}
int int_sort_down(const void * a, const void * b)
{
    if(*(long int*)a>*(long int*)b)
    {
        return -1;
    }
    else if(*(long int*)a==*(long int*)b)
    {
        return 0;
    }
    return 1;
}


int main(void)
{
    int n;
    long int h;
    scanf("%d %ld",&n,&h);
    long int a[100003]={};
    long int b[100003]={};
    for(int p=0;p<n;p++)scanf("%ld %ld",&a[p],&b[p]);
    long int time=0;
    qsort(a,n,sizeof(a[0]),int_sort_down);
    qsort(b,n,sizeof(b[0]),int_sort_down);
    int x=0;
    while(h>0&&b[x]>a[0])
    {
        h=h-b[x];
        time++;
        x++;
    }
    if(h>0)
    {
        time+=h/a[0];
        if(h%a[0]!=0)time+=1;
    }
    printf("%ld",time);
}


Measured memory_bytes: 2556
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	string C1 ,C2;
    string res = "NO";
	cin >> C1 >> C2;
    if (C1[0] == C2[2] && C1[1] == C2[1] && C1[2] == C2[0]) {res = "YES";}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int nlist[] = new int[n];
		for(int i = 1; i <= n; i++) {
			int a = sc.nextInt();
			nlist[a - 1] = i;
		}
		for(int i=0 ; i < n ; i++) {
			System.out.print(nlist[i] + " ");
		}
		sc.close();
	}

}

Measured memory_bytes: 51588
def decode(s, n):
    a = ""
    for i in s:
        if i.islower():
            o = ord(i) + n
            if o <= 122:
                a += chr(o)
            else:
                a += chr(o - 26)
        else:
            a += i
    return a

def judge(s):
    a = s.split()
    return "the" in a or "this" in a or "that" in a

while True:
    try:
        s = input()
    except:
        break
    for i in range(26):
        a = decode(s, i)
        if judge(a):
            print(a)
            break

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

int main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    int L, R;
    L = A + B;
    R = C + D;
    if (L > R)
        cout << "Left"<<endl;
    else if (L == R)
        cout << "Balanced"<<endl;
    else
        cout << "Right"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#define lld long long int 
#define mod 1000000007
#define FIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main() 
{
    FIO
    lld n,a,b;
    cin >> n >> a >> b;
    lld sum = a+b;
            cout<<(((n/sum)*a) + min(n%sum,a))<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
/* Uncomment only if you are not using GNU compiler->
*/
#include <map>
#include <algorithm> 
#include <vector> 
#include <string.h> 
#include <math.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <chrono> 
#include <thread> 
#include <iomanip>
#include <typeinfo>
/**/ 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define all(v)  v.begin(), v.end()

//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}

ll power(ll x, ll n)
{
    ll res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}

void solve()
{
    string s,t;
    cin>>s>>t;
    int n=s.length();
    int cnt=0;
    rep(i,n)
    {
        if(s[i]!=t[i])
            cnt++;
    }
    cout<<cnt<<endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1, tt=1;
    // cin>>t;
    while(tt<=t)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
        tt++;
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3900
/*Keyence Programming Contest 2020*/
/*A*/
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<stack>
#include<vector>
#include<queue>
#include<bitset>
using namespace std;

#define LL long long
#define DB double
#define MOD 59393
#define Pr pair<DB,int>
#define X first
#define Y second
#define MAXN 600000
#define INF 1200000001
#define mem(x,p) memset(x,p,sizeof(x))

LL read(){
  LL x=0,F=1;char c=getchar();
  while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
  while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}
  return x*F;
}

int add(int a,int b){return (a+b>=MOD)?a+b-MOD:a+b;}
int dec(int a,int b){return (a-b<0)?a-b+MOD:a-b;}
int mul(int a,int b){return 1LL*a*b%MOD;}

int h,w,n,p;

int main()
{
    h=read(),w=read(),n=read();
    p=max(h,w);
    printf("%d",(n+p-1)/p);
}


Measured memory_bytes: 128
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
vector<pint> v;
int main()
{
	int n,a,b;lint k,sum=0;
	cin>>n>>k;
	rep(i,n){
		cin>>a>>b;v.pb(mp(a,b));
	}
	sort(All(v));
	rep(i,n){
		sum+=v[i].se;
		if(sum>=k){
			cout<<v[i].fi<<endl;return 0;
		}
	}
}


Measured memory_bytes: 1400
ai = lambda: list(map(int,input().split()))
ai_ = lambda: [int(x)-1 for x in input().split()]

n,T = ai()
ans = 10**5
for _ in range(n):
    c,t = ai()
    if t <= T:
        ans = min(c,ans)
if ans == 10**5:
    print('TLE')
else:
    print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int num;
	scanf("%d", &num);
	ll ans = 0;
	ll now = 2;
	for (int i = 0; i < num; i++)
	{
		int z;
		scanf("%d", &z);
		if (i == 0)ans += z - 1;
		else if (z == now)now++;
		else ans += (z - 1) / now;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
namespace io{
    const int l=1<<20;
    char buf[l],*s,*t,c;
    inline void gc(){
        if(s==t){
            t=(s=buf)+fread(buf,1,l,stdin);
            c=s==t?EOF:*s++;
        }else c=*s++;
    }
    template<class IT>inline void gi(IT &x){
        x=0;gc();while(c<'0'||c>'9')gc();
        while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^48);gc();}
    }
    char buf0[20];int a;
    template<class IT>inline void pi(IT x){
        if(x<0){putchar('-');x=-x;}
        do buf0[++a]=x%10+48;while(x/=10);
        while(a)putchar(buf0[a--]);
        putchar('\n');
    }
};
using io::gi;
using io::pi;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
typedef vector<int> vi;
typedef vector<ll > vl;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const int N=5005,M=10005;
ll d[M],D[M];int x[N];
int main(){
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n,i,j;ll a,b,t;
    scanf("%d%lld%lld",&n,&a,&b);
    rep(i,1,n){scanf("%d",&j);x[j]=i<<1;}
	rep(i,1,n){
        //printf("%d\n",x[i]);
        t=1000000000000000000ll;
        REP(j,1,M)D[j]=d[j-((j&1)^1)]+((j==x[i])?0ll:((j<x[i])?b:a));
        d[1]=D[1];
        REP(j,2,M)d[j]=min(d[j-1],D[j]);
        //REP(j,1,9)printf("%lld ",d[j]);printf("\n");
    }
    printf("%lld",d[M-1]);
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void) {
	int A,B,C,D;
	scanf("%d%d%d%d",&A,&B,&C,&D);
	if(A*B>=C*D){
		printf("%d",A*B);
	}
	else{
		printf("%d",C*D);
	}
	return 0;
}


Measured memory_bytes: 128
# include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int mod = 1e9+7;
int dp[1005][1005];
int main()
{
	fast;
    int h,w;
    cin>>h>>w;
    char arr[h+1][w+1];
    for(int i=1; i<=h; i++){
    	for(int j=1; j<=w; j++){
    		cin>>arr[i][j];
		}
	}
	
	for(int i=1; i<=h; i++){
		for(int j=1; j<=w; j++){
			if(i==1 && j==1)dp[i][j]=1;
			else if(arr[i][j]=='#')dp[i][j]=0;
			else
			dp[i][j] = (dp[i-1][j]+dp[i][j-1])%mod;
		}
	}
	cout<<dp[h][w];
    return 0;
}



Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e18;
const int mod = 1e9+7;
typedef pair<int,int> P;
#define fi first
#define se second

int dp[302][302][302];
int calc(int k, int n){
	int res = 0;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			if(k == 0)res += dp[n][i][j];
			if(k == 1)res += dp[i][n][j];
			if(k == 2)res += dp[i][j][n];
			res %= mod;
		}
	}
	return res;
}

int MAX(int a, int b, int c){
	int res = max(a, b);
	return max(res, c);
}

int MIN(int a, int b, int c){
	int res = min(a, b);
	return min(res, c);
}

signed main(){
	int n, m;
	scanf("%lld%lld", &n, &m);
	vector<vector<P> > v(n+1);
	for(int i = 0;i < m;i++){
		int l, r, x;
		scanf("%lld%lld%lld", &l, &r, &x);
		v[r].push_back(P(l, x));
	}
	
	dp[0][0][0] = 1;
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= n;j++){
			for(int k = 0;k <= n;k++){
				int r = MAX(i, j, k), l = MIN(i, j, k);
				int mid = (i+j+k)-r-l;
				if(l != 0 && (mid == l || mid == r || l == r))continue;
				for(int p = 0;p < v[r].size();p++){
					if(v[r][p].se == 1){
						if(v[r][p].fi <= mid)dp[i][j][k] = 0;
					}else if(v[r][p].se == 2){
						if(v[r][p].fi <= l)dp[i][j][k] = 0;
						if(v[r][p].fi > mid)dp[i][j][k] = 0;
					}else{
						if(v[r][p].fi > l)dp[i][j][k] = 0;
					}
				}
				dp[r+1][j][k] += dp[i][j][k] %= mod;//dp[r+1][j][k] %= mod;
				dp[i][r+1][k] += dp[i][j][k] %= mod;//dp[i][r+1][k] %= mod;
				dp[i][j][r+1] += dp[i][j][k] %= mod;//dp[i][j][r+1] %= mod;
			}
		}
	}
	
	int ans = 0;
	for(int i = 0;i < 3;i++)ans += calc(i, n);
	printf("%lld\n", ans%mod);
	return 0;
}


Measured memory_bytes: 215424
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	nums := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&nums[i])
	}
	var count int
	var min int
	for i := 0; i < n; i++ {
		if i == 0 {
			min = nums[i]
			count++
		} else {
			if min > nums[i] {
				min = nums[i]
				count++
			}
		}
	}

	fmt.Println(count)
}


Measured memory_bytes: 4992
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 1000000000
#define LLINF 1145141919810LL
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

int dp[101][100002]; // i番目までみたとき価値jとなるときの最小重量

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

  REP(i, 101) REP(j, 100002){
    if(j == 0) dp[i][j] = 0;
    else dp[i][j] = LLINF;
  }

  int N, W, w[100], v[100]; cin >> N >> W;
  REP(i, N) cin >> w[i] >> v[i];

  for(int i = 1; i <= N; i++){
    for(int j = 1; j < 100002; j++){
      if(j-v[i-1] < 0) dp[i][j] = dp[i-1][j];
      else if(dp[i-1][j] == 0) dp[i][j] = dp[i-1][j-v[i-1]]+w[i-1];
      else dp[i][j] = min(dp[i-1][j], dp[i-1][j-v[i-1]]+w[i-1]);
    }
  }

  for(int i = 100001; i >= 0; i--){
    if(dp[N][i] <= W){
      cout << i << endl;
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 79232
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const bonus = Math.floor(N / 15) * 200;
    
    const x = (N * 800);
    
    console.log(x - bonus);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
//#include <numeric>
#pragma warning(disable:4996) 
 
typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

int a[500][500];
const int aa = 1000000000;

void solve()
{
    int H, W, h, w;
    scanf("%d%d%d%d", &H, &W, &h, &w);

    if (h == 1 && w == 1) {
        printf("No\n"); return;
    }
    else if (H % h ==0 && W % w == 0) {
        printf("No\n"); return;
    }
    else if (W % w == 0) {
        printf("Yes\n");
        int i, j;
        for (i = 0; i < H; i++) {
            for (j = 0; j < W; j++) {
                if (i%h == 0 && j%w == w - 1) {
                    printf("%d", aa-1);
                }
                else if (i%h == h - 1 && j%w == w - 1) {
                    printf("%d", -aa);
                }
                else {
                    printf("0");
                }
                if (j < W - 1) printf(" ");
                else printf("\n");
            }
        }
    }
    else {
        printf("Yes\n");
        int i, j;
        for (i = 0; i < H; i++) {
            for (j = 0; j < W; j++) {
                if (i%h == h-1 && j%w == 0) {
                    printf("%d", aa-1);
                }
                else if (i%h == h - 1 && j%w == w - 1) {
                    printf("%d", -aa);
                }
                else {
                    printf("0");
                }
                if (j < W - 1) printf(" ");
                else printf("\n");
            }
        }
    }


    return;
}


int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 2816
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<vector>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<iostream>
#include<string>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define REP(i,x) for (int i=0;i<x;i++)
#define REPP(i,x,y) for (int i=x;i<=y;i++)
#define SI(x) scanf("%d",&x)
#define SL(x) scanf("%lld",&x)
#define MX3(x,y,z) max(x,max(y,z))
#define MX4(x,y,z,p) max(x,max(y,max(z,p)))
#define MX5(x,y,z,p,q) max(x,max(y,max(z,max(p,q))))
#define MN3(x,y,z) min(x,min(y,z))
#define MN4(x,y,z,p) min(x,min(y,min(z,p)))
#define MN5(x,y,z,p,q) min(x,min(y,min(z,min(p,q))))
#define amax(x,y) x=max(x,y)
#define amin(x,y) x=min(x,y)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef tuple<int,int,int> ti;
typedef tuple<ll,ll,ll> tl;
// #####################################################################
const int MAX = 100000 + 10;
char arr[MAX];
int cnt[26];
ll dp[26];
const ll MOD = 1000000007;

void solve() {

    int n;
    SI(n);
    scanf("%s", arr);
    REP(i, n) {
        cnt[arr[i] - 'a']++;
    }
    ll ans = 0;
    REP(i, 26) {
        if(cnt[i]) {
            dp[i] = cnt[i];
            dp[i] %= MOD;
            REP(j, i) {
                dp[i] += dp[j] * cnt[i] % MOD;
                dp[i] %= MOD;
            }
            ans += dp[i];
            ans %= MOD;
        }
    }
    printf("%lld\n", ans);
}

void init() {
    


}

int main () {
    init();
    solve();
    return 0;
}




Measured memory_bytes: 384
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<double,double>
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
int par[100005];
int lank[100005];

void init(int n){
    for(int i=0; i<n; i++){
        par[i]=i;
        lank[i]=0;
    }
}
int find(int x){
    if(par[x]==x){
        return x;
    }else {
        return par[x]=find(par[x]);
    }
}
void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return;
    if(lank[x]<lank[y]){
        par[x]=y;
    }else {
        par[y]=x;
        if(lank[x]==lank[y])lank[x]++;
    }
}
bool same(int x,int y){
    return find(x)==find(y);
}
signed main() {
    int n,m;cin>>n>>m;
    if(n/2+m<n-1){
        cout<<"Impossible"<<endl;return 0;
    }
    else if(m==n-1){
        cout<<0<<endl;return 0;
    }
    int a[114514];
    rep(i,0,n){
        cin>>a[i];
    }
    init(n);
    rep(i,0,m){
        int x,y;cin>>x>>y;
        unite(x,y);
    }
    vector<int> G[114514];
    rep(i,0,n){
        G[find(i)].push_back(a[i]);
    }
    int ans=0;
    vector<int> cnt;
    int c=0;
    rep(i,0,n){
        if(G[i].size()==0)continue;else c++;
        sort(G[i].begin(),G[i].end());
        rep(j,0,G[i].size()){
            if(j==0)ans+=G[i][j];
            else cnt.push_back(G[i][j]);
        }
    }
    sort(cnt.begin(),cnt.end());
    rep(i,0,2*(n-1-m)-c){
        ans+=cnt[i];
    }cout<<ans<<endl;
    return 0;
}

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

int main() {
    // input, init
    map<int, bool> used;
    int s;
    cin >> s;
    used[s] = true;
    
    // simulation
    int a = s, cnt = 1;
    while (true) {
        cnt++;
        if (a % 2 == 0) {
            a /= 2;
        } else {
            a = a * 3 + 1;
        }
        
        if (used[a]) break;
        used[a] = true;
    }
    cout << cnt << endl;

    return 0;
}

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

#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <math.h>

using namespace std;


int main() {
  int D, N;

  scanf("%d %d", &D, &N);

  int space = pow(100, D);

  int ans;
  if(N == 100){
    ans = space * 101;
  }else{
    ans = space * N;
  }

  printf("%d", ans);

  return 0;
}


Measured memory_bytes: 384