akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
        using namespace std;
        #define int long long int
        #define pb push_back
        #define mk make_pair
        #define ft first
        #define sc second
        #define ppb pop_back
        #define sz size
        #define forn(i,a,n) for(i=a;i<n;i++)
        #define M 998244353 
        #define inf 2e18

        bool compare(pair<int,int> a,pair<int,int> b){
            if(a.first==b.first)
                return a.second<b.second;
            return a.first<b.first;
        }

        signed main() {
 
  
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        int fl=0;
        while(a>0&&c>0){
            if(fl)
            a=max(0ll,a-d);
            else
            c=max(0ll,c-b);
            // cout<<b<<" ";
            // cout<<a<<" "<<c<<"\n";
            fl=!fl;
        }
        // cout<<a<<" "<<c;
        if(a==0)
            cout<<"No\n";
        else
            cout<<"Yes\n";

        return 0;
    }

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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 (a>b) { a=b; return 1; } return 0; }

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

    ll H, W, N; cin >> H >> W >> N;
    vel a(N), b(N); rep(i,N) { cin >> a[i] >> b[i]; a[i]--; b[i]--; }

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

    map<l_l, int> cnt;
    map<l_l, bool> used;
    rep(i,N) {
        rep(j,9) {
            int nx = a[i] + dx[j];
            int ny = b[i] + dy[j];
            if(1 <= nx and nx <= H-2 and 1 <= ny and ny <= W-2){
                cnt[make_pair(nx, ny)]++;
                used[make_pair(nx, ny)] = false;
            }
        }
    }
    vel num(10, 0);
    ll sum = 0LL;
    rep(i,N) {
        rep(j,9) {
            int nx = a[i] + dx[j];
            int ny = b[i] + dy[j];
            if(used[make_pair(nx, ny)]) continue;
            if(1 <= nx and nx <= H-2 and 1 <= ny and ny <= W-2){
                used[make_pair(nx, ny)] = true;
                num [ cnt[make_pair(nx, ny)] ]++;
            }
        }
    }
    rep(i,10) sum += num[i];
    ll zero = (H-2) * (W-2) - sum;
    cout << zero << endl;
    rep1(i,10) cout << num[i] << endl;
    return 0;
}


Measured memory_bytes: 115968
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int>> vvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
const int INF = 1001001001;
const ll LINF = 1e18;
const ll mod = 1e9 + 7;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}

int H, W;
char s[450][450];
bool arrived[450][450];
vi dh = {-1, 1, 0, 0};
vi dw = {0, 0, -1, 1};

bool isValid(int h, int w){
    return h >= 1 && h <= H && w >= 1 && w <= W;
}

int main() {
    cin >> H >> W;
    for(int i = 1; i <= H; i++){
        for(int j = 1; j <= W; j++){
            cin >> s[i][j];
        }
    }
    
    ll count = 0;
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            if (arrived[i][j]) continue;
            ll bc = 0;
            ll wc = 0;
            queue<pii> q;
            q.push(pii(i, j));
            arrived[i][j] = true;
            while (!q.empty()) {
                pii p = q.front();
                q.pop();
                if(s[p.first][p.second] == '#') bc++;
                else wc++;
                for(int k = 0; k < 4; ++k){
                    int nh = p.first + dh[k];
                    int nw = p.second + dw[k];
                    if (!isValid(nh, nw) || arrived[nh][nw]) continue;
                    if(s[p.first][p.second] != s[nh][nw]){
                        arrived[nh][nw] = true;
                        q.push(pii(nh, nw));
                    }
                }
            }
            count += bc * wc;
        }
    }
    cout << count << endl;
    return 0;
}



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

#define ran 101101

char s[ran], t[ran];
vector<int> v[33];

int main() {
	scanf("%s%s", s, t);
	int ls = strlen(s);
	int lt = strlen(t);
	for(int i=0;i<ls;i++)
		v[s[i]-'a'].push_back(i);
	
	int cur = -1, cycle = 0;
	for(int i=0;i<lt;i++) {
		int id = t[i] - 'a';
		if (v[id].size() <=0) {
			puts("-1");
			return 0;
		}
		int nxt_id = upper_bound(v[id].begin(), v[id].end(), cur) - v[id].begin();
		if(nxt_id >= v[id].size()) {
			cur = v[id][0];
			cycle ++;
		} else cur = v[id][nxt_id];
	}
	printf("%lld\n", 1LL*ls*cycle + cur + 1);
	
	return 0;
}

Measured memory_bytes: 1024
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long int;
const int MOD = 1e9+7;

int main(){
    int n; cin >> n;
    vector<vector<int>> edge(n, vector<int>{});
    vector<ll> dp(1 << n, 0);
    dp[0] = 1;
    int val;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            cin >> val;
            if(val){
                edge[i].push_back(j);
            }
        }
    }
    for(int i=0; i<n; i++){
        if(i==0){
            for(auto& v:edge[i]){
                dp[0 | 1 << v] += dp[0];
            }
            continue;
        }
        int comb = (1 << i) - 1;
        while(comb < 1 << n){
            for(auto& v:edge[i]){
                if(comb & (1 << v)){continue;}
                dp[comb | (1 << v)] += dp[comb];
                dp[comb | (1 << v)] %= MOD;
            }
            int x = comb & -comb, y = comb + x;
            comb = ((comb & ~y) / x >> 1) | y;
        }
    }
    // for(auto& v:dp){
    //     cout << v << " ";
    // }
    // cout << "\n";
    cout << dp[(1 << n) - 1] << "\n";
    return 0;
}

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

ll n, temp;
ll ans;

int main() {
  cin >> n;
  vector<int> a(n);
  rep (i, n) {
    cin >> a[i];
  }
  vector<ll> r(n, 0);
  vector<ll> l(n, 0);
  rep (i, n) {
    if (i + a[i] < n) r[i+a[i]]++;
    if (i - a[i] >= 0) l[i-a[i]]++;
  }
  ans = 0;
  rep (i, n) {
    if (r[i] >= 0 && l[i] >= 0) {
      ans += r[i] * l[i];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7220
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

#define pii pair<int,int>
#define x first
#define y second

int n,res;
vector<int> a,b;
vector<pii> ans;

signed main(){
	read(n);
	for(int i=1,x;i<=n;i++) read(x),x>=0?a.push_back(x):b.push_back(-x);
	sort(a.begin(),a.end(),greater<int>());
	sort(b.begin(),b.end(),greater<int>());
	if(b.empty()){
		if(a.size()==2) res=a[0]-a[1],ans.emplace_back(a[0],a[1]);
		else{
			for(int i=1;i<a.size()-1;i++) ans.emplace_back(a[n-1],a[i]),a[n-1]-=a[i];
			ans.emplace_back(a[0],a[n-1]);
			res=a[0]-a[n-1];
		}
		write(res);
	}
	else if(a.empty()){
		for(int i=0;i<n;i++) b[i]=-b[i];
		for(int i=0;i<b.size()-1;i++) ans.emplace_back(b[n-1],b[i]),b[n-1]-=b[i];
		write(b[n-1]);
	}
	else{
		for(int i=1;i<a.size();i++){
			ans.emplace_back(-b[0],a[i]);
			b[0]+=a[i];
		}
		for(int i=0;i<b.size();i++){
			ans.emplace_back(a[0],-b[i]);
			a[0]+=b[i];
		}
		write(a[0]);
	}
	for(auto x:ans) printf("\n%d %d",x.x,x.y);
}

Measured memory_bytes: 4916
n,w = gets.chomp.split.map(&:to_i)
wv_arr = n.times.map{gets.chomp.split(" ").map(&:to_i)}
 
dp = Array.new(w+1,0)
 
n.times do |i|
  _w, _v = wv_arr[i]
  w.downto(0).each do |b|
    dp[b] = dp[b-_w] + _v if _w <= b && dp[b] < dp[b-_w] + _v
  end
end
 
puts dp[w]

Measured memory_bytes: 2556
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int N,i;
    string s,t;
    cin >> N >> s >> t;
    
    for(i = 0; i < N; i++){
        bool f = true;
        for(int j = 0; j+i < N; j++){
            if(t[j] != s[j+i]) f = false;
        }
        if(f) break;
    }
    
    cout << N + i << endl;
    
    
}


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

typedef long long ll;
typedef pair<int, int> P;

int MOD = 1e9 + 7;
ll INF = 1e18;

int main() {
    int n; cin>>n;
    int m=n, ans=0;

    while(m>0){
        ans += (m % 10);
        m /= 10;
    }
    
    if(n % ans == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <queue>
#include <utility>
#include <iomanip>

#define INF 5000000005
#define MP make_pair

using namespace std;
long long int n;
double x[1005],y[1005],r[1005],dis[1005],edge[1005][1005];
bool use[1005];
pair<double,int> P;
priority_queue<pair<double,int>,vector<pair<double,int>>, greater<pair<double,int>>>Q;

double cal(double a,double b,double r){
	double ans=sqrt(pow(a,2)+pow(b,2))-r;
	if(ans<0)ans=0;
	return ans;
}

int main() {
	cin>>x[0]>>y[0]>>x[1]>>y[1];
	r[0]=r[1]=0;
	cin>>n;
	for(int i=2;i<n+2;i++){
		cin>>x[i]>>y[i]>>r[i];
		use[i]=false;
		dis[i]=INF;
	}
	dis[0]=0;dis[1]=INF;
	use[0]=true;use[1]=false;

	for(int i=0;i<n+2;i++){
		for(int j=0;j<n+2;j++){
			edge[i][j]=cal(x[i]-x[j],y[i]-y[j],r[i]+r[j]);
		}
	}
	for(int i=0;i<n+2;i++){
		Q.push(MP(edge[0][i],i));
	}
	while(!Q.empty()){
		P=Q.top();
		Q.pop();
		if(use[P.second]==true)continue;
		if(P.second==1){
			cout<<fixed<<setprecision(10)<<P.first;
			return 0;
		}
		dis[P.second]=P.first;
		use[P.second]=true;
		for(int i=0;i<n+2;i++){
			if(dis[i]>P.first+edge[i][P.second]){
				Q.push(MP(P.first+edge[i][P.second],i));
			}
		} 
	}
	return 0;
}


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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

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

const int N = 22;
const int M = N*N;
string str[N];
int dp[M][M];
int id[N][N] , ID;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
int n , m;

bool valid(int x,  int y){
    return x >= 0 && x < n && y >= 0 && y < m && str[x][y] == '.';
}


int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    const int MX = 1e9;
    loop(i,M)loop(j,M)dp[i][j] = MX;

    cin >> n >> m;
    loop(i,n)cin >> str[i];
    loop(i,n)loop(j,m)if(str[i][j] == '.')id[i][j] = ID++;
    loop(i,n)loop(j,m)if(str[i][j] == '.')loop(k,4){
        int nxti = i + dx[k];
        int nxtj = j + dy[k];
        if(valid(nxti,nxtj)){
            dp[id[i][j]][id[nxti][nxtj]] = 1;
        }
    }

    loop(i,ID)dp[i][i] = 0;

    loop(k,ID)loop(i,ID)loop(j,ID)dp[i][j] = min(dp[i][j] , dp[i][k] + dp[k][j]);
    int ans = 0;
    loop(i,ID)loop(j,ID)if(dp[i][j] != MX)ans = max(ans , dp[i][j]);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1152
/*
 Thank you very much for
 http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=496648
 */

#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

typedef pair<int,int> P;

void solve116(int h, int w) {
    vector<vector<int>> bd(h,vector<int>(w+1));
    REP(i,h) {
        string s;
        cin >> s;
        REP(j,w) {
            if (s[j] == '*') bd[i][j] = 0;
            else i > 0 ? bd[i][j] = bd[i-1][j]+1 : bd[i][j] = 1;
        }
    }
    
    stack<P> st;
    int ans = 0;
    REP(i,h) {
        bd[i][w] = 0;
        REP(j,w+1) {
            int len = 0;
            while (!st.empty() && st.top().first >= bd[i][j]) {
                len += st.top().second;
                ans = max(ans, len * st.top().first);
                st.pop();
            }
            ++len;
            st.push(make_pair(bd[i][j], len));
        }
    }
    cout << ans << endl;
}

int main() {
    int h, w;
    while (cin >> h >> w, h + w) {
        solve116(h,w);
    }
    return 0;
}

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

void print(vector<int64_t> A)
{
  for (int i = 0; i < A.size(); i++)
  {
    cout << "node " << i + 1 << ": key = " << A.at(i) << ", ";
    if (i != 0)
    {
      cout << "parent key = " << A.at((i + 1) / 2 - 1) << ", ";
    }
    if ((i + 1) * 2 <= A.size())
    {
      cout << "left key = " << A.at((i + 1) * 2 - 1) << ", ";
    }
    if ((i + 1) * 2 + 1 <= A.size())
    {
      cout << "right key = " << A.at((i + 1) * 2) << ", ";
    }
    cout << endl;
  }
}

int main()
{
  int H;
  cin >> H;
  vector<int64_t> A(H);
  for (int i = 0; i < H; i++)
  {
    cin >> A.at(i);
  }
  print(A);
}



Measured memory_bytes: 3168
#include<iostream>
#include<queue>
#include<memory>
#include<map>
#include<set>
#include<unordered_map>
#include<array>
#include<vector>
#include<algorithm>
#include<list>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<string>

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

const ll MOD = 1000000007;

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

	vec X[2];
	X[0] = vec(60,0);
	X[1] = vec(60,0);

	vec Y(60, 0);

	for (int i = 0; i < N; ++i)
	{
		ll A; cin >> A;
		for (int j = 0; j < 60; ++j)
		{
			Y[j] += X[(A + 1) % 2][j];
			Y[j] %= MOD;

			X[A % 2][j]++;
			A /= 2;
		}
	}

	ll ans = 0;
	for (ll i = 0; i < 60; ++i)
	{
		ll B = (1ll << i) % MOD;

		ll add = (Y[i] * B) % MOD;

		ans = (ans + add) % MOD;
	}
	cout << ans << endl;
	return 0;
}

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

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

Measured memory_bytes: 23632
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int aa = Math.max(a,b);
    int bb = Math.min(a,b);
    for (int i=0; i<aa; i++){
      if (i != aa-1) {
        System.out.print(bb);
      }else{
        System.out.println(bb);
      }
    }
  }
}

Measured memory_bytes: 21844
N = gets.chomp.to_i
nums = []
flg = false
N.times do
  nums << gets.chomp.split(' ').map(&:to_i)
end
count = 0
nums.each do |num|
  count += 1 if num[0] == num[1]
  count = 0  if num[0] != num[1]
  break if count == 3
end
puts 'Yes' if count >= 3
puts 'No' if count < 3

Measured memory_bytes: 14300
#include <stdio.h>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, n, a[3];
  scanf("%lld", &n);
  char s[10];
  ll p[n + 1], q[n + 1], ans[n];
  for(i = 0; i < 3; ++i) scanf("%lld", &a[i]);
  for(i = 0; i < n; ++i) {
    scanf("%s", s);
    if(s[0] == 'A') p[i] = 0;
    else p[i] = 1;
    if(s[1] == 'B') q[i] = 1;
    else q[i] = 2;
  }
  p[n] = q[n] = 0;
  for(i = 0; i < n; ++i) {
    if(!a[p[i]] && !a[q[i]]) {
      printf("No");
      return 0;
    }
    if(a[p[i]] == 1 && a[q[i]] == 1) {
      if(p[i] == p[i + 1] || p[i] == q[i + 1]) a[p[i]]++, a[q[i]]--, ans[i] = p[i];
      else a[p[i]]--, a[q[i]]++, ans[i] = q[i];
    } else {
      if(a[p[i]] > a[q[i]]) a[p[i]]--, a[q[i]]++, ans[i] = q[i];
      else a[p[i]]++, a[q[i]]--, ans[i] = p[i];
    }
  }
  printf("Yes\n");
  for(i = 0; i < n; ++i) printf("%c\n", ans[i] ? --ans[i] ? 'C' : 'B' : 'A');
  return 0;
}

Measured memory_bytes: 4076
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    ll n;
    cin >> n;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    map<int,int> mii;
    rep(i,n){
        mii[v[i]]++;
    }
    if(n%2 == 0){
        if(mii.size()!=n/2){
            //cout<<"Yes1"<<endl;
            cout<< 0 <<endl;
            return 0;
        }else{
            for(auto u : mii){
                if(u.first%2!=0 && u.second==2);
                else{
                    //cout<<u.first<<" "<<u.second<<endl;
                    //cout<<"yes2"<<endl;
                    cout << 0 << endl;
                    return 0;
                }
            }
            int ans = 2;
            rep(i,n/2-1){
                ans *= 2;
                ans %= mod;
            }
            cout << ans << endl;
        }
    }
    else{
        if(mii.size()!=n/2+1){
            cout<< 0 <<endl;
            return 0;
        }else{
            bool ok = 0;
            for(auto u : mii){
                if(u.first==0 && u.second == 1){
                    ok = 1;
                    continue;
                }
                if(u.first%2==0 && u.second==2);
                else{
                    cout << 0 << endl;
                    return 0;
                }
            }
            if(ok){
                int ans = 2;
                rep(i,n/2-1){
                    ans *= 2;
                    ans %= mod;
                }
                if(n!=1)cout << ans << endl;
                else cout<<1<<endl;
            }
            else cout << 0 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3584
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
// typedef pair<ll,ll> P;

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

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return true;
    }
    return false;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return true;
    }
    return false;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};

typedef tuple<string, int, int> T;
int main() {
//    int N; cin >> N;
//
//    rep(i,N){
//        string S; int p;
//        cin >> S >> p;
//    }
    int A,P; cin >> A >> P;
    cout << (3*A+P)/2 << endl;
    return 0;
}


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


int main(void){
    int n, x;
    int l, d;
    cin >> n >> x;

    d = 0;
    int i;
    for(i = 0; i <= n && d <= x; i++){
        cin >> l;
        d += l;
    }
    cout << i << endl; 
    
    return 0;
}

Measured memory_bytes: 256
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

a,b,c=map(int, input().split())

for _ in range(10):
    c = a * c - b
    print(c)

Measured memory_bytes: 21424
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <random>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
#define mod 1e18 + 7;

int main()
{
	ios_base::sync_with_stdio(false); 
	cin.tie(nullptr); 
	cout.tie(nullptr); 
	cout.setf(ios::fixed); 
	cout.precision(20);

	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	if (k % 2 == 0) {
		cout << a - b << endl;
	}
	else {
		cout << b - a << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e10;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
using pll = pair<ll, ll>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}
ll ceilll(ll a, ll b) {return (a + b-1) / b;} // if(a%b == 0) (a/b) + 1
ll get_digit(ll a) {ll digit = 0; while(a != 0){a /= 10; digit++;} return digit;} // a != 0
template<typename T> void vecdbg(vector<T>& v){ rep(i, v.size()){cout << v[i] << " ";} br;}
template<typename T> void vecvecdbg(vector<vector<T>>& v){ rep(i, v.size()){rep(j, v[i].size()){cout << v[i][j] << " ";} br;}}

// 0 false, 1 true 
// string number to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp
// global vector -> 0 initialization
ll ans = 0;

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll n; cin >> n;
    for(ll a = 1; a <= n-1; a++){
        ans += (n-1) / a;
    }
    /*
    for(ll c = 1; c <= n-1; c++){
        ll tmp = n-c;
        p.divisor(tmp);

        if(v.size() % 2 == 0){
            ans += v.size();
        }else{
            ans += v.size() / 2 * 2 + 1;
        }

        cout << "v " << v.size() << endl;
        ans += (v.size() + 1)/ 2;
        cout << ans << endl;

    }*/
    
    cout << ans << endl;

}

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

int rec(string a,string b){
  string as,at,bs,bt;
  for(int i=0;i<a.size();i++){
    if(i<5){
      as+=a[i];
      bs+=b[i];
    }
    if(i>5){
      at+=a[i];
      bt+=b[i];
    }
  }
  if(bs<=as&&at<=bt)return 1;
  return 0;
}

int main(){
  int n,m;
  string l[100],t[100][100],s[100][100];
  int lc;
  int tc[100];
  int sc[100];
  cin>>lc;
  for(int i=0;i<lc;i++)cin>>l[i];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>tc[i];
    for(int j=0;j<tc[i];j++)cin>>t[i][j];
  }
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>sc[i];
    for(int j=0;j<sc[i];j++)cin>>s[i][j];
  }
  int ans=0;
  for(int cn=0;cn<lc;cn++){
    int cntt=0,cnts=0;
    for(int i=0;i<n;i++){
      int f=1;
      for(int j=0;j<tc[i];j++){
	if(rec(l[cn],t[i][j])&&f){
	  cntt++;
	  f=0;
	}
      }
    }
    for(int i=0;i<m;i++){
      int f=1;
      for(int j=0;j<sc[i];j++){
	if(rec(l[cn],s[i][j])&&f){
	  cnts++;
	  f=0;
	}
      }
    }
    ans+=min(cnts,cntt);
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 4620
//In The Name Of The God

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define F first
#define S second
#define X first.first
#define Y first .second
#define A second.first
#define B second.second
#define mp make_pair
#define pb push_back
#define pf push_front
#define P push
#define pob pop_back
#define pof pop_front
#define PO pop
#define rep(i,j,k) for(int i = j ; i <= k ; ++ i)
#define rrep(i,j,k) for(int i = j ; i>=k ; --i)
#define FR(i,j,k) for(int i = j ; i < k ; ++ i )
#define rFR(i,j,k) for(int i = j ; i > k ; -- i )
#define lb(x) x&-x
#define p2(x) (1LL<<x)
#define SZ size()
#define LB lower_bound
#define UB upper_bound
#define IT iterator
#define RIT reverse_iterator
#define E end()
#define BE begin()
#define RE rend()
#define RBE rbegin()
#define UN unsigned

typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll ;
typedef pair<int,pii> pip;
typedef pair<pii,int> ppi;
typedef pair<pii,pii> ppp;
typedef pair<int,pll> pipl;
typedef pair<pll,int> ppli ;
typedef pair<pll,pll> plpl ;
typedef pair<ll,pii> lpip;
typedef pair<pii,ll> lppi;
typedef pair<pii,pii> lppp;
typedef pair<ll,pll> lpipl;
typedef pair<pll,ll> lppli ;
typedef pair<pll,pll> lplpl ;
typedef vector<int> vi ;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef set<int> sti;
typedef set<ll> stl;
typedef set<pii > stpi;
typedef set<pll> stpl;
typedef vi::IT vit;
typedef vl::IT vlt;
typedef vpi::IT vpit;
typedef vpl::IT vplt;
typedef sti::IT stit;
typedef stl::IT stlt;
typedef stpi::IT stpit;
typedef stpl::IT stplt;
typedef vpi::RIT rvpit;
typedef vpl::RIT rvplt;
typedef sti::RIT rstit;
typedef stl::RIT rstlt;
typedef stpi::RIT rstpit;
typedef stpl::RIT rstplt;

const int MAXN = 500000;
const int SUPERN = 5000000;
const int MAXS = 325;
const int SUPERS = 1000;
const int MD = 1e9+7;
//......Structures.......

//......Variables........
ll h,w,n,a[MAXN],b[MAXN],cnt,u=1,ja[200][200];
//......Funcs............
ll sum(ll a,ll b)
{
    return (a+b)%MD;
}
ll mu(ll a,ll b)
{
    return (a*b)%MD;
}
ll mn(ll a,ll b)
{
    return(a-b+MD)%MD;
}
//......Code.............
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>h>>w>>n;
    rep(i,1,n)cin>>a[i];
    cnt=1;
    rep(i,1,n)rep(j,1,a[i])
    {
        b[cnt++]=i;
    }
    rep(i,1,h)
    {
        if(i%2)
        {
            rep(j,1,w)
            {
                ja[i][j]=b[u++];
            }
        }
        else
        {
            rrep(j,w,1)
            {
                ja[i][j]=b[u++];
            }
        }
    }
    rep(i,1,h){
    rep(j,1,w)
    {
        cout<<ja[i][j]<<' ';
    }
    cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 2560
(let* ((s (read-line))
       (x (make-array (list (length s)) :adjustable t :fill-pointer 0))
       (ans 0))
  (loop :with c := #\=
        :with p := -1
        :for y :across s
        :if (char/= c y)
        :do (progn
              (vector-push-extend 0 x)
              (incf p)
              (setf c y))
        :do (if (char= y #\<)
                (incf (aref x p))
                (decf (aref x p))))
  (loop :for v :across x
        :for w := (abs v)
        :for i :from 0
        :do (incf ans (/ (* w (- w 1)) 2))
        :if (> v 0)
        :do (incf ans (if (= (1+ i) (length x)) w (max w (abs (aref x (1+ i)))))))
  (when (< (aref x 0) 0)
    (incf ans (abs (aref x 0))))
  (format t "~A~%" ans))


Measured memory_bytes: 31700
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for j in range(H):
        for i in range(W):
            if j == 0 or i == 0 or j == H-1 or i == W-1 :
                print("#", end = "")
            else:
                print(".", end = "")
        print()
    print()


Measured memory_bytes: 7004
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int main(){
  ll N,M;cin>>N>>M;
  ll cnt=0;
  if(N*2>=M)cnt=M/2 ;
  else cnt=N+(M-2*N)/4;
  cout<<cnt<<endl;
}   





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

int main()
{
    int n,k,min=123,max=0;
    for(int i=0;i<5;i++)
    {
        cin>>n;
        if(min>n) min=n;
        if(max<n) max=n;
    }
  	cin>>k;
    if(max-min>k) cout<<":(";
    else cout<<"Yay!";
}

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

using namespace std;

typedef long long ll;


int main() {
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      std::cout << i << "x" << j << "=" << i*j << std::endl;
    }
  }

}

Measured memory_bytes: 3068
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
 
int b[110][110];
int dp[110][110];
 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    for (int i = 0; i < 110; i++) {
        for (int j = 0; j < 110; j++) {
            b[i][j] = -1;
        }
    }
 
    int n = 0;
    string s;
    while (cin >> s) {
        int j = 0, m = s.size(), idx = 0;
        while (j < m) {
            string ss;
            while (j < m && s[j] != ',') ss += s[j++];
            j++;
            b[n][idx++] = atoi(ss.c_str());
        }
        n++;
    }
 
    dp[0][0] = b[0][0];
    for (int i = 0; i < n - 1; i++) {
        for (int j = 0; j < n; j++) {
            if (b[i][j] == -1) continue;
            for (int d = -1; d <= 1; d++) {
                if (i < n / 2 && d == -1 || n / 2 <= i && d == 1) continue;
                if (0 <= j + d && j + d < n && b[i + 1][j + d] != -1) {
                    dp[i + 1][j + d] = max(dp[i + 1][j + d], dp[i][j] + b[i + 1][j + d]);
                }
            }
        }
    }
 
    cout << dp[n - 1][0] << endl;;
}


Measured memory_bytes: 3260
#include <string>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <math.h>
 
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
 
	int N,K,x,y,sum;
	cin >> N >> K;
    vector<int> vec(100);
    for(int i=0; i<K;i++){
      cin >> x;
      for(int j=0;j<x;j++){
        cin >> y;
        vec.push_back(y);
      }
    }
    for(int i=1;i<=N;i++){
      auto itr = find(vec.begin(), vec.end(), i);
      if( itr == vec.end() ) { 
        sum++;
       }
    }
      cout << sum << "\n";
  
}

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

using namespace std;

int main()
{
string n;
  cin>>n;
  int rem;
 long long  int sum=0;
  for(int i=0;i<n.length();i++){
   
    
    sum+=n[i]-'0';
       
  }
  
  if(sum%9==0)
    cout<<"Yes";
  else
    cout<<"No";
  
return 0;
  
}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
#define ll int
int main()
{
  ll n;cin>>n;
  ll a[n][3];
 
  
  for(int i=0;i<n;i++)cin>>a[i][0]>>a[i][1]>>a[i][2];
  
for(ll i=1;i<n;i++)
{
    a[i][0]+=max(a[i-1][1],a[i-1][2]);
    a[i][1]+=max(a[i-1][0],a[i-1][2]);
    a[i][2]+=max(a[i-1][0],a[i-1][1]);
}
cout<<max(a[n-1][0],max(a[n-1][1],a[n-1][2]))<<endl;
}

Measured memory_bytes: 4768
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;


int main(){
    int n;
    ll l;
    cin>>n>>l;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    vector<pair<ll,int>>sum;
    rep(i,n-1)sum.eb(a[i+1]+a[i],i+1);
    sort(sum.begin(),sum.end(),greater<pair<ll,int>>());
    if(sum[0].first<l){
        cout<<"Impossible"<<endl;
        return 0;
    }
    else {
        cout<<"Possible"<<endl;
        for(int i=1;i<sum[0].second;++i)cout<<i<<endl;
        for(int i=n-1;i>sum[0].second;--i)cout<<i<<endl;
        cout<<sum[0].second<<endl;
    }
    return 0;
}

Measured memory_bytes: 3312
#include <cstdio>

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  bool ans = false;
  while (n > 0) {
    if (n % 10 == 7) {
      ans = true;
    }
    n /= 10;
  }
  puts(ans ? "Yes" : "No");
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
unsigned f(unsigned long k){
    if(k == 1)
        return 1;
    return (k*f(k-1))%(1000000000+7);
}
int main(){
    long n,m;
    cin>>n>>m;
    if(abs(n-m)>1){
        cout<<"0";
        return 0;
    }
    long nc = f(n),mc,nn=1;
    if(n==m){
        mc = nc;
        nn = 2;
    }
    else
        mc = f(m);
    cout<<(mc*nc*nn)%(1000000000+7);
}

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

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    ll tmp;
    rep(i,N){
        cin >> tmp;
        A[i]=tmp - (i+1);
    }
    sort(A.begin(),A.end());
    vector<ll> d(N);
    
    d[0]=0;
    rep(i,N){
        d[0]+=(A[i]-A[0]);
    }

    ll ans=d[0];
    rep(i,N-1){
        d[i+1]=d[i]-(A[i+1]-A[i])*(N-2*(i+1));
        ans=min(ans,d[i+1]);
    }
    cout << ans << endl;

    
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
bool DEBUG = false;


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

    int n = N;
    int count = 0;
    while(n > 0){
        n /= 10;
        count++;
    }
    int counts[6] = {9,0,900,0,90000,0};
    int ans = 0;
    for(int i = 0; i < count-1; i++) {
        ans += counts[i];
    }

    if(count == 1){
        ans += N;
    }else if(count == 3){
        ans += N - 100 + 1;
    }else if(count == 5){
        ans += N - 10000 + 1;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (long long i = l; i < r; i++)
using namespace std;
typedef pair<int, int> P;

struct edge {
	int to, cost;
};
class dijkstra {
	int V;
	int d[100002];
	priority_queue<P, vector<P>, greater<P>> que;
	void update(int s, vector<edge> G[]) {
		fill(d, d + V + 1, 100000000000ll);
		d[s] = 0;
		que.push(make_pair(0, s));
		while (!que.empty()) {
			P p = que.top();
			que.pop();
			int v = p.second;
			if (d[v] < p.first) continue;
			rep(i, G[v].size()) {
				edge e = G[v][i];
				if (d[e.to] > d[v] + e.cost) {
					d[e.to] = d[v] + e.cost;
					que.push(make_pair(d[e.to], e.to));
				}
			}
		}
	}

  public:
	dijkstra(int v, int s, vector<edge> G[]) {
		V = v;
		update(s, G);
	}
	int find(int e) {
		return d[e];
	}
};
int gcd(int a, int b) {
	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}
int lcm(int a, int b) {
	return a * b / gcd(a, b);
}
bool prime(int a) {
	if (a == 1) return false;
	for (int i = 2; i * i <= a; i++) {
		if (a % i == 0) return false;
	}
	return true;
}
class Union_Find {
  private:
	vector<int> t, s;

  public:
	Union_Find(int max_length) {
		rep(i, max_length + 1) {
			t.push_back(i);
			s.push_back(1);
		}
	}
	void Union(int x, int y) {
		if (same(x, y)) return;
		int tx = Find(x), ty = Find(y);
		if (s[tx] < s[ty]) {
			s[ty] += s[tx];
			t[tx] = ty;
		}
		else if (s[tx] > s[ty]) {
			s[tx] += s[ty];
			t[ty] = tx;
		}
		else if (tx > ty) {
			t[tx] = ty;
			s[ty] += s[tx];
		}
		else {
			t[ty] = tx;
			s[tx] += s[ty];
		}
	}
	int Find(int n) {
		if (t[n] == n)
			return n;
		else
			return t[n] = Find(t[n]);
	}
	bool same(int x, int y) {
		return Find(x) == Find(y);
	}
	int get_Size(int a) {
		return s[a];
	}
};
signed main() {
	int n,m,k[10],s[10][10],p[10],ans=0;
	cin>>n>>m;
	rep(i,m){
		cin>>k[i];
		rep(j,k[i])cin>>s[i][j];
	}
	rep(i,m)cin>>p[i];
	rep(i,((1<<n))){
		int memo=i,cnt=1,memo2[10];
		fill(memo2,memo2+m,0);
		while(memo){
			if(memo%2==1){
				rep(j,m){
					rep(ck,k[j]){
						if(s[j][ck]==cnt){
							memo2[j]++;
						}
					}
				}
			}
			memo/=2;
			cnt++;
		}
		rep(j,m){
			if(memo2[j]%2!=p[j])goto ioi;
		}
		ans++;
		ioi:;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

result = 0
r = 0
xs = A[0]
cs = A[0]
for l in range(N):
    while r < N - 1 and xs ^ A[r + 1] == cs + A[r + 1]:
        r += 1
        xs ^= A[r]
        cs += A[r]
    result += r - l + 1
    xs ^= A[l]
    cs -= A[l]
print(result)


Measured memory_bytes: 23560
#include <iostream>

using namespace std;

int main()
{
  int n, k;
  cin >> n >> k;

  for (int i = 0; i < n; i++) {
    char c;
    cin >> c;
    if (i == k-1) {
      cout << (char)(c | 0x60);
    } else {
      cout << c;
    }
  }

  cout << endl;
  return 0;
}


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

const int INF = 1000000000;

int main()
{
	while(true){
		int n;
		cin >> n;

		if(n==0)
			break;

		int T[10][10];
		for(int i=0; i<10; i++){
			for(int j=0; j<10; j++){
				if(i==j){
					T[i][j] = 0;
				}
				else{
					T[i][j] = INF;
				}
			}
		}

		int m = 0;		// ????????°

		for(int i=0; i<n; i++){
			int a, b, c;
			cin >> a >> b >> c;

			T[a][b] = T[b][a] = c;

			if(a+1>m){
				m = a+1;
			}
			if(b+1>m){
				m = b+1;
			}
		}

		for(int k=0;k<m;k++){
			for(int i=0;i<m;i++){
				for(int j=0;j<m;j++){
					if(T[i][j]>T[i][k]+T[k][j]){
						T[i][j]=T[i][k]+T[k][j];
					}
				}
			}
		}

		int min=0;
		int total,num;

		for(int i=0;i<m;i++){
			min+=T[0][i];
		}

		for(int i=1;i<m;i++){
			total=0;
			for(int j=0;j<m;j++){
				total+=T[i][j];
			}
			if(min>total){	
				min=total;
				num=i;
			}
		}
		
		cout<<num<<' '<<min<<endl;

	}

	return 0;
}

Measured memory_bytes: 2996
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    int result = -1;

    for (int i = 1; i <= 1010; i++) {
      if ((int) (i * 0.08) == a && (int) (i * 0.1) == b) {
        result = i;
        break;
      }
    }
    System.out.println(result);
  }
}


Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
typedef		 long long int    ll;
typedef		 long double   ld;
typedef		vector<ll>      vll;
#define     fi              first
#define     print(v)        for(ll i:v) cout<<i<<ss
#define     se              second
#define		pb              push_back
#define		nn              "\n"
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		ss              ' '
#define     pii             pair<ll,ll>
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
const double eps = 1e-8;


ll mod=1e9+7;

int main()
{

    ll n;
    cin>>n;
    ll a[n+10];
    ll b[n+10];
    for(ll i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    for(ll i=1; i<=n; i++)
    {
        cin>>b[i];
    }
    sort(a+1,a+n+1);
    sort(b+1,b+n+1,greater<ll>());
    vll v;
    ll num;
    ll cnt=0;
    ll l=0,r=0;
    for(ll i=1; i<=n; i++)
    {
        if(a[i]==b[i])
        {
            l=i;
            num=a[i];
            while(i<=n&&a[i]==b[i])
            {
                i++;
                cnt++;
            }
            r=i-1;
            break;
        }
    }

    if(cnt)
    {
        ll c=0;
        ll i=1;
        vll v;
        while(i<l&&a[i]!=num&&b[i]!=num)
            c++,v.pb(i),i++;
        i=n;
        while(i>r&&a[i]!=num&&b[i]!=num)
            c++,v.pb(i),i--;
        if(cnt>c)
        {
            cout<<"No"<<nn;
        }
        else
        {
            cout<<"Yes"<<nn;
            ll k=0;
            for(ll it : v)
            {
                swap(b[it],b[l++]);
                if(l>r)
                    break;
            }
            for(ll i=1; i<=n; i++)
            {
                cout<<b[i]<<ss;
            }
            cout<<nn;

        }
    }
    else
    {
        cout<<"Yes"<<nn;
        for(ll i=1; i<=n; i++)
        {
            cout<<b[i]<<ss;
        }
        cout<<nn;
    }




}


/* Final check before submit :

1. array size or integer overflow,like uninitialised 0 index.

2. Think twice,code once.check all possible counter test case.

3. Be careful about corner case! n=1?k=1? something about 0?

4. avoid stupid mistake!complexity(t/m)?precision error?submit same code twice?

5. if got WA than remember that you are missing something common.
   *** Be confident!!! who knows? may be your one step back to AC ***
4. minus mod ans=(ans-k+mod)%mod;

*/






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

int main() {
	int		a,b,c,i,j,k,n,m,x,y,ans = 0;
	string	str;

	
	cin >> x;
	
	
	for( i=x; ; i++) {
		k = 0;
		for(j=2;j<i;j++) {
			if (i%j==0) {
				k = 1;
				break;
			}
		}
		if (k==0) break;
	}
	
	
	cout << i << endl;
	

}


Measured memory_bytes: 256
//#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9+7;
const long long INF = 1e15;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N;
	cin >> N;
	VI ans(1e5, 0);
	for (int x = 1; x <= 100; x++) {
		for (int y = 1; y <= 100; y++) {
			for (int z = 1; z < 100; z++) {
				int res =
					x * x + y * y + z * z +
					x * y + y * z + z * x;
				ans[res]++;
			}
		}
	}
	for (int n = 1; n <= N; n++) {
		cout << ans[n] << "\n";
	}
	return 0;
}


Measured memory_bytes: 3088
#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--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef long long int ll;

int main(){
    // read in integer 
    int x;
    int prime = 1;
    cin >> x;
    int m = x/2;

    while(true){
        for (int i = 2; i <= m; i++){
            if (x % i == 0){
                // not prime
                prime = 0;
                break;
            }
        }
        if (prime == 1){
            cout << x << endl;
            return 0;
        }
        x++;
        prime = 1;
    }
}

Measured memory_bytes: 256
A,B = map(int,input().split())
from fractions import gcd 

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

C = gcd(A,B)
E = make_divisors(C)
E.sort()

sosuu = []
ans = 0
for e in E:
    if e == 1:continue
    for s in sosuu:
        if e%s == 0:
            break
    else:
        sosuu.append(e)

print(len(sosuu)+1)            
        
        









Measured memory_bytes: 5304