akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    FASTINOUT;
    int x,ans=0;
    string s;
    cin>>x>>s;
    for (int i=0;i<=999;i++){
        string t="";
        int kl=i;
        for (int j=0;j<3;j++){
            t.push_back('0'+kl%10);
            kl/=10;
        }
        reverse(t.begin(),t.end());
        int idx=0;
        for (int j=0;j<s.size();j++){
            if (s[j]==t[idx])
                idx++;
            if (idx==3)
                break;
        }
        if (idx==3)
            ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 384
from collections import Counter
from math import gcd

class Prime:
    def __init__(self, N):
        smallestPrime = [1] * (N + 1)
        primes = []

        for i in range(2, N + 1):
            if smallestPrime[i] != 1:
                continue
            primes.append(i)
            for p in range(i * 2, N + 1, i):
                if smallestPrime[p] == 1:
                    smallestPrime[p] = i

        self.smallestPrime = smallestPrime
        self.primes = primes

    def isPrime(self, n):
        return n > 1 and self.smallestPrime[n] == 1

    def factorization(self, n):
        ret = Counter()
        while (p := self.smallestPrime[n]) != 1:
            ret[p] += 1
            n //= p
        if n > 1:
            ret[n] += 1
        return ret

N = int(input())
A = list(map(int, input().split()))
prime = Prime(max(A) + 100)

def isSetwise(A):
    ret = A[0]
    for a in A:
        ret = gcd(ret, a)
    return ret == 1

def isPairwise(A):
    cnt = Counter()
    for a in A:
        for p in prime.factorization(a).keys():
            if cnt[p] >= 1:
                return False
            cnt[p] += 1
    return True

if not isSetwise(A):
    print('not coprime')
elif isPairwise(A):
    print('pairwise coprime')
else:
    print('setwise coprime')


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

// 8*8Ìp^[ð90xñ]³¹é
vector<string> rot(vector<string>& m){
	vector<string> m_(8);
	for(int y=0 ; y < 8 ; y++ )
		m_[y] = "********";
	for(int y=0 ; y < 8 ; y++ ){
		for(int x=0 ; x < 8 ; x++ ){
			m_[x][7-y] = m[y][x];
		}
	}
	return m_;
}

// 8*8Ìp^[ðoÍ
void output(const vector<string>& m){
	for(int y=0 ; y < 8 ; y++ )
		cout << m[y] << endl;
}

int main(){
	vector<string> m(8);
	for(int y=0 ; y < 8 ; y++ ){
		cin >> m[y];
	}
	for(int i=1 ; i <= 3 ; i++ ){
		m = rot( m );
		cout << 90*i << endl;
		output( m );
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define all(x) x.begin(), x.end()

int binpow(int a, int b)
{
    int ans = 1;
    if (b == 0)
        return 1;
    while (b)
    {
        if (b & 1)
            ans = ans * a;
        a = a * a;
        b >>= 1;
    }
    return ans;
}

//read question carefully!

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int a[n];
        int pre[n];
        int sum = 0;
        for (int i = 0; i < n; ++i)
        {
            cin >> a[i];
            sum += a[i];
        }
        int temp = 0;
        int ans = 0;
        for (int i = 0; i < n; ++i)
        {
            temp += a[i];
            int dif = (sum - temp) % mod;
            ans += dif * (a[i] % mod) % mod;
            ans = ans % mod;
        }
        cout << ans << "\n";
    }
}


Measured memory_bytes: 5148
// ARC096
// D - Static Sushi

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 100000;

int N;
ll C;
pli xv[MAX_N];

ll solve() {
    ll mr[MAX_N + 1], ml[MAX_N + 1], mr2, ml2;
    ll ans;

    ll s[MAX_N + 1];
    s[0] = 0;
    for (int i = 0; i < N; i++) {
        s[i + 1] = s[i] + xv[i].second;
    }

    mr[0] = mr2 = 0;
    ml[N] = ml2 = 0;

    for (int i = 0; i < N; i++) {
        mr[i + 1] = max(mr[i], s[i + 1] - xv[i].first);
    }
    for (int i = N - 1; i >= 0; i--) {
        ml[i] = max(ml[i + 1], s[N] - s[i] - (C - xv[i].first));
    }

    ans = max(mr[N], ml[0]);
    for (int i = 0; i < N; i++) {
        mr2 = max(mr2, s[i + 1] - 2LL * xv[i].first);
        ans = max(ans, mr2 + ml[i + 1]);
    }
    for (int i = N - 1; i >= 0; i--) {
        ml2 = max(ml2, s[N] - s[i] - 2LL * (C - xv[i].first));
        ans = max(ans, ml2 + mr[i]);
    }

    return ans;
}

int main() {
    cin >> N >> C;
    for (int i = 0; i < N; i++) {
        cin >> xv[i].first >> xv[i].second;
    }

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 4096
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n;
int main() {
  cin >> n;
  cout << n * n * n << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
  public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}


void solve(long long N){
    cout << fixed << setprecision(10) << (double)ceil(N,2)/ N << endl;
}

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


Measured memory_bytes: 256
# coding: utf-8

II = lambda: int(input())
MI = lambda: map(int, input().split())
MIL = lambda: list(MI())
MIS = lambda: input().split()


def main():
    S = input()
    K = II()
    for c in S:
        if c == "1":
            K -= 1
            if K == 0:
                return c
        else:
            return c


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


Measured memory_bytes: 2940
#require 'pp'

n, m = gets.split.map(&:to_i)
graph = {}
edges = Array.new(m)
m.times do |i|
    a, b = gets.split.map(&:to_i)
    graph[a] ||= {}
    graph[a][b] = 1
    graph[b] ||= {}
    graph[b][a] = 1
    edges[i] = [a,b]
end

#pp graph

count = 0
edges.each do |n1, n2|
    path = Array.new(n+1, nil)
    path[n1] = 2
    nexts = [n1]
    while nexts.empty?.!
        x = nexts.pop
        path[x] ||= 1
        (graph[x] || []).each do |k, _|
            next if [n1, n2] == [x, k].minmax
            next unless path[k].nil?

            nexts.push(k)
        end 
    end

    1.upto(n) do |i|
        if path[i] == nil
            count += 1
            break
        end
    end
end

puts count


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
  while(cin>>n)
  {
      double sum=0;
      for(int i=0;i<n;i++)
      {
          double j;
          string s;
          cin>>j>>s;
          if(s=="JPY") sum+=j;
          else sum+=380000*j;
      }
      cout<<sum<<endl;
  }
}


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

typedef struct {
    int top;
    int forward;
    int right;
} diceMap;

int main(){
    while (1){
    string str;
    diceMap dice;
    dice.top = 1;
    dice.forward = 2;
    dice.right = 3;
    
    int n;
    cin >> n;
    if (n == 0) break;
    int score = 1;

    for (int m = 0; m < n; m++){
	cin >> str;
	diceMap bufDice = dice;

	if (str == "North"){
	    bufDice.top = dice.forward;
	    bufDice.forward = 7 - dice.top;
	    bufDice.right = dice.right;
	}
	else if (str == "East"){
	    bufDice.top = 7 - dice.right;
	    bufDice.forward = dice.forward;
	    bufDice.right = dice.top;
	}
	else if (str == "South"){
	    bufDice.top = 7 - dice.forward;
	    bufDice.forward = dice.top;
	    bufDice.right = dice.right;
	}
	else if (str == "West"){
	    bufDice.top = dice.right;
	    bufDice.forward = dice.forward;
	    bufDice.right = 7- dice.top;
	}
	else if (str == "Right"){
	    bufDice.top = dice.top;
	    bufDice.forward = dice.right;
	    bufDice.right = 7 - dice.forward;
	}
	else if (str == "Left"){
	    bufDice.top = dice.top;
	    bufDice.forward = 7- dice.right;
	    bufDice.right = dice.forward;
	}
	dice = bufDice;
	score += bufDice.top;
    }
    cout << score << endl;
    }
}

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


int main() {  
    ll n ;
    cin >> n ;
    ll ans = 0 ;
    vector<ll> vec (1000005) ;
    for(int i = 1 ; i <= 1000005 ; i++){
        for(int j = i ; j <= 1000005 ; j += i){
            vec[j]++ ;
        }
    }
    for(int i = 1; i < n ; i++){
        ll num = n - i ;
        ans += vec[num] ;
    }
    cout << ans << endl ;
} 



Measured memory_bytes: 11168
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;
typedef pair<long, long> P;

long bit[100001];
long a[100001];
long N;

long sum(long i){
    long s = 0;
    while(i > 0){
        s += bit[i];
        i-= i&-i;
    }
    return s;
}

void add(long i, long x){
    while(i <= N+1){
        bit[i] += x;
        i += i & -i;
    }
}

long count(long c){
    P b[100001];
    b[0] = P(0, 0);
    for(long i = 1; i <= N; i++){
        b[i].second = i;
        if(a[i] > c) b[i].first = b[i-1].first+1;
        else b[i].first = b[i-1].first-1;
        //cout << b[i].first << ' ';
    }
    //cout << endl;
    sort(b, b+N+1);
    long tmp = 0;
    memset(bit, 0, 100001*sizeof(long));
    for(long i = 0; i <= N; i++){
        tmp += sum(b[i].second+1);
        add(b[i].second+1, 1);
    }
    return tmp;
}

int main(){
    cin >> N;
    long M = (N*(N+1))/2;
    for(long i = 1; i <= N; i++) cin >> a[i];
    if(N == 1){
        cout << a[1] << endl;
        return 0;
    }
    long l  = 0;
    long r = 1000000001;
    while(r-l>1){
        long c = (r+l)/2;
        //cout << "c:" << c << endl;
        //cout << "l:" << l << " r:" << r <<endl;
        long tmp1 = count(c-1);
        long tmp2 = count(c);
        //cout << "tmp1:" << tmp1 << " tmp2:" << tmp2 <<endl;
        if(tmp1*(long)2 >= M && tmp2*(long)2 < M){
            cout << c << endl;
            //cout << tmp1 << ' ' << tmp2 << endl;
            //cout << count(0) << ' ' << count(10) << endl;
            return 0;
        }
        else if(tmp1 < M/2) r = c;
        else l = c;
    }
    //cout << l << endl;
}

Measured memory_bytes: 3328
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
// #define MAX 20
#define INF (int)1e18

template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.F<<','<< P.S<<')';}


signed main()
{
	fio
	inp(a) inp(b)
	int x=a,y=b;
	int aa=a-1,bb=b-1;
	while(aa--)
	{
		b=b*10+y;
	}
	while(bb--)
	{
		a=a*10+x;
	}
	
	if(a<b)
	{
		cout<<b<<'\n';
	}
	else
	{
		cout<<a<<'\n';
	}
	printclock;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n, k = LI()
    print(n-k+1)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 38768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const long double PI = (acos(-1));
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define sc(x) scanf("%d",&x)
#define scll(x) scanf("%lld",&x)
static const int mod = 1e9+7;
int main(){
    ll n, k; scll(n), scll(k);
    ll ans = 0;
    rep(i, k, n+2){
        ans = (ans + i*(n-i+1)%mod + 1)%mod;

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

Measured memory_bytes: 3736
import math

R,G,B,N = map(int,input().split())
KR = int(N/R)+1
KG = int(N/G)
KB = int(N/B)
c = 0
# for i in range(KR):
#     k = int(N/R)-i
#     for j in range(int((N-R*i)/G)):
#         while R*i + G*j + B*k >= N:
#             k -= 1
#             if R*i + G*j + B*k == N:c+=1
#
#
#     for j in range(KG):
#
#         for k in list(range(KB)).reverse():
#             if R*i + G*j + B*k == N:
#                 c += 1
for i in range(KR):
    for j in range(int((N-R*i)/G)+1):
        tmp = N-R*i-G*j
        if tmp >= 0 and tmp%B == 0:
            c += 1
print(c)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            int C = in.nextInt();
            int K = in.nextInt();

            int sum = A + B + C;
            int max = Math.max(A, Math.max(B, C));
            sum += -max + (max << K);

            System.out.println(sum);
        }
    }
}


Measured memory_bytes: 27064
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  cin >> n;
  string s1, s2;
  cin >> s1;
  cin >> s2;
  bool t = s1[0] == s2[0];
  ll ans = t ? 3 : 6;
  int i = t ? 1 : 2;
  for (; i < n;) {
    if (t) {
      if (s1[i] == s2[i]) {
        ans *= 2;
        ans %= MOD;
        i++;
      } else {
        ans *= 2;
        ans %= MOD;
        i += 2;
        t = false;
      }
    } else {
      if (s1[i] == s2[i]) {
        i++;
        t = true;
      } else {
        ans *= 3;
        ans %= MOD;
        i += 2;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  int N, X;
  cin >> N >> X;
  vector<int> L(N);

  for(int i = 0; i < N ; i++){
    cin >> L.at(i);
  }

  int total = 0;
  for(int i = 0; i < N ; i++){
    total += L.at(i);
    if(total > X){
      cout << i+1 << endl;
      break;
    }
    if(i == N-1){
      if(X >= total){
        cout << N+1;
      }
    }
  }
}

Measured memory_bytes: 256
N,K=map(int, input().split())
def f(a,N):
  minf=(a-1)*a//2
  maxf=(2*N-a+1)*a//2
  return maxf-minf+1
mod=10**9+7
ans=0
for i in range(K,N+2):
  ans+=f(i,N)%mod
print(ans%mod)

Measured memory_bytes: 9188
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
ll ans = 1;
ll Gcd(ll a, ll b) {
	if (b == 0)return a;
	return Gcd(min(a, b), max(a, b) % min(a, b));
}
int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		ll k; cin >> k;
		ans = ans / Gcd(ans, k)*k;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
I = [input() for i in range(2)]
K = int(I[0])
S = I[1].split()
A = int(S[0])
B = int(S[1])

na = A//K
nb = B//K

la = A%K
lb = B%K

#print(na)
#print(nb)

if na < nb or la == 0 or lb == 0 :
    ans = 'OK'
else:
    ans = 'NG'

print(ans)

Measured memory_bytes: 9192
#include<iostream>
#include<vector>
#include<unordered_map>

using namespace std;

int main() {
	int n;
	long long k;
	cin >> n >> k;
	vector<int> A(n+1);
	for (int i = 1; i <= n; i++)
		cin >> A[i];
	unordered_map<long long, long long> mp;
	vector<int> record(n+1,0);
	int isflag = 0;
	record[0] = 1;
	mp[1] = 0;
	long long i = 1;
	for (; i <= k; i++) {
		record[i] = A[record[i-1]];
		//cout << record[i] << endl;
		if (mp.count(record[i])) {
			isflag = 1;
			break;
		}
		else mp[record[i]] = i;
	}
	if (isflag == 0) {
		cout << record[k];
		return 0;
	}
	long long m = k - mp[record[i]];
	//cout << m << "e" << endl;
	long long index = m % (i - mp[record[i]]) + mp[record[i]];
	cout << record[index];
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  for(int i=0;i<=n/4;i++){
    for(int j=0;j<=(n-4*i)/7;j++){
      if(4*i+7*j==n){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <cctype>
#include <fstream>

using namespace std;

#define ll long long
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());


int main() {

    int K;
    cin >> K;

    if (K % 2 == 0)cout << (K / 2)*(K / 2) << endl;
    else cout << (K / 2)*((K / 2) + 1) << endl;
    
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  
  int x,y,c;
  
  while(1){
    scanf("%d%d",&x,&y);

    if( x == 0 && y == 0)
      break;
    
    if( x > y ){
      c = y;
      y = x;
      x = c;
    }
    printf("%d %d\n", x, y);

  }

  return 0;

}

Measured memory_bytes: 0
width = int(input())
heights = list(input().split())
score = 0
best = 0
for x in range(width - 1):
  if int(heights[x]) >= int(heights[x + 1]):
    score = score + 1
    if best < score:
      best = score
  else:
    score = 0
print("{}".format(best))

Measured memory_bytes: 11132
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n - 1];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt() - 1;
		}
		for (int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}
		for (int i = 0; i < n - 1; i++) {
			c[i] = sc.nextInt();
		}
		sc.close();

		int ans = b[a[0]];
		for (int i = 1; i < n; i++) {
			ans += b[a[i]];
			if (a[i - 1] + 1 == a[i]) {
				ans += c[a[i - 1]];
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 22100
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){

        int n, A[100001], dp[100000];

        //??\???
        cin >> n;
        for(int i = 0; i < n; i++) {
                cin >> A[i];
        }

        dp[0] = A[0];
        int length = 1;

        for(int i = 1; i < n; i++) {
                if(dp[length-1] < A[i]) {
                        dp[length++] = A[i];
                } else {
                        for(int j = 0; j < length; j++) {
                                if(dp[j] >= A[i]){
                                   dp[j] = A[i];
                                   break;
                                 }
                        }
                }
        }
        cout << length << endl;
}

Measured memory_bytes: 3840
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int N, M;
	int A[101], B;
	int pnt[101] = { 0 };

	cin >> N >> M;

	for (int i = 1; i <= M; i++)
		cin >> A[i];

	for (int i = 1; i <= M; i++)
		for (int j = 1; j <= N; j++) {
			cin >> B;
			if (A[i] == B)pnt[j]++;
			else pnt[A[i]]++;
		}

	for (int i = 1; i <= N; i++)
		cout << pnt[i] << endl;

	return 0;
}

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

int main(){
 int N;
int A[210]; 
  cin >> N;


for (int i=0; i< N; i++) cin >>  A[i];

int res = 0;

while(true){
  bool odd_number = false;
  for (int i=0; i < N ; i++){
    if (A[i]%2 != 0) odd_number = true;
  }
  if (odd_number)break;
  for (int i = 0; i < N; i++){
    A[i]/=2;
  }
  res++;
}
cout << res << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,dis,x,y;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d%d%d",&dis,&x,&y);
        if(dis<(x+y))
        {
            printf("No");
            return 0;
        }
        else
        {
            if((x+y)%2==0)
            {
                if(dis%2==0)
                    continue;
                else
                {
                    printf("No");
                    return 0;
                }
            }
            else
            {
                if(dis%2==0)
                {
                    printf("No");
                    return 0;
                }
                else
                    continue;
            }
        }

    }
    printf("Yes");
    return 0;
}


Measured memory_bytes: 256
import sys

def main():
    input = sys.stdin.readline
    N, C = map(int, input().split())
    dic = [[] for _ in range(C + 1)]
    for _ in range(N):
        s, t, c = input().split()
        dic[int(c)].append([int(s), int(t)])
    for c in range(C + 1):
        l = len(dic[c])
        if l == 1:
            continue
        dic[c] = sorted(dic[c])
        i = 0
        while i < l - 1:
            if i < l - 1 and dic[c][i][1] == dic[c][i + 1][0]:
                dic[c][i + 1][0] += 1
            else:
                i += 1
    f = [0 for _ in range(100002)]
    for c in range(C + 1):
        for t in dic[c]:
            f[t[0]] += 1
            f[t[1] + 1] -= 1
    ans = 0
    for i in range(1, 100001):
        f[i] += f[i - 1]
        if ans < f[i]:
            ans = f[i]
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 60892
#define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
int main() {
	int n;
	cin >> n;
	cout << n / 3 << endl;
	return 0;
}

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


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

    int op[]={1,-1};
    char opc[] = {'+','-'};
    for(int i=0;i<2;++i)
    {
        for(int j=0;j<2;++j)
        {
            for(int k=0;k<2;++k)
            {
                if((n[0]-'0')+op[i]*(n[1]-'0')+op[j]*(n[2]-'0')+op[k]*(n[3]-'0')==7)
                {
                    cout<<n[0]<<opc[i]<<n[1]<<opc[j]<<n[2]<<opc[k]<<n[3]<<"=7";
                    return 0;
                }
            }
        }
    }

}

Measured memory_bytes: 256
n = int(input())


def modif(n):
    a = []
    b = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            a.append(i)
            b.append(n // i)
    return a, b


ans = 10 ** 12 + 9
x, y = modif(n)
for i, j in zip(x, y):
    ans = min(ans, i + j - 2)
print(ans)


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

int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  ll x = n/(a+b);
  ll y = n%(a+b);
  ll ab = min(y,a);
  ll ans = x*a+ab;
  cout << ans << endl;
  return 0;
}


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

string L, M, U;
long long a, b, c;
char T[11] = "0123456789";

int main() {
	cin >> L >> a;
	for (int i = 0; i < 10; i++)
	{
		if (L[0] == T[i])
		{
			b = i; c = i;
		}
	}
	if (L[1] == '*')
	{
		U += L[0];
		b = 0;
	}
	for (int i = 1; i < L.size(); i += 2)
	{
		int d;
		for (int j = 0; j < 10; j++)
		{
			if (L[i + 1] == T[j])
			{
				d = j;
			}
		}
		if (L[i] == '+')
		{
			c += d;
		}
		if (L[i] == '*')
		{
			c *= d;
		}
	}
	for (int i = 1; i < L.size(); i += 2)
	{
		int d, e;
		for (int j = 0; j < 10; j++)
		{
			if (L[i + 1] == T[j])
			{
				d = j;
			}
		}
		if (L[i] == '+')
		{
			if (U.size() >= 1)
			{
				e = 1;
				for (int j = 0; j < U.size(); j++)
				{
					for (int k = 0; k < 10; k++)
					{
						if (U[j] == T[k])
						{
							e *= k;
						}
					}
				}
				b += e;
			}
			U = "";
			if (i == L.size() - 2)
			{
				b += d;
			}
			else {
				if (L[i + 2] == '+')
				{
					b += d;
				}
				else
				{
					for (int j = 0; j < 10; j++)
					{
						if (L[i + 1] == T[j])
						{
							U += T[j];
						}
					}
				}
			}
		}
		if (L[i] == '*')
		{
			U += L[i + 1];
		}
	}
	if (U.size() >= 1)
	{
		int e = 1;
		for (int j = 0; j < U.size(); j++)
		{
			for (int k = 0; k < 10; k++)
			{
				if (U[j] == T[k])
				{
					e *= k;
				}
			}
		}
		b += e;
	}
	if (b == a && c == a) { cout << 'U' << endl; }
	if (b == a && c != a) { cout << 'M' << endl; }
	if (b != a && c == a) { cout << 'L' << endl; }
	if (b != a && c != a) { cout << 'I' << endl; }
	return 0;
}

Measured memory_bytes: 1204
import sys
input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import math
import heapq
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15


def main():
    n, k = getlist()
    nums = getlist()
    nums.sort()
    if n <= k:
        print(0)
        return
    if k == 0:
        print(sum(nums))
        return
    print(sum(nums[:-k]))

if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

Measured memory_bytes: 75760
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();	
		int x=sc.nextInt();	
		
		int sum = 0;
		int ans = 0;
		
		for(int i=0;i<n;i++) {
			int l=sc.nextInt();
			sum+=l;
			if(sum<=x) {
				ans++;
			}
		}
		System.out.println(ans+1);
		sc.close();
	}
}


Measured memory_bytes: 27056
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
string s,t;
int dp[3010][3010];
vector<char>ans;
signed main(){
    cin>>s>>t;
    rep(i,s.size()){
        rep(j,t.size()){
            if(s[i]==t[j])dp[i+1][j+1]=dp[i][j]+1;
            else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
        }
    }
    int i=s.size(),j=t.size();
    while(i>0&&j>0){
        if(dp[i][j]==dp[i-1][j])i--;
        else if(dp[i][j]==dp[i][j-1])j--;
        else{
            i--;
            j--;
            ans.pb(s[i]);
        }
    }
    reverse(all(ans));
    for(char c:ans)cout<<c;
    cout<<endl;
    return 0;
}

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

int main(){
  int N; cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++) cin >> A[i];
  int ct=0;
  for(int i=0;i<N;i++){
    if(A[A[i]-1]==i+1) ct++;
  }
  cout << ct/2<< endl;
}

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

int main(){
    int n;
    cin >> n;
    int data1[n],data2[n];
    for(int i=0;i<n;i++){
        cin >> data1[i];
    }
    for(int j=0;j<n;j++){
        data2[j] = data1[n-1-j];
        if (j!=n-1) cout << data2[j] << " ";
        else cout << data2[j]<<endl;
    }
    return 0;
    
}


Measured memory_bytes: 3100
import java.io.*;
import java.util.*;
public class Main {
  public static void main(String[] args) throws Exception {
    String line = null;
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    line = br.readLine();
    char[] charArray = line.toCharArray();
    StringBuilder sb = new StringBuilder("");
    for (int i = 0; i < charArray.length; i ++) {
      //System.out.println(charArray[i]);
      if ((i + 1)%2 != 0) {
        sb.append(charArray[i]);
      }
    }
    System.out.println(sb.toString());
  }
}

Measured memory_bytes: 20436
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
        static long Mod = (long)1e9 + 7;
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }
        static void Solve()
        {
            var N = Sarray()[0];
            var Ai = Sarray();
            var dct = new Dictionary<long, long>();
            foreach (var a in Ai)
            {
                if (!dct.ContainsKey(a)) dct[a] = 0;
                ++dct[a];
            }
            var dupENum = dct.Count(d => 1 < d.Value && 0 == d.Value % 2);
            WriteLine(dct.Count - dupENum % 2);
        }
    }
}

Measured memory_bytes: 41320
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    ll ans = 0;
    ans += min(A, K);
    K -= A;
    if (K > 0) {
        K -= B;
        if (K > 0) {
            ans -= K;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3640
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>

#include <inttypes.h>
using namespace std;

int main()
{
	int32_t N;
	int64_t A, B;
	scanf("%d%" PRId64 "%" PRId64, &N, &A, &B);

	vector<int64_t> h(N);
	for (int32_t i = 0; i < N; i++)
		scanf("%" PRId64, &h[i]);
	sort(h.begin(), h.end());

	int64_t start = 0;
	int64_t end = 1000000000;
	int64_t ok = end, ng = start;
	while (ok - ng > 1) {
		int64_t mid = (ok + ng) / 2;
		bool isOk;
		if (h[N - 1] > mid * B) {
			auto it = upper_bound(h.begin(), h.end(), mid * B);
			priority_queue<int32_t, vector<int32_t>, greater<int32_t>> q;
			for (int32_t i = it - h.begin(); i < N; i++)
				q.push(h[i] - mid * B);

			int64_t rest = mid;
			isOk = true;
			while (!q.empty()) {
				int64_t now = q.top(); q.pop();
				rest -= now / (A - B);
				if (now % (A - B) != 0)
					rest--;
				if (rest < 0) {
					isOk = false;
					break;
				}
			}
		} else {
			isOk = true;
		}
		if (isOk)
			ok = mid;
		else
			ng = mid;
	}
	printf("%" PRId64 "\n", ok);

	return 0;
}

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

#define      pb    push_back

int   main(   ) {

    int  n ;
    cin >> n ;

    if( n & 1 ){
        cout << n / 2 ;
    }
    else  cout << n / 2 - 1 ;

    return  0;
}


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

int main(){
	int n, num2=0, num4=0;
  	cin >> n;
  	long long temp;
  	for(int i=0;i<n;i++){
    	cin >> temp;
      	if(temp%4==0)num4++;
      	else if(temp%2==0)num2++;
    }
  	if(num2%2==0){
  		cout << (num4*2+num2+1>=n?"Yes":"No");
    }else{
      	cout << (num4*2+num2>=n?"Yes":"No");
    }
}
  

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

using namespace std;

const uint64_t MOD = 1e+9 + 7;

inline uint64_t perm(uint64_t n, uint64_t k)
{
  uint64_t x = 1;
  for (uint64_t i = 0; i < k; ++i) {
    x = (x * (n - i)) % MOD;
  }
  return x;
}

uint64_t dfs(
  uint64_t N, uint64_t K, const vector< set<uint64_t> > &edges, 
  uint64_t parent, uint64_t node
)
{
  uint64_t subtract = (parent == static_cast<uint64_t>(-1)) ? 0 : 1;
  
  uint64_t num_of_case = (K - 1) - subtract;
  
  if (K < edges[node].size()) {
    return 0;
  }
  
  uint64_t result = perm(num_of_case, edges[node].size() - subtract);
  
  for (uint64_t child : edges[node]) {
    if (child != parent) {
      uint64_t temp = dfs(N, K, edges, node, child);
      result = (result * temp) % MOD;
    }
  }
  
  return result;
}

int main()
{
  uint64_t N, K;
  cin >> N >> K;
  
  vector< set<uint64_t> > edges(N);
  for (uint64_t n = 0; n < N - 1; ++n) {
    uint64_t a, b;
    cin >> a >> b;
    
    edges[a - 1].insert(b - 1);
    edges[b - 1].insert(a - 1);
  }
  
  uint64_t result = (K * dfs(N, K, edges, -1, 0)) % MOD;
  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 20224
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif


#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;


int main()
{
	int N, M, L;
	vector<int>A[2];
	map<int, int >B;
	int count = 0;
	while (1)
	{
		cin >> N >> M;
		if (N == 0 && M == 0)break;
		A[0].clear(); 
		A[1].clear(); 
		B.clear();
		count = 0;
		for (size_t i = 0; i < N; i++)
		{
			cin >> L;
			A[0].push_back(L);
			int sum = 0;
			for (auto i = A[0].rbegin(); i != A[0].rend(); i++)
			{
				sum += *i;
				B[sum]++;
			}
		}
		for (size_t i = 0; i < M; i++)
		{
			cin >> L;
			A[1].push_back(L);
			int sum = 0;
			for (auto i = A[1].rbegin(); i != A[1].rend(); i++)
			{
				sum += *i;
				count += B[sum];
			}
		}
		cout << count<<endl;
	}
	return 0;
}

Measured memory_bytes: 19068
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		int M = int.Parse(str[1]);
		int a = 1;
		int ans = 0;
		while(true){
			if(a>=M){
				break;
			}
			ans++;
			a += N-1;
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13140
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
//using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;

using lli = long long int;
using ulli = unsigned long long int;

#define INF 999999999;
#define MOD 1000000007;

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int A, B, T;

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

	cin >> A >> B >> T;
	cout << (T/A)*B;

	return 0;
}


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

#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int

const int maxr = 1e5 + 5;


int32_t main()
{
	GO;
	int x, y;
	cin >> x >> y;
	for (int i = 0; i <= x; i++) {
		int j = x - i;
		if (y == i * 2 + j * 4) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

//!

Measured memory_bytes: 3616
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("inline")
//#pragma GCC optimize("-ffast-math")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("inline-small-functions")
//#pragma GCC optimize("-finline-small-functions")
//#pragma GCC optimize("-fexpensive-optimizations")
//#pragma GCC optimize("-funsafe-loop-optimizations")
//#pragma GCC optimize("inline-functions-called-once")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
using oset = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
const int maxn = 2e5 + 33, mod = 1e9 + 7;
ll dp[maxn], ov[maxn], n, a[maxn], pref[maxn];
ll bp(ll a, ll p) {
	ll r = 1;
//	cout << a << " " << p << " ";
	while(p) {
		if(p&1) r = (r*a)%mod;
		a = (a*a)%mod;
		p>>=1;
	}
//	cout << r << "\n";
	return r;
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    ll t, s = 0;
    for(int i = 0; i < n; i++) cin >>a[i], (pref[i] = a[i] + (i?pref[i-1]:0))%=mod;
    for(int i = 0; i < n; i++) {
    	ll t = (a[n-1]-a[i]);
        (t *= bp((n-1)-i, mod-2))%=mod;
//        cout <<t << "\n";
    	s = (s+t)%mod;
    }
    for(int k = 1; k < n; k++) {
    	ll t = (mod+pref[n-2]-(k-1>=0?pref[k-1]:0))%mod;
//    	cout << k << " " <<t << "\n";
    	if(n-k-2>=0)
    	t = (mod+t-pref[n-k-2])%mod;
//    	cout << k << " " <<t << "\n";
        (t *= bp(k, mod-2))%=mod;
        (t *= bp(k+1, mod-2))%=mod;
        s = (s+t);
    }
    for(int i = 1; i < n; i++) s = (s*i)%mod;
    cout << s;
}


Measured memory_bytes: 3584
import scala.util.control.Breaks._

object Main extends App {
  var Array(n, k) = scala.io.StdIn.readLine.split(" ").map(_.toLong)

  breakable {
    while (true) {
      if (n > k) {
        n = n % k
      } else {
        val temp = scala.math.abs(n - k)
        if (temp < n) {
          n = temp
        } else {
          println(n)
          break()
        }
      }
    }
  }
}


Measured memory_bytes: 25416
//@author yash2040
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define pb push_back
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int32_t main()
{
	fast();
	int t=1;
	//cin>>t;
	while(t--)
	{
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		int ans=LLONG_MIN;
		
		ans=max(a*c,max(a*d,max(b*c,b*d)));
		cout<<ans;
	}
}








Measured memory_bytes: 3648
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
map<ll,ll>mp;
int main(){
    int n;
    cin >> n;
    vector<ll>a(n);
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    vector<ll>b(n);
    ll ans = 0;
    rep(i,n){
        if(i==0){
            b[i] = a[i];
        }else{
            b[i] = a[i]+b[i-1];
        }
        mp[b[i]]++;
        ll k = mp[b[i]];
        if(b[i]!=0){
            ans += k-1;
        }
        else{
            ans++;
            ans += k-1;
        }
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 15872