akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< string > S(N);
  cin >> S;
  sort(begin(S), end(S));
  S.erase(unique(begin(S), end(S)), end(S));
  cout << S.size() << endl;
}

Measured memory_bytes: 9524
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
A = get_ints

ax = A.map.with_index { |a, i| a - (i+1) }
ax.sort!

center = ax[ax.length / 2]

puts ax.map { |a| (a - center).abs }.sum



Measured memory_bytes: 32976
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int K,T;
  cin >> K >> T;
  vector<int> a(T);
  rep(i,T) cin >> a[i];
  sort(ALL(a));
  int sum = 0;
  rep(i,T-1)
  {
    sum += a[i];
  }
  if(sum>a[T-1])
  {
    cout << 0 << endl;
  }
  else
  {
    cout << a[T-1] - sum - 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 3584
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    b = sys.stdin.readline().rstrip()
    if b == "A":
        print("T")
    elif b == "C":
        print("G")
    elif b == "G":
        print("C")
    elif b == "T":
        print("A")





Measured memory_bytes: 5740
import java.util.*;

public class Main {
	public static void main(String[] args) {
		int n = 0, q = 0;
		Scanner scanner = new Scanner(System.in);
		try {
			n = scanner.nextInt();
			q = scanner.nextInt();
		} catch (Exception e) {
		}
		ArrayList<Queue> qu = new ArrayList<Queue>();
		for (int i = 0; i < n; i++) {
			try {
				String name = scanner.next();
				int time = scanner.nextInt();
				qu.add(new Queue(name, time));
			} catch (Exception e) {
			}
		}

		int i = 0, count = 0, alltime = 0;
		while (qu.size() > 0) {
			i = i % qu.size();
			int t = qu.get(i).time;
			if (t <= q) {
				alltime += t;
				System.out.println(qu.get(i).name + " " + alltime);
				qu.remove(i);
				i--;
			} else {
				alltime += q;
				qu.get(i).time -= q;
			}
			i++;
		}

	}
}


class Queue {
	String name;
	int time;

	public Queue(String n, int t) {
		name = n;
		time = t;
	}
}

Measured memory_bytes: 76588
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int N, A;
    cin >> N >> A;
    cout << N * N - A << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from fractions import gcd

def solve(N: int, A: "List[int]"):
    L = [A[0]]
    R = [A[-1]]
    for i in range(1, N):
        L.append(gcd(L[-1], A[i]))
        R.append(gcd(R[-1], A[N-1-i]))
    mx = 0
    for i in range(N):
        if i == 0:
            m = R[N-2]
        elif i == N-1:
            m = L[N-2]
        else:
            m = gcd(L[i-1], R[N-i-2])
        if mx < m:
            mx = m
    print(mx)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


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

int main(){
    string s;
    cin>>s;
    int sz=s.size(),cnt=0,ans=0;

    for(int i=0; i<sz; i++){
        if(s.at(i)=='A'||s.at(i)=='C'||s.at(i)=='G'||s.at(i)=='T') cnt++;
        else{
            ans=max(cnt,ans);
            cnt=0;
        }
        if(i==sz-1) ans=max(cnt,ans);
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <utility>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <math.h>
#include <stdio.h>
#include <deque>

using namespace std;

#define REP(i,n,m) for( long long int i = (n); i < (m); i++ )
#define REV(v) for (auto itr = v.rbegin(); itr != v.rend(); itr++)
#define ll long long
#define ALL(a) (a).begin(), (a).end()
#define SORT(v) sort( ALL(v) );
#define LAST(v) v[v.size()-1]
#define ZERO(a) memset(a,0,sizeof(a));
#define MINUS(a) memset(a,-1,sizeof(a));
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pi pair<int, int>
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define IIN(a) int a; cin >> a;
#define LIN(a) ll a; cin >> a;
#define SIN(a) string a; cin >> a;
#define VL(v,n) vector<ll> v(n);
#define Read_VL(v,n) vector<ll> v(n);REP(i,0,n)cin>>v[i];
#define sumV(v,n) Vl(acm,n) REP(i,0,n) acm[i] = v[i] + ( i == 0 ? 0 : acm[i - 1]);
#define EPS (1e-10)
#define INF 1000000000000LL

void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}


template<class T=ll>struct Graph{
	int n;
	vector<vector<tuple<ll,T>>>edge;
	Graph(int N=1):n(N){edge.resize(n);}
	void add(ll f,ll t,T c,bool d=false){
		edge[f].emplace_back(t,c);
		if(!d)edge[t].emplace_back(f,c);
	}
	void view(){
		REP(i,0,n)for(auto&e:edge[i])
			puta(i,"=>",get<0>(e),", cost :",get<1>(e));
	}
};

bool cmp( ll a, ll b ){
  return a>b;
}

bool length_cmp( string &a, string &b ){
  return a.size() < b.size();
}

ll StoLL( string s )
{
	ll num=0;
  REP( i, 0, s.size() ){
    num = num * 10 + ( s[i] ^ 48 );
  }
  return num;
}

ll CtoLL( char c )
{
	if( 'a' <= c && c <= 'z'){
		return (ll)( c ^ 96 ) ;
	}
	else if( 'A' <= c && c <= 'Z'){
		return (ll)( c ^ 64 );
	}
  return 0;
}

ll MOD=1000000007;
ll dx[4] = { 1, 0, -1, 0 };
ll dy[4] = { 0, 1, 0, -1 };
//I ASCII code: '0' = 48; 'A' = 65; 'a' = 97

ll dp[10000][10000];
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    LIN(n) LIN(q)
    SIN(s)
    vector<ll> sum(n);
    ll temp = 0;
    sum[0] = 0;
    REP( i, 1, n+1 ){
      if(s[i] == 'C' && s[i-1] == 'A'){
        temp++;
      }
      sum[i] = temp;
    }
    REP( i, 0, q ){
      LIN(l) LIN(r)
      puta( sum[r-1] - sum[l-1] );
    }

    return 0;
}


Measured memory_bytes: 1872
#ifndef ___Class_RMQ
#define ___Class_RMQ

#include <limits>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

template <typename Type> class RMQ
{
private:

	int size;

	vector<Type> minvalue;
	vector<Type> maxvalue;

	pair<Type, Type> _query(int a, int b, int k, int l, int r)
	{
		if (r <= a || b <= l) { return make_pair(INF, -INF); }
		if (a <= l && r <= b) { return make_pair(minvalue[k], maxvalue[k]); }

		pair<Type, Type> vl = _query(a, b, 2 * k, l, (l + r) / 2);
		pair<Type, Type> vr = _query(a, b, 2 * k + 1, (l + r) / 2, r);

		return make_pair(min(vl.first, vr.first), max(vl.second, vr.second));
	}

public:

	Type INF;

	RMQ(int size_)
	{
		INF = numeric_limits<Type>::max();

		for (size = 1; size < size_;) { size <<= 1; }

		minvalue = vector<Type>(size * 2, INF);
		maxvalue = vector<Type>(size * 2, -INF);
	}

	void update(int i, const Type& x)
	{
		i += size;

		minvalue[i] = x;
		maxvalue[i] = x;

		while (i > 1)
		{
			i = i / 2;

			minvalue[i] = min(minvalue[2 * i], minvalue[2 * i + 1]);
			maxvalue[i] = max(maxvalue[2 * i], maxvalue[2 * i + 1]);
		}
	}

	pair<Type, Type> query(int s, int t)
	{
		return _query(s, t, 1, 0, size);
	}
};

#endif


// ------ main ------ //

#include <cstdio>

using namespace std;

int n, q, com, x, y;

int main()
{
	scanf("%d", &n);
	scanf("%d", &q);

	RMQ<int> r(n);

	for (int i = 0; i < q; i++)
	{
		scanf("%d", &com);
		scanf("%d", &x);
		scanf("%d", &y);

		if (com == 0) 
		{
			r.update(x, y);
		}
		if (com == 1) 
		{
			pair<int, int> p = r.query(x, y + 1);

			printf("%lld\n", p.first != r.INF ? p.first : (1LL << 31) - 1);
		}
	}

	return 0;
}

Measured memory_bytes: 4476
N,M = (int(x) for x in input().split())
ball = [1 for x in range(N)]
red = [1] + [0 for x in range(N-1)]

for i in range(M):
    x,y = (int(x) for x in input().split())
    if red[x-1] != 0:
        if ball[x-1] <= 1:
            red[x-1] = 0
        red[y-1] = 1
    ball[x-1] -= 1
    ball[y-1] += 1

print(N - sorted(red).index(1))



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

int main() {
	// your code goes here
	int a,b,f=0;
	cin>>a>>b;
    for(int i=10;i<1500;i++)
    {
        int x=i*0.08;
        int y=i*0.1;
        if(x==a && y==b)
        {
            cout<<i;
            f=1;
            break;
        }
    }
    if(!f)
    cout<<-1;
	
	
}


Measured memory_bytes: 256
l=[[]for i in range(5)]
for i in range(3):
    a=[int(j) for j in input().split()]
    l[a[0]].append(a[1])
    l[a[1]].append(a[0])
p=0
for i in range(5):
    if len(l[i])>=3:
        p=1

if p==1:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define pb push_back
const ll mod=1e9+7;
template<typename T> T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
const ll N=1e6+8;
const ll INF=1e18;
ll n,k;
ll a[100003];
ll dp[123456];
ll func(ll k){
  if(k==0)
  return 0;
  if(dp[k]!=-1)
  return dp[k];
  for(ll i=0;i<n;i++){
    if(k-a[i]>=0){
      if(func(k-a[i])==0)
      return dp[k]=1;
    }
  }
  return dp[k]=0;
}
int main(){
  IOS;
  cin>>n>>k;
  for(ll i=0;i<n;i++)
  cin>>a[i];
  memset(dp,-1,sizeof(dp));
 if(func(k)==1){
   cout<<"First";
 }
 else 
 cout<<"Second";
}

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

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

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

const long long INF = 1LL << 60;

long long h[100110];
long long dp[100110];

int main() {
  int N, K; cin >> N >> K;
  for (int i = 1; i <= N; i++) cin >> h[i];
  for (int i = 0; i < 100110; i++) dp[i] = INF;

  dp[1] = 0;

  for (int i = 1; i <= N; i++) {
    for (int k = 1; k <= K; k++) {
      chmin(dp[i+k], dp[i] + abs(h[i] - h[i+k]));
    }
  }

  cout << dp[N] << endl;
  return 0;
}

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


int main(){
    int H, W;
    cin >> H >> W;

    ll ans = 100000 * 100000LL + 1;
    for(ll i=1;i<=H-2;i++){
        vector<ll> S{i * W, (H-i) / 2 * W, (H - i + 1) / 2 * W};
        sort(S.begin(), S.end());
        ans = min(ans, S[2] - S[0]);
    }

    for(ll i=1;i<=W-2;i++){
        vector<ll> S{i * H, (W-i) / 2 * H, (W - i + 1) / 2 * H};
        sort(S.begin(), S.end());
        ans = min(ans, S[2] - S[0]);
    }

    for(ll i=1;i<=H-1;i++){
        vector<ll> S{i * W, (W+1)/2 * (H-i), W/2 * (H-i)};
        sort(S.begin(), S.end());
        ans = min(ans, S[2] - S[0]);
    }

    for(ll i=1;i<=W-1;i++){
        vector<ll> S{i * H, (H+1)/2 * (W-i), H/2 * (W-i)};
        sort(S.begin(), S.end());
        ans = min(ans, S[2] - S[0]);
    }
    cout << ans << endl;

    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

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

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}


void solve(){
    string str;
    cin >> str;

    map<char, int> mp;
    for (int i = 0; i < (int)str.size(); i++) {
        mp[str[i]]++;
    }

    if (str == "zyxwvutsrqponmlkjihgfedcba") {
        cout << -1 << endl;
        return;
    }

    if ((int)str.size() < 26) {
        char c;
        for (char i = 'a'; i <= 'z'; i++) {
            if (mp[i] == 0) {
                c = i;
                break;
            }
        }
        cout << str << c << endl;
        return;
    }

    string ans = str;
    mp[str[25]] = 0;
    mp[str[24]] = 0;
    for (int i = 25; i >= 0; i--) {
        char c;
        for (char cc = 'a'; cc <= 'z'; cc++) {
            if (mp[cc] == 0 && str < ans.substr(0,i-1) + cc) {
                cout << ans.substr(0,i-1) + cc << endl;
                return;
            }
        }

        mp[str[i-2]] = 0;
    }


    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int sum1[4], sum2[4];
  int i, j, hit, blow;

  hit = blow = 0;

  while(scanf("%d%d%d%d\n%d%d%d%d", &sum1[0], &sum1[1], &sum1[2], &sum1[3], &sum2[0], &sum2[1], &sum2[2], &sum2[3]) != EOF){

    for(i = 0; i < 4; i++){
      for(j = 0; j < 4; j++)
	if(sum1[i] == sum2[j])
	  blow++;
    }

    for(i = 0; i< 4; i++)
      if(sum1[i] == sum2[i])
	hit++;

    printf("%d %d\n", hit, blow-hit);
    hit = blow = 0;
  }
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

int main(){
  int N,K;
  string s;
  cin>>N>>K>>s;
  vector<pair<int,int>> x;
  bool flag0 = true;
  if (s[0] == '0') {
    flag0 = true;
    x.push_back({0,1});
  } else {
    flag0 = false;
  }
  int cnt(0);
  for (int i(0);i<N;i++){
    if (s[i] == '0'){
      if (flag0 == false){
        x.push_back({cnt,1});
        cnt = 0;
      }
      flag0 = true;
    }else{
      if (flag0 == true){
        x.push_back({cnt,0});
        cnt = 0;
      }
      flag0 = false;
    }
    cnt++;
  }
  if (s[int(s.size())-1] == '0'){
    x.push_back({cnt,0});
    x.push_back({0,1});
  } else{
    x.push_back({cnt,1});
  }
  int l(0);
  int ans(0),tmp(0),cnti(0);
  //for (int i(0);i<int(x.size());i++) cout << x[i].first <<" "<< x[i].second << endl;
  for (int i(0);i<int(x.size());i++){
    while(i < int(x.size())){
      if (x[i].second == 0){
        cnti++;
        if (cnti == K){
          if (i != int(x.size())){
            tmp+=x[i].first;
            i++;
            tmp+=x[i].first;
          }
          break;
        }
      }
      tmp += x[i].first;
      i++;
    }
    //cout << tmp << endl;
    ans = max(ans,tmp);
    tmp -= (x[l].first+ x[l+1].first);
    l += 2;
    cnti -= 1;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 1528
#!/usr/bin/env python3

_list = [None]*5
for i in range(5):
    _list[i] = int(input())
k = int(input())

for i in _list:
    for j in _list:
        if i != j:
            if abs(i-j) > k:
                print(":(")
                exit()
print("Yay!")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t;
    }
    return n*rep_jijo(n,x-1);
}

int main(){
    int n;
    cin >> n;
    if(n>=30){
        cout << "Yes" <<endl;
    }
    else cout << "No" <<endl; 
    return 0;
}

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

template<class INT>
std::vector<INT> factorize(INT n){
    std::vector<INT> res;
    for (INT i = 1; i * i <= n; i++){
        if (n % i == 0){
            res.push_back(i);
            if (i * i != n)
                res.push_back(n / i);
        }
    }
    return res;
}

int main(){
    int n, k;
    cin >> n >> k;
    vector<int64_t> A(n);
    copy_n(istream_iterator<int64_t>(cin), n, A.begin());
    auto factors = factorize(accumulate(A.begin(), A.end(), 0L));

    int64_t ans = 0;
    for (const auto &f: factors){
        vector<int64_t> B(n);
        for (int i = 0; i < n; i++)
            B[i] = A[i] % f;
        sort(B.begin(), B.end());
        auto S = accumulate(B.begin(), B.end(), 0L);
        auto i = S / f;
        if (max(accumulate(B.begin(), B.begin() + (n - i), 0L), i * f - accumulate(B.begin()+ (n - i), B.end(), 0L)) <= k)
            ans = max(ans, f);

    }

    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
#define rep(i, n) for(int i = 0; i<(n); i++)
using namespace std;
typedef long long ll;
static const int MAX = 200000; 
//pi = 3.14159265358979323846

int main(){

  int a, b;
  cin >> a >> b;

  if(a <= b * 2){
    cout << "0" << endl;
    return 0;
  }
  cout << a - b * 2 << endl;

}


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

class game{
	int length;
	int cur;
	int *r,*l;
	int r_score,l_score;
public:
	game(int _l){
		length = _l;
		r = new int [length];
		l = new int [length];
		r_score = 0;
		l_score = 0;
		cur = 0;
	}
	~game(){
		delete [] r;
		delete [] l;
	}
	void run();
	void insert(int,int);
};

void game::run(){
	for(int i = 0;i < length;i++){
		if(r[i] < l[i]){
			l_score += r[i] + l[i];
		}else if(r[i] > l[i]){
			r_score += r[i] + l[i];
		}else{
			l_score += l[i];
			r_score += r[i];
		}
	}
	cout<<l_score<<" "<<r_score<<endl;
}

void game::insert(int l_card,int r_card){
	r[cur] = r_card;
	l[cur] = l_card;
	cur++;
}

int main(){
	list<game*> lst;
	while(1){
		int read;
		cin>>read;
		if(read == 0){
			break;
		}
		game *g = new game(read);
		for(int i = 0; i < read;i++){
			int r_card,l_card;
			cin>>l_card>>r_card;
			//cout<<l_card<<","<<r_card<<endl;
			g->insert(l_card,r_card);
		}
		lst.push_back(g);
	}

	for(auto it = lst.begin();it != lst.end();it++){
		(*it)->run();
		delete (*it);
	}
	return 0;
}

Measured memory_bytes: 3176
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 0;
    int conf = 0;
    for (int i = 0; i < 3; i++) {
      if ((n / (int)Math.pow(10, i)) % 10 == 1) {
        ans += 9 * Math.pow(10, i);
      } else {
        ans += 1 * Math.pow(10, i);
      }
    }
    System.out.println(ans);

  }

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int length;
    string s, result_s = "";
    cin >> length >> s;
    if (s.length() > length) {
        for (int i = 0; i < length; i++) {
            result_s += s[i];
        }
        result_s += "...";
        cout << result_s;
    } else {
        cout << s;
    }
}



Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
    cout << "vowel"; 
  else
  {
    cout << "consonant";
  }
  

 
  
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s[3];
    rep(i,3) cin>>s[i];
    int turn=0;
    vi idx(3,0);
    while(idx[turn]<s[turn].size()){
        turn = s[turn][idx[turn]++]-'a';
    }
    if (turn==0) cout<<"A\n";
    if (turn==1) cout<<"B\n";
    if (turn==2) cout<<"C\n";
    return 0;
}


Measured memory_bytes: 256
import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int n, m;
    readf("%s %s", &n, &m);
    readln;

    struct key {
        int cost;
        int[] boxes;
    }
    
    key[] keys;
    foreach (_; 0 .. m) {
        int a, b;
        readf("%s %s", &a, &b);
        readln;
        
        auto arr = readln.chomp.split.map!(to!int).map!(x => x-1).array;
        
        keys ~= key(a, arr);
    }
    
    debug { keys.writeln; }
    
    auto unlockable = new bool[] (n);
    foreach (k; keys) {
        foreach (e; k.boxes) { unlockable[e] = true; }
    }
    if (!unlockable.all()) {
        writeln(-1);
        return;
    }
    
    immutable int INF = 10 ^^ 5 * 100;
    
    auto dp = new int[] (1 << n);
    dp[] = INF;
    dp[(1 << n) - 1] = 0;
    
    int unlock(int cur, int[] nrs) {
        debug { writeln(cur, ' ', nrs); }
        
        foreach (e; nrs) { cur |= (1 << e); }
        
        debug { writeln(cur); }
        
        return cur;
    }
    
    auto ord = (1 << n).iota.array.sort!((a, b) => a.popcnt() > b.popcnt()).array;
    
    debug { ord.writeln; }
    
    foreach (v; ord.dropOne) {
        foreach (e; keys) {
            dp[v] = min(dp[v], dp[unlock(v, e.boxes)] + e.cost);
        }
    }
    
    dp[0].writeln;
}

Measured memory_bytes: 892
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using f32 = float;
using f64 = double;
using i8 = int_fast8_t;
using u8 = uint_fast8_t;
using i16 = int_fast16_t;
using u16 = uint_fast16_t;
using i32 = int_fast32_t;
using u32 = uint_fast32_t;
using i64 = int_fast64_t;
using u64 = uint_fast64_t;
void resolver();
inline void fast_io()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}
template <class T>
inline std::vector<T> read_vector()
{
    size_t n;
    std::cin >> n;
    std::vector<T> ret(n);
    for (T& i : ret) {
        std::cin >> i;
    }
    return ret;
}
void t_case()
{
    i64 t;
    std::cin >> t;
    while (t--) {
        resolver();
    }
}
void single_case()
{
    resolver();
}

int main(int argc, char* argv[])
{
    fast_io();
    // t_case();
    single_case();
}

void resolver()
{
    using namespace std;

    i32 n;
    cin >> n;
    i64 sum = 0;
    for (i32 i = 1; i <= n; i++) {
        if (i % 3 != 0 && i % 5 != 0) {
            sum += i;
        }
    }
    cout << sum;
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
typedef signed long long ll;
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	cin >> n;

	f = 1;
	x = 0;
	s = "";

	if(n == 0){
		cout << 0 << endl;
		return 0;
	}

	while(n != 0){
		if(n % 2 == 0){
			s = "0" + s;
		}else{
			s = "1" + s;
			if(x % 2 == 0){
				--n;
			}else{
				++n;
			}
		}
		++x;
		n /= 2;

	}

	cout << s << endl;
}

Measured memory_bytes: 256
N, M = gets.split(' ')

m = []
M.to_i.times do
    m << 0
end

N.to_i.times do
    a = gets.split(' ')
    a = a.drop(1)
    a.each do |x|
        m[x.to_i-1] += 1
    end
end

count = 0
m.each do |x|
    if x == N.to_i then
        count += 1
    end
end

print count

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

const int64_t MOD = 1000000007;

int main() {
  int n, k;
  cin >> n >> k;
  int a[n], flag = true;
  for (int i = 0; cin >> a[i]; ++i) {
    flag &= (a[i] < 0);
  }
  priority_queue<int64_t> positive;
  auto cmp = [=](const int64_t left, const int64_t right) {
    if (flag && k % 2 == 1) {
      return left < right;
    } else {
      return left > right;
    }
  };
  priority_queue<int64_t, vector<int64_t>, decltype(cmp)> negative(cmp);
  for (int i = 0; i < n; ++i) {
    if (a[i] >= 0) {
      positive.emplace(a[i]);
    } else {
      negative.emplace(a[i]);
    }
  }
  int64_t result = 1;
  while (k > 0) {
    if (k >= 2 && negative.size() >= 2 && !positive.empty()) {
      auto n = negative.top(), p = positive.top();
      negative.pop();
      positive.pop();
      if (positive.empty() || n * negative.top() >= p * positive.top()) {
        result = result * n % MOD * negative.top() % MOD;
        negative.pop();
        positive.emplace(p);
        k -= 2;
      } else {
        result = result * p % MOD;
        negative.emplace(n);
        --k;
      }
    } else if (!positive.empty()) {
      result = result * positive.top() % MOD;
      positive.pop();
      --k;
    } else {
      result = result * negative.top() % MOD;
      negative.pop();
      --k;
    }
  }
  cout << (result + MOD) % MOD;
  return 0;
}

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

int main(void)
{
    int n,k,d[100],a[100][100],i,j,ifhave[100]={0},ans=0;

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

    for ( i = 0; i < k; i++)
    {
        scanf("%d",d+i);
        for ( j = 0; j < d[i]; j++)
        {
            scanf("%d",&a[i][j]);
            a[i][j]--;
        }
    }

    for ( i = 0; i < k; i++)
    {
        for ( j = 0; j < d[i]; j++)
        {
            ifhave[a[i][j]]=1;
        }
    }

    for ( i = 0; i < n; i++)
    {
        if(ifhave[i]==0) ans++;
    }

    printf("%d",ans);

    return 0;
}

Measured memory_bytes: 1720
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define INF 120000000

using namespace std;

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

int main() {
    char x, y;
    cin >> x >> y;
    if (x == y) {
        cout << "=" << endl;
        return 0;
    }
    cout << ((x > y) ? ">" : "<") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long 
#define N 1000005
using namespace std;
LL int n,ar[N],sum,a,x,tut,tutmac;
int main()
{
	for(int i=1;i<=3;i++)
		scanf("%lld",&ar[i]);
	sort(ar+1,ar+4);
	printf("%lld",ar[1]*ar[2]*(ar[3]%2));
}


Measured memory_bytes: 256
#include <cstdio>

int main() {
  //入力
  int a,b;
  std::scanf("%d %d",&a,&b);
 
  if(a < b) {
    std::printf("a < b");
  }
  
  else if(a > b) {
    std::printf("a > b");
  }
  else if(a == b){
      std::printf("a == b");
  }
  std::printf("\n");
  
  
  return 0;
}



Measured memory_bytes: 2656
/*input
99992
*/
/**
    Author: Kristopher Paul
    Date Created: 29-12-2019
    Contest Name:
                _/    _/   _/_/_/_/   _/   _/_/_/_/
               _/  _/     _/    _/   _/   _/
              _/_/       _/_/_/_/   _/   _/_/_/_/
             _/  _/     _/  _/     _/         _/
            _/    _/   _/    _/   _/   _/_/_/_/
**/
#include<bits/stdc++.h>
#include<stdio.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int ll
#define pb push_back
#define INF 1e18
#define MOD 1000000007
//#define MOD 998244353
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define umap unordered_map
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define all(v) v.begin(),v.end()
#define WL(t) while(t--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define out(x) cout << #x << " is " << x << endl
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

//Uncomment for File I/O
/*
#define cin fin
#define cout fout

ifstream fin("cowmbat.in");
ofstream fout("cowmbat.out");
*/

using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // set
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // multiset

int ModExp(int x,int y,int m){
    int res = 1;
    x = x % m;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % m;

        y = y>>1;
        x = (x*x) % m;
    }
    return res;
}

void solve(){
    umap<int,bool> np;
    np[1] = true; 
    int x;
    cin >> x;
    FOR(i,2,1000006){
        if(np[i] == false){
            for(int j = 2*i;j < 1000006;j += i){
                np[j] = true;
            }
            if(i >= x){
                cout << i << endl;
                return;
            }
        }
    }
}

signed main(){
    FastIO;
    int t = 1;
//    cin >> t;
    WL(t){
        solve();
    }
}


Measured memory_bytes: 37648
#include <stdio.h>
int main(){
    int a[3];
    for(int z=0;z<3;z++){
        scanf("%d", &a[z]);
    }
    int co5=0;
    int c07=0;

    for(int x=0;x<3;x++){
        if(a[x]==5){
            co5++;
        }
        else if(a[x]==7){
            c07++;
        }
    }

    if(co5==2 && c07==1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }

    

}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

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

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=0,a,b,c,cmp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;

string s,w;

vector<int> z;

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

       cin  >> n >> y;
       rrep(i,0,n+1){
           rrep(j,0,n+1){
               if(y-(10000*i+5000*j)==1000*(n-i-j) && n-i-j>=0){
                   cout << i << " " << j << " " << n-i-j << endl;
                   return 0;
               }
           }
           
       }
       cout << -1 << " " << -1 << " " << -1 << endl;
return 0;
}


Measured memory_bytes: 256
//author:emre yazicioglu

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define fori(a,b,c) for(ll a = b;a < ll(c);a++)
#define ford(a,b,c) for(ll a = b;a >= ll(c);a--)
#define pb push_back

const int N = 2e6 + 7;
ll n,m,k,ans,cur,ar[N],a,b;
string str;
vector< pair<ll,ll> > v;

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);

	// freopen("in.txt","r",stdin);
	// freopen("out.txt","w",stdout);
	
	cin >> str;
	n = str.size();

	fori(i,0,n){
		if(i && str[i] == 'R' && str[i - 1] == 'L'){
			v.pb({a, b});
			a = 1;
			b = 0;
		}
		else if(str[i] == 'R')
			a++;
		else if(str[i] == 'L')
			b++;
	}
	v.pb({a,b});
	ll j = 0, c = 0;
	for(ll i = 0;i < n;i++){
		if(c){
			c--;
			continue;
		}
		if(str[i] == 'R' && str[i + 1] == 'L'){
			if((v[j].first + v[j].second) % 2 == 0){
				cout << (v[j].first + v[j].second) / 2 << ' ' << (v[j].first + v[j].second) / 2 << ' ';
				j++;
				c = 1;
			}
			else{
				if(v[j].first & 1){
					cout << (v[j].first + v[j].second) / 2 + (v[j].first + v[j].second) % 2 << ' ' << (v[j].first + v[j].second) / 2 << ' ';
					j++;
					c = 1;
				}
				else{
					cout << (v[j].first + v[j].second) / 2 << ' ' << (v[j].first + v[j].second) / 2 + (v[j].first + v[j].second) % 2 << ' ';
					j++;
					c = 1;	
				}
			}
		}
		else
			cout << 0 << ' ';
	}
}

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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1'000'000'000ll + 7;
//const i64 smod = 998244353ll;
//const i64 inf = 1'000'000'000'000'000'000ll + 7;
//const i64 inf = 1'000'000'007;

const long double eps = 1e-8;

const i64 MAXN = 100'000 + 6;

i64 n;
i64 a[MAXN];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

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

    i64 s = 0;
    for (i64 i = 0; i <= n; i++) {
        s += a[i];
    }

    i64 R = 0;
    i64 l = 1;
    for (i64 i = 0; i <= n; i++) {
        R += l;

        if (a[i] > l) {
            cout << -1 << endl;
            return 0;
        }

        l -= a[i];
        s -= a[i];
        l = min(l * 2, s);
    }

    cout << R << endl;



    return 0;
}

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

int main() {
  int n, cnt = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    if((0 < i && i < 10) || (99 < i && i < 1000) || (9999 < i && i < 100000)) cnt++;
  }
  cout << cnt;
}

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
bool chmin(T &a,T b){if(a>b){a=b;return true;}else return false;}
template<typename T>
bool chmax(T &a,T b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll a,b,c;cin>>a>>b>>c;
  ll k=a+b-c;
  ll k2=4*a*b;
  ans1(k<=0&&k*k>k2);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

const ll MAX = 5123456;
const ll MOD = 1e9 + 7;
vector<ll> fac(MAX);
vector<ll> finv(MAX);
vector<ll> inv(MAX);

// COMinit()を忘れないように！
void COMinit(){
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(ll i = 2; i < MAX; i++){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}

ll nCr(ll n, ll r){
  if(n < r) return 0;
  if(n < 0 || r < 0) return 0;
  return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD;
}

ll g(ll r, ll c){
  return (nCr(r+c+2, r+1) - 1)%MOD;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;
  r1--; c1--;
  COMinit();
  ll ans = 0;
  ans += g(r2, c2);
  ans = ans - g(r1, c2) < 0 ? ans - g(r1, c2) + MOD : ans - g(r1, c2);
  ans = ans - g(r2, c1) < 0 ? ans - g(r2, c1) + MOD: ans - g(r2, c1);
  ans += g(r1, c1);
  cout << ans%MOD << endl;
}


Measured memory_bytes: 120320
import sys
import os
import math

def file_input():
    f = open('ABC168/input.txt', 'r')
    sys.stdin = f

def main():
    if os.getenv("ENV")=='LOCAL':
        file_input()

    A,B,H,M=map(float, input().split())

    A_r=360*(H*60+M)/(12*60)
    B_r=M*360/60

    ans=0
    dif=abs(A_r-B_r)
    if dif>180:
        dif=360-dif
        ans=math.sqrt(A*A+B*B-2*A*B*math.cos(math.radians(dif)))
    else:
        ans=math.sqrt(A*A+B*B-2*A*B*math.cos(math.radians(dif)))

    # print(math.cos(dif))

    print(ans)

if __name__ == '__main__':
    main()


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

using namespace std;

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

    vector<bool> solved(n);
    vector<int> pe(n);
    int solveCount = 0, peCount = 0;
    for (int i = 0; i < m; i++) {
        int p;
        string s;
        cin >> p >> s;
        p--;

        if (s == "AC") {
            if (!solved[p]) {
                solved[p] = true;
                solveCount++, peCount += pe[p];
            }
        } else pe[p]++;
    }

    cout << solveCount << " " << peCount << endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
i,a,t[27];
int main(void){
    char c[1201]={};
    for(i=0,scanf("%[^\r]",c);c[i]!='\0';i++){
        a=64<c[i]&&c[i]<91?c[i]-'A'
         :96<c[i]&&c[i]<123?c[i]-'a'
         :26;
        t[a]++;
    }
    for(i=0;i<26;i++){
    printf("%c : %d\n",i+97,t[i]);
    }
}

Measured memory_bytes: 1764
#include"stdio.h"

int main(){
  int n;
  int x;
  int flag=0;
  scanf("%d",&n);
  x=n/1.08;
  //if((float)(n/1.08)-(int)(n/1.08)>=0.50)x++;
  //(int)(x*1.08)==n? printf("%d",x):printf(":(");
  
  for(int i=0;i<6;i++){if((int)((x-3+i)*1.08)==n){flag=1;x=x-3+i;break;}else flag=0;}
  
  flag==1?printf("%d",x):printf(":(");
  return 0;
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll N;
    string S;
    cin >> S>>N;

    ll size = S.size();
    ll flag = 0;

    ll count = 0;
    if(size==1){
        cout << S << endl;
    }
    
    else
    {
        REP(i, size)
        {
            if (!(S.at(i) == '1'))
            {
                cout << S.at(i) << endl;
                flag = 1;
                break;
            }
            else{
                count++;
                if(N<=count){
                    cout << 1 << endl;
                    flag = 1;
                    break;
                }
            }
        }
        if (flag == 0)
        {
            cout << 1 << endl;
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <iomanip>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <utility>
using namespace std;
int ky[8] = {-1,1,-2,2,-2,2,-1,1}; 
int kx[8] = {-2,-2,-1,-1,1,1,2,2};
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int ddy[8] = {-1,0,1,-1,1,-1,0,1};
int ddx[8] = {-1,-1,-1,0,0,1,1,1};
typedef long long ll;
#define pi pair
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define rep1(i,a,b) for(int i = a; i < b; i++)
#define rep2(i,a,b) for(int i = a; i <= b; i++) 
#define INF 9999999999999
const double PI = acos(-1.0);
ll a,b,c,k;
ll ans;
ll mn;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin >> a >> b >> c >> k;
    mn = min(a,k);
    k -= mn;
    ans += 1 * mn;

    mn = min(b,k);
    k -= mn;
    ans += 0 * mn;

    mn = min(c,k);
    k -= mn;
    ans += -1 * mn;
    
    cout << ans;
    return 0;
}

Measured memory_bytes: 3652
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int total = 0;
    if(a<b){
      total += a;
      if(b<c){
        total += b;
      }else{
        total += c;
      }
    }else{
      total += b;
      if(a<c){
        total += a;
      }else{
        total += c;
      }
    }            
    System.out.println(total);
  } 
}

Measured memory_bytes: 21844