akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define lll __int128
#define lp(i, a, b) for (int i = a; i < b; i++)
#define vec(v, type, sz) vector<type> v(sz)
#define in(v) \
    for (auto &i : v) cin >> i
#define all(v) v.begin(), v.end()
#define prv(v)                         \
    for (auto i : v) cout << i << " "; \
    cout << "\n"
#define MOD 1000000007
#define INF 1000000000
#define INFL 1000000000000000000ll
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define vi vector<int>
#define vl vector<ll>
#define vii(v, n, m, val) vector<vector<int>> v(n, vector<int>(m, val))
#define viii(v, i, j, k, val)        \
    vector<vector<vector<int>>> v(i, \
                                  vector<vector<int>>(j, vector<int>(k, val)))
#define pii pair<int, int>
#define pb push_back
#define file_io                       \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);

int count_factors(ll n) {
    int cnt = 0;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            if (i * i == n)
                cnt++;
            else
                cnt += 2;
        }
    }
    return cnt;
}

bool ok(ll n, ll k) {
    while (n % k == 0) n /= k;
    return n % k == 1;
}

int main() {
    fast_io;
    ll n;
    cin >> n;
    ll ans = count_factors(n - 1) - 1;
    for (ll k = 2; k * k <= n; k++) {
        if (n % k == 0) {
            if (k * k == n)
                ans += ok(n, k);
            else {
                ans += ok(n, k);
                ans += ok(n, n / k);
            }
        }
    }
    ans++;  // for n/n=1;
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(...) overload_rep(__VA_ARGS__, rep_1, rep_0) (__VA_ARGS__)
#define rep_0(i, end) for (int i = 0; i < (end); ++i)
#define rep_1(i, fr, ba) for (int i = (fr); i <= (ba); ++i)
#define overload_rep(arg_0, arg_1, arg_2, name, ...) name
#define all(box) box.begin(), box.end()
 
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }

int main() {

  int K, T;
  std::cin >> K >> T;
  std::vector<int> A(T);
  rep (i, T) std::cin >> A[i];

  int max = *std::max_element(all(A));
  std::cout << std::max(max * 2 - K - 1, 0) << '\n';

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
signed main() {
	 int A,B;
     cin>>A>>B;

     A=A-1;
     B=B-1;

     if(B%A==0){
         cout<<B/A<<endl;
     }
     else{
         cout<<B/A+1<<endl;
     }
}

Measured memory_bytes: 3608
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }


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

    vector<int> people(N + 1, 0);
    people[0] = 3;
    ll ans = 1;
    const ll MOD = 1000000007l;

    for (int i = 0; i < N; ++i)
    {
        int x;
        cin >> x;

        ++x;

        ans = ans * people[x - 1] % MOD;
        people[x - 1]--;
        people[x]++;
    }

    return ans;
}

int main()
{
    std::cout << solve() << std::endl;

    return 0;
}

Measured memory_bytes: 640
/*
ID: sstfmsc1
TASK: milk2
LANG: C++
*/
#include <bits/stdc++.h>
 
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define forin(i, n) for ( int i = 0; i < (int)n; ++i )
#define MAXN 50000
#define INF 1000000
#define MOD 10
typedef long long ll;
const char nl = '\n';
 
void solve()
{
    string s, t;
    cin >> s >> t;

    int ans = (int)t.size() + 1;

    forin(i, ( s.size() - t.size() + 1 ))
    {
        int cnt = 0;
        forin(j, t.size())
        {
            if ( s[i+j] != t[j] ) ++cnt;
        }
        ans = min(ans, cnt);
    }

    cout << ans << nl;
    return;
}
 
int main()
{
    //freopen("milk2.in", "r", stdin);
    //freopen("milk2.out", "w", stdout);
    IOS
 
    solve();
    
    
    return 0;
}

Measured memory_bytes: 3616
# include <iostream>
# include <sstream>
# include <cstdio>
# include <cstdlib>
# include <algorithm>
# include <string>
# include <cstring>
# include <cmath>
# include <stack>
# include <queue>
# include <vector>
# include <list>
# include <map>
# include <set>
# include <deque>
# include <iterator>
# include <functional>
# include <bitset>
# include <climits>
# include <ctime>
using namespace std;
//#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define odd(x) ((x)&1)
#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define all(x) (x).begin(),(x).end()
#define mem(a,x) memset(a,x,sizeof(a))
#define rep(i,a,b) for (int i=(a); i<=(b); ++i)
#define per(i,a,b) for (int i=(a); i>=(b); --i)
#define rep_it(it,x) for (__typeof((x).begin()) it=(x).begin(); it!=(x).end(); it++)
#define ____ puts("\n_______________\n\n")
#define debug(x) ____; cout<< #x << " => " << (x) << endl
#define debug_pair(x) cout<<"\n{ "<<(x).fir<<" , "<<(x).sec<<" }\n"
#define debug_arr(x,n) ____; cout<<#x<<":\n"; rep(i,0,n) cout<<#x<<"["<<(i)<<"] => "<<x[i]<<endl
#define debug_arr2(x,n,m) ____; cout<<#x<<":\n"; rep(i,0,n) rep(j,0,m) cout<<#x<<"["<<(i)<<"]["<<(j)<<"]= "<<x[i][j]<<((j==m)?"\n\n":"    ")
#define debug_set(x) ____; cout<<#x<<": \n"; rep_it(it,x) cout<<(*it)<<" "; cout<<endl
#define debug_map(x) ____; cout<<#x<<": \n"; rep_it(it,x) debug_pair(*it)
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int oo = /*2 * 1000 * 1000 * 1000*/0x3f3f3f3f;
const ll ooo=9223372036854775807ll;
const int _cnt = 1000 * 1000 + 7;
const int _p = 1000 * 1000 * 1000 + 7;
const int N=200105;
const double PI=acos(-1.0);
const double eps=1e-9;
int o(int x) { return x%_p; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int lcm(int a, int b) { return a / gcd(a, b)*b; }

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

int n,a[N],p=0,q=0,pp=0,qq=0,cnt=0;

int main() {
    //file_put();

    scanf("%d",&n);
    rep(i,1,n) scanf("%d",&a[i]),cnt+=(a[i]<0);
    rep(i,1,n) {
        if (a[i]>=0) if (a[i]>p) p=a[i],pp=i;
        if (a[i]<0) if (-a[i]>q) q=-a[i],qq=i;
    }
    if (p>=q) {
        printf("%d\n",cnt+n-1);
        rep(i,1,n) if (a[i]<0) printf("%d %d\n",pp,i);
        rep(i,2,n) printf("%d %d\n",i-1,i);
    } else {
        printf("%d\n",n-cnt+n-1);
        rep(i,1,n) if (a[i]>=0) printf("%d %d\n",qq,i);
        per(i,n-1,1) printf("%d %d\n",i+1,i);
    }

    return 0;
}


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

int main(void){
  int len, cnt;
  string str;

  while(getline( cin, str )){
    len = str.length();
    cnt = 0;

    while(true){
      if( str.find("the", 0) != string::npos
	  || str.find("this", 0) != string::npos 
	  || str.find("that", 0) != string::npos
	)
	break;
      for(int i = 0; i < len; i++){
	if( 'a' <= str[i] && str[i] <= 'z' ){
	  str[i]++;
	  if(str[i] > 'z')
	    str[i] = 'a';
	}
      }
      
      cnt++;
      if(cnt > 30)
	break;
    }
    
    cout << str << endl;
  }
  return 0;
}

Measured memory_bytes: 1176
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(float, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N = ii()
P = li()

dp = dp2(0, N+1, N)
dp[0][0] = 1 - P[0]
dp[0][1] = P[0]

for i in range(1, N):
    for j in range(i+1):
        dp[i][j] += dp[i-1][j] * (1-P[i])
        dp[i][j+1] += dp[i-1][j] * P[i]

print(sum(dp[N-1][(N//2+1):])) 

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

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

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();

    int n,m;cin>>n>>m;
    int k=m;
    long long ans=1;
    map<int,int>a;
    set<int>b;
    for(int i=2;i*i<=k;++i){
        if(k%i==0){
            b.insert(i);
        }
        while(k%i==0){
            k/=i;
            a[i]++;
        }
    }
    if(k!=1){
        a[k]++;
        b.insert(k);
    }
    for(auto x : b){
        ans*=COM(n+a[x]-1,n-1);
        ans%=MOD;
    }
    cout<<ans<<endl;
}

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

//----------------------------------------------------------------------------------
#define pb insert//                                                                 |
#define eb emplace_back//                                                           |
#define ff first//                                                                  |
#define ss second//                                                                 |
typedef long long int ll;//                                                         |
typedef long double ld;//                                                           |
#define all(a) a.begin(), a.end()//                                                 |
#define show(x) cerr << #x << " is " << x << "\n"//                                 |
#define show2(x, y) cerr << #x << " " << #y << " " << x << " " << y << "\n"//       |
typedef vector<ll> vl;//                                                            |
typedef vector<vl> vvl;//                                                           |
typedef pair<ll, ll> pp;//                                                          |
typedef vector<pp> vp;//                                                            |
typedef map<pp, ll> ipi;//                                                          |
typedef map<pp, char> ipc;//                                                        |
typedef map<ll, ll> ii;//                                                           |
typedef set<ll> sl;//                                                               |
typedef multiset<ll> msl;//                                                         |
typedef map<char, ll> ci;//                                                         |
typedef set<pair<ll, ll>> sp;//                                                     |
const ll mod = 1e9 + 7;//                                                           |
const ll N = 2e4 + 1;//                                                             |
//----------------------------------------------------------------------------------




//main func
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    
    ll t;cin>>t;
    vl v(t);
    ll xr=0;
    for(auto &i:v) {cin>>i;xr^=i;}
    for(int i=0;i<t;i++){
        ll ans=xr^v[i];
        cout<<ans<<" ";
    }
    
    
    
	return 0;
}

Measured memory_bytes: 4776
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <string>

using namespace std;

typedef long long ll;

int main() {
	string str;
	cin >> str;

	bool flag = false;
	
	ll cnt = str.length();
	while (cnt > 2) {
		for (int i = 1; i < cnt - 1; i++) {
			if(str[i - 1] != str[i + 1]){
				str.erase(i, 1);
				if(flag){
					flag = false;
				} else {
					flag = true;
				}
				break;
			}
			if (i == cnt - 2){
				if(flag) {
					printf("First\n");
				} else {
					printf("Second\n");
				} 
				return 0;
			}
		}
		cnt--;
	}
	
	if(flag) {
		printf("First\n");
	} else {
		printf("Second\n");
	} 
		
	
	return 0;
}

Measured memory_bytes: 512
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
  string alphabets = "abcdefghijklmnopqrstuvwxyz";
  int[] alphabetsS = new int[26];
  int[] alphabetsT = new int[26];
	string s = Console.ReadLine();
  string t = Console.ReadLine();
  bool ok = true;

    for(int i = 0; i < s.Length; i++)
    {
      for(int j = 0; j < 26; j++)
      {
        if(s[i] == alphabets[j]) alphabetsS[j]++;
      }
    }

    for(int i = 0; i < t.Length; i++)
    {
      for(int j = 0; j < 26; j++)
      {
        if(t[i] == alphabets[j]) alphabetsT[j]++;
      }
    }

    Array.Sort(alphabetsS);
    Array.Sort(alphabetsT);

    for(int i = 0; i < 26; i++)
    {
      if(alphabetsS[i] != alphabetsT[i]) ok = false;
    }

       Console.WriteLine((ok) ? "Yes" : "No");
       
	}
}


Measured memory_bytes: 13208
package main

import "fmt"

func main() {
	var w []byte
	fmt.Scan(&w)
	count := make(map[byte]int)
	var flag bool = true

	for _, v := range w {
		if _, ok := count[v]; ok {
			count[v]++
		} else {
			count[v] = 1
		}
	}

	for _, v := range count {
		if v%2 != 0 {
			flag = false
		}
	}

	if flag {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード
 
//ループ
#define rep(i, n) for(int i = 0; i < (n); i++) //普通のループ
#define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ
 
//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;
const double PI = acos(-1); //π
 
using namespace std;
 
//ソート
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 
//#include "./lib/generic/search.h"

//文字列入力した小数値を小数点なくして返す
int changeDoubleToInt(string decimal){ 
    decimal.erase(1, 1); //小数点削除
    int n_decimal = atoi(decimal.c_str()); //c_strでchar*に変換後、atoiでintに変換
    return n_decimal;
}

//最大公約数
int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

int main(){
   int a, b, c, k;
   cin >> a >> b >> c >> k;
   rep(i,k){
       if(c<=b || c<=a){
           c*=2;
       }
       else if(b<=a){
           b*=2;
       }
       if(c>b && b>a){
           cout << "Yes" << endl;
           return 0;
       }
   }
   cout << "No" << endl;
   return 0;
}

Measured memory_bytes: 3632
# include<iostream>
# include<algorithm>
# include<cmath>
using namespace std;
int A[11];
int B[10];
int N;
int M;
int Q;
int a[1000];
int b[1000];
int c[1000];
int d[1000];
int MAX =0;
void dfs(int i)
{
	 if(i>=N)
	 {
	 	
	 	
	 	 
	 	 int sum=0;
	 	 for(int j=0;j<Q;j++)
	 	 {
	 	 	  if(B[b[j]-1]-B[a[j]-1]==c[j])
	 	 	  {
	 	 	  	  sum+=d[j];
	 	 	  	
			  }
		  }
		 
		 MAX = max(MAX,sum);
	 	return;
	 }
	 if(i==0)
	 {
	      for(int j=1;j<=M;j++)
	    {
	 	   
	 	  	   B[i]=j;
	 	  	   dfs(i+1);
	 	  	  
		   
	 	
	     }	 	
	 }
     else
     {
 	      for(int j=1;j<=M;j++)
	    {
	 	    if(A[j]==0&&j>=B[i-1])
	 	   {
	 	  	  
	 	  	   B[i]=j;
	 	  	  
	 	  	   dfs(i+1);
	 	  	 
		   }
	 	
	     }	 	    	
	 }
	 
}

int main ()
{
	for(int i=1;i<=M;i++)
	{
		A[i]=0;
	}
	
    cin>>N>>M>>Q;
    
    for(int i=0;i<Q;i++)
    {
    	 cin>>a[i]>>b[i]>>c[i]>>d[i]; 
	}
    
    dfs(0);
    cout<<MAX<<endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    int sum =6;
    int A,B;
    cin >> A;
    cin >> B;
    cout << sum-A-B << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <tuple>

using u128 = __uint128_t;
using u64 = unsigned long long int;
using s64 = long long int;
using u32 = unsigned int;

constexpr u32 mod = 1000000007;

int n;

u32 pow2[200001];

void reduce(u64 *a, u64 *b){
  u64 s, t, u, v;
  s = v = 1;
  u = t = 0;
  
  while(*a){
    u64 q = *b / *a;
    u64 r = *b % *a;
    std::tie(s, t, u, v) = std::make_tuple(u, v, s + q*u, t + q*v);
    *b = *a;
    *a = r;
  }
  *a = u;
  *b = v;
}

int main(){

  scanf("%d", &n);
  pow2[0] = 1;
  for(int i = 1; i <= n; i++){
    pow2[i] = 2 * pow2[i-1];
    if(pow2[i] >= mod) pow2[i] -= mod;
  }

  using quot = std::pair<u64, u64>;
  std::vector<quot> vp, vn;
  int zero2 = 0;

  for(int i = 0; i < n; i++){
    s64 a, b;
    scanf("%lld%lld", &a, &b);
    if(a == 0 && b == 0) zero2++;
    else if(b != 0 && (a == 0 || (a^b) >= 0)){
      u64 ua = std::abs(a);
      u64 ub = std::abs(b);
      reduce(&ua, &ub);
      vp.emplace_back(ua, ub);
    }
    else {
      u64 ua = std::abs(a);
      u64 ub = std::abs(b);
      reduce(&ua, &ub);
      vn.emplace_back(ub, ua);
    }
  }

/*
  auto comp = [](const quot &a, const quot &b){ return (u128) a.first * b.second < (u128) b.first * a.second; };
  std::sort(vp.begin(), vp.end(), comp);
  std::sort(vn.begin(), vn.end(), comp);
  auto equiv = [](const quot &a, const quot &b){ return (u128) a.first * b.second == (u128) b.first * a.second; };
*/

  std::sort(vp.begin(), vp.end());
  std::sort(vn.begin(), vn.end());

  auto comp = std::less<quot>();
  auto equiv = [](const quot &a, const quot &b){ return a == b; };

  std::vector<std::pair<quot, u32> > vpp, vnn;
  quot prev = {1, -1};
  for(auto const &x: vp){
    if(equiv(x, prev)) vpp.back().second++;
    else{
      vpp.emplace_back(quot(x.first, x.second), 1);
      prev = x;
    }
  }
  prev = {1, -1};
  for(auto const &x: vn){
    if(equiv(x, prev)) vnn.back().second++;
    else{
      vnn.emplace_back(quot(x.first, x.second), 1);
      prev = x;
    }
  }

  u64 ans = 1;
  auto ip = vpp.begin(), in = vnn.begin();
  while(ip != vpp.end() && in != vnn.end()){
    if(equiv(ip->first, in->first)){
      ans = ans * (pow2[ip->second] + pow2[in->second] + mod - 1) % mod;
      ++ip, ++in;
    }
    else if(comp(ip->first, in->first)){
      ans = ans * pow2[ip->second] % mod;
      ++ip;
    }
    else {
      ans = ans * pow2[in->second] % mod;
      ++in;
    }
  }
  while(in != vnn.end()){ ans = ans * pow2[in->second] % mod; ++in; }
  while(ip != vpp.end()){ ans = ans * pow2[ip->second] % mod; ++ip; }

  ans = (ans + zero2 + mod - 1) % mod;
  printf("%llu\n", ans);

  return 0;
}


Measured memory_bytes: 13488
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    if(n&1){
    	ll id=1;
    	vector<pair<ll,ll> > v(m);
    	for(int i=0;i<m;i++){
    		v[i].first = id;
    		id++;
    	}
    	id = n/2+1;
    	for(int i=m-1;i>=0;i--){
    		v[i].second = id;
    		id++;
    	}
    	for(auto& i:v){
    		cout << i.first << " " << i.second << endl;
    	}
    	return 0;
    }
    ll a = n/2, b;
    if(a&1) b = a - 1, a -= 2;
    else b = a - 2, a--;
    vector<pair<ll, ll> > v;
    int idx = 1;
    for(ll i=a;i>=1;i-=2,idx++){
    	v.push_back({idx, idx + i});
    }
    idx = a + 2;
    for(int i=b;i>=1;i-=2,idx++){
    	v.push_back({idx, idx + i});
    }
    for(int i=0;i<m;i++){
    	cout << v[i].first << " " << v[i].second << endl;
    }
    return 0;
}


Measured memory_bytes: 5156
N=int(input())

a=list(map(int,input().split()))
a=sorted(a,reverse=True)
Alice=[]
Bob=[]

for index,num in enumerate(a):
    if index%2 == 0:
        Alice.append(num)
    else:
        Bob.append(num)
        

ans=sum(Alice)-sum(Bob)

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repi(i,x,n) for(ll i=x;i<(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
//cin.tie(0);
//ios::sync_with_stdio(false);

long long mpow(long long a, long long n) {//a^n(mod)を求める
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;//次の準備
        n >>= 1;
    }
    return res;
}

signed main(){
    ll n,k;cin>>n>>k;
    string s,t,ans;cin>>s;
    t=s;
    reverse(all(t));
    s+=t;
    vector<string> sub(0);
    for(int i=0;i <= siz(s)-n;i++)
    {
        sub.pb(s.substr(i,n));
    }
    
    sort(all(sub));

    t=sub[0];//辞書順最良

    int ind=0;//length of prefix
    rep(i,siz(t)+1){
        if(i==siz(t)){
            ind=siz(t);
            break;
        }

        if(t[i]!=t[0]){
            ind=i;
            break;
        }
    }
    //cout<<ind<<endl;

    if(k>=13 || ind*mpow(2,k-1)>=n){
        ans=string(n,t[0]);
    }else{
        ans=string(ind*mpow(2,k-1),t[0]);
        ans+=t.substr(ind,n-ind*mpow(2,k-1));
    }

    cout<<ans<<endl;
}


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

#define all(x) 		 (x).begin(),(x).end()
#define mp     		 make_pair
#define pb 				 push_back
#define fi 				 first
#define se 				 second
#define sz(x) 		 ((int)(x).size())
#define rep(x,y,z) for(int x=y;x<z;x++)
#define per(x,z,y) for(int x=z-1;x>=y;x--)
#define trav(y,x)  for(auto& y:x)
#define pii 			 pair<int,int>
#define vi 				 vector<int>

int dbg = 0;
#define cri   		 if(0)
#define shame 		 cri cerr<<(++dbg)<<"\n\n";

// aaaaaaaaaaaaaaaa
const int N = 2e5 + 1;
const int lg = 20;
const ll mod = 0xfffff;


void solve() {
  int n, k;
  cin >> n >> k;

  int x;
  vector<bool> bad(10, 0);
  rep(i, 0, k) {
    cin >> x;
    bad[x] = 1;
  }

  int MAX = 1e5;
  rep(i, n, MAX) {
    bool mk = 1;
    x = i;
    while (x) {
      mk &= !bad[x % 10]; 
      x /= 10;
    }

    if (mk) {
      cout << i << "\n";
      return;
    }
  }
}

int main() {
  // freopen("input.in", "r", stdin);
  // freopen("input.out", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// cout<<setprecision(15);
	// int t; cin>>t; while(t--)
	solve();
	return 0;
}



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

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

int main(void){

    int N, M;

    scanf("%d%d", &N, &M);

    int a[M], b[M], c[M];
    int dist[N][N];

    for(int i = 0; i < M; i++){
        scanf("%d%d%d", &a[i], &b[i], &c[i]);
        a[i]--;
        b[i]--;
    }

    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(i == j){
                dist[i][j] = 0;
            }else{
                dist[i][j] = 1000000000;
            }
        }
    }

    for(int i = 0; i < M; i++){
        dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
        dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
    }

    for(int k = 0; k < N; k++){
        for(int i = 0; i < N; i++){
            for(int j = 0; j < N; j++){
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int ans = M;

    for(int i = 0; i < M; i++){
        int f = 1;
        for(int j = 0; j < N; j++){
            if(dist[j][a[i]] + c[i] == dist[j][b[i]]){
                f = 0;
            }
        }
        if(f == 0){
            ans--;
        }
    }

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

    return 0;
}

Measured memory_bytes: 1744
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#include<iostream>
#include<cstdio>
#include<cstring>
#define ll long long
#define p 1000000007
using namespace std;
namespace ywy{
	int dp[602][302][302];ll jc[602];int ints[602];unsigned char bv[602],can[602];
	void ywymain(){
		int n;cin>>n;for(register int i=1;i<=n*2;i++)cin>>ints[i];
		jc[0]=1;for(register int i=1;i<=n*2;i++)jc[i]=(jc[i-1]*i)%p;int cnt=0;
		for(register int i=1;i<=n*2;i+=2){
			cnt+=(ints[i+1]==-1&&ints[i]==-1);if(ints[i]!=-1&&ints[i+1]!=-1){
				bv[ints[i]]=bv[ints[i+1]]=1;
			}if(ints[i]!=-1)can[ints[i]]=1;if(ints[i+1]!=-1)can[ints[i+1]]=1;
		}dp[n*2+1][0][0]=1;for(register int i=n*2;i>=1;i--){
			if(bv[i]){
				for(register int j=0;j<=n;j++){
					for(register int k=0;j+k<=n;k++)dp[i][j][k]=dp[i+1][j][k];
				}continue;
			}if(can[i]){
				for(register int j=0;j<=n;j++){
					for(register int k=0;j+k<=n;k++){
						if(!dp[i+1][j][k])continue;
						//left(
						if(j)dp[i][j-1][k]=(dp[i][j-1][k]+dp[i+1][j][k])%p;
						//right)
						dp[i][j][k+1]=(dp[i][j][k+1]+dp[i+1][j][k])%p;
					}
				}
			}else{
				for(register int j=0;j<=n;j++){
					for(register int k=0;j+k<=n;k++){
						if(!dp[i+1][j][k])continue;
						//left(
						if(k)dp[i][j][k-1]=(dp[i][j][k-1]+dp[i+1][j][k]*(ll)k)%p;
						if(j)dp[i][j-1][k]=(dp[i][j-1][k]+dp[i+1][j][k])%p;
						//right)
						dp[i][j+1][k]=(dp[i][j+1][k]+dp[i+1][j][k])%p;
					}
				}
			}
		}cout<<(dp[1][0][0]*jc[cnt])%p<<endl;
	}
}
int main(){
	ywy::ywymain();return(0);
}

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

int i,n,flag;
char s[105];


int main()
{
	scanf("%s",s);
	n=strlen(s);
	for(i=0;i<((n-1)/2);i++)
		if (s[i]!=s[n-i-1])
		{	
			flag=-1;
			break; 
		}

	for(i=0;i<(n-1)/4;i++)
		if (s[i]!=s[((n-1)/2)-1-i])
		{
			flag=-1;
			break; 
		}
	for(i=0;i<(n-1)/4;i++)
		if (s[(3+n)/2+i-1]!=s[n-i-1])
		{
			
			flag=-1;
			break; 
		}
	if(flag<0)printf("No");
	else printf("Yes");	
	return 0;
}

Measured memory_bytes: 256
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = ReadLine();
			var line = ReadLine().Split(' ').Select(value => int.Parse(value)).OrderBy(value => value).ToArray();
			WriteLine(line[line.Length - 1] - line[0]);
		}
	}
}


Measured memory_bytes: 13396
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long H = sc.nextLong();
		long W = sc.nextLong();
		
		long s = H * W;
		long s1h = H * W;
		long s1w = H * W;
		long sh3 = H * W;
		long sw3 = H * W;
		
		if(H * W % 3 == 0) {
			System.out.println(0);
		} else {
			sh3 = (H / 3 + 1) * W - H / 3 * W;
			sw3 = (W / 3 + 1) * H - W / 3 * H;
			
			for(long i = 1; i < H; i++) {
				long s1 = i * W;
				long s2 = (H - i) * (W / 2);
				long s3 = 0;
				
				if(W % 2 == 0) {
					s3 = s2;
				} else {
					s3 = (H - i) * (W / 2 + 1);
				}
				
				long stemp = Math.max(Math.max(s1, s2), s3) - Math.min(Math.min(s1,  s2), s3);
				s1h = Math.min(s1h, stemp);
			}
			
			for(long i = 1; i < W; i++) {
				long s1 = i * H;
				long s2 = (W - i) * (H / 2);
				long s3 = 0;
				
				if(H % 2 == 0) {
					s3 = s2;
				} else {
					s3 = (W - i) * (H / 2 + 1);
				}
				
				long stemp = Math.max(Math.max(s1, s2), s3) - Math.min(Math.min(s1,  s2), s3);
				s1w = Math.min(s1w, stemp);
			}
			
			s = Math.min(Math.min(Math.min(sh3, sw3), s1h), s1w);
			System.out.println(s);
		}
	}
}

Measured memory_bytes: 21972
K = int(input())

ls = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(ls[K-1])

Measured memory_bytes: 38256
import scala.io.StdIn._
object Main extends App {
  val n = readInt
  val abs = Array.fill(n)(readLine.split(" ").map(_.toLong)).sortBy(_(1))
  val result = abs.foldLeft(0L){case (z, Array(a, b)) => if (z + a > b) Int.MaxValue else z + a}
  println(if (result == Int.MaxValue) "No" else "Yes")
}

Measured memory_bytes: 124968
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
  vector<ll> v;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.push_back(i);
      if(i*i != n) v.push_back(n/i);
    }
  }
  sort(ALL(v));
  return v;
}

int main() {
    ll n;
    cin>>n;
    vector<ll> a(n),b(n),c(n-1);
    cin>>a>>b>>c;
    ll sum = 0;
    ll last = 9999;
    rep(i,n){
        sum += b[a[i]-1];
        if(last == a[i]-2) sum += c[a[i]-2];
        last = a[i] -1;
    }
    pr(sum);
}


Measured memory_bytes: 256
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

//for A以上B未満でI探索 for (int I = A; i <= B; i++)
//string s = to_string(i);
int a = 0, b = 0, c = 0, x = 0, y = 0, z = 0, n = 0, sum = 0, i = 0;
string s = ""; asas; cncn;

int main(void) {
	int d;
	cin >> a >> b >> c >> d;
	x = a * b;
	y = c * d;
	sec(x, y,x >= y);
	please AC;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using namespace std;
using ll = long long;
typedef std::pair<int,int> P;
//#include <boost/multiprecision/cpp_int.hpp>
//using bint = boost::multiprecision::cpp_int;



int main(){
    ll n,d,a;
    cin >> n >> d >> a;
    d = d*2ll;
    vector<P> p(n);
    rep(i,n) cin >> p[i].first >> p[i].second;
    SORT(p);
    ll tot = 0;
    ll damage = 0;
    ll ans = 0;
    queue<pair<ll,ll>> q;
    rep(i,n){
        ll x = p[i].first;
        ll h = p[i].second;
        
        while(q.size() && q.front().first < x){
            tot -= q.front().second;
            q.pop();
        }
        h -= tot;
        
        if (h>0){
            ll count = (h+a-1)/a;
            ans += count;
            damage = count*a;
            tot+=damage;
            q.push(mp(x+d,damage));
        }
        
    }
    cout << ans;
}


Measured memory_bytes: 3456
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using uint = uint32_t;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	int n;
	cin >> n;
	vector<int> cnt(n + 1);
	for(int i = 1; i <= n; i++)
		for(int j = i; j <= n; j += i)
			cnt[j]++;
	ll ans = 0;
	for(int i = 1; i <= n; i++)
		ans += cnt[n - i];
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 7156
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<iostream>
#include<map>
#include<cstring>
#define INF 0x3f3f3f3f
using namespace std;
vector <tuple<int,int,int>>relation;
set<int> pa;
set<int> pb;
int n,ma,mb,suma,sumb,a[50],b[50],c[50],maxc,maxa,maxb,ans=INF;
int dp[45][405][405];
int main(){
    scanf("%d%d%d",&n,&ma,&mb);
    for(int i=1;i<=n;i++){
        scanf("%d%d%d",&a[i],&b[i],&c[i]);
        maxc+=c[i];
        maxa+=a[i];
        maxb+=b[i];
    }
    for(int i=0;i<=n;i++)
        for(int j=0;j<=400;j++)
            for(int k=0;k<=400;k++){
                dp[i][j][k]=INF;
            }
    for(int i=0;i<=n;i++)
    dp[i][0][0]=0;
    for(int i=1;i<=n;i++)
        for(int j=0;j<=maxa;j++)
            for(int k=0;k<=maxb;k++){
                dp[i][j][k]=dp[i-1][j][k];
                if(dp[i-1][j-a[i]][k-b[i]]==INF)
                    continue;
                if(j>=a[i]&&k>=b[i])
                    dp[i][j][k]=min(dp[i][j][k],dp[i-1][j-a[i]][k-b[i]]+c[i]);
                /*if(dp[i][j][k]!=INF)
                printf("dp[%d][%d][%d]=%d\n",i,j,k,dp[i][j][k]);*/
            }
    for(int i=1;i<=maxa;i++)
        for(int j=1;j<=maxb;j++)
            if(i*mb==j*ma){
                ans=min(ans,dp[n][i][j]);
            }
    if(ans==INF)
        ans=-1;
    printf("%d",ans);
}


Measured memory_bytes: 29328
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	int n,m,l;
	ll int a[100][100];
	ll int b[100][100];
	ll int c[100][100];
	cin >> n >> m >> l;
	REP(i,n) REP(j,m) cin >> a[i][j];
	REP(i,m) REP(j,l) cin >> b[i][j];
	REP(i,n){
		REP(j,l){
			ll int sum = 0;
			REP(k,m){
				sum += a[i][k]*b[k][j];
			}
			c[i][j] = sum;
		}
	}
	REP(i,n){
		REP(j,l){
			cout << c[i][j];
			if(j!=l-1) cout << " ";
		}
		cout << endl;
	}
}

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

const int MAXN = 1e5;
const int INF = 1e9;

int N;
long long A[MAXN + 10];


long long lg(long long x) {
   int cc = 0;
   while(x > 1) {
      x >>= 1;
      cc++;
   }
   return cc;
}

bool cnt[40];

int main() {
   scanf("%d", &N);
   for(int i = 0; i < N; i++) {
      scanf("%lld", &A[i]);
      if((A[i] & (A[i] - 1LL)) == 0LL) {
         cnt[lg(A[i])] = true;
      }
   }
   int cc = N;
   for(int i = 0; i < N; i++) {
      if(A[i] % 2 == 0) cc--;
   }
   long long xr = 0;
   for(int i = 0; i < N; i++) {
      xr ^= A[i];
   }
   int res = 0;
   for(long long i = 30; i > 0; i--) {
      if(xr & (1LL << i)) {
         if(!cnt[i]) {
            printf("-1\n");
            exit(0);
         }
         xr ^= 1LL << i;
         xr ^= (1LL << i) - 1LL;
         res++;
      }
      for(int j = 0; j < N; j++) {
         A[j] &= ~(1 << i);
         if(A[j] > 1 && (A[j] & (A[j] - 1LL)) == 0LL) {
            cnt[lg(A[j])] = true;
         }
      }
   }
   if(xr == 0LL) printf("%d\n", res);
   else if(xr == 1LL && cc > 0LL) printf("%d\n", res+1);
   else printf("-1\n");
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
//#define INF 0x3f3f3f3f
#define INF 2147483647
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int SIZE=305;
//int arr[SIZE]={};
//???????????§???????????¬
//???????°????????±???????SegmentTree
struct SegmentTreeMin {
private:
    int n;
    vector<int> node;

public:
    // ????????? v ????????°???????????¨??§??¨?????????
    SegmentTreeMin(vector<int> v) {
        // ???????????????????????°??????????????????????????\????????????????°???? 2 ??? -> ????????? n ??¨??????
        // ?????°???????????¨??¨?????§????????????????????°??? 2n-1 ?????§??????
        int sz = v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, INF);

        // ????????????????????\???????????¨??????????????????????????????????????\??????
        // ????????\?????????????????????????????? 2 ???????????§????????°??????
        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = min(node[2*i+1], node[2*i+2]);
    }
	void update(int x, int val) {
		// ??????????????????????????¢???????????????
		x += (n - 1);

		// ??????????????????????????´??°?????????????????¨??????????????£?????´??°????????????
		node[x] = val;
		while(x > 0) {
			x = (x - 1) / 2;
			node[x] = min(node[2*x+1], node[2*x+2]);
		}
	}
	int getmin(int a, int b, int k=0, int l=0, int r=-1) {
		// ?????????????????????????????¨??????????±?????????? [0, n)
		if(r < 0) r = n;

		// ????±?????????¨????±????????????????????????? -> ???????????????
		if(r <= a || b <= l) return INF;

		// ????±??????????????±???????????????¨????¢???? -> ????±????????????????????¨?????????????
		if(a <= l && r <= b) return node[k];

		// ????±??????????????±???????????????¨????¢???? -> ?????????????????¢?´¢?????????
		// ?????´????????? vl ??? ?????´????????? vr ??¨????????????
		// ??°??????????±??????????????????¨???????±????????????????????????£?????????
		int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
		int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
		return min(vl, vr);
	}
};
//???????°????????±???????SegmentTree
vector<int> node;
signed main(){
    int N,Q;
    cin>>N>>Q;
    for(int i=0;i<N;i++){
        node.push_back(INF);
    }
    SegmentTreeMin mini(node);
    for(int i=0;i<Q;i++){
        int a,b,c;
		cin>>a>>b>>c;
        if(a){
            cout<<mini.getmin(b,c+1)<<endl;
        }
        else{
            mini.update(b,c);
        }
    }
    return 0;
}

Measured memory_bytes: 4708
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;

long long K, X, D;

int main(){
    cin >> X >> K >> D;
    X = abs(X);
    
    long long a = floor(X/D);
    long long ans = 0;
    
    if(a > K){
        ans = abs(X - K*D);
    }else{
        if(K%2 == a%2){
            ans = abs(X-a*D);
        }else{
            ans = abs(X-(a+1)*D);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3592
N, M = map(int, input().split())
MOD = 10 ** 9 + 7

if abs(N - M) > 1:
  ans = 0
elif N == M:
  ans = 2
  for i in range(1, N + 1):
    ans = (ans * i * i) % MOD
else:
  A = max(N, M)
  ans = 1
  for i in range(1, A):
    ans = (ans * i * i) % MOD
  ans = ans * A
print(int(ans % MOD))

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

//int main(int argc, const char * argv[]) {
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    
    if (a < b && b < c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3084
#include <iostream>

using namespace std;

int blocks[101];

void solve() {
	int n = 0;
	int up = 0, down = 0;
	while (blocks[n + 1] != -1) {
		int a = blocks[n + 1] - blocks[n];
		if (a > up) up = a;
		if (a < down) down = a;
		n++;
	}
	cout << up << " " << -down << endl;
}


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

	int t, n;
	cin >> t;
	for (int i = 0; i < t; i++) {
		cin >> n;
		for (int j = 0; j < n; j++)
			cin >> blocks[j];
		blocks[n] = -1;
		solve();
	}

}

Measured memory_bytes: 1196
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;
map<ll, ll> h_m, w_m;
set<pair<ll, ll>> s;

int main() {
  ll H, W, M;
  cin >> H >> W >> M;
  vector<ll> h(M), w(M);
  for (int i = 0; i < M; i++) {
    cin >> h[i] >> w[i];
    h_m[h[i]]++;
    w_m[w[i]]++;
    s.insert({h[i], w[i]});
  }
  ll best_h = h[0], h_score = h_m[h[0]];
  for (auto p : h_m) {
    if (h_score < p.second) {
      best_h = p.first;
      h_score = p.second;
    }
  }
  ll best_w = w[0], w_score = w_m[w[0]];
  for (auto p : w_m) {
    if (w_score < p.second) {
      best_w = p.first;
      w_score = p.second;
    }
  }
  ll ans = 0;
  for (int i = 1; i <= W; i++) {
    if (s.count({best_h, i})) {
      ans = max(h_score + w_m[i] - 1, ans);
    } else {
      ans = max(h_score + w_m[i], ans);
    }
  }
  for (int i = 1; i <= H; i++) {
    if (s.count({i, best_w})) {
      ans = max(w_score + h_m[i] - 1, ans);
    } else {
      ans = max(w_score + h_m[i], ans);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 64224
import sys
readline = sys.stdin.readline

def main():
    N, K = map(int, readline().rstrip().split())
    D = set(readline().rstrip().split())
    for i in range(N, N*10+1):
        d = str(i)
        flg = True
        for e in d:
            if e in D:
                flg = False
                break
        
        if flg:
            print(i)
            return


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
constexpr int mo2 = 998244353;
constexpr ll infl = 1ll<<60;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int m,d;
    cin>>m>>d;
    int m2,d2;
    cin>>m2>>d2;
    if(m2 != m) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}



Measured memory_bytes: 892