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

typedef long long int ll;
typedef long double ld;

using namespace std;


int main()
{
    ll n,m,i,j,cnt=0,ans=0;
    cin>>m>>n;
    int a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
        cnt+=a[i];
    }
    if(cnt>m){
        cout<<-1<<endl;
    }
    else{
        cout<<m-cnt<<endl;
    }

    //cout<<"Case "<<cn<<": "<<"good"<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
#include <set> 
using namespace std;

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

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

const ll INF = 1e15;
const ll MAX = 510000;
const ll MOD = 1000000007;


int main(void) {
	ll N; cin >> N;
	cout << N * (N + 1) / 2 - N << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
	map<string, int> dic;
	dic["SUN"] = 7;
	dic["MON"] = 6;
	dic["TUE"] = 5;
	dic["WED"] = 4;
	dic["THU"] = 3;
	dic["FRI"] = 2;
	dic["SAT"] = 1;

	string s;
	cin >> s;
	int dif = dic[s];
	cout << dif << endl;
	return 0;
}

Measured memory_bytes: 256
#include <string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,h[100005];
ll dp[100005];
#define ALL(v)  (v).begin(),(v).end()
std::set<int> st;
//#define MAX(a,b) if(a>b)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))

    /*  ペア関連
    //vector<pair<long long, long long> > pairs(N);
    for(long long i=0; i<N; i++){
        long long a, b;
        cin >> a >> b;
        pairs[i] = make_pair(a, b);
    }
    
    //sort(pairs.begin(), pairs.end(),greater<pair<int,int> >());
	sort(pairs.begin(), pairs.end());
    */

 	//stack<int> sta;   
    //queue<int> que;


int main(){
	
	long long N,M,K;
	//string s;
    
	std::cin >> N;
    //std::cin >> N >> M;
    //std::cin >> N >> M >> K;
    
	std::vector<long long> v(N);
	std::vector<long long> w(N);
    //std::cin >> s;
    
    
    // 配列入力
    /*
    for(long long i=0; i<N; i++){
		std::cin >> v[i];
	}
	*/
	/*
	for(long long i=0; i<N; i++){
		std::cin >> w[i];
	}
	*/
	
	
	//ソート
    //std::sort(v.begin(),v.end());//昇順ソート
    //std::sort(v.begin(),v.end(),std::greater<long long>());//降順ソート
    //std::sort(w.begin(),w.end());//昇順ソート
    //std::sort(w.begin(),w.end(),std::greater<long long>());//降順ソート
    /*
    for(long long i=0; i<N; i++){
		std::cin >> v[i];
		if(st.find(v[i])==st.end()){
			st.insert(v[i]);
		}
		else{
			st.erase(v[i]);
		}
	}
	*/

    
    long long sum,sum1;
	sum=0;
	sum1=0;
	int flg,flg1,cnt,cnt1;
	flg=0;
	flg1=0;
	cnt=0;
	cnt1=0;
	int max;
	int max1;
	max=0;
	max1=0;
	int min;
	int min1;
	min=INF;
	min1=INF;

	int work;
	work=0;
	
    
	//sum=saiki(N);
	
	
	//文字列入力
	
	//for(long long i=0; i<s.length(); i++){
		
	//if(s[0]<='1' && s[1]<=2){
	//}
	//}
	
	int work1,work2,work3,work4;
	work1=0;
	work2=0;
	work3=0;
	work4=0;
	int a[4];
	int value;
	value=N;
	a[0] = (value % 10); 
	value /= 10;// 1桁目を取り出す
	a[1] = (value % 10); 
	value /= 10;// 2桁目を取り出す
	a[2] = (value % 10); 
	value /= 10;// 3桁目を取り出す
	a[3] = (value % 10); 
	value /= 10;// 4桁目を取り出す
    work1=a[0]+10*a[1];
    work2=a[2]+10*a[3];
    if(1){
		if(work1>=1 && work1<=12 && work2>=1 && work2<=12){
			 
    	//printf("%d",work1);
    	//printf("%d",work2);
    		puts("AMBIGUOUS");
    	}
    	else if(work1>=1 && work1<=12 && (work2==0 || work2>12)){
    		puts("YYMM");
    	}
    	else if(work2>=1 && work2<=12 && (work1==0 || work1>12)){
    		puts("MMYY");
    	}
    	else{
			puts("NA");
		}
    	//printf("%d",st.size());
    	//文字列の出力
    	//std::cout << s << std::endl;
    	//cout << sum/mod << endl;
	}
	else{
		//puts("No");
	}
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

ll n, l, t, x, w, ans[100010];
vector<ll> con;
vector<P> clo, rev;

int main()
{
	cin >> n >> l >> t;
	for (int i = 1; i <= n; i++)
	{
		cin >> x >> w;
		if (w == 1)
		{
			con.push_back((x + t) % l);
			clo.push_back(P(i, x));
		}
		else
		{
			con.push_back((x + l - (t % l)) % l);
			rev.push_back(P(i, x));
		}
	}
	sort(con.begin(), con.end());
	if (clo.size() == 0)
	{
		for (int i = 0; i < rev.size(); i++)
		{
			ans[rev[i].first] = (rev[i].second + l - (t % l)) % l;
		}
	}
	else if (rev.size() == 0)
	{
		for (int i = 0; i < clo.size(); i++)
		{
			ans[clo[i].first] = (clo[i].second + t) % l;
		}
	}
	else
	{
		ll num = 0;
		for (int i = 0; i < rev.size(); i++)
		{
			ll len = (rev[i].second + l - clo[0].second) % l;
			num += t * 2 / l;
			if (t * 2 % l >= len)
			{
				num++;
			}
		}
		ll u = (clo[0].second + t) % l, s;
		ll ant = (num + clo[0].first) % n;
		if (ant == 0) ant = n;
		for (int i = con.size() - 1; i >= 0; i--)
		{
			if (u == con[i])
			{
				s = i;
				break;
			}
		}
		for (int i = 1; i <= n; i++)
		{
			if (ant < i)
			{
				ans[i] = con[((i - ant) + s) % n];
			}
			else if (ant == i)
			{
				ans[i] = con[s];
			}
			else
			{
				ans[i] = con[(s + n - (ant - i)) % n];
			}
		}
	}
	for (int i = 1; i <= n; i++)
	{
		cout << ans[i] << endl;
	}
	cin >> n;
}

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


int main() {
    int n;
    ll a, b;
    cin >> n >> a >> b;
    ll x[n];
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
    ll dis[n];
    for (int i = 1; i < n; i++) {
        dis[i] = a * (x[i] - x[i - 1]);
    }
    ll ans = 0;
    for (int i = 1; i < n; i++) {
        if (dis[i] < b) {
            ans += dis[i];
        } else {
            ans += b;
        }

    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int inf = 1e9;

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    while (cin >> n) {
        int h = -inf; bool good = true;
        FOR(i,0,n) {
            int x; cin >> x;
            if (x < h) 
                good = false;
            else if (x > h)
                h = --x;
            else
                h = x;
        }
        if (good)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		double b = sc.nextDouble();
		
		BigDecimal bd = new BigDecimal(String.valueOf(a));
		BigDecimal bd1 = new BigDecimal(String.valueOf(b));
		BigDecimal bd2 = bd1.multiply(bd);
		BigDecimal bd3 = bd2.setScale(0, RoundingMode.DOWN);
		
		System.out.println(bd3);
	}

}

Measured memory_bytes: 37696
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
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 T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


string st;

int main() {
    while (cin >> st) {
        st[3] = '8';
        cout << st << endl;
    }
}


















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

#define	MOD 1000000007;
#define PI 3.14159265358979323846;
using namespace std;
typedef long long ll;
ll mod = 1000000007;

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

	ll A[200];
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	ll count = 0;
	while (true) {
		bool allEven = true;
		for (int i = 0; i < N; i++)
		{
			if (A[i] % 2 != 0)
			{
				allEven = false;
			}
		}

		if (allEven)
		{
			count++;
			for (int j = 0; j < N; j++)
			{
				A[j] /= 2;
			}
		}
		else {
			break;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val list =  readLine()!!.split(" ").map{it.toInt()}
    var counter=0
    for(i in 1..n){
        if(list[i-1]!=i)counter++
    }
    if(counter==0 || counter==2){
        println("YES")
    }else{
        println("NO")
    }
}

Measured memory_bytes: 37864
#include<bits/stdc++.h>
using namespace std;
// make pair, tuple
// __gcd(int, int)
// bool isPrime(int n){
//       if(n <= 1)return false;
//       if(n <= 3)return true;
//       if(n % 2 == 0 || n % 3 == 0)return false;
//       for(int i = 5;i * i <= n;i += 6){
//             if(n % i == 0 || n % (i + 2) == 0)return false;
//       }
//       return true;
// }
// int countSubString(string s, string temp){
//       int ans = 0;
//       size_t f = s.find(temp);
//       while(f != string::npos){
//             ans++;
//             f = s.find(temp, f + 1);
//       }
//       return ans;
// }

int main(){
    int n;cin >> n;
    map<string, int> m;
    long long int ans = 0ll;
    for(int i = 0;i < n;i++){
        string t;cin >> t;
        sort(t.begin(), t.end());
        if(m[t] > 0)ans += m[t];
        m[t]++;
    }
    cout << ans;
}

Measured memory_bytes: 11136
from functools import reduce

def gcds(a, b):
	while b:
		a, b = b, a % b
	return a

def gcd(*num):
    return reduce(gcds, *num)

def main():
    N, X = map(int, input().split(' '))
    x_n = list(map(int, input().split(' ')))

    x_n = sorted(x_n)
    x_n = [n - X for n in x_n] # スタートを0からに
    
    print(abs(gcd(x_n)))
    return

main()

Measured memory_bytes: 14748
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;


ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222






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



  ll a, b, c;
  cin >> a >> b >> c;
  cout << (c / a)*b << endl;





  return 0;
}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		
		solve();flush();
		
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<Integer> one = nextIntArray();
		int N = one.get(0);
		int M = one.get(1);
		int L = 1;
		int R = N;
		for(int i = 0; i < M; i++){
			ArrayList<Integer> tmp = nextIntArray();
			L = Math.max(L, tmp.get(0));
			R = Math.min(R, tmp.get(1));
		}
		myout(Math.max(R - L + 1, 0));
	}
	//Method addition frame start




	//Method addition frame end
}


Measured memory_bytes: 55848
// Sakhiya07 - Yagnik Sakhiya
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
 
#define mp make_pair
#define bp __builtin_popcountll
#define MOD  1000000007
const int N = 10000;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));
 
void solve()
{
   ll n,p;
   p = 2019;
   string s;
   cin >> s;
    n = s.size();
   ll suf[n+1]={0};
   ll ten = 1;
   map<ll,ll> y;
   y[0] = 1;
   ll ans = 0;
   for(ll i=n-1;i>=0;i--)
   {
       suf[i] = ((s[i] - '0')*ten)%p;
       suf[i] = (suf[i] + suf[i+1])%p;
       ans += y[suf[i]];
       y[suf[i]]++;
       ten *= 10;
       ten %= p;
   }
   cout<<ans;
}

int main()
{
    FAST;
    ll t = 1;
 //   cin >> t;
    while(t--)
    {
     solve();
    }
}

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

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  int C[N], A[N][M];
  for (int i=0; i<N; i++) {
    cin >> C[i];
    for (int j=0; j<M; j++)
      cin >> A[i][j];
  }
  int ans = 10000000;
  for (int i = 0; i<(1<<N); i++) {
    int tmp = 0, a[12] = {};
    for (int j=0; j<N; j++) {
      if (i&(1<<j)) {
        tmp += C[j];
        for (int k=0; k<M; k++)
          a[k] += A[j][k];
      }
    }
    bool c = true;
    for (int j=0; j<M; j++)
      if (a[j]<X)
        c = false;
    if (c)
      ans = min(ans, tmp);
  }
  if (ans == 10000000)
    ans = -1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
#include<stdio.h>
int main(void){
int n1,n2,sum;
scanf("%d%d",&n1,&n2);
if((n1>=1 && n1<=9) &&(n2>=1 && n2<=9)){
sum=n1*n2;
printf("%d",sum);
}else {
printf("-1");
}
return 0;
}

Measured memory_bytes: 128
# coding: utf-8
# Your code here!
n=int(input())
ab=[]
flg=0
for i in range(n):
    ab.append(list(map(int,input().split())))
t=0
ab.sort(key=lambda x:x[1])

for i in range(len(ab)):
    t+=ab[i][0]
    if t>ab[i][1]:
        flg=1
if flg==0:
    print("Yes")
else:
    print("No")

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

int main(){
    int n ;
    cin >> n ;
    vector<int> h(n) ;
    for (size_t i = 0; i < n; i++)
    {
        cin >> h.at(i) ;
    }
    bool ans = true ;
    for (size_t i = 0; i < n-1; i++)
    {
        if (h.at(i) < h.at(i+1))
        {
            h.at(i+1) -= 1 ;
        }
        else if (h.at(i) > h.at(i+1))
        {
            ans = false ;
            break ;
        }
        
        
    }
    if (ans == true)
    {
        cout << "Yes" << endl;
    }else
    {
        cout << "No" << endl;
    }
    
    
    
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define strall(v) (v).cbegin(),(v).cend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}


int main() {
 int a,b,c,d;
 cin >> a >> b >> c >> d;
 int ans = 0;
 ans += min(a,b);
 ans += min(c,d);
 cout << ans << endl;
}


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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    ll h, w;
    cin >> h >> w;
    vector<string> s(h);
    REP(i, h) cin >> s[i];
    vector<vector<ll>> ans(h, vector<ll>(w, 0));
    // 横列
    REP(i, h){
        ll start = 0;
        REP(j, w){
            if(s[i][j] == '#'){
                for(ll k = start; k < j; k++) ans[i][k] += j - start;
                start = j + 1;
            }
        }
        for(ll k = start; k < w; k++) ans[i][k] += w - start;
    }
    // 縦列
    REP(j, w){
        ll start = 0;
        REP(i, h){
            if(s[i][j] == '#'){
                for(ll k = start; k < i; k++) ans[k][j] += i - start;
                start = i + 1;
            }
        }
        for(ll k = start; k < h; k++) ans[k][j] += h - start;
    }
    ll ans_max = 0;
    REP(i, h){
        REP(j, w){
            ans[i][j]--;
            ans_max = max(ans_max, ans[i][j]);
        }
    }
    cout << ans_max;
    return 0;
}

Measured memory_bytes: 42264
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int a,b,c,k; cin>>a>>b>>c>>k;
    int mx; mx = max({a,b,c});
    int diff;
    if (a==mx) diff = a; else if (b==mx) diff=b; else diff=c;
    for (int i=0; i<k; i++) mx *= 2;
    cout << a+b+c+mx-diff << endl;
}

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

#define pb push_back
#define mk make_pair
#define lob lower_bound
#define upb upper_bound
#define fst first
#define scd second

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

inline int read(){
	int f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
inline ll readll(){
	ll f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int MAXN=3005;
int n,MOD,fac[MAXN],invf[MAXN],S[MAXN][MAXN];
inline int mod(int x){return x<MOD?(x<0?x+MOD:x):x-MOD;}
inline int pow_mod(int x,int i,int m=MOD){int y=1;while(i){if(i&1)y=(ll)y*x%m;x=(ll)x*x%m;i>>=1;}return y;}
inline int comb(int n,int k){if(n<k)return 0;return (ll)fac[n]*invf[k]%MOD*invf[n-k]%MOD;}
int main() {
	n=read();MOD=read();
	fac[0]=1;for(int i=1;i<=n;++i)fac[i]=(ll)fac[i-1]*i%MOD;
	invf[n]=pow_mod(fac[n],MOD-2);
	for(int i=n-1;i>=0;--i)invf[i]=(ll)invf[i+1]*(i+1)%MOD;
	for(int i=0;i<=n+1;++i){
		S[i][0]=0;S[i][i]=1;
		for(int j=1;j<i;++j){
			S[i][j]=mod((ll)j*S[i-1][j]%MOD+S[i-1][j-1]);
		}
	}
	int ans=0;
	for(int i=0;i<=n;++i){
		int x=(ll)comb(n,i)*pow_mod(2,pow_mod(2,n-i,MOD-1))%MOD,s=0;
		if(i&1)x=mod(MOD-x);
		for(int j=0;j<=i;++j){
			s=mod(s+(ll)pow_mod(2,(n-i)*j)*S[i+1][j+1]%MOD);
		}
		ans=mod(ans+(ll)x*s%MOD);
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

int main() {
  int N;
  string s;
  cin >> N;
  cin >> s;
  
  int nr = 0, ng = 0, nb = 0;
  for (int i = 0; i < N; ++i) {
    switch (s[i]) {
      case 'R':
        nr++;
        break;
      case 'G':
        ng++;
        break;
      case 'B':
        nb++;
        break;
    }
  }
  
  long ans = (long)nr * ng * nb;
  long cnt = 0;
  for (int d = 1; d <= N / 2; ++d) {
    for (int i = 0; i + 2 * d < N; ++i) {
      int j = i + d;
      int k = i + 2 * d;
      if (s[i] != s[j] &&
          s[j] != s[k] &&
          s[k] != s[i]) {
        cnt++;
      }
    }
  }
  cout << ans - cnt << endl;
  
  return 0;
}

Measured memory_bytes: 3144
#include <iostream>

using namespace std;

int findSumOfDigits(int x){
  int s = 0;
  while(x > 0){
   s += x % 10;
   x /= 10;
  }
  return s;
}

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  int ans = 0;
  for(int i = 0; i <= N; i++){
    int sum = 0;
    sum = findSumOfDigits(i);
    if( A <= sum && sum <= B){
      ans += i;
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
from collections import deque
b = deque([])
if n%2==0:
    for i in range(n):
        if i%2==1:
            b.appendleft(a[i])
        else:
            b.append(a[i])
else:
    for i in range(n):
        if i%2==1:
            b.append(a[i])
        else:
            b.appendleft(a[i])
print(" ".join(map(str,b)))

Measured memory_bytes: 123476
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = 100001;
		boolean[] isPrime = new boolean[N];
		for(int i=2;i<N;++i) isPrime[i] = true;
		for(int i=2;i<=(int)Math.sqrt((double)N);++i){
			if(isPrime[i]){
				for(int j=2*i;j<N;j+=i) isPrime[j] = false;
			}
		}		
		int[] ruiseki = new int[N];
		ruiseki[1] = 0;
		for(int i=3;i<N;i+=2){
			if(isPrime[i]&&isPrime[(i+1)/2]) ruiseki[i]++;
			ruiseki[i] += ruiseki[i-2];
		}
		
		int Q = sc.nextInt();
		for(int i=0;i<Q;++i){
			int l = sc.nextInt()-2;
			if(l<0) l=1;
			int r = sc.nextInt();
			System.out.println(ruiseki[r]-ruiseki[l]);
		}
		return;
	}
}

Measured memory_bytes: 67532
#include<iostream>
#include<algorithm>
#include<string>
using namespace std ;
int main()
{
    string arr="",p="",q="";
    int n,a,b,t=1;
    cin >> n ;
    for(int i=1;i<=n;i++){int x ; cin >> x ; char c = x+'0';p+=c;}
    for(int i=1;i<=n;i++){int x ; cin >> x ; char c = x+'0';q+=c;}
    for(int i=1;i<=n;i++){char c = i +'0';arr+=c;}
    do
    {
       if(arr==p){a=t;}
       if(arr==q){b=t;}
       t++;
    }
    while(next_permutation(arr.begin(),arr.end()));
    int ans = a > b ? (a-b):(b-a);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long f(long long in){
    if(in%2==0){
        return in/2;
    }else{
        return (3*in+1);
    }
}
int main(){
    long long s;
    cin >> s;
    vector <long long> a;
    a.push_back(s);
    long long cnt = 1;
    while(true){
        cnt++;
        long long tmp = f(a.back());
        for(long long i = 0; i < a.size(); i++){
            if(a[i]==tmp){
                cout << cnt << endl;
                return 0;
            }
        }
        a.push_back(tmp);
    }
    return 0;
}

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

#define lp(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define ff first
#define ss second

using namespace std;

void goldenApple(){
    double n, d;
    cin >> n >> d;
    cout << ceil(n / (2 * d + 1));
}

int main() {
    goldenApple();
}

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

int main() {
	int n = 3, a, sum = 0, max = 0;
	for (int i = 0; i < n; i++) {
		cin >> a;
		sum += a;
		if (a > max)
			max = a;
	}
	cout << sum - max << endl;
}


Measured memory_bytes: 256
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let h: usize = read(&mut stdin_lock, &mut buf, b' ');
    let w: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut sv: Vec<Vec<char>> = Vec::new();
    for _ in 0..h {
        let s: String = read(&mut stdin_lock, &mut buf, b'\n');
        sv.push(s.chars().collect());
    }

    let mut ans = true;
    for y in 0..h {
        for x in 0..w {
            if sv[y][x] == '#' {
                let t = if y < 1 { false } else { sv[y - 1][x] == '#' };
                let l = if x < 1 { false } else { sv[y][x - 1] == '#' };
                let r = if x + 1 >= w {
                    false
                } else {
                    sv[y][x + 1] == '#'
                };
                let b = if y + 1 >= h {
                    false
                } else {
                    sv[y + 1][x] == '#'
                };
                if !(t || l || r || b) {
                    ans = false;
                }
            }
        }
    }

    println!("{}", if ans { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
n,capacity=map(int,input().split())
weights=[0]*n
values=[0]*n
for i in range(n):
    weights[i],values[i]=map(int,input().split())
maxValue=sum(values)
dp=[[float("inf")]*(maxValue+1) for i in range(n+1)]
for i in range(n+1):
    dp[i][0]=0

for i in range(1,n+1):
    for j in range(1,maxValue+1):
        if(values[i-1]<=j):
            dp[i][j]=min(weights[i-1]+dp[i-1][j- values[i-1]],dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]

ans=0
for i in range(maxValue+1):
    if(dp[n][i]<=capacity):
        ans=i
print(ans)

Measured memory_bytes: 318228
A, B, C, X = 4.times.map{gets.to_i}

count = 0

(0..A).each { |i|
  (0..B).each { |j|
    (0..C).each { |k|
      count += 1 if 0 == (X - (i * 500 + j * 100 + k * 50))
    }
  }
}

p count

Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int x,a;
  cin >> x >> a;
  if (x < a) cout << 0 << endl;
  else cout << 10 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <list>
#include <queue>
#include <string.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <stack>
using namespace std; 
typedef long long ll; 


int main(){
    
    int n,k; cin>>n>>k; 
    if(n%k==0) cout<<0; 
    else cout<<1; 

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main() {
	int n; cin >> n;
	vector<double> x(n);
	vector<string> u(n);
	double ans = 0.0;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> u[i];
		if (u[i] == "BTC") {
			x[i] = x[i] * 380000.0;
		}
		ans += x[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    ll X; cin >> X;

    ll d1 = X / 500;
    X %= 500;

    ll d2 = X / 5;
    X %= 5;

    cout << d1 * 1000 + d2 * 5 << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        String b = sc.next();
        int answer = 0;
        for (int i = 3; i <= a; i++) {
            if (b.substring(i - 3, i).equals("ABC")) {
                answer++;
            }
        }
        System.out.println(answer);
    }
}


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

int main(){

	int l = 0, x = 0, y = 0, z = 0;

	cin >> l;

	for(int i=0; i < l ; i++){
		cin >> x >> y >> z;

		if( x * x == y * y + z * z ||  x * x + y * y == z * z ||  x * x + z * z == y * y){
			cout << "YES" << endl;
		}

		else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1152
import java.io.*;
import java.util.*;
import java.math.*;
class Main
{ 
	public static int M = 1000000007;
    public static void main(String[] args)throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int n = Integer.parseInt(br.readLine());
        String[] s = br.readLine().split(" ");
        int[] a = new int[n];
        for(int i=0;i<n;i++)
        	a[i] = Integer.parseInt(s[i]);
        Arrays.sort(a);
        out.println(a[n-1]-a[0]);
        out.flush();
    }
    /** Loops
    *	i: for(int i=0;i<n;i++)
    *	j: for(int j=0;j<n;j++)
    *	k: for(int k=0;k<n;k++)

    *	ArrayList<Integer> arr1 = new ArrayList<>();
    
    * 	HashMap
    *	HashMap<Integer, Integer> hm = new HashMap<>();
    * 	for (Map.Entry<String,String> entry : hm.entrySet()) 
    		out.println(entry.getValue());
    
    *	Count frequencies
    	for(int i=0;i<n;i++)
        {
            Integer c = hm.get(Integer.parseInt(s[i]));
            if(c==null)
                hm.put(Integer.parseInt(s[i]),1);
            else
                hm.put(Integer.parseInt(s[i]),++c);
        }
	**/		
    public static long modularExpo(long x,long n,int M)
	{
		long result=1;
		while(n>0)
		{
		    if(n%2==1)
		        result=(result*x)%M;
		    x=(x*x)%M;
		    n=n/2;
		}	
		return result;												
	}
	//FLT, only when a and M are co-prime
	public static long modInverse(int a,int M)
	{
		long g = gcd(a,M);
		if(g!=1)
			return -1;
	    return modularExpo(a,M-2,M);
	}
	public static long gcd(long a, long b) 
	{
	    if(b==0)
	        return a;
	    else
	        return gcd(b, a % b);
	}
}

Measured memory_bytes: 21204
#include<stdio.h>
int main(void)
{
	int a[3];
	scanf("%d%d%d",&a[0],&a[1],&a[2]);
	int i,j,temp;
	for(i=0;i<3;i++){
		for(j=3;j>i;j--){
			if(a[j-1] > a[j]){
				temp = a[j-1];
				a[j-1] = a[j];
				a[j] = temp;
			}
		}
	}
	printf("%d",a[2]+a[1]);
	return 0;
}


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

namespace ConsoleApp66 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int H = st[0];
            int W = st[1];

            string[] S = new string[H];



            for (int i = 0; i < H; i++) {
                S[i] = Console.ReadLine();
            }

            string[] S_ans = new string[H];

            int cnt = 0;

            for (int h = 0; h < H; h++) {
                for (int w = 0; w < W; w++) {
                    cnt = 0;

                    if (S[h][w] == '#') {
                        S_ans[h] += "#";
                    } else if (S[h][w] == '.') {
                        if (w - 1 >= 0 && S[h][w - 1] == '#') cnt++;
                        if (w + 1 < W && S[h][w + 1] == '#') cnt++;
                        if (h - 1 >= 0 && w - 1 >= 0 && S[h - 1][w - 1] == '#') cnt++;
                        if (h - 1 >= 0 && S[h - 1][w] == '#') cnt++;
                        if (h - 1 >= 0 && w + 1 < W && S[h - 1][w + 1] == '#') cnt++;
                        if (h + 1 < H && w - 1 >= 0 && S[h + 1][w - 1] == '#') cnt++;
                        if (h + 1 < H && S[h + 1][w] == '#') cnt++;
                        if (h + 1 < H && w + 1 < W && S[h + 1][w + 1] == '#') cnt++;
                        S_ans[h] += cnt.ToString();
                    }
                }
            }

            for (int i = 0; i < H; i++) {
                Console.WriteLine(S_ans[i]);

            }
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll MOD = 998244353;


int main() {
    double a, b, h, m; 
    cin >> a >> b >> h >> m;

    double pi = acos(-1);
    double deg = 2*pi*(h/12 + m/720 - m/60);
    double c2 = a*a + b*b - 2.0*a*b*cos(deg);
    double c = sqrt(c2); 
    cout << setprecision(20) << c << endl; 
    return 0;
}

Measured memory_bytes: 4256
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const ll M=1000000007;
const ll MM=998244353;
ll begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";

 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(a<=0)return 0;
  a%=m;
  if(!b)return 1;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}


const ll N=2e5+5;

 
int main()
{ 

IOS;

ll n,k;
cin>>n>>k;

vl a(n);

ll mx=0;

FOR(i,n)cin>>a[i],chmax(mx,a[i]);


ll l=1,r=1e9,mid;
ll ans=mx;
ll cnt=0;
while(l<=r){
  mid=(l+r)/2;
  ll times=0;
  FOR(i,n){
    ll y=(a[i]-1)/mid;
    times+=y;
  }

//d2(mid,times);
  if(times<=k){
    chmin(ans,round(mid));
    r=mid-1;
  }
  else l=mid+1;
}


d1(ans);


//end_routine();

return 0;
 
 }


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

public class Main {
	public static void main(String[] args) {
			Scanner scanner = new Scanner(System.in);

            // 空白で分割してaとb,cを定義

            int a = scanner.nextInt();

            int b = scanner.nextInt();

            int c = scanner.nextInt();

            if (a < b && b < c) {
            	System.out.println("Yes");
            } else {
            	System.out.println("No");
            }
	}
}


Measured memory_bytes: 26080
let rec solve = function
  | 0 -> [[0]]
  | s ->
      List.concat
        (List.map
          (fun (h :: t) ->
            [ s mod 10 :: h :: t; 10 * h + s mod 10 :: t ])
          (solve (s / 10)))

let () = Scanf.scanf "%d\n" (fun s ->
  solve s
  |> List.map (List.fold_left ( + ) 0)
  |> List.fold_left ( + ) 0
  |> (fun s -> s / 2)
  |> Printf.printf "%d\n")


Measured memory_bytes: 640
import java.util.*;

public class Main {

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String[] tmp = in.nextLine().trim().split("\\s");
        int n = Integer.parseInt(tmp[0]);
        int m = Integer.parseInt(tmp[1]);
        Map<Integer ,List<Integer>> map = new HashMap<>();
        int count = 0;
        while(count++ < m){
            tmp = in.nextLine().trim().split("\\s");
            int from = Integer.parseInt(tmp[0]);
            int to = Integer.parseInt(tmp[1]);
            map.putIfAbsent(to, new ArrayList<Integer>());
            map.get(to).add(from);
        }
        in.close();
        int[] mem = new int[n+1];
        Arrays.fill(mem, -1);
        int maxL = -1;
        
        for(int i = 1; i <= n; i++){
            maxL = Math.max(maxL, findPath(i, mem, map));
            // System.out.println(maxL);
        }
        System.out.println(maxL);
    }

    static int findPath(Integer i, int[] mem, Map<Integer,List<Integer>> map){
        if(mem[i] == -1){
            if(map.get(i) == null){
                mem[i] = 0;
            }
            else{
                int maxv = -1;
                for(int from : map.getOrDefault(i, new ArrayList<Integer>())){
                    maxv = Math.max(findPath(from, mem, map),maxv);
                }
                mem[i] = maxv + 1;
            }

        }
        return mem[i];
    }
}

Measured memory_bytes: 186520
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int inf=0x3f3f3f3f;
const int MOD=1e9+7;
const int maxn=5e4+10;
ll gcd(ll a, ll b){return (b==0)?a:gcd(b, a%b);}
bool isPrime(int n) {
    if(n<=3){
        return n>1;
    }
    if(n%6!=1&&n%6!=5){
        return false;
    }
    int sqr=sqrt(n);
    for(int i=5;i<=sqr;i+=6){
        if(n%i==0||n%(i+2)==0){
            return false;
        }
    }
    return true;
}
int dis[4][2]={0,1,0,-1,1,0,-1,0};
int a[35]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51} ;
int main()
{
	int k;cin>>k;
	cout<<a[k-1]<<endl;
} 

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	double t1, t2;
	
	while (scanf("%lf %lf", &t1, &t2) != EOF){
		
		
		if (t1 < 35.50 && t2 < 71.00){
			printf("AAA\n");
		}
		else if (t1 < 37.50 && t2 < 77.00){
			printf("AA\n");
		}
		else if (t1 < 40.00 && t2 < 83.00){
			printf("A\n");
		}
		else if (t1 < 43.00 && t2 < 89.00){
			printf("B\n");
		}
		else if (t1 < 50.00 && t2 < 105.00){
			printf("C\n");
		}
		else if (t1 < 55.00 && t2 < 116.00){
			printf("D\n");
		}
		else if (t1 < 70.00 && t2 < 148.00){
			printf("E\n");
		}
		else{
			printf("NA\n");
		}
	}
	return (0);
}

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

int main(){
  int N,l,j=0,s[200000],k=0;
  cin >> N;
  while(j<N){
    s[j]=0;
    j++;
  }
  while(cin>>l){
    s[l-1]=s[l-1]+1;
  }
  while(k<N){
    cout << s[k] <<endl;
    k++;
  }
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

int A[1000];

bool can(int n){
    int pr = n % 10;
    n /= 10;

    while(n > 0){
        int nx = n % 10;
        if(nx + 1 != pr){
            return false;
        }
        pr = nx;
        n /= 10;
    }

    return true;
}

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

    int N;
    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> A[i];
    }

    int res = -1;
    for(int i=0;i<N;++i){
        for(int j=i+1;j<N;++j){
            if(can(A[i] * A[j])){
                res = max(res, A[i] * A[j]);
            }
        }
    }

    std::cout << res << std::endl;
}



Measured memory_bytes: 3196
#include<stdio.h>
long long num;
int main()
{
    scanf("%lld",&num);
    long long sum=0;
    for(long long time=1;time<=num;time++)
    {
        sum+=time;
        if(sum>=num)
        {
            printf("%lld\n",time);
            break;
        }
    }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

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

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  vector<string> youbi;
  youbi.pb("SUN");
  youbi.pb("MON");
  youbi.pb("TUE");
  youbi.pb("WED");
  youbi.pb("THU");
  youbi.pb("FRI");
  youbi.pb("SAT");

  string s;cin>>s;

  REP(i,youbi.size()){
    if(youbi[i]==s){
      cout<<7-i<<endl;
    }
  }
 

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int len;
    len=s.length();
    string x,y;
    for (size_t i = 0; i < len; i++) {
        if (i%2==0) {
            x+="0";
            y+="1";
        }
        else{
            x+="1";
            y+="0";
        }
    }
    int a,b;
    a=0,b=0;
    for (size_t i = 0; i < len; i++) {
        if (s[i]==x[i]) {
            a++;
        }
        else{b++;}
    }
    cout<<min(len-a,len-b);
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll N, K;
    cin >> N >> K;
    ll ans = 0;
    for (ll i = K; i < N + 2; i++)
    {
        ll sum1 = i * (i - 1) / 2;
        ll sum2 = i * ((N - i + 1) + N) / 2;
        ll sum = (sum2 % MOD - sum1 % MOD) % MOD;
        if (sum < 0)
        {
            sum += MOD;
        }
        ans += (sum + 1) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
program main
    implicit none
    integer k,now,i,ch
    read(*,*)k
    now=7
    ch=1
    do i=1,k
        if(mod(now,k)==0) then
            write(*,*)i
            ch=0
            exit
        else
            now=mod(10*now+7,k)
        endif
    enddo
    if(ch==1)then
        write(*,*) -1
    endif

end program main

Measured memory_bytes: 2836
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
using ll = long long;
int main()
{
    string s;
    int k;
    cin >> s >> k;
    for(int i = 0;i < s.size();i++)
    {
        if(s[i] != 'a' && k >= (26 - (s[i] - 'a')))
        {
            k -= 26 - (s[i] - 'a');
            s[i] = 'a';
        }
    }
    k %= 26;
    s[s.size() - 1] = (s[s.size() - 1] - 'a' + k) % 26 + 'a';
    cout << s << "\n";

    return 0;
}

Measured memory_bytes: 512