akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

int main(void) {

  char s[200001],t[200001];
  scanf("%s", s);
  scanf("%s", t);
  int length = strlen(s);
  int count = 0;
  for (int i = 0; i < length; i++) {
    if (s[i] != t[i]) {
      count++;
    }
  }
  printf("%d\n", count);

  return 0;
}

Measured memory_bytes: 2120
#include <iostream>
#include <stdio.h>
#include <string>

#define PI 3.141592653589793238

using namespace std;

int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	int min = a[0], max = a[0];
	long long sum = 0;
	
	for(int i = 0; i < n; i++){
		if(min > a[i]) min = a[i];
		if(max < a[i]) max = a[i];
		sum += a[i];
	}
	
	printf("%d %d %ld\n", min, max, sum);
	
}


Measured memory_bytes: 3252
#include<bits/stdc++.h>
using namespace std;
 
int main() {
  long long w, h, x, y, s;
  cin >> w >> h >> x >> y;
  if(2*x==w && 2*y==h){
    s = 1;
  }else{
    s = 0;
  }
  cout << (w*h)/2.0 << " " << s << endl;
}

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

int main() {

    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;

    if (A1 + A2 + A3 >= 22) {
        cout << "bust" << endl;
    }
    else {
        cout << "win" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a,b,i;
    char op;
    for(i=1;i>0;i++){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='+'){
            printf("%d\n",a+b);
        }
        else if(op=='-'){
            printf("%d\n",a-b);
        }
        else if(op=='*'){
           printf("%d\n",a*b); 
        }
        else if(op=='/'){
            printf("%d\n",a/b);
        }
        else if(op='?'){
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 1000000007
#define LINF 1000000000000000007LL
#define ll long long
using namespace std;
signed main(){
	int n,k;
	cin>>n>>k;
	vector<int> a,b;
	for(int i=0;i<n;i++){
		int x,y;
		cin>>x>>y;
		a.pb(x);b.pb(y);
	}
	if( k == 0 ){
		int tmp = 0;
		for(int i=0;i<n;i++){
			if( a[i] == 0 ) tmp += b[i];
		}
		cout<<tmp<<endl;
		return 0;
	}
	int ans = 0;
	for(int i=0;i<n;i++){
		if( (k|a[i]) == k)ans+=b[i];
		//cout<<k<<" "<<ans<<endl;
	}
	for(int i=29;i>=0;i--){
		int tmp = 0;
		int md = 1<<(i+1);
		int hf = 1<<i;
		int cur = k;
		if( cur % md >= hf ){
			cur = cur/hf * hf;
			cur--;
			for(int j=0;j<n;j++){
				if( (cur|a[j]) == cur)tmp+=b[j];
			}
			//cout<<cur<<" "<<tmp<<endl;
		}
		if(tmp>ans)ans=tmp;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2036
//1.read question_2.read I/O_3.read test cases_4.read constraints(to decide TC of solution)_5.decide method_6.dry run_
//7.code_8.test_9.submit
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define F first
#define S second
#define _READ freopen("input.txt","r", stdin);
#define pb push_back
#define MP make_pair
#define _FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main()
{

    lli m,n;
    cin>>m>>n;vector<pair<lli,lli>> v(n);
    for(auto &i:v)
        cin>>i.F>>i.S;
        //return 0;
    //for(auto i:v)
     //   cout<<i.F<<" "<<i.S<<"\n";return 0;
    vector<lli> dp(m+1,INT_MAX);
    //dp[i] is minimum cost for i health
    for(lli i=0;i<n;i++)
    {
        for(lli j=0;j<=m;j++)
        {
            if(j-v[i].F<=0)
                dp[j]=min(dp[j],v[i].S);
            else
                dp[j]=min(dp[j-v[i].F]+v[i].S,dp[j]);
        }
    }//return 0;
    cout<<dp[m];
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		String s = scan.next();
		char[] ch = s.toCharArray();
		
		String str = scan.next();
		char[] w = str.toCharArray();
		
		for(int i = 0; i < ch.length - (w.length - 1); i++){
			for(int j = 0; j < w.length; j++){
				if(ch[i + j] == w[j]){
					if(j == w.length - 1)System.out.println(i);
				}else break;
			}
		}
		
	}
}

Measured memory_bytes: 26164
#include <stdio.h>
int dp[50];
int fibonacci(int n){
  if (n == 0 || n == 1 )
    return dp[n]=1;
  if (dp[n] != -1)
    return dp[n];
  return dp[n] = fibonacci(n-2) + fibonacci(n-1);
}
int main() {
  int i, n;
  for(i=0 ; i< 50;i++)
    {
      dp[i]=-1;
    }
  scanf("%d",&n);
  printf("%d\n",fibonacci(n));
  return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define cst(x) cout<<fixed<<setprecision(x)
#define pi 3.14159265359
#define mod 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;

int main(){

    int n; cin >> n;
    vector<ld> p(n+1);
    for(int i = 1; i <= n; i++) cin >> p.at(i);
    vector<vector<ld>> dp(n+1,vector<ld>(n+1,0));
    dp.at(0).at(0) = 1;
    for(int i = 1; i <= n; i++){
        rep(j,n+1){
            if(j == 0) dp.at(i).at(j) = dp.at(i-1).at(j)*(1-p.at(i));
            else dp.at(i).at(j) = dp.at(i-1).at(j-1)*p.at(i) + dp.at(i-1).at(j)*(1-p.at(i));
        }
    }
    ld res = 0;
    for(int i = n/2+1; i<= n; i++){
        res += dp.at(n).at(i);
    }
    cst(10) << res << endl;
    return 0;   

}


Measured memory_bytes: 141056
#include <bits/stdc++.h>
#define maxn 100
#define maxv 100001
using namespace std;
typedef long long LL;

LL ans;
int n,k;
int w[maxn];
int v[maxn];
LL dp[maxv];

int main() {
	cin >> n >> k;
	for( int i = 0 ; i < n ; i++ )
		cin >> w[i] >> v[i];
	memset( dp , -1 , sizeof(dp) );
	dp[0] = 0;
	for( int i = 0 ; i < n ; i++ )
		for( int j = maxv-1-v[i] ; j >= 0 ; j-- )
			if( dp[j] != -1 )
				if( dp[j+v[i]] == -1 || dp[j]+w[i] < dp[j+v[i]] )
					dp[j+v[i]] = dp[j]+w[i];
	for( int i = maxv-1 ; i >= 0 ; i-- )
		if( dp[i] != -1 && dp[i] <= k ) {
			cout << i << endl;
			break;
		}
}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using f64 = double;
using f80 = long double;

#define FOR(v, a, b) for(i64 v = (a); v < (b); ++v)
#define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(i64 v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void pout(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void pout(const T &value, const Args&... args){std::cout << value << " ";pout(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;


template <typename T, typename F>
T power(T n, int64_t p, const T &e, const F &f){
  T ret = e;
  
  while(p > 0){
    if(p & 1) ret = f(ret, n);
    n = f(n, n);
    p >>= 1;
  }
  
  return ret;
}




int main(){
  int64_t N, K;

  while(cin >> N >> K){
    vector<int> A(N); cin >> A;
    REP(i,N) A[i] -= 1;


    vector<int> e(N);
    iota(ALL(e), 0);

    auto f =
      [N](vector<int> a, vector<int> b){
        vector<int> res(N);
        REP(i,N){
          res[i] = b[a[i]];
        }
        
        return res;
      };


    auto res = power(A, K, e, f);
    
    pout(res[0] + 1);
  }

  return 0;
}


Measured memory_bytes: 8744
w,h,n = map(int,input().split())
wl,wr,hu,hd = 0,w,h,0
for i in range(n):
  x,y,a = map(int,input().split())
  if a == 1:
    wl = max(wl,x)
  elif a == 2:
    wr = min(wr,x)
  elif a == 3:
    hd = max(hd,y)
  else:
    hu = min(hu,y)
print(max(0,wr-wl)*max(0,hu-hd))

Measured memory_bytes: 3064
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,D,T;
	while(cin>>N) {
		map<ll, ll> co;
		REP(i, N) {
			cin>>D;
			co[D]++;
		}
		cin>>M;
		string ans = "YES";
		REP(i, M) {
			cin>>T;
			co[T]--;
			if(co[T]==-1) ans="NO";
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}


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

int main(){
    ll n;
    cin>>n;
    ll a[n-1],sub[n];
    for(ll i=0;i<n;i++) sub[i]=0;
    for(ll i=0;i<n-1;i++)   cin>>a[i],sub[a[i]-1]++;
    for(ll i=0;i<n;i++) cout<<sub[i]<<endl;

    return 0;
}


Measured memory_bytes: 6744
/* https://codeforces.com/contest/1360/problem/H */
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
using ld = double;

#define f first
#define s second 
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define pb push_back
#define	lb lower_bound
#define	ub upper_bound
#define	sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define ins insert

const int MAX = INT_MAX;

int main() {
	
	int N;
	cin>>N;
	string s;
	cin>>s;
	int i = 0, j = N-1;
	int cnt = 0;
	while (i < j) {
		while (i < N && i < j && s[i] == 'R') {
			++i;
		}

		while (j >= 0 && i < j && s[j] == 'W') {
			--j;
		}

		if (i < j) {
			swap(s[i], s[j]);
			++i;
			--j;
			cnt++;
		}
	}

	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind() {double x; scanf("%lf", &x); return x;}

///*....Bitmask....*///
int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const ll M = (ll) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

ll dp[N][2][2];

int n;
ll f(int pos, int f1, int f2) {
  if (pos >= n) {
    if (f1 and f2)return 1ll;
    return 0ll;
  }

  ll &ret = dp[pos][f1][f2];
  if (ret != -1)return ret;

  ll res = 0ll;
  for (int i = 0; i < 10; ++i) { 
    ll k= f(pos + 1, f1 | (i == 0), f2 | (i == 9));
    res+=k;
    if(res >=M)res%=M;
  }
  return ret = res;
}

int main()
{

  Int(n);
  memset(dp, -1, sizeof(dp));
  ll res = f(0, 0, 0);

  printf("%lld\n", res);

  //printf("Case %d: ",++te);


 // cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
  return 0;
}






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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
const long long MOD = 1e9 + 7;
///////////////////////////////////////////////
// for template
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    ll ans = 0;
    ll N; cin >> N;
    FORq(K,1,N){
        ll Y = N / K;
        ans += Y*(Y+1)*K / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3580
#include<iostream>
using namespace std;
int H, W, i, j, k;
int main(){
    for(;;){
    cin >> H >> W;
    if (H==0&&W==0) break;
    for(i=0;i<H;i++)
        if(i==0||i==H-1){
            for(j=0;j<W;j++) cout << "#";
            cout << endl;
        }
        else{
            for(k=0;k<W;k++) {
                if(k==0||k==W-1) cout << "#";
                else(cout << ".");
            }
            cout << endl;
        }
    cout << endl;
}
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
typedef  long long int ll;
typedef long double ld;
#define pb  push_back
#define vll vector<ll>
#define mll map<ll,ll>
const double PI = 2*acos(0.0);
#define gcd(a,b)   __gcd((a),(b))
#define lcm(a,b)   ((a)/(__gcd((a),(b)))*(b))
#define INF         LLONG_MAX
#define ln  INT_MAX
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
using namespace std;
int main(){
ll a,b,c,d,l,m,n,e;
cin>>a>>b>>c>>d;
l=a*c;
m=a*d;
n=b*c;
e=b*d;
cout<<max(e,max(n,max(l,m)));


return 0;}








Measured memory_bytes: 3632
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<sstream>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;


int main()
{
	LL n;
	cin >> n;
	LL tmp = 10;
	LL ans = 0;
	if(n % 2 == 1){
		printf("0\n");
	}
	else{
		ans += n / 10;
		n /= 10;
		while(n > 0){
			ans += n / 5;
			n /= 5;
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
MOD = 10**9+7
N = int(input())
L = list(map(lambda x: bin(int(x))[2:], input().split()))
max_len = max([len(v) for v in L])
padL = ["0"*(max_len-len(v))+v for v in L]
cnt = [0]*max_len
for i in range(max_len):
    for l in padL:
        cnt[i] += 1 if l[i] == "1" else 0

ans = 0
v = 1
for i in range(max_len):
    ans += v*cnt[max_len-1-i]*(N-cnt[max_len-i-1])
    ans %= MOD
    v *= 2

print(ans)


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

int main(){
    int a,b,c;
    int t;
   
    cin >> a >> b >>c;
    
    //step1
    if(a > b){
      t = a;
      a = b;
      b = t;
    }
    
    //step2
    if(b > c){
      t = b;
      b = c;
      c = t;
    }
    
    //step3
    if(a > b){
      t = a;
      a = b;
      b = t;
    }
     
      cout << a << " " << b << " " << c << endl;
    
}

Measured memory_bytes: 1164
#B
n = int(input())
a = list(map(int, input().split()))
#1/sum(1/a)
#1/a+1/b+1/c = (ab+bc+ca) / abc
#1/sum(1/A) = abc / (ab+bc+ca)
prod = 1
for i in range(n):
    prod *= a[i]
lst = []
la = lst.append
for i in range(n):
    la(prod/a[i])
ans = prod/sum(lst)
print(ans)



Measured memory_bytes: 3060
N = int(input())
S = list(str(input()))

passwords = []
for i in range(0, 10):
    for j in range(0, 10):
        for k in range(0, 10):
            password = str(i) + str(j) + str(k)
            passwords.append(password)

char_hash = {}
for i, char in enumerate(S):
    if char in char_hash.keys():
        char_hash[char].append(i)
    else:
        char_hash[char] = [i]

# print(char_hash

count = 0
for password in passwords:
    exist_keys = char_hash.keys()
    # print(password[0] in char_hash.keys())
    if not(password[0] in exist_keys):
        continue
    if not(password[1] in exist_keys):
        continue
    if not(password[2] in exist_keys):
        continue
    first_index = min(char_hash[password[0]])
    second_indexes = char_hash[password[1]]
    second_index = -1
    for index in second_indexes:
        if index <= first_index:
            continue
        else:
            second_index = index
            break
    third_indexes = char_hash[password[2]]
    third_index = -1
    for index in third_indexes:
        if index <= second_index:
            continue
        else:
            third_index = index
            break
    # print(first_index, second_index, third_index)
    if first_index < second_index and second_index < third_index:
        count += 1

print(count)
# print(len(passwords))
# print(passwords)
# print(set(passwords))
# print(len(list(set(passwords))))


Measured memory_bytes: 43612
#include<stdio.h>
int main(void){
    int N,count=0,an=0,nns=0;
    scanf("%d",&N);
    int ans[81];
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){
            count++;
            ans[count]=i*j;
            if(N!=ans[count])
                an=-1;
            else if(N==ans[count]){
                nns=1;
                break;
            }
        }
    }
    if(nns==1)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
    
}


Measured memory_bytes: 128
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  string s;
  cin >> s;

  int n = s.size();

  int ans = 0;
  char c = '-';
  bool flag = false;
  REP(i,n){
    if(s[i] != c){
      c = s[i]; ans++;
    }
    else{
      c = '-';
      ans++;
      i++;
      if(i == n) ans--;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 720
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  cin >> str;
  while(str[0]!='#'){
    int i=0,a=0,k=1;
    i=str.size()-1;k=1;
    while(str[i]!='n'&&str[i]!='w'){
      i--;
    }
    if(str[i]=='n'){
      a=0;
    }else if(str[i]=='w'){
      a=90;
    }
    if(i>0) i--;
    while(i!=0){
      i--;
      if(str[i]=='n'){
	a*=2;
        a-=90;
	k*=2;
      }else if(str[i]=='w'){
	a*=2;
	a+=90;
	k*=2;
      }
      
    }
    while(a%2==0&&k%2==0){
      a/=2;k/=2;
    }
    if(k==1) cout << a << endl;
    else cout << a << "/" << k << endl;
    cin >> str;
  }
  return 0;
}

Measured memory_bytes: 1180
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
int main()
{
    ll n,m; cin>>n>>m;
    ll ans=(n)*(n-1)/2;
    ll val=(m*(m-1))/2;
    cout<<ans+val<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    max = 0
    next = 0
    for i in A:
        if i >= max:
            next = max
            max = i
        elif i >= next:
            next = i

    for i in A:
        if i == max:
            print(next)
        else:
            print(max)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 84628
N = int(input())
As = list(map(int, input().split()))


def isOdd(i):
    if i % 2 == 0:
        return False
    else:
        return True

i = 1
ans = 0
for a in As:
    if isOdd(a) and isOdd(i):
        ans = ans + 1

    i = i + 1

print(ans)

Measured memory_bytes: 9096
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
typedef long long LL;
const int N=50;
LL pow(LL x,LL p){
    LL res=1;
    while(p){
        if(p&1){
            res=res*x;
        }
        x=x*x;
        p>>=1;
    }
    return res;
}
int getnum(LL x){
    int res=0;
    while(x){
        res+=(x&1);x>>=1;
    }
    return res;
}
int first[N],n,m,tot;
LL ans,info[N],path[N];
struct edge{
    int to,next,num;
}e[N*2];
void add(int u,int v,int w){
    e[++tot].next=first[u],first[u]=tot;
    e[tot].to=v;e[tot].num=w;
}
void dfs(int x,int f,LL num){
    path[x]=num;
    for(int i=first[x];i;i=e[i].next){
        int u=e[i].to;
        if(u==f)continue;
        dfs(u,x,num|(1ll<<e[i].num));
    }
}
int main(){
    scanf("%d",&n);
    for(int i=0,u,v;i<n-1;i++){
        scanf("%d%d",&u,&v);
        add(u,v,i);add(v,u,i);
    }
    dfs(1,0,0);
    //for(int i=1;i<=n;i++)cout<<getnum(path[i])<<endl;
    scanf("%d",&m);
    for(int i=0,u,v;i<m;i++){
        scanf("%d%d",&u,&v);
        info[i]=path[u]^path[v];
    }
    LL stp=(1ll<<m)-1;
    for(int i=0;i<=stp;i++){
        int cnt=0;LL now=0;
        for(int j=0;j<m;j++){
            if((1<<j)&i){
                //cout<<i<<" "<<j<<endl;
                cnt++;
                now|=info[j];
            }
        }
        int free=n-getnum(now)-1;
        LL flag=-1;if(cnt%2==0)flag=1;
        ans+=flag*pow(2ll,free);
    }
    cout<<ans<<endl;
}

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

int main(){

    
    vector<int>a(4);
    for(int i=0;i<5;++i){
        cin>>a[i];
    }
    for(int i=0;i<5;++i){
        if(!a[i]){
            cout<<(i+1);
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll MOD = 1e9+7;
const double EPS = 1e-9;

ll inv[500000];

// O(k)
ll modnCk_bigN(int N, int K){
  if (N < K) return 0;
  if (K == 0) return 1;
  ll ret = N;
  inv[1] = 1;
  for (int k=2; k<=K; k++){
    inv[k] = MOD - inv[MOD%k] * (MOD/k) % MOD;
    ret = ret * ((N-k+1) * inv[k] % MOD) % MOD;
  }
  return ret;
}

int main(int argc, const char * argv[]) {
  int N, M, K;
  cin >> N >> M >> K;
  
  ll c = modnCk_bigN(N*M-2, K-2);
  ll ans = 0;
  for (int d=1; d<N; d++)
    ans = (ans + ((c * d % MOD) * (M * M % MOD) % MOD) * (N-d) % MOD) % MOD;
  
  for (int d=1; d<M; d++)
    ans = (ans + ((c * d % MOD) * (N * N % MOD) % MOD) * (M-d) % MOD) % MOD;
  
  cout << ans << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
#define eps 1e-12

int t[105], v[105];

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++)
    {
        cin >> t[i];
        t[i] += t[i - 1];
    }
    for(int i = 0; i < n; i++)
        cin >> v[i];
    ld cur = 0;
    ld sol = 0;
    for(int i = 0; i < n; i++)
    {
        ld st = t[i], en = t[i + 1], ans;
        for(int j = 0; j < 100; j++)
        {
            ld mid = (st + en) / 2;
            ld curSpeed = min((ld)v[i], cur + (mid - t[i]));
            bool good = 1;
            for(int k = i + 1; k <= n; k++)
                if(!(curSpeed - (t[k] - mid) <= v[k]))
                    good = 0;
            if(good)
                ans = mid, st = mid;
            else
                en = mid;
        }
        st = t[i], en = ans;
        ld acc, cons, desc = t[i + 1] - ans, ss;
        for(int j = 0; j < 100; j++)
        {
            ld mid = (st + en) / 2;
            ld curSpeed = cur + mid - t[i];
            if(curSpeed <= v[i])
                acc = mid - t[i], cons = ans - mid, ss = curSpeed, st = mid;
            else
                en = mid;
        }
        sol += cur * acc + 0.5 * acc * acc;
        sol += ss * cons;
        sol += ss * (t[i + 1] - ans) + 0.5 * -1 * (t[i + 1] - ans) * (t[i + 1] - ans);
        cur = ss + -1 * (t[i + 1] - ans);
    }
    cout << fixed << setprecision(6) << sol;
}


Measured memory_bytes: 256
import random
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(D)]
t = [0] * D
for i in range(D):
    r=((i+1)%26)+1
    t[i] = r
 
    
M=22*10*2*100
day=[random.randint(1,365) for i in range(M)]
q=[random.randint(1,26) for i in range(M)]
    
m=[0]*D
 
a=[[0 for i in range(26)] for j in range(D)]
R=[[0 for i in range(26)] for j in range(D)]
for u in range(D):
    i=t[u]
    for y in range(u,D):
        a[y][i-1]=u+1
    if u==0:
        m[u]=s[u][i-1]
    else:
        m[u]=m[u-1]+s[u][i-1]
mm=[0]*D
for d  in range(D):
    for i in range(26):
        mm[d]+=c[i]*(d+1-a[d][i])
    if not d==0:
        mm[d]+=mm[d-1]
for d in range(D):
    m[d]-=mm[d]
mmm=m[D-1]
 
 
 
for p in range(M):
    new_type=q[p]
    old_type=t[day[p]-1]
    #print(new_type,old_type)
    A=0
    B=0
    C=0
    C=s[day[p]-1][old_type-1]-s[day[p]-1][new_type-1]
    for d in range(D):
        A+=c[new_type-1]*(d+1-a[d][new_type-1])+c[old_type-1]*(d+1-a[d][old_type-1])
    xday=day[p]
    R=a
    if xday>1:
        before_new=a[xday-2][new_type-1]
        before_old=a[xday-2][old_type-1]
        now_new=a[day[p]-1][new_type-1]
        now_old=a[day[p]-1][old_type-1]
        for d in range(day[p]-1,D):
            if a[d][new_type-1]==now_new:
                a[d][new_type-1]=xday
            if a[d][old_type-1]==now_old:
                a[d][old_type-1]=before_old
    else:
        for d in range(day[p]-1,D):
            if a[d][old_type-1]==1:
                a[d][old_type-1]=0
            if a[d][new_type-1]==0:
                a[d][new_type-1]=1   
    t[day[p]-1]=new_type
    for d in range(D):
        B+=c[new_type-1]*(d+1-a[d][new_type-1])+c[old_type-1]*(d+1-a[d][old_type-1])
    T=mmm-(B-A+C)
    if T>mmm:
        mmm=T
    else:
        a=R
    #print(mmm)
for i in range(len(t)):
    print(t[i])

Measured memory_bytes: 82500
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll a,b;
    cin>>a>>b;
    ll ans = max(a-2*b,0ll);
    cout<<ans;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int s, ch, cm, cs, temp;
	cin >> s;
	ch = s / 60 / 60;
	s = s - (60 * 60 * ch);
	cm = s / 60;
	s = s - (60 * cm);
	cs = s;
	cout << ch << ":" << cm << ":" << cs << endl;
	return 0;
}


Measured memory_bytes: 3096
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

vector<int> zAlgorithm(const string &s) {
    int n = (int)s.size(), l = 0, r = 0;
    vector<int> Z(n, n);
    for (int i = 1; i < n; ++i) {
        if (i > r) {
            l = r = i;
        } else if (Z[i - l] >= r - i + 1) {
            l = i;
        } else {
            Z[i] = Z[i - l];
            continue;
        }
        while (r < n&&s[r] == s[r - l])r++;
        Z[i] = r - l; r--;
    }
    return Z;
}

class UnionFind {
    int cnt;
    vector<int> par, rank, size;
public:
    UnionFind() {}
    UnionFind(int _n) :cnt(_n), par(_n), rank(_n), size(_n, 1) {
        for (int i = 0; i<_n; ++i) par[i] = i;
    }
    int find(int k) {
        return (k == par[k]) ? k : (par[k] = find(par[k]));
    }
    int operator[](int k) {
        return find(k);
    }
    int getSize(int k) {
        return size[find(k)];
    }
    void unite(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return;
        --cnt;
        if (rank[x] < rank[y]) {
            par[x] = y;
            size[y] += size[x];
        } else {
            par[y] = x;
            size[x] += size[y];
            if (rank[y] == rank[x]) ++rank[x];
        }
    }
    int count() {
        return cnt;
    }
};

void solve() {
    string S, T;
    cin >> S >> T;
    int N = sz(S), M = sz(T);

    string s = S;
    while (sz(S) < 2 * M) {
        S += s;
    }
    S += S;

    UnionFind uf(N);
    int ans = 0;
    string TS = T + S;
    auto Z = zAlgorithm(TS);
    rep(i, N) {
        int j = (i + M) % N;
        if (Z[i + M] >= M && Z[j + M] >= M) {
            uf.unite(i, j);
        }
    }

    vector<bool> vis(N);
    rep(i, N) {
        if (Z[i + M] >= M) {
            smax(ans, uf.getSize(i));
        }
        int cur = i;
        if (vis[cur])continue;
        bool ok = true;
        do {
            vis[cur] = true;
            if (Z[cur + M] < M)ok = false;
            cur = (cur + M) % N;
        } while (cur != i);
        if (ok) {
            cout << -1 << endl;
            return;
        }
    }

    cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}

Measured memory_bytes: 27744
#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>;

const ll e9 = 1000000000;

int main() {
    ll s;
    cin >> s;
    ll x1 = 0, y1 = 0;
    ll x2 = e9, y2 = 1;
    ll y3 = s / e9;
    if (0 < s % e9) y3++;
    ll x3 = y3 * e9 - s;
    cout << x1 << ' ' << y1 << ' ';
    cout << x2 << ' ' << y2 << ' ';
    cout << x3 << ' ' << y3;
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

inline void write_bool(bool b, const string &tval, const string &fval) {
  cout << (b ? tval : fval) << endl;
} 
inline void YESNO(bool b) { return write_bool(b, "YES", "NO"); }
inline void YesNo(bool b) { return write_bool(b, "Yes", "No"); }
inline void yesno(bool b) { return write_bool(b, "yes", "no"); }

bool sorted(const vint& v) {
  REP(i,v.size()-1) if (v[i] > v[i+1]) return false;
  return true;
}

bool solve(vint v) {
  if (sorted(v)) return true;
  REP(i,v.size()) REP(j,i) {
    swap(v[i], v[j]);
    if (sorted(v)) return true;
    swap(v[i], v[j]);    
  }
  return false;
}

int main() {
  int n;
  while (cin >> n) {
    vint v(n);
    REP(i,n) cin >> v[i];
    YESNO(solve(v));
  }
}


Measured memory_bytes: 888
import sys
for line in sys.stdin:
    a, op, b = line.rstrip('\n').split(' ')
    if op == '+':
        print '%d' % (int(a) + int(b))
    elif op == '-':
        print '%d' % (int(a) - int(b))
    elif op == '*':
        print '%d' % (int(a) * int(b))
    elif op == '/':
        print '%d' % (int(a) / int(b))
    elif op == '?':
        break

Measured memory_bytes: 4220
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Integer a = scanner.nextInt();
        Integer b = scanner.nextInt();
        int sum = a + b;
        if(sum % 2 != 0) {
          System.out.println("IMPOSSIBLE");
        } else {
          System.out.println(sum / 2);
        }
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
using namespace std;

int N;
int mod = 1e9 + 7;

int main() {
    cin >> N;
    long long ans = 1;
    vector<int> factrl(N + 1);
    for (int i = 1; i <= N; i++) {
        factrl[i] = i;
    }
    for (int i = 2; i <= N; i++) {
        int cnt = 1;
        for (int j = 1; j <= N; j++) {
            if (factrl[j] % i == 0) {
                while (factrl[j] % i == 0) {
                    factrl[j] /= i;
                    cnt++;
                }
            }
        }
        ans = ans * cnt % mod;
    }
    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;
const long long 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; }

int main(){
    int N;
    cin >> N;
    vector<long long> A(N+1),sum(N+1);
    long long mod = 1000000007;
    sum.at(0) = 0;
    for(int i=1;i<=N;i++){
        cin >> A.at(i);
        sum.at(i) = sum.at(i-1) + A.at(i);
    }
    long long ans = 0;
    for(int i=1;i<N;i++){
        ans += ((A.at(i)%mod)*((sum.at(N)-sum.at(i))%mod))%mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6284
import sys
from itertools import permutations, combinations
  
def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [[int(a) for a in input().split()] for _ in range(N)]

    length = 0
    possible = True
    for a, b in combinations(range(N), 2):
        Lab = A[a][b]
        create_pass = True
        for k in range(N):
            if k != a and k != b:
                if Lab >  A[a][k] + A[k][b]:
                    possible = False
                    break
                elif Lab ==  A[a][k] + A[k][b]:
                    create_pass = False
                    break
        if create_pass: length += Lab
        if not possible:
            print(-1)
            break
    else: print(length)
    
    return 0
  
if __name__ == "__main__":
    solve()


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

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        String s=bu.readLine();
        String t=bu.readLine();
        int i,fl=0;
        for(i=0;i<s.length();i++)
        if(s.charAt(i)!=t.charAt(i)) {fl=1; break;}
        if(fl==1 || t.length()-s.length()!=1) System.out.print("No");
        else System.out.print("Yes");
    }
}


Measured memory_bytes: 32648
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
#include <fstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
//typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

vector<ll> dx = { 0, 1, 0, -1, 1, -1, 1, -1, 0};
vector<ll> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0};

void chmin(double& x, double y) {
	x = min(x, y);
}

void chmax(double& x, double y) {
	x = max(x, y);
}

ll pow_long(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y % 2 == 1) res *= x;
		x *= x;
		y /= 2;
	}
	return res;
}

void test() {
	cout << "888888888888888888888888" << endl;
}

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

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 1000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

ll k, q;
ll d[5010];
ll sum[5010], zeroSum[5010];
ll n, x, m;

void solve() {
	cin >> k >> q;
	rep(i, k) cin >> d[i];
	rep(i, q) {
		cin >> n >> x >> mod;
		ll SUM, ans = n - 1;
		x %= mod;
		rep(j, k) zeroSum[j + 1] = zeroSum[j] + (d[j] % mod == 0 ? 1 : 0);
		rep(j, k) sum[j + 1] = sum[j] + d[j] % mod;
		SUM = x + (n - 1) / k * sum[k];
		SUM += sum[(n - 1) % k];
		ans -= SUM / mod;
		//cout << SUM << endl;
		ans -= (n - 1) / k * zeroSum[k];
		ans -= zeroSum[(n - 1) % k];
		cout << ans << endl;
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T = 1;
	//cin >> T;
	rep(i, T) solve();
}


Measured memory_bytes: 384