akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
	int i;
	for ( i = 1; i <= n; i++ ){
		if ( i > 1 ) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

int main(){
    int n, i, j;
    int k, m, key;
	int A[N+1];
	scanf("%d", &n);

	for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
    A[0] = 0;
    
	trace(A, n);
    for ( k = 2; k < (n+1); k++){
        key = A[k];
        /* insert A[i] into the sorted sequence A[0,...,j-1] */
        m = k - 1;
        while ((m >= 0) && (A[m] > key)){
            A[m+1] = A[m];
            m--;
        }
        A[m+1] = key;
        trace(A, n);
    }

	return 0;
}

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

int main(){

	int card[4][13]={0},n,N; //????¬?????????????????????????????????¨?????¨?????§??\??????????????????????????£???????????§???????????????
	char M;
	cin >> n;

	for(int i=0; n>i; i++){ //????????????S?????????????????????H?????????????????????C?????????????????????D???????????¨??????
		cin >> M >> N;
		if(M == 'S')card[0][N-1]=1;
		else if(M == 'H')card[1][N-1]=1;
		else if(M == 'C')card[2][N-1]=1;
		else if(M == 'D')card[3][N-1]=1;
	}

	for(int i=0; 4>i; i++){
		for(int j=0; 13>j; j++){
			if(card[i][j]==0){
				if(i==0)cout << "S" << " " << j+1 << endl;
				else if(i==1)cout << "H" << " " << j+1 << endl;
				else if(i==2)cout << "C" << " " << j+1 << endl;
				else if(i==3)cout << "D" << " " << j+1 << endl;
			}
		}
	}

	return 0;
}

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

#define int long long
#define x first
#define y second

int l, r;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	cin >> l >> r;
	if(r - l >= 2019) cout << 0 << endl;
	else {
		int mini = 2020;
		for(int i = l; i <= r; i++)
			for(int j = i+1; j <= r; j++)
				mini = min(mini, (i*j)%2019);
		cout << mini << endl;
	}
}




















































Measured memory_bytes: 256
#include<cmath>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<algorithm>
#include<list>
#include<cstring>
#include <numeric>
#include <iomanip>

#define ll long long
#define int long long
#define ld long double
#define endl "\n"
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(p) cerr<<#p<<'='<<(p.first)<<" "<<p.second<<endl;
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define output(x)   cout << (x ? "YES" : "NO")<<endl;
#define print(x) cout<<x<<endl;
const ll MOD = 1e9 + 7;
const int N = 1e5+5;
const int demo = 10;
using namespace std;
const ll cfmod=998244353;
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
char button[4]={'L','R','U','D'};

// Ahhiya thi lakhvanu chalu thasse....

signed main() {
    FAST
    int q = 1;
    //cin>>q;
    while(q--){
        int x;
        cin>>x;
        if(x>=30){
            cout<<"Yes";
        }
        else{
            cout<<"No";
        }
    }
}


Measured memory_bytes: 3124
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	int X[3100];
	int Y[3100];
	int i = 0;
	while (true) {
		cin >> X[i] >> Y[i];
		if (X[i] == 0 && Y[i] == 0) break;
		++i;

	}

	for (int j = 0; j < i; ++j) {
		if (X[j] > Y[j]) cout << Y[j] << " " << X[j] << endl;
		else cout << X[j] << " " << Y[j] << endl;
	}
	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <string>
using namespace std;
int main() {
  string s;
  cin >> s;

  string ans;
  for(char i = 'a'; i <= 'z'; i++) {
    for(int j = 0; j <= s.size(); j++) {
      if(j == s.size()) {
        cout << i << endl;
        return 0;
      }else if(s[j] == i){
        break;
      }
    }
  }

  cout << "None" << endl;
  return 0;
}


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

char buf[20][20];
bool ok[20][20];
bool done[20];
int perm[20];
bool ya[20];
int r, c;

void bf(int at)
{
	if (at == r/2)
	{
		if (r&1) for (int i = 0;i < r;i++) if (!done[i])
		{
			perm[at] = i;
			break;
		}
		for (int i = 0;i < c;i++) ya[i] = false;
		for (int i = 0;i < c;i++) if (!ya[i]) for (int j = i+1;j < c;j++) if (!ya[j])
		{
			bool yes = true;
			for (int k = 0;k < r;k++) if (buf[perm[k]][i] != buf[perm[r-k-1]][j])
			{
				yes = false;
				break;
			}
			if (yes)
			{
				ya[i] = ya[j] = true;
				break;
			}
		}
		bool has = false;
		for (int i = 0;i < c;i++) if (!ya[i])
		{
			if (has) return;
			for (int j = 0;j < r;j++) if (buf[perm[j]][i] != buf[perm[r-j-1]][i]) return;
			has = true;
		}
		printf("YES\n");
		exit(0);
	}
	for (int i = at;i < r;i++) if (!done[i])
	{
		done[i] = true;
		perm[at] = i;
		for (int j = i+1;j < r;j++) if (!done[j] && ok[i][j])
		{
			done[j] = true;
			perm[r-at-1] = j;
			bf(at+1);
			done[j] = false;
		}
		done[i] = false;
	}
}

int main()
{
	scanf("%d%d", &r, &c);
	for (int i = 0;i < r;i++) scanf("%s", buf[i]);
	for (int i = 0;i < r;i++) for (int j = i+1;j < r;j++)
	{
		string x, y;
		for (int k = 0;k < c;k++) x.push_back(buf[i][k]), y.push_back(buf[j][k]);
		sort(x.begin(), x.end());
		sort(y.begin(), y.end());
		if (x == y) ok[i][j] = true;
	}
	bf(0);
	printf("NO\n");
	return 0;
}


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

#define  pf                  printf
#define  sc                  scanf
#define  PI                  2*acos(0.0)
#define  fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define  mem(a,b)            memset(a, b, sizeof(a) )
#define  gcd(a,b)            __gcd(a,b)
#define  lcm(a,b)            (a*(b/gcd(a,b)))
#define  MAX                 5347567899
#define  mod                 1000000007
#define  all(v)              (v).begin(),(v).end()
#define  vSort(v)            sort(all(v))
#define  maxSort(v)          sort(all(v),greater<int>())
#define  Unique(v)           v.erase(unique(all(v)),v.end())
#define  sqr(x)              ((x)*(x))
#define  qube(x)             ((x)*(x)*(x))
#define  deci(n)             cout<<fixed<<setprecision(n)
#define  sci(n)              sc("%d",&(n))
#define  scii(x,y)           sc("%d %d",&(x),&(y))
#define  scl(x)              sc("%lld",&(x))
#define  scll(x,y)           sc("%lld %lld",&(x),&(y))
#define  vi                  vector<int>
#define  hi                  pf(" HI \n")
#define  pp                  pair<int,int>
#define  pb(x)               push_back(x)
#define  mp(x,y)             make_pair(x,y)
#define  F                   first
#define  S                   second
#define  check(n,pos)        (n & (1<<(pos)))
#define  biton(n,pos)        (n  (1<<(pos)))
#define  bitoff(n,pos)       (n & ~(1<<(pos)))
typedef  long long int       lli;
typedef  unsigned long long int ulli;
int dx4[] = { 0, 0, -1, 1 } ;
int dy4[] = { -1, 1, 0, 0 } ;
bool valid( int r, int c, int x, int y )
{
    if( x >= 1 && x <= r && y >= 1 && y <= c ) return 1 ;
    return 0 ;
}

using namespace std;
lli arr[102][100005];
lli c,n;
lli result;
lli v[1000+2];
lli w[1000+2];
lli KP(lli pos, lli val)
{
    if(val==0)
        return 0;
     if(pos==n || val<0)
        return MAX;
    if(arr[pos][val]!=0)
        return arr[pos][val];


        lli temp1= KP(pos+1,val);
        lli temp2= w[pos]+ KP(pos+1,val-v[pos]);
        result= min(temp1,temp2);
    arr[pos][val]=result;
    return result;
}
int main ()
{

    cin >> n >> c;
    for(int i=0; i<n; i++)
        cin >> w[i]>> v[i];
//    for(int i=1; i<=n; i++)
//        cin >> w[i];
  //  cin >> c;
  int ans;
  for(int i=n*1000;i>=0;i--)
  {
      if(KP(0,i)<=c)
      {
          ans=i;
          break;
      }
  }
    cout << ans <<endl;

    return 0;
}




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

using namespace std;

typedef long long ll;

int gcd(int a, int b)
{
    while(a^=b^=a^=b%=a);
    return b;
}



int main()
{
    ll sum=0;
    int N;
       cin>> N;


    for(int i=1;i<=N;i++)
        for(int k=1;k<=N;k++)
        for(int z=1;z<=N;z++)
            sum+=gcd(gcd(i, k), gcd(i, z));
        cout << sum;



    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    REP(i, N) cin >> a[i];

    int num1 = 0, num2 = 0, num4 = 0;
    REP(i, N) {
        if (a[i] % 4 == 0) {
            num4++;
        } else if (a[i] % 2 == 0) {
            num2++;
        } else {
            num1++;
        }
    }
    if (num2 == 0) {
        if (num4 >= N / 2) 
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    } else {
        if ((N - num2 + 1) / 2 <= num4) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(){
	int panjangstring;
	cin >> panjangstring;
	char stringnya[panjangstring];
	cin >> stringnya;
	int huruf_yang_mau_dihapus;
	cin >> huruf_yang_mau_dihapus;
	huruf_yang_mau_dihapus = huruf_yang_mau_dihapus - 1;
	char hurufdihapus = stringnya[huruf_yang_mau_dihapus];
	//cout << hurufdihapus;
	for(int i = 0 ; i < panjangstring ; i++){
		if (hurufdihapus != stringnya[i]){
			stringnya[i] = '*';
		}
	}
	cout << stringnya << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
int main()
{
	long long n,flag=0,flag2=0;
	long double a[100005]={0},sum=1;
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> a[i];
		if(a[i]==0)
			flag=1;
	}
	for(int i=1;i<=n;i++){
		sum*=a[i];
		if(sum>1000000000000000000){
			flag2=1;
			break;
		}
		if(flag2==1)
			break;
	}
	if(flag==1){
		cout << "0" << endl;
	}
	else if(flag2==1){
		cout << "-1" << endl;
	}
	else
		cout << (long long)sum << endl;
	return 0;
}

Measured memory_bytes: 5292
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define ll int
#define bits_count __builtin_popcountll
#define endl '\n'
#define double double
#define ld double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
#define sz(x) (ll)x.size()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

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

    int ans = n*(n-1)/2 + m*(m-1)/2;

    cout<<ans<<endl;
}

signed main(){

   FastRead;    


    int t = 1; 
    // cin>>t; 
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

Measured memory_bytes: 256
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        while (true){
            int x = sc.nextInt();
            int y = sc.nextInt();
            if (x == 0 && y ==0){
                break;
            }System.out.println(Math.min(x,y)+" "+Math.max(x,y));
        }
    }
}


Measured memory_bytes: 33860
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;

int main(){
	int n=1;
	cin >> n;
	vector<int> a(n);

	for(int i = 0; i<n; i++) {
		int temp;
		cin >> temp;
		a[temp-1] = i + 1;
	}

	cout << a[0];
	for(int i = 1; i<n; i++) {
		cout << " " << a[i];
	}
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>

int main()
{
	int n;
	int *sequence;
	std::cin >> n;
	sequence = new int[n];
	for (int i = 0; i < n; i++)
	{
		int num;
		std::cin >> num;
		sequence[i] = num;
	}
	for (int i = n -1; i >= 0; i--)
	{
		std::cout << sequence[i];
		if (i > 0)
		{
			std::cout << " ";
		}
		else
		{
			std::cout << '\n';
		}
	}
	return 0;
}

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

int main()
{
	//ios::sync_with_stdio(0),cin.tie(0);
	int x;
	cin >> x;
	int f = x/100;
	int s = x%100;
	//printf("%d %d\n",f,s);
	if(f<=12 and f>0){
		if(s>12 or s==0){
			printf("MMYY\n");
		} else if(s<=12){
			printf("AMBIGUOUS\n");
		} else {
			printf("NA\n");
		}
	} else if(f>12 or f==0){
		if(s<=12 and s>0){
			printf("YYMM\n");
		}
		else{
			printf("NA\n");
		}
	}
	
}


Measured memory_bytes: 3580
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main() {
	double kotoshi[101][101];
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			kotoshi[i][j] = sqrt(i*i + j*j);
			//cout <<" "<< kotoshi[i][j];
		}
		//cout << endl;
	}
	int d, e;
	while (cin >> d >> e&&d&&e) {
		double cost = 50000;
		int x , y = 0;
		for (x = d; x >= 0; x--, y++) {
			cost = min(cost, fabs(kotoshi[y][x] - e));
		}
		cout << cost << endl;
	}
	return 0;

}

Measured memory_bytes: 1316
/**
*    author:  souzai32
*    created: 15.08.2020 21:00:57
**/

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

int main() {

    string s;
    cin >> s;
    int count=0;
    rep(i,3) if(s.at(i)=='R') count++;
    if(count==2&&s.at(1)=='S') count=1;
    cout << count << endl; 

    return 0;
}

Measured memory_bytes: 3584
#include <cstdio>
#include <cstdlib>
#include <vector>

const int N = 100000 + 10;

int n;
std::vector<int> adj[N];

void fail() {
  puts("First");
  exit(0);
}

bool dfs(int a, int fa = -1) {
  int cnt = 0;
  for (auto b : adj[a]) if (b != fa) cnt += dfs(b, a);
  if (cnt > 1) fail();
  return !cnt;
}

int main() {
  scanf("%d", &n);
  if (n & 1) fail();
  for (int i = n - 1; i--;) {
    int a, b;
    scanf("%d%d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs(1);
  puts("Second");
  return 0;
}


Measured memory_bytes: 5760
#include<iostream>
int main(){
    int s;
    std::cin >> s;
    int h = s / 3600;
    s = s % 3600;
    int m = s / 60;
    s = s % 60;
    std::cout << h << ":" << m << ":" << s << std::endl;
    return 0;
}

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

using namespace std;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int n,x,t,s=0;
    cin>>n>>x>>t;
    if(n%x==0)
    s=n/x;
    else
    {
         s=n/x;
         s++;
    }
    long long int ans=s*t;
    cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

vector<pair<ll, int>> factorize(ll n){
    vector<pair<ll, int>> res;
    for (ll i = 2; i*i <= n; ++i){
        if (n%i) continue;
        res.emplace_back(i, 0);
        while (n%i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

int main(){
    int n;
    cin >> n;
    map<int, ll> mp;
    for(int i = 1; i <= n; i++){
        auto res = factorize(i);
        for(auto r : res){
            mp[r.first] += r.second;
        }
    }
    vector<pair<ll, int>> res;
    for(auto m: mp){
        res.push_back(make_pair(m.first, m.second));
    }

    int sz = res.size();
    VVL dp(sz+1, VL(77));
    dp[0][1] = 1;
    rep(i, sz){
        int num = res[i].second;
        rep(j, 76) {
            rep(k, num+1){
                int to = min(j * (k+1), 76);
                dp[i+1][to] += dp[i][j];
            }
        }
    }
    ll ans = dp[sz][75];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3612
#!/bin/bash
import sys


def _ia(): return [int(x) for x in sys.stdin.readline().strip().split()]


def main():
    n, m = _ia()
    k = {i: set() for i in range(1, n + 1)}
    for _ in range(m):
        si, ci = _ia()
        k[si].add(ci)

    ans = ""
    for i in range(1, n + 1):
        lk = len(k[i])
        if lk == 0:
            if n > 1 and i == 1:
                k[i].add(1)
            else:
                k[i].add(0)
        elif lk == 1:
            pass
        else:
            return "-1"
        ans += str(k[i].pop())
    return "-1" if ans.startswith("0") and len(ans) > 1 else ans


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
#ifdef KEV
#define DE(i, e) cerr << #i << ' ' << i << e
void debug(auto L, auto R) { while (L < R) cerr << *L << " \n"[L+1==R], ++L; }
#else
#define DE(...) 0
void debug(...) {}
#endif
const int maxn = 300010;
signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int x;
	cin >> x;
	cout << !x << '\n';
}



Measured memory_bytes: 3636
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}

	sum := a[0]
	xor := a[0]
	right := 1
	res := 0
	for left := 0; left < n; left++ {
		for right < n && (sum+a[right]) == (xor^a[right]) {
			sum += a[right]
			xor ^= a[right]
			right++
		}
		res += right - left

		if right == left {
			right++
		} else {
			sum -= a[left]
			xor ^= a[left]
		}
	}

	fmt.Println(res)
}


Measured memory_bytes: 3840
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>

using namespace std;



int main(){

    int n;
    cin >> n;

    vector<long> h(n);
    for(int i=0; i<n; i++){
        cin >> h.at(i);
    }

    vector<unsigned long> dp_table(n);
    long jump_1 = 99999;
    long jump_2 = 99999;
    for(int i = 0; i<n; i++){
        if(i == 0){
            dp_table.at(i) = 0;
            continue;
        }
        else if(i == 1){
            jump_1 = labs(h.at(i) - h.at(i - 1)) + dp_table.at(i - 1);
        }
        else{
            jump_1 = labs(h.at(i) - h.at(i - 1)) + dp_table.at(i - 1);
            jump_2 = labs(h.at(i) - h.at(i - 2)) + dp_table.at(i - 2);
        }

        if(jump_1 < jump_2){
            dp_table.at(i) = jump_1;
        } else {
            dp_table.at(i) = jump_2;
        }

        jump_1 = 99999;
        jump_2 = 99999;
    }

    cout << fixed << dp_table.at(n-1) << endl;

}

Measured memory_bytes: 1920
import java.util.*;

public class Main {
	static int judge(String name, String org){
		for(int i=1; i<org.length(); i++){
			for(int k=0; k<i; k++){
				StringBuilder ename = new StringBuilder();
				int interval = k;
				while(interval < org.length()){
					ename.append(org.charAt(interval));
					interval += i;
				}
				if(ename.indexOf(name) >= 0)	return 1;
				
			}
		}
		return 0;
	}
	
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		String name = s.next();
		int cnt =0;
		
		for(int i=0; i<n; i++){
			cnt += judge(name, s.next());
		}
		System.out.println(cnt);
	}
}

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

int n;
int a[114][514];
set<int> cnt[114];

int main() {
  scanf("%d", &n);
  if (n == 2) {
    puts("-1");
    return 0;
  }

  for (int i=1; i<=n; i++) cnt[i].insert(i);

  for (int i=1; i<=n-2; i++) {
    if (i%2 == 0) {
      a[i][i] = i+1; 
      cnt[i].insert(i+1);
      a[i][i+1] = i+2; 
      cnt[i+1].insert(i+2);
      a[i][i+2] = i; 
      cnt[i+2].insert(i);
    } else {
      a[i][i] = i+2; 
      cnt[i].insert(i+2);
      a[i][i+1] = i; 
      cnt[i+1].insert(i);
      a[i][i+2] = i+1; 
      cnt[i+2].insert(i+1);
    }
  }

  for (int i=1; i<=n-2; i++) {
    for (int j=1; j<=n; j++) {
      if (i <= j && j <= i+2) continue;
      if (cnt[j].count(i)) {
        for (int k=1; k<=n; k++) {
          if (!cnt[j].count(k)) {
            a[i][j] = k;
            cnt[j].insert(k);
            break;
          }
        }
        continue;
      }

      a[i][j] = i;
      cnt[j].insert(i);
    }
  }

  for (int i=1; i<=n; i++) {
    for (int k=1; k<=n; k++) {
      if (!cnt[i].count(k)) {
        a[n-1][i] = k;
        cnt[i].insert(k);
        break;
      }
    }
  }

  for (int i=1; i<=n; i++) {
    printf("%d", a[1][i]);
    for (int j=2; j<=n-1; j++) {
      printf(" %d", a[j][i]);
    }
    puts("");
  }
}


Measured memory_bytes: 896
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=1e9+7;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-4;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>int LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>int UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	int n,i;cin>>n;
	set<int>a;
	while(n--){
		int x;cin>>x;a.ins(x);}
	cout<<a.size()<<endl;
	return 0;
}



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

using namespace std;

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define FOR(i,n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<ii> vii;

const int MX = 100005;
int n, a[MX];

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	sort(a, a+n);

	int x = a[n-1], y = a[0], mx = min(y, x - y);

	for (int i = 1; i < n - 1; i++) {
		int d = min(a[i], x - a[i]);
		if (d > mx) {
			y = a[i];
			mx = d;
		}
	}

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

	return 0;
}


Measured memory_bytes: 640
n = int(input())
s = input()

w = [0]*n
e = [0]*n

for i in range(n):
  if s[i] == "W": w[i] += 1
  else: e[i] += 1
  if i != n-1:
    w[i+1] = w[i]
    e[i+1] = e[i]

ans = e[-1]-e[0]
for i in range(1,n):
  ans = min(ans, w[i-1] + e[-1]-e[i])
print(ans)

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	int w, ans=0;
	string S;

	cin >> S >> w;

	for(int i=0; i<S.length(); i+=w){
		cout << S[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
import fractions
from functools import reduce

n = int(input())

a = list(map(int,input().split()))

count= 0
maxi = 10**10
for i in range(n):
    num = a[i]
    if a[i] < 0:
        count +=1
    maxi = min(maxi,abs(num))

if count % 2 == 0:
    print(sum(list(map(lambda x:abs(x),a))))
else:
    print(sum(list(map(lambda x:abs(x),a)))- 2 * maxi)

Measured memory_bytes: 16424
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int main(void){
  priority_queue< P > que;
  int k,t;
  cin >> k >> t;
  for(int i = 0;i < t;++i){
    int a; cin >> a;
    que.push(P(a,i));
  }
  int prev = -1;
  int res = 0;
  for(int i = 0;i < k;++i){
    P now = que.top();
    que.pop();
    if(prev == now.second
       && (int)que.size() == 0){
      ++res;
      prev = now.second;
      if(now.first > 1)
      que.push(P(now.first-1,now.second));
    }else if(prev == now.second){
      P next = que.top();
      que.pop();
      prev = next.second;
      que.push(now);
      if(next.first > 1)
      que.push(P(next.first-1,next.second));
    }else{
      prev = now.second;
      if(now.first > 1)
      que.push(P(now.first-1,now.second));
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 384
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//vector
using vi = vector<int>;
using vii = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

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

const string YES = "Yes";
const string NO = "No";



// ***************************************


int main(){

    int X, Y;
    cin >> X >> Y;

    REP(i, X + 1){
        int j = X - i;
        if (2 * i + 4 * j == Y) {
            cout << YES << endl;
            return 0;
        }
    }

    cout << NO << endl;

    return 0;
}


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

int main() {
    int ab[5][4][11];
    int n=0;
    int b,f,r,v=0;
    for(int i=1;i<=4;i++){
        for (int j=1;j<=3;j++){
            for (int k=1;k<=10;k++){
                ab[i][j][k]=0;
            }
        }
    }
    cin >> n ;
    for(int i=1;i<=n;i++){
        cin >> b >> f >> r >> v;
        ab[b][f][r]=ab[b][f][r]+v;
    }
    for(int i=1;i<=4;i++){
        for (int j=1;j<=3;j++){
            for (int k=1;k<=10;k++){
                cout << ' ' << ab[i][j][k];
            }
            cout << endl;
        }
        if (i!=4)
            cout << "####################" << endl;
    }
    return 0;
}


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

#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)

using ll = long long;
#define INF 1e9

int main(){ 
  string S;
  cin >> S;
  map<char, int> mp;
  REP(i, S.size()){
    mp[S[i]]++;
  }
  bool ans = true;
  if(mp.size() != 2){
    ans = false;
  }
  for(auto ite = mp.begin(); ite != mp.end(); ite++){
    if(ite->second != 2){
      ans = false;
    }
  }
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;
const ll MOD = 998244353;
const ll N = 3e3+1;
const ll S = 3e3+1;
ll dp[N][S];
ll a[N];
ll n,s;
//modulo arithmetic
inline ll add(ll a, ll b)
{
	ll res = a + b;
	if(res >= MOD)
		return res - MOD;
	return res;
}

inline ll mult(ll a, ll b)
{
	ll  res = a;
	res *= b;
	if(res >= MOD)
		return res % MOD;
	return res;
}

inline ll sub(ll a, ll b)
{
	return (a%MOD-b%MOD+MOD)%MOD;
}
int main()
{
    IOS
 	// freopen("input.txt","r",stdin);
 	// freopen("output.txt","w",stdout);
 	// freopen("error.txt","w",stderr);
 	memset(dp,0,sizeof(dp));
 	cin>>n>>s;
 	for(ll i=1;i<=n;i++)
 	{
 		cin>>a[i];
 	}	
 	//dp[0][0]=1;
 	ll ans=0;
 	for(ll i=1;i<=n;i++)
 	{
 		dp[i][a[i]]=add(dp[i][a[i]],i);
 		for(ll j=0;j<N;j++)
 		{	
 			dp[i][j]=add(dp[i][j],dp[i-1][j]);
 			if(j+a[i]<N)
 			{
 				dp[i][j+a[i]]=add(dp[i][j+a[i]],dp[i-1][j]);
 			}
 		}
 		// 	cout<<endl;
 		// for(ll j=0;j<=s;j++)
 		// {
 		// 	cout<<j<<" "<<dp[i][j]<<endl;
 		// }
 		ans=add(ans,mult(sub(dp[i][s],dp[i-1][s]) , (n-i+1)));
 		//cout<<(dp[i][s]) * (n-i+1)<<endl;
 	}
 	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 70784
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

# nの階乗のリスト
def fact(n:int, mod:int) -> list:
    fac = [1,1]
    res = 1
    for i in range(2,n+1):
        res = res*i%mod
        fac.append(res)
    return fac

from bisect import bisect_left
from collections import Counter

MOD = 10**9+7

n,m = li()
a = sorted(list(li()))
b = sorted(list(li()))
aset = set(a)
bset = set(b)

mini = min(a[0], b[0])

ans = 1
for i in range(mini,m*n+1):
    if i in set(a) and i in set(b):
        continue
    
    elif i in set(a):
        idx = bisect_left(b, i)
        ans *= (m-idx)
        ans %= MOD
    
    elif i in set(b):
        idx = bisect_left(a, i)
        ans *= (n-idx)
        ans %= MOD
    
    else:
        idxi = bisect_left(a, i)
        idxj = bisect_left(b, i)
        ans *= ((n-idxi)*(m-idxj) - (m*n-i))
        ans %= MOD
        
fac = fact(mini, MOD)
ans *= fac[mini-1]
ans %= MOD

# 重複判定
db = False
acnt = Counter(a)
bcnt = Counter(b)
for k,v in acnt.items():
    if v > 1:
        db = True
        break
    
for k,v in bcnt.items():
    if v > 1:
        db = True
        break
    
print(0) if db else print(ans)

Measured memory_bytes: 118616
n,k=map(int,input().split())
v=list(map(int,input().split()))
 
ans=0
 
for a in range(50):
  for b in range(50):
    if a+b <= min(n,k):
      li=v[:a]+v[n-b:]
      sumv = sum(li)
      li.sort()
      for i in range(min(k-a-b,len(li))):
        if li[i] < 0:
          li[i] = 0
        else:
          break
      ans=max(ans,sum(li))
      
print(ans)

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    vector<vector<T>>(h,vector<T>(w))
#define VVI(T,h,w,i) vector<vector<T>>(h,vector<T>(w,i))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
    ll a = in(), b = in(), t = in();
    cout << (t / a) * b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
LL facctorialMethod(LL k);
int main(){
    LL a,b,count,sum,ans;
    cin >> a >> b;
    count = b-a;
    sum = 0;
    for(int i = 1; i <= count; i++) {
        sum += i;
    }
    ans = sum - b;
    cout << ans << endl;
    return 0;
}

int facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i){
        sum *= i;
    }
    return sum;
}

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

#define int long long
#define fi first
#define se second
#define otp(n) cout << n;
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define ctv(v) rep(i,(v).size()) ct(v[i])
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define repv(i,v) for(int i=0;i<(v).size();i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);

int n,ans;
string a,b,c;

main() {
    cin >> n >> a >> b >> c;
    rep(i,n) {
        int cnt[3]={};
        if (a[i]!=b[i]) cnt[0]++,cnt[1]++;
        if (a[i]!=c[i]) cnt[0]++,cnt[2]++;
        if (b[i]!=c[i]) cnt[1]++,cnt[2]++;
        ans += min(min(cnt[0],cnt[1]),cnt[2]);
    }
    ct(ans)
}

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

long long dp[310][310][310];

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    dp[0][1][1] = 1;
    for (int i = 0; i < m; i++) {
        for (int j = 0; j <= n; j++) {
            for (int k = j; k <= n; k++) {
                // dp[i][j][k]
                dp[i][j][k] %= mod;
                dp[i+1][j][k+1] += dp[i][j][k] * (n-k) % mod;
                dp[i+1][k][k] += dp[i][j][k] * j % mod;
                dp[i+1][j][k] += dp[i][j][k] * (k-j) % mod;
            }
        }
    }
    cout << dp[m][n][n] % mod << "\n";
    return 0;
}

Measured memory_bytes: 227584
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
int read()
{
	char c=getchar();
	int res=0;
	while(c<'0'||c>'9') c=getchar();
	while(c>='0'&&c<='9') res=(res<<1)+(res<<3)+(c^48),c=getchar();
	return res;
}
int n,m;
int a[200005];
bool check(int x)
{
	int sum=1e9;
	for(int i=2*x+1;i<=2*n;i++) sum=min(sum,a[i]+a[2*n-i+2*x+1]);
	return sum>=m;
}
int main()
{
	n=read(),m=read();
	for(int i=1;i<=2*n;i++) a[i]=read();
	sort(a+1,a+2*n+1);
	int l=0,r=n;
	while(l<r)
	{
		int mid=(l+r)>>1;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	int ans=0;
	for(int i=1;i<=l;i++) ans=max(ans,a[i]+a[2*l-i+1]);
	for(int i=2*l+1;i<=2*n;i++) ans=max(ans,a[i]+a[2*n-i+2*l+1]-m);
	printf("%d\n",ans);
}

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

long long pointGenerator(int row, int column, int width){
    return (1LL*row*width)+column;
}

vector<int> getMax(vector<int> &men) {
    int maxSize=0;
    vector<int> ret;
    for(int & i : men) maxSize=max(maxSize, i);
    for(int i=0; i<men.size(); i++){
        if(maxSize==men[i]) ret.push_back(i);
    }
    return ret;
}

int main() {

    int h, w, m;
    scanf("%d%d%d", &h, &w, &m);

    vector<int> x(m), y(m);
    unordered_set<long long> coords;
    vector<int> menInRow(h, 0);
    vector<int> menInColumn(w, 0);

    for(int i=0; i<m; i++){
        scanf("%d%d", &x[i], &y[i]);
        x[i]--, y[i]--;
        coords.insert(pointGenerator(x[i], y[i], w));
        menInRow[x[i]]++;
        menInColumn[y[i]]++;
    }

    vector<int> maxRow = getMax(menInRow), maxCol = getMax(menInColumn);

    long long total=menInRow[maxRow[0]]+menInColumn[maxCol[0]];
    for(auto & currentRow : maxRow){
        for(auto & currentCol : maxCol){
            if(coords.find(pointGenerator(currentRow, currentCol, w))==coords.end()){
                printf("%lld\n", total);
                return 0;
            }
        }
    }
    printf("%lld\n", total-1);
    return 0;
}


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

#define MD 1000000007

int dp[2097157], P[25];
int N, A[25][25];
int U[25], n;

int solve()
{
    int h = 0;
    for (int i = 0; i < n; i++) h += P[U[i]];
    if (dp[h] != -1) return(dp[h]);
    int c = N - n;
    if (c == N)
    {
        dp[h] = 1;
        return(1);
    }
    int res = 0;
    for (int i = 0; i < n; i++) if (A[c][U[i]])
    {
        if (i < n - 1)
        {
            int tmp = U[i];
            U[i] = U[n - 1];
            n--;
            res = (res + solve()) % MD;
            U[i] = tmp;
            n++;
        }
        else
        {
            n--;
            res = (res + solve()) % MD;
            n++;
        }
    }
    dp[h] = res;
    return(res);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N;
    for (int i = 0; i < N; i++) P[i] = 1 << i;
    for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) cin >> A[i][j];
    for (int i = 0; i < N; i++) U[i] = i;
    n = N;
    int lim = 1 << N;
    for (int i = 0; i < lim; i++) dp[i] = -1;
    cout << solve() << '\n';
    return(0);
}

Measured memory_bytes: 8576
import java.util.*;
import java.io.*;
import java.lang.*;

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

        if (n%k == 0)
            System.out.println("0");
        else
            System.out.println("1");

    }
}


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

int main(){
	
	double a,b,x;
	cin >> a >> b >> x;
	
	double res = 0;
	if(x <= a*a*b/2.0){
		res = atan(a*b*b/(2.0*x));
	}
	else{
		res = atan(2.0*(a*a*b-x)/(a*a*a));
	}
	
	printf("%0.10f", res/M_PI*180);

	return 0;
}

Measured memory_bytes: 256
fun main() {
    val t = IntArray(10001)
    fun init() {
        for (x in 1..100) {
            for (y in 1..100) {
                for (z in 1..100) {
                    val i = x * x + y * y + z * z + x * y + y * z + x * z
                    if (i < t.size) t[i]++
                }
            }
        }
    }
    init()

    val n = readLine()!!.toInt()

    val ans = (1..n)
            .map { t[it] }
            .joinToString("\n")

    println(ans)
}


Measured memory_bytes: 37420
H,W = map(int,input().split())

def calc(a,b):
  res = 10**9
  for i in range(1,a-1):
    S1 = i*b
    S2 = (a-i)//2*b
    S3 = ((a-i)-((a-i)//2))*b
    res = min(res,max(S1,S2,S3)-min(S1,S2,S3))
  for i in range(1,a):
    S1 = i*b
    S2 = (a-i)*(b//2)
    S3 = (a-i)*(b-(b//2))
    res = min(res,max(S1,S2,S3)-min(S1,S2,S3))
  return res

print(min(calc(H,W),calc(W,H)))

Measured memory_bytes: 41200
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<int,int> P;
typedef unsigned long long int ull;
const int MOD=1e9+7;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const int INF=1e9;

int main(){
    int a;cin>>a;
    cout<<a+a*a+a*a*a<<endl;
}

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

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

    int L[M], R[M];
    int minL=0,maxR=N-1;
    for(int i = 0; i < M; i++) {
        cin >> L[i] >> R[i];
        L[i]--;
        R[i]--;

        minL = max(minL, L[i]);
        maxR = min(maxR, R[i]);
    }

    if(minL <= maxR){
        cout << maxR - minL + 1 << endl;
    }else{
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N;
    cin >> N;
    double T,A;cin >> T >> A;
    vector<double> H(N);
    rep(i,N)cin >> H[i];
    int res = 0;
    double diff = 1e9;
    rep(i,N){
        if(abs(A-(T-H[i]*0.006))<diff){
            res=i+1;
            diff = abs(A-(T-H[i]*0.006));
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
import static java.lang.System.in;
import static java.lang.System.out;
import static java.lang.Math.*;

import java.util.*;


public class Main {

	public static Scanner sc=new Scanner(in);

	public void run(){
		while(true){
			int n=sc.nextInt(),m=sc.nextInt(),l=sc.nextInt(),
					k=sc.nextInt(),s=sc.nextInt(),e=sc.nextInt();
			if(n==0)return;

			boolean[] ccity=new boolean[n];
			for(int i=0;i<l;i++){
				int v=sc.nextInt();
				ccity[v]=true;
			}
			ccity[s]=ccity[e]=true;

			long[][] d=new long[n][n];

			for(int i=0;i<n;i++){
				Arrays.fill(d[i],1<<30);
				d[i][i]=0;
			}
			for(int i=0;i<k;i++){
				int x=sc.nextInt(),y=sc.nextInt(),t=sc.nextInt();
				d[x][y]=d[y][x]=t;
			}
		    for(int _k=0;_k<n;_k++)
		    	for(int i=0;i<n;i++)for(int j=0;j<n;j++)
		    		d[i][j] = min(d[i][j], d[i][_k] + d[_k][j]);

		    for(int i=0;i<n;i++)for(int j=0;j<n;j++){
		    	if(d[i][j]>m || !ccity[i] || !ccity[j])d[i][j]=1<<30;
		    }

		    for(int _k=0;_k<n;_k++)
		    	for(int i=0;i<n;i++)for(int j=0;j<n;j++)
		    		d[i][j] = min(d[i][j], d[i][_k] + d[_k][j]);

			if(d[s][e]==1<<30)
				ln("Help!");
			else{
				ln(d[s][e]+max(0,d[s][e]-m));
			}
		}

	}

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

	//output lib
	public static void ln(){
		out.println();
	}
	public static void pr(Object obj){
		out.print(str(obj));
	}
	public static void ln(Object obj){
		pr(obj);ln();
	}
	public static String str(Object obj){
		return obj.toString();
	}
	public static <E> String str(E[] obj){
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<obj.length;i++){
			sb.append(i==0?"":" ").append(obj[i]);
		}
		return sb.toString();
	}
	public static <E> String str(List<E> obj){
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<obj.size();i++){
			sb.append(i==0?"":" ").append(obj.get(i));
		}
		return sb.toString();
	}


}

Measured memory_bytes: 64760
#include <iostream>
#include <vector>

#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

int main() {
  int n;
  cin >> n;
  int k;
  cin >> k;
  vector<int> x(n);
  rep(i, n) cin >> x.at(i);

  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int a = x.at(i) * 2;
    int b = abs(x.at(i) - k) * 2;

    a < b ? ans += a : ans += b;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

string sa;
int n,m,p;

int t[205];
char s[2005];
char sb[5]="RB";

int printt(){
	cout<<"? ";
	for(int i=0;i<n;i++){
		cout<<t[i]+1<<(i==n-1?'\n':' ');
	}
	cout<<flush;
	cin>>sa;
	if(sa[0]=='R')return 0;
	return 1;
}

int main(){
	int i,j,k;
	LL a,b,c,d;
	int be,af;
	cin>>n;
	for(i=0;i<n;i++){t[i]=i;}
	be=printt();
	int z[3]={0,n};
	while(z[1]-z[0]>1){
		z[2]=(z[0]+z[1])/2;
		for(i=0;i<n;i++){
			if(i<z[2])t[i]=i;
			else t[i]=n+i;
		}
		af=printt();
		if(be==af)z[1]=z[2];
		else z[0]=z[2];
	}
	z[0]++;
	z[1]=n-z[0];
	for(i=0;i<n;i++){
		if(i<z[0])t[i]=i;
		else t[i]=n+i;
	}
	for(i=0;i<2*n;i++){
		if(i<z[0] || i>=n+z[0])continue;
		t[z[0]-1]=i;
		af=printt();
		if(be==af)s[i]=sb[be];
		else s[i]=sb[1-be];
	}
	for(i=0;i<n;i++){
		t[i]=i+z[0];
	}
	for(i=0;i<2*n;i++){
		if(z[0]<=i && i<n+z[0])continue;
		t[n-1]=i;
		af=printt();
		if(be==af)s[i]=sb[be];
		else s[i]=sb[1-be];
	}
	s[2*n]='\0';
	cout<<"! "<<s<<endl;
}

Measured memory_bytes: 724
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
int mod=163577857;
inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int power(int a,int n,int m){if(n==0)return 1;int p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
vector<int>adj[100009];
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    int b[n+1],c[n+1];
    for(int i=1;i<=n;i++)
    {b[i]=i-a[i];c[i]=i+a[i];}
    map<int,int>mp;
    for(int i=1;i<=n;i++)
    {
        mp[b[i]]++;
    }
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
       if(b[i]!=c[i]&&mp.find(c[i])!=mp.end())
        cnt+=mp[c[i]];
       else if(b[i]==c[i]&&mp.find(c[i])!=mp.end())
        cnt+=mp[c[i]]-1;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 22256