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

//.define
// #define FILE_IN_OUT
#define RET(_x)                       return cout << (_x) << '\n', 0;
#define all(_obj)                     (_obj).begin(), (_obj).end()
#define loop(_n)                      for (int i = 0; i < (_n); ++i)
#define CeilDiv(_dividend, _divider)  (((_dividend) - 1LL + (_divider)) / (_divider))
#define sz(_obj)                      static_cast<int>((_obj).size())
#ifdef SHJ_LOCAL
#define debug(_x)                     std::cerr << (#_x) << " = " << (_x) << '\n' << std::flush;
#else
#define debug(_x)                     {}
#endif
#define endl "\n"
template<typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
    for (Tp current = _begin; current != _end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll  = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);

//.data

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream cin ("input.txt",  std::ios::in);
    std::ofstream cout("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if ((i & 1) == 0 && (x & 1)) {
            ++ans;
        }
    }
    cout << ans << endl;

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[][] a = new char[n][n];
        for(int i=0; i<n; i++) {
            a[i] = sc.next().toCharArray();
        }

        int res = 0;

        OUTER: for(int i=0; i<n; i++) {
            for(int j=0; j<n; j++) {
                for(int k=0; k<n; k++) {
                    if(a[(j+i)%n][k] != a[(k+i)%n][j]) {
                        continue OUTER;
                    }

                }
            }
            res ++;
        }
        System.out.println(res * n);
    }

}


Measured memory_bytes: 25416
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 1e9+7;



int main(){
    string S; cin >> S;
    if(S[S.size()-1] == 's') S += "es";
    else S += 's';
    cout << S << endl;

}


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

const ll INF = 1LL << 60;


int main() {
    long long S;
    scanf("%lld",&S);
    long long W;
    scanf("%lld",&W);

    if (W >= S) {
        cout << "unsafe" << endl;
    } else {
        cout << "safe" << endl;
    }
}


Measured memory_bytes: 3760
# -*- coding: utf-8 -*-

from math import sqrt


n = int(input())
x = []
y = []
for i in range(n):
    a,b = map(int,input().split())
    x.append(a)
    y.append(b)

s = 0

for i in range(n-1):
    for j in range(i+1,n):
        s += sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)

print(s*2/n)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define stpn setprecision
using namespace std;
typedef long long ll;
int main()
{
	ll a,b,c,d;
	cin>>a>>b>>c;
	d=c-a-b;
	if (d>0&&4*a*b<d*d) cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 3588
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author cplayer
 */
public class Main {
    public static void main (String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DFlippingSigns solver = new DFlippingSigns();
        solver.solve(1, in, out);
        out.close();
    }

    static class DFlippingSigns {
        public void solve (int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = in.nextIntArr(n);
            if (n == 1) {
                out.println(Math.max(a[0], -a[0]));
                return;
            }
            long[][] dp = new long[n][2];
            dp[0][0] = a[0] + a[1];
            dp[0][1] = -(a[0] + a[1]);
            for (int i = 1; i < n - 1; ++i) {
                dp[i][0] = Math.max(dp[i - 1][0] + a[i + 1], dp[i - 1][1] + a[i + 1]);
                dp[i][1] = Math.max(dp[i - 1][0] - 2 * a[i] - a[i + 1], dp[i - 1][1] + 2 * a[i] - a[i + 1]);
            }
            out.println(Math.max(dp[n - 2][0], dp[n - 2][1]));
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader (InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String next () {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }

        public int[] nextIntArr (int length) {
            int[] res = new int[length];
            for (int i = 0; i < length; ++i) {
                res[i] = nextInt();
            }
            return res;
        }

        public int nextInt () {
            return Integer.parseInt(next());
        }

    }
}



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

bool rot(int x) {
  int a, b, c, d, e;
  a = x / 10000;
  x = x % 10000;
  b = x / 1000;
  x = x % 1000;
  c = x / 100;
  x = x % 100;
  d = x / 10;
  e = x % 10;
  if (a == e && b == d) {
    return true;
  }
  else {
    return false;
  }
}

int main() {
  int A, B;
  cin >> A >> B;
  int ans = 0;
  for (int i = A; i <= B; i++) {
    if (rot(i)) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pll>   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pi>   vpi;
typedef    set<pi>   spi;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   998244353
#define    inf  9223372026854775807
#define    ninf   -inf
#define    ima   2047483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define    all(x)   x.be(),x.en()
#define    eps   1e-9
#define    coutd   cout<<setprecision(12)<<fixed
#define    mems(dp,x)   memset(dp,x,sizeof(dp))
#define    fbo    find_by_order
#define    ook    order_of_key
#define    upb    upper_bound
#define    lowb   lower_bound 
#define    lte(v,x)   upb(all(v),x)-v.be()
#define    gte(v,x)   v.end()-lowb(all(v),x)
const    ld   PI=3.1415926535897932384626433832792884197169399375105820974944;
inline ll modpow(ll x,ll n){if(x==0)return 0;if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}
inline ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}





int main()
{       io 
int testcases=1;      //  cin>>testcases;
while(testcases--)
{


ll n,d;
cin>>n>>d;
d*=2ll;
d++;
ll k=n/d;
if(n%d!=0)
k++;

cout<<k;














}return 0;}

Measured memory_bytes: 256
#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a[4];
  int t;
  cin >> t;
  rep(i,4){
    a[3-i] = t%10;
    t/=10;
  }
  rep(i,8){
    int s = a[0];
    int c = i;
    rep(j,3){
      if((c&1) == 1) s += a[j+1];
      else s -= a[j+1];
      c>>=1;
    }
    if(s == 7){
      cout << a[0];
      rep(j,3){
        if(i&1) cout << '+';
        else cout << '-';
        cout << a[j+1];
        i>>=1;
      }
      cout << "=7" << endl;

      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    int a, b, c; cin >> a >> b >> c;
    map<int, int> mp;
    mp[a]++, mp[b]++, mp[c]++;
    if(mp[5]==2 && mp[7]==1) cout << "YES";
    else cout << "NO";
}


Measured memory_bytes: 256
#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<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
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 pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;



void solve() {
	int n; cin >> n;
	int ans = 0;
	rep(i, n) {
		string s; cin >> s;
		if (s == "E869120")ans++;
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(4);
	//init();
	solve();
	stop
		return 0;
}



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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    s[k-1] = s[k-1] - 'A' + 'a';
    ANS(s);
    return 0;
}

Measured memory_bytes: 256
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 1000005
vector<int> v;
bitset<MAX> vis;
bitset<MAX> fck;
map<int,int> mp;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n; cin>>n;
    
    for(int i=1;i<=n;i++){
        int a; cin>>a;
        mp[a]++;
    }
    ll ans=0;
    for(auto i: mp){
        int a=i.first;
        if( mp[a]==1 && vis[a]==0) ans++;
        if(fck[a]==1) continue;
        fck[a]=1;
        for(int j=a;j<MAX;j+=a) vis[j]=1;
    }
    cout<<ans<<endl;
    
    
}

Measured memory_bytes: 13076
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
//#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
//#define M   1000000007 // 1e9 + 7
#define int long long
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
inline ll mod(ll n, ll m ){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}
ll exp(ll a,ll b,ll m){
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}

const int N = 100100;
int a[N];
const int M = 1e9 + 7;
int rev[N];

ll fat[N],inv[N];

ll C(int n,int k){
  if(k>n)return 0;
  return mod(fat[n]*mod(inv[k]*inv[n-k],M),M);
}

int32_t main(){
 fastio;
 fat[0] = inv[0] =1;
 for(int i=1;i<N;i++){
  fat[i] = (fat[i-1]*i)%M;
  inv[i] = exp(fat[i],M-2,M);
 }
 int n,k;
 cin>>n>>k;
 for(int i=1;i<=n;i++){
  cin >> a[i];
 }

 sort(a+1,a+1+n);
 int small=0;
 int res=0;
 for(int i=1;i<=n;){
  int ini = i;
  int in=0;
  while(i<=n and a[ini]==a[i]){
    in++;
    i++;
  }

  for(int pega=1;pega<=in;pega++){
    if(pega>k)break;
    ll cur = mod(a[ini]*C(small,k-pega),M);
    cur = mod(cur*C(in,pega),M);
    res = mod(res + cur,M);
  }

  small+=in;
 }

 int big=0;
 for(int i=n;i>=1;){
  int ini = i;
  int in=0;
  while(i>=1 and a[ini]==a[i]){
    in++;
    i--;
  }
  for(int pega=1;pega<=in;pega++){
    if(pega>k)break;
    ll cur = mod(a[ini]*C(big,k-pega),M);
    cur = mod(cur*C(in,pega),M);
    res = mod(res - cur,M);
   // cout << big<<" "<<cur<<" "<<pega<<" "<<a[ini] << endl;
  }
  big+=in;
 }
 cout << res << endl;

  // Math -> gcd it all
  // Did u check N=1? Did you switch N,M?
}

Measured memory_bytes: 2560
import sys
from collections import deque

s = deque(input() + 'T')
X, Y = map(int, input().split())

while True:
    if s[0] == 'T':
        break
    s.popleft()
    X -= 1

dirx = True
x_list = []
y_list = []
count = 0
for c in s:
    if c == 'F':
        count += 1
    else:
        if count > 0:
            x_list.append(count) if dirx else y_list.append(count)
            count = 0
        dirx = not(dirx)

if (sum(x_list) + X) % 2 != 0 or (sum(y_list) + Y) % 2 != 0 or sum(x_list) < abs(X) or sum(y_list) < abs(Y):
    print('No')
    sys.exit()

dx = (sum(x_list) + abs(X)) // 2
dy = (sum(y_list) + abs(Y)) // 2

dp_x = [False for _ in range(dx + 1)]
dp_x[0] = True
for x in x_list:
    for i in range(dx - x, -1, -1):
        if dp_x[i] and i + x <= dx:
            dp_x[i + x] = True
if not dp_x[dx]:
    print('No')
    sys.exit()

dp_y = [False for _ in range(dy + 1)]
dp_y[0] = True
for y in y_list:
    for i in range(dy - y, -1, -1):
        if dp_y[i] and i + y <= dy:
            dp_y[i + y] = True
if not dp_y[dy]:
    print('No')
    sys.exit()

print('Yes')


Measured memory_bytes: 3444
#include <stdio.h>
#include <string.h>
int main(void){
	char t[201],h[201];
	int n,taro=0,hanako=0;
        scanf("%d",&n);
	while(n--){
		scanf("%s %s",t,h);
		if(strcmp(t,h)>0)
			taro+=3;
		else if(strcmp(t,h)<0)
			hanako+=3;
		else{
			taro++;
			hanako++;
		}
	}
	printf("%d %d\n",taro,hanako);
	return 0;
}

Measured memory_bytes: 604
import sys

input()
card = sys.stdin.readlines()
bool_ = [[False for y in range(13)] for x in range(4)]

for i in card:
    m, n = i.split()
    m = m.replace('S', '0').replace('H', '1').replace('C', '2').replace('D', '3')
    m, n = int(m), int(n)
    bool_[m][n - 1] = True

for i in range(4):
    for j in range(13):
        if not bool_[i][j]:
            if i == 0:
                print('S', j + 1)
            elif i == 1:
                print('H', j + 1)
            elif i == 2:
                print('C', j + 1)
            else:
                print('D', j + 1)

Measured memory_bytes: 7752
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define rep(i, n) for (ll i = 0; i < (n); i++)
int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false); 
  ll N; cin >> N;
  ll ac = 0, wa = 0, tle = 0, re = 0;

  rep(i, N) {
    string s; cin >> s;
    if (s == "AC") ac++;
    if (s == "WA") wa++;
    if (s == "TLE") tle++;
    if (s == "RE") re++;
  }

  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}


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

using namespace std;

int grid[100005][3];

int vacation(int n) {
	int dp[100005][4];
	for (int j = 0; j < 3; j++) {
		dp[0][j] = grid[0][j];
	}
	for (int i = 1; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			if (j-1 < 0) {
				dp[i][j] = max(dp[i-1][j+2],dp[i-1][j+1]) + grid[i][j]; 
			}
			else if (j + 1 >= 3) {
				dp[i][j] = max(dp[i-1][j-2],dp[i-1][j-1]) + grid[i][j];
			}
			else {
				dp[i][j] = max(dp[i-1][j+1],dp[i-1][j-1]) + grid[i][j];
			}
		}
	}
	int best = 0;
	for (int i = 0; i < 3; i++) {
		best = max(best,dp[n-1][i]);
	}
	return best;
}


int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> grid[i][j];
		}
	}
	int ans = vacation(n);
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 2944
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int N = scan.nextInt();
		int T = scan.nextInt();
		int A = scan.nextInt();

		int[] H = new int[N] ;
		
		for (int i =0; i<N ;i++){
			H[i] = scan.nextInt();
		}
		
		double score = Math.abs((double)A - ((double)T - (double)H[0] * 0.006));
		int candidate = 1;
		
		for (int i =1; i<N ;i++){
			if (score > Math.abs((double)A - ((double)T - (double)H[i] * 0.006))){
				score = Math.abs((double)A - ((double)T - (double)H[i] * 0.006));
				candidate = i+1;
			}
		}
		
		System.out.println(candidate);
		
	}

}

Measured memory_bytes: 25556
N, M, Q = gets.split.map(&:to_i)

arrs = (1..M).to_a.repeated_combination(N).to_a
scores = Array.new(arrs.length) { 0 }
Q.times do
  a, b, c, d = gets.split.map(&:to_i)
  arrs.each_with_index do |arr, i|
    scores[i] += d if arr[b-1] - arr[a-1] == c
  end
end

puts scores.max


Measured memory_bytes: 28696
from itertools import accumulate

n, k = list(map(int,input().split(" ")))
s = input()


def findmax():
    cur=0
    l=[]
    prev = '1'
    for c in s:
        if prev ==c:
            cur+=1
        else:
            l.append(cur)
            cur = 1
        prev=c
    l.append(cur)
    if prev=='0':
        l.append(0)
    w = 2*k+1
    if len(l)<=w:
        return n
    sumup = [0]+list(accumulate(l))
    res = 0
    for i in range(0, len(l)-w+1,2):
        res = max(res,sumup[i+w]-sumup[i])
    return res
print(findmax())


Measured memory_bytes: 8704
#include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
#define f(n) for(ll i=0;i<n;i++)
#define vll vector<ll>
#define vlll vector<vll>
int main()
{
    Imposter
    
    int t=1;
    //cin>>t;
    while(t--)
    {
        string a,b;
        cin>>a>>b;ll ans=0;
        for(int i=0;i<a.length();i++)
        {
            if(a[i]!=b[i])
            ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3820
using System;
using System.Collections.Generic;
public class ABC147A {
    public static void Main() {
        int A, B, C, ans = 0;
        string[] str = Console.ReadLine().Split(' ');
        A = int.Parse(str[0]);
        B = int.Parse(str[1]);
        C = int.Parse(str[2]);
        ans = A + B + C;
        if (ans >= 22) Console.WriteLine("bust");
        else Console.WriteLine("win");
    }
}


Measured memory_bytes: 13140
#include<stdio.h>
int main()
{
  int num;
  int cnt;
  int d;
  int two;
  int i;
  int val;
  
  cnt = scanf("%d", &num);

  val = 1;
  for (i=0; i<4; i++) {
    d = (num % (val*10)) / val;
    val *= 10;
    if (d == 2) two++;
  }

  printf("%d", two);
  
  return 0;
}


Measured memory_bytes: 128
using System;

class C{
  static void Main(){
    int[] Ar = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
    int N = Ar[0], K = Ar[1];
    long[] Tree = new long[N];
    for (int i = 0; i < N; i++){ // 木を取得
      Tree[i] = int.Parse(Console.ReadLine());
    }
    Array.Sort(Tree);
    long ans = 999999999;
    for (int i = 0; i <= N - K; i++){
      // Console.WriteLine(Tree[i + K - 1] + " - " + Tree[i]);
      ans = Math.Min(ans, Tree[i + K - 1] - Tree[i]);
    }
    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 32752
#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
int n;
int a[maxn];
int main()
{
    cin>>n;
    for(int i=1;i<n;i++)
        cin>>a[i];
    a[n] = a[n-1];
    int ans = a[1];
    for(int i=1;i<n;i++)
        ans += min(a[i],a[i+1]);
    cout<<ans<<endl;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H,N;
    cin >> H >> N;
    int sum = 0;
    rep(i,N){
        int A;
        cin >> A;
        sum += A;
    }
    if(sum >= H) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define REV(x) reverse(ALL((x)))
#define pb push_back

int main()
{
    ll H, W;
    cin >> H >> W;    
    mat A(H+1, vec(W+1, 0)), B(H+1, vec(W+1, 0));
    REP(i,1,H+1) REP(j,1,W+1) cin >> A[i][j];
    REP(i,1,H+1) REP(j,1,W+1) cin >> B[i][j];

    ll K = 160 * 80;
    bool dp[H+1][W+1][K+1];
    REP(i,0,H+1) {
        REP(j,0,W+1) {
            REP(k,0,K+1) dp[i][j][k] = false;
        }
    }
    dp[0][1][0] = true;
    dp[1][0][0] = true;

    ll d;
    REP(i,1,H+1) {
        REP(j,1,W+1) {
            REP(k,0,K+1) {
                d = abs(A[i][j] - B[i][j]);
                if(k + d <= K) {
                    dp[i][j][k+d] |= dp[i][j-1][k];
                    dp[i][j][k+d] |= dp[i-1][j][k];
                }
                if(abs(k - d) <= K) {
                    dp[i][j][abs(k-d)] |= dp[i][j-1][k];
                    dp[i][j][abs(k-d)] |= dp[i-1][j][k];
                }
            }
        }
    }

    REP(k,0,K) {
        if(dp[H][W][k]) {
            PR(k);
            break;
        }
    }


    return 0;
}

/*



*/

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

int d[305][305];

int main()
{
    long long n;

    cin>>n;

    for(int i = 1; i<=n; i++)
        for(int j = 1; j<=n; j++)
            cin>>d[i][j];

    for(int k = 1; k<=n; k++)
        for(int i = 1; i<=n; i++)
            for(int j = 1; j<=n; j++)
                if(d[i][k] + d[k][j] < d[i][j])
                {
                    puts("-1");
                    return 0;
                }


    long long res;



    bool lagbena[305][305];
    memset(lagbena, 0, sizeof(lagbena));

    for(int i = 1; i<=n; i++){
        for(int j = 1; j<=n; j++){
            for(int k = 1; k<=n; k++){
                if(d[i][j] == d[i][k] + d[k][j]){
                    if(d[i][k] && d[k][j]){
                        lagbena[i][j] = true;
                    }

                }
            }
        }
    }

    for(int i = 1; i<=n; i++){
        for(int j = i+1; j<=n; j++){
            if(!lagbena[i][j]) res += d[i][j];
        }
    }

    cout<<res<<endl;










}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define pb push_back
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define uy q.front()
#define SIZE (ll)(1e6)
#define mod (ll)(1e9+7)
using namespace std;
typedef long long  ll;
int main(){
int n,k;cin>>n>>k;
int ar[n];
for(int i=0;i<n;i++) cin>>ar[i];
  int dp[n];
for(int i=0;i<n;i++) dp[i]=mod;
  dp[0]=0;dp[1]=abs(ar[1]-ar[0]);



for(int i=2;i<n;i++){
  for(int j=0;j<k;j++){
    if((i-j-1)>=0){
    dp[i]=min((dp[i-j-1]+abs(ar[i-j-1]-ar[i])),dp[i]);
  }}
}
cout<<dp[n-1]<<endl;return 0;}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
 int n;
 cin>>n;
 vector<int> v(n),c(n);
 for(int i=0;i<n;i++){
  cin>>v[i];
 }
 int ans=0;
 for(int i=0;i<n;i++){
  cin>>c[i];
  ans+=max(v[i]-c[i],0);
 }
 cout<<ans<<endl;
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

std::vector<bool> IsPrime;
void sieve(LL max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    } 
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(LL i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(IsPrime[i]) // iが素数ならば
            for(LL j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
}


int main(){
    int X;cin >> X;
    sieve(X*2+1);
    int ans = 0;
    for(int i = X;i <= X*2;++i){
        if(IsPrime[i]){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cout.tie(0);
cin.tie(NULL);
string s; cin>>s;
int a=0,b=0;
for(int i=0;i<3;i++)
{
	if(s[i]=='A')
	a++;
	else
	b++;
}
if(a==0||b==0)
cout<<"No";
else
cout<<"Yes";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
signed main()
{
   SPEED;
   int n,m;
   cin>>n>>m;
   int h[n+1];
   for(int i=1;i<=n;i++)
   {
       cin>>h[i];
   }
   vector <int> adj[n+1];
   for(int i=0;i<m;i++)
   {
       int a,b;
       cin>>a>>b;
       adj[a].push_back(b);
       adj[b].push_back(a);
   }
   int cnt=0;
   for(int i=1;i<=n;i++)
   {
       int flag=1;
       for(int j=0;j<adj[i].size();j++)
       {
           if(h[adj[i][j]]>=h[i])
           {
               flag=-1;
           }
       }
       if(flag==1)
       {
           ++cnt;
       }
   }
   cout<<cnt;
}

Measured memory_bytes: 10280
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        sc.close();
        if(a<b && b<c){
            System.out.println("Yes");
            
        }else{
        System.out.println("No");
        }
    }
}


Measured memory_bytes: 26332
#ifdef OJ_MISC_OFFLINE

#include "prolog.h"

#else
#define PRINT
#define LCERR
#endif

#include <algorithm>
#include <array>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

namespace {

using namespace std;

class Solution {
public:
    int hopscotch_addict(int N, const vector<pair<int, int>>& edges, int s, int t) {
        vector<vector<int>> g(N + 1);
        for (const auto& e : edges) {
            g[e.first].emplace_back(e.second);
        }

        vector<array<bool, 3>> visited(N + 1);
        for (auto& arr : visited) {
            fill(arr.begin(), arr.end(), false);
        }

        queue<int> q;
        q.push(s);
        visited[s][0] = true;
        int dist = 0;
        while (!q.empty()) {
            dist += 1;
            int bsize = q.size();
            for (int b = 0; b < bsize; ++b) {
                int pos = q.front();
                q.pop();
                for (int next : g[pos]) {
                    if (next == t && dist % 3 == 0) {
                        PRINT("From {} to {}, dist={}\n", pos, next, dist);
                        return dist / 3;
                    }
                    if (!visited[next][dist % 3]) {
                        q.push(next);
                        visited[next][dist % 3] = true;
                    }
                }
            }
        }
        return -1;
    }

private:

};

int solve() {
    Solution solution;
    // handle IO here
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> edges;
    for (int i = 0; i < M; ++i) {
        edges.emplace_back();
        cin >> edges.back().first >> edges.back().second;
    }
    int s, t;
    cin >> s >> t;
    cout << solution.hopscotch_addict(N, edges, s, t);
    return 0;
}

} // anonymous namespace

#ifdef OJ_MISC_OFFLINE

#include "epilog.h"

#else

int main() {
    return solve();
}

#endif


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

int main(){
	ll n, m;
	cin>>n>>m;
	vector<vector<char>> grid(n, vector<char>(m));
	ll i, j;
	ll mod = 1e9+7;
	for(i=0;i<n;i++){
		for(j=0;j<m;j++)
			cin>>grid[i][j];
	}
	vector<vector<ll>> dp(n, vector<ll>(m));
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			if(grid[i][j]=='#')
				dp[i][j]=0;
			else{
				if(i==0 && j==0)
					dp[i][j] = 1;
				else if(i==0)
					dp[i][j] = dp[i][j-1];
				else if(j==0)
					dp[i][j] = dp[i-1][j];
				else
					dp[i][j] = (dp[i-1][j]%mod + dp[i][j-1]%mod)%mod;
			}
		}
	}
	cout<<dp[n-1][m-1]<<"\n";
	return 0;
}

Measured memory_bytes: 12176
use whiteread::parse_line;

fn main() {
    let (n, k): (i64, i64) = parse_line().unwrap();
    let mut pro: f64 = 0.0;
    let mut i: i64 = 1;

    while i <= n {
        let mut j: i64 = i;
        let mut t: i64 = n;
        while j < k {
            j = j * 2;
            t = t * 2;
        }
        pro = pro + (1.0/(t as f64));
        i = i + 1;
    }

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


Measured memory_bytes: 2136
#include<functional>
#include<algorithm>
#include<iterator>
#include<cstring>
#include<cstdlib>
#include<cstdio>
using namespace std;
long long f[555][66][555];
int a[11],la[66];
long long dp(int n,int m)
{
	f[0][0][a[n]]=1;
	for(int i=0;i<1<<n;++i)
	{
		la[i]=0;
		for(int j=n;j--;)
			if(i&1<<j)la[i]=a[j];
	}
	for(int i=0;i<m;++i)
		for(int j=0;j<1<<n;++j)
			for(int k=0;k<1<<n;++k)if(!(j&k))
				for(int l=0;l<m;++l)if(la[k]-1>=0||l-1>=0)
					f[i+1][j|k][max(la[k]-1,l-1)]+=f[i][j][l];
	long long res=0;
	for(int i=0;i<m;++i)res+=f[m][(1<<n)-1][i];
	return res;
}
long long y[11];
int main()
{
	int n,c;
	int l[11];
	scanf("%d%d",&n,&c);
	for(int i=0;i<n;++i)scanf("%d",&l[i]);
	sort(l,l+n);
	for(int r=1;r<=n;++r)
	{
		for(int i=0;i<n;++i)a[i]=l[i]*r;
		memset(f,0,sizeof(f));
		y[r]=dp(n-1,c*r);
	}
	for(int i=n;i;--i)
	{
		for(int j=1;j<i;++j)
			y[j]=y[j+1]-y[j];
	}
	long long fa=1;
	for(int i=1;i<n;++i)fa=fa*i*c;
	printf("%.16lf\n",1.0*y[1]/fa);
	return 0;
}

Measured memory_bytes: 158976
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main {

	/* several useful subroutines */
	private static final BigDecimal BD1000000007 = new BigDecimal(1000000007);
	private static BufferedReader brStdin = new BufferedReader(new InputStreamReader(System.in));
	private static String[] readBuf = null;
	private static int readPtr = 0;
	private static String getString() throws IOException {
		while ( readBuf == null || readPtr >= readBuf.length ) {
			readBuf = brStdin.readLine().split(" ");
			readPtr = 0;
		}
		return readBuf[readPtr++];
	}
	private static int getInt() throws IOException {
		return Integer.parseInt(getString());
	}
	private static long getLong() throws IOException {
		return Long.parseLong(getString());
	}
	private static BigDecimal getBD() throws IOException {
		return new BigDecimal(getString());
	}
	@SuppressWarnings("unused")
	private static String[] getStringArray(int size) throws IOException {
		String stringArray[] = new String[size];
		for (int i = 0; i < stringArray.length; i++) {
			stringArray[i] = getString();
		}
		return stringArray;
	}
	@SuppressWarnings("unused")
	private static int[] getIntArray(int size) throws IOException {
		int intArray[] = new int[size];
		for (int i = 0; i < intArray.length; i++) {
			intArray[i] = getInt();
		}
		return intArray;
	}
	@SuppressWarnings("unused")
	private static long[] getLongArray(int size) throws IOException {
		long longArray[] = new long[size];
		for (int i = 0; i < longArray.length; i++) {
			longArray[i] = getLong();
		}
		return longArray;
	}
	@SuppressWarnings("unused")
	private static BigDecimal[] getBDArray(int size) throws IOException {
		BigDecimal bdArray[] = new BigDecimal[size];
		for (int i = 0; i < bdArray.length; i++) {
			bdArray[i] = getBD();
		}
		return bdArray;
	}
	private static BigDecimal mod1000000007(BigDecimal bd) {
		return bd.subtract(BD1000000007.multiply(bd.divide(BD1000000007, BigDecimal.ROUND_DOWN))) ;
	}
	@SuppressWarnings("unused")
	private static BigDecimal mod1000000007(int i) {
		return mod1000000007(new BigDecimal(i)) ;
	}
	@SuppressWarnings("unused")
	private static BigDecimal mod1000000007(long l) {
		return mod1000000007(new BigDecimal(l)) ;
	}

	
	/* main routine */
	public static void main(String args[]) throws IOException {
		int n = getInt();
		int a[] = getIntArray(n);
		int b[] = getIntArray(n);
		int c[] = getIntArray(n-1);

		int s = 0;
		for ( int i = 0 ; i < n ; i++ ) {
			if ( i>0 && a[i] == a[i-1]+1 ) {
				s += c[a[i-1]-1];
			}
			s += b[a[i]-1];
		}
		System.out.println(s);
	}
}


Measured memory_bytes: 21332
N, M = map(int, input().split())
am = [int(input()) for i in range(M)]
safe = [True]*(N+1)
for i in am:
    safe[i] = False
dp = [0]*(N+1)
dp[0]=1
for i in range(N):
    if safe[i+1]:
        dp[i+1] += dp[i]
    if i+2<=N:
        if safe[i+2]:
            dp[i+2] += dp[i]
print(dp[N]%(10**9+7))

Measured memory_bytes: 469624
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var a, b, x int
	con.Scan(&a, &b, &x)
	p := 0
	if a > 0 {
		p = (a-1)/x + 1
	}
	q := b/x + 1
	con.Println(q - p)
	return nil
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int W=sc.nextInt();
    int H=sc.nextInt();
    int x=sc.nextInt();
    int y=sc.nextInt();
    int r=sc.nextInt();
    if(x+r>W || x-r<0 || y+r>H || y-r<0){
      System.out.println("No");
    }else{
      System.out.println("Yes");
    }
  }
}



Measured memory_bytes: 26224
from math import *

a,v=[int(x) for x in input().split()]
b,w=[int(x) for x in input().split()]
t=int(input())

if (v-w)>0:
	tm=(abs(b-a))/(v-w)
	if tm<=t:
		print("YES")
	else:
		print("NO")
else:
	print("NO")

Measured memory_bytes: 9056
import sys
N = list(input())
M = list(input())

N.sort()
M.sort(reverse = True)

if(len(N) < len(M)):
    for i in range(len(N)):
        if(M[i] > N[i]):
            print("Yes")
            sys.exit()
        elif(M[i] == N[i]):
            continue
        else:
            print("No")
            sys.exit()
    print("Yes")

if(len(N) >= len(M)):
    for i in range(len(M)):
        if(M[i] > N[i]):
            print("Yes")
            sys.exit()
        elif(M[i] == N[i]):
            continue
        else:
            print("No")
            sys.exit()
    print("No")


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

int main() {
  int n, m;
  cin >> n >> m;
  int a[m+1], dp[n+1];
  for ( int i = 0; i < m; i++ ) {
    cin >> a[i];
    dp[a[i]] = 0;
  }
  a[m] = 100001;

  int ch = 0;
  dp[0] = 1;
  if ( a[0] == 1 ) {
    dp[1] = 0; ch++;
  } else {
    dp[1] = 1;
  }
  for ( int i = 2; i <= n; i++ ) {
    if ( a[ch] == i ) { ch++; continue; }
    dp[i] = dp[i-1] + dp[i-2];
    dp[i] %= 1000000007;
  }

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

Measured memory_bytes: 1024
//1W153021 KOYA IWASE
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct LIST{//?§????????????£?¨?
  struct LIST *prev;//??????????´??????????????????????
  struct LIST *next;//??????????´??????????????????????
  int key;
};

struct LIST *list;//???????????????????????????
void insert(int x);//?????¨????????¢??°?????£?¨?
void delete(int x);
void deleteFirst();
void deleteLast();
void printList();

int main(void){
  list=(struct LIST *)malloc(sizeof(struct LIST));//?????¢????¢????
  list->next=list;//?????????????´???????????????????????????????
  list->prev=list;
  int key,N;
  char comm[20];
  scanf("%d",&N);//????????°????????????
  for(int i=0;i<N;i++){//?????????????????????
    scanf("%s%d",comm,&key);
    if(comm[0]=='i'){//insert
      insert(key);
    }else{
      if(strlen(comm)>6){
        if(comm[6]=='F'){//deleteFirst
          deleteFirst();
        }else if(comm[6]=='L'){//deleteLast
          deleteLast();
        }
      }else{//delete
        delete(key);
      }
    }
  }
  printList();
  return 0;
}

void insert(int x){//????????¨?¬????????´????????????¢????????????????´?????????\??????
  struct LIST *y = (struct LIST *)malloc(sizeof(struct LIST));//?????\??????????????°????????????????¢????
    y->key = x;
    y->next = list->next;
    list->next->prev = y;
    list->next = y;
    y->prev = list;
}

void delete(int x){//????????????key?????????
  struct LIST *i = list->next;//list????¬????????´?????????????????±?????????????
  while(i != list && i->key != x ) {//???????????????key??¨?????´??????????´??????¢???
      i = i ->next;
    }
  if(i==list)return;//???????????????????????????????????£?????´??????i???list??????????????????????????£??????????????§?????????????????¢??°?????????
  i->prev->next=i->next;
  i->next->prev=i->prev;
  free(i);//?????¢???????§£???
}

void deleteFirst(){
  struct LIST *t = list->next;//list????¬????????´?????????????????????????????´??????????
  if(t==list)return;//list->next=list?????????????´???????????????§?????????????????¢??°?????????
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);//?????¢???????§£???
}

void deleteLast(){
  struct LIST *t = list->prev;//list??????????????????????????????????´??????????
  if(t==list)return;//?????????????§????????????????????´???????????????§??¢??°?????????
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);//?????¢???????§£???
}

void printList(){//????????????????´??????????
  struct LIST *i;
  i = list->next;//??????????¬????????????????????´?
  int j = 0;
  while(1) {
    if (i == list) break;//i=list?????´??????????´????????????????????????????????????????????????????
    if(j++ > 0) printf(" ");//?????????????????????????????????????????????????????§???????????????
    printf("%d", i->key);//key?????????
    i = i->next;//?¬????????´????
  }
  printf("\n");
}

Measured memory_bytes: 32992
#include <iostream>
using namespace std;
int main() {
    string s; cin >> s;
    for (char a = 'a'; a <= 'z'; a++) {
        for (int i = 0; i < s.size(); i++) {
            if (a == s[i]) break;
            else {
                if (i == s.size() - 1) { cout << a << endl; return 0; }
            }
        }
    }
    puts("None");
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long x = Long.parseLong(sc.next());
    long y = Long.parseLong(sc.next());
    int ans = 0;
    while(x <= y) {
      ans++;
      x *= 2;
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 23124
K = int(input())
lunlun = [n for n in range(10)]
if K < 10:
    print(K)
else:
    tmp = 9
    pre_top = 1
    pre_bottom = 9
    while(1):
        for j in range(pre_top, pre_bottom+1):
            for k in range(10):
                if abs(lunlun[j]%10 - k) < 2:
                    lunlun.append(lunlun[j]*10+k)
                    tmp += 1
                    if tmp == K:
                        break
            if tmp == K:
                break
        pre_top = pre_bottom + 1
        pre_bottom = tmp
        if tmp == K:
            break

    print(lunlun[-1])

Measured memory_bytes: 7320
#include <iostream>
using namespace std;
using ll = long long;

const ll M = 1e9 + 7;
ll n, a[200005], b[200005], d[200005], s[200005];

int main() {
    scanf("%lld", &n);
    s[0] = d[0] = 1;
    for(ll i = 1; i <= n; i++) {
        scanf("%lld", &a[i]);
        if(b[a[i]] > 0 && b[a[i]] < i - 1) {
            d[i] = s[b[a[i]]];
        }
        s[i] = s[i - 1] + d[i];
        s[i] %= M;
        b[a[i]] = i;
    }
    cout<<s[n]<<endl;
    return 0;
}

Measured memory_bytes: 6528
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/

int main()
{
	ll a, b, c, d, e, f;
	ll sum = 0;
	ll water = 0;
	ll sugar = 0;
	double maxnoudo = 0;
	ll anssugar = 0;
	ll anssum = 0;


	cin >> a >> b >> c >> d >> e >> f;

	ll tempwater = 0;
	ll tempsuger = 0;
	for (int anum = 0; anum <= 300; anum++) {
		tempwater = 0;
		if (anum * a * 100 > f) break;
		for (int bnum = 0; bnum <= 300; bnum++) {
			tempwater = anum*a * 100 + bnum*b * 100;
			if (tempwater > f || anum+bnum==0) {
				break;
			}
			else {
				for (int cnum = 0; cnum <= 3000; cnum++) {
					tempsuger = cnum*c;
					if (tempsuger > tempwater / 100 * e || tempwater + cnum*c > f) {
						break;
					}
					else {
						for (int dnum = 0; dnum <= 3000; dnum++) {
							tempsuger = cnum*c + dnum*d;
							if (tempsuger > tempwater / 100 * e || tempwater + tempsuger> f) {
								break;
							}
							else {
								if (double(100 * tempsuger /double(tempwater+tempsuger))> maxnoudo) {
									maxnoudo = double(100 * tempsuger / double(tempwater+tempsuger));
									anssum = tempwater + tempsuger;
									anssugar = tempsuger;
								}

							}

						}

					}

				}

			}
		}
	}

	if (anssum == 0) {
		anssum = a * 100;
	}

	cout << anssum << " " << anssugar;


	return 0;
}

Measured memory_bytes: 256
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#define ll long long
using namespace std;



int main(){
  ll N,A,B,train,tax;
  cin>>N>>A>>B;
  train=A*N;
  tax=B;
  cout<<min(train,tax)<<endl;

  return 0;
}



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

#define debug(a) cerr << #a << " = " << (a) << endl; 
#define get(t, i) get<(i)>((t))
#define fst first
#define snd second

template<typename T> ostream& operator<<(ostream& o, const vector<T>& v) {
  int b = 0; for (const auto& a : v) o << (b++ ? " " : "") << a; return o;
}

template<typename T, typename U> ostream& operator<<(ostream& o, const pair<T, U>& p) {
  o << p.fst << ' ' << p.snd; return o;
}

typedef long double ld;
int n;
vector<ld> A;
ld dp[3000][3000];
int v[3000][3000];

ld f(int i, int x) {
  if (i == n) return x > n/2;
  if (x > n/2) return 1;

  ld& z = dp[i][x];
  if (v[i][x]) return z;

  v[i][x] = 1;
  z = A[i] * f(i+1, x+1) + (1 - A[i]) * f(i+1, x);
  return z;
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  cin >> n;
  A.assign(n, 0);
  for (auto& a : A) cin >> a;

  cout << setprecision(18) << f(0, 0) << endl;
}



Measured memory_bytes: 174336
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;

int main()
{
  int N;
  cin >> N;
  while(N-- > 0)
    {
      int n;
      cin >> n;
      int dp[n][n];
      vector<int> vec(n);
      for(int i=0;i<n;i++)
	{
	  cin >> vec[i];
	  for(int j=0;j<n;j++)
	    dp[i][j] = 0;
	}

      int mex = 0;
      for(int i=0;i<n;i++)
	dp[i][(i+1)%n] = abs(vec[i]-vec[(i+1)%n]),mex = max(mex,dp[i][(i+1)%n]);

      for(int i=2;i<n;i++)//幅
	{
	  for(int j=0;j<n;j++)//index
	    {
	      for(int k=j;k<=j+i-1;k++)//中間地点
		{
		  if(k == j)
		    {
		      dp[j][(j+i)%n] = max(dp[j][(j+i)%n],dp[j][(j+i-1)%n]+abs(vec[j]-vec[(j+i)%n]));
		      mex = max(mex,dp[j][(j+i)%n]);
		      continue;
		    }
		  dp[j][(j+i)%n] = max(dp[j][(j+i)%n],
				       dp[k%n][(j+i)%n]+dp[j][k%n]);
		}
	      mex = max(mex,dp[j][(j+i)%n]);
	    }
	}

      cout << mex << endl;


    }
  return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
using namespace std;
int n,m,x,a[101][101],mi=0x3f3f3f3f,b[100001],c[1000001];
void dfs(int dep,int sum)
{
	if(dep==n+1)
	{
		for(int i=1;i<=m;i++)
		{
			if(b[i]<x)
				return;
		}
		mi=min(mi,sum);
		return;
	}
	for(int i=1;i<=m;i++)b[i]+=a[dep][i];
	dfs(dep+1,sum+c[dep]);
	for(int i=1;i<=m;i++)b[i]-=a[dep][i];
	dfs(dep+1,sum);
}
int main()
{
	cin>>n>>m>>x;
	for(int i=1;i<=n;i++)
	{
		cin>>c[i];
		for(int j=1;j<=m;j++)
			cin>>a[i][j];	
	}
	dfs(1,0);
	if(mi>=0x3f3f3f3f)cout<<"-1";
	else cout<<mi;
}

Measured memory_bytes: 3604
# frozen_string_literal: true

n = gets.to_i
a = gets.split.map(&:to_i)
sum = 0

MOD = 10**9 + 7
60.times do |b|
  count = 0
  x = 2**b
  n.times do |i|
    count += 1 if (a[i] & x).zero?
  end
  sum += count * (n - count) * x
end

puts sum % MOD


Measured memory_bytes: 36868