akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <numeric>
using namespace std;

int main() {
    long long n, a[10000];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    long long max = *max_element(a, a + n);
    long long min = *min_element(a, a + n);
    long long sum = accumulate(a, a + n, 0LL);

    cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3160
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()

    if n >= 1000:
        print('ABD')
    else:
        print('ABC')

if __name__ == '__main__':
    main()


Measured memory_bytes: 10444
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};


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 n;
vector<pair<int,int>> tasks;

int main(){
  cin>>n;
  REP(i,n){
    int a,b;
    cin>>a>>b;
    tasks.emplace_back(b,a);}


  sort(tasks.begin(),tasks.end());
  int sum=0;
  bool isyes =true;
  for(auto v:tasks){
    sum+=v.second;
    if(sum>v.first){
      isyes=false;
      break;
    }
  }
  cout<<(isyes?"Yes":"No")<<endl;
  return 0;

}


Measured memory_bytes: 2420
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] f = new int[n][10];
		int[][] p = new int[n][11];
		for(int i  = 0 ; i < n ; i++) {
			for(int j = 0 ; j < 10 ; j++) {
				f[i][j] = sc.nextInt();
			}
		}
		for(int i  = 0 ; i < n ; i++) {
			for(int j = 0 ; j < 11 ; j++) {
				p[i][j] = sc.nextInt();
			}
		}
		int ans = -1001001001;
		for(int i = 1 ; i < (1<<10) ; i++) {
			int money = 0;
			for(int j = 0 ; j < n ; j++) {
				int cnt = 0;
				for(int k = 0 ; k < 10 ; k++) {
					if(((i>>k)&1) == 1 && f[j][k] == 1) {
						cnt++;
					}
				}
				money += p[j][cnt];
			}
			ans = Math.max(ans, money);
		}
		System.out.println(ans);
	}
}


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

const int OFFSET = 101;
int X, N;
vector<int> P;
vector<bool> A;

void input_init(void) {
	cin >> X >> N;
	A.resize(2 * OFFSET + 1, true);
	for (int i = 0; i < N; ++i) {
		int p;
		cin >> p;
		A[p + OFFSET] = false;
	}
}

int solve(void) {
	if (A[X + OFFSET])
		return X;
	int id = 0;
	int d = 1;
	while (true) {
		id = X + OFFSET - d;
		if (A[id])
			return X - d;
		id = X + OFFSET + d;
		if (id <= 2 * OFFSET) {
			if (A[id])
				return X + d;
		}
		++d;
	}
	return -102;
}

int main(void) {
	input_init();
	int ans = solve();
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair

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

    ll n,w;
    cin>>n>>w;

    vector<ll>wv(n+1);
    vector<ll>vv(n+1);

    for(ll i=1;i<=n;i++)
    {
        cin>>wv[i]>>vv[i];
    }

    vector<ll>dp(100005,-1);

    dp[0]=0;

//    for(ll i=1;i<=n;i++)
//    {
//        if(dp[vv[i]]!=-1)dp[vv[i]]=min(dp[vv[i]],wv[i]);
//        else dp[vv[i]]=wv[i];
//        for(ll j=1;j+vv[i]<=100000;j++)
//        {
//            if(dp[j]!=-1)
//            {
//                if(dp[j+vv[i]]!=-1)dp[j+vv[i]]=min(dp[j+vv[i]],dp[j]+wv[i]);
//                else dp[j+vv[i]]=dp[j]+wv[i];
//            }
//        }
//    }

    for(ll i=1;i<=n;i++)
    {
        for(ll j=100000-vv[i];j>-1;j--)
        {
            if(dp[j]!=-1)
            {
                if(dp[j+vv[i]]!=-1)dp[j+vv[i]]=min(dp[j+vv[i]],dp[j]+wv[i]);
                else dp[j+vv[i]]=dp[j]+wv[i];
            }
        }
    }

    ll ans;

    for(ll i=0;i<=100000;i++)
    {
        if(dp[i]<=w&&dp[i]!=-1)ans=i;
    }

    cout<<ans;

    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <math.h>

using namespace std;

int main(){
  int a, b;
  while(true) {
    scanf("%d %d", &a, &b);
    if(a==0 && b==0) {
      return 0;
    }
    for(int i=0; i<a; i++) {
      for(int j=0; j<b; j++) {
        if((i == 0 || i == a-1) || (j == 0 || j == b-1)) {
          printf("#");
        } else {
          printf(".");
        }
      }
      printf("\n");
    }
    printf("\n");
  }
}



Measured memory_bytes: 2556
N, Y=map(int, input().split())
for x in range(N+1):
  for y in range(N-x+1):
    z=N-x-y
    if 0<=z<=2000 and 10000*x+5000*y+1000*z==Y:
      print(x,y,z)
      exit()
print(-1,-1,-1)

Measured memory_bytes: 3316
#include<stdio.h>

int main( void ){
    
    int ss;
    int h , m , s; 
    
    scanf( "%d" , &ss );
    
    h = ss / 3600;
    m = ( ss % 3600 ) / 60;
    s = ( ss % 3600 ) % 60;
    
    printf( "%d:%d:%d\n" , h , m , s );
    
    
    
}


Measured memory_bytes: 2144
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
using namespace std;
#define N (1000000000+7)
typedef pair<int,int> P;
typedef long long ll;
int d[1010][1010];
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
int h,w;
char board[1010][1010];
bool check(int i, int j) {
	return (i >= 0) && (i <= h) && (j >= 0) && (j <= w) && (board[i][j] == '.');
}

int main(void){
    ll a,b,c;
    cin>>a>>b>>c;
    if(a>c){
        cout<<b+c<<endl;
    }
    else{
        if(b>=c-a)cout<<b+c<<endl;
        else cout<<a+2*b+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int n, x; cin >> n >> x;
	vector<int> l(n, 0); for (int i = 0; i <= n - 1; i++) cin >> l[i];
	for (int i = 1; i <= n - 1; i++) l[i] += l[i - 1];
	debug(l);
	int j = prev(upper_bound(l.begin(), l.end(), x)) - l.begin();
	cout << j + 2;

	return 0;
}

Measured memory_bytes: 3124
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
struct vec {
  long num;
  long p;
  long y;
  int id;
  bool operator<(const vec &ano) const{
    return num < ano.num;
  }
};
struct pec {
  string str;
  int id;
  bool operator<(const pec &ano) const{
    return id < ano.id;
  }
};
int main() {
  int n,m;
  cin >> n >> m;
  int N = 1000000001;
  vec* data = new vec[100000];
  for(int i=0;i<m;i++){
    long pi,yi;
    cin >> pi >> yi;
    data[i] = {
      pi * N + yi,
      pi,
      yi,
      i
    };
  }
  sort(data,data+m);
  pec* ans = new pec[100000];
  int counter = 1;
  string preStr = "";
  for(int i=0;i<m;i++){
    string a,b;
    a = "000000" + std::to_string(data[i].p);
    if(preStr=="" || a!=preStr){
      preStr = a;
      counter = 1;
    }
    b = "000000" + std::to_string(counter++);
    ans[i] = {
      a.substr(a.length()-6) + b.substr(b.length()-6),
      data[i].id
    };
  }
  sort(ans,ans+m);
  for(int i=0;i<m;i++){
    cout << ans[i].str << endl;
  }
  return 0;
}


Measured memory_bytes: 10880
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    int n,k; cin >> n >> k;
    vector<int> a(n);
    rep(i,n) {
        cin >> a[i];
    }
    for (int i = 0; i < k ; i++) {

    vector<int> b(n,0);
    rep(j,n) {
        int l = max(0,j-a[j]);
        int r = min(j+a[j],n-1);
        b[l]++; 
        if (r+1 < n) b[r+1]--;
    }
    rep(j,n-1) b[j+1] += b[j];
    if (a == b) break;
    a = b;
    }
    rep(i,n) cout << a[i] << " ";
}


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

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

  if (n % 2 == 0){
    cout << 1.0/2.0 << endl;
  }
  else {
    cout << double(n+1)/2.0/double(n) << endl;
  }

  return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
# pragma GCC optimize "-O3"
# define int long long
  
using namespace std;
  
const int N = 1e4 + 7;
const int mod = 1e9 + 7;

void solve() {
	int a, b, n, ans = 0;
	cin >> a >> b >> n;
	for ( int x = 0; x < min( 10000000ll, n); x++ ) {
		ans = max( ans, (a*x) / b - a * (x / b) );
	}
	for ( int x = 0; x <= n; x += 10000 ) {
		ans = max( ans, (a*x) / b - a * (x / b) );
	}

	for ( int x = n; x > max( n - 10000000ll, 0ll ); x-- ) {
		ans = max( ans, (a*x) / b - a * (x / b) );
	}
	cout << ans;
}

int32_t main() {
	speed;
	int T = 1;
	// cin >> T;
	while ( T-- ) {
		solve();
	}
}

Measured memory_bytes: 3640
#include <stdio.h>
int main(void){
    // Here your code !
    int W,H,x,y,r;
    scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);
    if( x-r >= 0 && y-r >= 0 && x+r <= W && y+r <= H ){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

bool is_kaibun(string s){
    bool res = true;
    for(int i=0; i < s.size() / 2; i++){
        if(s[i] != s[s.size() - 1 - i]) res = false;
    }
    return res;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    string t = "";
    rep(i, 0, s.size()) if(s[i] != 'x') t += s[i];
    if(!is_kaibun(t)){
        cout << -1 << endl;
        return 0;
    }
    int l = 0, r = s.size() - 1;
    int ans = 0;
    while(l < r){
        if(s[l] == s[r]){
            l++; r--;
        }else if(s[l] == 'x'){
            l++; ans++;
        }else if(s[r] == 'x'){
            r--; ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define pii pair<int, int>
const int N = 2e5 + 10;

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector<int> mod[k];
    for(int i = 1; i <= n ; i++) {
        if(i % k == ((-i % k) + k) % k) {
            mod[i % k].push_back(i);
        }
    }
    int ans = 0;
    for(int i = 0; i < k ; i++) {
        ans += sz(mod[i]) * sz(mod[i]) * sz(mod[i]);
    }
    cout << ans << "\n";
}

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

const int mod = 1e9+7;

inline int add(int a, int b) { int res = a + b; if(res >= mod) res -= mod;  return res; }
inline int sub(int a, int b) { int res = a - b; if(res < 0) res += mod; return res;}
inline int mul(int a, int b) { return (a * b)%mod; }

const int N = 1e5+5;
int fac[N], rfac[N];

int modpow(int a, int b) {
    int ans = 1;
    while(b) {
        if(b%2) ans = mul(ans, a);    
        b /= 2; a = mul(a, a);
    }   return ans;
}

void pre() {
    fac[1] = 1;
    for(int i=2; i<N; i++) fac[i] = mul(fac[i-1], i);
    for(int i=1; i<N; i++) rfac[i] = modpow(fac[i], mod-2);
}   

int C(int a, int b) {  
    if(b<0) return 0;
    if(a < b) return 0;
    if(a == b) return 1;
    int ans = fac[a];
    ans = mul(ans, rfac[b]);
    ans = mul(ans, rfac[a-b]);
    return ans;
}

void solve() {
    pre();
    int n; cin >> n;
    int a[n+1];
    for(int i=0; i<n+1; i++) cin >> a[i];
    int ans[n+1]; memset(ans, 0, sizeof ans);
    int X = n*(n+1)/2;
    int sum = 0;
    for(int i=0; i<n+1; i++) sum += a[i];
    int rep = sum-X;
    int F, S;
    for(int i=0; i<n+1; i++) if(a[i]==rep) { 
        F = i; break;
    }   
    for(int i=n; i>=0; i--) if(a[i]==rep) {
        S = i; break;
    }
    int d = S-F;
    cout << n << endl;
    for(int L=2; L<=n+1; L++) {
        int tot = C(n+1, L);
        int rep = C(n-d, L-1);
        ans[L-1] = sub(tot, rep);
        cout << ans[L-1] << endl;
    }
}

signed main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(12);

    int T = 1;
    //cin >> T;

    while(T--) {
        solve();
    }
    return 0;
}

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

int main()
{
    int N;
    long long W;
    scanf("%d", &N);
    scanf("%lld", &W);
    int values[N];
    long long weights[N];
    long long MAX = W + 1;
    int total_value = 0;
    for (int i = 0; i < N; i++){
        cin>> weights[i] >> values[i];
        total_value += values[i];
    }
    long long dp[total_value + 1];
  	fill(dp, dp + (total_value + 1), MAX);
    // dp[0] = 0;
  	for (int i=0; i<N; ++i) {
        for (int j=total_value; j>=values[i]; --j){
            if (j != values[i])
                dp[j] = min(dp[j], dp[j-values[i]] + weights[i]);
            else if (j == values[i])
                dp[j] = min(dp[j], weights[i]);
        }
    }  
  
  	for (int i = total_value; i>=0; --i) {
        if (dp[i] < MAX){
            cout << i << endl;
            break;
        }
    }
    // for (int i = 0; i<=total_value; ++i) {
    //     cout << dp[i] << " ";
    // }
    
  	
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#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 all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define fi first
#define se second
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

string s;
cin >> s;
auto res = find(s.begin(), s.end(), '7');
yn(res == s.end(), "No", "Yes");
return 0;
}

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

using namespace std;



int main(void)
{
	int N, M, X;
	long long ans, minCost = INTMAX_MAX;
	bool ansFlag = false;

	cin >> N >> M >> X;

	vector<int> C(N, 0), tmpV(M, 0), x(M, 0);
	vector<vector<int>> A(N, tmpV);

	for (int i = 0; i < N; i++) {
		cin >> C[i];
		for (int j = 0; j < M; j++) {
			cin >> A[i][j];
		}
	}

	for (int bit = 0; bit < (1 << N); bit++) {
		ans = 0;
		x = tmpV;

		for (int i = 0; i < N; i++) {
			if (bit & (1 << i)) {
				ans = ans + C[i];
				for (int j = 0; j < M; j++) {
					x[j] += A[i][j];
				}
			}
		}
		 ansFlag=true;
		for (int i = 0; i < M; i++) {
			if (x[i] < X) {
				ansFlag=false;
				break;
			}
		}

		if ( (minCost > ans)  && (ansFlag)) {
			minCost = ans;
		}
	}

	if(minCost < INTMAX_MAX){
		cout << minCost << endl;
	}else{
		cout<<-1<<endl;
	}


	


	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    vector<ll> v(n);
    for (auto &&i : v) scanf("%lld", &i);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i+1; j < n; ++j) {
            if(v[i] == v[j]) continue;
            for (int k = j+1; k < n; ++k) {
                if(v[i] == v[k] || v[j] == v[k]) continue;
                if(2*max({v[i], v[j], v[k]}) < v[i]+v[j]+v[k]) ans++;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
long long int ans;
long long int a[10],n,b[10];
int  main(){
    cin>>n;
    for(int i=0;i<5;i++){
        cin>>a[i];
        b[i]=((n+(a[i]-1))/a[i]);
    }

    for(int i=0;i<5;i++){
        if(ans<b[i])ans=b[i];
    }

    cout<<ans+4<<endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int p[3];
    REP(i,3) cin >> p[i];
    sort(p,p+3);
    cout << p[0]+p[1] << endl;


}

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

int n, k;

int main (){
	cin >> n >> k;

	string S;

	cin >> S;
	k--;
	if (S[k] == 'A') S[k] = 'a';
	else if (S[k] == 'B') S[k] = 'b';
	else S[k] = 'c';

	cout << S << endl;

	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;

int main(void){
    ll K, A, B;
    cin>>K>>A>>B;
    if((A-1)/K==B/K) cout<<"NG"<<endl;
    else cout<<"OK"<<endl;
    return 0;
}


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

using namespace std;

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

    int Vn[N];
    int Cn[N];

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

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

    vector<int> Dn;
    for (int i=0;i<N;i++) {
        Dn.push_back(Vn[i] - Cn[i]);
    }
    sort(Dn.begin(), Dn.end(), greater<int>());

    int sum=0;
    for (int i=0;i<N;i++) {
        if (sum > sum + Dn[i]) {
            break;
        } else {
            sum += Dn[i];
        }
    }

    cout << sum << endl;

    return 0;
}

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

using namespace std;

#define INF 2<<29

int main(){
  int n,h[100],temp=0,ans=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&h[i]);
  }

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

  printf("%d\n",ans);
  
  return 0;
}


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

int main() {
  int N,M;
  cin >> N >> M;
  pair<int,int> P[M];
  for(int i = 0; i < M; i++){
  cin >> P[i].first >> P[i].second;
  }
  
  for(int i = 0; i < 1000; i++){
    int keta = 1;
    int nx = i /10;
    vector<int> d(1,i%10);
    while(nx){
      keta++;
      d.push_back(nx%10);
      nx /= 10;
    }
    
    if(keta != N) continue;
    bool ok = true;
    reverse(d.begin(), d.end());
    for(int j = 0; j < M; j++){
      if(d.at(P[j].first-1) != P[j].second) ok = false;
    }
      
      if(ok){cout << i << endl;
      return 0;}
    
  }
  cout << -1 <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;



int main()
{
  int n, m ;
  cin >> n >> m ;
  vector<int> count(n,0) ;
  REP(i,2*m){
    int j ;
    cin >> j ;
    count.at(j-1)++ ;
  }
  REP(i,n){
    cout << count.at(i) <<endl ;
  }

  return 0 ;
}




Measured memory_bytes: 256
#pragma region header
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a / gcd(a, b) * b ;
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion

signed main() {
    int n,k;cin >> n >> k;
    int ans = 1;
    rep(i, n) {
        if(i==0)ans*=k;
        else ans*=k-1;
    }
    cout << ans << endl;
    return 0;
}

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

 
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    long double a[n],sum=0;
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=(1/a[i]);
    }
	cout<<fixed<<setprecision(7)<<1/sum;
	return 0;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if(A+B>C+D){
    cout << "Left" << endl;
  }
  
  else if(A+B == C+D){
    cout << "Balanced" << endl;
  }
  
  else if(A+B<C+D){
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
import collections
def main():

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

    d = collections.defaultdict(int)

    prefix = [0]
    for i in range(N):
        prefix.append(prefix[-1] + A[i])

    ans = 0
    for j in range(N+1):
        v = (prefix[j] - j) % K
        ans += d[v]
        d[v] += 1
        if j >= K-1:
            d[(prefix[j-K+1] - (j-K+1)) % K] -= 1
        # print(ans)
    return ans



if __name__ == '__main__':
    print(main())

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

struct UnionFind
{
    vector<int> par;
    UnionFind(int n) : par(n, -1) {}
    // void init(int n) {
    //     par.assign(n, -1);
    // }
    int root(int x)
    {
        if (par[x] < 0)
            return x;
        else
            return par[x] = root(par[x]);
    }
    bool issame(int x, int y)
    {
        return root(x) == root(y);
    }
    bool merge(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
            return false;
        if (par[x] > par[y])
            swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    int size(int x)
    {
        return -par[root(x)];
    }
};

int main()
{
    int N, K, L, a, b;
    cin >> N >> K >> L;
    UnionFind tree1(N), tree2(N);
    for (int i = 0; i < K; i++)
    {
        cin >> a >> b;
        a--;
        b--;
        tree1.merge(a, b);
    }
    for (int i = 0; i < L; i++)
    {
        cin >> a >> b;
        a--;
        b--;
        tree2.merge(a, b);
    }

    map<pair<int, int>, int> mp;
    for (int i = 0; i < N; i++)
    {
        pair<int, int> v(tree1.root(i), tree2.root(i));
        mp[v]++;
    }
    for (int i = 0; i < N; i++)
    {
        pair<int, int> p(tree1.root(i), tree2.root(i));
        cout << mp[p] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 13568
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTA(a,n) sort(a,a+n)
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力  
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
    //処理
  int ans =  min(b,d)-max(a,c);   
    //出力
    if(ans>0) cout << ans << ENT;
  else cout << 0 <<ENT;
    return 0;
}

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


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

const ll mod = 1e9 + 7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
    int N;
    cin >> N;
    ll ans = 0;
    vector<ll> A(N),B(N);
    ll dif = 0;
    int p = -1;
    ll sum = 0;
    rep(i,N){
        cin >> A[i] >> B[i];
        sum += A[i];
    }
    rep(i,N){
        // i 番目以外を0にすると考えると
        if(A[i]>B[i]){
            ll t = A[i]-B[i] + sum - A[i];
            ans = max(t,ans);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
    unsigned long long h;
    cin >> h;
    unsigned long long ans=0;
    if(h == 1 ){
        cout << 1 << endl;
        return 0;
    }
    unsigned long long mosNum = 1;
    while(h>0){
        ans+=mosNum;
        mosNum*=2;
        h/=2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/* Don't try to copy it!
                    nhi too,
                         goli maar ke cheed bana dunga...;););)
 
                 
    _/﹋\_
    (҂`_´)
    <,︻╦╤─҉- - - - - - - - => - => - =>
    _/﹋\_
                
*/
 
#include "bits/stdc++.h"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#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 vll vector<ll>
#define T ll t; cin>>t; while(t--)
#define freeopen freopen("input.txt","r",stdin);
#define freeclose freopen("output.txt","w",stdout);
#define MOD 1000000007
using namespace std;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
ll n;
ll a[100005],b[100005],c[100005];
ll dp[100005][4];
ll max_happ(ll p,ll s)
{
    if(p>=n)
        return 0;

    if(dp[p][s]!=-1)
        return dp[p][s];
    if(s==1)
    {
        dp[p][s]=max(b[p]+max_happ(p+1,2),c[p]+max_happ(p+1,3));
    }
    else if(s==2)
    {
        dp[p][s]=max(a[p]+max_happ(p+1,1),c[p]+max_happ(p+1,3));
    }
    else
    {
        dp[p][s]=max(b[p]+max_happ(p+1,2),a[p]+max_happ(p+1,1));
    }
    return dp[p][s];
}



main()
{
   //ll n;
    memset(dp,-1,sizeof(dp));
   cin>>n;
   

   f(n)
   {
    cin>>a[i];
    cin>>b[i];
    cin>>c[i];
   }

   cout<<max({max_happ(0,1),max_happ(0,2),max_happ(0,3)});

}



Measured memory_bytes: 13772
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <complex>
#include <numeric>
#include <string.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const ll MOD = 998244353;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

int dp[500001][4];

int solve(vector<int>& v) {
    if (v.size() <= 1) return 0;
    rep(i,v.size()) rep(j,4) dp[i][j] = 0;
    for (int i = 1; i < v.size(); i++) {
        dp[i][0] = *max_element(dp[i-1], dp[i-1]+4);
        dp[i][1] = max(dp[i-1][0]+v[i-1], max(dp[i-1][1]+v[i-1]-1, dp[i-1][2]+1));
        if (v[i] != 1) {
            dp[i][2] = max(dp[i-1][0]+v[i]-1, max(dp[i-1][1]+v[i]-1, dp[i-1][2]+v[i]-1));
        } else {
            dp[i][3] = -inf;
        }
        dp[i][3] = max(dp[i-1][0], max(dp[i-1][1], dp[i-1][2])) + v[i];
        if (v[i] == 1) {
            dp[i][3] = max(dp[i][1], dp[i][3]);
            dp[i][1] = -inf;
        }
    }
    return *max_element(dp[v.size()-1], dp[v.size()-1]+4);
}

int N;
string s;
ll ans = 0;

int main() {
    cin >> N >> s;
    vector<int> v;
    bool st = false;
    bool con = false;
    rep(i,N) {
        if (!st) {
            if (s[i] == '0') continue;
            st = true;
            v.push_back(1);
            con = true;
            continue;
        }
        if (con) {
            if (s[i] == '0') con = false;
            else v[v.size()-1]++;
        } else {
            if (s[i] == '1') {
                v.push_back(1);
                con = true;
            } else {
                ans += solve(v);
                st = false;
                v.clear();
            }
        }
    }
    ans += solve(v);
    cout << ans << endl;
}

Measured memory_bytes: 900
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {

  i64 H, W, i, j;
  cin >> H >> W;
  //cout << H << " " << W << endl;
  vector<string> S(H);
  getchar();
  REP(0, H, i) {
    getline(cin, S[i]);
  }

  i64 LARGE = 10000;
  auto s = [&S, &LARGE](i64 i, i64 j) {
    //cout << "s " << i << "  " << j << " " << (S[i][j] == '#' ? 1 : 0) << endl;
    return S[i][j] == '#' ? LARGE : 0;
  };
  auto t = [&S, &LARGE](i64 i, i64 j) {
    // cout << "t " << i << "  " << j << " " << (S[i][j] == '.' ? 1 : 0) << endl;
    return S[i][j] == '.' ? LARGE : 0;
  };

  vvi C(H, vi(W, 0)), D(H, vi(W, 0));
  C[0][0] = s(0, 0);
  D[0][0] = t(0, 0) + 1;
  REP(1, W, j) {
    //cout << j << endl;
    C[0][j] = min(C[0][j-1], D[0][j-1]) + s(0, j);
    D[0][j] = min(C[0][j-1]+1, D[0][j-1]) + t(0, j);
  }

  REP(1, H, i) {
    C[i][0] = min(C[i-1][0], D[i-1][0]) + s(i, 0);
    D[i][0] = min(C[i-1][0]+1, D[i-1][0]) + t(i, 0);
    //cout << "line " << i << " "  << s(0,j) << " " << t(0,j) << endl;;
    REP(1, W, j) {
      C[i][j] = min(min(C[i-1][j], C[i][j-1]), min(D[i-1][j], D[i][j-1]));
      C[i][j] += s(i, j);
      D[i][j] = min(min(C[i-1][j], C[i][j-1])+1, min(D[i-1][j], D[i][j-1]));
      D[i][j] += t(i, j);
    }
  }

  cout << min(C[H-1][W-1], D[H-1][W-1]) << endl;

  /*
  REP(0, H, i) {
    REP(0, W, j) {
      cout << C[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
  REP(0, H, i) {
    REP(0, W, j) {
      cout << D[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
  */

  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(){
  int a=0;
  int N=0;
  int A[100];
  int i=0;
  int j=0;
  int temp=0;
  int p;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
    if(i==N-1) printf("%d",A[i]);
    else printf("%d ",A[i]);
  }
  printf("\n");
  for(i=1;i<N;i++){
    temp=A[i];
    j=i-1;
    while(j>=0&&A[j]>temp){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=temp;
    
    for(a=0;a<N;a++){
      if(a==N-1) printf("%d",A[a]);
      else printf("%d ",A[a]);
      
    }
    printf("\n");
  }
  return 0;
}




Measured memory_bytes: 2072
#include<bits/stdc++.h>
#define N 2000009
#define ll long long
#define ld long double
#define ff first
#define ss second
#define inf 1000000005
#define mod 1000000007
using namespace std;
ll f[200009], invf[200009], h, w;
ll bin_pow(ll x, ll k) {
    if(k == 0)
        return 1;
    ll res = bin_pow(x, k / 2);
    res = (res * res) % mod;
    if(k & 1)
        res *= x;
    res %= mod;
    return res;
}
ll inv(ll x) {
    return bin_pow(x, mod - 2);
}
ll C(ll n, ll k) {
    return ((f[n] * invf[k]) % mod * invf[n - k]) % mod;
}
ll n, dp[3009], dp2[3009];
vector<pair<ll, ll> > x;
int main() {
    cin>>h>>w>>n;
    f[0] = invf[0] = 1;
    for(int i=1;i<=h+w;i++) {
        f[i] = f[i - 1] * i % mod;
        invf[i] = inv(f[i]);
    }
    for(int i=0;i<n;i++) {
        int xx, yy;
        cin>>xx>>yy;
        x.push_back({xx, yy});
    }
    x.push_back({h, w});
    sort(x.begin(), x.end());
    for(int i=0;i<=n;i++) {
        ll k = C((x[i].ff + x[i].ss - 2), (x[i].ff - 1) );
        //cout<<i<<" "<<k<<" ";
        for(int j=0;j<i;j++) {
            if(x[j].ss <= x[i].ss) {
                k -= dp[j] * C(x[i].ff + x[i].ss - x[j].ff - x[j].ss, x[i].ff - x[j].ff) % mod;
                if(k < 0)
                    k += mod;
            }
        }
        //cout<<k<<" "<<(k * C(h + w - x[i].ff - x[i].ss, h - x[i].ff)) % mod<<endl;
        dp[i] = k;
    }
    cout<<dp[n];

}


Measured memory_bytes: 6836
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const ll mod = 1e+9 + 7;
const int INF = 1001001001;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n;
    cin >> n;
    map<string, int> mp;
    int maxcnt = 0;
    for(int i = 0; i < n; ++i){
        string s;
        cin >> s;
        ++mp[s];
        if(mp[s] > maxcnt){
            maxcnt = mp[s];
        }
    }
    for(auto it : mp){
        if(it.second == maxcnt){
            cout << it.first << "\n";
        }
    }
}

Measured memory_bytes: 23936
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner inp = new Scanner(System.in);
    int a = inp.nextInt();
    int b = inp.nextInt();
    int f=-1;
    for( int i=0; i<100000; i++){
      int t1 = (i*8)/100;
      int t2 = (i*10)/100;
      if(t1==a && t2==b){
        f=i;
        break;
      }
    }
    System.out.println(f);

  }
}

Measured memory_bytes: 23380
#include <algorithm>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define moder 1000000007
#define double long double
#define INF LLONG_MAX/10000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n,a[410],b[410];
int dp[410][410];
signed main(){
	cin>>n;
	rep(i,n){
		cin>>a[i];
		b[i]=a[i];
		if(i)b[i]+=b[i-1];
	}
	for(int i=2;i<=n;i++){
		rep(j,n-i+1){
			dp[j][i]=INF;
			for(int k=1;k<=i;k++){
				dp[j][i]=min(dp[j][i],dp[j][k]+dp[j+k][i-k]);
			}
			if(j)dp[j][i]+=b[j+i-1]-b[j-1];
			else dp[j][i]+=b[j+i-1];
		}
	}
	cout<<dp[0][n]<<endl;
}

Measured memory_bytes: 1536
ABCD = input()
result = 0

output=[]
#+を加えていく代入する
for i in range(4):
    output += "+"
    output += ABCD[i]
output = ''.join(output)

#4*4ループ
for i in range(4**2): 
    result = output 
    for j in range (4):
        if( (i>>j) & 1 ):
            result = list(result)
            result[j*2] = "-"
            result = ''.join(result)
    # print("-------")
    # print(result)
    if eval(result)==7:
        if(result[0]=="+"):
            print(result[1:]+"=7")
            exit()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;
const ll LINF=1e18;

int main(){
    int n;
    cin>>n;
    ll l[n];
    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    for(int i=0;i<n-1;i++){
        l[i+1]+=l[i];
    }
    ll ans=LINF;
    for(int i=0;i<n-1;i++){
        ll r=l[n-1]-l[i];
        ans=min(ans,abs(r-l[i]));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef pair<ll,P> PP;
int main() {
	string s; cin >> s; bool f = true;
	if (s[0] != 'A')f = false;
	int len = s.length(); int cnt = 0;
	Rep(i, 2, len - 1) {
		if (s[i] == 'C')cnt++;
	}
	if (cnt != 1)f = false;
	if ('A' <= s[1] && s[1] <= 'Z')f = false;
	Rep(i, 2, len) {
		if ('A' <= s[i] && s[i] <= 'Z'&&s[i] != 'C')f = false;
	}
	if (f)cout << "AC" << endl;
	else cout << "WA" << endl;
	return 0;
}

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

int main(){
    long long N, M;
    scanf("%lld %lld",&N,&M);

    if( N < M){
        int tmp = N;
        N = M;
        M = tmp;
    }
    assert( N >= M);

    long long ret;
    if(N == 1 && M == 1)      ret = 1;
    else if(N == 2 && M == 1) ret = 0;
    else if(N > 2 && M == 1)  ret = N-2;
    else if(N == 2 || M == 2) ret = 0;
    else                      ret = (N-2)*(M-2);

    printf("%lld\n",ret);
}

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

int main(){
	int n,m, temp;
	cin >> n >> m;
	vector<int> v(m,0);
	for(int i = 0;i<n;i++){
		int k;
		cin >> k;
		for(int j =0; j<k; j++){
			cin >> temp;
			v[temp-1]++;
		}
	}
	int count = 0;
	for(int i = 0; i<m; i++){
		if (v[i] == n) count++;
	}
	cout << count;
}


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

char s[200020];
int main() {
	scanf("%s", s);
	int n = strlen(s);
	int l = 0, r = n - 1;
	int z = 0;
	while (l < r) {
		if (s[l] == s[r]) {
			l++;
			r--;
		} else if (s[l] == 'x') {
			z++;
			l++;
		} else if (s[r] == 'x') {
			z++;
			r--;
		} else {
			z = -1;
			break;
		}
	}
	printf("%d\n", z);
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define PI 3.14159265359
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

  if (n % 2 == 1) {
    rep(i, m) {
      cout << i + 1 << " " << n - i << endl;
    }
  }
  else {
    rep(i, min(n/4, m)) {
      cout << i + 1 << " " << n - i << endl;
    }
    if (n/4 < m) {
      for (int i=n/4; i<m; i++) {
        cout << i + 1 << " " << n - i - 1 << endl;
      }
    }
  }
  
  return 0;
}


Measured memory_bytes: 3644
/**
 *    author:  FromDihPout
 *    created: 2020-05-26
**/

#include <bits/stdc++.h>
using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    map<string, int> freq;
    int max_freq = 0;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        freq[s]++;
        max_freq = max(max_freq, freq[s]);
    }
    
    for (auto it = freq.begin(); it != freq.end(); it++) {
        if (it->second == max_freq) {
            cout << it->first << '\n';
        }
    }
    return 0;
}

Measured memory_bytes: 23808
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
typedef long long ll;

int main(void) {
  int n;
  cin >> n;
  if(n == 1) {
    cout << "Hello World" << endl;
  } else {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define LEN 86400
signed main(){
  int n;
  cin>>n;
  int s[LEN*2+1];
  memset(s,0,sizeof(s));
  int t=0;
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    (t+=a)%=LEN;
    s[t]++;
    s[t+LEN]++;
    (t+=b)%=LEN;
  }
  for(int i=1;i<LEN*2+1;i++) s[i]+=s[i-1];
  int ans=s[10800];
  for(int i=1;i<LEN;i++){
    ans=max(ans,s[i+10800]-s[i-1]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  rep(i,0,5){
    int a;
    cin>>a;
    if(a==0) cout<<i+1<<endl;
  }
}

Measured memory_bytes: 3616