akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.math.BigInteger;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		String s[] = new String[N];
		for(int i = 0; i < N; i++) {
			s[i] = sc.next();
		}
		for(int i = 0; i < N; i++) {
			String t = s[i].substring(0, 1);
			for(int j = 1; j < 10; j++) {
				String temp = s[i].substring(j, j + 1);
				int c = 0;
				in : while(c < t.length()) {
					if(temp.compareTo(t.substring(c, c + 1)) < 0) {
						t = t.substring(0, c) + temp + t.substring(c);
						break in;
					}
					c++;
					if(c >= t.length()) {
						t = t + temp;
						break in;
					}
				}
			}
			s[i] = t;
		}
		
		Arrays.sort(s);
		boolean flag = false;
		long cnt = 0;
		long ans = 0;
		for(int i = 1; i < N; i++) {
			if(s[i].equals(s[i - 1])) {
				cnt++;
				flag = true;
			} else {
				if(flag) {
					cnt++;
					long sum = 0;
					if(cnt % 2 == 0) {
						sum = cnt / 2 * (cnt - 1);
					} else {
						sum = (cnt - 1) / 2 * cnt;
					}
					ans += sum;
					flag = false;
					cnt = 0;
				}
			}
		}
		if(flag) {
			cnt++;
			long sum = cnt * (cnt - 1) / 2;
			ans += sum;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 168544
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = do
	[ h, w ] <- readIntegers
	print $ if min h w == 1
		then 1
		else ( h * w + 1 ) `div` 2

Measured memory_bytes: 380
#include <iostream>
#include <string>
#include <stdlib.h>
#include <cmath>
using namespace std;

int c2(int n){
  if(n == 1) return 0;
  else if (n ==2) return 1;
  else return (n*(n-1)/2);
}

int main() {
  int n,m;

  cin >> n >> m;
  cout << (c2(n)+c2(m));

}

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

#define PI 3.1415926535897932384626
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,a,b) for(i=a;i<b;i++)
#define ll long long
#define pb push_back
#define popb pop_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define mod 1000000007

using namespace std;

typedef pair<int, int>	pi;
typedef pair<int,pi>    pii;
typedef pair<ll, ll>	pl;
typedef pair<ll,pl>     pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pi>		vpi;
typedef vector<pii>     vpii;
typedef vector<pl>		vpl;
typedef vector<pll>     vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const ll INF=(ll)1e18+5;

void min_self(ll &a,ll b){
	a=min(a,b);
}
void max_self(ll &a,ll b){
	a=max(a,b);
}



void solve(){
	
	ll n,w,valSum,i,weight_already;
	
	cin>>n>>w;
	
	ll val[n],weight[n];
	for(i=0LL;i<n;i++){
		cin>>weight[i]>>val[i];
	}
	//valSum=accumulate(val,val+n,0);

	// dp[i]="max value sum" with total weight exactly equal to i
	vl dp(w+1,0);
	//dp[0]=0;
	for(i=0LL;i<n;i++){
		for(weight_already=w-weight[i];weight_already>=0;weight_already--){
			max_self(dp[weight_already+weight[i]],dp[weight_already]+val[i]);
		}
	}
	ll ans=0LL;
	for(i=0LL;i<=w;i++){
	//	cout<<dp[i]<<" ";
			ans=max(ans,dp[i]);
	}
	cout<<ans;



}



int main(){

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

	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
return 0;
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
 
const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

ll kai[200001];
ll mokai[200001];

ll mod_pow (ll x, ll y) {
    ll ret = 1;
    while (y) {
        if (y&1) ret = ret*x%MOD;
        x = x*x%MOD;
        y /= 2;
    }
    return ret;
}

void init (int _n) {
    kai[0] = 1;
    for (int i = 1; i <= _n; i++) kai[i] = kai[i-1]*i%MOD;
    for (int i = 0; i <= _n; i++) mokai[i] = mod_pow(kai[i],MOD-2);
}

ll conb (ll x, ll y) {
    ll z = x-y;
    ll ret = kai[x]*mokai[y]%MOD;
    ret = ret*mokai[z]%MOD;
    return ret;
}

ll b, w;

int main() {
    bool f = false;
    init(200000);
    cin >> b >> w;
    if (w < b) {
        swap(b,w);
        f = true;
    }
    rep(i,b) {
        cout << 1LL * mod_pow(2,MOD-2) << endl;
    }
    ll val = 1;
    rep(i,b) val = val*2%MOD;

    ll po = val;

    ll ac = 0;

    for (ll i = b; i < b+w; i++) {
        if (i >= w) {
            ac = ac*2%MOD;
            ac = (ac + conb(i,i-w))%MOD;
        }
        po = po*2%MOD;
        ll xval = (val - conb(i,b) + MOD) % MOD;
        xval = (xval+ac)%MOD;
        /*
        if (i >= w) {
            xval = (xval+conb(i,i-w)+MOD)%MOD;
        }
        */
        if (!f) {
            cout << xval*mod_pow(po,MOD-2)%MOD << endl;
        } else {
            ll tval = (po-xval+MOD)%MOD;
            cout << tval*mod_pow(po,MOD-2)%MOD << endl;
        }
        val = val * 2 % MOD;
        if (i >= w) {
            val = (val-conb(i,i-w)+MOD)%MOD;
        }
        val = (val-conb(i,b)+MOD)%MOD;
    }
}



Measured memory_bytes: 5376
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
Volume0-0003
=end
def righttriangle(a,b,c)
  f = [a,b,c]
  mx = f.max
  f.delete_at(f.index(mx))
  f.inject(0){|acc,x| acc + x*x} == mx * mx
end

class Main
  def initialize
    fh=STDIN
    n = fh.gets.to_i
    while fh.gets do
      a,b,c = $_.split.map{|x| x.to_i}
      puts righttriangle(a,b,c) ? "YES" : "NO" 
    end
  end

end

if $0 == __FILE__ then
  Main.new
end

Measured memory_bytes: 8784
import math

# N = int(input())
# A = list(map(int, input().split()))
A, B = map(int, input().split())


def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


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


def is_prime(n):
    if n == 1:
        return True

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


print(sum([is_prime(n) for n in make_divisors(gcd(A, B))]))


Measured memory_bytes: 3316
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int h, w; cin >> h >> w;
  string S[h]; bool red[h][w] = {}, blue[h][w] = {};
  rep(i, h){
    cin >> S[i];
  }
  rep(i, h){
    red[i][0] = true;
  }
  rep(i, h){
    blue[i][w-1] = true;
  }
  rep(i, h){
    for(int j=1; j<=w-2; j++){
      if(i%2) blue[i][j] = true;
      else red[i][j] = true;
    }
  }
  rep(i, h){
    rep(j, w){
      if(S[i][j]=='#'){
        blue[i][j] = true; red[i][j] = true;
      }
    }
  }
  rep(i, h){
    rep(j, w){
      if(blue[i][j]) cout << '#';
      else cout << '.';
    }
    cout << endl;
  }
  cout << endl;
  rep(i, h){
    rep(j, w){
      if(red[i][j]) cout << '#';
      else cout << '.';
    }
    cout << endl;
  }
}

Measured memory_bytes: 1536
#include <cstdio>
#include <iostream>

using namespace std;

int main() {

	int INF = 2000000001;

	int n;
	scanf("%d", &n);

	int H[n + 1];
	for (int i = 1; i <= n; ++i)
		H[i] = INF;

	for (int i = 1; i <= n; ++i) {
		int key;
		scanf("%d", &key);
		H[i] = key;
	}
	for (int i = 1; i <= n; ++i) {
		cout << "node " << i << ": key = " << H[i] << ", ";
		//parent
		if (i != 1)
			cout << "parent key = " << H[i / 2] << ", ";
		//left
		if (i * 2 <= n)
			cout << "left key = " << H[i * 2] << ", ";
		//right
		if (i * 2 + 1 <= n)
			cout << "right key = " << H[i * 2 + 1] << ", ";
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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 ll INF = 1LL<<60;
const ll M = pow(10,9)+7;
/*template*/

int main()
{
  ll n,k;cin>>n>>k;
  ll ans=0;
  for(ll i=k;i<=n+1;i++){
    ll max=i*(n+n+1-i)/2;
    ll min=i*(0+i-1)/2;
    ans+=max+1-min;
    ans%=M;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;

int N, A, B, C[10000], SUM = 0, COUNT = 0, X[10000];
vector<int> R[10000];

void DFS(int A, int B) {
	X[A] = C[COUNT];
	for (int C : R[A]) {
		if (C != B) {
			COUNT++;
			DFS(C, A);
		}
	}
}

int main() {
	cin >> N;
	for (int i = 0; i < N - 1; i++) {
		cin >> A >> B;
		A--, B--;
		R[A].push_back(B);
		R[B].push_back(A);
	}
	for (int i = 0; i < N; i++) cin >> C[i], SUM += C[i];
	sort(C, C + N, greater<int>());
	cout << SUM - C[0] << endl;
	DFS(0, -1);
	for (int i = 0; i < N; i++) {
		if (i != 0) cout << " ";
		cout << X[i];
	}
}

Measured memory_bytes: 1408
#include<iostream>
using namespace std;
const int N=2e3+10;
int x[N][N],y[N][N];
string a[N];
int n,m;
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(a[i][j-1]=='#') continue;
			x[i][j]=x[i-1][j]+1;
			y[i][j]=y[i][j-1]+1;
		}
	}
	for(int i=n;i>=1;i--){
		for(int j=m;j>=1;j--){
			if(a[i][j-1]=='#') continue;
			x[i-1][j]=max(x[i-1][j],x[i][j]);
			y[i][j-1]=max(y[i][j-1],y[i][j]);
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			ans=max(x[i][j]+y[i][j]-1,ans);
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 35968
#include<iostream>
using namespace std;
int calc_num(int n){
  int num=0;
  while(n!=0){
    num+=n%10;
    n/=10;
  }
  return num;
}
int main(){
  int n,min=0,num;
  cin >> n;
  min=n;
  for(int i=1;i<n;i++){
    num=calc_num(i)+calc_num(n-i);
    if(num<min){
      min = num;
    }
  }
  cout << min << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>

using namespace std;

int main(){
	int n,p;
	cin >> n >> p;
	int tmp;
	long long a[2]={};
	for(int i=0;i<n;i++){
		cin >> tmp;
		a[tmp%2]+=1;
	}
	long long ans= 1;
	for(int i=0;i<a[0];i++){
		ans *= 2;
	}
	long long com[51][51]={};
	com[0][0]=1;
	for(int i=0;i<51;i++){
		com[i][0] = 1;
		com[i][i] = 1;
	}
	for(int i=2;i<51;i++){
		for(int j=1;j<i;j++){
			com[i][j] = com[i-1][j-1]+com[i-1][j];
		}
	}
	if(p==0){
		long long x=0;
		for(int i=0;i<=a[1];i+=2){
			x += com[a[1]][i];
		}
		cout << ans * x  << endl;
	}
	if(p==1){
		long long x=0;
		for(int i=1;i<=a[1];i+=2){
			x += com[a[1]][i];
		}
		cout << ans * x  << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<numeric>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(lli i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
 
int main(void){
	int n, k; cin >> n >> k;
	vector<int> a(n), b(n, 0), c(n, 0);
	rep(i, n){
		cin >> a[i];
		if(a[i] > 0) b[i] = a[i];
		else c[i] = -a[i];
	}

	lli t = accumulate(b.begin(), b.begin()+k, 0LL);
	lli s = accumulate(c.begin(), c.begin()+k, 0LL);
	
	lli ans = min(t, s);
	
	rep(i, n-k+1){
		t = t+b[k+i]-b[i];
		s = s+c[k+i]-c[i];
		ans = min(ans, min(t, s));
	}
	
	cout << accumulate(b.begin(), b.end(), 0ll) - ans << endl;
	
	return 0;
}

Measured memory_bytes: 1408
using System;

class MyClass
{
    public static void Main(string[] args)
    {
        var W = Console.ReadLine();
        var num = 0;
        while (true)
        {
            var str = Console.ReadLine();
            if (str == "END_OF_TEXT")
            {
                break;
            }
            var list = str.ToLower().Split();
            foreach (var item in list)
            {
                if (item == W)
                {
                    num++;
                }
            }
        }
        Console.WriteLine(num);
    }
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)

string S;

int main() {
    cin >> S;
    if (S == "AAA" || S == "BBB") cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 768
h,w = map(int,input().split())
a = [list(map(int,input().split())) for i in range(h)]
b = [list(map(int,input().split())) for i in range(h)]
grid = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w):
    grid[i][j] = abs(a[i][j]-b[i][j])
dp = [[0 for j in range(w)] for k in range(h)]
buf = (h+w)*80
for i in range(h):
  for j in range(w):
      t = grid[i][j]
      if i == j == 0:
        dp[i][j] = 1 << buf+t | 1 << buf-t
      if j > 0:
        dp[i][j] = dp[i][j] | dp[i][j-1] << t | dp[i][j-1] >> t
      if i > 0:
        dp[i][j] = dp[i][j] | dp[i-1][j] << t | dp[i-1][j] >> t
for i in range(buf):
  if (dp[h-1][w-1] & 1 << buf+i) or (dp[h-1][w-1] & 1 << buf-i):
    print(i)
    exit()


Measured memory_bytes: 58588
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();
        if (A==B) {
            System.out.println(C);
        } else if (B==C) {
            System.out.println(A);
        } else if (A==C){
            System.out.println(B);
        }
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
// #include <sys/types.h> 
// #include <unistd.h> 
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=1e7+5;
ld dis(ld x1,ld y1,ld x2,ld y2)
{
  ld ans=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  return ans;
}
int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);

      int n;
      cin>>n;
      ld x[n],y[n];
      for(int i=0;i<n;i++) cin>>x[i]>>y[i];
      vector<ld> a(n);
      for(int i=0;i<n;i++) a[i]=i;
        sort(all(a));
      ld s=0;
      ld cnt=0;
      do{
        for(int i=0;i<n-1;i++)
        {
          int ii=a[i];
          int jj=a[i+1];
          s+=dis(x[ii],y[ii],x[jj],y[jj]);
        }
        cnt++;
      }while(next_permutation(all(a)));
      s/=cnt;
      cout<<fixed<<setprecision(10)<<s;
}
// I never lose. I either win or I learn

Measured memory_bytes: 256
#include<iostream>
#define LEG 101

using namespace std;

int main(void){

	char str[101]={'\0'},decoStr[101]={'\0'};
	
	while(cin>>str){
		
		for(int i=0,j=0;j<101;){
			
			if(str[i]=='@'){
				
				for(int k=j;j<(k+(str[i+1]-'0'));j++){
					decoStr[j]=str[i+2];
				}
				
				i=i+3;
			}
			else{
				decoStr[j]=str[i];
				
				j++;
				i++;
			}
		}
		cout<<decoStr<<endl;
		
		fill(str,str+LEG,'\0');
		fill(decoStr,decoStr+LEG,'\0');
	}
}

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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    int n;
    cin >> n;
    vector<ll> t(n);
    ll ans = 1;
    rep(i,n)
    {
        cin >> t[i];
        ans = lcm(ans, t[i]);
    }
    cout <<ans << endl;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    s=input()
    x=0
    ans=0
    for i in range(n):
        if s[i]=='I':
            x+=1
            ans=max(ans,x)
        else:
            x-=1
    print(ans)
resolve()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define nl ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
#define pi acos(-1)

using namespace std;

int main() {
    nl // Bazzi - Paradise

    string s;
    cin >> s;

    if(s == "RSR") {
        cout << 1; return 0;
    }

    int cnt = 0;

    for(auto x : s) {
        if(x == 'R') cnt++;
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define fo(i,a,n) for (i = a; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;


void solve(){
    string s;
    cin>>s;
    f(i,2)if(s[i] != s[i+1]){cout<<"Yes\n";return ;}
    cout<<"No\n";
}

int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {

    void solve() throws IOException {
        long n = nl();
        out.println(f(n));
    }

    long MOD = 1000000007;
    HashMap<Long, Long> memo = new HashMap<>();

    long f(long s) {
        if (s == 0) return 1;
        if (s == 1) return 2;

        if (memo.containsKey(s)) return memo.get(s);

        long ret = (f(s / 2) + f((s - 1) / 2) + f((s - 2) / 2)) % MOD;
        memo.put(s, ret);
        return ret;
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    class INA {
        int[][] a;

        INA(int n, int m) throws IOException {
            this(n, m, -1);
        }

        INA(int n, int m, int t) throws IOException {
            a = new int[m][n];

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    a[j][i] = ni() + t;
                }
            }
        }

        int[] get(int i) {
            return a[i - 1];
        }
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 8324
#include <stdio.h>
#include <math.h>

int main(void)
{
    int A, B, H, M;

    scanf("%d %d %d %d", &A, &B, &H, &M);

    double H_x, H_y;
    double M_x, M_y;
    double length;

    H_x = A * cos((H*360/12.0) * (2*M_PI/360.0) + (1*(M/60.0)*360/12.0) * (2*M_PI/360.0));
    H_y = A * sin((H*360/12.0) * (2*M_PI/360.0) + (1*(M/60.0)*360/12.0) * (2*M_PI/360.0));

    M_x = B * cos((M*360/60.0) * (2*M_PI/360.0));
    M_y = B * sin((M*360/60.0) * (2*M_PI/360.0));

    length = sqrt((M_x - H_x)*(M_x - H_x) + (M_y - H_y)*(M_y - H_y));

    printf("%.10f\n", length);

    return 0;
}

Measured memory_bytes: 2384
#include <iostream>
using namespace std;
int main() {
  int a,b,c;
  cin >> a>>b>>c;
  int sum=a+b+c;
  if(sum<=21){
  	cout << "win" << endl;  
  }else{
  	cout << "bust" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    int a[1005],n,k,tot=0;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    for(int i=1;i<=k;i++)
        tot+=a[i];
    cout<<tot;
    return 0;
}



Measured memory_bytes: 3616
//adjacency list
//adj[i] contains all neighbors of i
#include <bits/stdc++.h>
using namespace std;
#define N 100005
#define maxn 1000000007
#define ll long long
vector<ll> adj[N];
ll mul(ll x, ll y)
{
  if(x*y < maxn)return x*y;
  else return (x*y)%maxn;
}
ll add(ll x, ll y)
{
  if(x+y < maxn)return x+y;
  return (x+y)%maxn;
}
//functions as defined above
ll dp1[N],dp2[N];

//pV is parent of node V
void dfs(ll V, ll pV){

    //for storing sums of dp1 and max(dp1, dp2) for all children of V
    ll sum1=1, sum2=1;

    //traverse over all children
    for(auto v: adj[V]){
    if(v == pV) continue;
    dfs(v, V);
    sum1 =mul(sum1, dp2[v]);
    sum2 = mul(sum2,dp1[v]+ dp2[v]);
    }

    dp1[V] =  sum1;
    dp2[V] = sum2;
}

int main(){
    ll n,u,v;
    cin >> n;

    for(ll i=1; i<n; i++){
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    }

    dfs(1, 0);
    ll ans = add(dp1[1], dp2[1]);
    cout << ans << endl;
}


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

using namespace std;

int main()
{
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < 6; i++) {
		if (s[i] == '1') {
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
package main

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

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

var sc = bufio.NewScanner(os.Stdin)

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

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

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)

	s := getString()
	K := getInt()
	sub := make([]string, 0)
	for i := 0; i < len(s); i++ {
		n := min(i+7, len(s))
		for j := i + 1; j <= n; j++ {
			sub = append(sub, s[i:j])
		}
	}

	sort.Strings(sub)
	prev := ""
	cnt := 0
	for _, v := range sub {
		if v == prev {
			continue
		}
		prev = v
		cnt++
		if cnt == K {
			break
		}
	}
	out(prev)
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
#define N 100005
#define INF 1<<30
#define LL long long

LL n,a,b;
LL h[N];

bool ok(LL x)
{
	LL sum=0;
	for(int i=0;i<n;i++)
		if(h[i]-x*b>0) sum+=(h[i]-x*b+a-b-1)/(a-b);
	if(sum>x) return 0;
	return 1;
}

int main()
{
	
	cin>>n>>a>>b;
	for(int i=0;i<n;i++)
		cin>>h[i];
	
	LL l=0,r=INF,mid;
	while(l<=r)
	{
		mid=(l+r)/2;
		if(ok(mid)) r=mid-1;
		       else l=mid+1;
	}
	if(ok(mid)) cout<<mid<<'\n';
	       else cout<<mid+1<<'\n';
	
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  string s; cin >> s;
  int k; cin >> k;

  string t = s;
  int n = s.size();
  for(int i = 0; i < n; i++){
    if(s[i] == 'a') continue;
    if('z' - s[i] + 1 <= k){
      t[i] = 'a';
      k -= 'z' - s[i] + 1;
    }
  }
  if(k > 0){
    t[n-1] += k%26;
    if(t[n-1] > 'z') t[n-1] -= 26;
  }
  cout << t << endl;

  return 0;
}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
//Main
public class Main {

	public static void main(String[] args) {
		FastScanner sc=new FastScanner();
		long n=sc.nextInt(), x=sc.nextInt(), t=sc.nextInt();
		System.out.println((n+x-1)/x*t);
	}

	static final Random random=new Random();
	
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

	
}


Measured memory_bytes: 32736
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
#define ll long long
#define pb push_back

int main()
{
    int n,j=0;
    vector<int> x(20);

    while (1)
    {
        cin >> n;
        if (n == 0)
        {
            break;
        }
        int score;
        int sum = 0, max = 0, min = 1000;
        for (int i = 0;i<n;i++)
        {
            cin >> score;
            if(max <  score){
                max = score;
            }
            if(min > score){
                min = score;
            }
            sum += score;
        }
        sum = sum - max - min;
        // cout << sum <<  " max:" << max << " min:" << min << endl;
        x[j] = sum/(n-2);
        j++; 
    }
    for(int i=0;i<j;i++){
        cout << x[i] << endl;
    }
}



Measured memory_bytes: 3080
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <random>
#include <bitset>
#include <time.h>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
//#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define sp system("pause")
#define queuel queue<long long>
#define all(x) (x).begin(),(x).end()
#define matrix vector<vector<ll>>
#define pin(p) cin >> p.first >> p.second;
#define rev(v) reverse(v.begin(),v.end());
#define mx(v) max_element(v.begin(), v.end());
#define mn(v) min_element(v.begin(), v.end());
#define sout(s, c) for(auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for(ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vout(v, c) for(int i = 0; i < v.size(); ++i) cout << v[i] << c;
#define pushi(v, a) for(int i = 0; i < a.size(); ++i) v.push_back(a[i]);
#define sin(s, n) for(int i = 0; i < n; ++i){int a; cin >> a; s.insert(a);}
#define fastio() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL));
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const ll INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 1000;
const int inf = 1000 * 1000 * 1000;
const ld PI = acos(-1.0);
const ll mod1 = inf + 7;
const ll mod2 = inf + 9;
const int MAXN = 500001;
const ld EPS = 1e-9;
int hp = 179;

signed main()
{
	fastio();
	int n;
	cin >> n;
	cout << (n / 2) * (n - n /2) ;
	system("pause");
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll dp[2222][2222];
ll lis[222222];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  vi S(n),T(m);
  for(auto &a:S)cin>>a;
  for(auto &a:T)cin>>a;
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      if(S[i]==T[j]){
	dp[i+1][j+1]=dp[i+1][j]+dp[i][j+1]+1;
	dp[i+1][j+1]%=MOD;
      }else{
	/*if(lis[T[j]]){
	  dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]+lis[T[j]]);
	  dp[i+1][j+1]%=MOD;
	  }else{
	  dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
	  dp[i+1][j+1]%=MOD;
	  }
	*/
	dp[i+1][j+1]=dp[i+1][j]+dp[i][j+1]-dp[i][j];
	dp[i+1][j+1]+=MOD;
	dp[i+1][j+1]%=MOD;
      }
    }
    lis[S[i]]++;
  }
  /* for(int i=0;i<=n;i++){
    for(int j=0;j<=m;j++)
      cout<<dp[i][j]<<" ";
    cout<<endl;
    }*/
  cout<<dp[n][m]+1<<endl;
  return 0;
}


Measured memory_bytes: 35456
#include <iostream>
#include <vector>
 
using namespace std;
 
typedef vector<int> VI;
 
int main ( void )
{
int n, r;
while ( cin >> n >> r, n | r ) {
VI cards( n );
for ( int i = 0; i < n; ++i ) {
cards[i] = n - i;
}
for ( int i = 0; i < r; ++i ) {
VI t( cards );
int p, c;
cin >> p >> c;
for ( int j = 0; j + 1 < p; ++j ) { // pの束を移動
t[c + j] = cards[j];
}
for ( int j = 0; j < c; ++j ) { // cの束を移動
t[j] = cards[p - 1 + j];
}
cards = t;
}
cout << cards[0] << endl;
}
return 0;
}

Measured memory_bytes: 1220
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s, i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = s, i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = s; i < (n); ++i)
#define VFORS(i, s, n) for(int i = s; i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = s, i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = s, i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end());

using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;

const int MOD = 1000000007;
const int INF = 1000000000;

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


int main(){
    int n; cin >> n;
    vector<int> c(n-1), s(n-1), f(n-1);
    REP(i, n-1) cin >> c[i] >> s[i] >> f[i];
    REP(i, n){
        int t = 0;
        FOR(j, i, n-1){
            if(t < s[j]) t = s[j];
            else t = (t+f[j]-1) /f[j] * f[j];
            t += c[j];
        }
        cout << t << "\n";
    }
    return 0;
}


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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ll long long

using namespace std;

const int MAXN = 100010;
ll sum1[MAXN], sum2[MAXN];
ll arr[MAXN];
int n, k;

ll val1(int a, int b) {
  ll out = sum1[b];
  if (a) out -= sum1[a - 1];
  return out;
}

ll val2(int a, int b) {
  ll out = sum2[n - 1] - sum2[b];
  if (a) out += sum2[a - 1];
  return out;
}

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

  cin >> n >> k;
  REP(i, n) cin >> arr[i];

  sum1[0] = arr[0];
  sum2[0] = max(0LL, arr[0]);
  FOR(i, 1, n) {
    sum1[i] = sum1[i - 1] + arr[i];
    sum2[i] = sum2[i - 1] + max(0LL, arr[i]);
  }

  ll out = 0;
  REP(i, n - k + 1) {
    int j = i + k - 1;
    out = max(out, val2(i, j) + max(0LL, val1(i, j)));
  }
  cout << out << "\n";

  return 0;
}

Measured memory_bytes: 2560
#include"bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
const long long mod = 1000000007;
int dp[302][302][302];
signed main() {
	int n, m; cin >> n >> m;
	dp[0][1][1] = 1;
	rep(i, m) {
		for (int j = 1; j <= n; j++) {
			for (int k = 1; k <= n; k++) {
				if (!dp[i][j][k])continue;
				if (j != n) {
					dp[i + 1][j + 1][k] += dp[i][j][k]*(n-j);
					dp[i + 1][j + 1][k] %= mod;
				}
				dp[i + 1][j][j] += dp[i][j][k] * k;
				dp[i + 1][j][j] %= mod;
				if (j != k) {
					dp[i + 1][j][k] += dp[i][j][k] * (j-k);
					dp[i + 1][j][k] %= mod;
				}
			}
		}
	}

	cout << dp[m][n][n] << endl;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MAX=100005;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,n){cout<<arr[i][j]<<" ";}cout<<endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    map<string,string>mp;
    mp["A"]="T";
    mp["C"]="G";
    mp["G"]="C";
    mp["T"]="A";
    cout<<mp[s]<<endl;
    return  0;
}


Measured memory_bytes: 256
import math

n = int(input())


def ts(x):
    return x * (x + 1)


m = n
for i in range(math.ceil(math.sqrt(2 * n) - 2), math.floor(math.sqrt(2 * n)) + 1, 1):
    if ts(i) < 2 * n <= ts(i + 1):
        m = i + 1
        break



if m % 2 == 0:
    a = n % (m + 1)
    b = n // (m + 1)
    if a != 0:
        print(a)
    i = 1
    c = 0
    while c != b:
        if i != a and m + 1 - i != a:
            print(i)
            print(m + 1 - i)
            c += 1
        i += 1
else:
    """
  check=[]
  if a!=0:
      check.append(a)
  i = 1
  c = 0
  while c!=b and i<(m+1)//2:
      if i!=a and m+1-i!=a:
          check.append(i)
          check.append(m+1-i)
          c+=1
      i+=1
  if c==b:
      for i in check:
          print(i)
  else:

      n-=(m+1)//2
      a = n % (m + 1)
      b = n // (m + 1)
      if m % 2 == 0:
          if a != 0:
              print(a)
          i = 1
          c = 0
          while c != b:
              if i != a and m + 1 - i != a:
                  print(i)
                  print(m + 1 - i)
                  c += 1
      """
    print(m)
    n -= m
    m -= 1

    a = n % (m + 1)
    b = n // (m + 1)
    if a != 0:
        print(a)
    i = 1
    c = 0
    while c != b:
        if i != a and m + 1 - i != a:
            print(i)
            print(m + 1 - i)
            c += 1
        i += 1

Measured memory_bytes: 9268
#include <iostream>
#include <vector>
#include <string>

using namespace std;

long long n, s;
long long ans = 1e18;

void check(long long b)
{
    if (b == 1) return;
    long long x = n, y = 0;
    while (x > 0)
    {
        y += x % b;
        x /= b;
    }
    if (y == s)
        ans = min(ans, b);
}

int main()
{
    cin >> n >> s;
    long long r = n - s;
    if (r < 0)
        cout << -1, exit(0);
    if (r == 0)
        cout << n + 1, exit(0);
    for (long long i = 1; i * i <= r; i++)
    {
        if (r % i == 0)
        {
            check(i + 1);
            check(r / i + 1);
        }
    }
    if (ans == 1e18)
        cout << -1, exit(0);
    else
        cout << ans;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


void solve() {
    int i,j,k,l,r,x,y,w,n; string S;
    bool exit = false;
    cin>>S>>w;
    if(S.size()%w==0)
        n = S.size() / w;
    else
        n = S.size() / w + 1;

    FOR(i,n)
        cout<<S[i*w];
    cout<<endl;
    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}




Measured memory_bytes: 256
/*input
1 2 3 6
*/

//code author: iamxlr8

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

#define ll long long
#define endl "\n"
#define pb push_back
#define all(c) c.begin(),c.end()
#define hell 1000000007
#define inf 100000000000001
#define F first
#define S second
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

void solve()
{
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k>a)
		k-=a;
	else
	{
		cout<<k;
		return;
	}
	if(k>b)
		k-=b;
	else
	{
		cout<<a;
		return;
	}
	cout<<a-k;
}

int main() 
{
    off;
    ll tests=1;
    // cin>>tests;
    while(tests--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
import sys
from collections import defaultdict

n, v = map(int, sys.stdin.readline().split())
a = tuple(map(int, sys.stdin.readline().split()))
b = tuple(map(int, sys.stdin.readline().split()))
c = tuple(map(int, sys.stdin.readline().split()))
d = tuple(map(int, sys.stdin.readline().split()))
mp = defaultdict(int)
for val1 in c:
    for val2 in d:
        mp[val1 + val2] += 1
print(sum(mp[v - val1 - val2] for val1 in a for val2 in b))


Measured memory_bytes: 179180
#include<cstdio>
#include<cstring>
#include<algorithm>
const int maxn=410;
typedef long long ll;
int n,c;
const ll MOD=1e9+7;
ll a[maxn],b[maxn],f[maxn][maxn];
ll pwr[maxn][maxn],pre[maxn][maxn];
void preload()
{
    pre[0][0]=1;
    for(int i=1;i<=400;i++)
    {
        pwr[i][0]=1;
        for(int j=1;j<=400;j++)
        {
            pwr[i][j]=(pwr[i][j-1]%MOD*i)%MOD;
        }
    }
    for(int i=1;i<=400;i++)
    {
        pre[i][0]=1;
        for(int j=0;j<=400;j++)
        {
            pre[i][j]=(pwr[i][j]+pre[i-1][j])%MOD;
        }
    }
}
int main()
{
    preload();
    scanf("%d%d",&n,&c);
    for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
    for(int i=1;i<=n;i++) scanf("%lld",&b[i]);
    f[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=c;j++)
        {
            for(int k=0;k<=j;k++)
            {
                ll tmp=((pre[b[i]][k]-pre[a[i]-1][k])%MOD+MOD)%MOD;
                f[i][j]=(f[i][j]+f[i-1][j-k]*tmp)%MOD;
            }
        }
    }
    printf("%lld",f[n][c]);
}


Measured memory_bytes: 4096
N = gets.to_i
dist = Hash.new { |h, k| h[k] = 0 }
cnt = 0

N.times { dist[gets.chomp.chars.sort.join] += 1 }

dist.each do |k, v|
  next unless v > 1
  cnt += v * (v - 1) / 2
end

p cnt

Measured memory_bytes: 17020
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

int main()
{
    ciosup;
    int n;
    cin>>n;
    vint a(n + 1), b(n);
    REP(i, n + 1) { cin >> a[i]; }
    REP(i, n) { cin >> b[i]; }

    ll ans = 0;
    REP(i, n)
    {
        if (a[i] >= b[i]){
            ans += b[i];
        }else{
            ans += a[i];
            if (a[i+1] >= (b[i]-a[i])){
                a[i + 1] -= (b[i] - a[i]);
                ans += b[i] - a[i];
            }
            else
            {
                ans += a[i + 1];
                a[i + 1] = 0;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
x,k,d = map(int,input().split())


x=abs(x)
if k*d<=x:
    print(x-k*d)
else:
    tem = int(x/d)
    x-= tem*d
    k-= tem
    if k%2==0:
        print(x)
    else:
        print(abs(x-d))


Measured memory_bytes: 9068
#include<iostream>
#include<math.h>

using namespace std;

long calc(long m){
  int num_pair = (m+1)/2;
  if (m % 2 == 1){
    return (1+int(pow(-1,num_pair+1)))/2;
  }else{
    return m ^ (1+int(pow(-1,num_pair+1)))/2;
  }
}

int main(){
  long m, n;
  cin >> m >> n;
  if(m>0) m--;
  cout << (calc(m) ^ calc(n)) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) 
{
    int a, b, sum, cnt;
    while(scanf("%d%d", &a, &b) != EOF){
        cnt = 0;
        sum = a + b;
        while (sum > 0) {
            sum /= 10;
            cnt++;
        }   
        printf("%d\n", cnt); 
    }   

    return 0;
}



Measured memory_bytes: 2044
#include<iostream>
using namespace std;
int main(){
int a;
cin>>a;
if(a==7){
cout<<"YES"<<endl;
}
else if(a==3){
cout<<"YES"<<endl;
}
else if(a==5){
cout<<"YES"<<endl;
}
else
cout<<"NO"<<endl;
return 0;
}

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

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> a(n);
  for(int i = 0; i < n; i ++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());

  int count = 0;
  for (int i = 0; i < n; i ++) {
    if (i == n - 1 && x != a.at(n - 1)) {
      break;
    } else if (x >= a.at(i)) {
      x -= a.at(i);
      count ++;
    } else {
      break;
    }
  }

  cout << count << endl;
}


Measured memory_bytes: 256
/*
    Sk arman Hossain
    University of Barisal

    Problem name :
    Algorithm :
 */
#include<bits/stdc++.h>
#define nl printf("\n");
#define N 200001
#define PR pair<ll,ll>
#define sf1(n) scanf("%lld", &n)
#define sf2(n, m) scanf("%lld %lld",&n,&m)
#define sf3(n, m,k ) scanf("%lld %lld %lld",&n,&m,&k)
#define pfn(n) printf("%d\n",n)s
#define pf1(n) printf("%d ",n)
#define pfl1(n) printf("%lld ",n)
#define pfln(n) printf("%lld\n",n)
#define pfu(n) printf("%llu\n",n)
#define pfs(s) printf("%s",s)
#define YES printf("YES\n")
#define NO printf("NO\n")
#define minus1 printf("-1\n")
#define PB push_back
#define PI 3.1415926536
#define VST(v) sort(v.begin(),v.end())
#define VSTcmp(v,cmp) sort(v.begin(),v.end(),cmp)
#define fori(i,n) for(;i<n;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define MP make_pair
#define ff first
#define ss second
#define tt third
#define mod 1000000007
#define T(n) printf("test %d\n",n)
int dx[] = {0,0,1,-1,2,2,-2,-2,1,-1,1,-1};
int dy[] = {1,-1,0,0,1,-1,1,-1,2,2,-2,-2};
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
vector<ll>V,V2,V3;
ll ar[300000];
int main()
{
    ll tcase=1;
    for(ll test=1; test<=tcase; test++)
    {
        memset(ar,0,sizeof(ar));
        V.clear();
        ll n;
        sf1(n);
        for(ll i=0;i<n;i++){
            ll a;
            sf1(a);
            ar[a]++;
            V.PB(a);
        }
        ll ans=0;
        for(ll i=0;i<=200000;i++){
            if(ar[i]){
                ll tm=ar[i];
                tm=(tm*(tm-1))/2;
                ans+=tm;
            }
        }
        for(ll i=0;i<n;i++){
            ll tm=ans;
            ll x=ar[V[i]];
            tm-=(x*(x-1))/2;
            x--;
            tm+=(x*(x-1))/2;
            printf("%lld\n",tm);
        }
    }
///*****************************  ALHAMDULILLAH  *****************************/
}


Measured memory_bytes: 6640