akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(){
    int n;
    scanf("%d",&n);
    int n10=0;
    int tmp=n;
    int nleft,nright;
    nright=n%10;
    while(tmp!=0){
        nleft=tmp;
        tmp=tmp/10;
        n10++;
    }
    unsigned long num=0;
    for(int i=1;i<n+1;i++){
        int left=i;
        int right=left%10;
        while(left/10!=0){
            left=left/10;
        }
        if(left!=0&&right!=0){
            for(int j=1;j<n10;j++){
                if(j==1){
                    if(left==right)num++;
                }else if(j==2){
                    num++;
                }else{
                    tmp=1;
                    for(int k=0;k<j-2;k++){
                        tmp=tmp*10;
                    }
                    num=num+tmp;
                }
            }
            if(nleft>right){
                tmp=1;
                if(n10<3){
                    num++;
                }else{
                    for(int j=0;j<n10-2;j++){
                        tmp=tmp*10;
                    }
                    num=num+tmp;
                }
            }else if(nleft==right){
                if(n10>2){
                    tmp=1;
                    for(int j=0;j<n10-2;j++){
                        tmp=tmp*10;
                    }
                    tmp=n/10-nleft*tmp;
                    if(nright<left){
                        num=num+tmp;
                    }else{
                        num=num+tmp+1;
                    }
                }else if(n10==1){
                    num++;
                }else{
                    if(nright>=left)num++;
                }
            }
        }
    }
    printf("%ld",num);
    return 0;
}

Measured memory_bytes: 128
#ABC157E

n = int(input())
s = list(input())
q = int(input())
bits = [[0 for _ in range(n+1)] for _ in range(26)]
sl = []
for alp in s:
	alpord = ord(alp) - 97
	sl.append(alpord)
#print(bits) #test
#print(sl) #test
#print('クエリ開始') #test

def query(pos):
	ret = [0] * 26
	p = pos
	while p > 0:
		for i in range(26):
			ret[i] += bits[i][p]
		p -= p&(-p)
	return ret

def update(pos, a, x):
	r = pos
	while r <= n:
		bits[a][r] += x
		r += r&(-r)

for i in range(n):
	update(i+1, sl[i], 1)
#print(bits) #test

for _ in range(q):
	quer, xx, yy = map(str, input().split())
	if quer == '1':
		x = int(xx)
		y = ord(yy) - 97
		if sl[x-1] == y:
			continue
		else:
			update(x, sl[x-1], -1)
			update(x, y, 1)
			sl[x-1] = y
		#print('クエリ1でした') #test
		#print(bits) #test
		#print(sl) #test
	else:
		x = int(xx)
		y = int(yy)
		cnt1 = query(y)
		cnt2 = query(x-1)
		#print('クエリ2です') #test
		#print(cnt1) #test
		#print(cnt2) #test
		ans = 0
		for i in range(26):
			if cnt1[i] - cnt2[i] > 0:
				ans += 1
		print(ans)

Measured memory_bytes: 253084
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MP make_pair
#define PB push_back
typedef long long ll;

int N, a[100100], n;
pair<int, int> v[100100];

int main () {
        scanf("%d", &N);
        fo(i, 0, N) scanf("%d", &a[i]), v[i] = {a[i], i};
        sort(v, v+N);
        fo(i, 0, N) if ((v[i].second - i) & 1) n++;
        printf("%d\n", n/2);
        return 0;
}


Measured memory_bytes: 1408
from sys import stdin
x = int(stdin.readline().rstrip())
ans = 0
if x <= 6:
    ans = 1
elif x <= 11:
    ans = 2
else:
    ans = (x//11)*2
    if x%11 <= 6:
        ans += 1
        if x%11 == 0:
            ans -= 1
    else:
        ans += 2
    
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <iomanip>
#include <deque>

#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define next next228
#define rank rank228
#define prev prev228
#define y1 y1228                                                         
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define files(FILENAME) read(FILENAME), write(FILENAME)
#define pb push_back
#define x first
#define y second

using namespace std;

const string FILENAME = "input";

int main(int argc, char const *argv[])
{
	int n; cin >> n;
	long long ans = 0;
	for (int i = 0; i < n; i++)
	{
		int x; cin >> x;
		ans += x;
	}
	cout << ans - n << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 998244353LL
#define endl "\n"

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, S;
  cin >> N >> S;
  vll A(N);
  for(ll i = 0; i < N; i++){
    cin >> A.at(i);
  }
  vvll dp(N, vll(S+1, 0));
  dp.at(0).at(0) = 1;
  for(ll i = 0; i < N; i++){
    dp.at(i).at(0) = 1;
  }
  if(A.at(0) <= S) dp.at(0).at(A.at(0)) = 1;
  for(ll i = 1; i < N; i++){
    if(A.at(i) <= S) dp.at(i).at(A.at(i)) = 1;
    for(ll j = 0; j <= S; j++){
      dp.at(i).at(j) += dp.at(i-1).at(j) * 2;
      dp.at(i).at(j) %= MOD;
      if(j + A.at(i) <= S){
        dp.at(i).at(j+A.at(i)) += dp.at(i-1).at(j);
        dp.at(i).at(j+A.at(i)) %= MOD;
      }
    }
  }
  cout << dp.at(N-1).at(S) << endl;
}

Measured memory_bytes: 73600
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
#define lint long long int
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
*/

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	cout << min(A, B) + min(C , D) << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

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

	hs := make([]int, n)
	for i, _ := range hs {
		fmt.Scan(&hs[i])
	}

	var a, b int
	mm := make(map[int]bool)
	for i := 0; i < m; i++ {
		fmt.Scan(&a, &b)
		a--
		b--

		if hs[a] <= hs[b] {
			mm[a] = true
		}
		if hs[a] >= hs[b] {
			mm[b] = true
		}
	}

	ans := 0
	for i := 0; i < n; i++ {
		if !mm[i] {
			ans++
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 8756
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
void Calc(){
	long A = rel();
	long B = rel();
	long C = rel();
	long ans = B + min(A+B+1,C);
	cout << ans << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main{

	private static final long mod =(long)1e9+7;
	public static void main(String[] args) throws Exception  {
	      Scanner  sc=new Scanner(System.in);
	      PrintWriter out=new PrintWriter(System.out);
	      long a=sc.nextLong(),b=sc.nextLong(),c=sc.nextLong(),d=sc.nextLong();
	   long aa[]= {a,b};
	   long bb[]= {c,d};
	   long ans=Long.MIN_VALUE;
	   for(int i=0;i<2;i++) {
	     for(int j=0;j<2;j++) {
	       ans=Math.max(ans,aa[i]*bb[j]*1l);
	     }
	   }
	   out.println(ans);

	    out.flush();
	    }
//	    static long binarySearch(long i,long j,long a[]) {
//	      
//	    }
	
	static boolean vis[]=new boolean[10001];
	      static long gcd(long a, long b) 
	      { 
	          if (a == 0) 
	              return b; 
	          return gcd(b % a, a); 
	      } 
//	    static  void dfs(long n,boolean flag,ArrayList<ArrayList<longeger>> adj,long src,boolean vis[],ArrayList<longeger> centroid,long size[]) {
//	        vis[src]=true;
//	        size[src]=1;
//	        for(long i:adj.get(src)) {
//	          if(vis[i]==false){
//	            dfs(n,flag,adj,i,vis,centroid,size);
//	            size[src]+=size[i];
//	            if(size[i]>n/2) {
//	              flag=false;
//	            }
//	          }
//	        }
//	        if(n-size[src]>n/2) {
//	          flag=false;
//	        }
//	        if(flag==true) {
//	          centroid.add(src);
//	        }
//	    }
//	
//	     
//	      
}

Measured memory_bytes: 35996
/*
  AtCoder Beginner Contest 092
  C - Traveling Plan
*/

#include<iostream>
using namespace std;

int N;
int A[100002];
// B[i]: A[i]とA[i-1]の距離
int B[100002];
// C[i]: A[i]を消すことでどれだけ距離が減るか
int C[100002] = {0};

int main() {
  long long sum = 0;

  scanf("%d", &N);
  A[0] = 0;
  for(int i = 1; i < N + 1; ++i) {
    scanf("%d", &A[i]);
    B[i] = abs(A[i] - A[i-1]);
    sum += B[i];
  }
  A[N+1] = 0;
  B[N+1] = abs(A[N+1] - A[N]);
  sum += B[N+1];

  for (int i = 1; i < N + 1; ++i) {
    printf("%lld\n", sum - (B[i] + B[i+1]) + abs(A[i+1] - A[i-1]));
  }
  return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;


int main() {
    llong n, a, b;

    cin >> n >> a >> b;

    if ((b - a + 1) % 2 == 1) {
        cout << (b - a) / 2 << endl;
    }
    else {
        llong x = (llong)(1e18) + 5;

        x = min(x, max(a - 1, b - 1));
        x = min(x, max(n - a, n - b));
        x = min(x, n - b + (b - a) / 2 + 1);
        x = min(x, a - 1 + (b - a) / 2 + 1);

        cout << x << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
m = 2000003

def MyHash(k,i):
    return (k%m+i*(1+(k%m)))%m

def main():
    n = input()
    T = ['']*2000003
    O = []
    for i in range(n):
        c, k = raw_input().split()
        i = 0
        if c == 'insert':
            k_hashed = hash(k)
            while True:
                j = MyHash(k_hashed,i)
                if T[j] == '':
                    T[j] = k
                    break
                else:
                    i += 1
        else:
            O.append(search(T,k))

    for item in O:
        print item

    return 0


def search(T,k):
    k_hashed = hash(k)
    i = 0
    while True:
        j = MyHash(k_hashed,i)
        if T[j] == k:
            o = 'yes'
            break
        elif T[j] == '':
            o = 'no'
            break
        else:
            i += 1

    return o


if __name__ == "__main__":
    main()

Measured memory_bytes: 84248
object Main extends App{
  import scala.io.StdIn._
  import scala.math._
  val q = readLine().trim().toInt
  for (_ <- 0 until q){
    val (a::b::_) = readLine().trim().split(' ').map(_.toLong).toList
    val sqrt = math.sqrt(a * b).toLong
    println(if (sqrt * (sqrt + 1) < a * b){//
      sqrt * 2 - 1      
    }else if (sqrt * sqrt != a * b) {
      sqrt * 2 - 2
    }else{
      if (a == b) sqrt * 2 - 2
      else sqrt * 2 - 3
    })
  }
}

Measured memory_bytes: 25416
#include <bits/stdc++.h>
using namespace std;
int bit[100000];
int n;
void add(int a,int x){
	while(a<=n){
		bit[a]+=x;
		a+=a&-a;
	}
}
int sum(int a){
	int ans=0;
	while(a){
		ans+=bit[a];
		a-=a&-a;
	}
	return ans;
}
int main(){
	int q;	cin>>n>>q;
	while(q--){
		int c,x,y;	cin>>c>>x>>y;
		if(c==0)	add(x,y);
		else if(c==1)	cout<<sum(y)-sum(x-1)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1548
#include <iostream>
#include <string>
using namespace std;
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200010
#define LIMIT2 500010
#define LIMIT3 1000010
#define INF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef long double ld;
typedef const void cv;
typedef pair<ll,ll> P;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define setpre(n) fixed << setprecision(n)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res *= a; if(mod>=1) res %= mod;
    }
    a *= a; if(mod>=1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
  
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int a[LIMIT2]={0};
  string s;
  
  cin >> n >> k;
  cin >> s;
  m=0;
  rep(i,n-1){
    if(s[i]!=s[i+1]) m++;
  }
  result = n-1-max(m-2*k,0);
  cout << result << endl;
  
  return 0;
}

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

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    
    int left = A + B;
    int right = C + D;
    if (left > right)
        cout << "Left" << endl;
    else if (left == right)
        cout << "Balanced" << endl;
    else if (left < right)
        cout << "Right" << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>

using namespace std;

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;

const int INF = INT_MAX / 4;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); i++ )
#define UREP( i, m, n ) for ( ui i = (ui)( m ); i < (ui)( n ); i++ )
#define EACH( v, c ) for ( __typeof( c.front() ) &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define RALL( c ) (c).rbegin(), (c).rend()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

int main()
{
	while ( true )
	{
		string line;
		getline( cin, line );

		if ( line == "." )
		{
			return 0;
		}

		bool yes = true;
		char c;
		stack<char> st;

		for ( char &c : line )
		{
			if ( c == '(' || c == '[' )
			{
				st.push( c );
			}
			else if ( c == ')' || c == ']' )
			{
				int c2 = ( c == ')' ? '(' : '[' );

				if ( !st.empty() && st.top() == c2 )
				{
					st.pop();
				}
				else
				{
					yes = false;
				}
			}
		}

		if ( yes && st.empty() )
		{
			cout << "yes" << endl;
		}
		else
		{
			cout << "no" << endl;
		}
	}				

	return 0;
}

Measured memory_bytes: 1180
n, m = map(int, input().split())
s = []
c = []
ans = [0 for _ in range(n)]
has_num = [False for _ in range(n)]

for i in range(m):
    S, C = map(int, input().split())
    s.append(S)
    c.append(C)

    if has_num[S - 1] == True and ans[S-1] != C:
        print(-1)
        exit(0)
    has_num[S-1] = True

    ans[S - 1] = C

if ans[0] == 0 and has_num[0] == True and n != 1:
    print(-1)
    exit(0)

if ans[0] == 0 and n != 1:
    ans[0] = 1

maped_ans = map(str, ans)
print(''.join(maped_ans))


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

using namespace std;

int n, m;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >>  n >> m;
    int a, Sum = 0;
    for (int i = 0; i < m; i++)
    {
        cin >> a;
        Sum += a;
    }
    cout << max(-1, n - Sum);
    return 0;
}

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

int main() {
    int K, N;
    int A[220000];

    cin >> K >> N;
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    int rightRes = 0;
    int leftRes = 0;
    int leftMax = 0;
    int rightMax = 0;
    for(int i = 0; i < N; ++i) {
        if (i == N - 1) {
            rightRes += K - A[i] + A[0];

            if (K - A[i] + A[0] > rightMax) {
                rightMax = K - A[i] + A[0];
            }
        } else {
            rightRes += A[i + 1] - A[i];
            if (A[i + 1] - A[i] > rightMax) {
                rightMax = A[i + 1] - A[i];
            }
        }
    }
    for(int i = 0; i < N; ++i) {
        if (i == 0) {
            leftRes += K - A[N-1] + A[0];
            if (K - A[N-1] + A[0] > leftMax) {
                leftMax = K - A[N-1] + A[0];
            }
        } else {
            leftRes += A[i] - A[i - 1];
            if (A[i] - A[i - 1] > leftMax) {
                leftMax = A[i + 1] - A[i];
            }
        }
    }
    rightRes -= rightMax;
    leftRes -= leftMax;

    if (rightRes > leftRes) cout << leftRes << endl;
    else cout << rightRes << endl;


}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define MAX INT_MAX
#define MIN INT_MIN
#define MOD 1000000007
#define FO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
set <int> s;
bool ar[100001];
void seive() {
	ar[0] = ar[1] = true;

	for(int p=2; p*p<=100001; p++) {
		if(ar[p] == false) {
			for(int i=p*p;i<=100001;i+=p)
				ar[i] = true ;
		}
	}

	for(int p=2;p<=100001;p++) {
		if(ar[p] == false)
			s.insert(p);
	}
}
void solve() {
	string s;
	cin >> s;
	int l = s.length();
	for(int i=0;i<l;i++)
		cout << 'x';
	cout << endl;
    return;
}
int32_t main() {
    FO;
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main() {
	int pos[22];
	memset(pos, 0xff, sizeof(pos));

	int n;
	cin>>n;
	long long ans=0;
	int right = -1;
	for (int i=0; i<n; i++) {
		int a; cin>>a;
		for (int p=0; p<20; p++)
			if (a & (1<<p)) {
				right = max(right, pos[p]);
				pos[p] = i;
			}
		ans += i-right;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
sum =0
for i in range(n):
    t = a[i]
    sum += b[t-1]
    if i!=0:
         if a[i]==a[i-1]+1:
             sum += c[a[i-1]-1]
print(sum)

Measured memory_bytes: 3064
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        var n = int.Parse(Console.ReadLine());
        //int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();

        long ans = 0;
        for (int i = 1; i <= n; i++)
        {
            if (i % 3 ==0 || i % 5 ==0)
            {
                //
            }
            else
            {
                ans += i;
            }
        }

        // 出力
        Console.WriteLine(ans);
    }
}

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

#define ll long long
#define ld long double
#define COIN const int
#define ite iterator
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define sz(s) (s).size()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/
const ll mod=1e9+7;
const ll INF=1e18;
/*****************************************************************************/

using namespace std;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	string s; cin >>s;
	if (s[sz(s)-1]=='s') s+="es";
	else s+='s';
	cout <<s;
	return 0;
}
/******************************************************************************
******************************************************************************/


Measured memory_bytes: 3628
import Control.Applicative
import Control.Monad

solve = do
  input <- fmap (read :: String -> Double) . words <$> getLine
  isParallel input

isParallel (x1:y1:x2:y2:x3:y3:x4:y4:y4s) = do
  if x1 == x2 || x3 == x4
    then if (x1 - x2) == (x3 - x4)
            then putStrLn "YES"
            else putStrLn "NO"
    else let s = (y1 - y2) / (x1 - x2) - (y3 - y4) / (x3 - x4)
         in if ((abs s) < 0.0000001)
            then putStrLn "YES"
            else putStrLn "NO"

main = do
  n <- readLn
  replicateM n solve

Measured memory_bytes: 4300
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;


void solve(){
	int h, w;
  cin >> h >> w;
  vector<string>a(h);
  for(int i = 0; i < h; i++)
    cin >> a[i];
  vector<vector<int>>dp(h, vector<int>(w,0));
  dp[0][0] = 1;
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      if(a[i][j] == '#') continue;
      if(i-1 >= 0)
        dp[i][j] = (dp[i][j] + dp[i-1][j]) % MOD;
      if(j-1 >= 0)
        dp[i][j] = (dp[i][j] + dp[i][j-1]) % MOD;
    }
  }
  cout << dp[h-1][w-1] << endl;
}

int main(){
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		int t = 1, tt = 0;
//		cin >> t;
		while(t--){
			//tt++;
			//cout << "Case #" << t << ": ";
			solve();
		}
	return 0;
}


Measured memory_bytes: 8200
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

const long long INF = 1e6+7;
const long long MOD = 1e9+7;
const double PI=acos(-1);

using namespace std;

int main(){
	
	string s;
	cin >> s;
	long long k;
	cin >> k;
	s+=s;
	
	bool f=true;
	for(int i=0;i<s.size()/2;i++){
		if(s[i]==s[i+1])continue;
		f=false;
		break;
	}
	if(f){
		long long ans=s.size()/2*k/2;
		cout << ans << endl;
		return 0;
	}
	
	string t;
	for(int i=0;i<s.size();i++){
		t+=s[i];
		if(s[i]==s[i+1]){
			t+='*';
			i++;
		}
	}
	
	//cout << t << endl;

	long long cnt_first=0;
	for(int i=0;i<t.size()/2;i++){
		if(t[i]=='*')cnt_first++;
	}
	
	long long cnt_second=0;
	for(int i=t.size()/2;i<t.size();i++){
		if(t[i]=='*')cnt_second++;
	}
	
	long long ans=cnt_first+(k-1)*cnt_second;
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e12)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
int main()
{
    int x, n; cin >> x >> n;
    set<int> s;
    int k;
    rep(i, n) {
        cin >> k;
        s.insert(k);
    }

    int dist=0;
    while(1){
        int neg = x-dist;
        int pos = x+dist;
        if(s.find(neg)==s.end()){
            pr(neg);
            return 0;
        }else if(s.find(pos)==s.end()){
            pr(pos);
            return 0;
        }
        dist++;
    }
    return 0;}

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


// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin>>n;
    ll a[n], b[n];
    rep(i,n) cin >> a[i] >> b[i];

    if (n%2==1)
    {
        sort(a, a+n);
        sort (b, b+n);
        cout << b[(n-1)/2] - a[(n-1)/2] + 1 << endl;
    }
    else
    {
        rep(i,n)
        {
            a[i] *= 2;
            b[i] *= 2;
        }
        sort(a, a+n);
        sort (b, b+n);
        ll sita = (a[n/2] + a[n/2-1])/2;
        ll ue = (b[n/2] + b[n/2-1])/2;
        // cout << ue << " " << sita << endl;
        cout << ue - sita  + 1 << endl;
    }


}


Measured memory_bytes: 6772
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<cmath>
#include<assert.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define INF 0x3f3f3f3f
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod=1000000007;
const double PI = acos(-1.0);
const double epsilon = PI / 180.0;//角度转弧度 
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N = 1e6+10, M = 1e6+10;
int n;
int a[N];
int prime[N], f[N];
int main() {
	for(int i = 2;i * i <= 1e6;i++) {
		for(int j = i * 2;j <= 1e6;j += i) {
			prime[j] = 1;
		}
	}
	cin>>n;
	for(int i = 1;i <= n;i++) cin>>a[i];
	int tmp = a[1];
	for(int i = 2;i <= n;i++) {
		tmp = gcd(tmp, a[i]);
	}
	if(tmp != 1) {
		cout<<"not coprime\n";
		return 0;
	}
	for(int i = 1;i <= n;i++) {
		if(a[i] == 1) continue;
		if(!prime[a[i]]) {
			if(f[a[i]]) {
				cout<<"setwise coprime\n";
				return 0;
			}
			f[a[i]] = 1; continue;
		}
		for(int j = 2;j * j <= a[i];j++) {
			if(a[i] % j == 0) {
				if(f[j]) {
					cout<<"setwise coprime\n";
					return 0;
				}
				f[j] = 1;
			}
			for(;a[i] % j == 0;a[i] /= j) {
			}
		}
		if(a[i] != 1) {
			if(f[a[i]]) {
				cout<<"setwise coprime\n";
				return 0;
			}
			f[a[i]] = 1;
		}
		
	}
	cout<<"pairwise coprime\n";
	return 0;
}

Measured memory_bytes: 11648
a, b, c, d = map(int, input().split())

def lcm(m, n):
    from fractions import gcd
    return (m * n) // gcd(m, n)

cd = lcm(c, d)

b_c = b//c
b_d = b//d
b_cd = b//cd
bb = b - (b_c + b_d - b_cd)

a_c = (a-1)//c
a_d = (a-1)//d
a_cd = (a-1)//cd
aa = (a-1) - (a_c + a_d - a_cd)

print(bb-aa)

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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

int main(){
    int N, R;
    cin >> N >> R;

    int ans = R;
    if (N < 10) ans += 100 * (10 - N);

    cout << max(0, ans) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define f first
#define se second
#define s second
#define vi_a vector<int>a;
#define p_b push_back
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define fast_io cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
#define pw(x) (1ll << x)
#define sz(x) (int)x.size()
#define endl "\n"
#define rall(x) x.rbegin(),x.rend()
#define len(a) (ll)a.size()
#define rep(x,l,r) for(ll x=l;x<r;x++)
using namespace std;
ld eps = (ld)1 / 1e15;
ll inf = 1e18, mod2 = 998244353, mod1 = 1e9 + 7;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
ll binmult(ll a, ll b, ll mod) { return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod : (2 * binmult(a, b / 2, mod)) % mod) : 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const ll to[5]={0,4,6,7,9};
const ll N=1e3+1e2;
const ll R=1e4;
//ll columns[N][26];
//ll str[N][26];
//pll cool[N][N];
signed main(){
    fast_io;
    string a;
    cin>>a;
    ll n=len(a);
    string f=a.substr(0,(n-1)/2);
    string s=f;
    bool ok=1;
    reverse(all(s));
    if(s!=f) ok=0;
    f=a.substr((n+3)/2-1,n);
    s=f;
    reverse(all(s));
//       cout<<f<<" "<<s<<endl;
    if(s!=f) ok=0;
    f=a;
    s=f;
    reverse(all(s));
    if(s!=f) ok=0;
    if(!ok){
        cout<<"No";
    }
    else{
        cout<<"Yes";
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb push_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const LL oo = 1e9;
const int maxn = 40000 + 5;
const long double eps = 1e-10;
 
template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

int n;
long double pos[maxn];
int c[maxn], rk[maxn];

struct Line { LL a, b, c; } L[maxn];

inline bool cmp(int x, int y) { return pos[x] < pos[y]; }
inline bool cmpx(Line x, Line y) { return 1.0 * x.a / x.b > 1.0 * y.a / y.b; }
inline bool cmpy(Line x, Line y) { return 1.0 * x.b / x.a > 1.0 * y.b / y.a; }

inline int lowbit(int x) { return x & (-x); }
void update(int u) {
    while(u <= n) {
        c[u] ++;    
        u += lowbit(u);
    }
}
int query(int u) {
    int res = 0;
    while(u > 0) {
        res += c[u];
        u -= lowbit(u);
    }
    return res;
}

bool chkx(long double mid) {
    LL res = 0;
    for(int i = 1; i <= n; ++i) 
        c[i] = 0, rk[i] = i, pos[i] = -(L[i].c + L[i].a * mid) / L[i].b;

    sort(rk + 1, rk + n + 1, cmp);
    for(int i = 1; i <= n; ++i) {
        res += query(rk[i]); update(rk[i]);
    }
    return (res << 2LL) >= 1LL * n * (n-1);
}

bool chky(long double mid) {
    LL res = 0;
    for(int i = 1; i <= n; ++i) 
        c[i] = 0, rk[i] = i, pos[i] = -(L[i].c + L[i].b * mid) / L[i].a;

    sort(rk + 1, rk + n + 1, cmp);
    for(int i = 1; i <= n; ++i) {
        res += query(rk[i]); update(rk[i]);
    }
    return (res << 2LL) >= 1LL * n * (n-1);
}

int main() {
#ifdef Wearry 
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif 

    n = read<int>();
    for(int i = 1; i <= n; ++i) {
        L[i].a = read<int>(); 
        L[i].b = read<int>();
        L[i].c = -read<int>();
    }

    static long double l, r;
    
    l = -oo, r = oo;
    sort(L + 1, L + n + 1, cmpx);

    while(r - l > eps) {
        long double mid = (l + r) / 2.0;
        if(chkx(mid)) r = mid; else l = mid;
    }
    printf("%.10Lf ", l);

    l = -oo, r = oo;
    sort(L + 1, L + n + 1, cmpy);

    while(r - l > eps) {
        long double mid = (l + r) / 2.0;
        if(chky(mid)) r = mid; else l = mid;
    }
    printf("%.10Lf\n", l);

    return 0;
}


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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

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

  int n;
  cin >> n;
  vi a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  sort(a.begin(), a.end());
  cout << a[n - 1] - a[0] << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,k;
char ch;
int mp[10][10];
int ans=0;
int sum=0;
int main()
{
	cin>>n>>m>>k;
	for(int i=0;i<n;i++)
	  for(int j=0;j<m;j++)
	  {
	  	cin>>ch;
	  	if(ch=='#')  {mp[i][j]=1;sum++;}   
	  }
	
	for(int i=0;i<(1<<n);i++)
	  for(int j=0;j<(1<<m);j++)
	  {
	  	int num=0;
		  for(int p=0;p<n;p++)
		   for(int q=0;q<m;q++)
		   {
		   	if(mp[p][q] && ((i&(1<<p)) || (j&(1<<q))))  num++;
		   }
		if(num==sum-k)  ans++; 
	  }
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>
int main()
{
  int a,b,i,min,v,N,count=0;
  int A[100];

  scanf("%d",&N);
  for(a=0;a<=N-1;a++)scanf("%d",&A[a]);
  for(a=0 ;a<=N-1 ;a++){
    v = A[a];
    min = 100;
    for(i=a+1;i<=N-1;i++){
      if(min > A[i]){
	min = A[i];
	b = i;
      }
    }
    if(min < v){
      A[a] = min;
      A[b] = v;
      count++;
    }
  }
  for(a=0 ;a<=N-2 ;a++)printf("%d ",A[a]);
  printf("%d\n",A[a]);
  printf("%d\n",count);
  return 0;
} 



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

int a[55];

int main() {
	int N;
	cin >> N;
	int mx=1;
	for(int i=1; i<=N; ++i){
		cin >> a[i];
		if(abs(a[mx])<abs(a[i])) mx=i;
	}
	cout << 2*(N-1) << endl;
	for(int i=1; i<=N; ++i){
		if(i!=mx) cout << mx << ' ' << i << endl;
	}
	if(a[mx]>0){
		for(int i=1; i+1<=N; ++i){
			cout << i << ' ' << i+1 << endl;
		}
	}else{
		for(int i=N; i>=2; --i){
			cout << i << ' ' << i-1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
#define inf 100000000//10^8

/////////////////////////////////



int main(){
    int n,m;
    while(cin>>n>>m,n||m){
        bool senbei[n][m];
        for(int i=0;i<=n-1;i++)for(int j=0;j<=m-1;j++)cin>>senbei[i][j];
        bool sen[n][m];
        int ans=0;
        for(int s=0;s<1<<n;s++){
            for(int i=0;i<=n-1;i++){
                if(s>>i&1)for(int j=0;j<=m-1;j++)sen[i][j]=!senbei[i][j];
                else for(int j=0;j<=m-1;j++)sen[i][j]=senbei[i][j];
            }
            int count=0;
            for(int j=0;j<=m-1;j++){
                int cou=0;
                for(int i=0;i<=n-1;i++)if(!sen[i][j])cou++;
                count+=max(cou,n-cou);
            }
            if(count>ans)ans=count;
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3260
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	REP(i, 9){
		REP(j, 9){
			cout << i + 1 << "x" << j + 1 << "=" << (i + 1) * (j + 1) << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 3136
n,k=map(int,input().split())
d=[]
a=[]
for i in range(k):
    d.append(int(input()))
    l=list(map(int,input().split()))
    #print(l)
    for v in l:
        a.append(v)
#print(a)
c=set(a)
print(n-len(c))

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vst = vector<st>;
using vchar = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  ll n;
  cin >> n;
  set<ll> a;
  rep(i, 0, n){
    ll ab;
    cin >> ab;
    a.insert(ab);
  }
  cout << (a.size() == n ? "YES" : "NO") << endl;
}

Measured memory_bytes: 9600
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
#define repr(i ,n) for(int i=n;i>(int)(n);--i)
#define rep1(i ,n) for(int i=1;i<=(int)(n);++i)
#define ALL(a) a.begin(), a.end()
#define RSORT(a) sort(ALL(a),greater<>())
#define SORT(a) sort(ALL(a))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define PRINT(x) cout << (x) << endl;
#define ENDL cout << endl;
using namespace std;
typedef long long int i64;
typedef unsigned long long u64;
template<class T> using V = vector<T>;
using VI = V<int>;
const int INF = 2e9;
const i64 MOD = 1e9 + 7;

template <class T> inline bool chmin(T& a, T b){if(a>b){a=b; return true;} return false;}
template <class T> inline bool chmax(T& a, T b){if(a<b){a=b; return true;} return false;}
struct Init_On{
    Init_On(){
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(16);
    }
};

signed main(){
    Init_On start;
    u64 x;
    cin >> x;
    u64 now = 100; int i = 1;
    for( ; ; ++i){
        now *= 1.01;
        if ( now >= x) break;
    }
    cout << i << endl;
}

Measured memory_bytes: 3656
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

ans=0

for i in range(N):
    if a[i] >= b[i]:
        ans += b[i]

    else:
        ans += a[i]
        yo = b[i]-a[i]

        if a[i+1]<= yo:
            ans += a[i+1]
            a[i+1]=0
        else:
            ans += yo
            a[i+1] -= yo
          
print(ans)


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


int main() {
  int N;
  int max;
  int sum;
  max =0;

  cin>>N;
  vector<int> L(N);
  for(int i =0; i<N;i++){
    cin>>L.at(i);}
  for(int i =0; i<N;i++){
    if (max < L.at(i)){
      max=L.at(i);
    }
  }
  int i =0;
  while(i<N){
    sum=sum+L.at(i);
    i++;
  }

  if(sum>max*2){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }

}


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

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int hour = 0, min = 0, sec = 0;
		while(true){
			String[] input = br.readLine().split(" ");
			hour = Integer.parseInt(input[0]);
			min = Integer.parseInt(input[1]);
			sec = Integer.parseInt(input[2]);
			if( hour == -1 && min == -1 && sec == -1)	break;
			Tape t = new Tape(hour, min, sec);
			System.out.println(t.toString());
		}
	}

}

class Tape{
	static final int maxRecordtime = 120 * 60;
	int recordTime;
	public Tape(int recordTime) {
		this.recordTime = recordTime;
	}
	public Tape(int recordHour, int recordMin, int recordSec){
		this.recordTime = recordHour * 3600 + recordMin * 60 + recordSec;
	}
	public int getRestTime(){
		return maxRecordtime - this.recordTime;
	}
	public int getRestTime3Speed(){
		return getRestTime() * 3;
	}
	private static String translate(int restTime){
		int hour = restTime / 3600;
		int min = (restTime % 3600) / 60;
		int sec = restTime % 60;
		return String.format("%02d:%02d:%02d", hour, min, sec);
	}
	@Override
	public String toString() {
		return translate(getRestTime()) + "\n" + translate(getRestTime3Speed());
	}
}

Measured memory_bytes: 17028
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]

cnt = 0

for i in range(N):
    res = C
    for j in range(M):
        res += B[j]*A[i][j]
    if res > 0:
        cnt += 1

print(cnt)

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

int main() {
  int N, i;
  cin >> N;

  for (int i = 0; i < N; ++i) {
  	string S;
    cin >> S;
    if (S == "Y") {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext())
		{
			int input = stdIn.nextInt();
			int ans = 0;
			for(int a = 0; a < 10; ++a)
			{
				for(int b = 0; b < 10; ++b)
				{
					for(int c = 0; c < 10; ++c)
					{
						for(int d = 0; d < 10; ++d)
						{
							if(a + b + c + d == input)
							{
								++ans;
							}
						}
					}
				}
			}
			System.out.println(ans);
		}
	}
}

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

	private static Scanner sc;

	public static void main(String[] args) {
		sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] t = new int [n];
		int time=0;
		for(int i=0;i<n;i++) {
			t[i]=sc.nextInt();
			time=time+t[i];
		}
		int m =sc.nextInt();
		for(int j=0;j<m;j++) {
			int z=sc.nextInt()-1;
			int answer =time-t[z]+sc.nextInt();
			System.out.println(answer);;
		}
		

	}

}

Measured memory_bytes: 21844
#include <stdio.h>

int main(void){
	int N;
	scanf("%d",&N);
	int i;
	double g,k; g = 0.0; k = 0.0;
	for(i=1;i<=N;i++){
		if(i%2 == 0) g++;
		else k++;
	}
	double w,ans;
	w = g+k;
	ans = k/w;
	printf("%lf\n",ans);
	
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
		int meu = x / (y + z);
		System.out.println((x % (y + z) >= z) ? meu : meu - 1);
	}
}


Measured memory_bytes: 21844
#include<stdio.h>

#define N 100
#define I 10000000
#define W 0
#define B 2
#define G 1

int n, M[N][N];

void dijkstra(){
  int i,u,minv,v;
  int d[N],color[N];

  for(i=0;i<n;i++){
    d[i]=I;
    color[i]=W;
  }

  d[0]=0;
  color[0]=G;
  while(1){
    minv = I;
    u = -1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i]!=B){
	u=i;
	minv=d[i];
      }
    }
    if(u==-1)break;
    color[u]=B;
    for(v=0;v<n;v++){
      if(color[v]!=B && M[u][v]!=I){
	if(d[v]>d[u]+M[u][v]){
	  d[v]=d[u]+M[u][v];
	  color[v]=G;
	}
      }
    }
  }

  for(i=0;i<n;i++){
    printf("%d %d\n",i,d[i]==I?-1:d[i]);
  }
}

int main(){
  int i,j,k,c,u,v;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=I;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
      M[u][v] = c;
    }
  }

  dijkstra();

  return 0;
}
      



Measured memory_bytes: 2052
S = input()
if S[0] != "A":
    print("WA")
else:
    capital_c_count = 0
    for i in range(2, len(S) - 1):
        if S[i] == "C":
            capital_c_count += 1
        
    if capital_c_count != 1:
        print("WA")
    else:
        is_ac = True
        for c in S:
            if c == "A" or c == "C":
                continue
            if not c.islower():
                is_ac = False
                break
                    
        if is_ac:
            print("AC")
        else:
            print("WA")

Measured memory_bytes: 3060
using System;

namespace ITP1_4_D
{
    class Program
    {
        static void Main(string[] args)
        {
            string str1 = Console.ReadLine();
            int n = int.Parse(str1);

            int[] a = new int[n];
            string[] str2 = Console.ReadLine().Split(' ');

            for(int i = 0;i<n;i++)
            {
                a[i] = int.Parse(str2[i]);
            }

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

            int max = a[0];
            for(int i = 0;i<n;i++)
            {
                if (a[i] > max)
                    max = a[i];
            }

            long sum = 0;
            for(int i = 0;i<n;i++)
            {
                sum += a[i];
            }

            Console.WriteLine("{0} {1} {2}", min, max, sum);
        }
    }
}

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

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define scd(t) scanf("%d",&t)
#define scld(t) scanf("%ld",&t)
#define sclld(t) scanf("%lld",&t)
#define scc(t) scanf("%c",&t)
#define scs(t) scanf("%s",t)
#define scf(t) scanf("%f",&t)
#define sclf(t) scanf("%lf",&t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define fr(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define gf(i,n) for (int i=0 ; i<n ; i+=1)
#define rfor(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define rep(i, j) FOR(i, 0, j, 1)
#define rrep(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define mp make_pair
#define pb push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define prarr(a,n) gf(i,n){printf("%d ", a[i]);}printf("\n");
#define sumarr(a,n) int zserkd=0;gf(i,n){zserkd+=a[i];}cout<<zserkd<<endl;
const double pi=acos(-1.0);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<int,int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

/****** Template of some basic operations *****/
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

int main(){
	
	long long x;
	cin >> x;
	fr(i,-100,150,1)
	{
		fr(j,-100,150,1)
		{
			long long i5 = pow(i,5);
			long long j5 = pow(j,5);
			if(i5-j5==x)
			{
				cout << i << " "<< j ;
				return 0;
			}

		}
	}
	return 0;
}


Measured memory_bytes: 4100