akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define print(x) cout<<x<<endl;
typedef long long ll;

int main() {
	string a, b, c;
	cin >> a >> b >> c;
	int a_len = a.size();
	int b_len = b.size();
	int c_len = c.size();
	if (a[a_len-1] == b[0] && b[b_len-1] == c[0]) { print("YES"); }
	else { print("NO"); }
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[])
{
  int N, d[100];
  int tmp = 0, count = 0;
  cin >> N;
  for(int i=0;i < N;i++){
    cin >> d[i];
  }
  sort(d,d+N,greater<int>());
  for(int i = 0;i < N;i++){
    if(d[i] == tmp){
      continue;
    }
    tmp = d[i];
    count++;
  }
  cout << count << endl;
  return 0;
}

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

using namespace std;

int main() {
	int h, w;
	cin >> h >> w;
	string a[1111];
	for (int i = 0; i < h; i++)
		cin >> a[i];
	queue<tuple<int, int, int>> q;
	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++)
			if (a[i][j] == '#')
				q.emplace(i, j, 0);
	int r = 0, s[] = { 0,1,0,-1,0 };
	while (!q.empty()) {
		auto t = q.front();
		q.pop();
		r = max(r, get<2>(t));
		for (int i = 0; i < 4; i++) {
			int x = get<0>(t) + s[i], y = get<1>(t) + s[i + 1];
			if (0 <= x && x < h && 0 <= y && y < w&&a[x][y] == '.')
				q.emplace(x, y, get<2>(t) + 1), a[x][y] = '#';
		}
	}
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 13456
#include<iostream>
using namespace std;
int main(){
    long n, a, b, mod, div;
    cin >> n >> a >> b;
    div = n / (a + b);
    mod = n % (a + b);
    if (mod > a){
        mod = a;
    }
    cout << mod + a * div;
    return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int64 mysqrt(int64 x){
	int64 l = 0, r = INF+1, m;
	while(r-l > 1){
		m = l+(r-l)/2;
		if(m*m < x) l = m;
		else r = m;
	}
	return l;
}

int main(void){
	int32 Q;
	cin >> Q;
	REP(_, Q){
		int64 a, b;
		cin >> a >> b;
		if(a > b) swap(a, b);
		int64 x = mysqrt(a*b);
		if(a == b || a+1 == b){
			cout << 2*a-2 << endl;
		}else if(x*(x+1) >= a*b){
			cout << 2*x-2 << endl;
		}else{
			cout << 2*x-1 << endl;
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 int main(){
     int N;
     string S;

     cin >> N >> S;

     int LB[N];

     int black_count = 0;

     for(int i=0;i<N;i++){
         if(S[i] == '#'){
             black_count++;
         }  
         LB[i] = black_count;
     }

     int RW[N];

     int white_count = 0;

     for(int i=N-1;i>=0;i--){
         if(S[i] == '.') {
             white_count++;
         }
         RW[i] = white_count;
     }

     int now_min = INT_MAX;

     for(int i=0;i<N;i++){
         int tmp = LB[i] + RW[i];
         if(tmp < now_min) now_min = tmp;
     }

     cout << now_min - 1 << endl;

     return 0;
 }

Measured memory_bytes: 2180
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <cmath>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());

int main(){
    double a, b, c,s ;
    cin >> a >> b >> c;
    s = (a + b + c) / 2;
    cout << (int)sqrt(s * (s - a) * (s - b) * (s- c)) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/agc029_a.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  string S;
  cin >> S;

  ll cnt = 0;
  ll ans = 0;
  rep(i, S.size()) { 
    if (S[i] == 'B') {
      cnt++;
    } else {
      ans += cnt;
    }
  }

  cout << ans << endl;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r, g, b, n;
    cin >> r >> g >> b >> n;
    int cnt = 0;
    for (int i = 0; r * i <= n; i++) {
        for (int j = 0; b * j <= n - r * i; j++) {
            int k = n - r * i - b * j;
            if (k % g == 0) {
                cnt++;
            }
        }
    }
    cout << cnt << endl;
}

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

int main() {
  int N,C,Z=0;
  cin>>N>>C;
  vector<vector<int>> p(100001,vector<int>(C));
  for(int i=0;i<N;i++){
    int a,b,c;
    cin>>a>>b>>c;
    c--;
    p.at(a).at(c)++;
    p.at(b).at(c)--;
  }
  vector<int> q(200001);
  for(int i=0;i<C;i++){
    for(int j=1;j<100001;j++){
      if(p.at(j).at(i)==1){
        q.at(j*2-1)++;
      }
      if(p.at(j).at(i)==-1){
        q.at(j*2)--;
      }
    }
  }
  for(int i=1;i<=200000;i++){
    q.at(i)+=q.at(i-1);
    Z=max(Z,q.at(i));
  }
  cout<<Z<<endl;
      
}

Measured memory_bytes: 17152
#include <iostream>
#include <deque>
#include <string>
#include <map>

using namespace std;

int main(void){
  int n;

  cin >> n;
  cin.ignore();
  for(int i=0;i<n;i++){
	map<int,char> m;
	int pos=0;
	string str;
	char tmp[2];

	
	getline(cin,str);
	int len = str.size();

	for(int j=0;j<len;j++){
	  if(m.find(pos) == m.end()){
		m[pos] = str[j];
	  }
	  if(j == len-1) break;
	  tmp[0] = str[++j];
	  tmp[1] = str[++j];
	  if(tmp[0] == '-'){
		pos++;
	  }else{
		pos--;
	  }
	}
	map<int,char>::iterator it = m.begin();

	while(it != m.end()){
	  cout << (*it).second;
	  ++it;
	}
	cout << endl;
  }
}

Measured memory_bytes: 0
n,m=map(int,input().split())
ls=[]
for i in range(m):
    lsin=list(map(int,input().split()))
    del lsin[0]
    ls.append(lsin)
lp=list(map(int,input().split()))
sans=0
for i in range(2**n):#switch pattern
    q=0
    for j in range(m):#for bulb
        non=0#onの個数
        for s in ls[j]:
            #non+=i%(2**(s-1))
            #non+=(i//2**(s-1))%2
            non+=((2**(s-1))&i )/(2**(s-1))#これでも良い
        #print("non",i,non)
        if non%2!=lp[j]:
            q=1
            break
    if q==0:
        #print("ok",i)
        sans+=1
print(sans)
#for i in range(2):
#    pass
#print(i)
#print(ls)
#print(lp)


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved
int main(){
    long long n,m,q;
    cin>>n>>m>>q;

    long long inc[510][510]={};
    //inc[l][r]:=閉区間[l,r]に含まれる線路の数
    rep(i,m){
        long long l,r;
        cin>>l>>r;
        inc[l][r]++;
    }
    for(int r=n;r>=0;r--){
        for(int l=r;l>=1;l--){
            inc[l][r]+=inc[l+1][r];
        }
    }
    for(int l=0;l<=n;l++){
        for(int r=l;r<=n;r++){
            inc[l][r]+=inc[l][r-1];
        }
    }
    rep(i,q){
        long long p,q;
        cin>>p>>q;
        cout<<inc[p][q]<<"\n";
    }


    return 0;

}
/*


*/


Measured memory_bytes: 2944
cnt=0
n,m,c=map(int,input().split())
b=list(map(int,input().split()))

for i in range(n):
  sum=0+c
  a=list(map(int,input().split()))
  for j in range(m):
    sum+=a[j]*b[j]
  if sum>0:
    cnt+=1
print(cnt)

Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys
from collections import defaultdict
sys.setrecursionlimit(10**8)


class Graph(object):
    def __init__(self, N):
        self.N = N
        self.E = defaultdict(list)

    def add_edge(self, f, t, w=1):
        self.E[f].append((t, w))


def solve(N: int, M: int, x: "List[int]", y: "List[int]"):
    g = Graph(N)
    for xx, yy in zip(x, y):
        g.add_edge(xx-1, yy-1)
        g.add_edge(yy-1, xx-1)

    dp = [0]*N

    def dfs(node, par=-1):
        dp[node] = 1
        for child, _ in g.E[node]:
            if child == par:
                continue
            dp[node] *= dfs(child, node) + 1
            dp[node] %= M
        return dp[node]

    ans = [0]*N

    def dfs_2(node, par=-1):
        ans[node] = 1
        for child, _ in g.E[node]:
            ans[node] *= dp[child]+1
            ans[node] %= M

        # 一要素を覗いた積を求めるため、昇順の積、降順の積を求めておく
        K = len(g.E[node])
        left, right = [1]*K, [1]*K
        for i in range(K):
            t, w = g.E[node][i]
            left[i] = left[i-1]*(dp[t]+1)
            left[i] %= M
        for i in range(K-1, -1, -1):
            t, w = g.E[node][i]
            if i != K-1:
                right[i] = right[i+1]*(dp[t]+1)
            else:
                right[i] = dp[t]+1
            right[i] %= M

        for i in range(K):
            child, _ = g.E[node][i]
            if child == par:
                continue
            dp[node] = 1
            if i:
                dp[node] *= left[i-1]
            if i+1 < K:
                dp[node] *= right[i+1]
            dp[node] %= M
            dfs_2(child, node)
    dfs(0)
    dfs_2(0)

    for a in ans:
        print(a % M)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    x = [int()] * (N - 1)  # type: "List[int]"
    y = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, M, x, y)


if __name__ == '__main__':
    main()


Measured memory_bytes: 162792
import sys
inputs = sys.stdin.readlines()

M, D = map(int, inputs[0].split())

good_dates = []
for date in range(D):
    d10 = (date+1) // 10
    d1 = (date+1) % 10
    if d1 >= 2 and d10 >= 2:
        if d1*d10 <= M:
            good_dates.append((d1*d10, date))
print(len(good_dates))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
// #define int ll
using PII = pair<int, int>;
 
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
 
template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) { 
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }
 
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}
 
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
ll MOD = 1000000007;

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

  ll n, m;
  cin >> n >> m;
  vector<vector<PII>> vec(n+1);
  vector<ll> p(m), y(m);
  REP(i, m) {
    cin >> p[i] >> y[i];
    vec[p[i]].push_back({y[i], i});
  }

  vector<string> ans(m);
  REP(i, n+1) {
    sort(ALL(vec[i]));
    ll k = 1;
    for(auto j: vec[i]) {
      string a = to_string(i);
      string b = to_string(k);
      ans[j.second] = string(6-a.size(), '0') + a + string(6-b.size(), '0') + b;
      ++k;
    }
  }

  REP(i, m) cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 13952
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String s=sc.next();
    char[] arr = s.toCharArray();
    if(arr[2]==arr[3])
    {
      if(arr[4]==arr[5]){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }else{
        System.out.println("No");
      }
  }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) std::cin>>(P)
#define IN2(P1,P2) std::cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) std::cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) std::cin>>V[I]
#define OUT(P) std::cout<<P<<std::endl
#define OUT2(P1,P2) std::cout<<P1<<" "<<P2<<std::endl
#define OUT3(P1,P2,P3) std::cout<<P1<<" "<<P2<<" "<<P3<<std::endl
#define OUTS(I,N,V) REP(I,N) std::cout<<V[i]<<std::endl
#define ALL(C) (C).begin(),(C).end()
using namespace std;
using namespace __gnu_pbds;
int N,h[101],i,cnt2;
bool flag,is_first;
void rec(int cnt){
  flag=true;
  REP(i,N){
    if(h[i]!=0){
      flag=false;
      break;
    }
  }
  if(flag){
    OUT(cnt);
    exit(0);
  }
  flag=false;
  REP(i,N){
    if(h[i]!=0){
      h[i]--;
      flag=true;
    }
    else if(h[i]==0&&flag)rec(cnt+1);
  }
  rec(cnt+1);
}
inline void solve(){
  IN(N);
  INS(i,N,h);
  rec(0);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 384
import math
A,B=list(map(float,input().split()))
A=int(A)
Bfloat, Bint = math.modf(B)
#print(Bfloat)
Bfloat=int(round(Bfloat*100,2))


ABfloat=int(A*Bfloat)
strABfloat=str(ABfloat)
lenABfloat=len(strABfloat)
#print(strABfloat)
temp=0
if lenABfloat>=3:
  for i in range(lenABfloat-2):
    temp+=int(strABfloat[i])*10**(lenABfloat-i-3)  
    #print(temp)
print(int(A*Bint)+temp)

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


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

	int a, b, c, d, i, j, k;
	string s;
	cin >> s;
	a = s[0] - '0';
	b = s[1] - '0';
	c = s[2] - '0';
	d = s[3] - '0';

	for (i = -1; i <= 1; i += 2) {
		for (j = -1; j <= 1; j += 2)
			for (k = -1; k <= 1; k += 2) {
				if (a + i * b + j * c + k * d == 7) {
					cout << a;
					if (i == -1) cout << "-";
					else cout << "+";
					cout << b;
					if (j == -1) cout << "-";
					else cout << "+";
					cout << c;
					if (k == -1) cout << "-";
					else cout << "+";
					cout << d << "=7\n";
					goto outer;
				}
			}
	}
outer:;

	return 0;
}


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

# A = list(enumerate(A))
# A.sort(key = lambda x: x[1])
# for i in range(N):
#     print(A[i][0] + 1, end = " ")

A = sorted(range(N), key = lambda i: A[i])
for i in range(N):
    print(A[i]+1, end = " ")


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

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
const int INF = INT_MAX/3;
const double EPS = 1e-14;

template<typename U, typename T>
void chmin(U &x, T y) { x = min(x, y); }

template<typename U, typename T>
void chmax(U &x, T y) { x = max(x, y); }

typedef long long int lli;

int N, P;

const int PRIMEMAX = 150000;
int FACTOR[PRIMEMAX];
vector<int> Primes;
void sieve(lli upb) {
  FACTOR[0] = FACTOR[1] = -1;
  for(lli n = 0; n < upb; ++n) {
    if (FACTOR[n] != 0) continue;
    Primes.push_back(n);
    lli kn = n * n;
    while (kn < PRIMEMAX) { FACTOR[kn] = n; kn += n; }
  }
}

bool is_prime(int n) {
  return FACTOR[n] == 0;
}

int main() {
  cout << fixed << setprecision(12);
  sieve(PRIMEMAX);
  while (cin >> N >> P and N != -1) {
    auto iter = upper_bound(ALL(Primes), N);
    vector<int> v;
    REP(i, 100) FOR(j, i, 100 + i) {
      v.push_back(*(iter + i) + *(iter + j));
    }
    sort(ALL(v));
    cout << v[P-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 1956
#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)
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define emb emplace_back
#define fcout cout << fixed << setprecision(15)

using namespace std;
using ll = long long;
using P = pair<int,int>;

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

int main() {
  int x,y,z;
  cin >> x >> y >> z;

  cout << z << " " << x << " " << y << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5 + 5;
int dp[N];
int n;
vector<int> v(N);
int res(int id){
		if(id == n){
    	return 0;
    }
    int &ans = dp[id];
    if(ans != -1)
    	return ans;
  	if(id < n-1)
    	ans = min(abs(v[id + 1] - v[id]) + res(id + 1) , abs(v[id+2]-v[id]) + res(id + 2)) ;
    if(id == n - 1)
    	ans = abs(v[id + 1] - v[id]);
    return ans;
}
int32_t main() {
	memset(dp, -1, sizeof(dp));
	cin >> n;
  for(int i = 1; i <= n; i++)
  	cin >> v[i];
  cout << res(1);
}


Measured memory_bytes: 7148
import java.util.Scanner;

//Rational Irrationals
public class Main{

	static long gcd(long a, long b){
		if(a < b){
			long tmp = a;
			a = b;
			b = tmp;
		}
		while(b!=0){
			long r = a%b;
			a = b;
			b = r;
		}
		return a;
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int p = sc.nextInt();
			int n = sc.nextInt();
			if((p|n)==0)break;
			double rp = Math.sqrt(p);
			int num = 1;
			int den = 1;
			boolean up = true;
			int x, y, u, v;
			x = y = u = v = 0;
			double d1, d2;
			d1 = -n;
			d2 = n;
			while(num<=n&&den<=n){
				double d = num*1.0/den-rp;
				if(d<0){
					up = true;
					if(d1<d&&gcd(num,den)==1){
						d1 = d;
						u = num;
						v = den;
					}
				}
				else{
					up = false;
					if(d<d2&&gcd(num,den)==1){
						d2 = d;
						x = num;
						y = den;
					}
				}
				num += up?1:0;
				den += up?0:1;
			}
			System.out.println(x+"/"+y+" "+u+"/"+v);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <vector>

bool Check(const std::vector<int>::const_iterator It, int m)
{
    if(m == 0) return true;
    if(m <  0) return false;
    if(*It == -1) return false;
    return
        Check(It+1, m - *It) ||
        Check(It+1, m);
}

int main()
{
    int n;
    std::cin >> n;
    std::vector<int> A(n+1);
    for(int i = 0; i < n; ++i){
        std::cin >> A[i];
    }
    A[n] = -1;
    
    int q;
    std::cin >> q;
    for(int i = 0; i < q; ++i){
        int m;
        std::cin >> m;
        std::cout << (Check(A.begin(), m) ? "yes" : "no") << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 3108
using System.Collections.Generic;
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var d = new Dictionary<long, int>();
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        for (int i = 0; i < n; i++)
        {
            var w = int.Parse(line[i]);
            if (d.ContainsKey(w)) d[w]++;
            else d[w] = 1;
        }
        var ret = 0L;
        if (d.Count(x => x.Value >= 4) == 0 && d.Count(x => x.Value >= 2 && x.Value <= 3) <= 1)
        { ret = 0; goto end; }
        var a = d.Where(x => x.Value >= 2).OrderByDescending(x => x.Key).Take(2).ToArray();
        if (a[0].Value >= 4) ret = a[0].Key * a[0].Key;
        else ret = a[0].Key * a[1].Key;
        end:;
        Console.WriteLine(ret);
    }
}



Measured memory_bytes: 26848
#include<stdio.h>
int main()
{
	int W, H, x, y, r;
	scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);

	if (r <= x&&x <= H - r&&r <= y&&y <= H - r)
		printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 584
use std::io::*;

fn main() {
  let stdin = stdin();
  let line = stdin.lock().lines().next().unwrap().unwrap();
  let n = line.parse::<u32>().unwrap();

  call(n);
}

fn call(n: u32) {
  let mut buf = String::new();

  for i in 1..(n + 1) {
    if i % 3 == 0 {
      buf.push_str(&format!(" {}", i));
      continue;
    }

    let mut x = i;
    while x != 0 {
      if x % 10 == 3 {
        buf.push_str(&format!(" {}", i));
        break;
      }
      x /= 10;
    }
  }

  println!("{}", buf);
}



Measured memory_bytes: 5048
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
typedef long long int ll;
typedef long double ld;
#define vvv vector<vector<vector<long long int>>>
#define vvvl(a, b, c, d) vector<vector<bitset<80*80*81>>>(a, vector<vector<long long int>>(b, vector<long long int> (c, d)));
using namespace std;
int main(int argc, char const *argv[]) {
  ll h, w;std::cin >> h >> w;
  vvi a = vv(h, w, 0, int);
  vvi b = vv(h, w, 0, int);
  for(int i=0;i<h;i++) for(int j=0;j<w;j++) scanf("%d", &a[i][j]);
  for(int i=0;i<h;i++) for(int j=0;j<w;j++) scanf("%d", &b[i][j]);
  vector<vector<bitset<80*80*170>>> dp = vector<vector<bitset<80*80*170>> >(h+1, vector<bitset<80*80*170>>(w+1, 0));
  ll zero = 80*80*85;
  dp[1][1].set(zero);
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      ll sa = abs(a[i-1][j-1] - b[i-1][j-1]);
      if(i==1&&j==1){
        dp[i][j] = ((dp[i][j] << sa) | (dp[i][j] >> sa));
        continue;
      }
      if(i==1){
        dp[i][j] = ((dp[i][j-1] << sa) | (dp[i][j-1] >> sa));
        continue;
      }
      if(j==1){
        dp[i][j] = ((dp[i-1][j] << sa) | (dp[i-1][j] >> sa));
        continue;
      }
      dp[i][j] = (((dp[i-1][j] | dp[i][j-1]) << sa) | ((dp[i-1][j] | dp[i][j-1]) >> sa));
    }
  }
  for(int i=zero;i<80*80*170;i++){
    if(dp[h][w][i]) {
      std::cout << i-zero << '\n';
      break;
    }
  }
  return 0;
}


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

int main() {
    using namespace std;
    constexpr unsigned long MOD = 1000000007;
    unsigned long N;
    cin >> N;
    vector<unsigned long> cnt(60);
    for(unsigned long _ = 0, A; _ < N; ++_){
        cin >> A;
        for(unsigned long i = 0; i < 60; ++i)if(1 & (A >> i))cnt[i]++;
    }
    unsigned long ans{0}, r{1};
    for(unsigned long i = 0; i < 60; ++i){
        (ans += (cnt[i] * (N - cnt[i])) % MOD * r) %= MOD;
        (r *= 2) %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

int64_t MOD = 1000000007;
double PI = 3.141592653589793;

int main()
{
    string S, T;
    cin >> S >> T;
    int ans = MOD;
    int SS = S.size(), TS = T.size();
    for (int i = 0; i <= SS - TS; i++)
    {
        int tmp = 0;
        for (int j = 0; j < TS; j++)
        {
            if (S[i + j] != T[j])
                tmp++;
        }
        ans = min(ans, tmp);
    }
    cout << ans;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
    int a, b; cin >> a >> b;

    cout << max(0, a - 2 * b) << endl;

    return 0;
}


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

{
  int x,y;
  cin>>x>>y;
  if(y%2==1)
  {
    cout<<"No";
    return 0;}
 int a=4*x;
 int b=2*x;
 if(a==y){
   
 cout<<"Yes";
 return 0;
 }
 else 
 if(b==y)
 cout<<"Yes";
 else if(a>y&&b<y)
 cout<<"Yes";
 else
cout<<"No";
  return 0;
  
}

Measured memory_bytes: 3636
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
int n = sc.nextInt();
int[] c=new int[n];
int[] s=new int[n];
int[] f=new int[n];
for (int i = 1; i < n; i++) {
    c[i]=sc.nextInt();
    s[i]=sc.nextInt();
    f[i]=sc.nextInt();
}
for (int i = 1; i < n; i++) {
    int t=0;
    for (int j = i; j < n; j++) {
        if(t<s[j]){t=s[j];}else if(t%f[j]!=0){t+=(f[j]-t%f[j]);}
        t+=c[j];
    }
    out.println(t);
}
out.println(0);
}}

Measured memory_bytes: 25840
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

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

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#ifdef LOCAL
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

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

    ll A[N];
    int cnt = 0;
    ll m = INF;
    REP(i, N) {
        cin >> A[i];
        m = min(abs(A[i]), m);
        if (A[i] < 0) {
            ++cnt;
        }
    }

    ll ans = 0;

    REP(i, N) {
        ans += abs(A[i]);
    }

    if (cnt % 2 == 1) {
        ans -= 2 * m;
    }
    
    cout << fixed << setprecision(20);
    cout << ans << endl;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <string>
//#include <boost/multiprecision/cpp_int.hpp>
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll  long long
#define fp cout<<fixed<<setprecision(9);
#define ifor(j,n) for(int i=j ;i<n;i++)
#define jfor(k,n) for(ll j=k ;j<n;j++)
#define pb push_back
#define mod 1000000007
using namespace std;
//using namespace boost::multiprecision;

//Compiler version g++ 6.3.0
int search (vector <long long> v,long long m,int n) 
{ 

    int start = 0;
    int ans = -1; 
    while (start <=n) 
    { 
     int mid = (start + n) / 2;
     if (v[mid] <= m) 
         start = mid + 1;
     else
   { 
   ans = mid; 
   n = mid - 1; 

       } 

    } 
    return ans; 
} 

int main()
{
 FAST 

   int d,t,s;
   cin>>d>>t>>s;
  float ti=d/(float)s;
  if((float)t>=ti)
    	cout<<"Yes";
  else
    	cout<<"No";
}
 
 

Measured memory_bytes: 3648
#include <iostream>
#include <queue>
#include <algorithm>
#include <cstring>
using namespace std;

typedef int W;
const int MAXV = 1005;
const int MAXE = 5005;
const int INF = 100000000;
int adj[100][100];

int main() {
  int n,m,s,g1,g2,b1,b2,c;

  while(cin>>n>>m>>s>>g1>>g2, n|m|s|g1|g2) {
    s--,g1--,g2--;


    for(int i=0; i<100; ++i) {
      for(int j=0; j<100; ++j)
        adj[i][j] = INF;
      adj[i][i] = 0;
    }

    for(int i=0; i<m; ++i) {
      cin>>b1>>b2>>c;
      b1--,b2--;
      adj[b1][b2] = c;
    }

    for (int k = 0; k < n; ++k)
      for (int i = 0; i < n; ++i) {
        const int p = adj[i][k];
        for (int j = 0; j < n; ++j)
          adj[i][j] = min(adj[i][j], p + adj[k][j]);
      }

    int minc = INF;
    for(int i=0; i<n; ++i)
      minc = min(minc, (adj[s][i]+adj[i][g1]+adj[i][g2]));

    cout<<minc<<endl;
  }
}

Measured memory_bytes: 1200
#include<stdio.h>
#include<string.h>

char o[55];
char e[55];
char pw[105];

int main(){
	int no,ne;
	no = ne = 0;
	scanf("%s%s",o,e);
	for(int i = 0; i < (strlen(o)+strlen(e)); i++){
		if(i % 2 == 0){
			pw[i] = o[no++];
		}
		else pw[i] = e[ne++];
	}
	printf("%s",pw);
	return 0;
}

Measured memory_bytes: 128
local mce, mfl, msq, mmi, mma = math.ceil, math.floor, math.sqrt, math.min, math.max
local n = io.read("*n")
local at, bt = {}, {}
local c = {}
local ref = {}
for i = 1, n do
  ref[i] = {}
  ref[i].dst = {}
  ref[i].dstnum = 0
  ref[i].c = 0
  ref[i].reserved = false
end
for i = 1, n - 1 do
  local a, b = io.read("*n", "*n")
  at[i], bt[i] = a, b
  table.insert(ref[a].dst, b)
  table.insert(ref[b].dst, a)
  ref[a].dstnum, ref[b].dstnum = ref[a].dstnum + 1, ref[b].dstnum + 1
end
for i = 1, n do
  c[i] = io.read("*n")
end
table.sort(c)
local tasks = {}
local tasknum, done = 0, 0
local function addtask(idx)
  ref[idx].reserved = true
  table.insert(tasks, idx)
  tasknum = tasknum + 1
end
for i = 1, n do
  if #(ref[i].dst) == 1 then
    addtask(i)
  end
end
while done < tasknum do
  done = done + 1
  local idx = tasks[done]
  ref[idx].c = c[done]
  for i = 1, #(ref[idx].dst) do
    local dstidx = ref[idx].dst[i]
    if not ref[dstidx].reserved then
      ref[dstidx].dstnum = ref[dstidx].dstnum - 1
      if ref[dstidx].dstnum == 1 then
        addtask(dstidx)
      end
    end
  end
end

local sum = 0
for i = 1, n - 1 do
  sum = sum + mmi(ref[at[i]].c, ref[bt[i]].c)
end
print(sum)
io.write(ref[1].c)
for i = 2, n do
  io.write(" " .. ref[i].c)
end
io.write("\n")


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

int main(){
  string s;
  cin >> s;
  int j = 1;
  for(int i = 0; i < s.size(); i++){
    if((i+1)%2==0){
      if(s[i] == 'R'){
        j = 0;
      }
    }
    if((i+1)%2==1){
      if(s[i] == 'L'){
        j = 0;
      }
    }
  }
  if(j  == 0){
    cout << "No" ;
  }
  else{
    cout << "Yes";
  }
}
  

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

int main(){
  int N,k,s;
  cin>>N;
  s=0;
  for(int i=1;i<10;i++){
    if(N%i==0){
      k=N/i;
      if(k<10){
        s=1;
      }
    }
  }
  if(s==0){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]

def chk(L):
    NN = 5
    BIT=[0] * (2**NN+1)
    def addbit(i):
        while i <= 2**NN:
            BIT[i] += 1
            i += i & (-i)
 
    def getsum(i):
        ret = 0
        while i != 0:
            ret += BIT[i]
            i -= i&(-i)
        return ret
    s = 0
    for l in L[::-1]:
        s += getsum(l+1)
        addbit(l+1)
    return s
ans = 1 << 100
for m in range(1<<N):
    if bin(m).count("1") & 1: continue
    C = [[], []]
    for i in range(N):
        p = m >> i & 1
        q = p + i & 1
        C[q].append(((A[i] if p == 0 else B[i]) << 5) + i)
    if len(C[1]) != N // 2: continue
    C[0].sort()
    C[1].sort()
    CC = [C[i&1][i//2] for i in range(N)]
    for i in range(1, N):
        if CC[i-1] >> 5 > CC[i] >> 5: break
    else:
        CCC = [c % 32 for c in CC]
        ans = min(ans, chk(CCC))
print(ans if ans < 1 << 100 else -1)

Measured memory_bytes: 52956
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}




signed main(){
    char c;
    cin >> c;
    if('a' <= c && c <= 'z')
        cout << "a" <<endl;
    else
        cout << "A" <<endl;
    return 0;
}


Measured memory_bytes: 3588
from bisect import bisect
n, l, t = map(int, input().split())
ants = [list(map(int, input().split())) for _ in range(n)]
bnts = []
diff = []

for i in range(n):
	x, w = ants[i][0], 3 - 2*ants[i][1]
	bnts.append((x + t*w) % l)
	if i == 0:
		zero = bnts[-1]
	if ants[i][1] != ants[0][1]:
		if ants[0][1] == 1:
			diff.append(x - ants[0][0])
		else:
			diff.append(l - (x - ants[0][0]))

bnts.sort()
num = 0
quo, mod = t//l, t%l
num += quo * len(diff) * 2
diff.sort()
diff += [d+l for d in diff]
num += bisect(diff, mod*2)
num %= n
for i in range(n):
	if bnts[i] == zero:
		if ants[0][1] == 1:
			true_zero = (i-num) % n
		else:
			if i < n-1:
				if bnts[i+1] == zero:
					num -= 1
			true_zero = (i+num) % n

ans = bnts[true_zero:] + bnts[:true_zero]
print(*ans, sep="\n")

Measured memory_bytes: 71512
#include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, b, e) for(int i = (b); i <= (int)(e); ++i)
#define FORD(i, b, e) for(int i = (b); i >= (int)(e); --i)

#define sim template<class n
sim, class s> ostream & operator << (ostream &p, pair<n, s> x)
{return p << "<" << x.f << ", " << x.s << ">";}
sim> auto operator << (ostream &p, n y) ->
typename enable_if<!is_same<n, string>::value, decltype(y.begin(), p)>::type 
{int o = 0; p << "{"; for(auto c: y) {if(o++) p << ", "; p << c;} return p << "}";}
void dor() {cerr << endl;}
sim, class...s> void dor(n p, s...y) {cerr << p << " "; dor(y...);}
sim, class s> void mini(n &p, s y) {if(p>y) p = y;}
sim, class s> void maxi(n &p, s y) {if(p<y) p = y;}
#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif 

#define I(x) #x " =", (x), " "
#define A(a, i) #a "[" #i " =", i, "] =", a[i], " "
const int MXN = 2e5+5;
int in[MXN];
bool byl[MXN];

int main()
  {
  ios_base::sync_with_stdio(0); 
  int n;
  cin >> n;
  LL k;
  cin >> k;

  FOR(i, 1, n)
    cin >> in[i];

  int kroki = 0;
  VI V;
  int p = 1;
  do
    {
    V.PB(p);
    byl[p] = 1;
    p = in[p];
    kroki++;
    }
  while(byl[p] == 0 && kroki < k);
  debug(V);

  if(kroki == k)
    {
    cout << p << endl;
    return 0;
    }
  VI przed;
  VI po;
  bool byl = 0;
  for(auto i: V)
    {
    if(i == p)byl = 1;

    if(byl)po.PB(i);
    else przed.PB(i);
    }

  debug(przed, po);

  cout << po[(k - przed.size()) % po.size()] << endl;
  }


Measured memory_bytes: 6228
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 99999999;
const ll linf = 999999999999999999;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



int main(){
	int sx,sy,tx,ty;
	cin >> sx>>sy>>tx>>ty;

	rep(i,0,ty-sy)cout << "U";
	rep(i,0,tx-sx)cout << "R";
	rep(i,0,ty-sy)cout << "D";
	rep(i,0,tx-sx+1)cout << "L";
	rep(i,0,ty-sy+1)cout << "U";
	rep(i,0,tx-sx+1)cout << "R";
	cout << "D";
	cout << "R";
	rep(i,0,ty-sy+1)cout << "D";
	rep(i,0,tx-sx+1)cout << "L";
	cout << "U" << endl;
	
	
	
	
	
	
	return  0;
}

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

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

  string s;
  cin >> s;

  if(s == "ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;

  return 0;
}

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

ll N, K;
vector<ll> a(100);

ll memo[105][105][260];
bool isUed[105][105][260];

ll dfs(int i, int n, int s) {
    if (isUed[i][n][s]) return memo[i][n][s];

    if(i == N) {
        if (s != K) return 0;
        ll ret = 1;
        for (ll i = 1; i <= n; i++) mulM(ret, i); 
        return ret;
    }

    memo[i + 1][n + 1][s ^ a[i]] = dfs(i + 1, n + 1, s ^ a[i]);
    memo[i + 1][n][s] = dfs(i + 1, n, s);

    ll ret = 0;
    addM(ret, memo[i + 1][n + 1][s ^ a[i]]);    
    addM(ret, memo[i + 1][n][s]);

    isUed[i][n][s] = true;
    return memo[i][n][s] = ret;
}

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

    REP(i, N) cin >> a[i];

    cout << dfs(0,0,0) << endl;

    return 0;
}

Measured memory_bytes: 23936
#include<bits/stdc++.h>
#define maxn 1001000
#define mod 998244353
using namespace std;
int fac[maxn],inv[maxn],n,m,K,M;
int qpow(int a,int b){
	int ans=1,tmp=a;
	for(;b;b>>=1,tmp=1ll*tmp*tmp%mod)
		if(b&1)ans=1ll*ans*tmp%mod;
	return ans;
}
int C(int x,int y){
	if(x>y||x<0)return 0;
	return 1ll*fac[y]*inv[x]%mod*inv[y-x]%mod;
}
int main(){
	scanf("%d%d",&n,&K),M=K,fac[0]=inv[0]=1;
	for(int i=1;i<=M;++i)fac[i]=1ll*fac[i-1]*i%mod;
	inv[M]=qpow(fac[M],mod-2);
	for(int i=M-1;i>=1;--i)inv[i]=1ll*inv[i+1]*(i+1)%mod;
	int ans=0;
	for(int i=0;i<=K-i;++i){
		int r=K-i,b=i;
		if(r-b+min(r,b)<n)continue; 
		if(r>b)ans=(1ll*ans+C(r,r+b)-C(r+r-n+1,r+b)+mod)%mod;
		else ans=(1ll*ans+C(r,r+b-1)-C(r+b-n+1,r+b-1)+mod)%mod;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 6272
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main {
	public static void main(String[] args) throws IOException {
		try (AtCoderReader ar = new AtCoderReader()) {

			int N = ar.nextInt();

			Set<Integer> sets = new HashSet<>();
			for (int i = 0; i < N; i++) {
				sets.add(ar.nextInt());
			}

			System.out.println(sets.size());
		}
	}

	public static class AtCoderReader implements AutoCloseable {
		private final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		public final String[] nextStringArray() throws IOException {
			return this.br.readLine().split(" ");
		}

		public final Stream<String> nextStream() throws IOException {
			return Arrays.stream(this.nextStringArray());
		}

		public final IntStream nextIntStream() throws NumberFormatException, IOException {
			return this.nextStream().mapToInt(Integer::parseInt);
		}

		public final int[] nextIntArray() throws IOException {
			return this.nextIntStream().toArray();
		}

		public final int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(nextLine());
		}

		public final int nextInt(int radix) throws NumberFormatException, IOException {
			return Integer.parseInt(nextLine(), radix);
		}

		public final long nextBits() throws NumberFormatException, IOException {
			return Long.parseLong(nextLine().replaceAll(" ", ""), 2);
		}

		public final String nextLine() throws IOException {
			return this.br.readLine();
		}

		@Override
		public final void close() throws IOException {
			br.close();
		}
	}
}


Measured memory_bytes: 22484
#include <bits/stdc++.h>
#define ll long long
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define endl "\n"
using namespace std;

bool sortbysec(const pair<ll,ll> &a, 
              const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
} 

ll maxSubArraySum(ll a[], ll size) 
{ 
    ll max_so_far = INT_MIN, max_ending_here = 0; 
  
    for (ll i = 0; i < size; i++) 
    { 
        max_ending_here = max_ending_here + a[i]; 
        if (max_so_far < max_ending_here) 
            max_so_far = max_ending_here; 
  
        if (max_ending_here < 0) 
            max_ending_here = 0; 
    } 
    return max_so_far; 
} 

ll findSubarraySum(ll arr[], ll n, ll sum = 0) 
{
    unordered_map<ll, ll> prevSum;
    ll res = 0;
    ll currsum = 0;
    for (ll i = 0; i < n; i++)
    {
        currsum += arr[i];
        if (currsum == sum) res++;
        if (prevSum.find(currsum - sum) != prevSum.end()) res += (prevSum[currsum - sum]);
        prevSum[currsum]++;
    }
    return res; 
} 
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
ll powmp(ll x, ll y, ll p) 
{ 
    ll res = 1;     x = x % p;   
    while (y > 0) 
    {  
        if (y & 1)  res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll x;cin>>x;
    ll in=100;
    ll ans=0;
    while(in<x)
    {
        ans++;
        in = (in/100)+in;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3656
#include <iostream>

using namespace std;

int main(){
    
    int a,b;
    cin >> a >> b;

    int temp;
    int result;

    if(a > b){
        temp = a % b;
        for(int i=1; i<=temp; i++){
            if( (temp%i == 0) && (b%i == 0)) result = i;
        }
    }else if(b > a){
        temp = b % a;
        for(int i=1; i<=temp; i++){
            if( (a%i == 0) && (temp%i == 0)) result = i;
        }
    }else{
        result = a;
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b;
	cin >> a >> b;

	puts(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0 ? "Possible" : "Impossible");

	return 0;
}

Measured memory_bytes: 256
n,l = map(int,input().split())
m = 400
e = []
ii = -1
tmp = 400
for i in range(1,n+1):
    e.append(l + i - 1)
for i,v in enumerate(e):
    if m > abs(v):
        ii = i
        m = abs(v)
        tmp = v
print(sum(e) - tmp)

Measured memory_bytes: 3064
using System;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            var k = int.Parse(Console.ReadLine());
            int ans = 1;
            for (int i = 0; i < n; i++)
            {
                if (ans > k) ans += k;
                else ans *= 2;
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
//#define lop(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
int main() {
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(false);
//	cin.tie(0);

	int n, m;
	cin >> n >> m;
	if (n == m) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

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

int main() {
    long a, b;
    long d, r;
    double f;
    cin >> a >> b;

    d = a / b;
    r = a % b;
    f = (double)a / b;

    printf("%d %d %.5lf", d, r, f);

    return 0;
}


Measured memory_bytes: 3200
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();

            string[] values = input.Split(' ');
            int A = int.Parse(values[0]);
            int B = int.Parse(values[1]);
            int C = int.Parse(values[2]);

            int i ;
            var list = new List<int>();

            i = A;
            A = B;
            B = i;

            i = A;
            A = C;
            C = i;

            list.Add(A);
            list.Add(B);
            list.Add(C);
            Console.WriteLine("{0}",string.Join(" ",list));
        }
    }
}

Measured memory_bytes: 13268