akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int n;
    double a;
    double ans = 0;
    int i;

    cin >> n;

    for (i = 0; i < n; i++)
    {
        cin >> a;
        ans += 1 / a;
    }

    ans = 1 / ans;

    printf("%.6f\n", ans);
}

Measured memory_bytes: 256
A,B,C,D = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

#Python -3.4
from fractions import gcd
#a=77
#b=121
#print(a,b,gcd(a,b))

#lcm (最小公倍数)
def lcm(a, b):
	return a * b // gcd (a, b)


a=A//C
b=B//C

c=0
for i in range(a,b+1):
	if A<=(i*C)<=B:
		c = b-i+1
		break
c=max(0,c)

#print("C,a,b,c",C,a,b,c)

a=A//D
b=B//D
d=0
for i in range(a,b+1):
	if A<=(i*D)<=B:
		d = b-i+1
		break
d=max(0,d)

#print("D,a,b,d",D,a,b,d)

E=lcm(C,D)

a=A//E
b=B//E
e=0
for i in range(a,b+1):
	if A<=(i*E)<=B:
		e = b-i+1
		break
e=max(0,e)

#print("E,a,b,e",E,a,b,e)

ans= B-A+1-(c + d - e)

print(ans)



Measured memory_bytes: 5104
#include <bits/stdc++.h>
using namespace std;
typedef long long       ll;
typedef pair<int,int>   pii;
typedef vector<int>     vi;
typedef long double     ld;
#define MOD         1000000007
#define pb          push_back
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        '\n'
#define PI          3.14159265359d
#define sz(x)       (int)x.size()
vi start[100005],stop[100005];
int A[100005],L[100005];
int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m,i,j,open=0;
    ll mini,cur=0;
    cin>>n>>m;
    for(i=0;i<n;i++)
        cin>>A[i];
    for(i=1;i<=n-1;i++)
    {
        start[A[i-1]+1].pb(i);
        stop[A[i]].pb(i);
        if(A[i-1]<A[i])
        {
            cur+=A[i]-A[i-1];
            L[i]=A[i]-A[i-1];
        }
        else
        {
            cur+=A[i];
            L[i]=m-A[i-1]+A[i];
            open++;
        }
    }
    mini=cur;
    for(i=2;i<=m;i++)
    {
        for(j=0;j<sz(stop[i-1]);j++)
        {
            open--;
            cur=cur-1+L[stop[i-1][j]];
        }
        cur-=open;
        for(j=0;j<sz(start[i]);j++)
            open++;
        mini=min(mini,cur);
    }
    cout<<mini;
    return 0;
}


Measured memory_bytes: 10368
package main

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

////////////////////////////////////////
///        templates                 ///
////////////////////////////////////////

var sc = bufio.NewScanner(os.Stdin)

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

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readBigLine() string {
        buf := make([]byte, 0, 1000000)
        for {
                l, p, e := rdr.ReadLine()
                if e != nil {
                        panic(e)
                }
                buf = append(buf, l...)
                if !p {
                        break
                }
        }
        return string(buf)
}

func strSprit(str string) []string {
        cols := strings.Split(str, " ")
        return cols
}

func parseInt(str string) int64 {
        n, _ := strconv.ParseInt(str, 10, 64)
        return n
}

func intSprit(str string) []int64 {
        strs := strSprit(str)
        cols := make([]int64, len(strs))
        for i, v := range strs {
                cols[i] = parseInt(v)
        }
        return cols
}

func bitCount(n uint) int {

        x := uint64(n)

        const m = 1<<64 - 1
        const m0 = 0x5555555555555555
        const m1 = 0x3333333333333333
        const m2 = 0x0f0f0f0f0f0f0f0f

        x = x>>1&(m0&m) + x&(m0&m)
        x = x>>2&(m1&m) + x&(m1&m)
        x = (x>>4 + x) & (m2 & m)
        x += x >> 8
        x += x >> 16
        x += x >> 32

        return int(x) & (1<<7 - 1)
}

func bitExist(n, i int) bool {
        return ((n >> uint(i)) & 1) == 1
}

////////////////////////////////////////
///        end templates             ///
////////////////////////////////////////
func chmin(dp [][]int64, idx, dir int, dn int64) {
        if dp[idx][dir] > dn {
                dp[idx][dir] = dn
        }
}

func main() {
        line := nextLine()
        spl := intSprit(line)
        N := spl[0]
        W := spl[1]

        INF := int64(1 << 60)

        maxv := 100100
        dp := make([][]int64, N+10)
        for i := 0; i < int(N)+10; i++ {
                dp[i] = make([]int64, maxv)
                for j := 0; j < maxv; j++ {
                        dp[i][j] = INF
                }
        }

        dp[0][0] = 0

        for i := 0; i < int(N); i++ {
                s := intSprit(nextLine())
                w, v := s[0], s[1]
                hv := int(v)
                for j := 0; j < maxv; j++ {
                        if j-hv >= 0 {
                                chmin(dp, i+1, j, dp[i][j-hv]+int64(w))
                        }
                        chmin(dp, i+1, j, dp[i][j])
                }
        }

        ret := 0
        for i := 0; i < maxv; i++ {
                if dp[N][i] <= W {
                        ret = i
                }
        }
        fmt.Println(ret)

}

Measured memory_bytes: 89728
// Think twice, Code once
// 1SAC
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;


int main(){
	FIO
	
	int n;cin >> n;
	int a[n];
	forn(i, n)cin >> a[i];
	int ma = a[0],mi = a[0],ans = 1;
	for1(i, n - 1){
		if(a[i] < ma && a[i] < mi)ans++;
		ma = max(ma,a[i]);
		mi = min(mi,a[i]);
	}
	cout << ans;
	return 0;
}


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

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

const long long INF = 1LL << 60;

int main(void){
	int a,b,c,x,y;
	cin >> a >> b >> c >> x >>y;
	int X = max(x,y),Y = min(x,y);
	if(2*c >= a+b){
		cout << a*x + b*y << endl;
	}else{
		if(2*c <= a && x > y){cout << 2*c*Y + 2*c*(X-Y) << endl;return 0;}
		if(2*c <= b && y > x){cout << 2*c*Y + 2*c*(X-Y) << endl;return 0;}
		if(x>y)cout << 2*c*Y + a*(X-Y) << endl;
		else cout << 2*c*Y + b*(X-Y) << endl;
	}
	return 0;
}



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

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    string s;
    cin >> s;
    vector<int> dp(s.size() + 1);
    rep(i, s.size())
    {
        char c = s.at(i);
        bool ok = c == 'A' || c == 'T' || c == 'C' || c == 'G';
        dp[i + 1] = (ok ? dp[i] + 1 : 0);
    }
    auto ans = max_element(dp.begin(), dp.end());

    cout << ans[0] << 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<ll> a(n+1);
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    ll ans = a[1] / 2;
    a[1] -= ans * 2;
    for(int i = 2; i <= n; i++)
    {
        if(a[i-1] >= a[i])
        {
            ans += a[i];
            a[i] = 0;
        }
        else
        {
            ans += a[i-1];
            a[i] -= a[i-1];
            ll num = a[i] / 2;
            ans += num;
            a[i] -= num * 2;
        }
    }
  
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

//---------------------------//
//順列を全て列挙できるか
//next_permutationを使うことによって，辞書順で順列を表示
//---------------------------


int main(){
  int n;
  cin >> n;
  vector<int> p(n), q(n);
  REP(i,n) cin >> p[i];
  REP(i,n) cin >> q[i];

  vector<int> a(n);
  REP(i,n) a[i] = i+1;  //1,2,3 - nの配列を作製；

  map<vector<int>,int> mp;  //key: 順列 value：辞書順の番号

  do {
    mp[a] = mp.size();
    // REP(i,n) cout << a[i] << " " ;
    // cout << mp.size() << endl;
    // cout << endl;

  } while(next_permutation(ALL(a)));

  int ans = abs(mp[p] - mp[q]);
  cout << ans << endl;
  return 0;

}

Measured memory_bytes: 8672
import bisect

N = int(input())
L = list(map(int, input().split()))

L.sort()

ans = 0

for i in range(N-2):
    for j in range(i+1, N-1):
        ans += bisect.bisect_left(L, L[i] + L[j]) - j - 1

print(ans)


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

namespace AtCoder
{
    class ABC
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int a = int.Parse(S[0].ToString());
            int b = int.Parse(S[1].ToString());
            int c = int.Parse(S[2].ToString());
            int d = int.Parse(S[3].ToString());

            if (a + b + c + d == 7) Console.WriteLine(a + "+" + b + "+" + c + "+" + d + "=7");
            else if (a - b + c + d == 7) Console.WriteLine(a + "-" + b + "+" + c + "+" + d + "=7");
            else if (a + b - c + d == 7) Console.WriteLine(a + "+" + b + "-" + c + "+" + d + "=7");
            else if (a + b + c - d == 7) Console.WriteLine(a + "+" + b + "+" + c + "-" + d + "=7");
            else if (a - b - c + d == 7) Console.WriteLine(a + "-" + b + "-" + c + "+" + d + "=7");
            else if (a - b + c - d == 7) Console.WriteLine(a + "-" + b + "+" + c + "-" + d + "=7");
            else if (a + b - c - d == 7) Console.WriteLine(a + "+" + b + "-" + c + "-" + d + "=7");
            else if (a - b - c - d == 7) Console.WriteLine(a + "-" + b + "-" + c + "-" + d + "=7");

                                                         
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11092
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

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

	while(n--)
	{
		int out = 0;
		vint v(4, 0);

		while(out != 3)
		{
			string ev;
			cin >> ev;

			if(ev == "OUT") out++;
			else if(ev == "HIT")
			{
				rep(i, 3)
				{
					v[3 - i] += v[2 - i];
					v[2 - i] = i == 2;
				}
			}
			else
			{
				v[3] += accumulate(v.begin(), v.begin() + 3, 1);
				fill(v.begin(), v.begin() + 3, 0);
			}
		}

		cout << v[3] << endl;
	}
}

Measured memory_bytes: 0
import java.util.*;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner scan = new Scanner(System.in);
		
      	int N = scan.nextInt();
      	int H[] = new int[N];
      
      	for(int i = 0; i < N; i++){
        	H[i] = scan.nextInt();  
        }
      	
     // Arrays.sort(H);
      
      int cnt = 0;
      List<Integer> cntList = new ArrayList<Integer>();
      for(int i = 0; i < N; i++){
      	for(int j = i+1; j < N; j++){
      	
          	if(H[i] >= H[j]){
             	cnt++;
              	break;
            } else {
              	cnt = 0;
             	break; 
            }
	      }	
     	cntList.add(cnt);
      }
      
     Collections.sort(cntList, Collections.reverseOrder());

      if(cntList.isEmpty()){
      	System.out.println(0);
        return;
        
      }
      System.out.println(cntList.get(0));
       	
    }
}


Measured memory_bytes: 53504
import itertools
from typing import List, Tuple


def main():
    d, g = map(int, input().split())
    v = []
    for _ in range(d):
        p, c = map(int, input().split())
        v.append((p, c))

    print(ag(v, g))


def ag(v: List[Tuple[int, int]], g: int) -> int:
    # ex. [(3, 500), (5, 800)] -> [(1, 3, 500), (2, 5, 800)]
    v = [(i + 1, v[i][0], v[i][1]) for i in range(len(v))]

    result = 100 ** 10

    for j in range(len(v) + 1):
        for cb in itertools.combinations(v, j):
            sc = 0
            cnt = 0
            # calc bonus score
            for (i, p, c) in cb:
                sc += i * 100 * p + c
                cnt += p

            for idx in reversed(range(len(v))):
                if sc >= g:
                    break
                if v[idx] in cb:
                    continue
                i, p, _ = v[idx]
                for _ in range(p - 1):
                    if sc >= g:
                        break
                    sc += i * 100
                    cnt += 1

            if sc >= g:
                result = min(result, cnt)
    return result


if __name__ == '__main__':
    main()


Measured memory_bytes: 10212
#include<bits/stdc++.h>
using namespace std;
typedef		long long       ll;
typedef		vector<ll>      vll;
#define		pb              push_back
string intostr(int x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    return str;
}

char Uplowch(char ch)
{
    if(ch >= 'A' &&  ch <= 'Z')
        ch += 32;
    return ch;
}
char Lowupch(char ch)
{
    if(ch >= 'a' &&  ch <= 'z')
        ch -= 32;
    return ch;
}
bool Isalpha(char ch)
{
    if((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'))
        return true;
    return false;
}
int Strtoint(string str)
{
    stringstream ss(str);
    int x = 0;
    ss >> x ;
    return x ;
}
string Intostr(int x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    return str;
}

#define		PB              pop_back
#define		nn              "\n"
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define		ss              ' '
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
#define		pi              acos(-1.0)

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

int dx[] = {0, 0, -1, 1} ;    // right , left , forward , backward
int dy[] = {1, -1, 0, 0} ;

//bool check(int x , int y) {
//    if(x <= n && y <= m && x >= 1 && y >= 1)
//        return 1 ;
//    return 0 ;
//}

int main()
{
    //freopen("in.txt","r",stdin);

//    ios::sync_with_stdio(0);
//    cin.tie(0);

    ll n;
    cin>>n;


    for(ll i=0; i<=5000; i++)
    {
        for(ll j=0; j>=-5000; j--)
        {
            if(i*i*i*i*i-j*j*j*j*j>n)
                break;
            if(i*i*i*i*i-j*j*j*j*j==n)
            {
                cout<<i<<ss<<j<<nn;
                return 0;
            }
        }

        for(ll j=0; j<=5000; j++)
        {
            if(i*i*i*i*i-j*j*j*j*j<n)
                break;
            if(i*i*i*i*i-j*j*j*j*j==n)
            {
                cout<<i<<ss<<j<<nn;
                return 0;
            }
        }
    }





}



Measured memory_bytes: 3632
N, M = map(int,input().split())
H = list(map(int,input().split()))
s = [[] for _ in range(N)]

for i in range(M):
  a, b = map(int,input().split())
  s[a-1].append(b-1)
  s[b-1].append(a-1)

ans = 0
for i in range(N):
  f = True
  for j in range(len(s[i])):
    if H[i] <= H[s[i][j]]:
      f = False
    
  if f:
    ans += 1
    
print(ans)


Measured memory_bytes: 29504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> p(n), q(n);
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];
    vector<ll> np(n);
    rep(i, n) np[i] = i + 1;
    ll a = 0, b = 0, cnt = 0;
    do {
        bool flag = true;
        rep(i, n) {
            if (p[i] != np[i]) {
                flag = false;
                break;
            }
        }
        if (flag) a = cnt;
        flag = true;
        rep(i, n) {
            if (q[i] != np[i]) {
                flag = false;
                break;
            }
        }
        if (flag) b = cnt;
        cnt++;
    }
    while(next_permutation(all(np)));
    cout << abs(a - b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define debug(x) cout << #x << " = " << x << endl
#define print(x) cout << x << endl;
const ll MOD = 1000000007;

int main()
{
    int a;
    cin >> a;
    cout << a + pow(a, 2) + pow(a, 3) << endl;
}


Measured memory_bytes: 4188
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
const int maxn=2e6+20;
const ll MOD=1e9+7;
char s[maxn],t[maxn];
int fail[maxn],suf[maxn]; 
void getfail(int *fail,char *s){
	fail[0]=-1;
	int i=0,j=-1;
	while(s[i]){
		if (j==-1||s[i]==s[j]){
			fail[i+1]=j+1;
			i++;
			j++;
		}
		else j=fail[j];
	} 
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%s",s);
	ll ans=0;
	int len=strlen(s);
	for (int i=0;s[i];i++) t[i]=s[len-i-1];
	t[len]='\0';
	getfail(fail,s);
	getfail(suf,t);
	int m;
	if (fail[len]==0||len%(len-fail[len])) m=1;
	else m=2;
	bool flag=true;
	for (int i=1;s[i];i++){
		if (s[i]!=s[i-1]) flag=false; 
	}
	if (flag) m=len;
	if (m==1||flag) ans=1;
	else{
		for (int i=0;i<len-1;i++){
			int k=len-i-1;
			if ((fail[i+1]==0||(i+1)%((i+1)-fail[i+1])) && (suf[k]==0||(k)%(k-suf[k]))) ans++;
		}
	}
	printf("%d\n%d\n",m,ans); 
	return 0;
}


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

	int main(){
		int a,b;

		cin >>a >>b;

		if(!(a%3)){
			cout <<"Possible" <<endl;
			return 0;
		}
		if (!(b%3)){
			cout <<"Possible" <<endl;
			return 0;
		}
		if(!((a+b)%3)){
			cout <<"Possible" <<endl;
			return 0;
		}

		cout <<"Impossible" <<endl;


		return 0;
	}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long[] times = new long[5];
    times[0] = sc.nextLong();
    times[1] = sc.nextLong();
    times[2] = sc.nextLong();
    times[3] = sc.nextLong();
    times[4] = sc.nextLong();

    int minNum = 0;
    for (int i = 1; i < 5; i++){
      if (times[i] < times[minNum]) {
        minNum = i;
      }
    }

    double bottleNeck = (double)N / (double)times[minNum];
    bottleNeck = Math.ceil(bottleNeck);
    long bottleNeckl = (long)bottleNeck;

    long t = bottleNeckl + 4;

    System.out.println(t);
  }
}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
const ll mod = 1000000007;
// const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"
#define TO_STRING(VariableName) # VariableName

template <typename T>ostream &operator<<(ostream &out,const vector<T> &v) {rep(i,(int)v.size()-1)cout<<v[i]<<" ";cout<<v[(int)v.size()-1];return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const map<T1, T2> &p) {out << "(" << p.first << ", " << p.second << ")";return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const pair<T1, T2> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template<class T>void debag(const T &obj){cout<<obj<<endl;}

bool solve(){
  ll n;cin>>n;
  vector<ll>a(n);
  vector<ll>x[n];
  vector<ll>y[n];
  rep(i,n){
    cin>>a[i];
    x[i].resize(a[i]);
    y[i].resize(a[i]);
    rep(j,a[i]){
      cin>>x[i][j]>>y[i][j];
      x[i][j]--;
    }
  }

  ll ans=0;
  rep(s,(1LL<<n)){
    ll num=0;
    bool isOK=true;
    rep(i,n){
      if((s>>i)&1){
        num++;
        rep(j,a[i]){
          if(y[i][j]==1){
            if(!((s>>x[i][j])&1))isOK=false;
          }else{
            if(((s>>x[i][j])&1))isOK=false;
          }
        }
      }
    }
    if(isOK)chmax(ans,num);
  }
  cout<<ans<<endl;
  return false;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed<<setprecision(30);
  solve();
}


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

using namespace std;

void solve()
{
    long a, b;
    cin >> a >> b;
    long g = __gcd(a, b);
    long ans = 1;
    for (long i = 2; i * i <= g; i++)
    {
        if (g % i == 0)
        {
            while (g % i == 0)
            {
                g /= i;
            }
            ans++;
        }
    }
    if (g > 1)
        ans++;
    cout << ans << endl;
}

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


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;

int main(){
	double r;
	cin >> r;

	double S,l;

	S = r*r*M_PI;
	l = 2*r*M_PI;

	printf("%.6f %.6f", S,l);

	return 0;
}


Measured memory_bytes: 3288
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>

using namespace std;

int main() {
	int n, minusCount = 0;
	long long ans = 0;
	cin >> n;
	vector<long long> a(n);
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		if (x < 0) ++minusCount;
		a[i] = abs(x);
		ans += a[i];
	}
	sort(a.begin(), a.end());
	if (minusCount % 2 == 1) ans -= a[0] * 2;
	cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

void Main()
{
  int n;
  string s;
  cin >> n >> s;
  int count = n;
  
  for(int i = 0; i < n - 1; i++){
    if(s[i] == s[i+1]){
      count--;
    }
  }
  
  printf("%d", count);
}

int main()
{
  std::cout << std::fixed << std::setprecision(15);
  Main();
}

Measured memory_bytes: 512
#include <stdio.h>
#define SIZE 251

int main(){
  int n,i;
    int heep[SIZE];
    scanf("%d",&n);
    for(i=1; i<=n; i++) scanf("%d",&heep[i]);
    
    for(i=1; i<=n; i++){
      int par,left,right;
      par = i/2;
      left = 2*i;
      right = 2*i + 1;
      
      printf("node %d: ",i);
      printf("key = %d, ",heep[i]);
      if(par > 0) printf("parent key = %d, ",heep[par]);
      if(left <= n)printf("left key = %d, ",heep[left]);
      if(right <= n) printf("right key = %d, ",heep[right]);
      printf("\n");
    }
    
    return 0;
}




Measured memory_bytes: 2112
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <assert.h>
#include <numeric>
#include <iomanip>
#define rep(i, a, b) for (int(i) = (a); i < (b); i++)
using namespace std;

using ll = long long;

typedef pair<int, int> P;

const int INF = 100000000;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;

ll pow_mod(ll x, ll y, ll mod)
{
	ll ans=1;
	for(;y>0;y>>=1){
		if(y&1)(ans*=x)%=mod;
		(x*=x)%=mod;
	}
	return ans;
}

int n;
int ans;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	//問題文中の添え字が0-indexか1-indexか確認!
	cin>>n;
	vector<int> dig;
	for(int i=n;i>0;i/=10){
		dig.push_back(i%10);
	}
	int size=dig.size();
	bool s=true;
	rep(i,0,size-1){
		if(dig[i]!=0)s=false;
	}
	if(s){
		if(dig[size-1]==1)ans=10;
		else ans=dig[size-1];
	}else{
		rep(i,0,size)ans+=dig[i];
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
using namespace std;
 
int main(int argc, char const *argv[])
{
	int a[3][3];
	for (int i = 0; i < 3; ++i)
	{
		for (int j = 0; j < 3 ; ++j)
		{
			cin>>a[i][j];
		}
	}
 
	int q;
	cin>>q;
	int query[q];
	for (int k = 0; k < q; ++k)
	{
		cin>>query[k];
		for (int i = 0; i < 3; ++i)
		{
			for (int j = 0; j < 3; ++j)
			{
				if(a[i][j] == query[k])
					a[i][j] = 0;
			}
		}
	}
	
	bool flag=1;
		for(int i = 0;i < 3;i++){
			//cout<<"dhara"<<endl;
			if(!a[0][i] && !a[1][i] && !a[2][i]) {cout<<"Yes"<<endl;flag=0;break;}
			else if(!a[i][0] && !a[i][1] && !a[i][2]) {cout<<"Yes"<<endl;flag=0;break;}
		}	
	// /cout<<a[0][0] <<" "<< a[1][1] << " "<<a[2][2]<<" ";
	//cout<<flag<<" ";
	if(flag && !a[0][0] && !a[1][1] && !a[2][2]) cout<<"Yes"<<endl;
	else if(flag && !a[0][2] && !a[1][1] && !a[2][0]) cout<<"Yes"<<endl;
	else if(flag)
		cout<<"No"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int GCD(int,int);

main(){
  int a,b;
  int gcd;

  scanf("%d%d",&a,&b);

  gcd=GCD(a,b);

  printf("%d\n",gcd);

  return 0;
  
}

int GCD(int a,int b){
  int r;

  r=a%b;

  while(r!=0){
    a=b;
    b=r;
    r=a%b;
  }
  
  return b;
}



Measured memory_bytes: 2124
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)

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

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n%2==0) return false;

  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}

int main(){
  int n,k;
  int ans = 0;
  cin >> n>> k;

  for(int i=0;i<n;i++){
    int h;
    cin >> h;
    if(k<=h) ans++;
  }
  cout<< ans <<endl;

}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
ndict = {i:0 for i in range(1, N+1)}
for i in A:
  ndict[i] += 1

nndict = {}
nnlist = []
for i in range(1, N+1):
  if ndict[i] >= 1:
    if ndict[i] not in nndict:
      nndict[ndict[i]] = 1
      nnlist.append(ndict[i])
    else:
      nndict[ndict[i]] += 1
      
nnlist.sort(reverse=True)


ki = K
for i in range(len(nnlist)):
  if ki > nndict[nnlist[i]]:
    ki -= nndict[nnlist[i]]
  else:
    nndict[nnlist[i]] -= ki
    inow = i
    break
else:
  print(0)
  exit()

ans = 0
for i in range(i, len(nnlist)):
  ans += nndict[nnlist[i]] * nnlist[i]
print(ans)

Measured memory_bytes: 38644
W, H, N = map(int, input().split())

grid = [[1]*W for i in range(H)]
def p():
    return
    for y in range(H)[::-1]:
        print(*grid[y])
    print()
for i in range(N):
    X, Y, a = map(int, input().split())
    if a == 1:
        for y in range(H):
            for x in range(X):
                grid[y][x] = 0
    elif a == 2:
        for y in range(H):
            for x in range(X, W):
                grid[y][x] = 0
    elif a == 3:
        for y in range(Y):
            for x in range(W):
                grid[y][x] = 0
    elif a == 4:
        for y in range(Y, H):
            for x in range(W):
                grid[y][x] = 0
    p()
print(sum(sum(grid[y]) for y in range(H)))



Measured memory_bytes: 3064
fun main(args: Array<String>) {
    val s = readLine()!!

    when(s){
        ("SUN")->println(7)
        ("MON")->println(6)
        ("TUE")->println(5)
        ("WED")->println(4)
        ("THU")->println(3)
        ("FRI")->println(2)
        ("SAT")->println(1)
    }
}

Measured memory_bytes: 31948
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		String S = sc.next();
		String[] Str = S.split("");
		String StrOut = Str[0];

		if(S.length() <= K) {
			System.out.println(S);
		}else {
		for(int i = 1;i<K;i++) {
			StrOut += Str[i];
		}

		StrOut += "...";
		System.out.println(StrOut);
		}
	}
}

Measured memory_bytes: 39804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=b-1; (ll)(a)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};


ll modpow(ll x, ll n, ll md=MOD){
    ll res=1, dig=x;
    while(n){
        if(n&1) res = res*dig%md;
        dig = dig*dig%md;
        n /= 2;
    }
    return res;
}


int main(){
    ll n;   cin >> n;
    ll res=0;
    res = modpow(10, n)+modpow(8, n)-modpow(9, n)-modpow(9, n);
    res %= MOD;
    cout << (res+MOD)%MOD << endl;
}


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

int sum(int x, int y)
{
	return x+y;
}
int sub(int x, int y)
{
	return x-y;
}
int mul(int x, int y)
{
	return x*y;
}

int main(void)
{
	int a, b, sm, sb, ml, gr;
	scanf("%d %d", &a, &b);
	
	sm = sum(a, b);
	sb = sub(a, b);
	ml = mul(a, b);
	
	if(sm >= sb && sm >= ml) gr = sm;
	else if(sb >= sm && sb >= ml) gr = sb;
	else if(ml >= sm && ml >= sb) gr = ml;

	
	printf("%d\n", gr);
}

Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.string;
import std.conv;
import std.math;

void main(){

    int c = 0;
    while(true){
	auto s = split(readln());
	int a = to!int(s[0]);
	int b = to!int(s[1]);
	if(a==0&&b==0) break;
	bool ifna = true;
	if(c) 
	    writeln("");
	c++;
	for(int i=a;i<=b;i++){
	    bool flg = false;
	    if(i%4==0){
		if(i%100==0){
		    if(i%400==0) flg = true;
		}else flg = true;
	    }
	    if(flg){
	       	writeln(i);
		ifna = false;
	    }
	}
	if(ifna) writeln("NA");
    }

}

Measured memory_bytes: 2424
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
#include<iomanip>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
typedef vector<int> vi;
typedef vector<pii> vpii;
 
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define so(v) sort(v.begin(),v.end())
#define re(s) reverse(s.begin(),s.end())
#define lb(v,a) lower_bound(v.begin(),v.end(),a)
#define ub(v,a) upper_bound(v.begin(),v.end(),a)
#define mp1(a,b,c) piii(a,pii(b,c))
 
const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
const ll mod=1e9+7;

int main(){

  int a,d[20]={0};
  rep(i,3){ 
    cin>>a;
    d[a]++;
  }
  if(d[5]==2&&d[7]==1) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N, W;
    cin >> N >> W;
    vector<P> items(N);
    rep(i, N) cin >> items[i].first >> items[i].second;

    vector<vector<ll>> dp(N + 1, vector<ll>(100005, INF));
    dp[0][0] = 0;
    rep(i, N) {
        P p = items[i];
        rep(j, 100005) {
            if (j - p.second >= 0) {
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - p.second] + p.first);
            }
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
        }
    }
    ll ans = 0;
    rep(i, 100005) {
        if (dp[N][i] <= W) {
            ans = max(ans, i);
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 81520
#include <iostream>                           
#include <vector>                             
                                              
int main(){                                   
    std::size_t n;                            
    std::cin >> n;                            
    std::vector<unsigned> h;                  
    h.resize(n);                              
    for(std::size_t i = 0; i < n; i++){       
        std::cin >> h[i];                     
    }                                         
                                              
    unsigned counter = h[0];                  
    for(std::size_t i = 1; i < h.size(); i++){
        if(h[i] > h[i - 1])                   
            counter += h[i] - h[i - 1];       
    }                                         
                                              
    std::cout << counter << std::endl;        
                                              
    return 0;                                 
}                                             


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	var ans, mother float64
	for i := 0; i < n; i++ {
		mother += 1.0 / nextFloat()
	}
	ans = 1.0 / mother
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cstring>
#include <queue>
using namespace std;
vector< vector<long long> > g(100005);
long long n,m,a,b;
int used[100005];
int main() {
    cin>>n>>m;
    for (int i=1;i<=m;i++){
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for (int i=1;i<=n;i++){
        used[i]=0;
    }
    queue<int> q;
    q.push(1);
    used[1]=1;
    while (!q.empty()){
        int x=q.front();
        q.pop();
        for (auto v:g[x]){
            if (used[v]==0){
                q.push(v);
                used[v]=-used[x];
            }else if (used[v]==used[x]){
                long long ans=(n-1)*n/2-m;
                printf("%lld",ans);
                return 0;
            }
        }

    }
    long long res1=0,res2=0;
    for (int i=1;i<=n;i++){
        if (used[i]==1){
            res1++;
        }else res2++;
    }
    printf("%lld",res1*res2-m);
    return 0;
}

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

using namespace std;

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

int h, w;
string s[50];

int main(){
	cin >> h >> w;
	for(int i = 0; i < h; ++i) cin >> s[i];
	
	for(int i = 0; i < h; ++i){
		for(int j = 0; j < w; ++j){
			if(s[i][j] == '#'){
				bool ok = false;
				for(int k = 0; k < 4; ++k){
					int y = i + dy[k], x = j + dx[k];
					if(0 <= x && x < w && 0 <= y && y < h && s[y][x] == '#') ok = true;
				}
				if(!ok){
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    ll n;cin>>n;
    vector<pair<ll,ll>> t(n);
    vector<ll> a(n),b(n);
    rep(i,n){
        cin>>a[i]>>b[i];
        t[i].first=a[i]+b[i];
        t[i].second=i;
    }
    sort(t.rbegin(),t.rend());
    ll res=0;
    rep(i,n){
        int id=t[i].second;
        if(i%2==0)res+=a[id];
        else res-=b[id];
    }
    cout<<res<<endl;
}

Measured memory_bytes: 6416
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int K = stdIn.nextInt();
		int count = 0;
		
		for(int i = 0; i < N; i++) {
			if(stdIn.nextInt() >= K) count++;
		}
		
		System.out.println(count);

	}

}

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

int main(){
	int n;
	int a[30];

	while( cin >> n , n ){
		for(int i=0 ; i<n ; ++i ){
			cin >> a[i];
		}
		int m = 32;
		
		for(int i=0 ; m ; ++i ){
			m -= (m-1)%5;
			m = (m<0)? 0 : m ;
			cout << m << endl;
			if(!m) break;
			m -= a[i%n];
			m = (m<0)? 0 : m ;
			cout << m << endl;
		}
	}
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(size_t i = 0; i < n; ++i) cin >> a[i];
    size_t op = 0;
    while (true) {
        bool isOdd = false;
        for (const auto& v : a) {
            if (v % 2 != 0) {
                isOdd = true;
                break;
            }
        }

        if (isOdd) break;

        for (auto&& v : a) {
            v = v / 2;
        }

        ++op;
    }

    cout << op << endl;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 256
import java.util.*;
class Card {
    int b;
    int c;
    public Card(int b, int c) {
	this.b = b;
	this.c = c;
    }
}
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n = Integer.parseInt(sc.next());
	int m = Integer.parseInt(sc.next());
	long[] a = new long[n];
	
	for(int i = 0; i<n; i++) {
	    a[i] = Long.parseLong(sc.next());
	}
	Arrays.sort(a);

	Card[] ca = new Card[m];
	for(int i = 0; i<m; i++) {
	    int b = Integer.parseInt(sc.next());
	    int c = Integer.parseInt(sc.next());
	    ca[i] = new Card(b,c);
	}

	Arrays.sort(ca, (ax,bx)-> bx.c - ax.c);

	Long[] tmp = new Long[n];
	int count = 0;
	for(int i = 0; i<m; i++) {
	    Card card = ca[i];
	    for(int j = 0; j<card.b; j++) {
		if(count==n)break;
		tmp[count] = (long)card.c;
		count++;
	    }
	    if(count==n)break;
	}
	for(int i = count; i<n; i++) {
	    tmp[i]=0L;
	}

	Arrays.sort(tmp, Comparator.reverseOrder());

	for(int i = 0; i<n; i++) {
	    if(a[i] < tmp[i]) {
		a[i] = tmp[i];
	    }else {
		break;
	    }

	}

	long total = 0;
	for(int i = 0; i<n; i++) {
	    total += a[i];
	}
	System.out.println(total);
    }
}

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

        long money = 100;
        long X = s.nextLong() ;
        int count = 0;

        while(money<X){
            money = (long)Math.floor(money*1.01);
            count++;
        }

        System.out.println(count);

    }


}


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


class data
{
    public int input;
    public int position;

};
namespace ConsoleApplication3
{
    class Program
    {

        static void Main(string[] args)
        {
            string temp;
            string[] data;
            int[] result;
            int number;
            int swap = 0,count=0,mini;

            temp = Console.ReadLine();
            number = int.Parse(temp);
            result = new int[number];

            data = new string[number];
            temp = Console.ReadLine();
            data = temp.Split(' ');
            for (int i = 0; i < number; i++)
                result[i] = int.Parse(data[i]);
           
            for (int i = 0; i < number; i++)
            {
                mini = i;
                for (int j = i; j <number; j++)
                {
                    if (result[j] < result[mini])
                    {
                        mini = j;
                    }
                }
                if (i != mini)
                {
                    count++;
                    swap = result[i];
                    result[i] = result[mini];
                    result[mini] = swap;
                }

            }


            Console.WriteLine(string.Join(" ", result));
            Console.WriteLine("{0}",count);
        }
    }
}



Measured memory_bytes: 19972
#include<iostream>
#include<vector>
#include<cmath>
#include<iomanip>
using namespace std;

struct Point{
    double x;
    double y;
};

int main()
{
    Point p1,p2;
    cin>>p1.x>>p1.y>>p2.x>>p2.y;
    int q;
    cin>>q;
    vector<Point> pp(q);
    for(int i=0; i<q; i++){
        cin>>pp[i].x>>pp[i].y;
    }
    double rc1,rc2,b1;
    rc1=(p1.y-p2.y)/(p1.x-p2.x);
    if(p1.x-p2.x==0){
        b1=p1.y;
        rc2=0;
    }else{
        b1=p1.y-rc1*p1.x;
        rc2=(-1)/rc1;
    }
    vector<double> bb(q);
    vector<Point> ans(q);
    for(int i=0; i<pp.size(); i++){
        if(rc1==0){
            ans[i].x=pp[i].x;
        }else{
            bb[i]=pp[i].y-rc2*pp[i].x;
            if(p1.x-p2.x==0){
                ans[i].x=0;
            }else if(rc2-rc1==0){
                ans[i].x=0;
            }else{
                ans[i].x=(b1-bb[i])/(rc2-rc1);
            }
        }
        if(p1.x-p2.x==0){
            ans[i].y=bb[i];
        }else{
            ans[i].y=rc1*ans[i].x+b1;
        }
        cout<<fixed;
        cout<<setprecision(10)<<ans[i].x<<" "<<ans[i].y<<endl;;
    }
    return 0;
}


Measured memory_bytes: 3332
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
count=0
for n in range(N):
    sum = C
    for m in range(M):
        sum += B[m]*A[n][m]
    if sum > 0:
        count+= 1
print(count)

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

int main(){
    int n,T;
    cin >> n >> T;
    VI c(n), t(n);
    rep(i,n){
        cin >> c[i] >> t[i];
    }

    int cmin = -1;

    rep(i,n){
        if(t[i] <= T){
            if(cmin == -1 || cmin > c[i]){
                cmin = c[i];
            }
        }
    }

    if(cmin == -1)cout << "TLE" << endl;
    else{
        cout << cmin << endl;
    }

    return 0;
}

Measured memory_bytes: 256
# 8
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


s = S()
alps = [chr(i) for i in range(ord('a'), ord('z') + 1)]
ans = -1
set_s = set(list(s))
# s の長さが 26 未満のとき
# 辞書順で s 以降の単語を探す
for c in alps:
    if c not in set_s:
        ans = s + c
        print(ans)
        break
# s の長さが 26 のとき
else:
    for i in reversed(range(len(s))):
        # i - 1 文字目までの s の アルファベットの集合
        set_now_s = set(list(s[:i]))
        for c in alps:
            if c > s[i] and c not in set_now_s:
                ans = s[:i] + c
                print(ans)
                exit()
    else:
        print(-1)


Measured memory_bytes: 9124
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N, K = MAP()
S = [int(s) for s in input()] + [1]

r = -1
ans = 0
cnt = 0
used = [0]*(N+1)

for l in range(N):
	if S[l] + S[l-1] == 0:
		continue
	while r < N and used[r] - used[l-1] <= K:
		r += 1
		if S[r-1] == 1 and S[r] == 0:
			used[r] = used[r-1] + 1
		else:
			used[r] = used[r-1]
	ans = max(ans, r-l)

print(ans)


Measured memory_bytes: 13408
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, k, a[200000];
int cnt[200010];
map<int, int> mp;
int ans;

signed main() {
	cin >> n >> k;
	if (k == 1) {
		cout << 0 << endl;
		return 0;
	}
	cnt[0] = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		cnt[i + 1] = (cnt[i] + a[i] - 1) % k;
	}
	mp[0] = 1;
	for (int i = 1; i <= n; i++) {
		ans += mp[cnt[i]];
		mp[cnt[i]]++;
		if (k - 1 <= i)mp[cnt[i - k + 1]]--;
	}
	cout << ans << endl;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];

  sort(ALL(a));
  int ans = 0;
  ans = *(a.end()-1)-*a.begin();


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


Measured memory_bytes: 3604