akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int func(ll n, vector<int> &a, int level, int k){
	if(level == k){
		if(n > 2) return 1;
		else if(n == 2) return 0;
		else return -1;
	}else{
		n /= (ll)a.at(level);
		n *= (ll)a.at(level);
		return func(n, a, level+1, k);
	}
}

ll b_serch(ll l, ll r, vector<int> &a, int k){
	while(r - l > 1){
		ll mid = (l+r)/2;
		if(func(mid, a, 0, k) >= 0){
			r = mid;
		}else{
			l = mid;
		}
	}
	return r;
}

ll b_serch2(ll l, ll r, vector<int> &a, int k){
	while(r - l > 1){
		ll mid = (l+r)/2;
		if(func(mid, a, 0, k) <= 0){
			l = mid;
		}else{
			r = mid;
		}
	}
	return l;
}

int main(){
	int k;
	cin >> k;
	vector<int> a(k);
	int mx = 0;
	rep(snip_i, k){
		cin >> a.at(snip_i);
		mx = max(mx, a.at(snip_i));
	}
	ll n_mn, n_mx;
	n_mn = b_serch(1, (ll)mx*k+3, a, k);
	n_mx = b_serch2(1, (ll)mx*k+3, a, k);
	if(n_mn > n_mx){
		cout << -1 << endl;
	}else{
		cout << n_mn << " " << n_mx << endl;
	}
	
	return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
	char l = sc.next().charAt(0); 
    char r = sc.next().charAt(0);
    if (l < r) {
      System.out.println('<');
    } else if (l > r) {
      System.out.println('>'); 
    } else {
      System.out.println('=');
    }
  }
}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

int main() {
    std::string a, b;
    std::cin >> a >> b;

    std::string ans;
    if (a.size() > b.size())
    {
        ans = "GREATER";
    }
    else if (a.size() < b.size())
    {
        ans = "LESS";
    }
    else if(a.size() == b.size())
    {
        ans = "EQUAL";
        int n = a.size();
        for (int i = 0; i < n; i++)
        {
            if(a[i] > b[i]) {
                ans = "GREATER";
                break;
            }
            else if (b[i] > a[i])
            {
                ans = "LESS";
                break;
            }
        }
    }

    std::cout << ans << "\n";
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
//#define ARRAY(type,n) (type *)malloc(sizeof(type)*n)
template<typename T>
T* ARRAY(int n){
	(T*)malloc(sizeof(T)*n);
}
template<typename T>
T** ARRAY2(int m,int n){
	T** type = (T**)malloc(sizeof(T*)*m);
	for(int i=0;i<m;i++){
		type[i]=(T*)malloc(sizeof(T)*n);
	}
	return type;
}
 
int par[100000];
void init(int n){
	rep(i,n){
		par[i]=i;
	}
}
 
int root(int x){
	if(par[x]==x){
		return x;
	}else{
		return par[x] = root(par[x]);
	}
}
 
void unite(int x,int y){
	x=root(x);
	y=root(y);
	if(x==y)return;
	par[x]=y;
}
 
 
 
struct a{
	ll a;
	int num;
	int par;
	bool use;
};
 
bool operator< (const a& left,const a& right){
        return left.a < right.a;
}

 
 
ll gcda(ll a, ll b){
	ll c = -1;
	ll tmp;
	if(b>a){
		tmp=a;
		a=b;
		b=tmp;
	}
	while(c!=0){
		c=a%b;
		a=b;
		b=c;
	}
	return a;
}
 
int main(void){
	int n;
	cin >> n;
  	ll a;
  	ll ans;
    cin>>ans;
	rep(i,n-1){
		cin>>a;
        ans = gcda(ans,a);
	}
	
	cout<<ans<<endl;
 
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  string str1,str2;
  getline(cin,str1);
  getline(cin,str2);
  int check=0,size1=0,size2=0;
  while(str1[size1]!='\0')
    size1++;
  while(str2[size2]!='\0')
    size2++;
  size1++;
  if(size1!=size2)
  cout<<"No";
  else
  {
  	for(int i=0;i<size1-1;i++)
  	{
    	if(str1[i]!=str2[i])
        {
          check++;
          break;
        }
  	}
    if(check!=0)
      cout<<"No";
    else
      cout<<"Yes";
  }
  return 0;
}


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

int N, M, now;
int ab[8][8] = {};
int visit[8]={};
int answer = 0;




// Judge that we have already visited all node.
bool all_visit(){
	bool ans = true;
	for(int j=0; j<N; j++){
		ans *= (visit[j] == 1);
	}
	return ans;
}


int num_path(int start){
	if(all_visit()){
		answer++;
	}

	for(int i=0; i<N; i++){
		if(visit[i] == 0 && ab[start][i] == 1){
			visit[i] = 1;
			num_path(i);
			visit[i] = 0;
		}
	}
	return 0;
}

int solve(){
	visit[0] = 1;
	num_path(0);
	cout << answer << endl;
	return 0;
}

int main(){
	int a,b;
	cin >> N >> M;
	for(int i=0; i<M;i++){
		cin >> a >> b;
		ab[a-1][b-1] = 1;
		ab[b-1][a-1] = 1;
	}
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<stack>
#include<vector>
#include<list>
using namespace std;

struct Point{
  int x;
  int y;
};
int main(){
  int n,m;
  int minv = 0,res;
  Point student[50],check_point[50];

  cin >> n >> m;
  for (int i=0;i<n;i++) cin >> student[i].x >> student[i].y;
  for(int i = 0;i<m;i++) cin >> check_point[i].x >>check_point[i].y;

  for(int i=0;i<n;i++){
    minv = 200000000;
    res = 0;
    for(int j=0;j<m;j++){
      if(minv>abs(student[i].x-check_point[j].x)+abs(student[i].y-check_point[j].y)){
        minv = abs(student[i].x-check_point[j].x)+abs(student[i].y-check_point[j].y);
        res = j;
      }
    }
    cout << res+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  public static void main(String[]args){
    Scanner scanner = new Scanner(System.in);

    int a = scanner.nextInt();
    int b = scanner.nextInt();

    int calc_result = (a*b)%2;
  
    if(calc_result != 1){
      System.out.println("Even");
    }else{
      System.out.println("Odd");
    }
  }
}

Measured memory_bytes: 21712
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}


int main(){
	string S;
	cin >> S;
	string T = "AKIHABARA";

	for(int i = 0; i < T.size();){
		if(i >= S.size()) break;

		if(S[i] != T[i] && T[i] == 'A') T.erase(i, 1);
		else i++;
	}
	
	int i = T.size() - 1;
	while(i >= S.size()){
		if(T[i] == 'A') T.pop_back();
		i--;
	}
	
	Cout(YES(S == T));
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int INF=1e9;
const ll MOD=1e9+7;

ll gcd(ll x,ll y){
    if(y==0) return 0;
    return gcd(y,x%y);
}

int dis2(int x1,int y1,int x2,int y2){
    return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}

int main(){
    int n;cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    int o=1,al=1;
    for(int i=0;i<n;i++){
        al*=3;
        if(a[i]%2==0) o*=2;
    }
    cout<<al-o<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, gcd, lcm 
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string
#include <vector> // vector
#include <queue> // queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <cstdint> // int64_t, int_fast64_t

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

typedef std::int_fast64_t ll; // at least int64 > 9*10^18
typedef std::uint_fast64_t ull; // at least uint64

#define all(v) v.begin(),v.end()

#define int ll

signed main() {
  int h,w;
  std::cin >> h >> w;
  std::vector<std::string> grid(h);
  rep(i,h) std::cin >> grid[i];
  std::vector<std::vector<int> > horizontal(h,std::vector<int>());
  std::vector<std::vector<int> > vertical(w,std::vector<int>());
  rep(i,h) {
    horizontal[i].emplace_back(-1);
    horizontal[i].emplace_back(w);
  }
  rep(i,w) {
    vertical[i].emplace_back(-1);
    vertical[i].emplace_back(h);
  }
  std::vector<std::pair<int,int> > white;
  rep(i,h) rep(j,w) {
    if(grid[i][j]=='#') {
      horizontal[i].emplace_back(j);
      vertical[j].emplace_back(i);
    }
    else white.emplace_back(i,j);
  }
  rep(i,h) std::sort(all(horizontal[i]));
  rep(i,w) std::sort(all(vertical[i]));
  auto nhorizontal = horizontal;
  auto nvertical = vertical;
  rep(i,h) std::reverse(all(horizontal[i]));
  rep(i,w) std::reverse(all(vertical[i]));
  
  int max = 0;
  for(auto w:white) {
    int i = w.first;
    int j = w.second;
    int r = *std::upper_bound(all(nhorizontal[i]),j);
    int l = *std::upper_bound(all(horizontal[i]),j,std::greater<int>());
    int d = *std::upper_bound(all(nvertical[j]),i);
    int u = *std::upper_bound(all(vertical[j]),i,std::greater<int>());
    max = std::max(max,r-l+d-u-3);
  }
  std::cout << max << ENDL;
  return 0;
}

Measured memory_bytes: 134004
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

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

    ll ans=1;
    ll idx=1;
    char ch=s[0];
    while(idx<n){
        if(s[idx]!=ch){
            ch=s[idx];
            ans++;
        }
        idx++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<cstdio>
#include<algorithm>
#include<memory.h>
#define N 105
using namespace std;
int w, h;
char g[N][N];
bool vis[N][N];
int mov[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};

void dfs(int x, int y, char flag)
{
    vis[x][y] = true;
    for(int i = 0; i < 4; i++) {
        int nx = x + mov[i][0];
        int ny = y + mov[i][1];
        if(nx < 0 || nx >= h || ny < 0 || ny >= w || g[nx][ny] != flag || vis[nx][ny]) continue;
        dfs(nx, ny, flag);
    }
}

void solve()
{
    int cnt = 0;
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            if(!vis[i][j]) {dfs(i, j, g[i][j]); cnt++;}
        }
    }
    printf("%d\n", cnt);
}

int main()
{
    while(~scanf("%d %d", &h, &w)) {
        getchar();
        if(h == 0 && w == 0) break;
        memset(vis, false, sizeof(vis));
        for(int i = 0; i < h; i++) {
            for(int j = 0; j < w; j++) {
                scanf("%c", &g[i][j]);
            }
            getchar();
        }
        solve();
    }

    return 0;
}



Measured memory_bytes: 3052
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[210][210];

ll mygcd(ll a,ll b){
    return a?mygcd(b%a,a):b;
}

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

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

    cin>>n;

    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            A[i][j] = mygcd(i,j);
        }
    }

    int res = 0;

    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cur = A[i][j];

            for(int t=1;t<=n;t++){
                res+=A[cur][t];
            }
        }

    }

    cout<<res<<"\n";

    return 0;
}


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

struct Student {
    int id;
    int time;
};
// 比較関数を定義
bool asc( const Student& left, const Student& right ) {
    return left.time < right.time;
}
int main() {
    int n;
    cin >> n;
    vector<Student> st;
    rep (i, n) {
        int t;
        cin >> t;
        st.push_back({i + 1, t});
    }
    std::sort(st.begin(), st.end(), asc);
    rep(i, n) {
        cout << st[i].id;
        if (i < n - 1) {
            cout << " ";
        } 
    }
    cout << "\n";


}

Measured memory_bytes: 1780
from collections import Counter

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

CA = Counter(A)
ans = 0
for key, val in CA.items():
    temp = 0
    kouho = [key - 1, key, key + 1]
    for num in kouho:
        if num in CA:
            temp += CA[num]
    ans = max(ans, temp)
print(ans)


Measured memory_bytes: 14564
// Problem : A - Duplex Printing
// Contest : AtCoder Beginner Contest 157
// URL : https://atcoder.jp/contests/abc157/tasks/abc157_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

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

#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);
#define endl "\n"
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;

int32_t main()
{
	IOS;
	int n;
	cin >> n;
	n++;
	cout << n/2 << endl;
	return 0;
}


Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

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

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()

	cnt := 0
	for i := 1; i <= N; i++ {
		if i%3 == 0 {
			continue
		} else if i%5 == 0 {
			continue
		}
		cnt += i
	}
	out(cnt)
}


Measured memory_bytes: 1756
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int n;
int x[100000];
int main(){
    cin >> n;

    int mx;
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
        if (mx < x[i]) mx = x[i];
    }

    sort(x, x + n);
    int ans1 = x[n - 1];
    double mid = ans1 / 2.;
    double mnd = ans1;
    int ans2 = -1;
    for (int i = 0; i < n - 1; ++i) {
        if (abs(x[i] - mid) < mnd) {
            mnd = abs(x[i] - mid);
            ans2 = x[i];
        }
    }

    cout << ans1 << " " << ans2 << endl;
}

Measured memory_bytes: 1272
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"

using namespace std;

typedef long int li;
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pt;

#define fi first
#define se second
#define dump(x) cout << #x << " = " << x << endl
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

ll n, a[100007], b[100007], res;

int main () {
    fastIO;
    cin >> n;
    for(li i = 0; i <= n; i ++) cin >> a[i];
    for(li i = 0; i < n; i ++) cin >> b[i];
    for(li i = 0; i < n; i ++) {
        res+=min(b[i], a[i]+a[i+1]);
        b[i]-=a[i];
        if(b[i]>0) a[i+1]=max(ll(0), a[i+1]-b[i]);
    }
    cout << res;
}


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

int a[102];

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

Measured memory_bytes: 3820
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int n=s.size()-7;
	for(int i=0;i<s.size()-n+1;i++){
		string s2=s.substr(0,i)+s.substr(i+n);
		if(s2=="keyence"){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
/*ex4_3
series2*/

# include <stdio.h>
int getHeight(int east,int west);
int main(void){
    //各文字の箱を作って読み取り
    int east,west;
    scanf("%d %d", &east,&west);
    //diffは西側の塔の図っている部分の西からの位置を示す
    int height=getHeight(east,west);

    printf("%d\n",height);
    return 0;
}

int getHeight(int east,int west){
   //diffは西側の塔の図っている部分の西からの位置を示す
    int diff=west-east-1;
    //西側の本来の塔の高さは1からdiffを足したもの
    int west_height = diff*(diff+1)/2;
    return west_height-east;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
string a;
int main(){
  cin>>a;
  if(a=="SUN")cout<<7<<endl;
  if(a=="SAT")cout<<1<<endl;
  if(a=="FRI")cout<<2<<endl;
  if(a=="THU")cout<<3<<endl;
  if(a=="WED")cout<<4<<endl;
  if(a=="TUE")cout<<5<<endl;
  if(a=="MON")cout<<6<<endl;
}

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

using namespace std;

/**/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define wt(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define wt(x...)
#endif
/**/

#define LL long long
const int MAXN = 212345;
const int INF  = 0x3f3f3f3f;

int main () {

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

	string s, t;
	cin >> s >> t;

	string ss = s + s;

	map < char, vector <int> > mp;
	
	for (int i = 0; i < int(ss.size()); ++i) 	
		mp[ss[i]].emplace_back(i);

	int rt = 0, idx = -1; LL ans = 0;

	for (int i = 0; i < int(t.size()); ++i) {
		
		auto it = mp.find (t[i]);
		
		if (it == mp.end()) {
			cout << -1 << '\n';
			return 0;
		}

		auto nx = upper_bound (it->second.begin(), it->second.end(), idx);
		ans = rt * (s.size()) + *nx + 1;
		idx = *nx;

		if (*nx >= int(s.size())) {
			++rt;
			idx -= int(s.size());
		}
		

	}

	cout << ans << '\n';


	return 0;
}



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

int main(){
  int n, i;
  cin >> n;
  int a[2][n];
  for(i = 0; i < n; i++) cin >> a[0][i] >> a[1][i];
  int sum = 0;
  for(i = 0; i < n; i++) sum += a[1][i] - a[0][i] + 1;
  cout << sum << endl;
  return 0;
}


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

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

  vector<int> v(201, 0);
  for (int i = 1; i <= n; i = i+2) {
    for (int j = 1; j <= i; j++) {
      // 奇数 i について 1〜i までの数字で剰余を求める
      // 割り切れたら約数なのでインクリメント
      if (i % j == 0) {
        v.at(i)++;
      }
    }
  }

  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (v.at(i) == 8) { ans++; }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
using System;
using System.Linq;

namespace B.Ringo_s_Favorite_Numbers
{
    class Program
    {
        static void Main(string[] args)
        {
            var DN = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int D = DN[0];
            int N = DN[1] == 100 ? 101 : DN[1];

            Console.WriteLine(Math.Pow(100, D) * N);
        }
    }
}


Measured memory_bytes: 13396
def addzero(n):
	result = str(n)
	if n < 10: result = '0' + result
	return result

def fixtime(second):
	s = second
	T = s/3600
	s = s%3600
	M = s/60
	S = s%60
	return addzero(T)+':'+addzero(M)+':'+addzero(S)
	
while True:
	T, M, S = map(int, raw_input().split())
	if T == -1: break
	leftsecond = 7200 - T*3600 - M*60 - S
	times3 = leftsecond * 3
	print fixtime(leftsecond)
	print fixtime(times3)


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

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

    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] == 'U' || s[i] == 'D')
            continue;
        
        if (i % 2 == 0)
        {
            if (s[i] == 'R')
            {
                continue;
            }
            cout << "No" << endl;
            return 0;
        }
        else
        {
            if (s[i] == 'L')
            {
                continue;
            }
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;

}


Measured memory_bytes: 256
n, m = map(int, input().split())
h = list(map(int, input().split()))
g = [[] for _ in range(n+1)]
for i in range(m):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)

cnt = 0
for i in range(1, n+1):
    for j in g[i]:
        if h[j-1] >= h[i-1]:
            break
    else:
        cnt += 1

print(cnt)

Measured memory_bytes: 29336
from collections import Counter
S=input()
N=len(S)
if N%3==0:
    n=N//3
else:
    n=N//3+1
S_n=Counter(S)

if len(S)==1:
    print('YES')
elif len(S)==2:
    if len(S_n)==1:
        print('NO')
    else:
        print('YES')
else:
    if len(S_n)<=2:
        print('NO')
    else:
        if S_n['a']<=n and S_n['b']<=n and S_n['c']<=n:
            print('YES')
        else:
            print('NO')
            

Measured memory_bytes: 73620
#include <cstdio>
const int N=100005;
int a[N];
int main (){
    int n,L;scanf ("%d%d",&n,&L);
    for (int i=1;i<=n;i++) scanf ("%d",&a[i]);
    for (int i=1;i<n;i++){
        if (a[i]+a[i+1]>=L) {
            puts("Possible");
            for (int j=1;j<i;j++)  printf ("%d\n",j);
            for (int j=n-1;j>i;j--) printf ("%d\n",j);
            printf ("%d",i);
            return 0;
        }
    }
    puts("Impossible");
    return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<string>
#include<cstdio>
#include<cctype>


int main(){
    std::string str;
    int i;
    int sum[26]={0};
    char str2;
    
    str2='a';
    
    while(std::getline(std::cin,str)){
        for(i=0;i<str.size();i++){
           if ((str[i]>='a'&&str[i]<='z')){
                int num =str[i]-'a';
                sum[num]+=1;
            }else if((str[i]>='A'&&str[i]<='Z')){
                int num =str[i]-'A';
                sum[num]+=1;
            }
        }
    }
    

    for(i=0;i<26;i++){
    printf("%c : %d\n",str2,sum[i]);
    str2+=1;
    }

    return 0;
}



Measured memory_bytes: 3248
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF (1LL<<60)
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
#define MSB(x) (63-__builtin_clzll(x))
#define pcnt(x) (__builtin_popcountll(x))
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  cin >> n;

  int sum = 0, ans = -1;
  REP(i,n){
    int x,y;
    cin >> x >> y;
    ans += y;
    sum += x*y;
  }

  while(sum > 9){
    ans += sum / 10;
    sum = sum - (sum / 10)*9; 
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
n = int(input())
p = list(map(int, input().split()))
p_new = sorted(p)
ans = 'NO'
for i in range(n):
    for j in range(i, n):
        tmp = p.copy()
        tmp[i], tmp[j] = tmp[j], tmp[i]
        if tmp == p_new:
            ans = 'YES'
            break
print(ans)            

Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            int cnt[] = new int[200001];
            Arrays.fill(cnt, 0);
            for (int i = 0; i < n; i++) {
                int a = sc.nextInt();
                cnt[a]++;
            }
            List<Integer> cntList = new ArrayList<>();
            for (int i = 0; i < 200001; i++) {
                if ( cnt[i] > 0 ) {
                    cntList.add(cnt[i]);
                }
            }
            Collections.sort(cntList);

            int ans = 0;
            for (int i = 0; i < cntList.size() - k; i++) {
                ans += cntList.get(i);
            }
            System.out.println(ans);
        }
    }
}


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

int main() {
int bingo[3][3];

for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
        cin >> bingo[i][j];
    }
}
int n;
cin >> n;
int b[n];
for(int i=0;i<n;i++){
    cin >> b[i];
}
bool flag[3][3];
for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
        flag[i][j]=false;
    }
}
for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
        for(int k=0;k<3;k++){
            if(b[i]==bingo[j][k])flag[j][k]=true;
        }
    }
}
if((flag[0][0]&&flag[0][1]&&flag[0][2])||(flag[1][0]&&flag[1][1]&&flag[1][2])||(flag[2][0]&&flag[2][1]&&flag[2][2])||(flag[0][0]&&flag[1][0]&&flag[2][0])||(flag[0][1]&&flag[1][1]&&flag[2][1])||(flag[0][2]&&flag[1][2]&&flag[2][2])||(flag[0][0]&&flag[1][1]&&flag[2][2])||(flag[2][0]&&flag[1][1]&&flag[0][2])){
    cout << "Yes";
}
else cout << "No";
}


Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ff first 
#define ss second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cerr << "\n\n" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define testcase(t) int t;cin>>t;while(t--)
#define mp(x,y) make_pair(x,y)
#define in(x) insert(x)
#define rep(i,a,b)  for (__typeof((b)) i=(a);i<=(b);i++)
#define nrep(i,a,b)  for (__typeof((b)) i=(b);i>=(a);i--)
#define PI 3.14159265358979323846
#define SP(x) setprecision(x)
#define reflex ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define M 1000000007
#define sz(a) (int)a.size()
#define endl "\n"
#define all(v) v.begin(), v.end()
#define UNIQUE(x) x.resize(distance(x.begin(), unique(all(x))))
#define mem(arr,val) memset(arr,val,sizeof(arr)) //For "0" and "-1"                  
#define inp0(a,n) rep(i,0,n-1) cin>>a[i];
#define inp1(a,n) rep(i,1,n) cin>>a[i]; 
#define prll(x) printf("%lld",x)
#define nth_ele(v,n) nth_element(v.begin(), v.begin()+n ,v.end())//O(N)
#define DEBUG(x) cerr << (#x) << ": " << (x) << endl
#define DEBUGV(x) for(auto IT:x) cout<<IT<<" "; cout<<endl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll gcd(ll n1, ll n2){if(n2!=0) return gcd(n2, n1%n2);else return n1;}
ll powerM(ll a,ll b){if(b==0) return 1;  if(b==1) return a%M; ll x=powerM(a,b/2)%M; if(b&1){return ((((a%M)*(x%M))%M)*(x%M))%M;}return ((x%M)*(x%M))%M;}
ll power(ll a,ll b){if(b==0) return 1;  if(b==1) return a; ll x=power(a,b/2); if(b&1){return ((((a)*(x)))*(x));}return ((x)*(x));}
 
const ll INF=1e18; 
const int SIZE = 200005;

int main(){
	reflex;
	ll n,W;
	cin>>n>>W;
	ll wt[n+1], val[n+1];
	rep(i,0,n-1){
		cin>>wt[i]>>val[i];
	}
	ll dp[100001];
	rep(j,0,100000) dp[j]=INF;
	dp[0]=0;
	rep(i,0,n-1){
		nrep(j,1,100000){
			if(j>=val[i])
				dp[j]=min(dp[j], wt[i]+dp[j-val[i]]);
		}
	}
	ll ans=0;
	nrep(i,1,100000){
		if(dp[i]<=W) {
			cout<<i<<endl;
			return 0;
		}
	}
}

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

#define ALICE 0
#define BOB 1
#define CHARLIE 2

int main(void) {
    string input;
    vector<string> decks(3);
    int indexes[3] = { 0, 0, 0 };

    for (int i = 0; i < 3; i++) {
        getline(cin, input);
        decks[i] = input;
    }

    int next_player = ALICE;
    while (true) {
        if (decks[next_player].empty() || indexes[next_player] >= decks[next_player].size()) {
            if (next_player == 0) cout << "A" << endl;
            else if (next_player == 1) cout << "B" << endl;
            else if (next_player == 2) cout << "C" << endl;
            break;
        }

        char n = decks[next_player][indexes[next_player]];
        indexes[next_player]++;

        if (n == 'a') {
            next_player = ALICE;
        } else if (n == 'b') {
            next_player = BOB;
        } else if (n == 'c') {
            next_player = CHARLIE;
        }
    }

    return 0;
}


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

// #undef DEBUG
// #define DEBUG
/// {{{ DEBUG --- ///
#ifdef DEBUG
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { o << "{"; for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? ", " : ""); o << "}"; return o; }
#ifdef USE_COUT
#define dump(...) [&](){auto __debug_tap=make_tuple(__VA_ARGS__);cout<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<__debug_tap<<"\n";}()
#else
#define dump(...) [&](){auto __debug_tap=make_tuple(__VA_ARGS__);cerr<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<__debug_tap<<"\n";}()
#endif
template<class T> inline void dump2D(T &d, size_t sizey, size_t sizex) { ostream&o=
#ifdef USE_COUT
  cout;
#else
  cerr;
#endif
  for(size_t i = 0; i < sizey; i++) { for(size_t j = 0; j < sizex; j++) o << d[i][j] << " "; o << endl; }
}
#else
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? " " : ""); return o; }
#define dump(...) (42)
#define dump2D(...) (42)
#endif
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":", ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream &o, tuple<T...> const &t){ o << "("; _ot<0>(o, t); o << ")"; return o; }
template<class T, class U> ostream & operator<<(ostream &o, pair<T, U> const &p) { o << "(" << p.first << ", " << p.second << ")"; return o; }
/// }}}--- ///

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  ll n;
  cin >> n;
  if(n==0){
    cout << 0 << endl;
    return 0;
  }
  string ans;
  for(int i = 0; i <= 32; i++) {
    ll b = 1ll << i;
    if(i % 2 == 1) b *= -1;
    ll k = n - b;
    dump(i, n, b, k);
    if((abs(n) >> i) & 1) n = k, ans = '1' + ans; else ans = '0' + ans;
  }
  while(ans[0] == '0') ans = ans.substr(1, 1000);
  cout << ans << endl;
  return 0;
}


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

int main()
{
    int a,b;
    cin >> a >> b;
    if(a*b == 15){
        cout << "*" << endl;
    }else if(a+b == 15){
        cout << "+" << endl;
    }else{
        cout << "x" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
#define INT_MAX 2147483647
#define _LIBCPP_DEBUG 0
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (n); ++i)	
using namespace std;



int max(int a,int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


int main() {
	int n;
	cin >> n;
	int t = 0;
	int s = 0;
	bool a = false;

	rep(i, n + 1) {
		t = i;
		s = 0;
		rep(i, 9) {
			s += t % 10;
			t /= 10;
		}
	}
	if ((n % s) == 0) {
		a = true;
	}
	if (a) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
x = input()
y = input()

list = y.split()

list_i = [int(s) for s in list]

Min = min(list_i)
Max = max(list_i)
Sum = sum(list_i)

mi = str(Min)
ma = str(Max)
su = str(Sum)
sp = " "

ans = mi + sp + ma + sp + su
print(ans)


Measured memory_bytes: 6768
#include <iostream>

using namespace std;

int main(){
  int k, s;
  long ans = 0;

  cin >> k >> s ;

  for (int x = 0; x < k + 1; x++){
    for (int y = 0; y < k + 1; y++){
      if(0 <= s-x-y && s-x-y <= k){
        ans++;
      }
    }
  }

  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            int H = in.nextInt();
            int N = in.nextInt();

            int dp[][] = new int[N+1][H+1];
            for (int i = 0; i < N; i++) {
                for (int w = 0; w <= H; w++) {
                    dp[i][w] = 1000000000;
                }
            }
            for (int i = 0; i <= N; i++) {
                dp[i][0] = 0;
            }

            List<Integer> damageList = new ArrayList<>();
            List<Integer> mpList = new ArrayList<>();

            for (int i = 0; i < N; i++) {
                damageList.add(in.nextInt());
                mpList.add(in.nextInt());
            }

            for (int i = 0; i < N; i++) {
                for (int j = 0; j <= H; j++) {
                    if (j < damageList.get(i)) {
                        dp[i + 1][j] = Math.min(dp[i][j], mpList.get(i));
                    }
                    else {
                        dp[i + 1][j] = Math.min(dp[i][j], dp[i + 1][j - damageList.get(i)] + mpList.get(i));
                    }
                }
            }
            out.println(dp[N][H]);
        }
    }
}

Measured memory_bytes: 83336
n,q = map(int, input().split())
import bisect
str = list(input())
index = []
for i in range(n-1):
    if str[i] == "A" and str[i+1] == "C":
        index.append(i)
index.sort()
li = []
counter = 0
for i in range(q):
    s,t = map(int, input().split())
    head = bisect.bisect_left(index, s-1)
    tail = bisect.bisect_left(index, t-1)
    print(tail - head)

Measured memory_bytes: 6472
N = int(input())
a = map(int, input().split(" "))

l = list(reversed(sorted(a)))

alice = 0
bob = 0
for i in range(0, len(l)):
	if i % 2 == 0:
		alice += l[i]
	else:
		bob += l[i]

print(alice-bob)


Measured memory_bytes: 3060
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sca = new Scanner(System.in);
		int m1 = sca.nextInt();
		int d1 = sca.nextInt();
		int m2 = sca.nextInt();
		int d2 = sca.nextInt();
		if(m1 != m2) {
			System.out.println(1);
		}
		else {
			System.out.println(0);
		}
	}
}


Measured memory_bytes: 21844
#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;
int main()
{
    int H, A;
    cin >> H >> A;
    int num = 0;
    for (; 0 < H;){
        num++;
        H -= A;
    }
    cout << num << endl;
}

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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var line = Console.ReadLine().Split(' ').Select(value => int.Parse(value.ToString())).ToList();
			var n = line[0];
			var m = line[1];

			int nTotal = n >= 2 ? (n * (n - 1)) / 2 : 0;
			int mTotal = m >= 2 ? (m * (m - 1)) / 2 : 0;
			
			Console.WriteLine(nTotal + mTotal);
		}
	}
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

long long modpower(long long radix, long long x) {
    // 高速階乗計算 radix^x
    long long ans = 1;
    while (0 < x) {
        if (x & 1) {
            ans = ans * radix;
        }
        radix = radix * radix;
        x >>= 1;
    }
    return ans == 0 ? 1 : ans;
}

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

    ll N, K;
    cin >> N >> K;

    ll ans = K;
    ll a   = modpower(K - 1, N - 1);
    ans *= a;

    std::cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] NK = Console.ReadLine().Split(' ');
            string[] strPs = Console.ReadLine().Split(' ');
            int N = int.Parse(NK[0]);
            int K = int.Parse(NK[1]);
            int[] ps = new int[N];
            for(int i = 0; i < N; i++) ps[i] = int.Parse(strPs[i]);

            Array.Sort(ps);

            int ans = 0;
            for(int i = 0; i < K; i++) ans += ps[i];

            Console.WriteLine(ans);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 27636
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
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;}
const ll INF = 1LL<<60;
//const int dy[4] = {0, 1, 0, -1};
//const int dx[4] = {1, 0, -1, 0};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};

void solve(){
    double n, k; cin >> n >> k;
    double res = 0;
    for(int i=1; i<=n; i++){
        double base = 1/n;
        double eye = i;
        while(eye<k){
            base *= 0.5;
            eye *= 2;
        }
        res += base;
    }
    printf("%.11f\n", res);
}

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

Measured memory_bytes: 3736
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		while(true){

			int studentNum = Integer.parseInt(br.readLine());
			if(studentNum == 0){
				break;
			}

			String[] score = br.readLine().split(" ");

			double scoreSum = 0;

			for(int i = 0; i < studentNum;i++){

				scoreSum += Double.parseDouble(score[i]);
			}

			double scoreAverage = scoreSum / studentNum;

			double sigmaSum = 0;

			for (int i = 0;i < studentNum;i++){
				double num = Double.parseDouble(score[i]) - scoreAverage;
				sigmaSum += num * num;
			}

			double sigmaResult = sigmaSum / studentNum;

			double alpha = Math.sqrt(sigmaResult);

			System.out.printf("%.8f\n", alpha);
		}
		br.close();
	}
}

Measured memory_bytes: 26816
#define DINGER_GISBAR
#include <bits/stdc++.h>
using namespace std;
const long long MOD = static_cast<int>(1e9) + 7;
//{{{TEMPLATE_BEGIN
#include <unistd.h>
using namespace std::rel_ops;
#ifdef ZEROKUGI
#include <dumper.hpp>
#define dump(x) dumper::dumper(cerr, __LINE__, (#x), (x), 50, 1, 1)
#define tick(...) dumper::tick(__VA_ARGS__)
#pragma message "Compiling " __FILE__
#else
#define dump(x)
#define tick(...)
#endif
typedef long long lint;
typedef unsigned long long ulint;
typedef long double ldouble;
typedef vector<int> vint;
#define rep(i, n) \
    for (int i = 0, i##_len = static_cast<int>(n); i < i##_len; i++)
#define all(c) begin(c), end(c)
#define perm(c)   \
    sort(all(c)); \
    for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))
#define uniquenize(v) (v).erase(unique(all(v)), end(v))
#define cauto const auto &
#define memset(x, y) memset(x, y, sizeof(x))
#define popcount __builtin_popcount
#define gcd __gcd
inline lint bit(int x) { return 1LL << x; }
template <class T>
inline int size(const T& a) {
    return (int)a.size();
}
template <class T>
inline bool chmin(T& a, const T& b) {
    return a > b ? a = b, 1 : 0;
}
template <class T>
inline int clamp(T v, T lo, T hi) {
    return (v > hi) - (v < lo);
}
template <class T>
inline bool chmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0;
}
template <class T>
inline pair<vector<T>, char> operator*(const vector<T>& v, const char& c) {
    return make_pair(v, c);
}
template <class T>
inline istream& operator>>(istream& is, vector<T>& v) {
#ifdef ZEROKUGI
    if (v.empty()) {
        cerr << "Error L" << __LINE__ << ": vector size is zero." << endl;
        exit(EXIT_FAILURE);
    }
#endif
    for (auto& x : v) is >> x;
    return is;
}
template <class T>
inline ostream& operator<<(ostream& os, const pair<vector<T>, char>& v) {
    bool t = 0;
    for (const T& x : v.first) {
        if (t) os << v.second;
        os << x;
        t = 1;
    }
    return os;
}
template <class T>
inline ostream& operator<<(ostream& os, vector<T>& v) {
    return os << v * ' ';
}
struct before_main {
    before_main() {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
        tick(0, 0);
    };
} __before_main;
//}}}TEMPLATE_END

int main() {
    int n;
    cin >> n;
    vector<int> v(3*n);
    cin >> v;
    sort(all(v), greater<int>());
    lint ans = 0;
    rep(i, n) ans += v[i*2 + 1];
    cout << ans << endl;
}



Measured memory_bytes: 1408