akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

using ll = long long int;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

#define pi 3.14159265358979323846

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }




ll cnt_rep = 0;
ll powmod(ll N, ll P, ll M){
  cnt_rep++;
  if(P == 0) return 1;
  if(P%2 == 0){
    ll t = powmod(N, P/2, M);
    return t*t % M;
  }
  return (N * powmod(N, P-1, M)) % M;
}


ll gcd(ll a, ll b){
  ll resi, g, l;
  if(a > b){
    g = a; l = b;
  }else if(b > a){
    g = b; l = a;
  }else{
    return a;
  }
  resi = g % l;
  if(resi != 0){
    return gcd(l, resi);
  }else{
    return l;
  } 
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

int ans = 0;
int N, M, Q;

template<typename T>
void showall(vector<T> v){
  rep(i, 0, v.size()){
    cout << v[i] << " ";
  }
  cout << endl;
}

template<typename T>
ll com(T n, T m, T mod){
  ll a = 1, b = 1, ans;
  if(n == m || m == 0){
    ans = 1;
  }else{
    for(ll i = 0;i < m; i++){
      a *= n-i;
      a %= mod;
      b *= i+1;
      b %= mod;
    }
    ans = (a * powmod(b, mod-2, mod)) % mod;
  }
  
  return ans;
}


 
int main() {
  ll N;
  cin >> N;
  vector<ll> x(N), y(N);

  rep(i, 0, N){
    ll xi, yi;

    cin >> xi >> yi;

    x[i] = xi;
    y[i] = yi;
    
  }
  

  map<pair<ll, ll>, ll> cnt;

  rep(i, 0, N){
    rep(j, 0, N){
      if(i == j) continue;

      ll x_diff = (x[i] - x[j]);
      ll y_diff = (y[i] - y[j]);

      cnt[make_pair(x_diff, y_diff)]++;
    }
  }

  ll max = 0;

  for(auto i = cnt.begin(); i != cnt.end(); i++){
    if(max < (i->second)) max = (i->second);
  }

  cout <<  N - max << endl;
  
  



}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>

using namespace std;

int main()
{
    int n, k; scanf("%d%d", &n, &k);
    vector<int> a(n+1, 0);
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        int tmp;
        scanf("%d", &tmp);
        ++a[tmp];
    }

    sort(a.begin(), a.end(), greater<int>());

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

    printf("%d\n", n - ans);

    return 0;
}

Measured memory_bytes: 1024
from collections import deque

if __name__ == "__main__":

    n = int(input())
    queue = deque()

    for _ in range(n):
        param = input().split(" ")

        if param[0] == "0":
            queue.append(param[1])
        elif param[0] == "1":
            print(queue[int(param[1])])
        elif param[0] == "2":
            queue.pop()



Measured memory_bytes: 20168
#include<iostream>
#include<algorithm>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define MAX 50000
#define INFTY 50000

int Coin[20];
int dp[MAX + 1];
int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++)cin >> Coin[i];
	REP(i, n + 1)
	{
		if (i == 0)dp[i] = 0;
		else dp[i] = INFTY;
	}
	for (int i = 0; i < m; i++)
	{
		for (int j = Coin[i]; j <= n; j++)
		{
			dp[j] = min(dp[j], dp[j - Coin[i]] + 1);
		}
	}
	cout << dp[n] << endl; 
	return 0;
}

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

        int flag = 0;
        int placeA = 0;
        for(int i = 0;i<a.length();i++){
            if(a.charAt(i) == 'A'){
                placeA = i;
                break;
            }
        }
        int[] placeB = new int[a.length()];
        for(int i =0;i<a.length();i++){
            if(a.charAt(i) == 'Z'){
                placeB[flag] = i;
                flag++;
            }
        }
        int answer = 0;
        for(int i = 0;i<a.length();i++){
                    answer = Math.max(answer,placeB[i]-placeA+1);
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 28432
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include<cmath>
#include<map>

using namespace std;

long long N,i,j,k,p[1000000],X,jmax,ans,M,n;

int main()
{
  cin>>N;
  
  
  ans=0;
  M=N;
  ans=0;
  for(i=2;i*i<N;i++)
  {
    k=i;
    
    while(N%k==0)
    {
      ans++;
      N/=k;
      k*=i;      
    }
    
    while(N%i==0)
    {
      
      N/=i;      
    }
    
  }
  
  if(N>1) ans++;
  
  cout<<ans;
  
  
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i, N) {
    cin >> a.at(i);
  }
  vector<bool> touched(N, false);
  bool bFound = false;
  int count = 0;

  int btn = 1;
  while ( !touched.at(btn-1) ) {
    if ( btn == 2 ) {
      bFound = true;
      break;
    }
    count++;
    touched.at(btn-1) = true;
    btn = a.at(btn-1);
  }
  if ( bFound == false ) {
    count = -1;
  }
  cout << count << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  long long N, A, B;
  cin >> N >> A >> B;
  vector<int> town(N);
  for(int i = 0; i < N; i++){
    cin >> town.at(i);
  }
  
  long long answer = 0;
  
  for(int i = 0; i < N - 1; i++){
    if((town.at(i + 1) - town.at(i)) * A >= B){
      answer += B;
    }
    else{
      answer += (town.at(i + 1) - town.at(i)) * A;
    }
  }
    
    cout << answer << endl;
}

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


int main (){
    int a,b;
    cin>>a>>b;
    if(a>b){
        cout<<2*a-1<<endl;
    }
    else if(a<b){
        cout<<2*b-1<<endl;
    }
    else{
        cout<<2*a<<endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define MOD 1000000007
typedef long long ll;
#include <string.h>
int main(){
	char str[11];
	char str1[] = "hi", str2[] = "hihi", str3[] = "hihihi", str4[] = "hihihihi", str5[] = "hihihihihi";
	scanf("%s", str);
	if(strcmp(str, str1) == 0){
		printf("Yes");
		return 0;
	}
	if(strcmp(str, str1) == 0){
		printf("Yes");
		return 0;
	}
	if(strcmp(str, str2) == 0){
		printf("Yes");
		return 0;
	}
	if(strcmp(str, str3) == 0){
		printf("Yes");
		return 0;
	}
	if(strcmp(str, str4) == 0){
		printf("Yes");
		return 0;
	}
	if(strcmp(str, str5) == 0){
		printf("Yes");
		return 0;
	}
	printf("No");
	return 0;
}



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

const string YES = "Yes";
const string NO = "No";

void solve(long long H, long long N, std::vector<long long> A){
  long long acc = 0;
  for(long long i = 0; i < N; i++){
    acc += A[i];
    if(H <= acc) {
      cout << YES << endl;
      return;
    }
  }

  cout << NO << endl;

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long H;
  scanf("%lld",&H);
  long long N;
  scanf("%lld",&N);
  std::vector<long long> A(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&A[i]);
  }
    solve(H, N, std::move(A));
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <cmath>

typedef long long ll;

using namespace std;

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

    int flag = 1;
    int cnt = 0;
    while(flag){
        flag = 0;
        for(int i = n - 1; i >= 1; i--){
            if(a[i] < a[i - 1]){
                int b = a[i];
                a[i] = a[i - 1];
                a[i - 1] = b;
                flag = 1;
                cnt++;
            }
        }
    }
    for(int i = 0; i < n; i++){
        cout << a[i];
        if(i == n - 1){
            cout << endl;
        } else {
            cout << " ";
        }
    }
    cout << cnt << endl;
}


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

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    lh = rli()
    lh = lh + lh
    best = 0
    count = 0
    mh = {}
    for i in range(n-1):
        if lh[i] >= lh[i+1]:
            count += 1
        else:
            best = max(best, count)
            count = 0
    best = max(best, count)
    print(best)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14484
#include <bits/stdc++.h>
using namespace std;
// #include <bits/stdtr1c++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;


/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")*/

/// Typedef
typedef long long           ll;
typedef unsigned long       ul;
typedef unsigned long long  ull;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef vector<vi>          vvi;
typedef vector<ll>          vll;
typedef pair<int,int>       pii;
typedef pair<ll,ll>         pll;

#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define sf                  scanf
#define pf                  printf
#define loop(i, y)          for(int i=0; i<int(y); i++)
#define FOR(i, x, y)        for(int i=int(x); i<int(y); i++)
#define ROF(i, x, y)        for(int i=int(x); i>=int(y); i--)
#define all(c)              c.begin(), c.end()
#define sz(c)               int(c.size())
#define clr(x, y)           memset(x, y, sizeof(x))
#define si(x)               scanf("%d", &x)
#define sii(x, y)           scanf("%d %d", &x, &y)
#define siii(x, y, z)       scanf("%d %d %d", &x, &y, &z)
#define sl(x)               scanf("%lld", &x)
#define sll(x, y)           scanf("%lld %lld", &x, &y)
#define slll(x, y, z)       scanf("%lld %lld %lld", &x, &y, &z)
template <class T> inline T bigMod(T p,T e,T M){ ll ret = 1; for(; e > 0; e >>= 1){ if(e & 1) ret = (ret * p) % M; p = (p * p) % M; } return (T) ret;}
template <class T> inline T modInverse(T a,T M){return bigMod(a,M-2,M);}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T lcm(T a,T b) {a=abs(a);b=abs(b); return (a/gcd(a,b))*b;}
template <class T> inline string int2String(T a){ostringstream str; str<<a; return str.str();}
template <class T> inline T string2int(string a){stringstream str(a); T b; str>>b; return b;}


#define MAX                 200005
#define MOD                 1000000007
#define base                1000000007
#define eps                 1e-9
#define INF                 1llu<<61    // 2,305,843,009,213,693,952
#define inf                 1<<29       // 536,870,912
#define PI                  acos(-1.0)  // 3.1415926535897932
// #define INF              0x3f3f3f3f3f3f3f3f
// #define inf              0x3f3f3f3f

int use[MAX];
int main(){
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int a,b,c;
    siii(a,b,c);
    cout<<min({a+b,b+c,c+a})<<endl;
    #ifdef VAMP
       printf("\n>>Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;

const long long TIME_LIMIT=10000;


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

    ll d;
    cin >> d;
    vector<ll> c(26);
    rep(i, 26)
    {
        cin >> c[i];
    }
    vector<vector<ll>> s(d, vector<ll>(26));
    rep(i, d)
    {
        rep(j, 26)
            cin >> s[i][j];
    }

    rep(i, d)
    {
        cout << 1 << endl;
    }

	return 0;

}

Measured memory_bytes: 3704
N,K = map(int,input().split())
t = 1/N
a = []
X = K
i = 0
for i in range(20):
  if X%2 == 0:
    for j in range(int(X/2)):
      a.append(0.5**(i+1))
    X = X/2
    i += 1
  else:
    for j in range(int((X-1)/2)):
      a.append(0.5**(i+1))
    X = (X+1)/2
    i += 1
if K>N:
  ans = sum(a[K-N-1:])*t
elif K == N:
  ans = (sum(a)+1)*t
else:
  ans = (sum(a)+(N-K+1))*t
print(ans)

Measured memory_bytes: 6296
#include<iostream>

using namespace std;
int main()
{
  int N;
  cin>>N;
  int up[N], down[N];
  int left[N], right[N];
  int sum=0;
  for(int i=0;i<N;i++){
    cin>>up[i];
    sum+=up[i];
    left[i]=sum;
  }
  for(int i=0;i<N;i++){
    cin>>down[i];
  }
  sum=0;
  for(int i=N-1;i>=0;i--){
    sum+=down[i];
    right[i]=sum;
  }
  
  
  int cnt[N];
  for(int i=0;i<N;i++){
    cnt[i]=left[i]+right[i];
  }
  
  int max=cnt[0];
  for(int i=1;i<N;i++){
    max=(max>cnt[i])? max:cnt[i];
  }
  cout<<max;
}
    
  

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

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

int main(void){
  int second;
  int h,m,s,ans;
  while(cin>>h>>m>>s){
    if(h==-1) break;
    second = h*3600 + m*60 + s;
    ans = 120*60-second;
    h = ans/3600;
    ans %= 3600;
    m = ans/60;
    ans %= 60;
    s = ans;
    printf("%02d:%02d:%02d\n",h,m,s);
    ans = 120*60-second;
    ans*=3;
    h = ans/3600;
    ans %= 3600;
    m = ans/60;
    ans %= 60;
    s = ans;
    printf("%02d:%02d:%02d\n",h,m,s);
  }
  return 0;
}

Measured memory_bytes: 0
from collections import defaultdict, Counter

N = int(input())
A = list(map(int, input().split()))

#要素数の確認
C = Counter(A)

# 総パターンは普遍
k = 0
for i,j in C.items():
  if j == 1:
    k += 0
  else:
    k += j*(j-1)//2
# 自分の数字のパターンがへる
# delta = j(j-1)/2 - (j-1)(j-2)/2 = j - 1
d = defaultdict(int)
for i,j in C.items():
  if j == 1:
    d[i] = 0
  else:
    d[i] = j-1
    
for i in A:
  print(k-d[i])

Measured memory_bytes: 30776
#include <iostream>

using namespace std;

int main(){
    int A, B;
    cin >> A >> B;

    int coins = 0;

    for(int i=0;i<2;i++){
        if(A>=B){
            coins += A;
            A--;
        }
        else{
            coins += B;
            B--;
        }
    }

    cout << coins << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Text;

public class Hello
{
    public static void Main()
    {
        // Your code here!
        string s = Console.ReadLine();
        string ans1 = "";
        StringBuilder ans2 = new StringBuilder("");
        if(s.Length == 2)
        {
            ans1 = s;
            Console.WriteLine(ans1);
        }
        else if(s.Length == 3)
        {
            for(int i = s.Length - 1; i >= 0; i--)
            {
                ans2.Append(s[i]);
                
            }
            Console.WriteLine(ans2);
        }

        
        
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <utility>
using namespace std;

typedef long long ll;

struct UnionFind {
    vector<int> data;
    int sz;
    UnionFind(int sz) : data(sz, -1), sz(sz){ }
    bool unionSet(int x, int y) {
        if ((x = root(x)) == (y = root(y))) return false;
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y]; data[y] = x; sz--;
        return true;
    }
    bool findSet(int x, int y) { return root(x) == root(y); }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
    int size(int x) { return -data[root(x)]; }
    int size() { return sz; }
};

int main() {
  int n, m;
  cin >> n >> m;
  vector<ll> a(m), b(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  UnionFind uf(n);
  vector<ll> ans;
  ll cnt = (ll)n*(n - 1)/2;
  for (int i = m - 1; i >= 0; i--) {
    if (uf.findSet(a[i], b[i])) {
      uf.unionSet(a[i], b[i]);
      ans.push_back(cnt);
    }
    else {
      ans.push_back(cnt);
      cnt -= uf.size(a[i])*uf.size(b[i]);
      uf.unionSet(a[i], b[i]);
    }
  }
  for (int i = ans.size() - 1; i >= 0; i--) {
    cout << ans[i] << endl;
  }
  return 0;
}

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

int main() {
  int a,b; cin >> a >> b;
  if(a==b) cout << "Draw" << endl;
  else if(a!=1 && b!=1){
    if(a>b) cout << "Alice" << endl;
    else cout << "Bob" << endl;
  }
  else if(a==1) cout << "Alice" << endl;
  else if(b==1) cout << "Bob" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <bitset>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstdio>
#include <cstring>

using namespace std;

//#define FAST_ALLOCATOR_MEMORY 1e8
#undef LOCAL
//#include "optimization.h"


int main() {
	iostream::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);

#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	map<int, int> cnt;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		cnt[a]++;
	}
	int res = 0;
	for (auto j : cnt) {
		if (j.second >= j.first)
			res += j.second - j.first;
		else
			res += j.second;
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 4736
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#include <queue>
#include <map>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

std::vector<std::pair<lli,lli>> pq;
std::map<lli,lli> cost;

void push(lli v, lli cv)
{
    lli &k = cost[v];
    if(k && k <= cv) return;
    pq.push_back({cv,v});
    std::push_heap(pq.begin(),pq.end(),std::greater<std::pair<lli,lli>>());
    k = cv;
}

int main()
{
    int T;
    scanf("%d", &T);
    for(int tc=1; tc<=T; ++tc)
    {
        lli n;
        int a,b,c,d;
        scanf("%lld%d%d%d%d", &n, &a,&b,&c,&d);
        pq.clear(), cost.clear();
        push(n,0);
        lli ans;
        while(!pq.empty())
        {
            lli u=pq.front().sd, cu=pq.front().ft;
            std::pop_heap(pq.begin(),pq.end(),std::greater<std::pair<lli,lli>>()), pq.pop_back();
            dbg_pri("poi 1: %lld %lld\n",u,cu);
            if(u==0)
            {
                ans = cu;
                break;
            }
            lli v,cv;
            v = u/2    , cv = cu+a + (u-v*2)*d, push(v,cv);
            v = (u+1)/2, cv = cu+a + (v*2-u)*d, push(v,cv);
            v = u/3    , cv = cu+b + (u-v*3)*d, push(v,cv);
            v = (u+2)/3, cv = cu+b + (v*3-u)*d, push(v,cv);
            v = u/5    , cv = cu+c + (u-v*5)*d, push(v,cv);
            v = (u+4)/5, cv = cu+c + (v*5-u)*d, push(v,cv);
            if((__int128)u*d < 1e18)
                v = 0, cv = cu + u*d, push(v,cv);
        }
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 3932
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

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

    int a=0;
    while(N>0){
        a++;
        N/=K;
    }
    cout << a << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int h,w;
  cin >> h >> w;
  while(h!=0){
    int i,j;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	cout << "#";
      }
      cout << endl;
    }
    cout << endl;
    cin >> h >> w;
  }
  return 0;
}



Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <string>

using namespace std;
int check(int a, int b) {
	int kakaku8;
	int kakaku10;
	for (int i = 1; i <= 1000; i++) {
		kakaku8 = i * 0.08;
		kakaku10 = i * 0.1;

		if (a == kakaku8 && b == kakaku10) {
			return i;
		}
	}
	return -1;
}

int main() {
	int  a, b;
	cin >> a >> b;

	cout <<check(a, b);
		
	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 ;
            String op ;
            int b ;
       
            int sum=0;
       
            String tasu = "+" ;
            String hiku = "-" ;
            String kake = "*" ;
            String waru = "/" ;
            String end = "?" ;
       
       while(true){
           a = sc.nextInt();
           op = sc.next();
           b = sc.nextInt();
           if(op.equals(tasu)){
               sum=a+b;
               System.out.println(sum);
           }
           if(op.equals(hiku)){
               sum=a-b;
               System.out.println(sum);
           }
           if(op.equals(kake)){
               sum=a*b;
               System.out.println(sum);
           }
           if(op.equals(waru)){
               sum=a/b;
               System.out.println(sum);
           }
           if(op.equals(end)){
               break;
           }
       }
   }
 }


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

int N;

void BF(string A, char mx) {
  if(A.size() == N) {
    cout << A << "\n";
  }else {
    for(char i = 'a'; i < mx; i++) {
      BF(A + i, mx);
    }
    BF(A + mx, mx + 1);
  }
}

int main() {
  ios_base::sync_with_stdio(0);
  cin >> N;
  BF("", 'a');
}

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

int main(){
	int n;
	cin >> n;
	int m[n+1][n+1]={0};
	for(int i=0;i<n;i++){
		int id, k;
		cin >> id >> k;
		for(int j=0;j<k;j++){
			int d;
			cin >> d;
			m[id][d]=1;
		}
	}
	
	for(int i=1;i<=n;i++){
		for (int j=1;j<=n;j++){
			if(j!=1) cout << " ";
			cout << m[i][j];
		}
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll N, K;
vector<ll> A, B;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    vector<ll> pos, zero, neg;
    for(int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        if(a > 0) pos.push_back(a);
        if(a == 0) zero.push_back(a);
        if(a < 0) neg.push_back(-a);
    }
    sort(pos.begin(), pos.end());
    sort(neg.begin(), neg.end());
    ll ok = 1e18 + 1;
    ll ng = -1e18 - 1;
    while(abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        ll num = 0;
        for(auto val : pos) {
            if(val * val <= mid) num--;
            if(mid > 0) {
                num += neg.size();
                num += zero.size();
                auto itr = upper_bound(pos.begin(), pos.end(), mid / val);
                num += distance(pos.begin(), itr);
            }
            if(mid == 0) {
                num += neg.size();
                num += zero.size();
            }
            if(mid < 0) {
                auto itr = lower_bound(neg.begin(), neg.end(), (-mid + val - 1) / val);
                num += distance(itr, neg.end());
            }
        }
        if(mid >= 0) {
            num += (ll)zero.size() * N;
            num -= (ll)zero.size();
        }
        for(auto val : neg) {
            if(val * val <= mid) num--;
            if(mid > 0) {
                num += pos.size();
                num += zero.size();
                auto itr = upper_bound(neg.begin(), neg.end(), mid / val);
                num += distance(neg.begin(), itr);
            }
            if(mid == 0) {
                num += pos.size();
                num += zero.size();
            }
            if(mid < 0) {
                auto itr = lower_bound(pos.begin(), pos.end(), (-mid + val - 1) / val);
                num += distance(itr, pos.end());
            }
        }
        num /= 2;
        if(num >= K) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
    return 0;
}


Measured memory_bytes: 2548
#include<stdio.h>
#include<string.h>
int main(){
  char s[10];
  scanf("%s\n",s);
  if(strcmp(s,"SUN")==0){
  printf("7\n");
  }
  else if(strcmp(s,"MON")==0){
  printf("6\n");
  }
    else if(strcmp(s,"TUE")==0){
  printf("5\n");
  }
    else if(strcmp(s,"WED")==0){
  printf("4\n");
  }
    else if(strcmp(s,"THU")==0){
  printf("3\n");
  }
    else if(strcmp(s,"FRI")==0){
  printf("2\n");
  }
    else if(strcmp(s,"SAT")==0){
  printf("1\n");
  }
  return 0;
  }

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

int main() {
  int N;
  cin >> N;
  int people = 0;
  int r,l;
  for(int i=0; i<N; i++){
    cin >> l >> r;
    people += r-l+1;
  }
  cout << people << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

ll a, b;

int main()
{
    cin>>a>>b;
    for(ll i = 0; i <= 20000; i++)
    {
        if(i * 8 / 100 == a && i * 10 / 100 == b)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define INF 100000000
#define rep(i,a,b) for(int (i)=a;(i)<(int)(b);(i)++)
using ipair = pair<int,int>;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N,0);
    rep(i,0,N) cin >> A[i];
    sort(A.begin(),A.end(),greater<int>());

    if(find(A.begin(),A.end(),0)!=A.end()){
        cout << "0" << endl;
    }

    else{
        bool flag=true;
        ll cnt=0,ans=1;
        for(ll i=0;i<N;i++){
            ll cnt = 0;
            ll tmp = A[i];
            while(tmp/10>0){
                tmp = tmp/10;
                cnt ++;
            }
            if(cnt>18){
                flag = false;
                break;
            }
        }        

        if(flag){
            for(ll i=0;i<N;i++){
                ans *= A[i];
                if(ans>1000000000000000000 || ans<A[0]){
                    flag = false;
                    break;
                }
            }
        }
        if(flag)cout << ans << endl;
        else cout << "-1" << endl;
    }
}

Measured memory_bytes: 4048
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <chrono>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <cctype>
# include <unordered_map>
# include <unordered_set>
//#include <bits/stdc++.h>
 
#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")
 
#define forn(i, n) for (int i = 0; i < (n); i++)
#define forx(i,x,n) for (int i = x; i < (n); i++)
#define form(i, n) for (int i = n-1; i>=0; i--)
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define pf push_front
#define mp make_pair
#define ll long long
#define ld long double
#define ull unsigned ll
#define srt(a) sort(a.begin(), a.end());
#define pll pair<ll, ll>
#define pii pair<int,int>
#define pld pair<ld,ld>
#define ar array
#define endl '\n';

using namespace std;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <class T> inline T gcd(T a, T b) { while (b) { a %= b; swap(a, b); } return a; }
template <class T> inline T lcm(T a, T b) { return a * b / gcd(a, b); }
 
const ll MAXN = 2e6 + 7, K = 200043, M = 2500, INF = 1e18 + 7, LOG = 20;
// the good way to get PI number
const ld PI = acos(-1.0);
ll MOD = 1e9 + 7;

template <class T> T sqr(T a) {
    return a * a;
}

ll mul(ll a, ll b) {
    return ((a % MOD) * (b % MOD)) % MOD;
}

ll sum(ll a, ll b) {
    return ((a % MOD) + (b % MOD)) % MOD;
}

ll sub(ll a, ll b) {
    return sum(a, MOD - b);
}

ll bin_pow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = mul(res, a);
        a = mul(a, a);
        n >>= 1;
    }
    return res;
}

ll inv(ll x) {
    return bin_pow(x, MOD - 2) % MOD;
}

//ll fact[MAXN];
//
//ll C(ll n, ll k) {
//    return mul(mul(fact[n], inv(fact[k])), inv(fact[n - k]));
//}

ll sum_digit(ll n, ll b) {
    ll sum = 0;
    while (n > 0) {
        sum += n % b;
        n /= b;
    }
    return sum;
}

void solve() {
    ll n, s;
    cin >> n >> s;
    
    for (ll b = 2; b*b <= n; ++b) {
        ll sum = sum_digit(n, b);
        if (sum == s) {
            cout << b << endl;
            return;
        }
    }
    
    ll ans = ((n == s) ? (n + 1) : 1e18);
    for (ll c1 = 1; c1*c1 <= n; ++c1) {
        ll c0 = s - c1;
        ld b = 1.0 * (n - c0) / c1;
        if (b < 2) continue;
        if (abs(b - (ll)b) < 1e-9 && sum_digit(n, (ll)b) == s)  {
            ans = min(ans, (ll)b);
        }
    }
    
    cout << (ans == 1e18 ? -1 : ans) << endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int t = 1;
//    cin >> t;
    
    while (t --> 0)
        solve();
    return 0;
}



Measured memory_bytes: 3648
#include <stdio.h>
 
int main(void) {
    int a,b,c;
 
    int i,num= 0;
    scanf("%d",&a);
    scanf(" %d",&b);
    scanf(" %d",&c);
     
    for(i=a;i <= b;i++){
         
     
        if(c % i == 0){
            num++;
        }
     
    }
     
    printf("%d\n",num);
    return 0;
}

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

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

const int Maxn = 100005;
const int Maxm = 524288;

int n, x;
int b[Maxn], l[Maxn], u[Maxn];
lli seq[Maxn];
ll cur;
ll st[Maxm], cnt[Maxm];
ll res;

ll Get(int ind, int y)
{
    if (y <= b[ind]) return ll(l[ind]) * y;
    return ll(y - b[ind]) * u[ind] + ll(l[ind]) * b[ind];
}

void Union(int v)
{
    st[v] = st[2 * v] + st[2 * v + 1];
    cnt[v] = cnt[2 * v] + cnt[2 * v + 1];
}

void Create(int v, int l, int r)
{
    if (l == r) { st[v] = seq[l].first; cnt[v] = 1; }
    else {
        int m = l + r >> 1;
        Create(2 * v, l, m);
        Create(2 * v + 1, m + 1, r);
        Union(v);
    }
}

void Update(int v, int l, int r, int x, bool add)
{
    if (l == r)
        if (add) { st[v] = seq[l].first; cnt[v] = 1; }
        else st[v] = cnt[v] = 0;
    else {
        int m = l + r >> 1;
        if (x <= m) Update(2 * v, l, m, x, add);
        else Update(2 * v + 1, m + 1, r, x, add);
        Union(v);
    }
}

lli Get(int v, int l, int r, ll val)
{
    if (val >= 0) return lli(0, 0);
    else if (l == r) return lli(st[v], cnt[v]);
    else {
        lli res = lli(0, 0);
        int m = l + r >> 1;
        if (val + st[2 * v + 1] >= 0)
            return Get(2 * v + 1, m + 1, r, val);
        else {
            res = lli(st[2 * v + 1], cnt[2 * v + 1]);
            lli got = Get(2 * v, l, m, val + st[2 * v + 1]);
            res.first += got.first; res.second += got.second;
            return res;
        }
    }
}

int main()
{
    scanf("%d %d", &n, &x);
    for (int i = 0; i < n; i++) {
        scanf("%d %d %d", &b[i], &l[i], &u[i]);
        cur -= ll(b[i]) * l[i];
        seq[i] = lli(ll(b[i]) * l[i] + ll(x - b[i]) * u[i], i);
    }
    res = ll(n) * x;
    sort(seq, seq + n);
    Create(1, 0, n - 1);
    for (int i = 0; i < n; i++) {
        Update(1, 0, n - 1, i, false);
        lli got = Get(1, 0, n - 1, cur + seq[i].first);
        int lef = 0, rig = x;
        while (lef <= rig) {
            int mid = lef + rig >> 1;
            if (cur + got.first + Get(seq[i].second, mid) >= 0)
                rig = mid - 1;
            else lef = mid + 1;
        }
        res = min(res, ll(x) * got.second + ll(rig + 1));
        Update(1, 0, n - 1, i, true);
    }
    cout << res << endl;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;
using str = string;

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

long int M = 1e+9+7;
int inf = 1e+9;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    int a,b;
    cin >> a >> b;
    b--;
    a--;
    int ans=0;
    ans = b/a;
    if(b%a) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    string s;
    cin>>s;
    int n=s.size(),mini=10000;
    for(auto c='a';c<='z';c++){
        int cnt=0,maxi=0;
        rep(i,n){
            if(s[i]==c){
                maxi=max(maxi,cnt);
                cnt=0;
            }
            else cnt++;
        }
        maxi=max(maxi,cnt);
        mini=min(mini,maxi);
    }
    cout<<mini;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl 	"\n"

typedef vector< ll > 	vi;
typedef vector< vi > 	vvi;
typedef pair< ll,ll > 	ii;
#define pb 		push_back
#define all(c) 		(c).begin(),(c).end()
#define tr(c,i) 	for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) 	((c).find(x) != (c).end())

#define MOD 	1000000007
#define INF 	(int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))

int main()
{	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	
	ll n;
	cin>>n;
	cout<<(n*n*n);
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string a,b;
  int minimum=1005;
  cin>>a>>b;
  for(int i=0;i<a.size()-b.size()+1;i++){
    int cnt=0;
    for(int j=0;j<b.size();j++){
      if(a[i+j]!=b[j]){
	cnt++;
      }
    }
    minimum=min(minimum,cnt);
  }
  cout<<minimum<<endl;
  return(0);
}

Measured memory_bytes: 3600
k, n = map(int, input().split())
list = list(map(int, input().split()))
ans = 100000000
for i in range(n):
    list.append(list[i] + k)
for i in range(n):
    m = list[i + n - 1] - list[i]
    ans = min(ans, m)
print(ans)

Measured memory_bytes: 26444
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int n;
    cin >> n;

    vector <ll> s(n);
    for (int i = 0; i < n; i++) cin >> s[i];

    ll ans = 0;
    for (int c = 1; c < n - 1; c++) {
        ll cur = 0;
        int l = 0, r = n - 1;
        while (r > c && (r % c != 0 || l < r)) {
            cur += s[l] + s[r];
            ans = max(ans, cur);
            l += c; r -= c;
        }
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1024
n = int(input())
m = list(map(int,input().split()))
m.sort()

ans = 0
for i in range(n):
    for j in range(i+1,n):
        l = j
        r = n
        while r-l>1:
            mid = (r+l)//2
            if m[mid] < m[i]+m[j] and m[i] < m[mid]+m[j] and m[j] < m[mid]+m[i]:
                l = mid
            else:
                r = mid
        ans += l-j

print(ans)

Measured memory_bytes: 73984
#[allow(dead_code)]
pub struct Scanner<'a> {
    _buf: &'a str,
    iter: ::std::str::SplitWhitespace<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    pub fn new(buf: &'a str) -> Self {
        Scanner {
            _buf: buf,
            iter: buf.split_whitespace(),
        }
    }

    pub fn array<T>(&mut self, n: usize) -> Vec<T>
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        let mut res = Vec::with_capacity(n);
        for _ in 0..n {
            res.push(self.value());
        }
        res
    }

    pub fn value<T>(&mut self) -> T
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        self.next().parse().unwrap()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.next().chars().collect()
    }

    fn next(&mut self) -> &str {
        self.iter.next().unwrap()
    }
}

fn adj_diff(v: &[i64]) -> Vec<i64> {
    let it1 = v.iter();
    let it2 = v.iter().skip(1);
    it1.zip(it2).map(|(&cur,&nex)| nex-cur).collect()
}

fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 { return a; }
    gcd(b, a%b)
}

fn main() {
    let mut _input = String::new();
    {
        use ::std::io::Read;
        ::std::io::stdin().read_to_string(&mut _input).unwrap();
    }
    let mut sc = Scanner::new(&_input);

    let n = sc.value::<i64>();
    let x = sc.value::<i64>();
    let mut a = sc.array::<i64>(n as usize);

    a.push(x);
    a.sort();

    let diff = adj_diff(&a);
    let ans = diff.iter().fold(0, |d,&x| gcd(d,x));

    println!("{}", ans);
}


Measured memory_bytes: 8444
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

using P = pair<int, int>;

int main() {
  size_t N;
  cin >> N;
  vector<int64_t> A(N, 0);
  int positive = 0;
  int negative = 0;
  int64_t sum = 0;
  int64_t minElement = 1e5;
  int64_t maxElement = -1e5;
  for (size_t i = 0; i < N; i++) {
    cin >> A[i];
    sum += abs(A[i]);
    minElement = min(minElement, A[i]);
    maxElement = max(maxElement, A[i]);
    if (A[i] >= 0) positive++;
    if (A[i] < 0) negative++;
  }
  sort(A.begin(), A.end());
  deque<int64_t> dq;
  for (const auto& e : A) {
    dq.push_front(e);  // dqには降順に数字が入っている．
  }
  if (positive > 0 && negative > 0) {
    // 全ての絶対値の和が答え
    cout << sum << endl;
    while (positive > 1) {
      auto po = dq.front();
      dq.pop_front();
      auto ne = dq.back();
      dq.pop_back();
      cout << ne << ' ' << po << endl;
      dq.push_back(ne - po);
      positive--;
    }
    while (negative > 0) {
      auto po = dq.front();
      dq.pop_front();
      auto ne = dq.back();
      dq.pop_back();
      cout << po << ' ' << ne << endl;
      dq.push_front(po - ne);
      negative--;
    }
  } else if (negative == 0) {
    // 一番小さいやつに引き算しまくって，最後に，できた負の値を引き算
    cout << sum - 2 * minElement << endl;
    while (positive > 2) {
      auto po = dq.front();
      dq.pop_front();
      auto ne = dq.back();
      dq.pop_back();
      cout << ne << ' ' << po << endl;
      dq.push_back(ne - po);
      positive--;
    }
    auto po = dq.front();
    dq.pop_front();
    auto ne = dq.back();
    dq.pop_back();
    cout << po << ' ' << ne << endl;
  } else if (positive == 0) {
    // 一番大きいやつに負の値を引き算しまくる
    cout << sum + 2 * maxElement << endl;
    while (dq.size() >= 2) {
      auto po = dq.front();
      dq.pop_front();
      auto ne = dq.back();
      dq.pop_back();
      cout << po << ' ' << ne << endl;
      dq.push_front(po - ne);
    }
  } else {
    // 全部0なのでなにも頭を使わない
  }
  return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
#define MOD (ll)(1e9+7)
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;


signed main(){
    
    ll a,b;
    cin >> a >> b;
    cout << a*b << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	int num,sum;
	scanf("%d",&n);
	sum=n/500;
	num=n-sum*500;
	num=num/5;
	num=num*5;
	sum=sum*1000;
	printf("%d",num+sum);
 } 

Measured memory_bytes: 256
# coding: utf-8
import sys
import itertools

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))


def getScore(ai, abcds):
    ret = 0
    for abcd in abcds:
        a,b,c,d = abcd
        if ai[b-1]-ai[a-1] == c:
            ret += d
    return ret


def main():
    n,m,q = na()
    abcds = [na() for _ in range(q)]
    nums = [i for i in range(1,m+1)]
    ans = 0
    for ai in itertools.combinations_with_replacement(nums, n):
        ans = max(ans, getScore(ai, abcds))
    print(ans)
    return


if __name__ == '__main__':
    main()

Measured memory_bytes: 68092
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n, m, x;
int c[15];
int a[15][15];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> m >> x;
  REP(i, n) {
    cin >> c[i];
    REP(j, m) cin >> a[i][j];
  }

  int ans = INF;
  REP(i, (1 << n)) {
    int sum[15] = {0};
    int t = 0;
    REP(j, n) {
      if((i >> j) & 1) {
        REP(k, m) sum[k] += a[j][k];
        t += c[j];
      }
    }
    bool f = true;
    REP(j, m) if(sum[j] < x) f = false;
    if(f) ans = min(ans, t);
  }

  cout << (ans == INF ? -1 : ans) << endl;
}


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

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define llrep(i,a,b) for(ll i=a;i<b;i++)
#define llrepd(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; const ll MOD = 1000000007;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

//---------------------------------------------------------------------------------------------------
void _main(){
    ll N; cin >> N;
    ll check = N % 10;
    if (check == 3) cout << "bon" <<endl;
    else if (check == 0 || check == 1 || check == 6 || check ==8) cout << "pon" <<endl;
    else cout << "hon" << endl;
}


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

int main(){
  int N;
  int d[101];
  bool S = true;
  int count = 0;
  
  cin >> N;
  for(int i = 0; i < N; i++) cin >> d[i];
  for(int j = 0; j < N; j++){
    for(int k = j+1; k < N; k++){
      if(d[j] == d[k]) S = false;
    }
    if(S == true) ++count;
    S = true;
  }
  cout << count << endl;
}


Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)998244353;

int n, s, a[3009];
long long dp[3009][3009];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> s;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	dp[0][0] = 2;
	dp[0][a[0]] = 1;
	for (int i = 1; i < n; i++) {
		for (int j = 0; j <= 3000; j++) {
			dp[i][j] += dp[i - 1][j] + dp[i - 1][j];
			dp[i][j] %= MOD;

			if (j + a[i] <= 3000) {
				dp[i][j + a[i]] += dp[i - 1][j];
				dp[i][j + a[i]] %= MOD;
			}
		}
	}
	cout << dp[n - 1][s] << "\n";
	//system("pause");
	return 0;
}

Measured memory_bytes: 74072
n, x = gets.split(" ").map{|v|
	v.to_i
}

a = gets.split(" ").map{|v|
	v.to_i
}

init_sum = a.inject(0){ |sum, i|
	sum + i
}

if x < a[0] + a[1]
	a[1] -= (a[0] + a[1] - x)
	if a[1] < 0
		a[0] = x
		a[1] = 0
	end
end

1.upto(n-2) do  |i| 
	if a[i] + a[i+1] > x
		a[i+1] -= (a[i] + a[i+1] - x)
	end
end

after_sum = a.inject(0){ |sum, i|
	sum + i
}

puts init_sum - after_sum


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

int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,m;
	cin>>n>>m;
	cout<<(n*(n-1) + m*(m-1))/2;
	return 0;
}


Measured memory_bytes: 256