akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int INF=1e9;
const int MOD=1e9+7;
typedef pair<int,int> pii;
template<typename A,size_t N,typename T>
void Fill(A (&array)[N],const T &val)
{
    std::fill( (T*)array,(T*)(array+N),val );
}

int main(void)
{

    int N;
    cin >> N;
    vector<pii> testimony[20];
    for(int i=1;i<=N;i++)
    {
        int a;
        cin >> a;
        for(int j=0;j<a;j++)
        {
            int x,y;
            cin >> x >> y;
            testimony[i].push_back(make_pair(x-1,y));
        }
    }
    int ans=0;
    for(int i=0;i<(1<<N);i++)
    {
        int tmp=0;
        bool clear=true;
        for(int j=0;j<N;j++)
        {
            if(i&(1<<j))
            {
                for(int k=0;k<int(testimony[j+1].size());k++)
                {
                    if(testimony[j+1][k].second==1)
                    {
                        if(!(i&(1<<testimony[j+1][k].first))) clear=false;
                    }
                    else
                    {
                        if((i&(1<<testimony[j+1][k].first))) clear=false;
                    }
                }
                tmp++;
            }
        }
        if(clear) ans=max(ans,tmp);
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
# coding: utf-8
# Here your code !

while 1 :
    try:
        h,w=map(int,input().split())
        #print(h,w)
        if( h==0 and w==0 ): 
            break
        else:
            for hi in range(h):
                out=""
                if (hi==0 or hi==h-1):
                    out+="#"*w
                else :
                    for wi in range(w):
                        if(wi==0 or wi==w-1): out+="#"
                        else: out+="."
                print(out)
            print()
        if( h==0 and w==0 ): break
    except (EOFError):
        #print("EOFError")
        break

Measured memory_bytes: 7516
N = int(input())
A = [0]*(N)
B = list(map(int, input().split()))
# print("A",A,"B",B)
# print(N)

output=0

for i in range(N):
   # print("i",i)
   if (i==0):
      A[i]=B[i]
   elif(i==N-1):
      # print("last",B[i-1])
      A[i]=B[i-1]
   else:
      if(B[i-1]<=B[i]):
         A[i]=B[i-1]
      else:
         A[i]=B[i]


# print("A:",A,"B:",B)
print(sum(A))





Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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 S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N;
std::string S[2];

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

  rep( i, 2 )
    std::cin >> S[i];

  rep( i, 2*N ) {
    std::cout << S[i%2][i/2];
  }

  std::cout << endl;

  return 0;
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)


void func(long long D, long long N){

    lli base = 1;
    REP(i,0,D)base*=100;

    if(N!=100)cout<<N*base<<endl;
    else{
        cout<<(N+1)*base<<endl;
    }

}

int main(){
    // cout << fixed << setprecision(5);

    long long D;
    scanf("%lld",&D);
    long long N;
    scanf("%lld",&N);
    func(D, N);
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getkeys(m map[int]int) (m1k, m2k int) {
	max1v, max2v := 0, 0
	for k, v := range m {
		if v > max1v {
			max1v = v
			m1k = k
		} else if v > max2v {
			max2v = v
			m2k = k
		}
	}
	return m1k, m2k
}
func check(a []int, m0v, m2v int) (r int) {
	for i := 0; i < len(a); i++ {
		if i%2 == 0 && a[i] != m0v {
			r++
		} else if i%2 == 1 && a[i] != m2v {
			r++
		}
	}
	return r
}

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := range a {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
	}
	m := make([]map[int]int, 2)
	m[0] = make(map[int]int, 0)
	m[1] = make(map[int]int, 0)
	for j := 0; j < n; j++ {
		if j%2 == 0 {
			m[0][a[j]]++
		} else {
			m[1][a[j]]++
		}
	}
	m0k1, m0k2 := getkeys(m[0])
	m2k1, m2k2 := getkeys(m[1])
	var ans int
	if m0k1 != m2k1 {
		ans = check(a, m0k1, m2k1)
	} else {
		// m0をm0k1, m2をm2k2にした場合と, m0をm0k2, m2をm2k1にした場合の小さい方をとる
		ans = min(check(a, m0k1, m2k2), check(a, m0k2, m2k1))
	}
	fmt.Println(ans)
}
func min(a, b int) int {
	if a >= b {
		return b
	}
	return a
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
// typedef long long LL;
// typedef unsigned long long UL;
// typedef pair<int, int> P;
// typedef pair<int, P> PPI;
// typedef pair<LL, LL> PL;
// typedef long long LL;
// // LLONG_MIN, INT_MIN
// #define xx first
// #define yy second
// const LL INF = 1000000000;
#define RG register int
#define LL long long
struct edge
{
    LL to, cost;
    edge(int a, int b):to(a), cost(b){}
};

void debug(vector<int>& db){
  for(auto x:db)
    cout<<x<<" ";
  cout<<endl;
}
LL mod = 1000000007;
vector<int> G[210000];
LL ps[210000];
vector<LL> st(210000, 1);
LL son[210000];
LL ans[210000];

LL pmod(LL x, LL k, LL m=mod){
  LL re = 1;
  LL now = 1;
  while(k){
    if(k&1)re *= x;
    k>>=1;
    x = (x*x)%m;
    re %= mod;
  }
  return re;
}

LL inv(LL a){
  // if(a==0)return 1;
  return pmod(a, mod-2);
}

void dfs(int p, int from = -1){
  son[p] = 1;
  for(auto adj: G[p]){
    if(adj==from)continue;
    dfs(adj, p);
    son[p]+=son[adj];
  }
  st[p] *= ps[son[p]-1];
  for(auto adj: G[p]){
    if(adj==from)continue;
    st[p] *= inv(ps[son[adj]]);
    st[p] %= mod;
    st[p] *= st[adj];
    st[p] %= mod;
  }
}

void reroot(int p, int from = -1){
  ans[p] = st[p];
  for(auto adj: G[p]){
    if(adj==from)continue;
    LL or_stp=st[p], or_stadj = st[adj];
    LL diffp = (ps[son[p]-1] * inv(ps[son[p]-1-son[adj]]))%mod;
    st[p] = (st[p] * inv(diffp))%mod;
    st[p] = (st[p] * ps[son[adj]])%mod;
    st[p] = (st[p] * inv(st[adj]))%mod;

    diffp = (ps[son[p]-1] * inv(ps[son[adj]-1]))%mod;
    st[adj] = (st[adj]*diffp)%mod;
    st[adj] = (st[adj]*st[p])%mod;
    st[adj] = (st[adj]*inv(ps[son[p]-son[adj]]))%mod;

    son[p] -= son[adj];
    son[adj] += son[p];
    reroot(adj, p);
    son[adj] -= son[p];
    son[p] += son[adj];
    st[p] = or_stp;
    st[adj] = or_stadj;
  }


}
int main()
{
    //freopen("input", "r", stdin);
    //freopen("output", "w", stdout);
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int n;
    cin>>n;
    for(int i=0;i<n-1;i++){
      int a,b;
      cin>>a>>b;
      G[a].push_back(b);
      G[b].push_back(a);
    }
    ps[0] =  1;
    for(LL i=1;i<210000;i++)
      ps[i] = (ps[i-1]*i)%mod;
    dfs(1);
    reroot(1);
    for(int i=1;i<=n;i++)
      cout<<ans[i]<<endl;
}


Measured memory_bytes: 20724
def f(n):
  D={}
  A=[]
  for _ in range(n):
    a,b,c=map(int,raw_input().split(' '))
    if D.has_key(a): D[a]+=b*c
    else:
      D[a]=b*c
      A.append(a)
  B=[i for i in A if D[i]>=1e6]
  if B==[]: B=["NA"]
  return B

while 1:
  n=input()
  if n==0:break
  x=f(n)
  for e in x: print e

Measured memory_bytes: 4360
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int n;
int bit_counter(int n){
    int ans=0;
    while(n>0){
        if(n&1) ans++;
        n=(n>>1);
    }
    return  ans;
}
int main(){
    cin>>n;
    int aa[n][n];
    rep(i,n)rep(j,n) aa[i][j]=-1;
    rep(i,n){
        int m;
        cin>>m;
        rep(j,m){
            int x,y;
            cin>>x>>y;
            x--;
            aa[i][x]=y;
            //cout<<"a["<<i<<"]"<<"["<<x<<"]"<<"="<<y<<endl;
        }
    }
    rep(i,n){
        //rep(j,n) cout<<aa[i][j]<<" ";
        //cout<<endl;
    }
    int ans=0;
    //cout<<(1<<n)<<endl;
    //cout<<"next"<<endl;
    rep(i,(1<<n)){
        bool ok = true;
        //cout<<"wariate"<<i<<endl;
        vector<int> aaaa(n,0);
        rep(j,n){
            if((i>>j)&1){
                aaaa[j]=1;
            }
        }
        rep(j,n){
            if((i>>j)&1){//j番目は正直もの
                //jについて,証言と照らし合わせる
               //cout<<j<<"is honest"<<endl;
                rep(k,n){
                    //cout<<k<<" "<<aa[j][k]<<" "<<(i>>k)<<endl;
                    if(j==k) continue;
                    if(aa[j][k]==-1) continue;
                    if(aa[j][k]!=aaaa[k]){
                        //cout<<"out"<<endl;
                        ok = false;
                    }
                }
            }
        }
        if(ok){
            //cout<<"collect No is "<<i<<endl;
            //cout<<bit_counter(i)<<endl;
        }
        if(ok ) ans = max(ans,bit_counter(i));
        //cout<<endl<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef long long ll;

int main(void){
    char s[4];
    scanf("%s",s);
    int cnt = 0;
    for(int i = 0; i < 4; i++){
        if(s[i] == 'o') cnt++;
    }
    printf("%d\n",700+cnt*100);
}

Measured memory_bytes: 128
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
h,w = inp
t = []
h.times{t << gets.chomp.split("")}
ngh = na(h,false)
ngw = na(h,false)
h.times do |i|
  ngh[i] = true unless(t[i].include?("#"))
end
tz = copy(t.transpose)
w.times do |i|
  ngw[i] = true unless(tz[i].include?("#"))
end
(h).times do |i|
  next if(ngh[i])
  w.times do |j|
    print t[i][j] unless(ngw[j])
  end
  puts
end

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  if(a==0)
  cout<<1<<endl;
  else if(b==0)
    cout<<2<<endl;
  else if(c==0)
    cout<<3<<endl;
  else if(d==0)
    cout<<4<<endl;
  else if(e==0)
    cout<<5<<endl;
  return 0;
 }

Measured memory_bytes: 3460
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>
 
using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
typedef long long int ll;

int main(){
    int n ;
    int c0=0 , c1=0, c2=0, c3=0;
    cin >> n ;
    for (int i=1 ; i <= n; i ++){
        string s;
        cin >> s;
        if (s == "AC"){c0 = c0 +1;}
        else if (s == "WA"){c1 = c1 +1;}
        else if (s == "TLE"){c2 = c2 +1;}
        else{c3 = c3 + 1;}
    }
    cout << "AC x "<<c0 << endl;   
    cout << "WA x "<<c1 << endl;
    cout << "TLE x "<<c2 << endl;
    cout << "RE x "<<c3 << endl;
}

Measured memory_bytes: 3636
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int d;
    cin>>d;
    if(d==22)   cout<<"Christmas Eve Eve Eve"<<endl;
    else if(d==23) cout<<"Christmas Eve Eve"<<endl;
    else if(d==24)  cout<<"Christmas Eve"<<endl;
    else if(d==25)  cout<<"Christmas"<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<limits.h>
using namespace std;

int main(){
  
  int a,b; cin >> a >> b;
  
  if (a >= 13) cout << b << endl;
  else if (a >= 6) cout << b/2 << endl;
  else cout << 0 << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n,mi=10000000,ma=-10000000;
	long long sum=0;
	cin >> n;
	int i,b;
	for(i=0;i<n;i++){
		cin >> b;
		mi=min(mi,b);
		ma=max(ma,b);
		sum+=b;
	}
	cout << mi << " " << ma << " " << sum << endl;
	return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[205];
map<ll,int>mp;
int main()
{
	
	ll x;cin>>x;
	for(ll i=1;i<=120;i++)
	{
		ll s=pow(i,5);
		mp[s]++;
		mp[-s]++;
	}
	for(ll i=0;i<=120;i++)
	{
		ll s=x+pow(i,5);
		if(mp.count(s))
		{
			ll a=pow(s,1.0/5);
			cout<<a<<" "<<i;
			return 0;
		}
		s=x-pow(i,5);
		if(mp.count(s))
		{
			ll a=pow(s,1.0/5);
			cout<<a<<" "<<-i;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 4092
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll n,t;
    cin >> n >> t;
    ll a[n];
    rp(i,n) cin >> a[i];
    ll sum = 0;
    ll curR=0;
    rp(i,n){
        if(curR > a[i]){
            sum += t - (curR - a[i]);
        }
        else sum += t;
        curR = a[i]+t;
    }
    cout << sum << endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 1792
import java.util.*;
import java.util.Map.Entry;
 
 

class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
       String ans="APPROVED";
       
       long[] a = new long[(int)N];
       for (int i=0 ; i<N; i++) {
           a[i] = sc.nextLong();
       }
       
       for (int i=0 ; i<N; i++) {
    	   if(a[i]%2==0) {
    		   if(a[i]%3!=0&&a[i]%5!=0) {
    		       ans="DENIED";
   			   
    		   }
    	   }
       }
       
       System.out.println(ans); 	
              		
   }

}

Measured memory_bytes: 23764
N=int(input())
H=list(map(int,input().split()))
ans = 0
ok = 0
for i in range(0,N-1):
  if H[i] >= H[i+1]:
    ok += 1
  else:
    ans = max(ok,ans)
    ok = 0
ans = max(ok,ans)
print(ans)

Measured memory_bytes: 63984
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

		int a = in.nextInt();
		int b = in.nextInt();
		int t = in.nextInt();

		int result = solve(a, b, t);
		System.out.println(result);

		in.close();

	}
	
	public static int solve(int a, int b, int t) {
		int result = 0;
		
		result = (int)(t / a) * b;
		
		return result;
	}

}

Measured memory_bytes: 23380
#include <iostream>
#include <vector>
#include <algorithm> 
using namespace std;
int n, t, ans=0; 
int main() 
{
    cin>>n>>t;
    vector<pair<int,int> > v(n);
    vector<int> F(t);
    for(int i=0;i<n;i++)	cin>>v[i].first>>v[i].second;
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++)
    {
        ans=max(ans,F.back()+v[i].second);
        for(int j=t-1;j>=v[i].first;j--)
            F[j]=max(F[j],F[j-v[i].first]+v[i].second);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX_N 2000
#define P 1000000007
using namespace std;
typedef long long lnt;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, m, d[MAX_N+5], f[MAX_N+5];
int fa[MAX_N+5][10], mx[MAX_N+5][10];
lnt S, X; vector <int> G[MAX_N+5], E[MAX_N+5];
struct edge {int u, v, c;} e[MAX_N+5]; bool mrk[MAX_N+5];
bool cmp(const edge &x, const edge &y) {return x.c < y.c;}
int getf(int x) {return f[x] == x ? x : f[x] = getf(f[x]);}
void insert(int u, int v, int c) {G[u].push_back(v), E[u].push_back(c);}
void addedge(int u, int v, int c) {insert(u, v, c), insert(v, u, c), S += c;}
lnt pw2(int k) {
	lnt x = 2, ret = 1;
	for (; k; k >>= 1, x = x*x%P)
		if (k&1) ret = ret*x%P;
	return ret;
}
void DFS(int u) {
	for (int i = 1; i <= 9; i++)
		fa[u][i] = fa[fa[u][i-1]][i-1], 
		mx[u][i] = max(mx[u][i-1], mx[fa[u][i-1]][i-1]);
	for (int i = 0, v; i < (int)G[u].size(); i++)
		if ((v = G[u][i]) ^ fa[u][0])
			d[v] = d[u]+1, fa[v][0] = u, mx[v][0] = E[u][i], DFS(v);
}
int LCA(int u, int v) {
	int ret = 0; if (d[u] < d[v]) swap(u, v);
	for (int i = 9; ~i; i--) if (d[u]-(1<<i) >= d[v])
		ret = max(ret, mx[u][i]), u = fa[u][i];
	if (u == v) return ret;
	for (int i = 9; ~i; i--) if (fa[u][i] ^ fa[v][i])
		ret = max(ret, max(mx[u][i], mx[v][i])), 
		u = fa[u][i], v = fa[v][i];
	return max(ret, max(mx[u][0], mx[v][0]));
}
int main() {
	read(n), read(m), read(X);
	for (int i = 1; i <= m; i++)
		read(e[i].u), read(e[i].v), read(e[i].c);
	sort(e+1, e+m+1, cmp);
	for (int i = 1; i <= n; i++) f[i] = i;
	for (int i = 1, u, v; i <= m; i++)
		if ((u = getf(e[i].u)) ^ (v = getf(e[i].v)))
			f[v] = u, mrk[i] = true, addedge(e[i].u, e[i].v, e[i].c);
	DFS(1);
	int low = 0, equ = 0, upp = 0;
	for (int i = 1, mxc; i <= m; i++) if (!mrk[i])
		mxc = LCA(e[i].u, e[i].v), 
		low += (S-mxc+e[i].c < X), 
		equ += (S-mxc+e[i].c == X), 
		upp += (S-mxc+e[i].c > X);
	lnt ans = 2LL*(pw2(equ)-1)*pw2(upp)%P; if (S > X) ans = 0;
	if (S == X) (ans += (pw2(n-1)-2+P)*pw2(m-n+1)%P) %= P;
	return printf("%lld\n", ans), 0;
}


Measured memory_bytes: 640
h, w = map(int, input().split())
s = []
for i in range(h):
    s += [input()]

dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]

ans = True
for i in range(h):
    for j in range(w):
        if (s[i][j] == '#'):
            found = False
            for k in range(4):
                i2 = i + dx[k]
                j2 = j + dy[k]
                if (0 <= i2 < h) and (0 <= j2 < w) and (s[i2][j2] == '#'):
                    found = True
            if not(found):
                ans = False

if ans:
    print('Yes')
else:
    print('No')

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

int main() {
    double a, b;
    cin >> a >> b;
    int aveInt;
    double aveDouble;

    aveInt = (a + b)/2;
    aveDouble = (a + b)/2;
    if (aveDouble - aveInt !=0){
        cout << aveInt + 1 << endl;
    } else {
        cout << aveInt << endl;
    }
}


Measured memory_bytes: 256
from bisect import bisect_left,bisect_right
import sys
def input(): return sys.stdin.readline().strip()

def main(bisect_left=bisect_left, bisect_right=bisect_right):
    n=int(input())
    ll=sorted(list(map(int,input().split())))
    c=0
    lll=len(ll)
    for i in range(lll-2):
        for j in range(i+1, lll-1):
            uk = bisect_left(ll, ll[i] + ll[j], j+1)
            lk = bisect_right(ll, abs(ll[j] - ll[i]), j+1, uk)
            c+=uk-lk
    print(c)

main()

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

int gcd(int x, int y){
    
    if(x%y==0){
        return y;
    }
    
    return gcd(y,x%y);
}

int main(){ 
    
    long x,y;
    cin >> x >> y;
    cout << x*y/gcd(x,y) << endl;
}


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

using namespace std;

int min(int a,int b);
int main(void)
{
	string nn; cin>>nn;
	int len = nn.size();
	int i;
	int n[len]; for(i = 0; i < len; i++) n[i] = (int)nn[i]-48;
	
	/*
	printf("\n\n\n");
	for(i = 0; i<len; i++){
		printf("i = %d, n[i] = %d\n",i,n[i]);
	}
	printf("\n\n\n\n");
	*/
	int dp[len][2];
	if(n[0] == 1){
		dp[0][0] = 1;
		dp[0][1] = 10;
	}
	else if(n[0] == 2){
		dp[0][0] = 2;
		dp[0][1] = 9;
	}
	else if(n[0] == 3){
		dp[0][0] = 3;
		dp[0][1] = 8;
	}
	else if(n[0] == 4){
		dp[0][0] = 4;
		dp[0][1] = 7;
	}
	else if(n[0] == 5){
		dp[0][0] = 5;
		dp[0][1] = 6;
	}
	else if(n[0] == 6){
		dp[0][0] = 6;
		dp[0][1] = 5;
	}
	else if(n[0] == 7){
		dp[0][0] = 7;
		dp[0][1] = 4;
	}
	else if(n[0] == 8){
		dp[0][0] = 8;
		dp[0][1] = 3;
	}
	else if(n[0] == 9){
		dp[0][0] = 9;
		dp[0][1] = 2;
	}
	for(i = 1; i < len; i++){
		dp[i][0] = min(dp[i-1][0],dp[i-1][1])+n[i];
		dp[i][1] = min(dp[i-1][0]+11-n[i],dp[i-1][1]+9-n[i]);
	}
	
	int ans = min(dp[len-1][0],dp[len-1][1]);
	//printf("len = %d\n",len);
	printf("%d\n",ans);
	//printf("dp[0][0] = %d, dp[0][1] = %d\n",dp[0][0],dp[0][1]);
 	return 0;
}

int min(int a,int b){
	if(a <= b) return a;
	else return b;
}



Measured memory_bytes: 13060
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int n,i,a,b,r=0,m,t;
    scanf("%d%d%d",&n,&a,&b);
    for(i=1;i<=n;i++){
        t=0;m=i;
        while(m){t+=m%10;m/=10;}
        if(a <= t && t <= b){r+=i;}
    }
    printf("%d\n",r);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

tuple<int,int,int> or_expr(const string& s, int pos);

tuple<int,int,int> term(const string& s, int pos) {
  if (s[pos] == '?') {
    return make_tuple(pos+1, 1, 1);
  } else {
    assert(s[pos] == '(');
    int np, f, t;
    tie(np, f, t) = or_expr(s, pos+1);
    assert(s[np] == ')');
    return make_tuple(np+1, f, t);
  }
}

tuple<int,int,int> and_expr(const string& s, int pos) {
  int np, f0, t0;
  tie(np, f0, t0) = term(s, pos);
  while (np < s.size() && s[np] == '&') {
    pos = np+1;
    int f1, t1;
    tie(np, f1, t1) = term(s, pos);
    f0 = min(f0, t0 + f1);
    t0 += t1;
  }
  return make_tuple(np, f0, t0);
}

tuple<int,int,int> or_expr(const string& s, int pos) {
  int np, f0, t0;
  tie(np, f0, t0) = and_expr(s, pos);
  while (np < s.size() && s[np] == '|') {
    pos = np+1;
    int f1, t1;
    tie(np, f1, t1) = and_expr(s, pos);
    t0 = min(t0, f0 + t1);
    f0 += f1;
  }
  return make_tuple(np, f0, t0);
}

pair<int,int> formula(const string& s) {
  int pos, f, t;
  tie(pos, f, t) = or_expr(s, 0);
  return make_pair(f, t);
}

int main()
{
  string s;
  cin>>s;
  auto res = formula(s);
  cout<<res.first<<' '<<res.second<<endl;
  return 0;
}



Measured memory_bytes: 3336
using System;

namespace _1_D
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			int h, m, s;
			var time = int.Parse (Console.ReadLine ());
			h = time / 3600;
			m = time % 3600 / 60;
			s = time % 3600 % 60;
			Console.WriteLine ("{0}:{1}:{2}", h, m, s);
		}
	}
}

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

const int MAX = 1000001; 

struct Query 
{ 
	int l, r, idx; 
}; 

bool cmp(Query x, Query y) 
{ 
	return x.r < y.r; 
} 

void update(int idx, int val, int bit[], int n) 
{ 
	for (; idx <= n; idx += idx&-idx) 
		bit[idx] += val; 
} 

int query(int idx, int bit[], int n) 
{ 
	int sum = 0; 
	for (; idx>0; idx-=idx&-idx) 
		sum += bit[idx]; 
	return sum; 
} 

void answeringQueries(int arr[], int n, Query queries[], int q) 
{ 
	int bit[n+1]; 
	memset(bit, 0, sizeof(bit)); 

	int last_visit[MAX]; 
	memset(last_visit, -1, sizeof(last_visit)); 

	int ans[q]; 
	int query_counter = 0; 
	for (int i=0; i<n; i++) 
	{ 

		if (last_visit[arr[i]] !=-1) 
			update (last_visit[arr[i]] + 1, -1, bit, n); 

		last_visit[arr[i]] = i; 
		update(i + 1, 1, bit, n); 

		while (query_counter < q && queries[query_counter].r == i) 
		{ 
			ans[queries[query_counter].idx] = 
					query(queries[query_counter].r + 1, bit, n)- 
					query(queries[query_counter].l, bit, n); 
			query_counter++; 
		} 
	} 

	for (int i=0; i<q; i++) 
		cout << ans[i] << endl; 
} 

int main() 
{ 
	int n,q;
	cin>>n>>q;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	Query queries[q];
	for(int i=0;i<q;i++){
		cin>>queries[i].l>>queries[i].r;
		queries[i].l-=1;
		queries[i].r-=1;
		queries[i].idx=i;
	} 
	sort(queries, queries+q, cmp); 
	answeringQueries(a, n, queries, q); 
	return 0; 
} 



Measured memory_bytes: 19288
#include <bits/stdc++.h>
#define int long long int
#define endl "\n"
using namespace std;
int countFreq(string &pat, string &txt) 
{ 
    int M = pat.length(); 
    int N = txt.length(); 
    int res = 0; 
    
    /* A loop to slide pat[] one by one */
    for (int i = 0; i <= N - M; i++) 
    {  
        /* For current index i, check for  
           pattern match */
        int j; 
        for (j = 0; j < M; j++) 
            if (txt[i+j] != pat[j]) 
                break; 
   
        // if pat[0...M-1] = txt[i, i+1, ...i+M-1] 
        if (j == M)   
        { 
           res++; 
           j = 0; 
        } 
    } 
    return res; 
} 
void solve()
{
	//Enter your code here Tanmay:)
	int n;
	string s="ABC",t;
	cin>>n>>t;
	cout<<countFreq(s,t);
}
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

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

#define rep(i, n)  for (int i = 0; i < (n) ; ++i)
#define mod 1000000007

using namespace std;
using ll=long long;

const int INF = 100000;

int main() {
    ll N, K;
    cin >> N >> K;
    ll res = 0, min, max;

    for (ll i = K; i <= N + 1; ++i) {
        min = (i - 1) * (i / 2) + (i % 2) * ((i - 1) / 2);
        max = (N + N - i + 1) * (i / 2) + (i % 2) * (N - (i / 2));

        res += (max - min + 1) % mod;
        res = res % mod;
    }

    cout << res;
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	ll a, b, c;
	cin >> a >> b >> c;
	
	ll cnt = c / a;
	
	cout << cnt * b << endl;

	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main(): 
    N=int(input())
    w=list(map(int, input().split()))
    allsum=sum(w)
    count=0
    min=allsum
    for i in range(N):
        count+=w[i]
        dis=abs(allsum-2*count)

        if min > dis:
            min = dis
    print(min)
if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
<?php
//$N = trim(fgets(STDIN));
list($A,$B) =  explode(" ",trim(fgets(STDIN)));
//$A =  explode(" ",trim(fgets(STDIN)));

printf("%d\n",lcm($A,$B));

function gcd($a,$b) {
  if ($b == 0) return $a;
  return gcd($b,$a%$b);
}
function lcm($a,$b) {
  $l = gcd($a,$b);
  return $a / $l * $b;
}

function prime_factors(int $n) {
    $i = 2;
    $factors = [];
    while ($i * $i <= $n) {
        if ($n % $i) $i += 1;
        else {
            $n /= $i;
            $factors[] = $i;
        }
    }
    if ($n > 1) $factors[] = $n;
    return $factors;
}
function is_prime(int $n) : bool {
    $r = true;
    if ($n < 2) $r = false;
    elseif ($n == 2 || $n == 3 || $n == 5) $r = true;
    elseif ($n & 1 == 0) $r = false;
    elseif ($n % 2 == 0 || $n % 3 == 0 || $n % 5 == 0) $r = false;
    else {
        $f = true;
        $v = 7;
        $m = intval($n ** 0.5) + 1;
        while ($v < $m) {
            if ($n % $v == 0) {
                $r = false;
                break;
            }
            $v += $f ? 4 : 2;
            $f = !$f;
        }
    }
    return $r;
}


Measured memory_bytes: 4728
#include<bits/stdc++.h>
#define endl "\n"
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

const int N=500001;
int i,j,n,q,l,r,ans[N],freq[N],cnt,ar[N],blc=1000;

struct node {
    int L,R,pos;
}Q[N];

bool cmp(node x, node y){
    if(x.L/blc!=y.L/blc)
        return x.L/blc<y.L/blc;
    return x.R<y.R;
}

int main()
{
    ios
    scanf("%d%d",&n,&q);
   // blc=sqrt(n);
    for(i=0;i<n;i++)  scanf("%d",&ar[i]);
    for(i=0;i<q;i++){
       scanf("%d%d",&Q[i].L,&Q[i].R);
        Q[i].L--; Q[i].R--;
        Q[i].pos=i;
    }
    sort(Q,Q+q,cmp);
    int start=0,end=0;
    for(i=0;i<q;i++){
        l=Q[i].L;
        r=Q[i].R;
        while(start<l){
          //  remove(start);
            freq[ar[start]]--;
            if(freq[ar[start]]==0) cnt--;
            start++;
        }
        while(start>l){
            //add(start-1);
            freq[ar[start-1]]++;
            if(freq[ar[start-1]]==1) cnt++;
            start--;
        }
        while(end<=r){
            //add(end);
            freq[ar[end]]++;
            if(freq[ar[end]]==1) cnt++;
            end++;
        }
        while(end>r+1){
            //remove(end-1);
            freq[ar[end-1]]--;
            if(freq[ar[end-1]]==0) cnt--;
            end--;
        }
        ans[Q[i].pos]=cnt;
    }
    for(i=0;i<q;i++){
         printf("%d\n",ans[i]);
    }
}




Measured memory_bytes: 15464
///AJoy Sarker ,CSE JAHANGIRNAGAR UNIVERSITY 48 Batch
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define pi 3.141592653589793
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define sz size()
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
const int inf = (int)1e9 + 5;
const ll linf = (ll)1e16 + 5;
const ll modd = (ll)1e9 + 7;
const int mod = 10000007;
/*#define N 20000009
bool prime[N];
vector<ll> prm;
void seive ()
{

    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {
        if (prime[i] == true)
        {
            prm.pb(i);
            for (ll j=i*i; j<=N; j += i)
                prime[j] = false;
        }
    }
}*/
void pr (int f)
{
    if(f==1)
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
map<int,int>mp;
multiset<string> st;
multiset<string> :: iterator it;

deque <char> q ;
int vis [1000];
int main()
{
    fast;

    ll n,av;
    cin >> n >> av;
    vector<ll> X(n);
    for(ll i=0; i<n; i++)
    {
    cin >> X[i];
        X[i] -= av;
    }

    map<ll, ll> M;
    for ( int i=0;i<n;i++)
    {
        map<ll,ll> tmp;
        for(auto p : M)
        {
            tmp[p.first + X[i]] += p.second;
            tmp[p.first] += p.second;
        }
        tmp[X[i]]++;
        swap(tmp,M);
    }

    cout << M[0] << endl;
}




Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>
using namespace std;
int main () {
  int x[3];
  cin >> x[0] >> x[1] >> x[2];
  sort(x, x+3);
  cout << x[0] << ' ' << x[1] << ' ' << x[2] << endl;
  return 0;
}

Measured memory_bytes: 3112
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int y=0;
    long long o=100,x;
    scanf("%lld",&x);
    while(o<x){
        o=(long long)(o*1.01);
        y++;
    }
    printf("%d",y);
    return 0;
}


Measured memory_bytes: 1724
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int a,b[1000000];
  b[0]=2;
  b[1]=1;
  cin>>a;
  for(int i=2;i<a+1;i++){
    b[i]=b[i-1]+b[i-2];
  }
  cout<<b[a]<<"\n";
  }

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }


int
main(void){  
  ll n, t;
  cin >> n >> t;
  ll a[n];
  ll a_max[n];
  ll a_min[n];
  int count = 0;
  REP(i, n){
    cin >> a[i];    
  }
  
  ll diff_m=0LL;
  ll temp_m;
  a_min[0] = a[0];
  FOR(i, 1, n) {
    a_min[i] = min(a_min[i-1], a[i]);
    temp_m = (a[i] - a_min[i-1]);
    if(temp_m > diff_m) {
      diff_m = temp_m;
      count = 1;
    }
    else if (temp_m == diff_m) {
      ++count;
    }
  }
 
  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 1792
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, S: str):
    print(len(S.split('ABC'))-1)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

int main(void)
{
    int N, M;
    cin >> N >> M;
    int singleWait = M * 1900 + (N - M) * 100;


    int result = (1 << M) * singleWait;

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 3608
#include<iostream>
using namespace std;
int main(){
 int A,B;
 cin>>A>>B;
 if(A+B>=A*B&&A+B>=A-B){
    cout<<A+B;
 }
 else if(A-B>=A+B&&A-B>=A*B){
    cout<<A-B;
 }
 else if(A*B>=A+B&&A*B>=A-B){
        cout<<A*B;
 }
return 0 ;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    int same = 0;
    for (int i = 0; i < N.length(); i++) {
      int d = N.charAt(i) - '0';
      same += d;
    }
    int lower = (N.charAt(0) - '0') - 1;
    lower += 9*(N.length()-1);
    System.out.println(Math.max(lower, same));
  }
}

Measured memory_bytes: 21844
N, M = map(int,input().split()) # 複数の数字を変数に格納
List = [list(map(int,input().split())) for i in range(M)] # [[1,2],[3,4],[5,6]]

result = str(10**(N-1))


for i in range(M):
    n = List[i][0]
    num = str(List[i][1])
    result = result[:n-1] + num + result[n:]

for i in range(M):
    for j in range(M):
        if List[i][0] == List[j][0]:
            if List[i][1] != List[j][1]:
                result = '-1'
    
if N != 1 and result[0] == '0':
    print(-1)
elif N == 1 and M == 0:
    print(0)
else:
    print(int(result))

Measured memory_bytes: 3064
#1_10_A
n = int(input())
MEMO = [None] * (n + 1)

def Fib(i):
    if i == 0 or i == 1:
        return 1
        
    if MEMO[i]:
        return MEMO[i]
    
    r =  Fib(i-1) + Fib(i-2)
    MEMO[i] = r
    return r
     
print(Fib(n))


Measured memory_bytes: 5600
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N, K; cin >> N >> K;
  vector<ll> a(N);
  rep(i,N) cin >> a[i];

  ll ans = 1e16;

  rep(i, (1 << N)){
    if(bitset<16>(i).count() != K or
    !bitset<16>(i).test(0) ) continue;

    ll cost = 0;
    ll h = a[0];
    // hはなるべき高さ
    rep(j ,N){
      if( bitset<16>(i).test(j) ){
        cost += max(h - a[j] , (ll)0);
        h = max(h + 1, a[j] + 1);
      }
      else h = max(h, a[j]);
    }
    // cout << i << " " << cost << endl;
    ans = min(ans , cost);
  }
  cout << ans << endl;
}


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

inline int func(int a){
  int r=0;
  while(a!=0){
  	r+=a%10;
    a/=10;
  }
  return r;
}
 
int main(){
  int n,a,b;
  int r=0;
  cin>>n>>a>>b;
  for(int i=0;i<=n;++i){
    int f=func(i);
  	if(a<=f&&f<=b){
      r+=i;
    }
  }
  cout<<r;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#define int long long
using namespace std;
int test[51];
signed main() {
    int n, a, b; string s;
    for (int h = 0; h < 9; h++) {
        cin >> s >> n >> a;
        cout << s << ' ' << n + a << ' ' << 200 * n + 300 * a << endl;
    }
}


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

int main() {
	int a[100000], b, c,o=0;
	cin >> b >> c;
	for (int i = 0; i < b; i++) {
		cin >> a[i];
		if (a[i] >= c)o++;
	}
	cout << o << endl;
		return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<cctype>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll a,b;
    cin >> a >> b;
    if(a!=1&&b!=1)cout<<(a*b)/2+(a*b)%2;else cout << 1;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    char c;
    cin >> c;
    if(c == 'a' || c == 'e' || c == 'o' || c == 'i' || c == 'u')
        cout << "vowel";
    else
        cout <<"consonant";
    cout << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);		
		int N = in.nextInt();
        String moji = "";
      
      int flag = 0;
      for(int i = 0;i < N;i++){
      	moji = in.next();
        if(moji.equals("Y")){flag=1;}
      }
        
      if(flag==1){System.out.print("Four");}
      else{System.out.print("Three");}

      }
	}

Measured memory_bytes: 23380
n=int(input())
a=[int(i) for i in input().split()]
iro=[0 for i in range(8)]
tyi=0
for i in range(n):
  if a[i]<3200:
    iro[int(a[i]/400)]=1
  else:
    tyi+=1
print(max(iro.count(1),1),iro.count(1)+tyi)

Measured memory_bytes: 3060
N = int(input())
a_i = list(map(int, input().split(" ")))
 
x = []
y = []
 
if N%2==0:
    for j in range(int(N/2)):
        x.append(max(a_i))
        a_i.remove(max(a_i))
        y.append(max(a_i))
        a_i.remove(max(a_i))
 
else:
    for j in range(int((N/2)+1)):
        x.append(max(a_i))
        a_i.remove(max(a_i))
        if a_i == []:
            break
        y.append(max(a_i))
        a_i.remove(max(a_i))
 
X = sum(x)
Y = sum(y)
 
 
if X >= Y:
    print(X - Y)
 
else:
    print(Y - X)

Measured memory_bytes: 3064
#include <cmath>
#include <iostream>
#include <string>
#include <time.h>
#include <stdio.h>
using namespace std;

int main()
{
    int x;
    for (int i = 1; i <= 10000; i++)
    {
        cin >> x;
        printf("Case %d: %d\n", i, x);
    }
}


Measured memory_bytes: 3024
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
    im=i
    count=[]
    for j in range(37):
        count.append(i%10)
        i=i//10
    csum=sum(count)
    if a<=csum and csum<=b:
        #print(csum)
        ans+=im
print(ans)

Measured memory_bytes: 3060
package main

import(
    "fmt"
    "math"
)

func main() {
    var n int
    fmt.Scan(&n)
    if isPrime2(n) {
        fmt.Println(n-1)
        return
    }
    for i:= int(math.Sqrt(float64(n)));i > 0;i-- {
        if n % i == 0 {
            fmt.Println(i+n/i-2)
            return
        }
    }
}

func isPrime2(x int) bool {
    if x == 1 {
        return false
    }
    if x == 2 {
        return true
    }
    if x%2 == 0 {
        return false
    }

    b := true
    rootx := int(math.Sqrt(float64(x)))
    i := 3
    for i <= rootx {
        if x%i == 0 {
            b = false
            break
        }
        i += 2
    }
    return b
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String C = sc.next();
        byte[] byteC = C.getBytes();
        byteC[0]++;
        String nextC = new String(byteC);
        
        System.out.println(nextC);
    }
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define brep(i,n) for(int i=n-1;i>=0;i--)
#define brep1(i,n) for(int i=n;i>=1;i--)
#define rep1(i,n) for(int i=1;i<n;i++)
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
#define ll long long

int main(void){
    int n;
    cin >> n;
    vector<string> str_list;
    rep(i,n){
        char input[10];
        cin >> input;
        sort(input,input+10);
        string str(input,10);
        str_list.emplace_back(str);
    }
    sort(str_list.begin(),str_list.end());
    ll ans = 0;
    ll count = 0;
    rep1(i,n){
        if(str_list[i] == str_list[i-1])count++;
        else{
            ans += (count+1)*count/2;
            count = 0;
        }
        if(i == n-1)ans += (count+1)*count/2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5748
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    L = sorted(readInts())
    ans = 0
    for i in range(0,n*2,2):
        ans += L[i]
    print(ans)
if __name__ == '__main__':
  main()


Measured memory_bytes: 5276