akhauriyash/Code-Regression huggingface dataset:
/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner s=new Scanner(System.in);
		int h=s.nextInt();
		
		int n=s.nextInt();
		int a[]=new int[n];
		int sum=0;
		for(int i=0;i<n;i++)
		{a[i]=s.nextInt();
		sum+=a[i];}
		if(sum>=h)
		
		System.out.println("Yes");
		else
		System.out.println("No");
	}
}

Measured memory_bytes: 51344
N, M = map(int, input().split())
A_B = []
for n in range(N):
  ai, bi = map(int, input().split())
  A_B.append((ai, bi))

A_B.sort()
count = 0
cost = 0 
for abi in A_B:
  if count == M:
    print(cost)
    exit()
  else:
    for i in range(abi[1]):
      count += 1
      cost += abi[0]
      if count == M:
        print(cost)
        exit()


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

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int prime = Integer.parseInt(sc.next());

    if (prime == 2) {
      System.out.println(prime);
      return;
    }

    if (prime % 2 == 0) {
      prime++;
    }
    
    while (true) {
      for (int i = 3; ; i+=2) {
        if (prime % i == 0) {
          prime += 2;
          break;
        }
        
        if (i > prime / 2) {
          System.out.println(prime);
          return;
        }
      }
    }
  }
}

Measured memory_bytes: 22100
N = gets.to_i
W = gets.split.map(&:to_i)

sum = W.inject(:+)
middle = sum/2
x = 0
index = 0
W.each do |w|
    x += w
    if middle <= x then
        left = x
        right = sum - x
        a = (left - right).abs
        left -= w
        right += w
        b = (left - right).abs
        puts [a,b].min
        break
    end
    index += 1
end

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

int main()
{
	int a[3][3];
	bool bl[3][3]; 
	int n;
	for (int i = 0; i < 3; i++){
		for (int j = 0; j < 3; j++){
			cin >> a[i][j];
			bl[i][j] = false;
		}
	}
	cin >> n;

	for (int i = 0; i < n; i++){
		int b;
		cin >> b;
		for (int j = 0; j < 3; j++){
			for (int k = 0; k < 3; k++){
				if (a[j][k] == b){
					bl[j][k] = true;
				}
			}
		}
	}

	bool res = false;

	for (int i = 0; i < 3; i++){
		if (bl[i][0] and bl[i][1] and bl[i][2]) res = true;
		if (bl[0][i] and bl[1][i] and bl[2][i]) res = true;
	}

	if (bl[0][0] and bl[1][1] and bl[2][2]) res = true;
	if (bl[0][2] and bl[1][1] and bl[2][0]) res = true;

	if (res) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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


typedef long double ld;
typedef long long ll;

using namespace std;



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

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

ll n, m;
vector<ll> a;

int main() {
	cin >> n >> m;
	bool odd = false;
	for (int i = 0; i < n; i++) {
		ll t;
		cin >> t;
		t /= 2;
		if (t & 1) {
			odd = true;
		}
		a.push_back(t);
	}

	ll l = 1;
	for (int i = 0; i < n; i++) {
		l = lcm(a[i], l);
		if (l > m) {
			//cerr << "lcm too big" << endl;
			cout << "0" << endl;
			return 0;
		}
	}
	//cerr << "lcm = " << l << endl;
	ll ans = 1 + (m / l - 1) / 2;
	if ((n == 1) || (l % 2 == 1)) {
		//cerr << "odd" << endl;
		cout << ans << endl;
	} else {
		int two = 1;
		while (!(l & 1)) {
			l >>= 1;
			two <<= 1;
		}
		bool ok = true;
		for (int i = 0; i < n; i++) {
			if (!((a[i] % two) == 0)) {
				ok = false;
			}
		}
		if (ok) {
			cout << ans << endl;
		} else {
			cout << 0 << endl;
		}

/*		//cerr << "even" << endl;
		if (odd) {
			//cerr << "exists odd, no sol" << endl;
			cout << "0" << endl;
		} else {
			//cerr << "all even" << endl;
			if (l % 4 == 0) {
				cout << "0" << endl;
			} else {
				cout << 1 + (m / l - 1) / 2 << endl;
			}
		}
*/
	}

	return 0;
}


Measured memory_bytes: 4300
#include <iostream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<15;
const ll MOD = 998244353;
const double EPS = 1e-9;

ll modpow(ll base, ll exp, ll mod){
  base %= mod;
  ll ret = 1;
  while(exp > 0){
    if (exp & 1) ret = (ret * base) % mod;
    exp /= 2;
    base = (base * base) % mod;
  }
  return ret;
}

int main(int argc, const char * argv[]) {
  int N; cin >> N;
  vector<int> a(N);
  for (int i=0; i<N; i++)
    cin >> a[i];

  int sum = accumulate(a.begin(), a.end(), 0);
  vector<vector<ll>> RGB(N+1, vector<ll>(sum+1, 0));
  vector<vector<ll>> GB(N+1, vector<ll>(sum+1, 0));
  RGB[0][0] = 1;
  GB[0][0] = 1;
  for (int i=1; i<N+1; i++){
    for (int j=0; j<=sum; j++){
      if (j - a[i-1] < 0){
        RGB[i][j] = 2*RGB[i-1][j] % MOD;
        GB[i][j] = GB[i-1][j] % MOD;
      }
      else{
        RGB[i][j] = (2*RGB[i-1][j] % MOD + RGB[i-1][j-a[i-1]]) % MOD;
        GB[i][j] = GB[i-1][j] % MOD + GB[i-1][j-a[i-1]] % MOD;
      }
    }
  }

  ll ans = modpow(3, N, MOD);
  int half = (sum+2-1)/2;
  for (int i=sum; i>=half; i--)
    ans = (ans - 3 * RGB[N][i] % MOD) % MOD;

  if (sum % 2 == 0)
    ans = (ans + 3 * GB[N][half] % MOD) % MOD;
  
  cout << (ans + MOD) % MOD << endl;

  return 0;
}

Measured memory_bytes: 423744
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

Total = 0

# i: 0 ~ N-1
for i in range(N):
  if min(A[i], B[i]) == B[i]:
    Total += B[i];
  else:
    Total += A[i];
    B[i] -= A[i];
    Total += min(A[i+1], B[i]);
    A[i+1] -= min(A[i+1], B[i]);
    
print(Total)

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

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

template<typename T, typename U>
istream& operator >> (istream& istr, pair<T,U>& p){
    istr >> p.first >> p.second;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& v){
    if(!v.empty()){
        ostr << v.front();
        for(auto itr = ++v.begin(); itr != v.end(); itr++)
            // ostr << *itr;
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    // ostr << p.first << p.second;
    ostr << p.first << ", " << p.second;
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& vv){
    if(!vv.empty()){
        ostr << vv.front();
        for(auto itr = ++vv.begin(); itr != vv.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& vp){
    if(!vp.empty()){
        ostr << vp.front();
        for(auto itr = ++vp.begin(); itr != vp.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<double> vd;
// vll x(n); x[i]=a;
typedef vector<vll> vvll;
typedef vector<vc> vvc;
typedef vector<vd> vvd;
// vvll x(m,vi(n)); x[i][j]=a;
typedef pair<ll,ll> pll;
typedef pair<double,double> pd;
typedef vector<pll> vpll;
typedef vector<pd> vpd;
// vpll x(n); x[i]={a,b}; x[i].first/second;

#define PI 3.1415926535897932
#define EPS 1e-12
#define INF (ll)1e+12
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

int main(){
    ll h, w, ans = 0;
    cin >> h >> w;
    if(w<=1 || h<=1) cout << 1 << endl;
    else if(w%2==0 || h%2==0) cout << h*w/2 << endl;
    else cout << h*w/2+1 << endl;
    // cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
str s;
int a,b;
int main(){
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(i%2==0){
            if(s[i]=='0'){a++;}
            else{b++;}
        }
        else{
            if(s[i]=='1'){a++;}
            else{b++;}
        }
    }
    cout<<min(a,b)<<endl;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main() {
    int n, k, result=0;
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        int f;
        cin >> f;

        if (f >= k){
            result++;
        }
    }
    printf("%d", result);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n, i, ans = INT_MAX;
  cin >> n;
  vector <int> a(n);
  for(i = 0; i < n; i++)
    cin >> a[i];
  for(i = -100; i <= 100; i++)
  {
    int sum = 0;
    for(int j = 0; j < n; j++)
      sum += (a[j] - i) * (a[j] - i);
    ans = min(sum, ans);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lmax LLONG_MAX
#define lmin LLONG_MIN
#define f(i,a,b) for(long long i=a;i<b;i++)
#define rf(i,a,b) for(long long i=a;i>=b;i--)
#define tc long long test;cin>>test;while(test--)
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define input(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define output(a,n) for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<endl;
#define endl "\n"
#define mem(a) memset(a,-1,sizeof(a))
#define ll long long
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

vector<ll> v[100005];
ll vis[100005]={0};

void dfs(ll p){
    if(vis[p]) return;
    vis[p]=1;

    for(ll x:v[p]){
        if(vis[x]==0){
            dfs(x);
        }
    }
}

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

    int place=0;
    place++;
    place--;
    ll n,m;
       place++;
    place--;
    cin>>n>>m;
   place++;
    place--;
    f(i,0,m){
           place++;
    place--;
        ll p,q;
           place++;
    place--;
        cin>>p>>q;
           place++;
    place--;
        p--;q--;
        v[q].pb(p);
           place++;
    place--;
        v[p].pb(q);
           place++;
    place--;
    }
   place++;
    place--;
    ll ans=0;
       place++;
    place--;
    dfs(0);
    f(i,0,n){
        if(vis[i]==0){
            ans++;
            dfs(i);
        }
    }
   place++;
    place--;
    cout<<ans<<endl;

    return 0;
}

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

using namespace std;

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

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

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

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

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    VV grph(n,Vec(n));
    map<ll,Vec> graph;
    string tmp;
    rep(i,n){
        cin>>tmp;
        rep(j,n){
            grph[i][j]=tmp[j]-'0';
            if(grph[i][j]==1){
                graph[i].pb(j);
            }
        }
    }
    Vec color(n,0);
    color[0]=1;
    queue<P> p;
    p.push(mp(0,1));

    while(!p.empty()){
        P &nowp = p.front();
        ll &pcol = nowp.se;
        Each(child,graph[nowp.fi]){
            if(color[child]==pcol){
                cout<<-1<<endl;
                return 0;
            }
            if(color[child]==0){
                color[child] = -pcol;
                p.push(mp(child,-pcol));
            }
        }
        p.pop();
    }

    ll ans =0;
    rep(i,n){
        Vec d(n,INF);
        d[i]=0;
        queue<ll> q;
        q.push(i);
        while(!q.empty()){
            ll &now = q.front();
            q.pop();
            ans = max(ans,d[now]);
            Each(next,graph[now]){
                if(d[now]+1<d[next]){
                    d[next] = d[now]+1;
                    q.push(next);
                }
            }
        }
    }

    cout<<ans+1<<endl;
    return  0;


}


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

long long a[405], dp[405][405], sum[405];

long long get(long long l, long long r){
    if(l == 0){return sum[r];}
    return sum[r] - sum[l-1];
}

int main() {
    long long n; cin>>n;
    for(long long i = 0; i < n; i++){
        cin>>a[i];
        if(i == 0){sum[i] = a[i];}else{sum[i] += sum[i-1] + a[i];}
    }
    for(long long L = n-1; L >= 0; --L){
        for(long long R = L; R < n; ++R){
            if(L == R){
                dp[L][R] = 0;
            }else{
                dp[L][R] = 1e18;
                long long s = get(L, R);
                for(long long i = L; i < R; i++){
                    dp[L][R] = min(dp[L][R], dp[L][i] + dp[i+1][R] + s);
                }
            }
        }
    }
    cout<<dp[0][n-1];
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


long long A, B, N;
long long solve() {
    long long x = min(B-1, N);
    return (A*x)/B - A*(x/B);
}

int main() {
    while (cin >> A >> B >> N) {
        cout << solve() << endl;
    }
}

















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

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

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

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

//ここまで毎回include
//以下プログラム

using namespace std;

long gcd(long a, long b) {
	long r = -1;
	if (a < b) {
		swap(a, b);
	}
	while (r != 0) {
		r = a % b;
		if (r == 0) {
			return b;
		}
		else {
			a = b;
			b = r;
		}
	}
}

int main() {
	long long n;
	cin >> n;
	long long result = 1;
	for (long long i = 1; i <= n; i++) {
		result *= i;
		result %= 1000000007;
		
	}
	cout << result << endl;
}



Measured memory_bytes: 384
l=list(map(int,input().split()))
ans=[int(input()) for i in range(l[2])]
n=l[0]
k=l[1]
q=l[2]
p=[k-q]*n
for num in ans:
  r=p[num-1]+1
  p[num-1]=r
for a in p:
  if(a<=0):
    print("No")
  else:
    print("Yes")
  

Measured memory_bytes: 10512
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
typedef long long int ll;
using namespace std;
using Graph = vector<vector<int> >;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin>>N;
vector<int>d(N);
rep(i,N)cin>>d[i];
int sum=0;
rep(i,N-1){
    reps(j,N,i+1){
        sum+=d[i]*d[j];
    }
}
cout<<sum<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;


    void solve()
    {
        var N = cin.nextlong;
        var M =cin.nextlong;

        var SUM = 1900 * M + 100 * (N - M);
        for (int i = 0; i < M; i++)
        {
            SUM *= 2;
        }
        WriteLine(SUM);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll sum = 0;
    ll n;
    cin >> n;
    for(ll i = 1; i <= n; i++){
        for(ll j = 1; j <= n; j++){
            for(ll k = 1; k <= n; k++){
                sum += gcd(gcd(i,j),k);
            }
        }
    }
    cout << sum << endl;
}

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

int main() {
  ll n; cin>>n;
  string ans;
  // 'a'の文字コードは97
  while(n>0){
    int mod26;
    if(n%26==0) mod26=26;

    else mod26 = n%26;
    ans = (char)(96+mod26)+ans;
    n-=mod26;
    n/=26;
  }
  cout << ans << endl;
}


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

#define FOR(a, b) for(int i=a; i<b; i++)
int grid[21][21];

struct Point
{
    int x;
    int y;
};

struct queueNode
{
    Point pt;
    int dist;
};

bool isValid(int row, int col, int ROW, int COL)
{

    return (row >= 0) && (row < ROW) &&
           (col >= 0) && (col < COL);
}

int rowNum[] = {-1, 0, 0, 1};
int colNum[] = {0, -1, 1, 0};

int BFS(Point src, Point dest, int ROW, int COL)
{

    if (!grid[src.x][src.y] || !grid[dest.x][dest.y])
        return -1;

    bool visited[ROW][COL];
    memset(visited, false, sizeof visited);

    visited[src.x][src.y] = true;

    queue<queueNode> q;

    queueNode s = {src, 0};
    q.push(s);

    while (!q.empty())
    {
        queueNode curr = q.front();
        Point pt = curr.pt;

        if (pt.x == dest.x && pt.y == dest.y)
            return curr.dist;

        q.pop();

        for (int i = 0; i < 4; i++)
        {
            int row = pt.x + rowNum[i];
            int col = pt.y + colNum[i];

            if (isValid(row, col, ROW, COL) && grid[row][col] &&
               !visited[row][col])
            {
                visited[row][col] = true;
                queueNode Adjcell = { {row, col},
                                      curr.dist + 1 };
                q.push(Adjcell);
            }
        }
    }

    return -1;
}

int main()
{
    int h, w, j;
    cin >> h >> w;
    FOR (0, h)
    {
        string buf;
        cin >> buf;
        for (j=0; j<w; j++)
        {
            if (buf[j] == '.')
                grid[i][j] = 1;
            else if (buf[j] == '#')
                grid[i][j] = 0;
        }
    }

    int ans = 0;
    FOR (0, h)
    {
        for(j=0; j<w; j++)
        {
            if (grid[i][j] == 1)
            {
                Point source = {i, j};
                for (int k=0; k<h; k++)
                {
                    for (int l=0; l<w; l++)
                    {
                        if ((i!=k || j!=l) && grid[k][l] == 1)
                        {
                            Point dest = {k, l};
                            int temp = BFS(source, dest, h, w);
                            //cout <<  temp << " " << i << " " << j <<" " << k << " " << l <<endl;
                            if (temp != INT_MAX)
                                ans = max(ans, temp);
                        }
                    }
                }
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3564
# def fac(n):
#     if n == 0:
#         return 1
#     else:
#         return n*fac(n-1)

# def com(n, r):
#     return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    
# 繰り返しx乗法x^n
def modpow(x, n, mod):
    ans = 1
    while n > 0:
        if (bin(n & 1) == bin(1)):
            ans = ans * x % mod
        x = x * x % mod
        n = n >> 1
    return ans

def modnc(n, a, mod):
    X = 1
    Y = 1
    for i in range(a):
        X = (X*(n - i)) % mod
        Y = (Y*(a - i)) % mod
    return X, Y

# # フェルマーの小定理
# set p as primary num
# set a as not multiple num of p
# a^(p-1) (mod p) = 1 (mod p)
# a^(p-2) (mod p) = a^(-1) (mod p)

# nCa = n! / (n-a)! * a! = n*n-1*...*n-(a-1)/ a*a-1*...*1 = X/Y
# nCa (mod p)  = X/Y (mod p) = X*Y^(p-2) (mod p) 

p = pow(10, 9) + 7

n, a, b = map(int, input().split())
xa, ya = modnc(n, a, p)
xb, yb = modnc(n, b, p)
ya %= p
yb %= p
nca = xa * modpow(ya, p-2, p) 
ncb = xb * modpow(yb, p-2, p)
ans = (modpow(2, n, p) - nca - ncb - 1) % p
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    string a;
    cin >> a;
    if (a[0]=='a' || a[1]=='a' || a[2]=='a'){
        if (a[0]=='b' || a[1]=='b' || a[2]=='b'){
            if (a[0]=='c' || a[1]=='c' || a[2]=='c'){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int l,r;
    l=a+b;
    r=c+d;
    if(l>r)cout<<"Left"<<endl;
    if(l==r)cout<<"Balanced"<<endl;
    if(l<r)cout<<"Right"<<endl;
    return 0;
}


Measured memory_bytes: 256
// In the name of God
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <ctime>
#include <set>
#include <map>
#include <vector>
#include <bitset>
using namespace std;

template <typename T>
T next_int() {
	T x = 0, p = 1;
	char ch;
	do { ch = getchar(); } while(ch <= ' ');
	if(ch == '-') {
		p = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		x = x * 10 + (ch - '0');
		ch = getchar();
	}
	return p * x;
}
	
const int max_int = (int)1e9 + 228;
const int max_n = (int)1e6 + 227 + 1;	
const int mod = (int)1e9 + 7;

int main() {
//	freopen(".in", "r", stdin);

	string a; cin >> a;

	bool ok[4] = {0, 0, 0, 0};
	for(int i = 0; i < a.size(); i++) {
		if(a[i] == 'N') ok[0] = 1;
		if(a[i] == 'S') ok[1] = 1;
		if(a[i] == 'W') ok[2] = 1;
		if(a[i] == 'E') ok[3] = 1; 
	}

	if((ok[0] ^ ok[1]) || (ok[2] ^ ok[3])) puts("No"); else puts("Yes");
}


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

int main(){
  int x;
  cin >> x;
  int n500 = floor(x/500);
  x = x - n500 * 500;
  int n5 = floor(x/5);
  long long int r = n500 * 1000 + n5 * 5;
  cout << r << endl;

  return 0;
}

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


int main() {
  string s;
  cin >> s;
  bool ans = false;
  if(s == "A"){
    ans = true;
  }if(s == "B"){
    ans = true;
  }if(s == "C"){
    ans = true;
  }if(s == "D"){
    ans = true;
  }if(s == "E"){
    ans = true;
  }if(s == "F"){
    ans = true;
  }if(s == "G"){
    ans = true;
  }if(s == "H"){
    ans = true;
  }if(s == "I"){
    ans = true;
  }if(s == "J"){
    ans = true;
  }if(s == "K"){
    ans = true;
  }if(s == "L"){
    ans = true;
  }if(s == "M"){
    ans = true;
  }if(s == "N"){
    ans = true;
  }if(s == "O"){
    ans = true;
  }if(s == "P"){
    ans = true;
  }if(s == "Q"){
    ans = true;
  }if(s == "R"){
    ans = true;
  }if(s == "S"){
    ans = true;
  }if(s == "T"){
    ans = true;
  }if(s == "U"){
    ans = true;
  }if(s == "V"){
    ans = true;
  }if(s == "W"){
    ans = true;
  }if(s == "X"){
    ans = true;
  }if(s == "Y"){
    ans = true;
  }if(s == "Z"){
    ans = true;
  }
  
  if(ans){
    cout << "A" << endl;
  } else {
    cout << "a" << endl;
  }
}


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

using namespace std;
using ll = long long;

int main() {
    string s;
    cin >> s;
    int check = 0;

    string rev1 = s;
    reverse(s.begin(), s.end());
    if (s == rev1) ++check;
    
    int n = s.length();
    string rev2 = s.substr(0, (n - 1) / 2);
    string rev3 = rev2;
    reverse(rev3.begin(), rev3.end());
    if (rev2 == rev3) ++check;

    string rev4 = s.substr(( n + 2 ) / 2);
    string rev5 = rev4;
    reverse(rev5.begin(), rev5.end());
    if(rev4 == rev5) ++check;
    
    if (check == 3) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    lint 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
// In the name of God

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

int n;
long long a[N], dp[N][2];

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

	cin >> n;
	
	for(int i = 0; i < n; i++) cin >> a[i];
	
	for(int i = n - 1; i >= 0; i--) {
		dp[i][0] = dp[i][1] = -1e18;

		int t = (n - i - 1) / 2;
		if(t == 0) dp[i][0] = a[i];	
		else {
			for(int j = i + 2; j < min(i+25, n); j++) {
				int k1 = (n - j - 1) / 2;
				int k2 = (n - j - 2) / 2;

				if(k1 == t - 1) dp[i][0] = max(dp[i][0], a[i] + dp[j][0]);
				if(k2 == t - 1) dp[i][0] = max(dp[i][0], a[i] + dp[j][1]);
			}
		}

		t = (n - i - 2) / 2;

		if(t == 0) dp[i][1] = a[i];
		else {
			for(int j = i + 2; j < min(i+25, n); j++) {
				int k1 = (n - j - 1) / 2;
				int k2 = (n - j - 2) / 2;
				if(k1 == t - 1) dp[i][1] = max(dp[i][1], a[i] + dp[j][0]);
				if(k2 == t - 1) dp[i][1] = max(dp[i][1], a[i] + dp[j][1]);
			}
		}
		
	}

	long long ans = -1e18;
	for(int i = 0; i < n; i++) {
		if((n-1-i)/2 + 1 == n/2) ans = max(ans, dp[i][0]);
		if((n-2-i)/2 + 1 == n/2) ans = max(ans, dp[i][1]);
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 8296
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

int main(){
	ll a,b,c,d;
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	printf("%lld",min(a,b)+min(c,d));
}

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

int main(void) {
  int n;
  cin >> n;
  string s = to_string(n);
  int d = 0;
  for (int i = 0; i < s.size(); i++) {
    d += s[i] - '0';
  }
  if (n % d == 0) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

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

int main()
{
	int L, R, d;
	cin >> L  >> R >> d;
	int cnt= 0 ;
	for(int i = L ; i <= R; i++){
		if(i%d==0){
			cnt++;
		}
	}
	cout << cnt;
	return 0;
}


Measured memory_bytes: 3560
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int M = sc.nextInt();
      int D = sc.nextInt();
      int count=0;
      for(int i=1;i<M+1;i++){
        for(int j=20;j<D+1;j++){
          int d1 = j/10;
          int d2 = j%10;
          if(d2>=2 && d1*d2==i){
            count++;
          }
        }
      }
      System.out.println(count);
    }
}

Measured memory_bytes: 35716
n = gets.to_i
a = gets.split.map(&:to_i)
puts a.join(' ')
for i in 1..(n-1)
  v = a[i]
  j = i - 1
  while j >= 0 && a[j] > v
    a[j+1] = a[j]
    j -= 1
  end
  a[j+1] = v
  puts a.join(' ')
end



Measured memory_bytes: 6892
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    int a, b;

    cin >> a >> b;
    if (a <= b)
        cout << a << endl;
    else
        cout << a - 1 << endl;
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

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

int main(int argc, char *argv[])
{
  int n, x;
  while (cin >> n >> x) {
    lli a[n];
    lli b[n];
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      b[i] = a[i];
    }
    for (int i = 0; i + 1 < n; ++i) {
      int j = i + 1;
      a[j] -= max(0LL, min(a[j], (a[i] + a[j]) - x));
      a[i] -= max(0LL, min(a[i], (a[i] + a[j]) - x));
    }
    {
      int i = n - 2;
      int j = n - 1;
      if (x < a[i] + a[j]) {
        a[j] -= max(0LL, min(a[j], a[i] + a[j] - x));
        a[i] -= max(0LL, min(a[i], a[i] + a[j] - x));
      }
    }
    lli sum = 0;
    for (int i = 0; i < n; ++i) {
      sum += b[i] - a[i];
    }
    cout << sum << endl;
  }
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int N;
    cin >> N;
    vector<long> B(N - 1);
    vector<long> A(N);
    for(int i = 0;i < N - 1;i++){
        cin >> B[i];
    }
    
    A[0] = A[1] = B[0];
    for(int i = 2;i < N;i++){
        A[i] = B[i - 1];
        if(A[i - 1] > A[i]){
            A[i - 1] = A[i];
        }
    }
    long ans = 0;
    for(int i = 0;i < N;i++){
        ans += A[i];
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define pb push_back
#define mp make_pair
#define all(a)  (a).begin(),(a).end()
#define dwn(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;
const ll inf = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	ll x, y;
	cin >> x >> y;
	if (x % y == 0) {
		cout << -1 << endl;
	}
	else {
		cout << x << endl;
	}
	return 0;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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


    lint a,b,c,k;
    cin >> a >> b >> c >> k;

    if(a+b>=k){
        cout << min(a,k) << "\n";
    }else{
        cout << a - (k - (a + b)) << "\n";
    }

    return 0;
}

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

int n,A[3],arr[10],can,ans,c,nn,nnn,bt1,bt2,bt3,tmp,tmp2,tmp3,cc,ccc;

int main(){
	scanf("%d",&n);
	for(int i=0;i<3;i++) scanf("%d",&A[i]);
	for(int i =0;i<n;i++) scanf("%d",&arr[i]);
	
	ans = 1000000000;
	
	bt1 = (1<<n)-1;
	for(int i =1;i<bt1;i++){
		c = 0;tmp =0;
		for(int j =0;j<n;j++){
			if(i&(1<<j)){
				tmp+= arr[j];
				c++;
			}
		}
		
		can = (c-1)*10+abs(tmp-A[0]);		

		for(int j =1;j<=bt1;j++){
			if((j|i) == (j^i)){
				cc =0;tmp2 =0;
				for(int k =0;k<n;k++){
					if(j&(1<<k)){
						tmp2+= arr[k];
						cc++;
					}
				}
				
				can += (cc-1)*10+abs(tmp2-A[1]);
		
				
				
				for(int k = 1;k<=bt1;k++){
					if(((i|j)|k) == ((i|j)^k)){
						ccc = 0;tmp3 =0;
						for(int l=0;l<n;l++){
							if(k&(1<<l)){
								tmp3 += arr[l];
								ccc++;
							}
						}
						can += (ccc-1)*10+abs(tmp3-A[2]);
						ans = min(ans,can);
						
						can -= (ccc-1)*10+abs(tmp3-A[2]);
					}
				}
				
				can -= (cc-1)*10+abs(tmp2-A[1]);
				
			}
			
			
		}
		
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[list(map(int,input().split()))for _ in range(n)]
ans=0
for i in range(n):
  x=c
  for j in range(m):
    x+=a[i][j]*b[j]
  if x>0:ans+=1
print(ans)

Measured memory_bytes: 3060
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // long long64_t, long long*_t
#include <cstdio> // prlong longf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
using namespace std;
int main(){
  int h,w;
  cin >> h >> w;
  vector<vector<char>> a(h,vector<char>(w));
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++) cin >> a[i][j];
  }
  for(int i=0;i<w+2; i++){
    cout << '#';
  }
  cout << endl;
   for(int i=0; i<h; i++){
     cout << '#';
    for(int j=0; j<w; j++) cout <<  a[i][j];
    cout << '#' << endl;
  }
  for(int i=0;i<w+2; i++){
    cout << '#';
  }
  cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	ll i,j,t,h,w,m,x,y,maxi=0,maxi1,maxi2,ind1,ind2;
	map<ll,ll> mp2,mp3;
	map<pair<ll,ll>,ll> mp;
	cin>>h>>w>>m;
	for(i=0;i<m;i++)
	{
		cin>>x>>y;
		mp[{x,y}]++;
		mp2[y]++;
		mp3[x]++;
	}
	vector<pair<ll,ll>> v;
	for(i=1;i<=w;i++)
	{
		v.push_back({mp2[i],i});
	}
	sort(v.begin(),v.end());
	
	maxi1=v[w-1].first;
	ind1=v[w-1].second;
	maxi2=maxi1;
	ind2=ind1;
	if(w>1)
	{
		maxi2=v[w-2].first;
		ind2=v[w-2].second;
	}
	
	for(i=1;i<=h;i++)
	{
		x=mp3[i]+mp2[ind1];
		if(mp.find({i,ind1})!=mp.end())
		{
			x--;
		}
		
		y=mp3[i]+mp2[ind2];
		if(mp.find({i,ind2})!=mp.end())
		{
			y--;
		}
		
		maxi=max(maxi,max(x,y));
	}
	v.clear();
	for(i=1;i<=h;i++)
	{
		v.push_back({mp3[i],i});
	}
	sort(v.begin(),v.end());
	
	maxi1=v[h-1].first;
	ind1=v[h-1].second;
	maxi2=maxi1;
	ind2=ind1;
	if(h>1)
	{
		maxi2=v[h-2].first;
		ind2=v[h-2].second;
	}
	
	for(i=1;i<=w;i++)
	{
		x=mp2[i]+mp3[ind1];
		if(mp.find({ind1,i})!=mp.end())
		{
			x--;
		}
		
		y=mp2[i]+mp3[ind2];
		if(mp.find({ind2,i})!=mp.end())
		{
			y--;
		}
		
		maxi=max(maxi,max(x,y));
	}
	
	cout<<maxi;
}

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

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(1)
	a, b, c, k = map(int, sys.stdin.readline().split())
	ans = 0
	if k <= a:
		print(k)
	elif k <= a + b:
		print(a)
	elif k <= a + b + c:
		print(a+(k-a-b)*-1)


main()


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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  int r;
  cin >> r;
  cout << r * 3.14159265 * 2 << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 3804
#include <iostream>

int main(int argc, char **argv) {
	int a, b, sum, digit;
	
	while(std::cin >> a >> b) {
		sum = a + b;
		
		digit = 0;
		while(sum != 0) {
			sum /= 10;
			digit += 1;
		}
		std::cout << digit << std::endl;
	}
}


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

//定数
const long long MOD1=1000000007;
const long long MOD2=998244353;
const long double PI=3.1415926535897932;
const long long MAXLL=9223372036854775807;
const long long INF=2305843009213693951;
const long long dx[]={0,1,0,-1,1,-1,1,-1};
const long long dy[]={1,0,-1,0,1,1,-1,-1};

//省略
#define ll long long
#define ull unsigned long long
#define ld long double
#define uld unsigned long double
#define pll pair<long long,long long>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define vvvl vector<vector<vector<long long>>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector<string>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<pair<long long,long long>>
#define umap unordered_map
#define uset unordered_set
#define Lqueue priority_queue<long long>
#define Squeue priority_queue<long long,vector<long long>,greater<long long>>
#define fi first
#define se second
#define mp make_pair
#define eb emplace_back

//マクロ
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rbf(a,x) for(auto& a:x)
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s);i<(long long)(n);i++)
#define bitrep(i,s,n) for(long long i=(s);i<(1LL<<(n));i++)
#define bitcheck(bit,i) (bit)&(1LL<<(i))
#define Maxe(x) *max_element((x).begin(),(x).end())
#define Mine(x) *min_element((x).begin(),(x).end())
#define Size(x) ((long long)(x).size())
#define Lin(s) getline(cin,(s))

//Yes,No
void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}

//MAX,MIN
template<class T,class U> auto max(T a,U b){return a>b?a:b;}
template<class T,class U> auto min(T a,U b){return a<b?a:b;}

//最大公約数,最小公倍数
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a,long long b){return a/gcd(a,b)*b;}

//切り上げ除算
long long cutup(long long a,long long b){return (a+b-1)/b;}

//累乗
template<typename t>
constexpr t my_pow(t a,long long b){
    if(b==0)return 1;
    if(a==0)return 0;
    t x=1;
    while(b>0){
        if(b&1LL)x*=a;
        a*=a;
        b>>=1LL;
    }
    return x;
}
#define pow my_pow

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

//組み合わせ O(r)
template<typename t>
constexpr t nCr(t n,long long r){
    if(r==0)return 1;
    if(n==0)return 0;
    if(n<r)return 0;
    t x=1;
    for(long long i=1;i<=r;i++){
        x*=n-i+1;
        x/=i;
    }
    return x;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll d,t,s;
    cin>>d>>t>>s;
    Yes(d<=t*s);
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define drep2(j,n) for(int j = (n)-1; j >= 0; --j)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define srep2(j,s,t) for (int j = s; j < t; ++j)
#define srep3(k,s,t) for (int k = s; k < t; ++k)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int H,W;
  cin >> H >> W;
  int N;
  cin >> N;
  vi arr;
  rep(i,N) {
    int x;
    cin >> x;
    rep(j,x) {
      arr.emplace_back(i+1);
    }
  }
  
  rep(i,H*W) {
    int l = i/W;
    
    if(i % W == 0) {
      if(i != 0) {
        cout << endl;
      }
    } else {
      cout << " ";
    }
    if(l % 2 == 0) {
      cout << arr[i];
    } else {
      cout << arr[(W-(i % W))-1+ l*W];
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#define NUM 3
using namespace std ;

int main( void )
{
    int array[ NUM ] , min = 30000 ;
    for( auto &a : array )
    {
        cin >> a ;
    }

    for( int i = 0 ; i < NUM ; i++ )
    {
        for( int j = i + 1 ; j < NUM ; j++ )
        {
            int k = array[ i ] + array[ j ] ;
            if( k < min )
                min = k ;
        }
    }
    cout << min << endl ;
}


Measured memory_bytes: 256