akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;
  cin>>n;
  vector<int> w(n);
  rep(i,n) cin>>w[i];
  int sum =0;
  rep(i,n){
    sum+=w[i];
  }
  int a=0;
  int b=sum;
  int c=1000;
  rep(i,n){
    a=a+w[i];
    b-=w[i];
    c=min(c,abs(b-a));
  }
  cout<<c<<endl;
 
  
  return 0;
}

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

#define REP(i,n) for(long long i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(long long i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9



int main(){
  int A, B;
  cin >> A >> B;

  int K = A+B;

  if(K%2 == 0){
    cout << K/2 << endl;
  }
  else{
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

	public void execute() {
		Scanner sc = new Scanner(System.in);
		final int X = sc.nextInt();

		int pos = 0;
		int t = 0;
		while (true) {
			pos += t;
			if (pos >= X) {
				System.out.println(t);
				return;
			}
			t++;
		}
	}
}


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

int main(){
  string s;
  cin >> s;
  
  int A_first;
  int Z_last;
  
  for(int i=0; i<s.size(); i++){
    if(s.at(i) == 'A'){
      A_first = i+1;
      break;
    }
  }
  
  reverse(s.begin(), s.end());
  for(int i=0; i < s.size(); i++){
    if(s.at(i) == 'Z'){
      Z_last = s.size() - i;
      break;
    }
  }
  
  int size = Z_last - A_first + 1;
  
  cout << size << endl;
  
}


Measured memory_bytes: 3752
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
const int INF = 1<<28;
const ll MOD = 1000000007;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int n, m[20], dp[20][1<<13 + 1];

int dfs(int idx, int rem){
	int &res = dp[idx][rem];
	if(res != -1) return res;
	if(rem == 1) return res = 0;
 
	FOR(i, 1, m[idx]+1) {
		if(rem - i < 1)
			break;
		if(!dfs((idx + 1) % n, rem - i))
			return res = 1;
	}
	return res = 0;
}
 
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	while(cin >> n, n) {
		n += n;
		int s; cin >> s;
		REP(i, n)
			cin >> m[i];
		memset(dp, -1, sizeof(dp));
		cout << dfs(0, s) << endl;
		/*
		REP(i, n*2) {
			REP(j, s)
				cout << dp[i][j] << ' ';
			cout << endl;
		}
		*/
	}
	return 0;
}

Measured memory_bytes: 2736
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code ---*/

	n := nextInt()
	an := nextInts(n)
	// an := make([]int, n)
	// for i := 0; i < n; i++ {
	// 	fmt.Scan(&an[i])
	// }
	sort.Ints(an)

	len := 0
	left := 0
	right := 0
	for ; left < n; left++ {
		for ; right < n; right++ {
			lhs := an[left]
			rhs := an[right]
			diff := rhs - lhs
			if diff <= 2 {
				count := right - left + 1
				if len < count {
					len = count
				}
			} else {
				break
			}
		}
	}
	fmt.Fprintln(out, len)
}

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

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


Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
	int a[10],b[10];
	for (int c=0;c<10;c++)cin>>a[c];
	for (int c=0;c<10;c++)cin>>b[c];
	sort(a,a+10);
	sort(b,b+10);
	cout<<a[7]+a[8]+a[9]<<" "<<b[7]+b[8]+b[9]<<endl;
	return 0;
}

Measured memory_bytes: 3128
using System;
using System.Collections.Generic;
using System.Text;

namespace AtCoder.ABC159
{
    class A
    {
        static void Main(string[] args)
        {
            string value = Console.ReadLine();

            if (value[2].Equals(value[3]) && value[4].Equals(value[5]))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


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

int main() {
  string s;
  cin>>s;
  int ans=100000000;
  rep(i,s.size()-2){
    string t;
    t=s.substr(i,3);
    int u,dif;
    u=stoi(t);
    dif=abs(u-753);
    ans=min(ans,dif);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
#define MOD 10000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define revrep(i,n) for(ll i=n;i>0;i--)

typedef long long ll;

ll fac[100001], inv[100001];

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

ll mylcm(ll a, ll b) { return a / mygcd(a, b) * b; }

ll mymax(ll a, ll b) { return (a > b) ? a : b; }

ll mymin(ll a, ll b) { return (a < b) ? a : b; }

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

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

ll mypow(ll a, ll b) {
	ll x;
	if (b == 0) return 1;
	else if (b % 2 == 1) return a * mypow(a, b - 1) % MOD;
	x = mypow(a, b / 2);
	return x * x % MOD;
}

ll mycomb(ll a, ll b) {
	if (a < b || a < 0 || b < 0)return 0;
	return fac[a] * inv[a - b] * inv[b] % MOD;
}

int main() {
	ll n;
	scanf("%lld", &n);
	printf("%lld",8-(n-400)/200 );

	return 0;
}

Measured memory_bytes: 2156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define sz(x) (int)(x).size()

const int N = 550;
int a[N][N], n, m;

void solve() {
  vector<ii> p;
  for (int i = 0; i < n; i++) {
    if (i & 1) {
      for (int j = m - 1; j >= 0; j--) p.push_back({i, j});
    } else {
      for (int j = 0; j < m; j++) p.push_back({i, j});
    }
  }
  vector<ii> fr, to;
  for (int i = 0; i < sz(p) - 1; i++) {
    int t = a[p[i].first][p[i].second];
    if (t & 1) {
      fr.push_back(p[i]);
      to.push_back(p[i + 1]);
      a[p[i + 1].first][p[i + 1].second]++;
    }
  }
  printf("%d\n", sz(fr));
  for (int i = 0; i < sz(fr); i++) {
    printf("%d %d %d %d\n", fr[i].first + 1, fr[i].second + 1, to[i].first + 1, to[i].second + 1);
  }
}

int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      scanf("%d", &a[i][j]);
  solve();
}



Measured memory_bytes: 8432
h,w = map(int,input().split())
c = [[int(i) for i in input().split()] for _ in range(10)]
a = [[int(i) for i in input().split()] for _ in range(h)]

for k in range(10):
    for i in range(10):
        for j in range(10):
            c[i][j] = min(c[i][j],c[i][k]+c[k][j])

ans = 0
for i in range(h):
    for j in range(w):
        if abs(a[i][j]) != 1:
            ans += c[a[i][j]][1]

print(ans)

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

int main() {
    int H, W, D, tmp; cin >> H >> W >> D;
    vector<pair<int, int>> pos(H*W+1);
    rep(i, H)rep(j, W) {
        cin >> tmp;;
        pos[tmp] = make_pair(i, j);
    }
    vector<int> cost(H*W+1);
    for (int i = D+1; i <= H*W; i++) {
        cost[i] = cost[i-D] + abs(pos[i].first-pos[i-D].first) + abs(pos[i].second-pos[i-D].second);
    }
    int Q; cin >> Q;
    int L, R;
    rep(i, Q) {
        cin >> L >> R;
        cout << cost[R] - cost[L] << endl;
    }
}


Measured memory_bytes: 4240
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;
typedef long long ll;
const int maxN=1e5+5;

ll a[maxN],n,A,B;

bool check(ll x)
{
    ll k,sum=0;
    for(k=1;k<=n;k++)
    {
        if(a[k]-x*B<=0)continue;
        sum+=(a[k]-x*B)/(A-B);
        if((a[k]-x*B)%(A-B)!=0)sum++;
    }
    return sum<=x;
}

int main()
{
    ll k,l,r,mid;
    scanf("%lld%lld%lld",&n,&A,&B);
    for(k=1;k<=n;k++)
        scanf("%lld",&a[k]);
    l=1;r=1e9;
    while(r-l>5)
    {
        mid=(l+r)>>1;
        if(check(mid))r=mid;
        else l=mid;
    }
    for(;l<=r;l++)
        if(check(l))break;
    printf("%lld",l);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int x, y;
    cin >> x >> y;
    if ((x + y) % 3 != 0) {
        cout << 0 << endl;
        return 0;
    }

    int a = (2 * y - x) / 3;
    int b = (2 * x - y) / 3;

    COMinit();
    cout << COM(a + b, a) << endl;

    return 0;
}

Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n);i>0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+5  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
//ll const mod=998244353;
ll const mod=1e9+7;
const ll MAX=1000005;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvl =vector<vector<ll>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


//////////////////////////////////////
int main(){
    ll n;
    cin>>n;
    if(n%2==1){
        cout<<0<<endl;
        return 0;
    }
    ll tmp=n;
    ll fiv=1;
    ll ans=0;
    while(n/fiv>1){
        fiv*=5;
        ans+=(n/fiv)/2;
    }
    cout<<ans<<endl;
    
    return 0;
}

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

/*int main(){
    int n;cin >> n;
    if(n==0||n==1) {cout << 1 << endl;return 0;}
    vector<int> fb(n+1);
    fb[0] = 1;
    fb[1] = 1;
    for(int i=2;i<=n;i++){
        fb[i] = fb[i-1]+fb[i-2];
    }
    cout << fb[n] << endl;
    return 0;
}*/

int main(){
    int n;cin >> n;
    int a = 1;
    int b = 1;
    int c=0;
    if(n==1||n==0) {cout << 1 << endl;return 0;}
    for(int i=0;i<n-1;i++){
        c = a+b;
        a = b;
        b = c;
    }
    cout << c << endl;
}


Measured memory_bytes: 3124
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Reflection.Emit;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var r = int.Parse(spl[0]);
        var g = int.Parse(spl[1]);
        var b = int.Parse(spl[2]);
        var k = int.Parse(input.ReadLine());

        while(g <= r) {
            k--;
            g *= 2;
        }

        while(b <= g) {
            k--;
            b *= 2;
        }

        return k>=0 ? Yes : No;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        if (n == 0) return ret;
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 27428
def solve():
    n = int(input())
    x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 111, 222, 333, 444, 555, 666, 777, 888, 999]
    for i in range(len(x)):
        if n <= x[i]:
            print(x[i])
            exit()



if __name__ == '__main__':
    solve()


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

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

  vector<int64_t> Ndiv(N+1);
  for(int64_t div=1; div<=N; div++){
    for(int64_t num= div; num<=N; num+= div){
      Ndiv.at(num)++;
    }
  }
  
  int64_t ans= 0;
  for(int64_t num= 1; num<= N; num++){
    ans+= num* Ndiv.at(num);
  }
  cout << ans << endl;
}

Measured memory_bytes: 81384
#include <bits/stdc++.h>
#define simplify ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;

int ans[10005];

int32_t main() {

    simplify

    for(int x=1;x<=100;x++){
        for(int y=1;y<=100;y++){
            for(int z=1;z<=100;z++){
                int value=x*x+y*y+z*z+x*y+y*z+x*z;
                if(value>10000)break;
                ans[value]++;
            }
        }
    }

    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cout<<ans[i]<<endl;
    }


    




    return 0;
}



Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

bool equal(string s1,string s2){
    if(s1==s2)return true;
    return false;
}

bool close(string s1,string s2){
    bool in_db_quo=false;
    int index1=0;
    int index2=0;
    int times=0;//一致していない二重引用符
    int l_of_sen1=s1.length(),l_of_sen2=s2.length();

    while(true){
        if(!in_db_quo){
           if(s1[index1]=='"' && s2[index2]=='"')in_db_quo=true;
           if(!(s1[index1] == s2[index2]))return false;//different
        }
        else{
           int index1_s=index1,index2_s=index2;//二重引用符の中の始まりの添字
           bool end_quo1=false,end_quo2=false;//終わりの方の二重引用符にいるかを表す
           while(!end_quo1 || !end_quo2){
               if(!end_quo1){
                   if(s1[index1] == '"')end_quo1 = true;
                   if(!end_quo1)index1++;
               }
               if(!end_quo2){
                   if(s2[index2] == '"')end_quo2 = true;
                   if(!end_quo2)index2++;
               }
           }
           if(!(s1.substr(index1_s,index1-index1_s) == s2.substr(index2_s,index2-index2_s))){
               times++;
               if(times>=2)return false;//different
           }
           in_db_quo=false;
        }
        if(index1==l_of_sen1-1 || index2==l_of_sen2-1){
             if(index1==l_of_sen1-1 && index2==l_of_sen2-1)return true;
             else return false;
        }
        index1++;index2++;
    }
}
int main(){
    string s1,s2;
    while(true){
        cin>>s1;
        if(s1==".")break;
        cin>>s2;
        if(equal(s1,s2))cout<<"IDENTICAL"<<endl;
        else if(close(s1,s2))cout<<"CLOSE"<<endl;
        else cout<<"DIFFERENT"<<endl;
    }
}


Measured memory_bytes: 3212
import std.stdio;
import std.string;
import std.array; // split
import std.conv; // to
import std.math;
import std.algorithm;
void main()
{
    string n = chomp(readln());
    int N = to!int(n); // 第0要素を整数に変換
    string[] input = split(readln());
    int a = to!int(input[0]);
    int min = a,max = a;
    for(int i =1;i<N;i++){
        a = to!int(input[i]);
        if(min > a){
            min = a;
        }
        if(max < a){
            max = a;
        }
    }
    writeln(max - min);
}

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

using ll = long long;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];

    ll s = 0;
    for (int i = 0; i < n; i++)
        s ^= a[i];

    for (int i = 0; i < n; i++)
    {
        ll ans = s ^ a[i];
        cout << ans << endl;
    }
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int a;
    cin >> a;
    if(a==1) cout << "Hello World" << endl;
    else
    {
        int b,c;
        cin >> b >> c;
        cout << b+c << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int a[3010];
    rep(i, N) cin >> a[i];
    int ans = 0;
    rep(i, N) ans += a[i] - 1;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n=int(input())
l=[[] for i in range(n)]
for i in range(n):
  a=int(input())
  for j in range(a):
    x,y=map(int,input().split())
    l[i].append([x-1,y])
ans=0
for i in range(2**n):
  z=str(format(i,('0'+str(n)+'b')))
  f=1
  for k in range(n):
    if f:
      if int(z[k]):
        for m in l[k]:
          if z[m[0]]!=str(m[1]):
            f=0
  if f:            
    ans=max(ans,z.count('1'))    
print(ans)

Measured memory_bytes: 43228
#include<bits/stdc++.h>
#define mem(dp,a) memset(dp,a,sizeof(dp))
#define pb(x) push_back(x)
#define m_p(x,y) make_pair(x,y)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repush_back(i,a,b) for(ll i=a;i>=b;i--)
#define f(n) for(ll i=0;i<n;i++)
#define r(n) for(ll j=0;j<n;j++)
#define F first
#define S second
#define pi 3.14159265359
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
typedef long double ld;
ll ESP=1e18;
ll INF=1e9+7;

int main()
{
 hs;
 ll n;
 cin>>n;
 ll a[n];
 unordered_map<ll,ll>mp;
 f(n)
 {
  cin>>a[i];
  mp[a[i]]++;
 }
 ll sum=0;
 for(auto x:mp)
 {
  ll zz=(x.second*(x.second-1))/2;
  if(zz>0)
    sum+=zz;
 }
 for(ll i=0;i<n;i++)
 {
  ll zz=mp[a[i]];
  ll a1=(zz*(zz-1))/2;;
  ll a2=((zz-1)*(zz-2))/2;
  cout<<sum+a2-a1<<endl;
 }
 return 0;

}


Measured memory_bytes: 9160
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  ll a,b,c;
  cin >>a>>b >>c;
  ll d = c-a-b;
  if (d > 0 && 4*a*b < d*d) {
    cout << "Yes" << endl;
  }else cout << "No" << endl;
  return 0;
}

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

int n, m;
char grid[1005][1005];
int ans[1005][1005];
const int mod = 1e9 + 7;

int solve(int i, int j)
{
    if(i >= n || j >= m || grid[i][j] == '#')
        return 0;
    if(i == n - 1 && j == m - 1)
        return 1;
    int &ret = ans[i][j];
    if(~ret)
        return ret;
    ret = (solve(i + 1, j) + solve(i, j + 1)) % mod;
    return ret;
}

int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> m;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < m; j++)
            cin >> grid[i][j];
    memset(ans, -1, sizeof ans);
    cout << solve(0, 0);
    return 0;
}


Measured memory_bytes: 5248
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string>
using namespace std;

int main(){
    string s;
    cin >> s;

    if(s[6] > '4' || s[5] == '1'){
        cout << "TBD" << endl;
    }
    else if(s[6] < '4' && s[5] == '0'){
        cout << "Heisei" << endl;
    }
    else{
        cout << "Heisei" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int main(){
    ll N,M;
    cin>>N>>M;
    vector<ll> H(N+1);
    REP1(i,N)cin>>H[i];
    
    vector<ll> Hf(N+1,true);
    ll cnt=0;
    REP(i,M){
        ll A,B;
        cin>>A>>B;
        if(H[A]>H[B])Hf[B]=false;
        else if(H[A]<H[B]) Hf[A]=false;
        else{
            Hf[B]=false;Hf[A]=false;
        }
    }
    REP1(i,N){
        if(Hf[i])cnt++;
    }
    cout<<cnt;
    //ll t=N*M;
    //cout<<fixed<<setprecision(20)<<N*M<<endl;
    //cout<<fixed<<setprecision(0)<<floor(t);
    //N-=F;
    //cout<<N/(M+F);
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 4836
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(l,k):
        r = [0] * (l+1)
        r[1] = 1
        if l >= k:
            r[k] += 1
        for i in range(1,l):
            if i + 2 <= l:
                r[i+2] += r[i]
            if i + 1 + k <= l:
                r[i+1+k] += r[i]

        return sum(r)


    while 1:
        n,m = LI()
        if n == 0:
            break
        rr.append(f(n,m))
        break

    return '\n'.join(map(str, rr))


print(main())



Measured memory_bytes: 9032
#include<stdio.h>
#include<string.h>
int main()
{
    int n,i,j,f;
    char s[1000],t[]="Hoshino";
    scanf("%d\n",&n);
    while(n--)
    {
        gets(s);
        for(i=0;i<strlen(s);i++)
        {
            for(j=0,f=1;j<7;j++)
                if(t[j]!=s[i+j])
                {
                    f=0;
                    break;
                }
            if(f)
                s[i+6]='a';
        }
        puts(s);
    }
    return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
vector<int> vec[203];
int maxdep,flag,e[203][203], n, dep[203], vis[203];
 
void bfs(int x) {
    memset(vis, 0, sizeof(vis));
    memset(dep, 0, sizeof(dep));
    queue<int> q;
    q.push(x);
    dep[x] = 1;
    while(!q.empty()) {
        int u = q.front();
        q.pop();
        vis[u] = 1;
        for (int i = 0; i < vec[u].size(); i++) {
            int v = vec[u][i];
            //cout << u << " " << v << " " << vis[v] << " " << dep[v] <<" " << dep[u] << endl;
            if (vis[v]) continue;
            if (dep[v] == 0) {
                dep[v] = dep[u] + 1;
                maxdep = max(maxdep, dep[v]);
                q.push(v);
            }else if(dep[v] != dep[u] + 1) {
                flag = 1;
                return;
            }
        }
    }
}
int main() {
    //freopen("test.in","r",stdin);
    //freopen("test.out","w",stdout);
    cin >> n;
    string s;
    for (int i = 1; i <= n; i++) {
        cin >> s;
        for (int j = 0; j < n; j++) {
            if (s[j] == '1') {
                vec[i].push_back(j + 1);
                vec[j + 1].push_back(i);
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        bfs(i);
        if (flag) break;
    }
    if (flag) cout << -1 << endl;
    else
        cout << maxdep << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
struct card{
                char letter,value;
            };

void bubbleSort(struct card A[],int N){
    for(int i=0;i<N;i++){
        for(int j=N-1;j>i;j--){
            if(A[j].value < A[j-1].value){
                swap(A[j],A[j-1]);
            }
        }
    }
}
void selectionSort(struct card A[],int N){
    for(int i=0;i<N;i++){
        int minj=i;
        for(int j=i;j<N;j++){
            if(A[j].value < A[minj].value){
                minj=j;
            }
        }
        swap(A[minj],A[i]);
    }
}
void output(struct card A[],int N){
    for(int i=0;i<N;i++){
        if(i!=0)
        cout << " ";

        cout << A[i].letter << A[i].value;
    }
    cout << endl;
}
bool isstable(struct card C1[],struct card C2[], int N){
    for(int i=0;i<N;i++){
        if(C1[i].letter != C2[i].letter)
            return false;
    }
    return true;

}
int main() 
{
    int n;
    cin >> n;
    struct card C1[n+10],C2[n+10];
    rep(i,n){
        cin >> C1[i].letter >> C1[i].value;
        C2[i]=C1[i];
    }

    bubbleSort(C1,n);
    selectionSort(C2,n);

    output(C1,n);
        cout << "Stable" << endl;
    output(C2,n);
    if(isstable(C1,C2,n))
        cout << "Stable" << endl;
    else
    {
        cout << "Not stable" << endl;
    }

}


Measured memory_bytes: 3072
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	x, t := intScanner(), intScanner()
	fmt.Println(larger(0, x-t))
}


Measured memory_bytes: 1772
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
using namespace std;
typedef pair<int, int> pairII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
#define long long ll;
#define shig_for(i, a, b) for(int i = (a); i < (b); ++i)
#define shig_rep(i, n) shig_for(i, 0, n)
#define shig_forB(bit,a,b) for(int bit = (a); bit < (1<<(b)); ++bit)
#define shig_repB(bit,n) shig_forB(bit,0,n)
#define tmp int temp = 0
#define str string 

struct UnionFind {
    
    vector<int> r;

    UnionFind(int N) {
        r = vector<int>(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) {
        return -r[root(x)];
    }

    int host_size(int fir, int N) {
        tmp;
        for(int k = fir; k < N; k++){
            if(r[k] < 0){
                temp++;
            }
        }
        return temp;
    }

};


int main()
{

    int N ,M;
    cin >> N >> M;

    UnionFind UF(N);

    for (int i = 0; i < M; i++){
        int A, B;
        cin >> A >> B;
        A -= 1;
        B -= 1;
        UF.unite(A, B);
    }

    int ans = UF.host_size(0, N);
    ans--;
    cout << ans << endl;

    //cout << "Atcoder" << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;
#define MOD 1000000007
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

ll helper(int cur, int tgt, int n, vector<vector<int>> &pos) {
    if(cur >= n) return 0;
    if(tgt > n) return 0;
    ll res = n - cur;

    auto it = lower_bound(pos[tgt].begin(), pos[tgt].end(), cur);
    while(it != pos[tgt].end()) {
        res = min(res, *it - cur + helper(*it+1, tgt+1, n, pos));
        it++;
    }

    return res;
}

int main() {
    ll n;
    cin >> n;

    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];

    // check whether input array contains 1
    bool flg = true;
    for(int i=0; i<n; i++) if(a[i] == 1) flg = false;
    if(flg) {
        cout << -1 << endl;
        return 0;
    }

    vector<vector<int>> pos(n+1);
    for(int i=0; i<n; i++) pos[a[i]].push_back(i);

    ll ans = helper(0, 1, n, pos);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 27648
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main(int argc, char* argv[]) {
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i]=='7')
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

int main()
{
	int N,Q;
	cin>>N>>Q;
	vector<tuple<int,int,int>> event;

	for(int i=0; i<N; i++)
	{
		int s,t,x;
		cin>>s>>t>>x;
		event.emplace_back(s-x,1,x);
		event.emplace_back(t-x,0,x);
	}

	for(int i=0; i<Q; i++)
	{
		int D;
		cin>>D;
		event.emplace_back(D,2,i);
	}

	sort(event.begin(),event.end());

	set<int> sx;
	vector<int> ans(Q,-1);

	for(auto itr : event)
	{
		int type = get<1>(itr);
		int label = get<2>(itr);

		switch(type)
		{
			case 0:
				sx.erase(label);
				break;
			case 1:
				sx.insert(label);
				break;
			case 2:
				if(sx.size()>0)
				{
					ans[label] = *sx.begin();
				}
				break;
		}
	}

	for(int i=0; i<Q; i++)
	{
		cout<<ans[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 20200
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){
   
    int x;
	cin >> x;

	int a = x%100;
	int cnt = 0;
	for(int i = 5;i >= 1;i--){
		while(a>=i){
			cnt++;
			a -= i;
		}
	}
	if(x/100 >= cnt)cout << 1 << endl;
	else cout << 0 << endl;

	cerr << x << endl;
	cerr << a << endl;
	cerr << cnt << endl;


	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://ddcc2020-qual.contest.atcoder.jp/tasks/ddcc2020_qual_b
// rm -r -f test;oj dl https://sumitrust2019.contest.atcoder.jp/tasks/sumitb2019_b

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <climits>
#include <cmath>
#include <algorithm>
#include <set>

using namespace std;
#define ll long long int
#define MAX 1000001
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define VV vector
#define pb push_back
#define bitc __builtin_popcountl
#define mp make_pair
#define inf 200000000000000l
#define swap(a, b) { a = a ^ b; b = a ^ b; a = a ^ b; }
#define rep(i, n) for (ll i = 0, _n = (n); i < _n; i++)
#define debug(x) cout << #x << ": " << x << endl;
#define fr(i, a, b) for (ll i = (a), _b = (b); i <= _b; i++)

ll arr[MAX];



int main()
{
  fast
  ll n,m,k;
  cin>>n>>m>>k;
  ll ans=n*m;
  ll ky;
  if(ans<k) ky=ans;
  else ky=k;
  cout<<ky<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


vector<int>TopologicalSort(int n, vector<int>in, vector<int>e[]) {
	stack<int>st;
	for (int i = 0; i < n; i++)if (!in[i])st.push(i);
	vector<int>ret;
	while (st.size()) {
		int i = st.top();
		st.pop();
		ret.pb(i);
		fore(x, e[i]) {
			in[x]--;
			if (!in[x])st.push(x);
		}
	}
	return ret;
}

struct RollingHash {
	vector<ll>hash;
	vector<ll>base_pow;
	ll base, mod;
	const ll DEFAULT_BASE = 1009, DEFAULT_MOD = 1e9 + 7;
	RollingHash(string S = "", ll base_ = -1, ll mod_ = -1) {
		base = (base_ > 0) ? base_ : DEFAULT_BASE;
		mod = (mod_ > 0) ? mod_ : DEFAULT_MOD;
		if (S.size() > 0)initialize(S);
	}
	void initialize(string& S) {
		int N = S.size();
		vector<int>s(N);
		for (int i = 0; i < N; i++)s[i] = S[i];
		initialize2(s);
	}

	void initialize2(vector<int>& S) {
		hash.resize(S.size() + 1);
		base_pow.resize(S.size() + 1);
		hash[0] = 0;
		base_pow[0] = 1;
		for (int i = 1; i <= S.size(); i++) {
			hash[i] = (hash[i - 1]*base + S[i-1]) % mod;
			base_pow[i] = base_pow[i - 1] * base % mod;
		}
	}

	//[a,b)
	ll between(int a,int b) {
		return (mod + hash[b] - hash[a] * base_pow[b - a] % mod)%mod;
	}
};

int dp[1010101];

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

	string S, T;
	cin >> S >> T;
	string temp = S;
	while (S.size() < T.size())S += temp;

	RollingHash rhs1(S+S, 1007, 1e9 + 7),rhs2(S+S, 2009, 1e9 + 9);
	RollingHash rht1(T, 1007, 1e9 + 7),rht2(T, 2009, 1e9 + 9);


	vector<int>in(S.size());
	vector<int>e[1010101];
	for (int left = 0; left < S.size(); left++) {
		pair<ll,ll>p1 = {rhs1.between(left,left + T.size()),rhs2.between(left,left + T.size()) };
		pair<ll,ll>p2= {rht1.between(0,T.size()),rht2.between(0,T.size())};
		if (p1 == p2) {
			in[(left + T.size()) % S.size()]++;
			e[left].pb((left+T.size())%S.size());
		}
	}
	vector<int>ord = TopologicalSort(S.size(),in,e);

	if (ord.size() != S.size()) {
		puts(-1);
		return 0;
	}

	int ans = 0;
	for (int i = 0; i < S.size() - 1; i++) {
		int cur = ord[i];
		fore(to, e[cur]) {
			dp[to] = max(dp[cur] + 1, dp[to]);
			ans = max(dp[to], ans);
		}
	}
	puts(ans);

	return 0;
}

Measured memory_bytes: 143088
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <sstream>
#include <vector>
#include <string>
#include <iomanip>
#include <bitset>
using namespace std;
#define INF	100000000
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define SS stringstream
#define rep(i,n) for(int i = 0; i < n; i++)
#define sz(x) ((int)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).begin(), (x).end(), greater<int>() )
#define clr(a,b) memset((a),(b),sizeof(a))
typedef pair<int, int> P;
typedef long long int ll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<P> Vp;
typedef priority_queue<P, vector<P>, greater<P> > PQ;

int n,a,b,A,B;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	while(cin >> n){
		if(n == 0) break;
		a = 0; b = 0;
		rep(i,n){
			cin >> A >> B;
			if(A > B) a += A+B;
			else if(A < B) b += A+B;
			else{
				a += A;
				b += B;
			}
		}
		cout << a << " " << b << endl;
	}
}

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

int main(){
    string S; cin>>S;
    string ans = "AC";
    int n = S.size();
    for(int i=0; i<n; ++i){
      if(S.at(0)!='A'){
        ans = "WA";
      }
    }
    int cnt = 0;
    for(int i=1; i<n; ++i){
      if(isupper(S.at(i))){
        if(i==1||i==n-1||S.at(i)!='C'){
          ans="WA";
        }
      ++cnt;
      }
    }
    if(cnt!=1){
      ans="WA";
    }
      cout << ans << endl;
    
}

Measured memory_bytes: 256
/**
 *     author: qodjf
 *     created: 04.28.2020 01:35:08
 */
#include <bits/stdc++.h>
using namespace std;

string to_string(string s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) 42
#endif

#define mst(x, a) memset(x, a, sizeof(x))

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr ll LLINF = 0x3f3f3f3f3f3f3f3f;
constexpr ll MOD = 1e9 + 7;

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

int N, A, B;
vector<ll> v;

const int MAXN = 51;
ll C[MAXN][MAXN];

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

  cin >> N >> A >> B;
  v.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());

  mst(C, 0);
  C[0][0] = 1;
  for (int i = 1; i < MAXN; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
    }
  }

  ll sum = 0;
  for (int i = 0; i < A; i++) {
    sum += v[i];
  }
  printf("%.6lf\n", sum * 1.0 / A);

  int cnt = 0, cOthers = 0;
  for (int i = 0; i < N; i++) {
    if (v[i] > v[A - 1]) {
      cOthers++;
    } else if (v[i] == v[A - 1]) {
      cnt++;
    }
  }

  ll choose = 0;
  if (sum == v[A - 1] * A) {
    for (int all = A; all <= min(cOthers + cnt, B); all++) {
      choose += C[cnt][all - cOthers];
    }
  } else {
    choose = C[cnt][A - cOthers];
  }
  printf("%lld\n", choose);
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
#include<numeric>
#include<stack>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1LL<<60;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  string S;
  cin >> S;
  for(int i=0; i<S.size(); i++){
    cout << "x";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N = int(input())
res = N%1000
if res==0:
    print(0)
else:
    print(1000-N%1000)


Measured memory_bytes: 65520
while true
    n,x=gets.split.map(&:to_i)
    exit if n==0 && x==0
    cnt=0
    1.upto(n-2) do |i|
        (i+1).upto(n-1) do |j|
            (j+1).upto(n) do |k|
                cnt+=1 if(i+j+k==x)
            end
        end
    end
    puts cnt
end


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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N; cin>>N;
	bool odd=false;
	for (int i=0; i<N; i++) {
		int a; cin>>a;
		if(a%2) odd=true;
	}
	cout<<(odd?"first":"second")<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
int A,B;
char ans[100][100+8];
int h;
bool sf;
void show(){
	cout<<h<<" "<<100<<endl;
	if (sf){
		REP(i,h){
			REP(j,100){
				if (ans[i][j]=='.'){
					ans[i][j]='#';
				}else{
					ans[i][j]='.';
				}
			}
		}
	}
	REP(i,h){
		cout<<ans[i]<<endl;
	}
}
int main(){
	cin>>A>>B;
	if (A>B){
		swap(A,B);
		sf=true;
	}
	{
		int b=B-A+1;
		REP(i,(b+49)/50*2){
			REP(j,100){
				ans[i][j]='.';
			}
		}
		REP(i,b){
			ans[i/50*2][(i%50)*2]='#';
		}
		h=(b+49)/50*2;
		A--;
	}
	if(A==0){
		show();
	}else{
		REP(i,25){
			if (i<A){
				ans[h][i*4]='.';
				REP(j,3){
					ans[h][i*4+j+1]='#';
				}
				REP(j,2){
					ans[h+1][i*4+j*2]='.';
					ans[h+1][i*4+j*2+1]='#';
				}
			}else{
				REP(j,2)REP(k,4){
					ans[h+j][i*4+k]='.';
				}
			}
		}
		A-=min(A,25);
		h+=2;
		if(A==0){
			show();
		}else{
			bool f=true;
			while(A){
				REP(i,50){
					if (i<A){
						if (f){
							ans[h][i*2]='#';
							ans[h][i*2+1]='.';
						}else{
							ans[h][i*2]='.';
							ans[h][i*2+1]='#';
						}
					}else{
						if (f){
							ans[h][i*2]='#';
						}else{
							ans[h][i*2]='.';
						}
						FOR(j,i*2+1,100){
							if (f){
								ans[h][j]='#';
							}else{
								ans[h][j]='.';
							}
							f=!f;
						}
						break;
					}
				}
				A-=min(A,50);
				h++;
				f=!f;
			}
			show();
		}
	}							
	return 0;
}

Measured memory_bytes: 256
from math import factorial as f
n,k=map(int,input().split())
mod=10**9+7
for i in range(1,k+1):
    if i>n-k+1:
        print(0)
    else:
        a= f(k-1)  // (f(i-1) * f(k-i))  %mod
        b= f(n-k+1)// (f(i) * f(n-k-i+1))%mod
        print( a*b %mod )

Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

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


    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        sc.close();

        long sum = 0;
        for(int i=1; i<= N; i++){
            if(i % 3 == 0){
            }
            else if(i % 5 == 0){
            }
            else if(i % 15 == 0){
            }
            else {
                sum = sum + i;
            }
        }

        System.out.println(sum);


    }
}    



Measured memory_bytes: 35820
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        string s = Console.ReadLine();
        var b = s.Substring(0, (s.Length - 1) / 2);
        var c = s.Substring((s.Length + 1) / 2);
        Console.WriteLine(IsPalindrome(s) && IsPalindrome(b) && IsPalindrome(c) ? "Yes" : "No");
    }
    static bool IsPalindrome(string s) => s.Zip(s.Reverse(), (x, y) => x == y).All(x => x);
}


Measured memory_bytes: 13268