akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define ff first
#define ss second
#define setbits(x)          __builtin_popcountll(x)
#define lp(a,n) for(ll i=a; i<n; i++)
#define lpi(a,n) for(int i=a; i<n; i++)
#define w(t) int t; cin>>t; while(t--)
#define vi vector<int> 
#define vll vector<ll>
#define pll pair<ll, ll>
#define pii pair<int, int>
#define inf 1e9
#define LB lower_bound
#define UB upper_bound
const int mod = 1000000007;
using namespace std;
ll gcd(ll a,ll b){
    if(a==0)return b;
    return gcd(b%a,a);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}

int prime[100007];
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, -1, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
         
        if (prime[p] == -1) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = p; 
        } 
    } 
    
} 
int lps(string s){
    int len = 0;
    int n = s.length();
    int dp[n];
    dp[0] = 0;
    for(int i=1; i<n; i++){
        if(s[i] == s[len]){
            len++;
            dp[i] = len;
            continue;
        }
        if(len!=0){
            len = dp[len-1];
            i--;
            continue;
        }
        dp[i]=0;
    }
    return dp[n-1];
}
 
ll power(unsigned ll x,unsigned  ll y) 
{ 
    ll res = 1;     
    while (y > 0) 
    { 
        if (y & 1) 
            res = res*x; 
   
        y = y>>1;
        x = x*x;  
    } 
    return res; 
}

//to calculate p1^x  *  p2^x2  *p3^x3 ----------
//i.e. prime factorization and store pi and xi in vector 
vector<pair<ll, ll>> pFactor;

void factorize(long long n) 
{ 
    int count = 0; 
  
    // count the number of times 2 divides  
    while (!(n % 2)) { 
        n >>= 1; // equivalent to n=n/2; 
        count++; 
    } 
  
    // if 2 divides it 
    if (count) 
        pFactor.pb({2,count}); 
  
    // check for all the possible numbers that can  
    // divide it 
    for (long long i = 3; i <= sqrt(n); i += 2) { 
        count = 0; 
        while (n % i == 0) { 
            count++; 
            n = n / i; 
        } 
        if (count) 
            pFactor.pb({i,count});
    } 
  
    // if n at the end is a prime number. 
    if (n > 2) 
        pFactor.pb({n,1}); 
} 



int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
    ll n, x, m;
    cin>>n>>x>>m;
    if(m==1){
        cout<<"0";
        return 0;
    }
    ll ans =x, i;
    vll v;
    map<ll, bool> mp;
    mp[x] = true;
    v.pb(x);
    for( i=2; i<=n; i++){
        x = (x*x)%m;
        if(mp.count(x)!=0){
            break;
        }
        ans += x;
        mp[x] = true;
        v.pb(x);
        if(x==0){
            break;
        }

    }
    if(i<n and x!=0){
        ll ind;
        for(int j=0; j<v.size(); j++){
            if(v[j]==x){
                ind = j;
                break;
            }
        }
        for(int j=v.size()-2; j>=0; j--){
            v[j] += v[j+1];
        }
        ll size = v.size()- ind, moves = n-i+1;
        ans += (moves/size)*v[ind];
        if(moves%size!=0)
        ans += (v[ind] - v[ind+moves%size]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6664
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// solution 
use std::cmp;
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        N: usize,
        H: [usize; N],
    }

    let mut count = 0;
    let mut max = 0;
    for ind in 0..N {
        if max <= H[ind] {
            count += 1;
            max = H[ind];
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-10;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int A[110000];
int B[110000];
int p[110000];
int q[110000];
int UF[110000];
int FIND(int a){
	if(UF[a]<0)return a;
	return UF[a]=FIND(UF[a]);
}
void UNION(int a,int b){
	a=FIND(a);b=FIND(b);if(a==b)return;
	UF[a]+=UF[b];UF[b]=a;
}
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		scanf("%d",A+i);
	}
	for(int i=0;i<a;i++){
		scanf("%d",B+i);
	}
	int S=0;
	int T=0;
	for(int i=0;i<a;i++){
		S^=A[i];
		T^=B[i];
	}
	A[a]=S;B[a]=T;
	a++;
	for(int i=0;i<a;i++){
		p[i]=A[i];q[i]=B[i];
	}
	std::sort(p,p+a);std::sort(q,q+a);
	for(int i=0;i<a;i++){
		if(p[i]!=q[i]){
			printf("-1\n");return 0;
		}
	}
	for(int i=0;i<a;i++)UF[i]=-1;
	int ret=0;
	for(int i=0;i<a-1;i++){
		if(A[i]!=B[i]){
			ret++;
			UNION(lower_bound(p,p+a,A[i])-p,lower_bound(p,p+a,B[i])-p);
		}
	}
	for(int i=0;i<a;i++)if(i==0||p[i]!=p[i-1])if(UF[i]<-1)ret++;
	if(UF[FIND(lower_bound(p,p+a,A[a-1])-p)]!=-1){
		ret--;
	}
	printf("%d\n",ret);
}

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

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

int main()
{
    int t; t=1;     
    while(t--)
    {
        int a,b; cin>>a>>b;
        cout<<max(a+b,max(a-b,a*b));
    }
    return 0;
}

Measured memory_bytes: 256
program main
  implicit none
  integer(8) i,N,ans
  integer(8),allocatable :: H(:)
  read(*, *)N
  allocate(H(N))
  read(*, *) (H(i), i = 1,N)
  ans = 1
  H(1) = H(1)-1
  do i = 2,N
    if (H(i-1) <= H(i)-1) then
      H(i) = H(i)-1
    elseif (H(i-1) > H(i)) then
      ans = 0
    endif
  enddo
  if (ans == 1) then
    write(*, *) 'Yes'
  else
    write(*, *) 'No'
  end if
end program main


Measured memory_bytes: 1536
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PII;
const ll MOD = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
//head
char str[maxn]; 
int nxt[maxn][30], dp[maxn];

void solve(){
	memset(nxt, -1, sizeof(nxt));
	int len = strlen(str + 1);
	for(int i = len - 1; i >= 0; i--){
		for(int j = 0; j < 26; j++){
			nxt[i][j] = (str[i + 1] == 'a' + j)? i + 1: nxt[i + 1][j];
		}
	}
	memset(dp, 0x3f, sizeof(dp));
	for(int i = len; i >= 0; i--){
		bool flag = false;
		for(int j = 0; j < 26; j++){
			if(nxt[i][j] == -1){
				flag = true;
				dp[i] = 1;
				break;
			}
		}
		if(flag) continue;
		for(int j = 0; j < 26; j++){
			if(nxt[i][j] != -1)
				dp[i] = min(dp[i], dp[nxt[i][j]] + 1);
		}
	}
	for(int i = 0; i <= len; ){
		if(dp[i] == 1){
			for(int j = 0; j < 26; j++) {
				if(nxt[i][j] == -1){
					printf("%c", j + 'a');
					break;
				}
			}
			break;
		}
		for(int j = 0; j < 26; j++) {
			if(nxt[i][j] != -1 && dp[i] == dp[nxt[i][j]] + 1){
				printf("%c", j + 'a');
				i = nxt[i][j];
				break;
			}
		}
		
	}
	printf("\n");
}
int main(){
	scanf("%s", str + 1);
	solve();
}






Measured memory_bytes: 24704
n = gets.to_i
n.times {
  x1, y1, x2, y2, x3, y3 = gets.split.map(&:to_f)

  def solve(a, b, c, d, e, f)
    z = a*e - b*d 
    x = (c*e-f*b)/z + 0.000
    y = (f*a-c*d)/z + 0.000
    return x, y
  end 

  x, y = solve(
    2*(x1 - x2), 2*(y1 - y2), x1**2 + y1**2 - (x2**2 + y2**2),
    2*(x1 - x3), 2*(y1 - y3), x1**2 + y1**2 - (x3**2 + y3**2)
  )

  r = Math::sqrt((x - x1)**2 + (y - y1)**2)
  puts sprintf("%.3f %.3f %.3f", x, y, r)
}

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

int main() {
  int N,M;
  cin >> N;
  M = N;
  int f = 0;
  for (int i = 0; i < 9; i++){
    f += M % 10;
    M = M / 10;
  }
  if (N % f == 0){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



long long mul_inv(long long a, long long b)
{
	long long b0 = b, t, q;
	long long x0 = 0, x1 = 1;
	if (b == 1) return 1;
	while (a > 1) {
		q = a / b;
		t = b, b = a % b, a = t;
		t = x0, x0 = x1 - q * x0, x1 = t;
	}
	if (x1 < 0) x1 += b0;
	return x1;
}

long long division(long long a, long long b, long long p) {		// (a / b) mod p = ((a mod p) * (b^(-1) mod p)) mod p
	long long ans, inv;
	inv = mul_inv(b, p);
	ans = ((a % p) * inv) % p;
	return ans;
}

vector<long long> fact;

long long comb(long long a, long long b, long long p) {
	long long aa = division(fact[a], fact[b], p);
	long long ans = division(aa, fact[a - b], p);
	return ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	long long MOD = 1000000007, n, m, a, b, i, j, k, ans, aa, bb;
	cin >> n >> m >> a >> b;
	fact.resize(n + m + 2);
	fact[0] = 1;
	for (i = 1; i < n + m + 2; i++) fact[i] = (fact[i - 1] * i) % MOD;

	ans = 0;
	for (i = 1; i <= n - a; i++) {
		aa = comb(i - 1 + b - 1, i - 1, MOD);
		bb = comb(n - i + m - b - 1, n - i, MOD);
		ans = (ans + aa * bb) % MOD;
	}
	
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
// const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1},
//           dx[] = {0, -1, -1, -1, 0, 1, 1, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
int main() {
  const int V = 10000;
  int h, w; cin >> h >> w;
  vector<vector<int> > a(h, vector<int>(w)), b(h, vector<int>(w));
  REP(i, h) REP(j, w) cin >> a[i][j];
  REP(i, h) REP(j, w) cin >> b[i][j];
  vector<vector<int> > diff(h, vector<int>(w));
  REP(i, h) REP(j, w) diff[i][j] = abs(a[i][j] - b[i][j]);
  vector<vector<vector<bool> > > dp(h, vector<vector<bool> >(w, vector<bool>(2 * V + 1, false)));
  dp[0][0][V + diff[0][0]] = true;
  dp[0][0][V - diff[0][0]] = true;
  REP(i, h) REP(j, w) {
    if (i == h - 1 && j == w - 1) break;
    if (i + 1 < h) {
      REP(k, 2 * V + 1) if (dp[i][j][k]) {
        if (k + diff[i + 1][j] <= 2 * V) dp[i + 1][j][k + diff[i + 1][j]] = true;
        if (k - diff[i + 1][j] >= 0) dp[i + 1][j][k - diff[i + 1][j]] = true;
      }
    }
    if (j + 1 < w) {
      REP(k, 2 * V + 1) if (dp[i][j][k]) {
        if (k + diff[i][j + 1] <= 2 * V) dp[i][j + 1][k + diff[i][j + 1]] = true;
        if (k - diff[i][j + 1] >= 0) dp[i][j + 1][k - diff[i][j + 1]] = true;
      }
    }
  }
  for (int ans = 0; ; ++ans) {
    if (dp[h - 1][w - 1][V + ans] || dp[h - 1][w - 1][V - ans]) {
      cout << ans << '\n';
      return 0;
    }
  }
}


Measured memory_bytes: 16512
import java.util.Scanner;
	class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
            int b = sc.nextInt();
            int d = a/b;
            int r = a%b;
            double f = (double)a/b;
            System.out.printf(d + " " + r + " " + "%.5f\n", f);
            
            sc.close();
        }
    }


Measured memory_bytes: 26516
#include <stdio.h>

int main(void){
    int n;
    scanf("%d", &n);

    char s[n];
    scanf("%s", s);

    int m = n / 2;
    if(n % 2 != 0){
        printf("No");
        return 0;
    }else{
        for(int i=0; i<m; i++){
            if(s[i] != s[i+m]){
                printf("No");
                return 0;
            }
        }
    }

    printf("Yes");

}

Measured memory_bytes: 128
import sys

read= sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 1000000007
sys.setrecursionlimit(10**7)

#N,*A = map(int,read().split())
N = int(input())
A = list(map(int,input().split()))

State = 0
res = 1

for i in range(1,N):
    if A[i] > A[i-1]:
        X = 1
    elif A[i] == A[i-1]:
        X = 0
    else :
        X = -1

    #前と同じ状態の時
    if X == State:
        continue
    
    if  State == 0:
        State = X

    if X != State  and  X != 0:
        res += 1
        State = 0

print(res)

Measured memory_bytes: 14484
#include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair <int,int> PAIR;
const int N = 2e5+5;
const ll M = 998244353;

ll C[N];

inline ll qpow(ll a,ll b){
	ll res = 1;
	a %= M;
	while(b){
		if(b & 1) (res *= a) %= M;
		(a *= a) %= M;
		b >>= 1;
	}
	return res%M;
}
inline ll inv(ll a){
	return qpow(a,M-2);
}

inline void C_table(ll n){
	C[0] = 1ll;
	C[1] = n;

	for(int i = 2;i <= n;++i){
		C[i] = C[i-1]%M * (ll)(n-i+1)%M * inv(i)%M;
		C[i] += M;
		C[i] %= M; 
	}
	return ;
}

int main() {
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	C_table(n-1);
	
	ll ans = 0;
	for(int i = 0;i <= k;++i){
		int t = n-1-i;
		
		ll l = C[t];
		ll r = t+1;
		
		l = l*(ll)m%M;
		r--;
		l = l*qpow(m-1,r)%M;
		(ans += l) %= M;
		(ans += M) %= M;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 5316
A, B, C, X, Y = map(int, input().split())

cost = 0
if (A+B)/2 > C:
    cost = 2*C*min(X, Y)
    if X > Y:
        X = X - Y
        if A > 2*C:
            cost += 2*C*X
        else:
            cost += A*X
    else:
        Y = Y - X
        if B > 2*C:
            cost += 2*C*Y
        else:
            cost += B*Y
else:
    cost = A*X + B*Y
print(cost)

Measured memory_bytes: 3064
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <typeinfo>
#include <cmath>
#include <numeric>
#include <queue>
#include <set>
using namespace std;
// using Data = pair<long long, vector<int>>; //組み合わせを表現するクラス pair

struct OisisaData
{
    long long oisisa;
    std::vector<int> abc;
    
    bool operator >(const OisisaData &another) const
    {
        return (oisisa < another.oisisa);
    };
};

int main()
{
    //最悪のケースからかかる時間を予測する
    long long X, Y, Z, K; //32bit seisu
    std::cin >> X >> Y >> Z >> K;
    std::vector<long long> a(X), b(Y), c(Z);
    std::vector<int> abc_size(3);
    
    for (int i = 0; i < X; ++i) std::cin >> a[i];    
    for (int i = 0; i < Y; ++i) std::cin >> b[i];
    for (int i = 0; i < Z; ++i) std::cin >> c[i];

    abc_size[0] = a.size();
    abc_size[1] = b.size();
    abc_size[2] = c.size();
    
    sort(a.begin(), a.end(), greater<long long>());
    sort(b.begin(), b.end(), greater<long long>());
    sort(c.begin(), c.end(), greater<long long>());
    
    priority_queue<OisisaData, std::vector<OisisaData>, std::greater<OisisaData>> que; //一要素がDataな優先
    std::set<vector<int>> flag;
    
    que.push((OisisaData){a[0] + b[0] + c[0], vector<int>({0, 0, 0})});
    flag.insert(vector<int>({0, 0, 0}));
    for (int iter = 0; iter < K; ++iter)
    {
        /* code */
        OisisaData top = que.top();
        std::cout << top.oisisa << "\n";
        que.pop();
        for (int i = 0; i < 3; ++i)
        {
            OisisaData tmp = top;
            
            if(tmp.abc[i] == abc_size[i] - 1) continue;
            tmp.abc[i] += 1;
            // std::cout << tmp.abc[0] << tmp.abc[1] << tmp.abc[2] << "\n";
            tmp.oisisa = a[tmp.abc[0]] + b[tmp.abc[1]] + c[tmp.abc[2]]; 
            // std::cout << tmp.oisisa << "\n";
            // まだ追加されていなければ追加する
            if(!flag.count(tmp.abc)){
                que.push(tmp);
                flag.insert(tmp.abc);
            }
        }
    }
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int64_t ans = 0;
    int MaxNum = 0;
    for (int i = 0; i < N; i++) {
        MaxNum = max(MaxNum, A[i]);
        int Bi = MaxNum;
        ans += Bi - A[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3972
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	public static void main(String [] args) {
		
		Scanner scan = new Scanner(System.in);
		ArrayList<String> charcter = new ArrayList<String>();
		final String END = "END_OF_TEXT";
		int count = 0;
		int i = 0;
		String sentence;
		
		String word = scan.nextLine();
		
		do {
			
			sentence = scan.next();
			charcter.add(sentence);
			
			if (sentence.equals(END)) break;
			
			if ( sentence.equalsIgnoreCase(word)) count++;
			
		} while(scan.hasNext());
		
		System.out.println(count);
		
	}
}


Measured memory_bytes: 26348
import math
A,B,H,M = map(int,input().split())
HR = (M * 360)/60
MR = (H * 60 + M)*360/(12*60)
d = abs(MR - HR)
if(H == 5*M):
    print(str(abs(B-A)))
else:
    ans = ((A**2 + B**2) - (2*A*B*math.cos(math.radians(d))))**(1/2)
    print(str(ans))

Measured memory_bytes: 9524
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int m = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
    str = in.readLine().split(" ");
    int[] b = new int[m];
    int[][] a = new int[n][m];
    int count = 0;
    for(int i=0; i<m; i++) {
      b[i] = Integer.parseInt(str[i]);
    }
    for(int i=0; i<n;i++) {
      str = in.readLine().split(" ");
      int sum = 0;
      for(int j=0; j<m; j++) {
        a[i][j] = Integer.parseInt(str[j]);
        sum += a[i][j] * b[j];
      }
      if(sum+c>0){
        count+=1;
        sum = 0;
      }
    } 
    System.out.println(count);
  }
}

Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <string>

int main(){
	int q;
	std::string a, b;
	std::vector< std::vector< int > > dp;
	
	dp.resize(1001);
	for(int i=0;i<=1000;++i){
		dp[i].resize(1001);
	}
	
	std::cin >> q;
	
	for(int i=0;i<q;++i){
		std::cin >> a >> b;
		
		for(int x=1;x<=a.length();++x){
			for(int y=1;y<=b.length();++y){
				if(a[x-1] == b[y-1]){
					dp[x][y] = std::max(std::max(dp[x - 1][y - 1] + 1, dp[x][y - 1]), dp[x - 1][y]);
				}else{
					dp[x][y] = std::max(std::max(dp[x - 1][y - 1], dp[x][y - 1]), dp[x - 1][y]);
				}
			}
		}
		std::cout << dp[a.length()][b.length()] << std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 5156
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String[] in = s.nextLine().split(" ");
        int S = Integer.parseInt(in[0]);
        int W = Integer.parseInt(in[1]);

        if (W >= S) {
            System.out.println("unsafe");
        } else {
            System.out.println("safe");
        }
    }
}

Measured memory_bytes: 35712
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define x first
#define y second

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;

template <class T>
void read(T &x)
{
	char ch;
	for (ch=getchar();(ch<'0'||ch>'9')&&ch!='-';) ch=getchar();
	x=0;int t=1;if (ch=='-') {ch=getchar();t=-1;}
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	x*=t;
}

char a[2010],b[2010];
int l[2010],r[2010],g[2010];
bool v[2010];
pii w[2010];

int main()
{
	scanf("%s",a);int n=strlen(a);
	scanf("%s",b);
	bool ok=1;for (int i=0;i<n;i++) if (b[i]=='1') ok=0;
	if (ok)
	{
		for (int i=0;i<n;i++) if (a[i]=='1') ok=0;
		if (ok) puts("0"); else puts("-1");return 0;
	}
	for (int i=0;i<n;i++)
		if (b[i]=='1')
		{
			int j=(i+1)%n;
			while (b[j]=='0') {l[j]=(j-i+n)%n;j=(j+1)%n;}
			j=(i-1+n)%n;
			while (b[j]=='0') {r[j]=(i-j+n)%n;j=(j-1+n)%n;}
		}
	int ans=10*n*n;
	memset(v,0,sizeof(v));
	for (int i=0;i<n;i++)
	{
		int s=i,m=0;
		for (int j=0;j<n;j++)
		{
			if (b[(i+j)%n]=='1') v[j]=1;
			if (v[j]==0&&a[j]!=b[(i+j)%n]) w[m++]=mp(l[j],r[(i+j)%n]);
			if (a[j]!=b[(i+j)%n]) s++;
		}
		int t=0;
		if (m>0)
		{
			sort(w,w+m);
			g[m]=0;for (int j=m-1;j>=0;j--) g[j]=max(g[j+1],w[j].y);
			t=g[0];
			for (int j=0;j<m;j++) t=min(t,g[j+1]+w[j].x);
		}
		ans=min(ans,s+2*t);
	}
	memset(v,0,sizeof(v));
	for (int i=0;i<n;i++)
	{
		int s=i,m=0;
		for (int j=0;j<n;j++)
		{
			if (b[(j-i+n)%n]=='1') v[j]=1;
			if (v[j]==0&&a[j]!=b[(j-i+n)%n]) w[m++]=mp(r[j],l[(j-i+n)%n]);
			if (a[j]!=b[(j-i+n)%n]) s++;
		}
		int t=0;
		if (m>0)
		{
			sort(w,w+m);
			g[m]=0;for (int j=m-1;j>=0;j--) g[j]=max(g[j+1],w[j].y);
			t=g[0];
			for (int j=0;j<m;j++) t=min(t,g[j+1]+w[j].x);
		}
		ans=min(ans,s+2*t);
	}
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007
//#define DEBUG

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(array, 10, sizeof(int), compare_int)

int main(){
	int n;
	char color[200100];
	scanf("%d", &n);
	for(int i=0; i<n; i++) scanf(" %c", &color[i]);

	int left=0, right=n-1;
	int count = 0;
	
	while((color[left] == 'R') && (left<n)) left++;
	while((color[right] == 'W') && (right>=0)) right--;
	while(left<right){
		color[left] = 'R';
		color[right] = 'W';
		count++;
		while((color[left] == 'R') && (left<n)) left++;
		while((color[right] == 'W') && (right>=0)) right--;
	}
	
	printf("%d\n", count);

	
	return 0;
}



Measured memory_bytes: 1880
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n;
  cin >> n;
  V a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (i == n) {
      cnt++;
      break;
    }
    if (a[i] == a[i+1]) {
      i++;
      continue;
    }
    cnt++;
  }
  dump(cnt);
  return 0;
}


Measured memory_bytes: 640
parseInt(x) = parse(Int,x)

parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    A,B,K = readline() |> split |> parseMap
    for i in 1:K
        if i%2==1 
      B+=Int(floor(A/2)) 
      A=Int(floor(A/2))
        else 
      A+=Int(floor(B/2))
      B=Int(floor(B/2))
    end
    end
    print(A)
    print(' ')
    println(B)
end

main()

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

typedef long long LL;
static LL INF = (1LL<<62);

int lbound(vector<long long>&v, long long b){
	int s = 0, e = v.size() - 1;
	int l = v.size();
	int m;
	while(e - s > 1){
		m = (s + e) / 2;
		if(v[m] >= b){
			e = m;
		}
		else{
			s = m;
		}
	}
	if(v[max(s - 1, 0)] >= b) return max(s - 1, 0);
	else if(v[s] >= b) return s;
	else if(v[min(s + 1, l - 1)] >= b) return min(s + 1, l - 1);
	else return v.size();
}

LL A, B, Q;
vector<LL> S, T;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> A >> B >> Q;

	for(int i=0; i<A; i++){
		LL s;
		cin >> s;
		S.push_back(s);
	}

	for(int i=0; i<B; i++){
		LL t;
		cin >> t;
		T.push_back(t);
	}
	
	sort(S.begin(), S.end());
	sort(T.begin(), T.end());

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

		LL d1 = 0, d2 = 0, d3 = 0, d4 = 0;;
		int ps, pt;
		int s, t;

		s = lbound(S, x);
		t = lbound(T, x);
		if( s == S.size() || t == T.size() ){
			d1 = INF;
		}
		else{
			ps = min(s, (int)S.size()-1);
			pt = min(t, (int)T.size()-1);
			d1 += max(abs(S[ps]-x), abs(T[pt]-x));
		}

		if(x < S[0] || x < T[0]){
			d2 = INF;
		}
		else{
			ps = max(s - 1, 0);
			pt = max(t - 1, 0);
			d2 += max(abs(S[ps]-x), abs(T[pt]-x));
		}

		if(s == S.size() && t == T.size()){
			d3 = INF;
		}
		else if(s == S.size()){
			d3 += abs(T[t] - x);
			d3 += abs(S[s-1] - T[t]);
		}
		else if(t == T.size()){
			d3 += abs(S[s] - x);
			d3 += abs(T[t-1] - S[s]);
		}
		else{
        	ps = min(s, (int)S.size()-1);
        	pt = min(t, (int)T.size()-1);
        	if(S[ps] < T[pt]){
        		d3 += abs(S[ps] - x);
        		int p = max(lbound(T, S[ps]) - 1, 0);
        		d3 += abs(T[p] - S[ps]);
        	}
        	else{
        		d3 += abs(T[pt] - x);
        		int p = max(lbound(S, T[pt]) - 1, 0);
        		d3 += abs(S[p] - T[pt]);
        	}
		}

		if(x < S[0] && x < T[0]){
			d4 = INF;
		}
		else if(x < S[0]){
			d4 += abs(T[t-1] - x);
			d4 += abs(S[0] - T[t-1]);
		}
		else if(x < T[0]){
			d4 += abs(S[s-1] - x);
			d4 += abs(T[0] - S[s-1]);
		}
		else{
        	ps = s - 1;
        	pt = t - 1;
        	if(S[ps] > T[pt]){
        		d4 += abs(S[ps] - x);
        		int p = min(lbound(T, S[ps]), (int)T.size() - 1);
        		d4 += abs(T[p] - S[ps]);
        	}
        	else{
        		d4 += abs(T[pt] - x);
        		int p = min(lbound(S, T[pt]), (int)S.size() - 1);
        		d4 += abs(S[p] - T[pt]);
        	}
		}

		LL ans = min(d1, min(d2, min(d3, d4)));
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 5496
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();

        sc.nextLine();

        char WHITE = '.';
        char BLACK = '#';

        int whiteNum = 0;
        int pathLength = -1;

        char[][] grid = new char[H][W];

        for (int i = 0; i < H; i++) {
            String line = sc.nextLine();
            for (int j = 0; j < W; j++) {
                char c = line.charAt(j);
                if (c == WHITE) whiteNum++;
                grid[i][j] = c;
            }
        }

        Queue<Integer> iqueue = new LinkedList<>();
        Queue<Integer> jqueue = new LinkedList<>();
        iqueue.add(0);
        jqueue.add(0);
        int[][] countGrid = new int[H][W];

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                countGrid[i][j] = Integer.MAX_VALUE;
            }
        }

        countGrid[0][0] = 0;

        LOOP: while (!iqueue.isEmpty()) {
            int inow = iqueue.poll();
            int jnow = jqueue.poll();

            for (int i = -1; i <= 1; i++) {
                for (int j = -1; j <= 1; j++) {
                    if (i == 0 && j == 0) continue;
                    if (i != 0 && j != 0) continue;
                    if (inow + i < 0 || jnow + j < 0) continue;
                    if (inow + i >= H || jnow + j >= W) continue;
                    if (grid[inow + i][j + jnow] == BLACK) continue;

                    if (countGrid[inow][jnow] + 1 < countGrid[inow + i][jnow + j]) {
                        countGrid[inow + i][jnow + j] = countGrid[inow][jnow] + 1;

                        iqueue.add(inow + i);
                        jqueue.add(jnow + j);
                    }

                    if (inow + i == H - 1 && jnow + j == W - 1) {
                        pathLength = countGrid[inow + i][j + jnow];
                        break;
                    }
                }
            }
        }

        if (pathLength == -1) {
            System.out.println(-1);
        } else {
            System.out.println(whiteNum - pathLength - 1);
        }
    }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int x, a, b;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> x >> a >> b;
	if(a < b && b - a <= x) cout << "safe\n";
	else if(a < b && b - a > x) cout << "dangerous\n";
	else cout << "delicious\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

	int R_0, W_0, C, R;
	while(cin >> R_0 >> W_0 >> C >> R && R_0 && W_0 && C && R){
		if(C * W_0 <= R_0){
			cout << 0 << endl;
		} else {
			cout << (C * W_0 - R_0 + R - 1) / R << endl; 
		}
	}

	return 0;
}


Measured memory_bytes: 3080
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;
 
using ll = long long;
 
//constant
const double EPS = 1e-10;
 
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()
 
//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;
 
// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }
 
// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }
 
// DP
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
 
 
 
 
// ***************************************
 
 
int main(){
 
    int R;
    cin >> R;
    cout << 2 * M_PI * R << endl;
 
    return 0;
}

Measured memory_bytes: 3776
#if __has_include("../library/Basic/Debug.hpp")

#include "../library/Basic/Debug.hpp"

#else

/* ----- Header Files ----- */
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <array>
#include <string>
#include <tuple>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>
#include <cstdint>

/* ----- Type Alias ----- */
using lint = long long int;
using Real = long double;
template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T>
T ndvec(T v) { return v; }

template <class T, class... Ts>
auto ndvec(size_t l, Ts... ts) {
    return std::vector<decltype(ndvec<T>(ts...))>(l, ndvec<T>(ts...));
}

template <class Cost = int>
struct Edge {
    int src, dst;
    Cost cost;
    Edge(int src = -1, int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = int>
using Edges = std::vector<Edge<Cost>>;
template <class Cost = int>
using Graph = std::vector<std::vector<Edge<Cost>>>;

#endif

/* ----- Misc ----- */
void fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

struct Fout {
    int precision;
    explicit Fout(int precision) : precision(precision) {}
};

std::ostream& operator<<(std::ostream& os, const Fout& fio) {
    os << std::fixed << std::setprecision(fio.precision);
    return os;
}

/* ----- Constants ----- */
// constexpr Int INF = std::numeric_limits<Int>::max() / 3;
// constexpr Int MOD = 1000000007;
// const Real PI = acos(-1);
// constexpr Real EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));

int main() {
    int a, b;
    std::cin >> a >> b;
    std::cout << (a <= 9 && b <= 9 ? a * b : -1) << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define int long long
using namespace std;

int n, a, b;

signed main() {
	int i, j;
	cin >> n >> a >> b;
	if (n > a * b || a + b > n + 1) { cout << -1 << endl; return 0; }
	
	vector<int> cnts;
	for (i = 0; i < b; i++) cnts.push_back(a);
	int cnt = a * b;
	
	for (i = b - 1; i > 0; i--) {
		if (cnt > n) {
			int eraseNum = min(cnt - n ,cnts[i] - 1);
			cnts[i] -= eraseNum;
			cnt -= eraseNum;
		}
	}
	
	static vector<vector<int>> v;
	v.resize(b);
	for (i = 0; i < b; i++) {
		for (j = 0; j < cnts[i]; j++) {
			v[i].push_back((b - 1 - i) * a + j);
		}
	}
	
	static vector<int> orderToVal;	//orderToVal[i] = i(>=0)番目に小さい要素の値
	for (i = 0; i < b; i++) for (j = 0; j < v[i].size(); j++) orderToVal.push_back(v[i][j]);
	sort(orderToVal.begin(), orderToVal.end());
	orderToVal.erase(unique(orderToVal.begin(), orderToVal.end()), orderToVal.end());
	
	for (i = 0; i < b; i++) {
		for (j = 0; j < v[i].size(); j++) {
			int p = lower_bound(orderToVal.begin(), orderToVal.end(), v[i][j]) - orderToVal.begin();
			cout << p + 1;
			if (i + 1 == b && j + 1 == a) cout << endl;
			else cout << " ";
		}
	}
	return 0;
}

//一通り考えてダメだったので、変な方法を考えていたら、言い換えを思いつきました。(最初の2行が本質)↓
//数列は共通の要素を持たない1個以上の増加列によって表せます。
//そこで、数列から増加列を取り除く操作を考えます。
//数列が空になるまでの操作回数をXとします。このとき、Xの最小値=LDSの長さ … (1)
//が成り立ちます。LDSの長さはBにしたいので、Xの最小値=Bです。
//また、1回に取り除ける増加列の長さはLISの長さ(=A)以下です。
//よって、操作によって取り除かれる要素の個数はABで抑えられます。よって、N>ABなら答えはNOです。
//N≦ABのときを考えます。N=ABの場合は、以下のように構成できます.
//N=12, A=3, B=4の例：[10,11,12][7,8,9][4,5,6][1,2,3]
//N<ABの場合を考えましょう。これは、N=ABの状態から「ABを増やした」または「Nを減らした」状態です。簡単のため、後者で考えます。
//ABを変えずにNを減らす場合は、2つ目以降の[]であって2要素以上存在する[]の中から1つの要素を削除すればよいです。
//N=11, A=3, B=4の例：[10,11,12][7,8,9][4,5,6][1,2]
//N=10, A=3, B=4の例：[10,11,12][7,8,9][4,5,6][1]
//N=9,  A=3, B=4の例：[10,11,12][7,8,9][4,5][1]
//このようにNを減らす操作は、N≧A+Bのときまでできます。N=A+B-1のときはNを減らすことができませんが、実は、N<A+B-1のとき(⇔N+1<A+Bのとき)
//は解が存在しないので、構成はこれで十分です。(LISとLDSに共通要素が2つ以上存在しないため、A+B<=N+1が成り立つ必要がある)
//さて、点の順序的にはこの構成で十分ですが、1～ABの値の並べ替えについて削除操作をしているため、値に「順序付け」を行う必要があります。
//これは、座標圧縮と呼ばれる方法を用いればO(NlogN)でできます。
//
//全体の計算量は、O(2AB - N + NlogN)程度です。(ABが大きいとTLEΣ
//↑各ブロックについて必要な要素数をあらかじめ求めておけばよい。O(NlogN)
//
//(1)の証明は「JOI春合宿：マトリョーシカ人形」の解説に書かれています。


Measured memory_bytes: 17136
import math
import copy
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, m = map(int, input().split())
data = getSomeInputListInt(n)

dataSorted = sorted(data, key=lambda x:x[0])

dataSum = np.zeros(n)

for i in range(n):
    dataSum[i] = dataSorted[i][1]
    if i == 0:
        continue
    else:
        dataSum[i] += dataSum[i-1]

tmpNum = 0
tmpSa = 0
for i in range(n):
    if dataSum[i] >= m:
        tmpNum = i
        if i == 0:
            tmpSa = m
            break
        else:
            tmpSa = m - dataSum[i-1]
            break

ans = 0
for i in range(tmpNum):
    ans += dataSorted[i][0] * dataSorted[i][1]

ans += dataSorted[tmpNum][0] * tmpSa

print(int(ans))


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

const int N = 310;
const int moder = 998244353;

std::bitset <N> set[N];
int power[N];

int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; ++ i){
        for (int j = 0; j < m; ++ j){
            int x;
            scanf("%d", &x);
            set[i][j] = x;
        }
    }
    int now = 0;
    for (int i = 0; i < m; ++ i){
        for (int j = now; j < n; ++ j){
            if (set[j][i]){
                std::swap(set[now], set[j]);
                break;
            }
        }
        if (!set[now][i]){
            continue;
        }
        for (int j = now + 1; j < n; ++ j){
            if (set[j][i]){
                set[j] ^= set[now];
            }
        }
        ++ now;
    }
    power[0] = 1;
    for (int i = 1; i < N; ++ i){
        power[i] = 2 * power[i - 1] % moder;
    }
    int ans = (1ll * power[n] * (power[m - 1]) - 1ll * power[n - now] * power[m - 1]) % moder;
    ans += ans < 0 ? moder : 0;
    printf("%d\n", ans);
    return 0;
}

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

using namespace std;
using ll = long long;

template <typename K,typename V>
using umap = unordered_map<K,V>;
template <typename V>
using uset = unordered_set<V>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i,n) for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(v) v.begin(),v.end()

#define INF 1'000'000'000'000 //10^12
#define MOD 1'000'000'007
//グリッドグラフの範囲チェック
bool range_validation(int y,int x,int h,int w){
    return y>=0 && y<h && x>=0 && x < w;
}
//ビットカウント
int popcount(long bits){
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int gcd(ll a, ll b){
  if(b == 0){
    return a;
  }else{
    return gcd(b,a%b);
  }
}

vector<ll> sieve(ll n){
  
  vector<bool> is_prime(n+1,true);
  vector<ll> res;
  for(int i=2;i<=n;i++){
    if(is_prime[i]){
      res.push_back(i);
      for(int j=2*i;j<=n;j+=i){
        is_prime[j] = false;
      }
    }
  }
  return res;
}

vector<ll> divisor(ll n){
  vector<ll> list;
  for(int i=2;i*i<=n;i++){
    if(n%i==0){
      list.push_back(i);
      if(n/i != i){
        list.push_back(n/i);
      }
    }
  }
  return list;
}

umap<int,int> prime_factor(ll n){
  umap<int,int> fac;
  for(int i=2;i*i<=n;i+=2){
    if(n%i == 0){
      int count = 0;
      while(n%i == 0){
        count++;
        n /= i;
      }
      fac[i] = count;
    }
  }
  if(n!=1)fac[n] = 1;
  return fac;
}

int N;

int cnt = 0;

bool ok(ll val){
    uset<int> s;
    while(val > 0){
        s.insert((int)(val%10));
        val /=10;
    }
    
    return s.size() == 3;
}
void dfs(ll val){
    if(val > N){
        return ;
    }else{
        if(ok(val))cnt++;
        dfs(val*10+3);
        dfs(val*10+5);
        dfs(val*10+7);
    }
}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  cin >> N ;
  dfs(0);
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define lld long long int
void deepu()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt","w",stderr);
	#endif
}

int main() 
{ 
	//deepu();
	  
	long double n;
	cin>>n;
     lld a=ceil(n/1.08);
     lld b=a*1.08;
     //lld c=floor(b);
     if(b==n)
     	cout<<a;
     else
     	cout<<":(";


   
 	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<set>
using namespace std;
int main()
{
    string s;
    set<string> subs;
    int k;
    cin >> s >> k;
    int ssize = s.size();
    for(int i = 1; i <= k; i++){
        for(int j = 0; j + i - 1 < ssize; j++){
            subs.insert(s.substr(j, i));
        }
    }
    auto itr = subs.begin();
    for(int i = 1; i < k; i++){
        itr++;
    }
    cout << *itr << endl;
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <ctime>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mst(a,b) memset((a),(b),sizeof(a))
#define pii pair<int,int>
#define pII pair<ll,ll>
#define pi acos(-1)
#define pb push_back
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 1e5 + 10;
const int MAXM = 1e6 + 10;



int main() {
#ifdef local
    freopen("data.txt","r",stdin);
//    freopen("data.txt","w",stdout);
#endif
    ll a,b;
    scanf("%lld%lld",&a,&b);
    int ans=1;
    while(2ll*a<=b) {
        a*=2ll;
        ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <array>
#include <algorithm>

using namespace std;
using ll = long long;

int main() {
    array<ll, 100> m;
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> m[i];
    }
    sort(m.begin(), m.begin() + n, greater<ll>());
    ll ans = 0;
    while (m[0] >= n) {
        for (int i = 1; i < n; ++i) {
            m[i] += m[0] / n;
        }
        ans += m[0] / n;
        m[0] %= n;
        sort(m.begin(), m.begin() + n, greater<ll>());
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define s_cin(X) scanf("%s",&X)


#define  i_cout(X) printf("%d\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

int i_cins(int n, int* A);

int main(void) {
	int   N, K,i,no=1;
	i_cin2(N,K);
	no*=2;
	for (i = 1; i < N; i++) {
		if (no + K < no * 2)no += K;
		else no *= 2;
	}
	i_cout(no);

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<vector>
#include<stack>
#include<iomanip>
#define rep(i,n) for(int i=0;i<((int)n);i++)
#define drep(i,n) for(int i=((int)n)-1;i>-1;i--)
#define Rep(i,n0,n) for(int i=n0;i<((int)n);i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<((int)n);j++)
#define W(x) cout<<x<<endl;
#define Debug(x) cout<<"#DEBUG "<<x<<endl;
#define INF (1<<29)
#define INF2 (long long)8*(long long)INF*(long long)INF
#define mod 1000000007
typedef long long ll;

using namespace std;


int min(int x,int y){if(y<x)return y;else return x;}
int max(int x,int y){if(y>x)return y;else return x;}
int fact(int x){int i=1;rep(j,x){i*=(j+1);} return i;}
long long fact(long long x){long long i=1;rep(j,x){i*=(j+1);} return i;}
int gcd(int x, int y)
{
    if(x%y==0)return y;
    else if(y%x==0)return x;
    else return gcd(x%y,y%x);
}
ll gcd(ll x, ll y)
{
    if(x%y==0)return y;
    else if(y%x==0)return x;
    else return gcd(x%y,y%x);
}



int main()
{
    int n;
    cin>>n;
    if(n<1200)
    {
        W("ABC")
    }
    else if(n<2800)
    {
        W("ARC")
    }
    else W("AGC")
    return 0;
}

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

int main()
{
  long a,b,k;
  cin >> a >> b >> k;
  if(a > k)
    cout << a-k << " " << b << endl;
  else if(a <= k && b > k-a)
    cout << 0 << " " << b+a-k << endl;
  else
    cout << "0 0" << endl;
  return 0;
}

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


constexpr double PI = 3.14159265358979;


//Point
struct Point {
    double x, y;
    Point(double x = 0, double y = 0) : x(x), y(y){}
    friend ostream& operator<<(ostream& os, const Point& p){ return os << '(' << p.x << ", " << p.y << ')'; }
};
inline Point operator+(const Point& p, const Point& q){ return Point(p.x+q.x, p.y+q.y); }
inline Point operator-(const Point& p, const Point& q){ return Point(p.x-q.x, p.y-q.y); }
inline Point operator*(const Point& p, double a){ return Point(p.x*a, p.y*a); }
inline Point operator*(double a, const Point& p){ return Point(a*p.x, a*p.y); }
inline Point operator/(const Point& p, double a){ return Point(p.x/a, p.y/a); }
inline Point rot(const Point& p, double ang){ return Point(cos(ang)*p.x-sin(ang)*p.y, sin(ang)*p.x+cos(ang)*p.y); }
inline double norm(const Point& p){ return p.x*p.x+p.y*p.y; }
inline double abs(const Point& p){ return sqrtl(norm(p)); }


void rec(Point p1, Point p2, int l){
    if(l == 0){ cout << fixed << setprecision(10) << p1.x << ' ' << p1.y << endl; return; }
    auto s = p1+(p2-p1)/3;
    auto t = p1+2*(p2-p1)/3;
    auto u = s+rot(t-s, PI/3);
    rec(p1, s, l-1);
    rec(s, u, l-1);
    rec(u, t, l-1);
    rec(t, p2, l-1);
}


int n;


int main(){
    cin >> n;
    rec(Point(0, 0), Point(100, 0), n);
    cout << fixed << setprecision(10) << 100.0 << ' ' << 0.0 << endl;

    return 0;
}


Measured memory_bytes: 3248