akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(){
 
  int a,b,i,d;
 
  while(1){
  scanf("%d %d",&a,&b);
if(a==0 && b==0)break;
 
  for(i=0;i<a;i++){

    for(d=0;d<b;d++)
{
    printf("#");
  } 
  printf("\n");
 
  
  }
  printf("\n");
  }
  
 
  return 0;
  }



Measured memory_bytes: 2112
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>

using namespace std;

#define ll long long
#define el '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repi(i, a, b) for (int i = a; i >= b; i--)
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define mp make_pair
#ifdef LOCAL
#define debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
#define check(...) assert(__VA_ARGS__)
#else
#define debug(fmt, ...)
#define check(...)
#endif

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

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


Measured memory_bytes: 3128
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define ls st<<1
#define rs st<<1|1
#define LL long long
#define CLR(a,b) memset(a,(b),sizeof(a))

const int MAXN = 1e5+11;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const LL INFLL = (1LL<<60);

/*-------------------------------------------------------*/

int x[MAXN], y[MAXN], t[MAXN];
int main() {
    string s;
    cin >> s;
    int k = 0;
    for(int i = 1; i <s.size(); i++) {
        if(s[i]!=s[i-1]) k++;
    }
    cout << k << endl;
return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<cmath>
#include<cctype>
#include<ctime>
#define pi acos(-1.0)
using namespace std;
int main()
{
	char str[15];
	char str1[15];
	int n=0;
	scanf("%s",str);
	for(int i=0;i<strlen(str);i++)
	{
		if(str[i]=='0') str1[n++]='0';
		else if(str[i]=='1') str1[n++]='1';
		else if(str[i]=='B') 
		{
			if(n>0) str1[--n]='\0';
		}
	}
	for(int i=0;i<n;i++)
		printf("%c",str1[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    long long int N;
    bool YYMM = true;
    bool MMYY = true;
    cin>>N;
    if(N%100>12||N%100==0) YYMM = false;
    if((N-(N%100))/100>12||(N-(N%100))/100==0) MMYY = false;
    string ans;
    if(YYMM){
        if(MMYY){
            ans = "AMBIGUOUS";
        } else {
            ans = "YYMM";
        }
    } else {
        if(MMYY){
            ans = "MMYY";
        } else {
            ans = "NA";
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
/* Coached by Dukkha */
#include <stdio.h>

int main() {
	long long n, a, b, c, d, e, x;

	scanf("%lld%lld%lld%lld%lld%lld", &n, &a, &b, &c, &d, &e);
	x = a;
	if (x > b)
		x = b;
	if (x > c)
		x = c;
	if (x > d)
		x = d;
	if (x > e)
		x = e;
	printf("%lld\n", (n + x - 1) / x - 1 + 5);
	return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<P> p;
  rep(i, n){
    int a, b;
    cin >> a >> b;
    p.push_back(P(b, a));
  }
  sort(p.begin(), p.end());
  int s = 0;
  bool can = true;
  rep(i, n){
    s += p[i].second;
    if(s > p[i].first) can = false;
  }
  cout << (can? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 2548
from collections import deque

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

history = deque()
score = 0

def bestChoiceTo(op):
    if op == 'r':
        return 'p'
    if op == 's':
        return 'r'
    if op == 'p':
        return 's'

for i, op in enumerate(t):
    bestChoice = bestChoiceTo(op)
    futureBestChoice = '' if i + k >= n else bestChoiceTo(t[i + k])
    prohibitedChoice = '' if i < k else history.popleft()
    if bestChoice != prohibitedChoice:
        choice = bestChoice
        if choice == 'r': score += r
        if choice == 's': score += s
        if choice == 'p': score += p
    else:
        if futureBestChoice == prohibitedChoice:
            choice = 'x'
        else:
            choices = ['r', 's', 'p']
            if prohibitedChoice != '':
                choices.remove(prohibitedChoice)
            if futureBestChoice != '':
                choices.remove(futureBestChoice)
            choice = choices[0]
    history.append(choice)

print(score)

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

using namespace std;
typedef pair<int, int> P;

void solve()
{
	int N, x;
	cin >> N >> x;
	vector<int> a(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int ans = 0;
	for (int i = 0; i < N; ++i)
	{
		if (x >= a[i])
		{
			++ans;
			x -= a[i];
		}
	}
	if (ans < N)
	{
		cout << ans << endl;
	}
	else
	{
		if (x == 0)
		{
			cout << ans << endl;
		}
		else
		{
			cout << ans - 1 << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int n,m,i,x,y;
	int a[110];
	cin>>n>>m;
	memset(a,0,sizeof(a));
	for(i=0;i<m;i++)
	{
		cin>>x>>y;
		a[x]++;
		a[y]++;
	}
	for(i=1;i<=n;i++)
	  cout<<a[i]<<endl;
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  int A[N];
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  sort(A, A + N, greater<int>());
  
  cout << A[0] - A[N-1] << endl;
}


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

int main()
{
	int n, ans = 1;
	cin >> n;

	for (int i = 2; i < n; i++) {
		int tmp = i, cnt = 0, j = 1; 
		for (j = 1; j * j < tmp; j++) {
			if (tmp % j == 0) {
				cnt+=2;
			}
		}
		if (j * j == tmp) {
			cnt++;
		}
		ans += cnt;
	}

	cout << ans;
	return 0;
}

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

int main()
{
    int n;
    std::cin >> n;

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

    std::vector<int> sorted = a;
    std::sort(sorted.begin(), sorted.end(), std::greater<int>());
    int max = sorted[0], second_max = sorted[1];

    for (auto c : a) {
        std::cout << (c == max ? second_max : max) << std::endl;
    }
}


Measured memory_bytes: 3200
Imports System.Collections.Generic
Imports System.Console
Imports System.Math

Module Program
    Sub Main()
        Dim A As Long = NextLong()
        Dim B As Long = NextLong()
        Dim C As Long = NextLong()

        Dim S As Long = Min(A, Min(B, C))
        Dim L As Long = Max(A, Max(B, C))
        Dim M As Long = A + B + C - S - L

        Dim ans As Long = (L Mod 2) * S * M
        WriteLine(ans)
    End Sub

    Function NextLong() As Long
        Return CLng(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
vector<ll_ll> prime_factor(ll n);

int main(int argc, char* argv[]) {
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  set<ll> s;

  ll g = gcd(A, B);
  auto v = prime_factor(g);
  put(sz(v) + 1);
  return 0;
}

vector<ll_ll> prime_factor(ll n) {
  vector<ll_ll> 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;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
int n, a[N], flag, f[N], last[5];
char s[N];
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
int main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	scanf("%s", s + 1); n = strlen(s + 1);
	for(int i = 1; i <= n; i ++) if(s[i] == s[i - 1]) flag = 1;
	if(!flag) {puts("1"); return 0;}
	for(int i = 1; i <= n; i ++) a[i] = (a[i - 1] + s[i] - 'a' + 1) % 3;
	for(int i = 1; i <= n; i ++)
	{
		f[i] = ((f[last[0]] + f[last[1]] + f[last[2]] - f[last[a[i]]] + (a[i] >= 1)) % mod + mod) % mod;
		last[a[i]] = i;
	}
	printf("%d\n", f[n]);
	fclose(stdin);
	fclose(stdout);
	return 0;
}


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

#include <iostream>
#include <fstream>

#include <iostream>
#include "bits/stdc++.h"

using namespace std;
typedef unsigned long long ll;
typedef int                     integer;
#define int                     long long
#define ii                      pair<int,int>
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define f(a,b,c)                for(int a=b;a<c;a++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<x<<endl
#define p2(x,y)                 out<<x<<' '<<y<<endl
#define p3(x,y,z)               out<<x<<' '<<y<<' '<<z<<endl
#define p4(x,y,z,w)             out<<x<<' '<<y<<' '<<z<<' '<<w<<endl
#define pl(x)                   out<<x
#define pll(x)                  out<<x<<' '
#define range(v)                v.begin(),v.end()
#define rst(x)                  memset(x, -1, sizeof(x))
#define UNVISITED               -1
#define VISITED                 0
#define EXPLORED                2

#define EACH(x, a) for (auto& x: a)
template<class T> void read_v(T& x, std::istream& in) {
    in >> (x);
}
template<class A> void read_vec(vector<A>& x, std::istream& in) {
    EACH(a, x)
        read_v(a, in);
}

bool sortpairbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
template <typename T>
T factmod(T a, T modulus){ int res = 1, i; for (i = 2; i <= a; i++){ res *= i; res%=modulus;} return res; }
template <typename T>
int powmod(T a,T b,int m){ int ans=1; while(b>0){if(b&1){ans*=a;ans%=m;}a*=a;a%=m;b>>=1;} return ans; }
template <typename T>
int power(T a, T b){ int ans=1; while(b>0){if(b&1){ans*=a;}a*=a;b>>=1;}return ans;}

struct UnionFind {
    vector<int> d;
    UnionFind(int n=0): d(n,-1) {}
    int find(int x) {
        if (d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return false;
        if (d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y) { return find(x) == find(y);}
    int size(int x) { return -d[find(x)];}
};

void ssolve(std::istream& in, std::ostream& out){
    int n, m; s2(n, m);
    vector<vector<int>> edges(n + 1);
    UnionFind uf(n + 1);
    int ans = 0;
    f(i, 0, m){
        int a, b; s2(a, b);
        uf.unite(a, b);
    }
    f(i, 0, n){
        ans = max(ans, uf.size(i + 1));
    }
    p(ans);
}

class DFriends {
public:
void solve(std::istream& in, std::ostream& out) {
    ios_base::sync_with_stdio(false);
    in.tie(nullptr);out.tie(nullptr);
    int t;
    int READ = 0;
    if(READ) s(t);
    else t = 1;
    while(t--){
        ssolve(in, out);
    }
}
};

integer main() {
    DFriends solver;
    std::istream& in(std::cin);
     std::ostream& out(std::cout);
     solver.solve(in, out);
}

Measured memory_bytes: 9492
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

constexpr ll mod = 1000000007;
constexpr ll modsize = 2000;
vector<ll> fac(modsize);
vector<ll> inv(modsize);
vector<ll> facinv(modsize);

void modcalc() {
	if (modsize == 0) abort();
	fac[0] = 1; fac[1] = 1; inv[1] = 1;
	facinv[0] = 1; facinv[1] = 1;
	for (ll i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modinv(ll a) {
	if (a == 0) abort();
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0 || n == 0 && k > 0) return 0;
	if (n == 0 && k == 0) return 1;
	return fac[n + k - 1] * facinv[k] % mod * facinv[n - 1] % mod;
}

ll dp[1010][1010];

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	
	modcalc();
	ll n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	dp[0][a] = 1;
	for (int j = a; j <= b; j++) {
		rep(i, n + 1) {
			dp[i][j + 1] += dp[i][j];
			if (dp[i][j + 1] > mod) dp[i][j + 1] -= mod;
			int st = i;
			for (int k = c; k <= d; k++) {
				if (i + j * k > n) break;
				dp[i + j * k][j + 1] += dp[i][j] * fac[n - i] % mod * modpow(facinv[j], k) % mod * facinv[n - i - j * k] % mod * facinv[k] % mod;
				if (dp[i + j * k][j + 1] > mod) dp[i + j * k][j + 1] -= mod;
			}
		}
	}
	cout << dp[n][b + 1] << endl;
}

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

int n;

int main(){
  cin >> n;
  vector<int> p(n), q(n), seq(n);
  rep(i, n) cin >> p[i];
  rep(i, n) cin >> q[i];
  rep(i, n) seq[i] = i + 1;
  int cnt = 0, res = 0;
  do{
    if(p == seq){
      res += cnt;
    }
    if(q == seq){
      res -= cnt;
    }
    cnt++;
  }while(next_permutation(seq.begin(), seq.end()));
  res = abs(res);
  cout << res << endl;
  return 0;
}

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

using namespace std;

#define OnlineJudge1

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
#define debug(x) cerr << #x << " = " << (x) << '\n'
const long double PI = 3.141592653589793238L;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

void init(){
    cin.tie(0);
    ios::sync_with_stdio(0);
#ifdef OnlineJudge
    freopen("input.in","r",stdin);
    freopen("output.in","w",stdout);
#endif
}

const int N = 1e4 + 9, M = 105, OO = 0x3f3f3f3f;
const ll llOO = 1e18;


int main(){
    init();

    string s;   cin >> s;
    for(int i = 0;i < s.size();i++) cout << 'x';

}




Measured memory_bytes: 256
s=[]
while True:
    m,f,r = map(int, input().split())
    if m==-1 and f==-1 and r==-1:
        break

    if m==-1 or f==-1:
        s.append('F')
        continue
    elif m+f>=80:
        s.append('A')
        continue
    elif m+f>=65 and m+f<80:
        s.append('B')
        continue
    elif m+f>=50 and m+f<65:
        s.append('C')
        continue
    elif m+f>=30 and m+f<50:
        if r>=50:
            s.append('C')
        else:
            s.append('D')
        continue
    elif m+f<30:
        s.append('F')

for i in range(len(s)):
    print(s[i])




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

ll f0(ll n) {
    if (n % 2 == 0) {
        if (n % 4 == 0) return n;
        else return n ^ 1;
    } else {
        return ((n + 1) / 2) % 2;
    }
}

int main() {
  ll a,b,ans;
  cin >> a >> b;
  if(a == 0) cout << f0(b) << endl;
  else cout << (f0(a-1)^f0(b)) << endl;
}


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

int main()
{
    int n,k;
    cin >> n >> k;
    double ans=0;
    for(int i=1;i<=n;i++)
    {
        int x=i;
        double num=1.0/n*1.0;
        while(x<k)
        {
            num*=0.5;
            x*=2;
        }
        ans+=num;
    }
    printf("%0.12f",ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

int main() {
    int n, d, a[10][10] = { {} }, p = 0;
    cin >> n >> d;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < i; j++) {
            int m = 0;
            for (int k = 0; k < d; k++) {
                m += (a[i][k] - a[j][k])* (a[i][k] - a[j][k]);
            }
            double x = sqrt(1. * m);
            int y = sqrt(m);
            if (x == 1. * y) p++;
        }
    }
    cout << p << endl;
}
    

Measured memory_bytes: 256
N = input()
for i in range(N):
  s = raw_input()
  p, r, l, a= 50, 50, 50, [s[0]]
  for c in s:
    if c == '-':
      pass
    elif c == '>':
      p += 1
    elif c == '<':
      p -= 1
    else:
      if p > r:
        a.append(c)
        r = p
      elif p < l:
        a.insert(0, c)
        l = p
  print(''.join(a))

Measured memory_bytes: 4228
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;

int prime[200001] = {};

int main(){
    int i, j, x;
    cin >> x;
    prime[1] = 1;
    for(i=1; i<=200000; i++){
        if(prime[i] == 1) continue;
        else{
            for(j=2; j*i<=200000; j++){
                prime[j*i] = 1;
            }
        }
    }
    for(i=x; i<=200000; i++){
        if(prime[i] == 0){
            cout << i << "\n";
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 1024
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;

int gcd(int x, int y){
	return y ? gcd(y, x%y) : x;
}
void Main()
{
	int N, K;
  	cin >> N >> K;
  	vector<int> A(N);
  	rep(i,N) cin >> A[i];
  
  	sort(A.begin(), A.end());
  	int gd = 0;
	if(K > A[N-1]) {
      puts("IMPOSSIBLE");
    }
  	else {
      	rep(i,N) gd = gcd(gd, A[i]);
  		if((A[N-1]-K) % gd == 0) puts("POSSIBLE");
  		else puts("IMPOSSIBLE");
    }
	return;
}

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

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
#define rep(i,n) for (int i=0; i<(n); i++)
#define reps(i,s,n) for (int i=(s); i<(n); i++)
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define repr(i,s,n) for (int i=(s)-1; i>=(n); i--)
#define print(a) cout << (a) << endl
#define all(v) v.begin(), v.end()
#define rsort(v) sort(v.rbegin(), v.rend())


int main() {
  string S;
  cin >> S;
  S += 'S';
  int ans = 0,cnt = 0;
  rep(i,4) {
    if (S[i] == 'R')
      cnt++;
    else {
      ans = max(ans,cnt);
      cnt = 0;
    }
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 3536
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m,p,q,r,as[1234][1234];
int main()
{
	scanf("%d%d%d%d",&n,&m,&p,&q);
	for(int i=1;i<=q;i++)
	for(int j=1;j<=p;j++)as[i][j]=1;
	for(int i=q+1;i<=q*2;i++)
	for(int j=p+1;j<=m;j++)as[i][j]=1;
	for(int i=q*2+1;i<=n;i++)for(int j=1;j<=p;j++)as[i][j]=1;
	for(int i=1;i<=n;i++,printf("\n"))
	for(int j=1;j<=m;j++)printf("%d",as[i][j]);
}

Measured memory_bytes: 6016
#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <ctype.h>  /*文字操作*/

#define BUFSIZE 256   /*読み取れる単語の最大文字数*/
#define NOT_FOUND 0   /*単語が二分探索木に存在していない状態*/
#define FOUND     1   /*単語が二分探索木に存在する状態*/
#define YES       0   /*走査を続ける状態*/
#define NO        1   /*走査をやめる状態*/

int flag      = NOT_FOUND; /*単語が存在するか否かを示す変数*/
long Word_sum = 0;         /*単語の総数*/

/*二分探索木を作る構造体*/
struct Word_Tree{
  char word[BUFSIZE];       /*単語を格納する配列*/
  struct Word_Tree *left;   /*左の子を指すポインタ*/
  struct Word_Tree *right;  /*右の子を指すポインタ*/
};

struct Word_Tree *root = NULL;  /*二分探索木の根*/

/*単語の二分探索木を作成する関数*/
struct Word_Tree MakeTree(char *buf, int *count);

/*二分探索木で使用した領域を解放する関数*/
int Free(struct Word_Tree *pointer);

int main(void)
{
  int n;
  int count = 0;
    char buf[BUFSIZE]  = {}; 	/*読み取った単語*/
    struct Word_Tree *print;  /*出力時に用いるポインタ*/

    /*読み込み部*/
    scanf(" %d", &n);

    /*処理部*/
    /*二分探索木の作成*/
    for (size_t i = 0; i < n; i++) {
      scanf(" %s", &buf);
      MakeTree(buf,&count);
    }
    printf("%d\n", count);

    Free(root);
    return 0;
}

/*単語の二分探索木を作成する関数*/
struct Word_Tree MakeTree(char *buf/*読み込んだ文字*/,int *count)
{
  struct Word_Tree *pointer;  /*作業用ポインタ*/
  struct Word_Tree *parent;   /*pointerの親を指すポインタ*/
	int n = strlen(buf);

          /*二分探索木が作成されてないとき*/
          if(root == NULL){
            root = (struct Word_Tree *)malloc( sizeof(struct Word_Tree));
            strcpy(root->word,buf);
            root->left  = NULL;
            root->right = NULL;
            *count = *count +1;
          }
          /*探索木を更新するとき*/
          else{
            pointer = root;
            parent  = pointer;
            while(1){
              if(pointer == NULL){
                pointer = (struct Word_Tree *)malloc( sizeof(struct Word_Tree));
                if (strcasecmp(parent->word, buf) > 0 ) {
                  parent->left  = pointer;
                }
                else{
                  parent->right = pointer;
                }
                strcpy(pointer->word,buf);
                pointer->left  = NULL;
                pointer->right = NULL;
                *count = *count +1;
                break;
              }
              if (strcasecmp(pointer->word, buf) == 0) {
                break;
              }else if(strcasecmp(pointer->word, buf) > 0){
                parent  = pointer;
                pointer = pointer->left;
              }else{
                parent  = pointer;
                pointer = pointer->right;
              }
            }
          }
}


/*二分探索木で使用した領域を解放する関数*/
int Free(struct Word_Tree *pointer)
{
  if (pointer == NULL) {return 0;}
  Free(pointer->left);
  Free(pointer->right);
  free(pointer);
}


Measured memory_bytes: 57980
import math
n = int(raw_input())
 
p1_x = float(0)
p1_y = float(0)
p2_x = float(100)
p2_y = float(0)
 
def KC(i, n, x1, y1, x2, y2):
    v = [0] * 5
    w = [0] * 5
    if i < n:
        v[0] = x1
        w[0] = y1
        v[1] = (2 * x1 + x2) / 3.0
        w[1] = (2 * y1 + y2) / 3.0
        v[2] = (x1 + 2 * x2) / 3.0
        w[2] = (y1 + 2 * y2) / 3.0
        v[3] = (v[2] - v[1]) * math.cos(math.pi/3) - (w[2] - w[1]) * math.sin(math.pi/3) + v[1]
        w[3] = (w[2] - w[1]) * math.cos(math.pi/3) + (v[2] - v[1]) * math.sin(math.pi/3) + w[1]
        v[4] = x2
        w[4] = y2
        KC(i+1, n, v[0], w[0], v[1], w[1])
        print v[1], w[1]
        KC(i+1, n, v[1], w[1], v[3], w[3])
        print v[3], w[3]
        KC(i+1, n, v[3], w[3], v[2], w[2])
        print v[2], w[2]
        KC(i+1, n, v[2], w[2], v[4], w[4])
 
print p1_x, p1_y
KC(0, n, p1_x, p1_y, p2_x, p2_y)
print p2_x, p2_y

Measured memory_bytes: 6576
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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

    vector<int> d;
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        d.push_back(tmp);
    }

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

    cout << d[N/2] - d[N/2 - 1] << endl;
    return 0;
}



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

int Zero[6] = { 1,6,1,4,5,2 };
int One[6] = { 2,3,6,5,2,1 };

int hantei(int s, int t) {
	if (t == 0) {
		return Zero[s];
	}
	return One[s];
}

string S;

int main() {
	while (true) {
		int x = 0;
		cin >> S;
		if (S == "#") { break; }
		for (int i = 0; i < S.size(); i++) {
			if (S[i] == '0') {
				x = hantei(x, 0);
			}
			else {
				x = hantei(x, 1);
			}
			if (x == 6) {
				cout << "No" << endl;
				goto E;
			}
		}
		if (x == 5) { cout << "Yes" << endl; }
		else { cout << "No" << endl; }
	E:;
	}
}

Measured memory_bytes: 1180
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <deque>
#include <queue>

using namespace std;
typedef long long ll;


int main(){
    int N,K;
    cin >> N >> K;
    int p[K];
    string s[K];
    for(int i = 0; i < K; i++){
        cin >> p[i];
        cin >> s[i];
    }
    map<int, int> mp;
    int wa[N];
    for(int i = 0; i < N; i++) wa[i] = 0;

    for(int i = 0; i < K; i++){
        if(s[i] == "AC") mp[p[i]-1] = 1;
        else{
            if(mp.count(p[i]-1) == 0){
                wa[p[i]-1]++;
            }
        } 
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
        if(mp.count(i) == 1) ans += wa[i];
    }
    cout << mp.size() << endl;
    cout << ans << endl;

    
}


Measured memory_bytes: 11136
#include <stdio.h>
int main(){
  int i,h,H[20000],n;
 
  scanf("%d",&h);
 
  for(i=1;i<=h;i++){
    scanf("%d",&H[i]);
  }
 
  /* output */
  for(i=1;i<=h;i++){
    printf("node %d: key = %d, ",i,H[i]);
    if(i!=1) printf("parent key = %d, ",H[i/2]);
     if(2*i<=h) printf("left key = %d, ",H[2*i]);
     if(2*i+1<=h) printf("right key = %d, ",H[2*i+1]);
    printf("\n");
  }
 
  return 0;
}

Measured memory_bytes: 608
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<map>
using namespace std;
#define ll long long
int main()
{
	map<int,int>mp;
	int i,n,a;
	scanf("%d",&n);
	for(i=1;i<n;i++)
	{
		scanf("%d",&a);
		mp[a]++;
	}
	for(i=1;i<=n;i++)
		printf("%d\n",mp[i]);
}

Measured memory_bytes: 12604
// ????????????????????????????????????????????????????????????????§£????????¢??°
// ????§£????????????????????????????????????????????°????????????????????????????????±???????????¨???????????????
// ??????????????????????????±??????0????????£???????????????
//
// ???s,t???(x,y)??????????????????p2.x-p1.x ??¨ p2.y-p1.y ??? 1/3(s), 2/3(t) ??°????????????????????¨?????????
//
// 2????????°??? a, b ??? 1/3 ??°????????°??? c ?????\???????????§?±??????????
// c = a + (b - a) / 3
//   = (3a + b - a) / 3
//   = (2a + b) / 3
// ????§???????2/3 ??°????????°??? d ?????\?????§?±??????????
// d = b - (b - a) / 3
//   = (3b - b + a) / 3
//   = (a + 2b) / 3
// 
// ????¨?????????????a, b ?????§?°???¢????????¢???????????£????????°??????????????§?????????
// ???u ????±??????????????????£?????????????????¢???????????????????????¨?????????


/* ALDS1_5_B: Koch Curve */

#include <iostream>
#include <vector>
#include <cstdio>
#include <cmath>
using std::vector;

const double T_RAD = 60 * M_PI / 180.0;

struct Point {
    double x, y;
    Point(double _x, double _y) : x(_x), y(_y) {};
};

double one_third_in(double b, double e) {
    return (2 * b + e) / 3;
}

double two_thirds_in(double b, double e) {
    return (b + 2 * e) / 3;
}

double lotate_x(Point& a, Point& b) {
    return (b.x - a.x) * cos(T_RAD) - (b.y - a.y) * sin(T_RAD) + a.x;
}

double lotate_y(Point& a, Point& b) {
    return (b.x - a.x) * sin(T_RAD) + (b.y - a.y) * cos(T_RAD) + a.y;
}

void koch(int depth, vector<Point>& points, Point& p1, Point& p2) {
    if (depth == 0) return;

    Point s( one_third_in(p1.x, p2.x), one_third_in(p1.y, p2.y) );
    Point t( two_thirds_in(p1.x, p2.x), two_thirds_in(p1.y, p2.y) );
    Point u( lotate_x(s, t), lotate_y(s, t) );
    int next_depth = depth - 1;

    koch(next_depth, points, p1, s);
    points.push_back(s);

    koch(next_depth, points, s, u);
    points.push_back(u);

    koch(next_depth, points, u, t);
    points.push_back(t);

    koch(next_depth, points, t, p2);
}

int main() {
    int depth;
    scanf("%d", &depth);

    vector<Point> points;
    Point p1(0, 0), p2(100, 0);

    points.push_back(p1);
    koch(depth, points, p1, p2);
    points.push_back(p2);

    for (int i = 0; i < points.size(); i++) {
        Point& p = points[i];
        printf("%.8f %.8f\n", p.x, p.y);
    }

    return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  if(s[0] == '0'){
    cout << -1 << endl;
    return 0;
  }

  if(s.back() == '1'){
    cout << -1 << endl;
    return 0;
  }
  ll n = s.size();
  rep(i,n-1){
    if(s[i] != s[n-2-i]) {
      cout << -1 << endl;
      return 0;
    }
  }

  int nodeCnt = 1;
  cout << nodeCnt << " " << nodeCnt+1 << endl;
  nodeCnt++;
  FOR(i,1,s.size()) {
    if(s[i] == '0') continue;
    int pathNode = nodeCnt;
    nodeCnt++;
    while(nodeCnt <= i+1){
      cout << pathNode << " " << nodeCnt << endl;
      nodeCnt++;
    }
    if(nodeCnt <= s.size()) cout << pathNode << " " << nodeCnt << endl;
  }
  return 0;
}


Measured memory_bytes: 1616
#include <stdio.h>
#include <stdlib.h> 
typedef struct{
    int k,l,r;
}Node;
void insert(int, int);
void inParse(int);
void preParse(int);
Node T[500001];
int main(void)
{
    char s[8];
    int m;
    int num,count=0;
    int i;
  
    scanf("%d", &m);  
    for(i=0; i<m; i++){
        scanf("%s", &s);
        if(s[0]=='i'){ 
          scanf("%d", &num); 
          insert(count, num); 
          count++; 
        }
        if(s[0]=='p'){
          if(count>0) inParse(0);
            printf("\n");
            if(count>0) preParse(0);
            printf("\n");
        }
    }  
    return 0;  
}
  
void inParse(int p){
    if(T[p].l>=0) inParse( T[p].l);
    printf(" %d", T[p].k);
    if(T[p].r>=0) inParse( T[p].r);
}
  
void preParse(int p){
    printf(" %d", T[p].k);
    if(T[p].l>=0) preParse(T[p].l);
    if(T[p].r>=0) preParse(T[p].r);
}
  
void insert(int count, int z){
    int x=0, y;
    if(count<1) x=-1;
  
    T[count].k = z;
    T[count].l = -1;
    T[count].r = -1;
  
    while(x>=0){
        y = x; 
        if(z < T[x].k)x = T[x].l; 
        else x = T[x].r; 
    }
    if(count<1){}
    else if(z < T[y].k)T[y].l = count; 
    else T[y].r = count; 
}

Measured memory_bytes: 6460
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <algorithm>
#include <string>
#include <iostream>
#include <complex>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <stack>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <random>
#include <set>
#include <vector>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <array>
#include <forward_list>
#include <chrono>
#include <iomanip>
#include <utility>
#include <cassert>

#pragma GCC optimize("Ofast")
#pragma target("sse", "sse1")

#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

mt19937 gen(34);

int n, m;
multiset <int> s;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
	//freopen("memory.in", "r", stdin);
	//freopen("memory.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		s.insert(x);
	}
	while (m--)
	{
		int x = *s.rbegin();
		s.erase(s.find(x));
		s.insert(x / 2);
	}
	ll ans = 0;
	while (!s.empty())
	{
		ll x = *s.begin();
		ans += x;
		s.erase(s.begin());
	}
	cout << ans;
	return 0;
}

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

/* 繰り返し自乗法. */
int modPow(long long a, long long n, long long p) {
	if (n == 0) return 1; // 0乗にも対応する場合.
	if (n == 1) return a % p;
	if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
	long long t = modPow(a, n / 2, p);
	return (t * t) % p;
}

signed main() {
    string S;
    cin >> S;

    rep (i, S.size()) S[i] = 'x';

    cout << S << endl;
}



Measured memory_bytes: 3560
import java.util.Scanner;

public class Main {

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

    private Scanner scan = new Scanner(System.in);
    private int N;
    private int[] count;

    public Main() {
	N = Integer.parseInt(scan.next());
	count = new int[3];
	for (int i = 0; i < N; i++) {
	    int a = Integer.parseInt(scan.next());

	    if(a%4 == 0) count[0]++;
	    else if(a%2 == 0) count[1]++;
	    else count[2]++;
	}
	scan.close();
    }

    public final void answer() {
	int hoge = count[2] - count[0];
	String ans = "Yes";

	if(hoge == 1 && count[1] > 0) ans = "No";
	else if(hoge >= 2) ans = "No";

	System.out.println(ans);
    }
}


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

int main() {
  int n, k; cin >> n >> k;
  int ans = 0;
  rep(i, n) {
    int t; cin >> t;
    if (t >= k) ans ++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
		if(a==b && b==c) {
			System.out.println("No");
		}else if(a!=b && a!=c && b!=c) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}

	}
}



Measured memory_bytes: 23764
using ll=long long;using ull=unsigned long long;
#include<limits>
namespace pcl{template<typename T>constexpr T TNF=std::numeric_limits<T>::max()/2;constexpr int INF=TNF<int>;constexpr ll LNF=TNF<ll>;constexpr double DNF=TNF<double>;constexpr double EPS=1e-8;constexpr int P7=1'000'000'007;constexpr int DX[]={1,0,-1,0,1,1,-1,-1};constexpr int DY[]={0,1,0,-1,-1,1,1,-1};}
#include<algorithm>
#include<cmath>
#include<iostream>
namespace pcl{template<typename T>void updmax(T&a,T const&b){a=std::max(a,b);}template<typename T>void updmin(T&a,T const&b){a=std::min(a,b);}template<typename T,typename U,typename V>bool in_range(T const&begin,U const&mid,V const&end){return begin<=mid&&mid<end;}template<typename T,typename U,typename V>bool in_range(T const&begin,std::initializer_list<U>list,V const&end){auto p=std::minmax_element(list.begin(),list.end());return begin<=*p.first&&*p.second<end;}template<typename T,typename U,typename V>bool in_range_strict(T const&begin,std::initializer_list<U>list,V const&end){if(!std::is_sorted(list.begin(),list.end()))return false;return in_range(begin,list,end);}template<typename T>inline T cget(){T x;std::cin>>x;return x;}}
#include<iostream>
#include<vector>
namespace pcl{template<typename T>std::ostream&operator<<(std::ostream&os,std::vector<T>const&v){os<<'[';for(size_t i=0;i<v.size();i++){if(i!=0)os<<",";os<<v[i];}os<<']';return os;}template<typename T>std::istream&operator>>(std::istream&is,std::vector<T>&v){for(size_t i=0;i<v.size();i++)is>>v[i];return is;}}
#include<bits/stdc++.h>
using namespace std;using namespace pcl;ll sum(ll x){return x*(x+1)/2;}int main(){string s;cin>>s;vector<ll>a;ll cur=0;char p='<';for(char ch:s){if(ch!=p){a.push_back(cur);p=ch;cur=1;}else{cur++;}}if(cur!=0)a.push_back(cur);if(a.size()%2!=0)a.push_back(0);ll res=0;for(int i=0;i<(int)a.size();i+=2){res+=max(a[i],a[i+1]);res+=max(0ll,sum(a[i]-1));res+=max(0ll,sum(a[i+1]-1));}cout<<res<<endl;}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
int main() {
     int n;
     cin >> n;
     bool ans = false;
     for(int i = 0; i <= n / 4; i++){
          for(int j = 0; j <= n / 7; j++){
               if(4 * i + 7 * j == n) ans = true;
          }
     }
     if(ans) cout << "Yes" << endl;
     else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  int i;
  for(i=0;i<1003;i++){
    int c=i*0.08;
    int d=i*0.1;
    if(c==a && d==b){
      cout << i;
      return 0;
    }
  }
  cout << -1;
}
   
    

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const int MAX = 510000;

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;
}
bool is_integer(double x)
{
  return floor(x) == ceil(x);
}

int main()
{
  int n;
  cin >> n;
  int cnt = 0;
  for (int a = 1; a < n; a++)
  {
    for (int b = 1; b < n; b++)
    {
      if (a * b >= n)
      {
        break;
      }
      else
      {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3632
package main

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

var scanner *bufio.Scanner

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func getI() int {
  return int(getI64())
}

func main() {
  scanner = bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer := bufio.NewWriter(os.Stdout)
  defer writer.Flush()

  n := getI()
  forward, backward := make([]int64, n), make([]int64, n)
  for i := range forward {
    forward[i] = getI64()
  }
  for i := range forward {
    backward[i] = getI64()
  }
  exact, high := make([]int64, n), make([]int64, n)
  tall := int64(0)
  for i, x := range forward {
    if x > tall {
      tall = x
      exact[i] = tall
    } else {
      high[i] = tall
    }
  }
  mod := int64(1000 * 1000 * 1000 + 7)
  result := int64(1)
  tall = 0
  for i := n - 1; i >= 0; i-- {
    x := backward[i]
    if x > tall {
      tall = x
      if (exact[i] > 0 && exact[i] != x) || (high[i] > 0 && high[i] < x) {
        result = 0
        break
      }
    } else {
      if exact[i] > 0 {
        if exact[i] > x {
          result = 0
          break
        }
      } else {
        if high[i] < x {
          result = (high[i] * result) % mod
        } else {
          result = (x * result) % mod
        }
      }
    }
  }
  writer.WriteString(fmt.Sprintf("%d\n", result))
}


Measured memory_bytes: 6144
import java.util.Scanner;

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

        long[] ti = new long[n];

        for (int i = 0; i < n; i++) {
            ti[i] = sc.nextLong();
        }
        sc.close();

        long ans = 1;

        for (int i = 0; i < n; i++) {
            ans = lcm(ans, ti[i]);
        }

        System.out.println(ans);

    }

    private static long gcd(long m, long n) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m / gcd(m, n) * n;
    }

}

Measured memory_bytes: 23124
#include <cstdio>
#include <algorithm>
#include <functional>

int k, t;
int a[100];
int ans;

int main(){
	scanf("%d %d", &k, &t);
	for(int i=0; i<t; ++i) scanf("%d", &a[i]);
	std::sort(a, a+t, std::greater<int>());
	int p = -1;
	for(int i=0; i<k; ++i){
		for(int j=0; j<t; ++j){
			if(a[j] > 0){
				if(p != j && (j == t-1 || a[j] > a[j+1])){
					p = j;
					--a[j];
					break;
				}else if(j == t-1 || a[j+1] == 0){
					p = j;
					++ans;
					--a[j];
					break;
				}
			}
		}
/*		for(int j=0; j<t; ++j) printf("%d ", a[j]);
		printf("\n");
*/	}
	printf("%d\n", ans);
}

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

using db = double;
using ll = long long;
using vi = vector <int>;
#define op operator
#define pb push_back

const int N = 1e6L + 11;
bool v[N];

int main() {
	cout << fixed << setprecision(9);
	ios :: sync_with_stdio(0);

	for(int n, a, b; cin >> n >> a >> b && n && a && b; ) {
		fill(v, v + n + 1, 0);
		v[0] = 1;
		for(int i = 0; i < n; i ++) if(v[i]) {
			if(i + a <= n) v[i + a] = 1;
			if(i + b <= n) v[i + b] = 1;
		}

		cout << count(v, v + n + 1, 0) << '\n';
	}

	return 0;
}

Measured memory_bytes: 4020
import java.util.*

fun main(args : Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    println(problem55a(n))
}

fun problem55a(n: Int): Int {
    val cashBackCount =  n / 15
    return 800 * n - (200 * cashBackCount)
}

Measured memory_bytes: 31260
using System;
class Program
{
	static void Main(string[] args)
	{
		string t = Console.ReadLine();
		long N = long.Parse(t);
		string[] s = Console.ReadLine().Split(' ');
		long [] A = new long[N];
		for(var i=0;i<N;i++){
			A[i] = long.Parse(s[i]);
		}
		long c = 0;
		long count = 0;
		long sum = 0;
		long xor = 0;
		for(var i=0;i<N;i++){
			sum = sum + A[i];
			xor = xor ^ A[i];
			c += 1;
			if(sum == xor){
				count += c;
			} else {
				sum = 0;
				xor = 0;
				c = 0;
				long sum2 = 0;
				long xor2 = 0;
				for(var j=i;j>=1;j--){
					sum2 = sum + A[j];
					xor2 = xor ^ A[j];
					c += 1;
					if(sum2==xor2){
						count += 1;
						sum = sum2;
						xor = xor2;
					} else {
						c -= 1;
						break;
					}
				}
			}
		}
		Console.WriteLine(count);
	}
}

Measured memory_bytes: 30812
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        int ans = 0;
        for (ll x = 1; x * x < i; x++)
        {
            for (ll y = 1;x*x + y * y + x*y < i; y++)
            {
                for (ll z = 1;x*x+y*y+ z * z+x*y+y*z+z*x <= i; z++)
                {
                    if(x*x+y*y+z*z+x*y+y*z+z*x == i)
                    ans++;
                }
            }
        }
        cout<<ans<<endl;
    }
//    cout<<1;
    return 0;
}

Measured memory_bytes: 3544