akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
// using System.Linq;

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // int[] nx = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // long K = long.Parse(Console.ReadLine());
            // int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int a = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int h = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string A = Console.ReadLine();
            // string B = Console.ReadLine();
            string[] B = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // for(int i = 0; i<A_num.Length;i++){
            //     A_num[i] = 0;
            // }
            Console.WriteLine(B[0][0].ToString()+B[1][0].ToString()+B[2][0].ToString());
        }
        //最小公倍数
        static long Lcm(long a, long b)
        {
            return a/Gcd(a,b)*b;
        }

        //最大公約数
        static long Gcd(long m, long n)
        {
            if(n==0)return m;
            return Gcd(n,m%n);
        }
    }
}

Measured memory_bytes: 11092
#include <stdio.h>
typedef long long unsigned int u64;
u64 min(const u64 a, const u64 b) {
    return a < b ? a : b;
}
u64 max(const u64 a, const u64 b) {
    return a > b ? a : b;
}
u64 numdigits(u64 n) { 
    int i;
    for(i = 0; n != 0; n /= 10, i++);
    return i;
}
u64 f(u64 a, u64 b) {
    return max(numdigits(a), numdigits(b));
}
u64 solve(u64 n) {
    u64 minf = 4000;
    for(u64 i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            u64 a = i;
            u64 b = n / i;
            minf = min(minf, f(a, b));
        }
    }
    return minf;
}
int main(void) {
    u64 n;
    scanf("%llu", &n);
    printf("%llu", solve(n));
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <functional>

using namespace std; using ll=long long; using ld=long double; using P=pair<ll,ll>; const int INF=1e9; const ll LINF=1e18;

int main(){
  int n,m; cin>>n>>m;
  int a[n];
  for(int i=0;i<n;i++) {
    cin>>a[i]; a[i]--;
  }
  int b[n]={};
  for(int i=0;i<n;i++) {
    b[a[i]]++;
  }
  set<int> se[n];
  for(int i=0;i<n;i++) {
    for(int j=0;j<b[i];j++) {
      if (i-j<0) break;
      se[i-j].insert(i);
    }
  }
  int an = 0;
  for(int i=0;i<n;i++) {
    an += se[i].empty();
  }

  for(int i=0;i<m;i++) {
    int x,y; cin>>x>>y; x--; y--;
    int id0 = a[x] - b[a[x]] + 1;
    if (id0 >= 0) {
      se[id0].erase(a[x]);
      an += se[id0].empty();
    }
    b[a[x]]--;
    int id1 = y - b[y];
    if (id1 >= 0) {
      an -= se[id1].empty();
      se[id1].insert(y);
    }
    b[y]++; a[x]=y;
    
    /*
    if (x==7&&y==0){
    for(int j=0;j<n;j++) {
      cout<<j<<" : ";
      for(int x:se[j]) {
        cout<<x<<" ";
      } cout<<endl;
    }cout<<id0<<" "<<id1<<endl;}*/
    cout<<an<<endl;
  }
}

Measured memory_bytes: 21760
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#include <math.h> /* M_PI */
#define INF 2147483647
int main()
{
    ll n, k;
    cin >> n >> k;
    map<ll, ll> data;
    rep(i, k)
    {
        ll d;
        cin >> d;
        data[d] = 1;
    }
    queue<ll> qe;
    vector<ll> stock;
    for (int i = 0; i < 10; i++)
    {
        if (data[i] != 1)
        {
            qe.push(i); //小さい値からどんどん入れていく。
            stock.push_back(i);
        }
    }
    //qeに入っている値を順に、全探索で並べていく。
    ll ans = 0;
    while (1)
    {
        ll k = qe.front();
        for (ll x : stock)
        {
            qe.push(10 * k + x);
        }
        if (k >= n)
        {
            ans = k;
            break;
        }
        qe.pop();
    }
    cout << ans;
}

Measured memory_bytes: 768
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		HashSet<Integer> hs = new HashSet<Integer>();
		for(int i = 1; i <= K;i++) {
			int d = sc.nextInt();
			for(int j = 1; j <= d;j++) {
				int tmp = sc.nextInt();
				hs.add(tmp);
			}
		}
		System.out.println(N - hs.size());
	}

}


Measured memory_bytes: 46548
S = input()
dict = {}
for i in range(len(S)):
    if(S[i] in dict):
        dict[S[i]] += 1
    else:
        dict[S[i]] = 1
l = list(dict.values())
cnt = 0
for i in range(len(l)):
    if(l[i] % 2 != 0):
        cnt += 1
print(cnt // 2)


Measured memory_bytes: 5564
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
const ll MAX = 200010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    vector<ll> s(n),t(m);
    cins(all(s));
    cins(all(t));
    vector<vector<ll>> dp(n+1,vector<ll>(m+1,0));
    rep(i,n){
        rep(j,m){
            if (s[i] == t[j]) dp[i+1][j+1] += dp[i][j+1]+dp[i+1][j]+1;
            else dp[i+1][j+1] += (dp[i][j+1]+dp[i+1][j]+MOD-dp[i][j])%MOD;
            dp[i+1][j+1]%=MOD;
        }
    }
    //rep(i,n+1) array_output(all(dp[i]));
    PRINT((dp[n][m]+1)%MOD);
}



Measured memory_bytes: 31616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define all(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int main(){
    int N;cin>>N;
    vector<ll> a(N);
    REP(i,N)cin>>a[i];
    ll sum=0;
    REP(i,N)sum+=a[i];
    ll tmp=0;
    int i=0;
    while(2*tmp<sum){
        tmp+=a[i];
        i++;
    }
    i--;
    // i番目まで足すとtmp*2>=sum
    if(i==0)cout<<abs(sum-2*tmp)<<endl;
    else{
        ll tmp2=tmp-a[i];
        cout<<min(abs(sum-2*tmp),abs(sum-2*tmp2))<<endl;
    }
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
    int a, b, c; cin >> a >> b >> c;
    if(a + b + c <= 21) cout << "win" << endl;
    else cout << "bust" << endl;
}

Measured memory_bytes: 256
A,B,T = [int(s) for s in input().split(' ')]
next_product = A
times = 2
biscuits = 0

while next_product <= T:
    biscuits += B
    next_product = A*times
    times += 1
#print("Biscuits are {} pieces".format(biscuits))
print(biscuits)

Measured memory_bytes: 2940
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdlib.h>
#include<stack>
#include<set>
#include<string.h>
#include<map>
#include<vector>
#define pb push_back
#define eb emplace_back
#define ins insert 
#define mp make_pair
#define ll long long 
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define M 10000007
using namespace std;
void solve(){
	ll n;
	cin>>n;
	ll a[n],dp[n+1];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		dp[i]=0;
	}
	dp[0]=0;
	dp[1]=abs(a[0]-a[1]);
	for (int i = 2; i < n; ++i)
	{
		dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<dp[n-1];
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0 ;
}


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

namespace ConsoleApp15
{
    class Class3
    {
        static void Main()
        {
            string S = Console.ReadLine();
            int a = int.Parse(S.Substring(0, 2));
            int b = int.Parse(S.Substring(2));

            if (1 <= a && a <= 12)
            {
                if (1 <= b && b <= 12)
                    Console.WriteLine("AMBIGUOUS");
                else
                    Console.WriteLine("MMYY");
            }
            else
            {
                if (1 <= b && b <= 12)
                    Console.WriteLine("YYMM");
                else
                    Console.WriteLine("NA");
            }
        }
    }
}


Measured memory_bytes: 11092
///#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
///#define double long double
#define all(x) (x).begin(), (x).end()
#define finout(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout);
#define X first
#define Y second

using namespace std;
const int MOD = 1e9 + 7;

typedef pair <int, int> pii;
typedef vector <int> vi;
inline int ni() {int x; cin >> x; return x;}
template <class T>
inline T nt() {T x; cin >> x; return x;}
inline void print(){}
template<typename T, typename ...TAIL>
inline void print(const T &t, TAIL... tail) {cout << t; print(tail...);}
inline void input() {return;}
template<typename T, typename ...TAIL>
inline void input(T &t, TAIL&... tail) {cin >> t; input(tail...);}

const int N = 2 * 1e5 + 1;
const int inf = 1e9 + 7;
const double PI = 3.14159265359;

int f[N], rf[N];

int get(int n, int m) {
    return (f[n + m - 2] * rf[m - 1] % MOD) * rf[n - 1] % MOD;
}

int bpow(int x, int n) {
    if (n == 0) return 1;
    int k = bpow(x, n / 2);
    return (k * k % MOD) * (n % 2 ? x : 1) % MOD;
}

signed main () {
    ios_base::sync_with_stdio(NULL);  cin.tie(0); cout.tie(0);
    int h, w;
    cin >> h >> w;
    int a, b;
    cin >> a >> b;
    f[0] = 1;
    for (int i = 1; i <= h + w; i++) f[i] = f[i - 1] * i % MOD;
    rf[h + w] = bpow(f[h + w], MOD - 2);
    for (int i = h + w - 1; i >= 0; i--) rf[i] = rf[i + 1] * (i + 1) % MOD;
    int l = h - a;
    int ans = 0;
    for (int i = b + 1; i <= w; i++) {
        ans += get(l, i) * get(a, w - i + 1) % MOD;
        ans %= MOD;
    }
    cout << ans << '\n';
    return 0;
}


///C(n + m - 2, m - 1)

















Measured memory_bytes: 6736
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<u32> = procon_read();
	let n = v[0];
	for i in 0.. {
		let d1 = (n+i)%10;
		let d2 = ((n+i)%100 - d1)/10;
		let d3 = ((n+i) - (n+i)%100)/100;
		if d1 == d2 && d2 == d3 {
			println!("{}", n+i);
			break;
		}
	}
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;

int main(){
    int a,b;
    cin >> a >> b;
    if((a+b)%2==1) cout << (a+b+1)/2 << endl;
    else cout << (a+b)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
#include <vector>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int         long long
#define ll          long long
#define ld	    long double
#define pb          push_back
#define pp	    pop_back()
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),a.rend()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repj(j,a,b) for(ll j=a;j<b;j++)
#define lexistr(x,y)      lexicographical_compare(x.begin(),x.end(),y.begin(),y.end())
#define IOS	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//CONSTANTS----------------------------------
#define PI 	    3.141592653589793238462643
const ll hell=1000000007;
const ll mod=1000000007;
//function-----------------------------------
ll GCD(ll a , ll b)
{
    if(b==0)
        return a;
    else
        return GCD(b,a%b);
}
ll LCM(ll a, ll b)
{
    return a*(b/GCD(a,b));
}
bool isPrime(ll n) {

    if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (ll i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
}
ll fact(ll n)
{
    ll f=1;
    for(ll i=2;i<=n;i++)
	f=f*i;
    return f;
}
ll power(ll a,ll b)
{
  if(b==0)return 1;
  if(b==1)return a;
  ll t=power(a,b/2);
  t%=hell;
  t*=t;
  t%=hell;
  if(b%2)return (t*a)%hell;
  else
     return t;
}
//CODE------------------------------------------
ll solve()
{
    ll n,x; cin>>n;
    x=n%10;
    if(x==3) cout<< "bon";
    else if(x==0 || x==1|| x==6|| x==8) cout<<"pon";
    else cout<<"hon";
    return 0;
}
//MAIN------------------------------------------
signed main(){
    IOS
    #ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    //cin>>t;
    while(t--) {
        solve();
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3672
A = [[False, False, False], [False, False, False], [False, False, False]]

def checker():
    for i in range(3):
        if A[i][0] & A[i][1] & A[i][2]:
            return True
        elif A[0][i] & A[1][i] & A[2][i]:
            return True
    if A[0][0] & A[1][1] & A[2][2]:
        return True
    elif A[0][2] & A[1][1] & A[2][0]:
        return True
    return False

a0 = list(map(int, input().split()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

n = int(input())

for i in range(n):
    b = int(input())
    for j in range(3):
        if b == a0[j]:
            A[0][j] = True
            break
        elif b == a1[j]:
            A[1][j] = True
            break
        elif b == a2[j]:
            A[2][j] = True
            break

if checker():
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int n;
	int m;
	int s[99999];
	int i, j;
	int a;
	int move;
	int buf;
	
	scanf("%d %d", &n, &m);
	
	for (i = 0; i < n - 1; i++){
		scanf("%d", &s[i]);
	}
	
	move = 0;
	buf = 0;
	for (i = 0; i < m; i++){
		scanf("%d", &a);
		
		if (a > 0){
			for (j = buf; j < buf + a; j++){
				move += s[j];
			}
			buf += a;
		}
		else {
			a *= -1;
			for (j = buf; j > buf - a; j--){
				move += s[j - 1];
			}
			buf -= a;
		}
		
		move %= 100000;
		/*printf("buf:%d\n", buf);
		printf("move:%d\n", move);*/
	}
	
	
	printf("%d\n", move);
	
	return (0);
}

Measured memory_bytes: 988
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;
const int MAXN = 1000 + 10;
const int SIZ = 1000000 + 10;

int n, k;
long long data[MAXN];
long long que[SIZ], cnt;
bool flag[SIZ];

int main(){
	scanf("%d", &n);
	scanf("%d", &k);
	
	for(register int i=1; i<=n; i++)
		scanf("%lld", &data[i]);
	
	for(register int l=1; l<=n; l++){
		long long ans = 0;
		
		for(register int r=l; r<=n; r++){
			ans += data[r];
			que[++cnt] = ans;	
		}
	}
	
	long long ans = 0;
	
	for(register int i=1; i<=cnt; i++){
		flag[i] = true;
	}
	
	for(register int i=45; i>=0; i--){
		int times = 0;
		for(register int j=1; j<=cnt; j++){
			if(flag[j] && (((que[j] >> i) & 1) == 1)){
				times++;
			}
		}
		
		ans <<= 1;
		
		if(times >= k){
			ans += 1;
			
			for(register int j=1; j<=cnt; j++){
				if(flag[j] &&  (((que[j] >> i) & 1) == 0))
					flag[j] = false;
			} 
		}
	}
	
	printf("%lld", ans);

	return 0;
}


Measured memory_bytes: 5888
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define ll long long
using namespace std;
int main(){
    int n;
    double t,a;
    cin>>n>>t>>a;
    vector<double> h(n);
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    double min=9999999;
    int index=0;
    for(int i=0;i<n;i++){
        double temp=abs(a-(t-h[i]*0.006));
        if(min>temp){
            min=temp;
            index=i;
        }
    }
    cout<<index+1<<endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 


def kai(num):
	x = 0
	for i in range(10000):
		
		mk = str(i).zfill(4)
		if int(mk[0])+int(mk[1])+int(mk[2])+int(mk[3]) == num:
				x += 1
	return x

def main(): 
	while True:
		try:
			num = int(input())
		except:
			return
		else:
			print(kai(num))	
if __name__ == '__main__':
	main()

Measured memory_bytes: 7656
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
    int N;
    long long D;
    cin >> N >> D;

    int ans = 0;
    const long long dd = D * D;
    for (int i = 0; i < N; i++) {
        long long x, y;
        cin >> x >> y;

        long long d = x * x + y * y;
        if (d <= dd)
            ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define ll long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	char c;
	cin>>c;
	if(c<'a'){
		cout<<'A';
	}else cout<<'a'; 
	RE 0;
}




Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int N;
  cin >> N;
  if (N<2) {
    cout << 1 << endl;
  }
  else {
    if (N<4) {
      cout << 2 << endl;
    }
    else {
      if (N<8) {
        cout << 4 << endl;
      }
      else {
        if (N<16) {
          cout << 8 << endl;
        }
        else {
          if (N<32) {
            cout << 16 << endl;
          }
          else {
            if (N<64) {
              cout << 32 << endl;
            }
            else {
              cout << 64 << endl;
            }
          }
        }
      }
    }
  }
}

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

using namespace std ;
#define pi 3.1415926535897932384626
int main ()  { 
	
ios_base::sync_with_stdio(false) ; 
cin.tie(NULL) ; 
cout.tie(NULL) ;

int n ; 
cin >> n ; 

double keliling ; 
keliling = 2 * pi * n ; 

cout << keliling << endl; 


}


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

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

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


int main(void) {
	int a, b;
	int count = 0;

	cin >> a >> b;
	count = a - 1;
	if (a <= b) {
		count++;
	}
	cout << count << endl;


	return 0;
}

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

typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;

double kaijyo(int n){
    int k(1);
    for(int i=n;i>0;i--){
        k *= i;
    }

    return k;
}

double distance(int x[],int y[],int i,int j){
    int dx = (x[i] - x[j]) * (x[i] - x[j]);
    int dy = (y[i] - y[j]) * (y[i] - y[j]);
    return sqrt(dx+dy);
}

int main(){
    int n,m;   
    cin >> n >> m;
    vector<pair<ll,ll>> v(n);
    rep(i,n){
        ll a,b;
        cin >> a  >> b;
        v[i] = make_pair(a,b);
    }

    sort(v.begin(),v.end());

    ll ans(0);
    rep(i,n){
        if(v[i].second>=m){
            ans += m*v[i].first;
            break;
        }else{
            m -= v[i].second;
            ans += v[i].first*v[i].second;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4808
#include <cstdint>
#include <iostream>
#include <algorithm>
 
typedef int64_t i64;
 
static const auto NMAX = 100002;
 
static int N;
static int L;
static int A[NMAX];
 
int main() {
	std::ios_base::sync_with_stdio(false);
	std::cin >> N;
	for(auto i = 1; i <= N; i++) std::cin >> A[i];
        std::sort(A + 1, A + N + 1);
        std::reverse(A + 1, A + N + 1);
        auto v = 2000000000;
        auto u = 0;
        auto lt = 0;
	for(auto i = 1; i <= 1+N; i++) {
                if(i < N && A[i] == A[i + 1]) continue;
            if(i>=A[i]){
        if(lt == A[i] && ( (i-A[i] )% 2 == 1 || (A[lt]-lt)% 2 == 1)) {
               	    std::cout << "First" << std::endl;
                    return 0;
                }  
               if(lt<A[i])u=(A[i]-i)%2;
                 else u=(lt-A[lt])%2;
                   break;
              }
                lt = i;
	}
        if(!u) 
	    std::cout << "Second" << std::endl;
        else
	    std::cout << "First" << std::endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<functional>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
LL a,n,m;

int main(){
    cin>>a>>n>>m;
    LL ans=0;
    for(int y=0;pow(y+a,n)<=m;y++){
        LL x=pow(y+a,n);
        if(x==0)continue;
        string s=to_string(x);
        int cnt=0;
        for(auto c:s){
            cnt+=c-'0';
        }
        if(cnt==y)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3396
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

template <typename T> class union_find {
  vector<T> par, rank;

public:
  union_find(size_t n) {
    par.reserve(n + 1);
    rank.reserve(n + 1);
  }

public:
  void init(T n) { // add a set
    rep(i, 0, n) {
      par[i] = i;
      rank[i] = 0;
    }
  }

public:
  T find(T x) { // find the parent of x
    if (par[x] == x)
      return x;
    else
      return par[x] = find(par[x]);
  }

public:
  void unite(T x, T y) { // unite x and y
    x = find(x);
    y = find(y);
    if (x == y)
      return;
    if (rank[x] < rank[y])
      par[x] = y;
    else
      par[y] = x;
    if (rank[x] == rank[y])
      rank[x]++;
  }

public:
  bool same(T x, T y) { // compare x's parent and y's parent
    return find(x) == find(y);
  }
};

vector<int> x, y, p;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    int n, m;
    cin >> n >> m;
    union_find<int> uf = union_find<int>(n+1);
    uf.init(n);
    rep(i, 0, n) {
        int t; cin >> t;
        p.pb(t);
    }
    rep(i, 0, m) {
        int val, a, b;
        cin >> a >> b;
        x.pb(a); y.pb(b);
        uf.unite(a, b);
    }
    int ans = 0;
    rep(i, 0, n) {
        if (uf.same(i+1, p[i])) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2680
#include <cstdio>
#include <string>
#include <utility>
#include <queue>
#include <set>
using namespace std;

typedef pair<int, string> P;

int main()
{
    char worm[32];

    while (scanf("%s", worm), *worm != '0'){
        queue<P> que;
        set<string> exist;

        exist.insert(string(worm));
        for (que.push(P(0, string(worm))); que.size(); que.pop()){
            P tmp = que.front();
            string s = tmp.second;
            bool flag = true;

            for (int i = 0; i < s.length() - 1; i++){
                string t = s;

                if (t[i] != t[i + 1]){
                    flag = false;
                    if (t[i] != 'r' && t[i + 1] != 'r'){
                        t[i] = t[i + 1] = 'r';
                    }
                    else if (t[i] != 'g' && t[i + 1] != 'g'){
                        t[i] = t[i + 1] = 'g';
                    }
                    else {
                        t[i] = t[i + 1] = 'b';
                    }
                    if (exist.find(t) == exist.end()){
                        exist.insert(t);
                        que.push(P(tmp.first + 1, t));
                    }
                }
            }
            if (flag){
                printf("%d\n", tmp.first);
                break;
            }
        }
        if (que.empty()){
            puts("NA");
        }
    }

    return 0;
}

Measured memory_bytes: 2532
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc  = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        System.out.printf("%d %d %f",a/b,a%b,(double)a/b);
        sc.close();
    }
}


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

int main(){
    int n;
    cin>>n;
    int a[n], b[n-1];

    for(int i=0; i<n-1; i++){
        cin>>b[i];
    }

    for(int i=0; i<n; i++)
        a[i] = 0;

    a[0] = b[0];
    a[1] = b[0];

    for(int i=1; i<n-1; i++){
        if(b[i] > a[i]){
            a[i+1] = b[i];
        }
        else if(b[i] <= a[i]){
            a[i] = b[i];
            a[i+1] = b[i];
        }
    }

    int result = 0;
    for(int i=0; i<n; i++){
        //cout<<a[i]<<" ";
        result += a[i];
    }
    //cout<<endl;


    cout<<result<<endl;

}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DRainFlowsIntoDams solver = new DRainFlowsIntoDams();
        solver.solve(1, in, out);
        out.close();
    }

    static class DRainFlowsIntoDams {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = new long[n];
            long[] res = new long[n];

            long s = 0;
            for (int i = 0; i < n; i++) {
                a[i] = in.nextLong();
                if (i % 2 == 0) {
                    s += a[i];
                } else {
                    s -= a[i];
                }
            }

            for (int i = 0; i < n; i++) {
                res[i] = s;
                s = -s + 2 * a[i];
            }


            for (int i = 0; i < n; i++) {
                out.print(res[i] + " ");
            }
            out.println();
        }

    }
}



Measured memory_bytes: 62964
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
  	cin >> s;
  	for(int i = 0 ; i < 3 ; i++)
      if(s[i] == s[i + 1]){
		cout << "Bad" << endl;
        return 0;
      }
	cout << "Good" << endl;
 	return 0; 
}

Measured memory_bytes: 256
#include <stdio.h>
void swap(int*x, int*y){
	int tmp = *x;
	*x = *y;
	*y = tmp;
}
int main(void){
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a > b)
		swap(&a, &b);
	if (b > c)
		swap(&b, &c);
	if (a > b)
		swap(&a, &b);
	printf("%d %d %d\n", a, b, c);
	return 0;
}

Measured memory_bytes: 596
def resolve():
    a, b, c, d = list(map(int, input().split(" ")))
    if abs(c - a) <= d:
        print("Yes")
        return
    if abs(b - a) <= d and abs(c - b) <= d:
        print("Yes")
        return
    print("No")

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 38384
n,m,k=map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

init = 0
init2 = 0
s = 0
for i in range(n):
  if s + a[i] <= k:
    s += a[i]
    init += 1
  else:
    break

for i in range(m):
  if s + b[i] <= k:
    s += b[i]
    init2 += 1
  else:
    break

max_ = init+init2

while init > 0:
  s -= a[init-1]
  init -= 1
  for i in range(init2, m):
    if s + b[i] <= k:
      s += b[i]
      init2 += 1
    else:
      break
  max_ = max(max_, init+init2)
print(max_)
      

    

Measured memory_bytes: 117804
#include <bits/stdc++.h>
#include <iostream>
using namespace  std;
set<long long int> st;
vector<long long > finall;
map<long long int,long long int>mp;

vector<long long int> vc;
int main() {

    long long n,m;
    cin>>n>>m;
    long long x=__gcd(n,m);
    for(long long int i=1;i*i<=x;i++) {
       if(x%i==0){
           st.insert(i);
           st.insert(x/i);

       }
    }

   long long int counter=0;
    for(auto it=st.begin();it!=st.end();it++)vc.push_back(*it);

    //for(auto x: vc)cout<<x<<" ";

    for(int i=0;i<vc.size();i++){
         counter=0;
        for(long long int j=2;j*j<=vc[i];j++){
          if(vc[i]%j==0) counter++;}

        if(counter==0)finall.push_back(vc[i]);



    }

cout<<finall.size();
    return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <deque>

using namespace std;

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

    deque<char> q;
    for(int i=0; i<s.length(); i++){
        q.push_back(s[i]);
    }

    int sw = 0;
    int t;
    int p;
    char a;
    for(int i=0; i<Q; i++){
        cin >> t;
        if(t==1){
            sw++;
        }else{
            cin >> p >> a;
            if((sw+p)%2==1) q.push_front(a);
            else q.push_back(a);
        }
    }

    if(sw%2==1){
        while(!q.empty()){
            cout << q.back();
            q.pop_back();
        }
    }else{
        while(!q.empty()){
            cout << q.front();
            q.pop_front();
        }
    }
    cout << endl;

    return 0;
}

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

using namespace std;

int main(){
        long long int n,d,ans = 0;

        cin >> n >> d;
        for (int i = 0;i < n;i++){
                long long int x,y;
                cin >> x >> y;

                if ( sqrt (x * x + y * y) <= d)
                        ans++;
        }

        cout << ans;
}

Measured memory_bytes: 3600
import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache, reduce

INF = float("inf")
sys.setrecursionlimit(10 ** 7)

# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]


def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W


def dfs(n, p, grundy, graph):
    g = 0
    for x in graph[n]:
        if x != p:
            g ^= dfs(x, n, grundy, graph) + 1
    grundy[n] = g
    return g


def solve(N, graph):
    grundy = [None] * (N + 1)
    dfs(1, 0, grundy, graph)
    return grundy[1] != 0


def main():
    N = int(input())
    graph = defaultdict(list)
    for _ in range(N - 1):
        a, b = map(int, input().split())
        graph[a].append(b)
        graph[b].append(a)
    print("Alice" if solve(N, graph) else "Bob")


if __name__ == '__main__':
    main()


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

using namespace std;

int main() {
  int n = 0;
  string str;
  cin >> str;

  for(int i = 0; i < str.length(); i++){
    int x = str[i] - '0';
    n += x;
  }

  int num = stoi(str);
  
  if(num%n == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void) {
    char s[20];
    char a[] = "YAKI";
    int len;
    int match = 0;

    scanf(" %s", s);
    len = strlen(s);

    for (int i = 0; i < 4 && i < len; i++) {
        if (a[i] != s[i]) {
            break;
        } else {
            match++;
        }
    }
    if (match == 4) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}




Measured memory_bytes: 128
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7

O = list(input())
E = list(input())
ans = ''

for i,s1 in enumerate(O):
	ans = ans + s1
	if i < len(E):
		ans = ans + E[i]

print(ans)

Measured memory_bytes: 3832
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
typedef pair<ll,ll> pll;



ll a, b;
int main()
{
        cin >> a >> b;
        ll  g = __gcd(a, b);
        ll og = g;
        ll ans = 0;
        for(ll i=2;i*i <= og;i++) {
                if(g%i==0){
                        ans++;
                        while(g%i==0) g /= i;
                }
        }
        if(g>1){
                ans++;
        }
        cout << ans+1 << endl;
        return 0;
}


Measured memory_bytes: 256
A = int(input())
x = list(map(int, input().split()))

kotae='APPROVED'
for i in range(len(x)):
    if x[i]%2==0:
        if x[i]%3==0 or x[i]%5==0:
            pass
        else:
            kotae='DENIED'


print(kotae)


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

int main() {
    int n;
    int64_t c;
    cin >> n >> c;
    vector<int64_t> x(n), v(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> v[i];
    }
    vector<int64_t> right(n), left(n);
    int64_t cur = 0;
    int64_t calMax = 0;
    for (int i = 0; i < n; i++) {
        cur += v[i] - x[i];
        calMax = max(calMax, cur);
        cur += x[i];
        right[i] = calMax;
    }
    int64_t ans = calMax;
    cur = 0;
    calMax = 0;
    for (int i = n-1; i >= 0; i--) {
        cur += v[i] - (c - x[i]);
        calMax = max(calMax, cur);
        cur += (c - x[i]);
        left[n-i-1] = calMax;
    }
    ans = max(ans, calMax);
    for (int i = 0; i < n - 1; i++) {
        ans = max(ans, right[i] + left[n - i - 2] - x[i]);
        ans = max(ans, left[i] + right[n - i - 2] - (c - x[n - i - 1]));
    }
    cout << ans << endl;
}

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

int main() {
    int n, ans;
    int sum = 0;
    int min = 9999;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int score;
        cin >> score;
        sum += score;
        if (score < min) {
            if (score % 10 != 0) {
                min = score;
            }
        }
    }
    if (sum % 10 == 0) {
        if (min == 9999) {
            ans = 0;
        } else {
            ans = sum - min;
        }
    } else {
            ans = sum;
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const long long mod = 1e9 + 7;

int n;
string s;
int arr[MAXN];
void solve(){
    for(int i = 1; i <= 5; i++){
        if(!arr[i]) {
            cout << i << "\n";
            return;
        }
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int i = 0;
    for(i = 1; i <= 5; i++)
        cin >> arr[i];
    solve();
    return 0;
}


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

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

using namespace std;

typedef int Weight;
Weight INF = 1000000000;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

int main() {
  map<string,int> m;
  multimap<string,int> g;
  int n;
  cin >> n;
  Matrix mat(n+1, Array(n+1, INF));
  REP(i,n) {
    string l1;
    cin >> l1;
    if (l1 == "goto") {
      string str;
      cin >> str;
      str.resize(str.size()-1);
      g.insert(make_pair(str, i));
      mat[i][i+1] = 1;
    } else {
      assert(l1.back() == ':');
      l1.resize(l1.size()-1);
      m.insert(make_pair(l1, i));
      mat[i][i+1] = 0;
    }
  }
  for (auto p : g) {
    string str;
    int i;
    tie(str, i) = p;
    assert(m.find(str) != end(m));
    //cout << str << " " << i << " " << m[str] << endl;
    mat[i][m[str]] = 0;
  }
  REP(k,n+1)REP(i,n+1)REP(j,n+1)
    mat[i][j] = min(mat[i][j], mat[i][k] + mat[k][j]);
  cout << mat[0][n] << endl;
  return 0;
}

Measured memory_bytes: 1292
/*
 * 2665.cc: Hopping Hearts
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 5000;
const int MAX_L = 5000;

typedef long long ll;
const ll MOD = 1000000007;

/* typedef */

/* global variables */

int xs[MAX_N], as[MAX_N], ts[MAX_N];
ll dp[MAX_N][MAX_L];

/* subroutines */

/* main */

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

  for (int i = 0; i < n; i++) cin >> xs[i];
  for (int i = 0; i < n; i++) cin >> as[i];
  for (int i = 0; i < n; i++)
    ts[i] = (as[i] == 0) ? 0 : (l - 1 - xs[i]) / as[i];
  //for (int i = 0; i < n; i++) printf("%d ", ts[i]); putchar('\n');

  for (int j = 0; j <= ts[0]; j++) dp[0][j] = j + 1;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= ts[i]; j++) {
      int k = ts[i - 1];
      if (as[i - 1] > 0)
	k = min(k, ((xs[i] + as[i] * j) - 1 - xs[i - 1]) / as[i - 1]);
      dp[i][j] = (((j > 0) ? dp[i][j - 1] : 0) + dp[i - 1][k]) % MOD;
    }
  }

  printf("%lld\n", dp[n - 1][ts[n - 1]]);
  return 0;
}

Measured memory_bytes: 195296
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
#include <numeric>
#define ll long long
#define INF INT_MAX 
using namespace std;
int main(){
    int r,D,x;
    cin >> r >> D >> x;
    for(int i=0;i<10;i++){
        x = r*x - D;
        cout << x << endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
typedef long long LL;

int main(){
  int N;
  cin >> N;
  if(N==1) cout << "Hello World" << endl;
  if(N==2){
    int A, B;
    cin >> A >> B;
    cout << A+B << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	string s;
	int a, b;
	bool va, vb;
	cin >> s;

	a = stoi(s.substr(0, 2));
	b = stoi(s.substr(2, 2));

	va = ((a >= 1) && (a <= 12));
	vb = ((b >= 1) && (b <= 12));

	if (va && vb) cout << "AMBIGUOUS\n";
	else if (va) cout << "MMYY\n";
	else if (vb) cout << "YYMM\n";
	else cout << "NA\n";
	
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
typedef long long ll;
typedef long double ld;
using namespace std;

int main(void){
    ll N;
    cin >> N;
    int ans=0;
    for(ll i=2; i*i<=N; ++i){
        int d=0;
        while(N%i==0){
            N /= i;
            ++d;
        }
        int now=1;
        while(now<=d){
            d -= now;
            ++now;
        }
        ans += now-1;
    }
    if(N>1) ++ans;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
n = int(input())
x, y = 1, 1

for i in range(n):
    t, a = map(int, input().split())

    l = -(-x // t)
    r = -(-y // a)
    if l > r:
        x = t * l
        y = a * l
    else:
        x = t * r
        y = a * r

    #print(x, y)

print(x + y)

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


namespace ConsoleApp76 {
    class Program {
        static void Main(string[] args) {
            string givingNum = Console.ReadLine();

            CreateData753 Create753Data = new CreateData753(); 

            List<string> saveNum = Create753Data.choseThreeStr(givingNum);
            List<int> saveInt = Create753Data.ConvertStrToIntList(saveNum);

            int count = 0;
            List<int> min = new List<int>();
            foreach(var n in saveInt) {
                count = n - 753;
                min.Add(System.Math.Abs(count));
            }
            var minA = min.Min(n => n);
            Console.WriteLine(minA);
            //Console.ReadLine();
        }

        public class CreateData753 {

            public List<string> choseThreeStr(string givingNum) {
                List<string> chooseStr = new List<string> { };
                for (int i = 0; i < givingNum.Length - 2; i++) {
                    chooseStr.Add(givingNum.Substring(i, 3));
                }

                return chooseStr;
            }

            public List<int> ConvertStrToIntList(List<string> saveStr) {
                List<int> saveNum = new List<int>();

                foreach (var n in saveStr) {
                    saveNum.Add(int.Parse(n));
                }

                return saveNum;
            }
        }
    }
}

Measured memory_bytes: 13396
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int T = sc.nextInt();
        int[] t = new int[N];
        for (int i = 0; i < N; i++) {
            t[i] = sc.nextInt();
        }

        long total = T;
        for (int i = t.length - 1; i > 0; i--) {
            total += Math.min(t[i] - t[i-1], T);
        }

        System.out.println(total);
    }
}

Measured memory_bytes: 63112
#include <iostream>
#include <vector>
#include <unordered_set>

int main()
{
  int n, m;
  std::cin >> n >> m;
  std::vector<int> edge[110000];
  std::vector<int64_t> h(n);
  for (auto& itr : h)
  {
    std::cin >> itr;
  }
  for (int i = 0; i < m; ++i)
  {
    int a, b;
    std::cin >> a >> b; --a; --b;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  int count = 0;
  for (int i = 0; i < n; ++i)
  {
    bool isGood = true;
    for (const auto& to : edge[i])
    {
      if (h[i] <= h[to])
      {
        isGood = false;
        break;
      }
    }
    if (isGood) count++;
  }
  std::cout << count << std::endl;
  return 0;
}

Measured memory_bytes: 9328
import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String w = sc.next().toLowerCase();
        int cnt = 0;
        while (sc.hasNext()) {
            if (w.equals(sc.next().toLowerCase())) cnt++;
        }
        System.out.println(cnt);
    }
}



Measured memory_bytes: 26304
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) for(ll (i)=(n)-1;(i)>=0;i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18;
bool comp(pair<int,int>a,pair<int,int>b){
    if(a.first == b.first)return a.second<b.second;
    else return a.first<b.first;
}

int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    vector<pair<int,int>>ans(n);
    rep(i,n){
        ans[i].first = a[i];
        ans[i].second = i+1;
    }
    sort(all(ans),comp);
    rep(i,n-1){
        cout<<ans[i].second<<" ";
    }
    cout<<ans[n-1].second<<endl;
}



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

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2")

using namespace std;

#define f first
#define s second
#define mp make_pair
#define all(x) x.begin(), x.end()
#define up(x, v) upper_bound(all(x), v)
#define low(x, v) lower_bound(all(x), v)
#define bin(x, v) binary_search(all(x), v)
#define FOR(k, a, b) for(int k = (a); k < (b); ++k)
#define ROF(k, a, b) for(int k = (a); k > (b); --k)
#define fn(k, n) for(int k = 0; k < n; ++k)

#define EPS 1.0e-9

#define X real()
#define Y imag()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using point = pair<double, double>;
using Vector = complex<double>;

int f(int a, int b, int x) {

	return x * x * a - b * x;
}

int main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	int N, S = 0, K = 0;

	cin >> N;

	vi x(N);
	
	for(int k = 0; k < N; ++k) {

		cin >> x[k];
		S += x[k];
		K += x[k] * x[k];
	}
	
	int low = 0, high = 100;

	while(low < high) {

		int mid = (low + high) / 2;

		int a = f(N, 2 * S, mid);
		int b = f(N, 2 * S, mid + 1);

		if(a > b)
			low = mid + 1;
		else
			high = mid;
	}

	int ans = min(f(N, 2 * S, low), f(N, 2 * S, high));

	cout << K + ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL gcd(LL a, LL b) {
	return b ? gcd(b, a % b) : a;
}
int main() {
	LL A, B; cin >> A >> B, A = gcd(A, B);
	int res = 1;
	for (int i = 2; i <= A / i; i++) if (A % i == 0) {
		res++;
		while (A % i == 0) A /= i;
	}
	if (A != 1) res++;
	cout << res << endl;
}

Measured memory_bytes: 256