akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define int long long
int mod=1e9+7;

signed main(){
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    if(i%3==0)cout<<" "<<i;
    else {
      int x=i;
      while(x>0){
        if(x%10==3){
          cout<<" "<<i;
          break;
        }
        x/=10;
      }
    }
  }
  cout<<endl;
}



Measured memory_bytes: 3080
#include<stdio.h>
#define MAX 2000
int n;
int A[MAX];
int solve(int,int);

int main(){
  int i;
  int q;
  int m[MAX];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m[i]);
    if(solve(0,m[i])==1) printf("yes\n");
    else printf("no\n");
  }

  
  return 0;
}

int solve(int i,int m){
  int res;
  if(m==0) return 1;
  if(i>=n) return 0;
  res = solve(i+1,m) || solve(i+1,m-A[i]);
  return res;
}



Measured memory_bytes: 2048
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int H, W;
  cin>>H>>W;
  vector<string> S(H);
  for(int i=0;i<H;++i) cin>>S[i];
  int ans[H][W];
  for(int i=0;i<H;++i) {
    for(int j=0;j<W;++j) {
      if(S[i][j]=='#') ans[i][j] = -1;
      else {
        ans[i][j] = 0;
        if(i>0 && S[i-1][j]=='#') ans[i][j]++;
        if(i>0 && j>0 && S[i-1][j-1]=='#') ans[i][j]++;
        if(i>0 && j+1<W && S[i-1][j+1]=='#') ans[i][j]++;
        if(j>0 && S[i][j-1]=='#') ans[i][j]++;
        if(j+1<W && S[i][j+1]=='#') ans[i][j]++;
        if(i+1<H && S[i+1][j]=='#') ans[i][j]++;
        if(i+1<H && j>0 && S[i+1][j-1]=='#') ans[i][j]++;
        if(i+1<H && j+1<W && S[i+1][j+1]=='#') ans[i][j]++;
      }
    }
  }
  for(int i=0;i<H;++i) {
    for(int j=0;j<W;++j) {
      if(ans[i][j]==-1) cout<<'#';
      else cout<<ans[i][j];
    }
    cout<<endl;
  }
}



Measured memory_bytes: 3532
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)

H, W = map(int, input().split())
A = [[int(i) for i in input().split()] for _ in range(H)]
B = [[int(i) for i in input().split()] for _ in range(H)]
C = [[abs(A[y][x] - B[y][x]) for x in range(W)] for y in range(H)]

N = 13000
half = N // 2

dp = [[0] * W for _ in range(H)]
dp[0][0] = (1 << (half - C[0][0])) | (1 << (half + C[0][0]))

for y in range(H) :
    for x in range(W) :
        if y != 0 :
            dp[y][x] |= (dp[y-1][x] >> C[y][x]) | (dp[y-1][x] << C[y][x])
                    
        if x != 0 :
            dp[y][x] |= (dp[y][x-1] >> C[y][x]) | (dp[y][x-1] << C[y][x])

b = bin(dp[-1][-1])[2:][::-1]
ret = float('inf')
for k, v in enumerate(b) :
    if v == '1' :
        ret = min(ret, abs(k - half))
        
print(ret)

Measured memory_bytes: 55004
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yosiiii
 */

#include <iostream>
#include <fstream>

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

class CAttackSurvival {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll n,k,q;
        in >> n >> k >> q;
        vector<ll> a(n,0);
        rep(i,q){
            ll t;
            in >> t;
            t--;
            a[t]++;
        }
        rep(i,n){
            if(k-(q-a[i])>0){
                out << "Yes" << endl;
            }else{
                out << "No" << endl;
            }
        }
	}
};


int main() {
	CAttackSurvival solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <string.h>
int main(void){
    // Here your code !
    int m,i,j,k;
    int sum = 0;
    int l = 0;
    char s[200];
    char t[100];
    scanf("%s",s);
    m = strlen(s);
    /*if(n%2 >= 1){
        m = n-1;
    }
    else if(n%2 <= 0){
        m = n;
    }*/
    if(m%2 == 0){
        m = m-1;
    }
    for(j=0;j<m/2;j++){
        t[j] = s[j];
    }
    for(i=1;i<m;i+=2){
        for(k=0;k<(m-i)/2;k++){
            if(t[k] != s[k+((m-i)/2)]){
                sum = 0;
                break;
            }
            else if(t[k] == s[k]){
                sum++;
            }
            if(sum >=(m-i)/2){
                l = m-i;
                break;
            }
        }
        if(l != 0){
            break;
        }
    }
    printf("%d\n",l);
    return 0;
}


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

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

using namespace std;

bool solve() {
    int n, m, k;
    cin >> n >> m >> k;
    rep(i, n + 1) rep(j, m + 1) {
        int x = i * (m - j) + j * (n - i);
        if (x == k) return true;
    }
    return false;
}

int main() {
    cout << (solve() ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

n = int(input())
p = list(map(int, input().split()))

count = 0
for i in range(1,n-1):
    temp = sorted(p[i-1:i+2])
#    print(temp)
    if p[i] == temp[1]:
        count += 1

print(count)


Measured memory_bytes: 2940
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, DD):
    count = 0
    for d1, d2 in DD:
        if d1 == d2:
            count += 1
        else:
            count = 0
        if count >= 3:
            print('Yes')
            return
    print('No')


if __name__ == '__main__':
    # S = input()
    N = int(input())
    # N, M = map(int, input().split())
    # A = [int(i) for i in input().split()]
    # B = [int(i) for i in input().split()]
    DD = [[int(i) for i in input().split()] for _ in range(N)]
    solve(N, DD)

    # # test
    # from random import randint
    # from func import random_str
    # solve()


Measured memory_bytes: 9180
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    int64_t A, B;
    std::cin >> A >> B;

    if ((A*B)%2 ==0) {
        std::cout << "No" << std::endl;
    }
    else {
        std::cout << "Yes" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
A,B=[int(i) for i in input().split()]
S=input()
flag = 1
L = A+B+1
if len(S)== L:
    for i in range(L):
        if (i != A and S[i] == '-'):
            flag = 0
        if (i == A and S[i] != '-'):
            flag = 0
else:
    flag = 0
 
if flag == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>

#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define FOR(i, A, N) for(int (i) = (A); (i) < (N); (i)++)
#define REP(i, N) for(int (i) = 0; (i) < (N); (i)++)

using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

int n,m;
int A[111111];

int main() {
	scanf("%d", &n);
	int ans = 0;
	REP(i, n) {
		ll x;
		scanf("%d", A+i);
		if(A[i]%2 == 1) {
			printf("first\n");
			return 0;
		}
		ans = ans^(A[i]%2);
	}
	printf("second\n");
	return 0;
}


Measured memory_bytes: 640
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class BStringsWithTheSameLength {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      string s, t; cin >> s >> t;
      rep(i, n) {
        cout << s[i] << t[i];
      }
      cout << endl;
    }
};

signed main() {
  BStringsWithTheSameLength solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 508
#include <stdio.h>
#include <stdlib.h>
#define rep(i, n)   for(i = 0; i < (int)(n); i++)
typedef long long ll;

int compare_ll(const void *a, const void *b){
  return *(ll*)a - *(ll*)b;
}

int main(){
  ll  i, n, a[200000+1] = {0};
  scanf("%lld", &n);
  rep(i,n){ scanf("%lld", &a[i]); }
  qsort( a, n, sizeof(ll), compare_ll );
  
  rep(i,n){
    if( a[i] == a[i+1] ){ printf("NO\n"); return 0; }
  }
  printf("YES\n");
  return 0;
}

Measured memory_bytes: 4612
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define SREP(s,i,m) for(unsigned int i = s; i < m; ++i)
#define REP(i,m) SREP(0,i,m)
using namespace std;

#ifdef _MSC_VER
using LONG = __int64;
using ULONG = unsigned __int64;
#else
using LONG = long long int;
using ULONG = unsigned long long int;
#endif

// 二乗を計算する。
int sq(int x) { return x * x; }
int main(void) {
  int W, H;
  cin >> H >> W;
  REP(i, H)
    REP(j, W) {
    string str;
    cin >> str;
    if (str == "snuke") {
      cout << (char)('A' + j) << (i + 1) << endl;
    }
  }
  return 0;
}


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


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int x = sc.nextInt();
		int t = sc.nextInt();

		pr.println(Math.max(0, x - t));
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long llong;
double digrad(double dig) { return dig*M_PI / 180.0; }
int main() {
	double d, a,q=90;
	double x = 0, y = 0;
	char f;

	double rad=M_PI*q/180;
	while (true) {
		cin >> d >> f >> a;
		if (d == 0 && a == 0)break;
		x += d*cos(digrad(q));
		y += d*sin(digrad(q));
		//cout << "x: " << x << "  y: " << y << endl;
		q -= a;
	}
	x = (int)x;
	y = (int)y;
	cout << x << endl << y << endl;

	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int i,k=0;
  cin >> N;
  
  
  while(i<N){
    int l,r;
    cin >> l >> r;
    k+=r;
    k-=l;
    k++;
    i++;
  }
  cout << k << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i, n) cin >> d.at(i);
  int sum = 0;
  rep(i, n) {
    if(i == n - 1) break;
    int cmp = d.at(i);
    for(int j = i + 1; j < n; j++) {
      sum += cmp * d.at(j);
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3552
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <stack>
#include <utility>
#include <cmath>
#include <cstdio>
#include <string>

using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;
LL MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    string s;
    cin >> s;
    vector<vector<LL>> dp(N, vector<LL>(N, 0));
    dp[0][0] = 1;
    for(int i=0; i<N-1; i++) {
        if(s[i] == '<')
            for(int j=1; j<=i+1; j++) {
                dp[i+1][j] = dp[i+1][j-1] + dp[i][j-1];
                dp[i+1][j] %= MOD;
            }
        if(s[i] == '>')
            for(int j=i; j>=0; j--) {
                dp[i+1][j] = dp[i+1][j+1] + dp[i][j];
                dp[i+1][j] %= MOD;
            }
            /*
        for(int j=0; j<N; j++)
            cout << dp[i+1][j];
        cout << endl;
        */
    }
    LL ans = 0;
    for(auto elem: dp[N-1]) ans += elem;
    cout << ans % MOD << endl;

    return 0;
}

Measured memory_bytes: 70656
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pa;
typedef map<int,int> ma;
typedef set<int> se;
typedef vector<int> ve;
const int maxn=2e5+7;
const int mod=1e9+7;
const int N=1e5+7;
const int inf=1e9+7;
double a[maxn];
int main() {
    int n,k;
    double cmax=0,s=0;
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++)
        scanf("%lf",&a[i]);
    for(int i=0;i<k;i++){
        s+=(1+a[i])/2.0;
    }
    cmax=max(cmax,s);
    for(int i=0;i+k<n;i++){
        s-=(1+a[i])/2.0;
        s+=(1+a[i+k])/2.0;
        cmax=max(cmax,s);
    }
    printf("%.7f\n",cmax);
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds; 
using namespace std;



typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
    
    
    
//defines
typedef long long ll;
typedef long double ld;
  
ll a,b,c,n,m,k,t=1;


void solve()
{
  string s,ss;
  cin>>s>>ss;
  m=0;
  for(ll i=0;i<s.size();i++)
  {
      if(s[i]!=ss[i])m++;
  }
  cout<<m;
}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  //cin>>t;
    while(t--)
    {
        solve();
    }
  //cout<<sum;
        
    return 0;
}

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

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

  bool threedoubles= false;
  int cnt= 0;
  int buf1,buf2;
  for(int i=0; i<N; i++){
    cin >> buf1 >> buf2;
    if(buf1==buf2){
      cnt++;
      if(cnt >= 3){
        threedoubles= true;
      }
    }
    else{
      cnt= 0;
    }
  }

  string ans= threedoubles ? "Yes"
                           : "No";
  
  cout << ans << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y))
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;

const int N = 1e6+10 ;
const ll MOD = 1e9 + 7;
typedef pair<ll,ll >PII;

vector<int >g[N];

int T,n,b,c,r;
int x1,x2,ans;
int a[N],p,k;

int dp[N];

int main(){
   string s;
   cin>>s;
   for(int i=0 ,j = s.length()-1;i<s.length();i++,j--){
       if(s[i]!=s[j]) ans++;
   }
   cout<<ans/2;
}


Measured memory_bytes: 25344
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	ll a, v, b, w, t;
	cin >> a >> v >> b >> w >> t;
	ll mid = abs(b-a);
	ll ts = abs(w-v);
	if(w-v >= 0){
		puts("NO");
		return 0;
	}
	ll check = mid/ts;
	if(mid%ts != 0) check = mid/ts +1;
	if(check <= t) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;
ll ans[200010];
int main(){
  string s; cin>>s; s+="R";
  for(int i=0;i<s.size();i++)ans[i]=0;
  ll a=1,b=0,pl=-1;
  for(int i=1;i<s.size();i++){
      if(s[i-1]=='L'&&s[i]=='R'){
	  ans[pl]=(a+1)/2+b/2;
	  ans[pl+1]=a/2+(b+1)/2;
	  a=1,b=0,pl=-1;
	  continue;
      }
      if(s[i]=='L')b++;
      if(s[i]=='R')a++;
      if(s[i-1]=='R'&&s[i]=='L')pl=i-1;
  }
  for(int i=0;i<s.size()-1;i++)cout<<ans[i]<<endl;
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N;
    cin >> N;
    lint ret = 0;
    FOR(i, 1, N + 1)
        if (i % 3 != 0 && i % 5 != 0)
            ret += i;
    cout << ret << endl;
    return 0;
};

Measured memory_bytes: 3604
use std::{io::{self, prelude::*}, *};

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    let mut scan = Scanner::new(stdin.lock());
    let mut w = io::BufWriter::new(stdout.lock());
    
    let mut p = Vec::<i64>::new();
    const N:usize =1e6 as usize + 1;
    let mut isp = vec![false; N];
    
    for i in 2..(N as i64) {
        if !isp[i as usize] {
            p.push(i as i64);
        }
        for x in &p {
            if x * i >= N as i64 {
                break;
            }
            isp[(x * i) as usize] = true;
            if i % x == 0 {
                break;
            }
        }
    }
    // writeln!(w, "ok");
    let mut ans = 0;
    let n = scan.next();
    for i in 1..n {
        let mut t = i;
        let mut s = 1;
        for x in &p {
            if x * x > i {
                break;
            }
            let mut c = 0;
            while t % x == 0 {
                c += 1;
                t /= x;
            }
            s *= c + 1;
        }
        if t > 1 {
            s *= 2;
        }
        ans += s;
    }
    writeln!(w, "{}", ans);
}
 
 
pub struct Scanner<B> {
    reader: B,
    buf_str: Vec<u8>,
    buf_iter: std::str::SplitWhitespace<'static>,
}
impl<B: BufRead> Scanner<B> {
    pub fn new(reader: B) -> Self {
        Self {
            reader,
            buf_str: Vec::new(),
            buf_iter: "".split_whitespace()
        }
    }
    pub fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse");
            }
            self.buf_str.clear();
            self.reader.read_until(b'\n', &mut self.buf_str).expect("Failed read");
            self.buf_iter = unsafe {
                let slice = std::str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_whitespace()) }
        }
    }
}

Measured memory_bytes: 3672
/* ex 9_1
   riverstone */

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

//スタックに格納するデータの数
#define SIZE 20
 
//スタックの定義
typedef struct stack{
    int size;//格納最大数
    int count;//現在のデータ数
    char data[SIZE];//データ配列
    char *top;//topへのポインタ
} stack;

void initialize_stack(stack *stk);
void push(stack *stk, char elem);
char pop(stack *stk);
void print_stack(stack *stk);

int main(void){
    int i=0;
    char string[SIZE];
    stack stk;
 
    //スタックを初期化
    initialize_stack(&stk);
 
    //入力を受け取る
    scanf("%s", string);

    //stringの中身を一文字ずつ見ていく
    for(i=0;i<strlen(string);i++){
        //入力文字が0か1の場合
        if(string[i]=='0' || string[i]=='1'){
            //スタックにプッシュする
            push(&stk,string[i]);
        }

        //入力文字がBの場合
        else if(string[i]=='B' && stk.count>0){
            //スタックから一文字popする
            pop(&stk);
        }
    } 

    //stackの中身を出力
    print_stack(&stk);
    printf("\n");
    return 0;
}


//スタックの初期化
void initialize_stack(stack *stk){
    stk->count = 0;//個数を0にセット
    stk->size = SIZE;//格納最大数はSIZEに
    stk->top = &(stk->data[SIZE]);//topは配列の最終要素の1つ手前。
}

//データの追加
void push(stack *stk, char elem){
    //最大要素数stk->sizeより多くの要素を追加使用とした場合エラー
    if(stk->count >= stk->size){
        fprintf(stderr, "Error: stack overflow. (x=%c)\n", elem);
        exit(1);
    }
    else{
        //topを1つ上に上げる(=topを1つ手前に移動する)
        stk->top--;
        //1つ上げたtopにデータを格納する
        *(stk->top) = elem;
        //現在のデータ数を1つ増やす
        stk->count++;
    }
}

//データの取り出し
char pop(stack *stk){
    char latest;
    //要素数が0以下になった場合取り出せない
    if(stk->count <= 0){
        fprintf(stdout, "Error: stack underflow.\n");
        exit(1);
    }
    else{
        //topの位置からデータを取り出す
        latest = *(stk->top);
        //topを1つ下に下げる
        stk->top++;
        //現在のデータ数を1つ減らす
        stk->count--;
        return latest;
    }
}
 
//出力
void print_stack(stack *stk){
    int i;
    //先頭の位置から、新しいデータに向かって順番にprint
    for (i=0;i < stk->count;i++){
        printf("%c",stk->data[SIZE-i-1]);
    }
    printf("\n");
}

Measured memory_bytes: 1604
import java.util.*;

/**
 * Created by DELL on 2017/7/15.
 */
public class Main {




    public static void main(String[] args) {
        Scanner in=new Scanner(System.in
        );
        List<Integer> list=new ArrayList();
        int N=in.nextInt();
        int K=in.nextInt();
        for (int i = 0; i < N; i++) {
            list.add(in.nextInt());
        }
        Collections.sort(list);
        System.out.println(list.parallelStream().sorted(Comparator.comparing(x->-x)).mapToInt(x->x).limit(K).sum());


    }
}

Measured memory_bytes: 29260
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var p = Console.ReadLine().ToInt();
		
		Console.WriteLine(p >= 30 ? "Yes": "No");
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 27468
#define MAX 200000

#include <stdio.h>
#include <string.h>
#include <stdbool.h>

//?§???????.
typedef struct process {
	char name[11];
	int time;
}pro;

//????????????????????£?¨?.
void enqueue(pro x);
pro dequeue();
bool isFull();
bool isEmpty();

//??°?????????????????°.
pro pr[MAX];
int head = 0;
int tail = 0;

int main(void) {
	int i = 0;
	int n = 0;
	int q = 0;
	int t = 0;
	pro cell;

	scanf("%d %d", &n, &q);

	//process?????£?¨???¨????????????.
	for (i = 0; i < n; i++) {
		scanf("%s", pr[i].name);
		scanf("%d", &pr[i].time);
	}

	tail = n;

	while (!isEmpty()) {
		cell = dequeue();
		if (cell.time - q <= 0) {
			t += cell.time;
			cell.time = 0;
			printf("%s %d\n", cell.name, t);
		}
		else if (cell.time > 0) {
			t += q;
			cell.time -= q;
			enqueue(cell);
		}
	}

	return 0;
}

void enqueue(pro x) {
	pr[tail] = x;

	if (tail + 1 == MAX)
		tail = 0;
	else
		tail++;
}

pro dequeue(void) {
	pro x = pr[head];

	if (head + 1 == MAX)
		head = 0;
	else
		head++;

	return x;
}

bool isFull() {
	return head == (tail + 1) % MAX;
}

bool isEmpty() {
	return head == tail;
}

Measured memory_bytes: 3556
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;
 
namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var n = ReadInt();
            Console.WriteLine($"{n * 800 - n / 15 * 200}");
        }
    }
 
    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);
    }
}

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

#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define lb(v, z) lower_bound(all(v), z)
#define ub(v, z) upper_bound(all(v), z)
#define fill(a, z) memset(a, z, sizeof(a))
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define rdp(i, a, b) for (int i = (a); i >= (b); i--)
#define rlt(i, a, b) for (int i = (a); i < (b); i++)
#define cns(z) cout << z << ' '
#define cnl(z) cout << z << '\n'
#define printclock cerr << "Time : " << 1000 * (double)clock() / (double)CLOCKS_PER_SEC << "ms\n";
#define M 1000000007
#define M2 998244353
#define MAXN 300005
#define INF 1000000000000
#define endl "\n"
#define iip(t) \
	int t;     \
	cin >> t;
#define iip2(a, b) \
	int a, b;      \
	cin >> a >> b;
#define dip(a) \
	double a;  \
	cin >> a;
#define dip2(a, b) \
	double a, b;   \
	cin >> a >> b;
#define garr(ip)       \
	for (auto &x : ip) \
		cin >> x;
#define parr(ip)          \
	for (auto &x : ip)    \
		cout << x << " "; \
	cout << endl;
#define test   \
	int _t;    \
	cin >> _t; \
	while (_t--)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vp;

int modExp(int base, int exponent)
{
	if (exponent == 0)
		return 1;
	int curr = modExp(base, exponent >> 1);
	curr = (curr * curr) % M;
	if (exponent & 1)
		curr = (curr * base) % M;
	return curr;
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	iip2(n, k);
	vi ans(k+1);
	rdp(i, k, 1)
	{
		ans[i] = modExp(k / i, n);
		for (int j = i + i; j <= k; j += i)
		{
			ans[i] = (ans[i] - ans[j] + M) % M;
		}
	}
	int sum = 0;
	rep(i, 1, k)
		sum = (sum + i * ans[i]) % M;
	cnl(sum);
}

Measured memory_bytes: 3976
import math 
n,d =map(int, input().split())

xx=[]
for i in range(n):
    xx.append(list(map(int, input().split())))


def distance(xx,d,i,j):
    ans = 0
    for u in range(d):
        ans+=((xx[i][u]-xx[j][u])**2)
    if math.sqrt(ans).is_integer():
         return 1
    else :
        return 0
    
count =0
for i in range(n):
    for j in range(i+1,n):
        count += distance(xx,d,i,j)
print (count)


Measured memory_bytes: 9208
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication39
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int a = 0;
                int[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (b[0] == 0 && b[1] == 0)
                    break;
                if (b[0] == 1)
                    a += 0;
                if (b[0] == 2)
                    a += 31;
                if (b[0] == 3)
                    a += 60;
                if (b[0] == 4)
                    a += 91;
                if (b[0] == 5)
                    a += 121;
                if (b[0] == 6)
                    a += 152;
                if (b[0] == 7)
                    a += 182;
                if (b[0] == 8)
                    a += 213;
                if (b[0] == 9)
                    a += 244;
                if (b[0] == 10)
                    a += 274;
                if (b[0] == 11)
                    a += 305;
                if (b[0] == 12)
                    a += 335;
                a += b[1];
                if (a % 7 == 0)
                    Console.WriteLine("Wednesday");
                else if (a % 7 == 1)
                    Console.WriteLine("Thursday");
                else if (a % 7 == 2)
                    Console.WriteLine("Friday");
                else if (a % 7 == 3)
                    Console.WriteLine("Saturday");
                else if (a % 7 == 4)
                    Console.WriteLine("Sunday");
                else if (a % 7 == 5)
                    Console.WriteLine("Monday");
                else if (a % 7 == 6)
                    Console.WriteLine("Tuesday");
            }
        }
    }
}

Measured memory_bytes: 9236
#include <stdio.h>
int main()
{
    int A,B;
    scanf("%d%d",&A,&B);
    if(A>=13)
    {
        printf("%d\n",B);
    }
    else if(A>=6 && A<=12)
    {
        printf("%d\n",B/2);
    }
    else if(A<=5)
    {
        printf("0\n");
    }
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))

static const ll MOD = 1e9 + 7;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;

    cin >> n;
    cin >> k;

    int x;
    int half = k / 2;
    int ans = 0;

    int i;

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

        if (x <= half) ans += x * 2;
        else ans += (k - x) * 2;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        String str =sc.next();

        if(str.equals("ABC") ){
            System.out.println("ARC");
        }
        else if(str.equals("ARC")){
            System.out.println("ABC");
        }
    }
}

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

namespace ABC
{
    class ProgramC
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            var n = long.Parse(inputs[0]); // s
            var m = long.Parse(inputs[1]); // c

            // S使うパターン
            var sm = m / 2;
            var s = Math.Min(n, sm);
            n -= s;
            m -= s * 2;

            // cからS作るパターン
            var c = m / 4;

            Console.WriteLine(s + c);
        }
    }
}


Measured memory_bytes: 27320
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int res = a + (int)Math.pow(a, 2) + (int)Math.pow(a, 3);
                System.out.println(res);
    }
}


Measured memory_bytes: 35784
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int main(){
    long long N, A, B;
    cin >> N >> A >> B;
    if(abs(A-B)%2==0){
        cout << abs(A-B)/2 << endl;
    }else{
        long long max_=max(A,B);
        long long min_=min(A,B);
        
        cout << min(min_+(max_-min_-1)/2, N-max_+1+(-min_+max_-1)/2);
    }
}

Measured memory_bytes: 256
#line 1 "DPL_5_E.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_5_D"

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

#line 1 "../modint.cpp"
template <ll Mod>
struct ModInt {
  ll n;
  ModInt(const ll x = 0) : n(x) { while (n < 0) n += Mod; n %= Mod; }
  ModInt operator+(const ModInt r) const { return ModInt(*this) += r; }
  ModInt operator-(const ModInt r) const { return ModInt(*this) -= r; }
  ModInt operator*(const ModInt r) const { return ModInt(*this) *= r; }
  ModInt operator/(const ModInt r) const { return ModInt(*this) /= r; }
  ModInt &operator+=(const ModInt r) { n += r.n; if (n >= Mod) n -= Mod; return *this; }
  ModInt &operator-=(const ModInt r) { if (n < r.n) n += Mod; n -= r.n; return *this; }
  ModInt &operator*=(const ModInt r) { n = n * r.n % Mod; return *this; }
  ModInt &operator/=(const ModInt r) { return *this *= r.inv(); }
  ModInt pow(ll x) const { ModInt<Mod> ret(1), tmp(*this); while (x) { if (x&1) ret *= tmp; tmp *= tmp; x >>= 1; } return ret; }
  ModInt inv() const { return pow(Mod-2); }
  friend ostream& operator<<(ostream& os, const ModInt& obj) { return os << obj.n; }
  friend istream& operator>>(istream& is, ModInt& obj) { ll t; is >> t; obj = ModInt(t); return is; }
};
constexpr ll mod = 1000000007;
using mint = ModInt<mod>;
mint operator"" _mi(unsigned long long n) { return mint(n); }
#line 1 "../combination.cpp"
// T modint
template<class T>
struct Combination {
  vector<T> fact, inv_fact;
  Combination(ll n) : fact(n+1), inv_fact(n+1) {
    fact[0] = T(1);
    for (ll i = 1; i <= n; i++) fact[i] = fact[i-1] * static_cast<T>(i);
    inv_fact[n] = fact[n].inv();
    for (ll i = n; i > 0; i--) inv_fact[i-1] = inv_fact[i] * static_cast<T>(i);
  }

  T P(ll n, ll k) const {
    if (n < k or k < 0) return T(0);
    return fact[n] * inv_fact[n-k];
  }

  T C(ll n, ll k) const {
    if (n < k or k < 0) return T(0);
    return fact[n] * inv_fact[n-k] * inv_fact[k];
  }

  T H(ll n, ll k) const {
    if (n < 0 or k < 0) return T(0);
    if (n == 0 and k == 0) return T(1);
    return C(n+k-1, n-1);
  }
};
#line 16 "DPL_5_E.test.cpp"

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

  ll n, k;
  cin >> n >> k;
  Combination<mint> c(n+k);
  cout << c.C(k, n) << endl;
}



Measured memory_bytes: 3200
#include <cstdio>
#include <cstdlib>
#include <cstring>

struct Node {
    int key;
    Node *next, *prev;
};

Node *nil;

Node* listSearch(int key) {
    Node *cur = nil->next;
    while (cur != nil && cur->key != key) {
        cur = cur->next;
    }
    return cur;
}

void init() {
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void printList() {
    Node *cur = nil->next;
    int isf = 0;
    while (1) {
        if (cur == nil) break;
        if (isf++ > 0) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}

void deleteNode(Node *t) {
    if (t == nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst() {
    deleteNode(nil->next);
}

void deleteLast() {
    deleteNode(nil->prev);
}

void deleteKey(int key) {
    deleteNode(listSearch(key));
}

void insert(int key) {
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    
    x->next = nil->next;
    nil->next->prev = x;
    x->prev = nil;
    nil->next = x;
}

int main() {
    int key, n, i;
    int size=0;
    char com[20];
    int np=0, nd=0;
    scanf("%d", &n);
    init();
    
    for (i=0; i<n; i++) {
        scanf("%s%d", com, &key);
        if (com[0] == 'i') {
            insert(key);
            np++;
            size++;
        } else if (com[0] == 'd') {
            if (strlen(com) > 6) {
                if (com[6] == 'F') deleteFirst();
                else if (com[6] == 'L') deleteLast();
            } else {
                deleteKey(key);
                nd++;
            }
            size++;
        }
    }
    
    printList();
    return 0;
}


Measured memory_bytes: 33928
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int map[55][55], map2[55][55];

int main()
{
	int h,w,x,y,c,i,j;
	while (scanf("%d%d", &h, &w) != EOF)
	{
		memset(map, 0, sizeof(map));
		memset(map2, 0, sizeof(map2));
		getchar();
		for (y = 0; y < h; y++)
		{
			for (x = 0; x < w; x++)
			{
				c=getchar();
				if (c == '#')
					map[y][x] = '#';
			}
			getchar();
		}

		for (y = 0; y < h; y++)
		{
			for (x = 0; x < w; x++)
			{
				if (map[y][x] != '#')
				{
					int count = '0';
					for (j = y - 1; j <= y + 1; j++)
					{
						for (i = x - 1; i <= x + 1; i++)
						{
							if (j < 0 || j >= h)
								continue;
							if (i < 0 || i >= w)
								continue;
							if(map[j][i]=='#')
								count++;
						}
					}
					map[y][x] = count;
				}
			}
		}


		for (y = 0; y < h; y++)
		{
			for (x = 0; x < w; x++)
				printf("%c", map[y][x]);
			printf("\n");
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n;cin>>n;
  ll cnt=0;
  for(ll i=0;i<n;i++){
    ll a;cin>>a;
    if(a%2==1)cnt++;
  }
  if(cnt%2==0)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

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

#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,lessl<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define double long double

#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()

#define ff first
#define ss second
#define mp make_pair

#define pb push_back
#define endl "\n"

#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)

#define bp __builtin_popcountll
#define inf 1e18

const int N = 1e5 + 5;
const int M = 1e9 + 7;
bool chmin(int &a, int &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
bool chmax(int &a, int &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    int maxv = -1e7, minv = 1e7;
    vector<pair<int, int>>ans;
    int max_pos = 0, min_pos = 0;

    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        if (chmax(maxv, a[i]))max_pos = i + 1;
        if (chmin(minv, a[i]))min_pos = i + 1;
    }
    if (maxv <= 0) {
        for (int i = n - 1; i > 0; --i) {
            a[i - 1] += a[i];
            ans.pb({i + 1, i});
        }
    }
    else if (minv >= 0) {
        for (int i = 0; i < n - 1; i++) {
            a[i + 1] += a[i];
            ans.pb({i + 1, i + 2});
        }
    }
    else {
        if (abs(maxv) >= abs(minv)) {
            for (int i = 0; i < n; i++)
            {
                a[i] += maxv;
                ans.pb({max_pos, i + 1});
            }
            for (int i = 0; i < n - 1; i++)  {
                a[i + 1] += a[i];
                ans.pb({i + 1, i + 2});
            }
        }
        else {
            for (int i = 0; i < n; i++)
            {
                a[i] += minv;
                ans.pb({min_pos, i + 1});
            }
            for (int i = n - 1; i > 0; i--)
            {
                a[i - 1] += a[i];
                ans.pb({i + 1, i});
            }
        }
    }
    cout << ans.size() << endl;
    for (auto x : ans)
        cout << x.ff << " " << x.ss << endl;;
}


signed main()
{
    FAST

#ifndef ONLINE_JUDGE
    freopen("input_sublime.txt", "r", stdin);
    freopen("output_sublime.txt", "w", stdout);
#endif

    int t = 1;
    // cin>>t;
    for (int tc = 1; tc <= t; tc++)
    {
        // cout<<"Case #"<<tc<<": ";
        solve();
    }

#ifndef ONLINE_JUDGE
    cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
}


Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

vector<vector<int>> dp(400, vector<int>(400));
vector<int> a(400);

int rec(int l, int r) {
    if (abs(r - l) < 2) return 0;
    if (dp[l][r] != -1) return dp[l][r];
    
    int res = 0;
    if (abs(a[r - 1] - a[l]) < 2 && rec(l + 1, r - 1) == r - l - 2) res = r - l;
    for (int mid = l + 1; mid < r; ++mid) res = max(res, rec(l, mid) + rec(mid, r));
    dp[l][r] = res;
    return res;
}

int main() {
    while (true) {
        rep(i, 400) a[i] = 0;
        rep(i, 400) rep(j, 400) dp[i][j] = -1;
        int n;
        cin >> n;
        if (n == 0) break;
        rep(i, n) cin >> a[i];
        cout << rec(0, n) << endl;
    }
    return 0;
}



Measured memory_bytes: 3592
"use strict"

function main(input) {
  input = input.split(" ").map(v => ~~v)
  const Y = input[1] // human width
  const Z = input[2] // margin
  const YZ = Y + Z
  const X = input[0] - Z // chair width

  const ans = Math.floor(X / YZ)
  console.log(ans)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

const int maxm=1e5+10;
int m,a[maxm],odd1,odd2;

int main(){
	scanf("%*d%d",&m);
	for(int i=1;i<=m;++i){
		scanf("%d",&a[i]);
		if(a[i]&1){
			if(odd2){
				puts("Impossible");
				return 0;
			}
			else if(odd1)
				odd2=i;
			else
				odd1=i;
		}
	}
	if(m==1){
		if(a[1]==1)
			printf("1\n1\n1\n");
		else
			printf("%d\n2\n1 %d\n",a[1],a[1]-1);
	}
	else{
		if(odd1)swap(a[1],a[odd1]);
		if(odd2)swap(a[m],a[odd2]);
		for(int i=1;i<=m;++i)
			printf("%d ",a[i]);
		if(a[m]==1){
			printf("\n%d\n",m-1);
			printf("%d ",a[1]+1);
			for(int i=2;i<m;++i)
				printf("%d ",a[i]);
			puts("");
		}
		else{
			printf("\n%d\n",m);
			printf("%d ",a[1]+1);
			for(int i=2;i<m;++i)
				printf("%d ",a[i]);
			printf("%d\n",a[m]-1);
		}
	}
	return 0;
}

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

using namespace std;

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  if (K < A) {
    cout << K << endl;
  } else if (K <= A + B) {
    cout << A << endl;
  } else {
    cout << A - (K - A - B) << endl;
  }

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 3632
#include <iostream>
#include <math.h>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main() {
    int n;
    cin >> n;
    int X[n], Y[n];
    for (int i = 0; i < n; i++) cin >> X[i];
    for (int i = 0; i < n; i++) cin >> Y[i];
    
    double a = 0, b = 0, c = 0, d = 0;
    for (int i = 0; i < n; i++) a += abs(X[i] - Y[i]);
    for (int i = 0; i < n; i++) b += abs(X[i] - Y[i]) * abs(X[i] - Y[i]);
    b = sqrt(b);
    for (int i = 0; i < n; i++) c += abs(X[i] - Y[i]) * abs(X[i] - Y[i]) * abs(X[i] - Y[i]);
    c = cbrt(c);
    for (int i = 0; i < n; i++) {
        double tmp = abs(X[i] - Y[i]);
        d = max (d, tmp);
    }

    printf("%.6lf\n", a);
    printf("%.6lf\n", b);
    printf("%.6lf\n", c);
    printf("%.6lf\n", d);
    return 0;
}


Measured memory_bytes: 3332
N,K,S = map(int,input().split())

if N == K:
  ans = [S for _ in range(K)]
else:
  ans = []
  if S == 1:
    for i in range(K):
      ans.append(S)
  else:
    a = S//2
    b = S-a
    for i in range(K+1):
      if i%2 == 0:
        ans.append(a)
      else:
        ans.append(b)
for i in range(N-len(ans)):
  if S < 10**9:
    ans.append(10**9)
  else:
    ans.append(10**9-1)
  
print(*ans)

Measured memory_bytes: 49656