akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>> data(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> data.at(i).at(j);
    }
  }
  
  //H
  vector<bool> heightWhite(W, false);
  for (int i = 0; i < W; i++) {
    bool isAllWhite = true;
    for (int j = 0; j < H; j++) {
      if (data.at(j).at(i) == '#') {
        isAllWhite = false;
        break;
      }
    }
    
    if (isAllWhite)
      heightWhite.at(i) = isAllWhite;
  }
  
  //W
  vector<bool> widthWhite(H, false);
  for (int i = 0; i < H; i++) {
    bool isAllWhite = true;
    for (int j = 0; j < W; j++) {
      if (data.at(i).at(j) == '#') {
        isAllWhite = false;
        break;
      }
    }
    
    if (isAllWhite)
      widthWhite.at(i) = isAllWhite;
  }
  
  for (int i = 0; i < H; i++) {
    if(!widthWhite.at(i)) {
      for (int j = 0; j < W; j++) {
        if (!heightWhite.at(j))
          cout << data.at(i).at(j);
      }
      cout << endl;
    }
  }
}

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

const int maxn=3050;
double p[maxn];
double dp[maxn][maxn];

int main()
{
	int n;
	cin>>n;
    for(int i = 1;i<=n;++i)
        cin>>p[i];
    
    dp[1][1]=p[1];
    dp[1][0]=1.0000000-p[1];

    for(int i = 2;i<=n;++i){
        for(int j=0;j<=i;j++){
            if(j==0){
                dp[i][j]=dp[i-1][j]*(1.00000-p[i]);
                continue;
            }
            dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1.0000-p[i]);
        }
    }
    double ans=0.0000000000000000000;
    for(int i=(n+1)/2;i<=n;i++)
    {
        ans+=dp[n][i];
    }
    printf("%.10lf\n",ans);
    return 0;
}

Measured memory_bytes: 50040
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <array>
#include <cassert>
#include <utility>
#include <vector>
#include <atcoder/all>

template <class InputIterator>
std::ostream& range_output(std::ostream& os_arg, InputIterator first_arg, InputIterator last_arg){ if(first_arg != last_arg){ do{ os_arg << *(first_arg++); if(first_arg == last_arg) break; os_arg << ' '; } while(true); }  return os_arg; }
template <class Tp> std::ostream& operator << (std::ostream& os_arg, const std::vector<Tp>& arr_arg){ return range_output(os_arg, arr_arg.cbegin(), arr_arg.cend()); }
template <class Tp, std::size_t Size> std::ostream& operator << (std::ostream& os_arg, const std::array<Tp, Size>& arr_arg){ return range_output(os_arg, arr_arg.cbegin(), arr_arg.cend()); }
template <class S, class T> std::ostream& operator << (std::ostream& os_arg, const std::pair<S, T>& pair_arg){ return os_arg << '(' << pair_arg.first << ", " << pair_arg.second << ')'; }

#ifndef ONLINE_JUDGE
    template <typename Head> void dump_out(Head head_arg){ std::cerr << head_arg << '\n'; }
    template <typename Head, typename... Tail>
    void dump_out(Head head_arg, Tail... tail_args){ std::cerr << head_arg << ", "; dump_out(tail_args...); }
    #define dump(...) do { std::cerr << "[in line " << __LINE__ << "] " << #__VA_ARGS__ << " : "; dump_out(__VA_ARGS__); } while(false)
#else
    #define dump(...) (void(0))
#endif




int main(void){
    std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); 
    std::cout << std::fixed << std::setprecision(16);
    int n, d; std::cin >> n >> d;
    std::vector<int> x(n), y(n);
    for(int i = 0; i < n; ++i) std::cin >> x[i] >> y[i];
    atcoder::two_sat TS(n);
    const auto social_distance = [&](int a, int b){
        const int dis = a - b;
        return dis <= -d or dis >= d;
    };
    for(int i = 0; i < n; ++i) for(int j = i + 1; j < n; ++j){
        if(not social_distance(x[i], x[j])) TS.add_clause(i, false, j, false);
        if(not social_distance(x[i], y[j])) TS.add_clause(i, false, j, true);
        if(not social_distance(y[i], x[j])) TS.add_clause(i, true, j, false);
        if(not social_distance(y[i], y[j])) TS.add_clause(i, true, j, true);
    } 
    if(not TS.satisfiable()){ std::cout << "No\n"; return 0; }
    std::cout << "Yes\n";
    const auto v = TS.answer();
    for(int i = 0; i < n; ++i){
        if(v[i]) std::cout << x[i] << '\n';
        else     std::cout << y[i] << '\n';
    }
    return 0;
}

Measured memory_bytes: 3804
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>

int main()
{
    int n;
    std::cin >> n;
    int c = 0;
    std::vector<int> ar(n);
    for (auto& e : ar) {
        std::cin >> e;
        c = e xor c;
    }
    for (int i = 0; i < n; i++) {
        int o = (c xor ar.at(i));
        std::cout << o << ((i == (n - 1)) ? '\n' : ' ');
    }
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    
    vector<int> spade;
    vector<int> heart;
    vector<int> clover;
    vector<int> diamond;
    
    rep(i,n){
        char s;
        int x;
        cin >> s >> x;
        
        if(s == 'S') spade.push_back(x);
        else if(s == 'H') heart.push_back(x);
        else if(s == 'C') clover.push_back(x);
        else if(s == 'D') diamond.push_back(x);
    }
    
    sort(spade.begin(), spade.end());
    sort(heart.begin(), heart.end());
    sort(clover.begin(), clover.end());
    sort(diamond.begin(), diamond.end());
    
    for(int i = 1; i <= 13; i++){
        if(!binary_search(spade.begin(), spade.end(), i)){
            cout << 'S' << " " << i << endl;
        }
    }
    
    for(int i = 1; i <= 13; i++){
        if(!binary_search(heart.begin(), heart.end(), i)){
            cout << 'H' << " " << i << endl;
        }
    }
    
    for(int i = 1; i <= 13; i++){
        if(!binary_search(clover.begin(), clover.end(), i)){
            cout << 'C' << " " << i << endl;
        }
    }
    
    for(int i = 1; i <= 13; i++){
        if(!binary_search(diamond.begin(), diamond.end(), i)){
            cout << 'D' << " " << i << endl;
        }
    }
}

 


Measured memory_bytes: 3168
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <random>
using namespace std;
int main() {
  string s;
  cin >> s;
  int l = s.length();
  if (s[0] != 'A' || s[1] < 'a' || s[1] > 'z' || s[l - 1] == 'C') {
	  cout << "WA" << endl;
	  return 0;
	}
  bool flag = true;
  for (int i = 2; i < l; i++) {
	  if (s[i] == 'C') {
		  if (flag) {
			  flag = false;
			} else {
			  cout << "WA" << endl;
			  return 0;
			}
		}
	  else if (s[i] < 'a' || s[i] > 'z') {
		  cout << "WA" << endl;
		  return 0;
		}
	}
  if (!flag) {
	  cout << "AC" << endl;
	} else {
	  cout << "WA" << endl;
	}
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 100

int main(){

  int n; // array size
  int a[N]; //array
  int i,j; //loop
  int count = 0;
  
  // array size
  scanf("%d",&n);
  
  // array element
  for(i = 0 ; i < n ; i++){
    scanf("%d",&a[i]);
  }

  // bubble sort
  int emp;
  for( i = 0 ; i != n-1 ; i++){
    for( j = n-1 ; j != i; j--){
      if(a[j] < a[j-1]){
	emp = a[j];
	a[j] = a[j-1];
	a[j-1] = emp;
	count++;
      }
    }
  }

  // output
  for( i = 0 ; i < n ; i++){
    printf("%d",a[i]);
    if(i < n-1) printf(" ");
  }
  printf("\n%d\n",count);

  return 0;

}



Measured memory_bytes: 2104
N, K = map(int, input().split())
h = list(map(int, input().split()))
dp = [10 ** 9 for _ in range(N)]
dp[0] = 0
for i in range(1, N):
  x = dp[i-1] + abs(h[i]-h[i-1])
  for j in range(2, K+1):
    if i-j >= 0:
      x = min(dp[i-j] + abs(h[i]-h[i-j]), x)
    else:
      pass
  dp[i] = x
print(dp[N-1])

Measured memory_bytes: 56288
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

string s, str="keyence";
int main(){
    cin>>s;

    bool flag=false;
    if(s==str) flag=true;
    REP(i, 1, s.size()-6){
        for(ll j=0; i+j<=s.size(); j++){
            string sub=s;
            sub.erase(sub.begin()+j, sub.begin()+i+j);
            if(sub==str) flag=true;
        }
    }

    if(flag) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

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

bool is_shichigosan(int n) {
  unordered_set<int> res;
  while (n) {
    res.insert(n % 10);
    n /= 10;
  }
  return res.size() == 3;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<long long> q(1001001);
  vector<int> cand = {3, 5 ,7};
  int ma = 1001001001;
  int j = 1;
  bool flag = false;
  for (int i = 0; i < 1001001; i++) {
    for (int c : cand) {
      q[j] = q[i] * 10 + c;
      if (q[j] > ma) {flag = true; break;}
      j++;
    }
    if (flag) break;
  }
  vector<int> res;
  for (int x : q) {
    if (is_shichigosan(x)) res.push_back(x);
  }
  int n; cin >> n;
  cout << upper_bound(res.begin(), res.end(), n) - res.begin() << '\n';
  return 0;
}

Measured memory_bytes: 8320
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, n) for (ll i = n; i >= 0; --i)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define pb push_back
#define ist insert
#define fst first
#define snd second


ll dp[51][51][2501];

int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N, A;
    cin >> N >> A;
    vector<ll> X;
    X.pb(0);  // dummy
    rep (i, N) {
        ll x;
        cin >> x;
        X.pb(x);
    }
    sort(all(X));
    dp[0][0][0] = 1;
    for (ll j = 0; j <= N; ++j) {
        for (ll k = 0; k <= N; ++k) {
            for (ll s = 0; s <= N * A; ++s) {
                if (j >= 1 && s < X[j]) {
                    dp[j][k][s] = dp[j - 1][k][s];
                } else if (j >= 1 && k >= 1 && s >= X[j]) {
                    dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - X[j]];
                }
            }
        }
    }
    ll ans = 0;
    for (ll k = 1; k <= N; ++k) {
        ans += dp[N][k][k * A];
    }
    cout << ans << endl;
}


Measured memory_bytes: 50048
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	n, h, w := nextInt(), nextInt(), nextInt()
	ans := (n - h + 1) * (n - w + 1)
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
 
int main()
{
    // get a integer
    int X, Y;
    cin >> X >> Y;
  	int a = 0;
  	int b = 0;
  	int c = 0;
  	if (X == 1){
      a = 300000;
    }else if(X == 2){
      a = 200000;
    }else if(X == 3){
      a = 100000;
    }
  	if (Y == 1){
      b = 300000;
    }else if(Y == 2){
      b = 200000;
    }else if(Y == 3){
      b = 100000;
    }
  	if( X==1 && Y == 1){
      c = 400000;
    }
    cout << (a+b+c) << endl;
    return 0;
}

Measured memory_bytes: 384
#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 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
	string n;
	cin >> n;
	if (n[0] == '9' || n[1] == '9') cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, ans = 0;
  cin >> n;
  vl a(n), b(n);
  rep(i, n) cin >> a[i];
  sort(all(a));
  rep(x, 2) {
    ll i = 0, now = 0;
    for(; i < n / 2; i++) b[2 * i + 1] = a[i];
    if(n % 2) {
      b[n - 1] = a[i];
      i++;
    }
    for(ll j = 0; i + j < n; j++) b[2 * j] = a[i + j];
    rep(k, n - 1) now += abs(b[k] - b[k + 1]);
    ans = max(ans, now);
    if(x == 0) reverse(all(a));
  }
  cout << ans << endl;
}

Measured memory_bytes: 4840
#include "bits/stdc++.h"
using namespace std;

int main() {
	string S;
	cin >> S;
	string ansS;
	for (int i = 0;i<S.size();++i) {
		if ('0' ==S[i]) {
			ansS += "0";
		}
		else if ('1' == S[i]) {
			ansS += "1";
		}
		else {
			if (ansS.size() >0) {
				ansS.erase(ansS.size()-1);
			}
		}
	}
	cout << ansS<<endl;
	return 0;
}

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

using namespace std;

char c[100010];
int cnt1,cnt2,len;

int main()
{
	scanf("%s",c+1);
	len=strlen(c+1);
	for(int i=2; i<=len; i++)if(c[i]!=c[i-1])cnt1++;
	for(int i=len-1; i>=1; i--)if(c[i]!=c[i+1])cnt2++;
	printf("%d",min(cnt1,cnt2));
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#define N 105
using namespace __gnu_pbds;
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
LL z = 1;
int read(){
	int x, f = 1;
	char ch;
	while(ch = getchar(), ch < '0' || ch > '9') if(ch == '-') f = -1;
	x = ch - '0';
	while(ch = getchar(), ch >= '0' && ch <= '9') x = x * 10 + ch - 48;
	return x * f;
}
int ksm(int a, int b, int p){
	int s = 1;
	while(b){
		if(b & 1) s = z * s * a % p;
		a = z * a * a % p;
		b >>= 1;
	}
	return s;
}
int a[N];
int main(){
	int i, j, n, m;
	n = read();
	for(i = 1; i <= n; i++) a[i] = read();
	sort(a + 1, a + i);
	printf("%d", a[n] - a[1]);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    char[] s = scanner.next().toCharArray();
    if (s[0] == s[s.length - 1]) {
      System.out.println(s.length % 2 == 0 ? "First" : "Second");
    } else {
      System.out.println(s.length % 2 == 0 ? "Second" : "First");
    }
  }
}


Measured memory_bytes: 27860
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



void solve(){
    ll sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    string s="";
    ll n=tx+ty-sx-sy;
    rep(i,(tx-sx)) s+='R';
    rep(i,(ty-sy)) s+='U';
    rep(i,(tx-sx)) s+='L';
    rep(i,(ty-sy)) s+='D';
    s+="DR";
    s+=s.substr(0,n);
    s+="ULUL";
    s+=s.substr(n,n);
    s+="DR";
    cout<<s<<endl;

    
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    solve();

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int mod=1e9+7;
using LL=long long;
using namespace std;
namespace ndifix{

}//end of namespace ndifix


int main(){
  int n,d;cin>>n>>d;
  for(int i=0;i<20;i++){
    if(n<=2*i*d+i){
      cout<<i<<endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int h, w; cin>>h>>w;
    string s[1010];
    for(int i=0; i<h; i++) cin>>s[i];
    int mn1=h+w, mn2=h+w, mx1=-h-w, mx2=-h-w;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(s[i][j]=='B'){
                mn1=min(mn1, i+j);
                mx1=max(mx1, i+j);
                mn2=min(mn2, i-j);
                mx2=max(mx2, i-j);
            }
        }
    }
    cout<<max(mx1-mn1, mx2-mn2)<<endl;
    return 0;
}


Measured memory_bytes: 3928
using System;
using System.Collections;
using System.IO;
using System.Linq;

namespace CompetitiveProgramming
{

  class Solve
  {
    const int INF = (int)(1e9) + 10;

    private void Main()
    {
      string w = Console.ReadLine();
      int[] count = new int[256];
      for (int i = 0; i < w.Length; i++) 
      {
        count[w[i]]++;
      }
      for (int i = 0; i < 256; i++)
      {
        if (count[i] % 2 == 1)
        {
          Console.WriteLine("No");
          return;
        }
      }
      Console.WriteLine("Yes");
    }

    public Solve()
    {
      Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
      Main();
      Console.Out.Flush();
    }
  }

  class Program
  {
    static void Main(string[] args)
    {
      new Solve();
    }
  }
}

Measured memory_bytes: 2648
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void)
{
  int sum=0,i,time;
  for(i=0;i<4;i++)
  {
    scanf("%d",&time);
    sum+=time;
  }
  //printf("%d\n",sum);
  printf("%d\n%d\n",sum/60,sum%60);
  return 0;
}



Measured memory_bytes: 2028
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

ll inf = 1e9+7;

ll pw(ll x, ll y) {
    if (y == 0) return 1;
    else if (y == 1) return x % inf;
    else if (y % 2 == 0) return pw(x, y / 2) * pw(x, y / 2) % inf;
    else return pw(x, y / 2) * pw(x, y / 2) % inf * x % inf;
}

ll dv(ll x, ll y) {
    return x * pw(y, inf - 2) % inf;
}

int main(void){
    ll n, a, b, c;
    cin >> n >> a >> b >> c;
    
    ll ans = 0, comb = 1;
    for (int i = 0; i < n; i++) {
        ans += (comb * pw(dv(a, 100 - c), n) % inf) * pw(dv(b, 100 - c), i) % inf * (n + i) % inf;
        ans += (comb * pw(dv(b, 100 - c), n) % inf) * pw(dv(a, 100 - c), i) % inf * (n + i) % inf;
        comb *= (n + i) * dv(1, i + 1) % inf;
        ans %= inf;
        comb %= inf;
    }
    
    cout << ans % inf * dv(100, 100 - c) % inf << endl;
    
}


Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
img_a = n.times.map {gets.chomp}
img_b = m.times.map {gets.chomp}

loop_num = n - m + 1

check = ->(y, x) {
  m.times.all? {|dy| img_a[y + dy][x, m] == img_b[dy]}
}

f = loop_num.times.any? {|y|
  loop_num.times.any? {|x| check.(y, x)}
}

puts f ? "Yes" : "No"

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

using namespace std;
            
long long a[100001];	

int main () {
	long long n, ans = 0, cur = 0;
	cin >> n;
	for (int i = 1;i <= n;i ++) {
		cin >> a[i];
		if (a[i] == 0) {
			ans += cur / 2;
			cur = 0;  
		}
		else cur += a[i];
	}
	ans += cur / 2;
	cout << ans;
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var abc = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            var tmp = abc[0] - abc[1];
            Console.WriteLine(abc[2]-tmp<0?0: abc[2] - tmp);
        }
    }
}


Measured memory_bytes: 13268
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)

N = 0
ans = 0


def isOK(n):
    m = set()
    for s in str(n):
        m.add(s)
    if len(m) != 3:
        return False
    if '3' in m and '5' in m and '7' in m:
        return True
    return False


def rec(n):
    global ans
    global N
    if n > N:
        return
    if isOK(n):
        ans += 1
    rec(n * 10 + 3)
    rec(n * 10 + 5)
    rec(n * 10 + 7)


def solve():
    global N
    N = Scanner.int()
    rec(0)
    print(ans)


def main():
    # sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()


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

using namespace std;

int main() {
  int N;
  while(cin >> N && N) {
    int t[N][N+1];
    for(int i=0;i<N;i++)
      for(int j=0;j<N+1;j++)
	cin>>t[i][j];
    int dp[1<<N]; memset(dp, 63, sizeof dp);dp[0]=0;
    for(int S=0;S<(1<<N);S++) {
      for(int i=0;i<N;i++) {
	if(S>>i & 1) continue;
	dp[S+(1<<i)]=min(dp[S+(1<<i)], dp[S]+t[i][0]);
	for(int j=0;j<N;j++) {
	  if(!(S>>j & 1)) continue;
	  dp[S+(1<<i)]=min(dp[S+(1<<i)], dp[S]+t[i][j+1]);
	}
      }
    }
    cout<<dp[(1<<N)-1]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1420
n = int(input())
n = str(n)
  
if n[len(n) - 1] == str("7"):
  print("Yes")
elif n[len(n)- 2] == str("7"):
  print("Yes")
elif n[len(n)- 3] == str("7"):
  print("Yes")
else:
  print("No")

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

long long n, m, q;
vector<int> a;

int f(int r){
    int w = r*7, res = 0;
    vector<bool> vsd(w, false);
    for(int i=0;i<q;i++){
        int v = a[i];
        while(v < w){
            vsd[v] = true;
            v += m;
        }
    }
    for(int i=0;i<w;i++){
        if(vsd[i]) continue;
        res++;
        queue<int> q;
        q.push(i);
        while(!q.empty()){
            int v = q.front();
            q.pop();
            if(vsd[v]) continue;
            vsd[v] = true;
            if(v%7 > 0 && !vsd[v-1]) q.push(v-1);
            if(v%7 < 6 && !vsd[v+1]) q.push(v+1);
            if(v/7 > 0 && !vsd[v-7]) q.push(v-7);
            if(v+7 < w && !vsd[v+7]) q.push(v+7);
        }
    }
    return res;
}

int main(void){
    cin >> n >> m >> q;
    a.assign(q, 0);
    for(int i=0;i<q;i++) cin >> a[i];
    long long x = m, y;
    if(m%7 == 0) x = m / 7;
    y = n / x;
    long long b = f(x);
    long long a = f(x*2) - b;

    cout << b + a * (y-1) << endl;

}


Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
const int mod=1e9+7;
int main()
{
	int n,k;
	int c[2002][2002];

	cin>>n>>k;
	for(int i=0;i<=n+1;i++)
	{
		c[i][0]=1;
		for(int j=1;j<=i;j++)c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
	}
for(int i=1;i<=k;i++)
	{
		int ans=1ll*c[k-1][i-1]*c[n-k+1][i]%mod;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 15872
import java.util.Scanner;

public class Main {

    private static int inf = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int v = Integer.parseInt(scan.next());
        int e = Integer.parseInt(scan.next());
        long[][] dist = new long[v][v];
        for (int i = 0; i < v; i++) {
            for (int j = 0; j < v; j++) {
                if (i == j) {
                    dist[i][j] = 0;
                } else {
                    dist[i][j] = inf;
                }
            }
        }

        for (int k = 0; k < e; k++) {
            int i = Integer.parseInt(scan.next());
            int j = Integer.parseInt(scan.next());
            int d = Integer.parseInt(scan.next());
            dist[i][j] = d;
        }
        scan.close();

        for (int k = 0; k < v; k++) {
            for (int i = 0; i < v; i++) {
                for (int j = 0; j < v; j++) {
                    if (dist[i][k] != inf && dist[k][j] != inf) {
                        dist[i][j] = Math.min(dist[i][j], dist[i][k] + dist[k][j]);
                    }
                }
            }
        }

        for (int i = 0; i < v; i++) {
            if (dist[i][i] < 0) {
                System.out.println("NEGATIVE CYCLE");
                return;
            }
        }

        for (int i = 0; i < v; i++) {
            for (int j = 0; j < v; j++) {
                if (dist[i][j] == inf) {
                    System.out.print("INF");
                } else {
                    System.out.print(dist[i][j]);

                }

                if (j != v - 1) {
                    System.out.print(" ");
                }
            }
            System.out.println("");
        }
    }

}



Measured memory_bytes: 49732
#include<stdio.h>
int main()
{
	int a,b,c;
	char s[3];
	//scanf("%d", &a);
	//scanf("%d %d",&b,&c);
	scanf("%s",s);
	//printf("%d %s\n",a+b+c,s);
	if (s[0] == s[2]){
		printf("Yes\n");
	}else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
// Created by Nandu Vinodan
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN
#define TC 0

using namespace std;
using ll = long long;

void testcase() {
    int n, m;
    cin >> n >> m;

    unordered_map<int, pair<bool, int> > mp;
    while (m--) {
    	int id; string res;
    	cin >> id >> res;
    	pair<bool, int> &val = mp[id];
    	if (res == "AC") {
    		val.first = true;
    	} else {
    		if (!val.first)
    			val.second++;
    	}
    }

   	int ac = 0, p = 0;
    rep (i, 1, n) {
    	pair<bool, int> val = mp[i];
    	ac += (val.first);
    	if (val.first)
    		p += val.second;
    }
    cout << ac << " " <<  p << endl;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    if (TC)
        cin>>t;
    while(t--) {
        testcase();
    }
    return 0;
}

Measured memory_bytes: 4388
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iomanip>


#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;


// <<fixed<<setprecision(6)<<


int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}


int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}


int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}


int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}


int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}


int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}


int main(){
  int s,w;
  cin>>s>>w;
  if(s<=w){
    cout<<"unsafe";
  }
  else{
    cout<<"safe";
  }
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;

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

  ll a, b;
  cin >> a >> b;

  ll now = 1, ans = 0;
  while (now < b)
  {
    now += a - 1;
    ++ ans;
  }
  cout << ans << endl;
}


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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

template<typename V,typename T>
T find_num(V v, T num) {
    if ( find(ALL(v), num) == v.end() ) {
        return false;
    } else {
        return true;
    }
}

// π M_PI
// deg = rad*180/M_PI

int main() {
    ll n, m;
    cin >> n >> m;
    ll ans = 0;
    if ( n <= m ) {
        ans = 1;
    }

    cout << ( ans ? "unsafe" : "safe" ) << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include <cmath>
//#include <bits/stdc++.h>
using namespace std;

int main(){
    long int N,M;
    cin>>N>>M;
    if (N%2==1){
        for (int i=1;i<=M;i++){
            cout<<i<<" "<<N-i<<endl;
        }
    }
    else if (N%4!=0){
        for (int i=1;i<=M;i++){
            if (4*i<=N-2) cout<<i<<" "<<N+1-i<<endl;
            else cout<<i<<" "<<N-i<<endl;
        }
    }
    else{
        for (int i=1;i<=M;i++){
            if (4*i<=N) cout<<i<<" "<<N+1-i<<endl;
            else cout<<i<<" "<<N-i<<endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define RI(x) x = rit()
#define RII(a,b) a = rit(), b = rit()
#define RIII(a,b,c) a = rit(), b = rit(), c = rit()
#define REP(I, N) for(int I=0;I<int(N);I++)
#define REPP(I, N) for(int I=1;I<=int(N);I++)
inline int rit(){
    int f=0,key=1;
    char ch;
    do{
        ch = getchar();
        if(ch=='-') key=-1;;
    }while(ch<'0'||ch>'9');
    do{
        f = f*10+ch-'0';
        ch = getchar();
    }while(ch>='0'&&ch<='9');
    return f*key;
}
using namespace std;
int mp[101][101],dis[101][101];
bool visit[101];
struct edge{int a,b,d;};
bool operator<(const edge& e1, const edge& e2){return e1.d > e2.d;}
int main(void){
    int n,m,u,v;
    RII(n,m);
    REP(i,m){
        RIII(u,v,mp[u][v]) ;
        mp[v][u] = mp[u][v];
    }
    REPP(i,n){
        memset(visit,false,sizeof(visit));
        priority_queue<edge> pq;
        pq.push((edge){i,i,0});
        REPP(j,n){
            while(!pq.empty()&&visit[pq.top().b]) pq.pop();
            edge tmp = pq.top();
            pq.pop();
            visit[tmp.b] = true;
            dis[i][tmp.b] = tmp.d;
            REPP(k,n){
                if(visit[k]) continue;
                if(mp[tmp.b][k]){
                    pq.push((edge){tmp.b,k,dis[i][tmp.b]+mp[tmp.b][k]});
                }
            }
        }
    }
    int cnt=0;
    REPP(i,n) REPP(j,n){
        if(mp[i][j]){
            if(mp[i][j]==dis[i][j]) cnt++;
        }
    }
    printf("%d\n",m-cnt/2);
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>

#include <set>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))
#define REP(i, n) for (ll i = 0; i < n; i++)
int main()
{
	ll N, K;
	ll H[200000] = {0};
	cin >> N >> K;
	REP(i, N)
	{
		cin >> H[i];
	}
	ll cnt = 0;
	std::sort(H, H + 200000, std::greater<ll>());

	for (ll i = 0 + K; i < N; i++)
	{
		cnt += H[i];
	}
	cout << cnt << endl;
	return 0;
}

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

void Main()
{
	int A, B, T; cin >> A >> B >> T;
	cout << B * (T / A) << endl;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#include <stdlib.h>
long a,b,c,x,y,n,m;
long sum=0;
int main(){
scanf("%ld",&a);
scanf("%ld",&b);
scanf("%ld",&c);
scanf("%ld",&x);
scanf("%ld",&y);
n=fminl(x,y);
m=labs(x-y);
if(a+b>=2*c){
sum+=2*c*n;
}else{
sum+=(a+b)*n;
}
if(x>y){
if(a>=2*c)
{sum+=m*2*c;
}else{
sum+=m*a;
}
}else{
if(b>=2*c)
{sum+=m*2*c;
}else{
sum+=m*b;
}
}
printf("%ld",sum);
}

Measured memory_bytes: 128
// Code for A - Disjoint Set Union
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

int main(){
	int N, q;

  cin >> N >> q;

	dsu d(N);

	while(q--){
		int t, u, v;
		cin >> t >> u >> v;
		if (t == 0) {
      d.merge(u, v);
    } else {
      cout << d.same(u,v) << endl;
    }
	}
	return 0;
}


Measured memory_bytes: 3928
#include <iostream>

int main()
{
    int a, b, c;
    std::cin >> a >> b >> c;

    int tmp;
    if (a > b){
        tmp = a;
        a = b;
        b = tmp;
    }
    if (b > c){
        tmp = b;
        b = c;
        c = tmp;
    }
    if (a > b){
        tmp = a;
        a = b;
        b = tmp;
    }

    std::cout << a << " " << b << " " << c << std::endl;

    return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
/*

6
10
20
40
41
60
70

two triangles: (10 40 41) and (20 60 70)
but program which see only continuous triplets returns 0
*/

/*
0 < a < b < c < d
to suru

sankakukei ga dekiru zyouken
b+c>d
c+d>b => zimei
d+b>c => zimei
d-c<b => b+c>d
d-b<c => b+c>d
c-b<d => d+b>c => zimei

a+c>d => b+c>d
a+b>d => b+c>d

yotte ookikute renzoku de toreru yatu kara toreba yoi

A X a B C b c A+B>C => X+B>C
A a X B C b c A+B>C => a+B>C a+b>c => X+b>c
A a B X C b c A+B>C => a+X>C a+b>c => B+b>c
A a B C X b c a+b>c => B+b>c A+B>C => a+C X -> a+B>C X+b>c
A a B C b X c A+B>C a+b>c => a+B>C b+X>c

yotte 6 ko renzoku wo mireba yoi
*/

long long read_ll(void) {
	long long ret=0;
	int input;
	while(isspace(input=getchar()));
	ungetc(input,stdin);
	while(isdigit(input=getchar()))ret=ret*10+(input-'0');
	return ret;
}

void print_ll(long long n) {
	char buf[64];
	char *p=buf;
	if(n<0){putchar('-');n=-n;}
	do {
		*(p++)=(char)(n%10+'0');
	} while((n/=10)>0);
	do {
		putchar(*(--p));
	} while(p!=buf);
}

int comp_ll(const void *x,const void *y) {
	long long a=*((long long*)x);
	long long b=*((long long*)y);
	if(a>b)return 1;
	if(a<b)return -1;
	return 0;
}

int main(void) {
	int N;
	static long long a[100000];
	static long long dp[3][100010]; /* [left][pos] */
	long long ret=0;
	int left=2;
	int i;
	if(scanf("%d",&N)!=1)return 1;
	for(i=0;i<N;i++)a[i]=read_ll();
	qsort(a,N,sizeof(a[0]),comp_ll);
	for(i=N-3;i>=0;i--) {
		if(a[i]+a[i+1]>a[i+2]) {
			ret+=a[i]+a[i+1]+a[i+2];
			i-=2;
			left--;
			if(left<=0)break;
		}
	}
	if(left>0)ret=0;
	for(i=N-6;i>=0;i--) {
		static const int ptn[10][6]={
			{0,1,2,3,4,5},
			{0,1,3,2,4,5},
			{0,1,4,2,3,5},
			{0,1,5,2,3,4},
			{0,2,3,1,4,5},
			{0,2,4,1,3,5},
			{0,2,5,1,3,4},
			{0,3,4,1,2,5},
			{0,3,5,1,2,4},
			{0,4,5,1,2,3}
		};
		int j,ok=0;
		for(j=0;j<10;j++) {
			if(a[i+ptn[j][0]]+a[i+ptn[j][1]]>a[i+ptn[j][2]] &&
			a[i+ptn[j][3]]+a[i+ptn[j][4]]>a[i+ptn[j][5]]) {
				ok=1;break;
			}
		}
		if(ok) {
			long long cur=a[i]+a[i+1]+a[i+2]+a[i+3]+a[i+4]+a[i+5];
			if(cur>ret)ret=cur;
		}
	}
	print_ll(ret);
	putchar('\n');
	return 0;
}

Measured memory_bytes: 1916
MOD=10**9+7

def matmul(A,B): # A,B: 行列
    res = [[0]*len(B[0]) for _ in [None]*len(A)]
    for i, resi in enumerate(res):
        for k, aik in enumerate(A[i]):
            for j,bkj in enumerate(B[k]):
                resi[j] += aik*bkj
                resi[j] %= MOD
    return res

def matpow(A,p): #A^p mod M
    if p%2:
        return matmul(A, matpow(A,p-1))
    elif p > 0:
        b = matpow(A,p//2)
        return matmul(b,b)
    else:
        return [[1 if i == j else 0 for j in range(len(A))] for i in range(len(A))]

def solve(n):
    pass
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

#n,k,*a = map(int,read().split())

T, = map(int,readline().split())


c = [1, -11, 50, -110, 65, 253, -648, 440, 610 , -1430 ,+ 780 ,+ 780, - 1430 ,  610 , 440, - 648, + 253, + 65, - 110, + 50, - 11, + 1]

m = 21
A = [[0]*m for _ in range(m)]
for i in range(m-1):
    A[i+1][i] = 1
for i in range(m):
    A[i][-1] = -c[i]
    
#print(A)


v = [[0]*(m-1)+[1]]
c = matmul(v,matpow(A,15))

#print(c)

for _ in range(T):
    n, = map(int,readline().split())
    x = matmul(c,matpow(A,n))
    print(x[0][0])



Measured memory_bytes: 73616
#include<iostream>
using namespace std;
int main(){
    int a,b,c;
    int d = 0;
    cin>>a>>b>>c;
    for(int i = a;i <= b;i++){
        if(c % i == 0){
            d += 1;
        }
    }
    cout<<d<<endl;
    return 0;
}


Measured memory_bytes: 3132
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main() {
    int n, m;
    int num[10][10];
    int k;
    int p[10];

    scanf("%d", &n);
    scanf("%d", &m);
    
    for (int i = 0; i < 10; ++i) {
        for (int j = 0; j < 10; ++j) {
            num[i][j] = 0;
        }
    }
    //onになりうるスイッチにフラグを立てる
    for (int i = 0; i < m; ++i) {
        scanf("%d", &k);
        for (int j = 0; j < k; ++j) {
            int c;
            scanf("%d", &c);
            num[i][c-1] = 1;
        }
    }
    
    for (int i = 0; i < m; ++i) {
        scanf("%d", p+i);
    }
    
    int ans = 0;
    for (int i = 0; i < (1 << n); ++i) {
        int flag = 1;
        for (int j = 0; j < m; ++j) {
            int cnt = 0;
            for (int l = 0; l < n; ++l) {
                if (num[j][l] & i >> l) cnt += 1;
            }
            //printf("%d\n", cnt);
            if (cnt % 2 != p[j]) flag = 0;
        }
        if (flag) ans += 1;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for (int i=0; i<n; i++)
int main(){
    string N;
    cin >> N;
    bool flag = false;
    rep(i, 3) if (N[i] == '7') flag = true;
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3628
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( [ $ t : ty ] ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( [ $ t : ty ] ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( [ $ t ] ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let s: Vec<bool> = util::line().chars().map(|c| c == 'B').collect();

    let mut sum = 0u64;
    let mut ans = 0u64;
    for c in s {
        if c {
            sum += 1;
        } else {
            ans += sum;
        }
    }

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


Measured memory_bytes: 8572
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
#define F first
#define S second
const int dr[] = {-1,1,0,0};
const int dc[] = {0,0,-1,1};
const int N = 1087;
char g[N][N];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,m,c=0;
    cin >> n >> m;
    vector<pii> q,qq;
    for (int i = 0; i < n; ++i) {
        cin >> g[i];
        for (int j = 0; j < m; ++j)
            if (g[i][j] == '#') {
                q.emplace_back(i,j);
                ++c;
            }
    }
    int ans = 0;
    for (;c < n * m; ++ans) {
        qq.clear();
        for (auto p : q) {
            for (int k = 0; k < 4; ++k) {
                pii o(p.F+dr[k],p.S+dc[k]);
                if (0 <= o.F && o.F < n && 0 <= o.S && o.S < m && g[o.F][o.S] == '.') {
                    g[o.F][o.S] = '#';
                    qq.push_back(o);
                    ++c;
                }
            }
        }
        swap(q,qq);
    }
    cout << ans << endl;
}


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

int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int main() {
	int a, b;
	cin >> a >> b;
	cout << gcd(a, b) << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main () {
	int A,B,C,D,E,F;
	cin >> A >> B >> C >> D >> E >> F;
	std::vector<int> sumWater;
	std::vector<int> sumSugar;
	int limWater = F;
	int limSugar = (F * E) / 100 + 10;
	for (int Ai = 0; Ai * A * 100 <= limWater; ++Ai)
	{
		for (int Bi = 0; Bi * B * 100 <= limWater; ++Bi)
		{
			if(0 < 100 * A * Ai + 100 * B * Bi && 100 * A * Ai + 100 * B * Bi <= limWater){
				sumWater.push_back(100 * A * Ai + 100 * B * Bi);
			}
		}
	}
	for (int Ci = 0; Ci <= limSugar; ++Ci)
	{
		for (int Di = 0; Di <= limSugar; ++Di)
		{
			if(0 < Ci * C + Di * D && Ci * C + Di * D<= limSugar){
				sumSugar.push_back(Ci * C + Di * D);
			}
		}
	}

	int maxWater=100 * A;
	int maxSugar=0;
	/*cout << "sumWater" << endl;
	for (int Wi = 0; Wi < (int)sumWater.size(); ++Wi)
	{
		cout << sumWater[Wi] << endl;
	}
	cout << "sumSugar" << endl;
	for (int Si = 0; Si < (int)sumSugar.size(); ++Si)
	{
			cout << sumSugar[Si] << endl;
	}*/
	for (int Wi = 0; Wi < (int)sumWater.size(); ++Wi)
	{
		for (int Si = 0; Si < (int)sumSugar.size(); ++Si)
		{
			if(maxSugar * 10000 / (maxWater + maxSugar) < sumSugar[Si] * 10000 / (sumSugar[Si] + sumWater[Wi])){
				if(sumWater[Wi] + sumSugar[Si] <= F && sumSugar[Si] * 10000 / (sumSugar[Si] + sumWater[Wi]) <= E * 10000 /(100 + E)){
					maxSugar = sumSugar[Si];
					maxWater = sumWater[Wi];
				}

			}
		}
	}
	cout << maxWater + maxSugar << " " << maxSugar << endl;
}

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

#define ll long long
#define pb push_back
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cerr << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define _ ios_base::sync_with_stdio(0);cin.tie(NULL);

void solve() {
    ll n;
    cin >> n;
    ll a[n] = {};
    ll x = 0;
    for(int i = 0; i<n; i++) {
        cin >> a[i];
        x ^= a[i];
    }
    for(int i = 0; i<n; i++) {
        cout << (ll)(a[i] ^ x) << ' ';
    }

}

int main() {
    int t = 1;
    //cin >> t;
    // Please remember to uncomment for taking test cases
    for(int i = 1; i<=t; i++) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 5088