akhauriyash/Code-Regression huggingface dataset:
// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

int aray[105];

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, M; gi(n), gi(M); int tot = 0;
	rep(i, n) { gi(aray[i]); tot += aray[i]; }
	int thre = (tot+4*M-1)/(4*M);
	int cnt = 0;
	rep(i, n) cnt += (aray[i] >= thre);
	if(cnt >= M) pstr("Yes");
	else pstr("No");
}


Measured memory_bytes: 2304
#include <cmath>
#include <iostream>
#include <vector>

int main() {
  int M, K;
  std::cin >> M >> K;

  int max = 1 << M;
  std::vector<int> result(max * 2);

  if (max <= K) {
    std::cout << -1 << std::endl;
    return 0;
  }

  if (M == 0) {
    if (K == 1) {
      std::cout << -1 << std::endl;
      return 0;
    } else {
      result[0] = 0;
      result[1] = 0;
    }
  } else if (M == 1) {
    if (K == 1) {
      std::cout << -1 << std::endl;
      return 0;
    } else {
      result[0] = 0;
      result[1] = 0;
      result[2] = 1;
      result[3] = 1;
    }
  } else {
    // 最初と真ん中らへんにKを配置する
    result[0] = result[max] = K;

    int val = 0;
    for (int i = 1; i < max; ++i) {
      if (val == K) {
        ++val;
      }
      result[i] = result[result.size() - i] = val;
      ++val;
    }
  }

  for (auto r : result) {
    std::cout << r << " ";
  }
  std::cout << std::endl;
}


Measured memory_bytes: 2816
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (int x = sc.nextInt(), i = 1; x != 0; x = sc.nextInt(), i++) {
            System.out.println("Case " + i + ": " + x);
        }
    }
}

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

int main()
{
    double x;
    while (cin >> x) {
        double v = 0;
        int n = 1;
        while (v < x) {
            int f = 5 * n;
            double t = sqrt(f / 4.9);
            v = 9.8 * t;
            n++;
        }
        cout << n << endl;
    }
    return 0;
}

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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

class Solution {
public:
	void solve() {
		long long n;
		cin >> n;
		long long ans = n-1;
		for(long long i=1; i*i <= n; i++){
			if(n % i == 0){
				updmin(ans, i-1 + n/i - 1);
			}
		}
		cout << ans << "\n";
		
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

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

int main(){
  stack<int> S;

  int a;
  while(cin >> a){
    if(a == 0){
      cout << S.top() << endl;
      S.pop();
    } else {
      S.push(a);
    }
  }
}
  
  


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
typedef  long long int     ll;
typedef  vector<int>       vi;
typedef  pair<int,int>     pii;
#define  int               ll
#define  F                 first
#define  S                 second
#define  pb                push_back
#define  mp                make_pair 
#define  si(x)             (int)x.size()
#define  all(x)            x.begin(),x.end()
#define  minv(m,n)         *min_element(m,n)      
#define  maxv(m,n)         *max_element(m,n)
#define  mem(a,x)          memset(a,x,sizeof(a))
#define  deb(x)            cout<<#x<<" = "<<x<<endl
#define  rep(i,n)          for(int i=0;i<n;i++)
#define  prs(x)            fixed <<setprecision(x)
#define  w(ttz)            int ttz;cin>>ttz;while(ttz--)
#define  show(a)           for(auto x:a){cout<<x<<" ";}cout<<endl;
        void iosbase(void);

int32_t main() 
{   
  iosbase();
  int a[3];
  rep(i , 3)cin>>a[i];
  sort(a , a+3);
  if(a[0] ==5 and a[1] == 5 and a[2] == 7)
  {
    cout<<"YES"<<endl;
  }
  else
    cout<<"NO"<<endl;


}


void iosbase(void){
ios::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
#endif 
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))
#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)
#define All(x) (x).begin(),(x).end()
#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))
#define End '\n'
#define Out(x) cout<<(x)<<End
template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

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

    int n;
    ll x;

    cin >> n >> x;

    ll a[n];
    int ans = 0;

    int i;

    rep(i, n) cin >> a[i];

    sort(a, a + n);

    rep(i, n) {
        if (a[i] <= x) {
            x -= a[i];
            ans++;
        } else {
            x = 0;

            break;
        }
    }

    if (x != 0) ans--;

    Out(ans);

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
using vi = vector<int>;
using vll = vector<ll>;
const ll INF = 1LL<<60;

int main(){
  int n,k; cin >> n >> k;

  vi h(n);
  rep(i,n) cin >> h[i];
  sort(h.begin(), h.end());
  reverse(h.begin(), h.end());
  int ans = 1<<30;
  for(int i = 0; i < n-k+1; i++){
    int now = h[i] - h[i+k-1];
    ans = min(ans, now);
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  string S, right, left;  //反転が無い条件下で、rightは右、leftは左に位置する文字列
  int Q, count = 0;  //countは偶数なら反転無し、奇数なら反転あり
  cin >> S >> Q;
  for (int i = 0; i < Q; i++) {
    int T;
    cin >> T;
    if (T == 1) {
      count++;
    }
    else {
      int F;
      string c;
      cin >> F >> c;
      if ((count % 2 == 0 && F == 1) || (count % 2 != 0 && F == 2)) {
        right = c + right;
      }
      else if ((count % 2 == 0 && F == 2) || (count % 2 != 0 && F == 1)) {
        left = left + c;
      }
    }
  }
  
  if (count % 2 == 0) {
    cout << right + S + left << endl;
  }
  else {
    reverse(S.begin(), S.end());
    reverse(right.begin(), right.end());
    reverse(left.begin(), left.end());
    cout << left + S + right << endl;
  }
      
}

Measured memory_bytes: 1512
#include"bits/stdc++.h"


#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(int x = (l);x<=(u);x++)
#define RREP(x,l,u) for(int x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()

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

const int maxn = 200010;
const int mod = 1e9+7;
const int MAX = 1000000010;
const double eps = 1e-6;
const double PI = acos(-1);

template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}

int n,m,a,b,ans;

int fac[maxn],inv[maxn];

int calc(int n,int m){
	return 1ll*fac[n+m-2]*inv[m-1]%mod*inv[n-1]%mod;
}

void Work(){
	REP(i,b+1,m)ans=(1ll*calc(n-a,i)*calc(a,m-i+1)+ans)%mod;
	iout(ans);
}

void Init(){
	read(n,m,a,b);
	fac[0]=1;
	REP(i,1,n+m)fac[i]=1ll*fac[i-1]*i%mod;
	REP(i,0,n+m)inv[i]=fexp(fac[i],mod-2);
}

int main(){
	Init();
	Work();
	return 0;
}


Measured memory_bytes: 1792
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val S = next()
    val ans = f(S, S.length - 1)
    println(ans)
}

fun f(S: String, pos: Int): Long {
    if (pos == 0) return calc(S)
    else return f(S, pos - 1) + f(S.take(pos) + "+" + S.drop(pos), pos - 1)
}

fun calc(S: String) = S.split("+").map { it.toLong() }.sum()

Measured memory_bytes: 40376
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;

int main()
{
    int N;
    cin>>N;
    vector<int> d(N);
    for(int i=0;i<N;i++)
        cin>>d[i];
    sort(d.begin(),d.end());
    cout<<d[N/2]-d[N/2-1]<<endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

string t;

int main() {
	cin >> t;
	rep(i, sz(t)) {
		if (t[i] == '?') {
			cout << 'D';
		}
		else {
			cout << t[i];
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  string s, t;
  cin >> s >> t;
  ll n = s.size();
  ll m = t.size();
  ll ans = n;
  REP(i, n-m+1){
    ll a = 0;
    REP(j, m){
      if(s[i+j] != t[j]) a++;
    }
    chmin(ans, a);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



void solve(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int ac=abs(a-c);
  if(ac<=d)cout << "Yes" << endl;
  else{
    int ab=abs(a-b);
    int bc=abs(b-c);
    if(ab<=d && bc <=d)cout << "Yes";
    else cout << "No" ;
    cout << endl;
  }
}

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


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

int n;
long long march[5];
int comb[10][3] = {{0,1,2}, {0,1,3}, {0,1,4}, {0,2,3}, {0,2,4},
                    {0,3,4},{1,2,3}, {1,2,4}, {1,3,4}, {2,3,4}};

int main(){
    cin >> n;
    string s;
    for(int i = 0; i < n; i++){
        cin >> s;
        switch(s[0]){
            case 'M':
                march[0]++;
                break;
            case 'A':
                march[1]++;
                break;
            case 'R':
                march[2]++;
                break;
            case 'C':
                march[3]++;
                break;
            case 'H':
                march[4]++;
                break;
        }
    }
    long long count = 0;
    for(int j = 0; j < 10; j++){
        count += march[comb[j][0]] * march[comb[j][1]] * march[comb[j][2]];
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
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> void PrintVector(const vector<T> &vec) {for (auto val : vec) cout << val << " "; cout << endl;}
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll GCD(ll a, ll b)
{
    return b ? GCD(b, a%b) : a;
}

int main()
{
    int n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll ans = a[0];
    Rep(i, 1, n)
    {
        ans = GCD(ans, a[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s, t;
    cin >> n >> s >> t;
    rep(i,n){
        bool ok = true;
        rep(j,n-i){
            if(s[i+j] != t[j]) ok = false;
        }
        if(ok){
            cout << n + n - (n - i) << endl;
            return 0;
        }
    }
    cout << 2*n << endl;
    return 0;
}


Measured memory_bytes: 3608
n, m = map(int, input().split())
cakes = [list(map(int, input().split())) for _ in range(n)]
a = []
def pm(x):
    if x % 2 == 0: return 1
    else: return -1
for i in range(8):
    temp = sorted([pm(i//4)*x + pm(i//2)*y + pm(i)*z for x,y,z in cakes],reverse=True)
    a.append(sum(temp[0:m]))
print(max(a))

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

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

  if (A + B > C + D) {
    cout << "Left" << endl;
  }
  else if (A + B == C + D) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//<(") 
#define ll long long
#define double long double
using namespace std;

const ll siz = 5e5 + 10;
const ll mod = 1e9 + 7;
const ll MAXX = 1e17;
const ll base = 31;

ll n;
string s;

ll tree[50][siz];

void update(char x, ll pos, ll val) {
	for (ll i = pos; i <= n; i += i & -i) {
		tree[x - 'a'][i] += val;
	}
}

ll get(char x, ll pos) {
	ll ans = 0;
	for (ll i = pos; i; i -= i & -i) {
		ans += tree[x - 'a'][i];
	}
	return ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("INP.txt", "r", stdin);
    //freopen("OUT.txt", "w", stdout);
	cin >> n;
	cin >> s;
	s = ' ' + s;
	for (ll i = 1; i <= n; i++) {
		update(s[i], i, 1);
	}
	ll q;
	cin >> q;
	while (q--) {
		ll task;
		cin >> task;
		if (task == 1) {
			ll pos; char x;
			cin >> pos >> x;
			update(s[pos], pos, -1);
			update(x, pos, 1);
			s[pos] = x;
		}
		else {
			ll l, r;
			cin >> l >> r;
			ll ans = 0;
			for (ll i = 'a'; i <= 'z'; i++) {
				ans += (get(i, r) - get(i, l - 1)) > 0;
			}
			cout << ans << '\n';
		}
	}
    return 0;
}

Measured memory_bytes: 103344
h, w = map(int, input().split())
a = [[] for i in range(h)]
for i in range(h):
    a_tmp = input()
    for _ in a_tmp:
        a[i].append(_)
# for i in range(h):
#    print(a[i])
yoko = []
for i in range(h):
    judge = True
    for j in range(w):
        if a[i][j] == "#":
            judge = False
            break
    if judge:
        yoko.append(i)
tate = []
for i in range(w):
    judge = True
    for j in range(h):
        if a[j][i] == "#":
            judge = False
            break
    if judge:
        tate.append(i)
# print(tate)
it = 0
iy = 0
an = [[] for i in range(h-len(yoko))]
# print('sol')
for i in range(h):
    sum = 0
    for j in range(w):
        if i not in yoko and j not in tate:
            print(a[i][j], end="")
            sum += 1
    if sum != 0:
        print("")


Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
mt19937 mrand(random_device{}()); 
const ll mod=998244353;
int rnd(int x) { return mrand()%x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=401000;
int a[N],b[N],n,m,c[N];
ll s;
void dft(int *a,int l,int r) {
	if (l==r) return;
	int md=(l+r)>>1,len=(r-l+1)>>1;
	dft(a,l,md);dft(a,md+1,r);
	rep(i,0,len) {
		int x1=a[l+i],x2=a[l+len+i];
		a[l+i]=(x1+x2)%mod;
		a[l+len+i]=(x1-x2)%mod;
	}
}
ll inv2=(mod+1)/2;

void idft(int *a,int l,int r) {
	if (l==r) return;
	int md=(l+r)>>1,len=(r-l+1)>>1;
	rep(i,0,len) {
		int x1=a[l+i],x2=a[l+len+i];
		a[l+i]=(x1+x2)*inv2%mod;
		a[l+len+i]=(x1-x2)*inv2%mod;
	}
	idft(a,l,md);idft(a,md+1,r);
}

int main() {
	scanf("%d",&n);
	m=1<<n;
	for (int i=0;i<m;i++) {
		scanf("%d",a+i);
		s+=a[i];
	}
	s=powmod(s,mod-2);
	rep(i,0,m) a[i]=a[i]*s%mod;
	dft(a,0,m-1);
	rep(i,0,m) b[i]=1;
	b[0]=(mod-m+1);
	dft(b,0,m-1);
//	rep(i,0,m) printf("%d ",a[i]); puts("");
//	rep(i,0,m) printf("%d ",b[i]); puts("");
	rep(i,1,m) c[i]=b[i]*powmod(mod+1-a[i],mod-2)%mod;
	idft(c,0,m-1);
	// c[0]+ 1/2^n f0 = 0
	ll f0=(mod-c[0])%mod;
	rep(i,0,m) {
		c[i]=(c[i]+f0)%mod;
		if (c[i]<0) c[i]+=mod;
		printf("%d\n",c[i]);
	}
}

Measured memory_bytes: 6400
#include<stdio.h>
int main(void){
	int i, a, b, c, count = 0;
	for(i = 0;;i++){
		scanf("%d %d %d", &a, &b, &c);
		if(a <= b){
			break;
		}
		else
		{
		}
	}
	for(i = a; i <= b; i++){
		if(c % i == 0){
			count++;
		}
	}
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <stdio.h>

char lower(char c)
{
    c = c + ('a' - 'A');
    return c;
}

char makelower(char c)
{
        if('a' <= c && c <= 'z')
        {
            return c;
        }
        else if('A' <= c && c <= 'Z')
        {
            return lower(c);
        }
        else
        {
            return c;
        }
}

int main()
{
    char ch;
    int a[123] = {0};
    while(std::cin>>ch && ch != EOF)
    {
        a[makelower(ch)]++;
    }
    for(int i = 'a'; i <= 'z'; i++)
    {
        printf("%c : %d\n",i,a[i]);
    }  
}




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

using namespace std;

#define io freopen("test.txt", "r", stdin);
#define fast ios_base::sync_with_stdio(0);cin.tie(0);


#define ull unsigned long long int
#define lli long long int
#define li long int
#define ld long double

#define cout(x) cout<<x<<" "
#define coutn(x) cout<<x<<endl
#define newline cout<<endl

#define sz(x) (int)x.size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define ar array

#define pii pair<int,int>
#define pll pair<lli,lli>
#define pps pair<pair<int,int>, string>

const int MOD=1000000007;
const lli INF=1e18;
const int MX=100001;
const int N=1000000;

int a,b,c;

void solve(){

    int n;
    cin>>n;

    vector<ar<int,3>>v(n+1);

    v[0][0]=v[0][1]=v[0][2]=0;

    for(int i=1;i<=n;i++){
        cin>>a>>b>>c;
        v[i][0]=max(v[i-1][1], v[i-1][2])+a;
        v[i][1]=max(v[i-1][0], v[i-1][2])+b;
        v[i][2]=max(v[i-1][0], v[i-1][1])+c;
    }
    
    // for(auto x:v){
    //     cout<<x[0]<<" "<<x[1]<<" "<<x[2]<<"\n";
    // }
    
    cout<<max(v[n][0], max(v[n][1], v[n][2]))<<"\n";
}


int main(){
    fast
    // #ifndef godzqa
    //     io
    // #endif

    lli t=1;
    // cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 4496
import numpy as np

# N,M = list(map(int, input().split()))

S = input()
set_array = []
prev_set_len = 0
total = 0

prev_check_point = 0
mountains = []
valleys = [0]
for i in range(len(S)-1):
    if S[i] == "<" and S[i+1] == ">":
        mountains.append(i+1)
    elif S[i] == ">" and S[i+1] == "<":
        valleys.append(i+1)

valleys.append(len(S))

if len(mountains) == 0 and len(valleys) == 2:
    print((len(S)+1)*len(S)//2)
    exit()
if len(mountains) == 0 and len(valleys) == 3:
    left = valleys[1]
    right = len(S) - valleys[1]
    total += (left+1)*left//2
    total += (right+1)*right//2
    print(total)
    exit()

if valleys[1] < mountains[0]:
    left = valleys[1]
    total += (left+1)*left//2
    valleys.remove(0)

for i, mountain in enumerate(mountains):
    left = mountain - valleys[i]
    right = valleys[i+1] - mountain

    if left > right:
        total += (left+1)*left//2
        total += (right-1+1)*(right-1)//2
    else:
        total += (right+1)*right//2
        total += (left-1+1)*(left-1)//2
# print(total)
if valleys[-2] > mountains[-1]:
    right = len(S) - valleys[-2]
    total += (right+1)*right//2


print(total)


Measured memory_bytes: 23224
S = input()
c1 = c2 = 0
for i, s in enumerate(S):
    if i % 2 == 0:
        if s == '1':
            c1 += 1
        else:
            c2 += 1
    else:
        if s == '0':
            c1 += 1
        else:
            c2 += 1
print(min(c1, c2))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
using namespace std;
int a,b,c[110000],d[110000],e=0,f=110000;
signed main()
{
	cin>>a>>b;
	rep(i,b){
		cin>>c[i]>>d[i];
		if(e<c[i]){
			e=c[i];
		}
		if(f>d[i]){
			f=d[i];
		}
	}
	if(f-e+1<1){
		cout<<0;
	}else{
		cout<<f-e+1;
	}
}

Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	char buf[102],sta[102],c;
	int len,i,j,p,flg;
	while(1)	{
		fgets(buf,102,stdin);
		if(buf[0]=='.')	break;
		len=0;
		while(buf[len]!='.')	len++;
		
//		printf("len=%d %s\n",len,buf);
		
		p=0;
		flg=1;
		for(i=0;i<len;i++)	{
			if(buf[i]=='(' || buf[i]=='[')	{
				sta[p]=buf[i];
//				printf("i=%d c=%c\n",i,buf[i]);
				p++;
			}
			else if(buf[i]==')')	{
				if(p==0)	{
					flg=0;
					break;
				}
				if(sta[p-1]!='(')	{
					flg=0;
					break;
				}
				else {
					p--;
				}
			}
			else if(buf[i]==']')	{
				if(p==0)	{
					flg=0;
					break;
				}
				if(sta[p-1]!='[')	{
					flg=0;
					break;
				}
				else {
					p--;
				}
			}
		}
		if(p!=0)	{
			flg=0;
		}
		if(flg==1)	{
			printf("yes\n");
		}
		else {
			printf("no\n");
		}
	}
	
	return 0;
}


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

int main() {
    int K, N;
    cin >> K >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    int sa = A[0];
    rep(i, N - 1) {
        sa = max(sa, A[i + 1] - A[i]);
    }
    sa = max(sa, K - A[N - 1] + A[0]);

    cout << K - sa << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
    cin >> n;
    vector<string> cases = {"AC", "WA", "TLE", "RE"};
    vector<int> cnt(4);
    string s;
    for (int i = 0; i < n; i++) {
        cin >> s;
        for (int j = 0; j < 4; j++) {
            if (s == cases[j]) {
                cnt[j]++;
                break;
            }
        }
    }
    for (int i = 0; i < 4; i++) {
        cout << cases[i] << " x " << cnt[i] << "\n";
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
const int N = 100010;
int a[N];

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	int n;
	cin >> n;
	
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	for(int i = n-1; i > 0; i--){
		if(a[i] - a[i-1] == -1) a[i-1]--;
		else if(a[i] - a[i-1] < -1){
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
}

Measured memory_bytes: 640
n = int(input())
i = 1
for i in range(1, n + 1):
 if i % 3 == 0:
  print(' {0}'.format(i), end = '')
 else:
  st = str(i)
  for x in range(0, len(st)):
   if st[x] == '3':
    print(' {0}'.format(i), end = '')
    break
print()

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

int main(){

    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
        a[i]*=2;
    }
    a.push_back(a[0]);
    vector<ll> b(n+1);
    b[0]=0;
    for(int i=0;i<n;i++){
        b[i+1]=a[i]-b[i];
    }
    if(b.back()==b[0]){
        rep(i,n){
            cout << b[i] << " ";
        }
        cout << endl;
        return 0;
    }
    b[0]=(b[0]+b.back())/2;
    for(int i=0;i<n;i++){
        b[i+1]=a[i]-b[i];
    }
    rep(i,n){
        cout << b[i] << " ";
    }cout << endl;

    return 0;
}

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

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template <typename T> using pq = priority_queue<T>;
template <typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template <typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for (auto &i : mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template <class T> ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template <class T> istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template <class T> ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n;
    cin >> n;
    vl a(n);
    cin >> a;
    ll ans = 0;
    ll nowHi = 0, nowPlus = 0;
    rep(i, n) {
        if (a[i] < nowHi) {
            nowPlus += nowHi - a[i];
        } else {
            nowHi = a[i];
        }
    }
    cout << nowPlus << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}


Measured memory_bytes: 4824
/* ex3_4
    sak_Citrus*/

#include <stdio.h>

int main(void){
    //標準入力
    int num;
    scanf("%d",&num);
    for(int i=1;i<10;i++){
        //nがiで割り切れてなおかつその商が10未満なら
        if(num%i == 0 && num/i < 10){
            printf("Yes\n");
            break;
        }
        //最後までbreakされなかったら九九にはない
        if(i == 9)
            printf("No\n");
    }

}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<cassert>
#include<set>

using namespace std;
#define int long long
#define repeat(i,n) for(int i=0;i<(n);i++)

struct Edge{
   int to, c;
   Edge(int _to, int _c):to(_to), c(_c){}
};

vector<Edge> g[100005];
vector<int> d(100005, -1);
vector<int> sb(100005, 0);

int par[17][100005];
int dep[100005];

void init(int N){
  repeat(i, 16){
    repeat(j, N){
      if(par[i][j]==-1){
        par[i+1][j]=-1;
      }else{
        par[i+1][j]=par[i][par[i][j]];
      }
    }
  }
}

int lca(int s, int t){
  if(dep[s]<dep[t]) swap(s, t);
  repeat(i,17)if((dep[s]-dep[t])>>i&1) s=par[i][s];
  if(s==t) return s;
  for(int i=16; i>=0; i--){
    if(par[i][s]!=par[i][t]) s=par[i][s], t=par[i][t];
  }
  return par[0][s];
}


void f(int i, int p, int k){
   par[0][i]=p;
   if(i==k) sb[i]=1;
   for(auto e: g[i])if(e.to!=p){
      assert(d[i]>=0);
      d[e.to]=d[i]+e.c;
      sb[e.to]|=sb[i];
      dep[e.to]=dep[i]+1;
      f(e.to, i, k);
   }
}


signed main(){

   int N; cin>> N;
   repeat(i, N-1){
      int a, b, c;
      cin>> a>> b>> c;
      a--; b--;
      g[a].push_back(Edge{b, c});
      g[b].push_back(Edge{a, c});
   }

   int Q, K;
   cin>> Q>> K; K--;

   d[0]=0;
   f(0, -1, K);
   init(N);

   while(Q--){
      int x, y;
      cin>> x>> y;
      x--; y--;
      int dd=0;
      if(sb[x]==0 and sb[y]==0){
         // dd=2*d[K]+d[x]+d[y];
         dd=d[x]+d[K]-2*d[lca(x, K)];
         assert(dd>=0);
         dd+=d[y]+d[K]-2*d[lca(y, K)];
         assert(dd>=0);
      }else if(sb[x]==1 and sb[y]==1){
         dd=d[x]+d[y]-2*d[K];
         assert(dd>=0);
      }else{
         dd=d[x]+d[y]-2*d[lca(x, y)];
      }
      cout<< dd<< endl;
   }


   return 0;
}


Measured memory_bytes: 30720
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";}

// #define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
typedef long long ll;
typedef double ld;
#define pll pair<ll,ll>
#define pii pair<int, int>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()
   
const ll Mod = 1e9 + 7;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
    ll l , r;
    cin >> l >> r;
    set<ll> rem;
    for(ll i = l ; i <= min(l+2019 , r) ; i++){
        rem.insert(i%2019);
    }
    ll ans = 2019;
    for(auto it : rem){
        for(auto it2 : rem){
            if(it == it2)
                continue;
            ans = min(ans , it*it2%2019);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i,k,c=0;
    cin>>n;
    long long A[n];
    for(i=0;i<n;i++)
    {
      cin>>k;
      A[k]=i+1;
    }
    for(i=1;i<=n;i++)
     cout<<A[i]<<" ";
   
return 0;
}


Measured memory_bytes: 4352
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

string s;

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

  int ans = 0;
  for (int i = 0; i < 3; i++) {
    if (s[i] == '1') {
      ans++;
    }
  }

  cout << ans << endl;
  return 0;
}

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

#define fill(a,val) memset(a, (val), sizeof a)
#define pb push_back
#define lli long long int
#define scantype long long int
#define endl "\n"
#define unique(x) x.erase(unique(x.begin(),x.end()), x.end())

lli MOD  = 1000000007;
lli inf = 1e15;

void scan(scantype &x);
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli string_to_number(string s){lli x=0; stringstream convert(s); convert>>x; return x;}
lli add(lli a,lli b){lli x = (a+b)%MOD; return x; }
lli mul(lli a,lli b){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b){lli x = (a-b+MOD)%MOD; return x; }
lli divi(lli a,lli b){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}

#define N 100003

lli n,a[N];

lli solve(int turn)
{
  lli res = 0,sum=0;
  for(int i=0;i<n;i++,turn=1-turn)
  {
  	sum += a[i];
  	
  	if(turn==1 && sum>0LL)
  		continue;

  	if(turn==0 && sum<0LL)
  		continue;

    res += (abs(sum)+1);

    if(turn) sum = 1;
    else	 sum = -1;
  }

  return res;
}
int main(void)
{
  cin>>n;

  for(int i=0;i<n;i++)
  	scan(a[i]);

  cout<<min(solve(0),solve(1));
  return 0;
}


void scan(scantype &x)
{
    register int c = getchar(); //for negative/positive
    x = 0;
    int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = getchar());
    if(c=='-') {neg=1;c=getchar();}
    for(;c>47 && c<58;c = getchar()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}



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

using namespace std;
typedef long long ll;

struct Group {
    int l;
    int r;
    int size;
};
typedef struct Group Group;

int main(int argc, const char * argv[]) {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    char state = S[S.size() - 1];
    int ret = 0;
    int cursor = S.size() - 2;
    while (cursor >= 0) {
        if (state == S[cursor]) {
            ret += 1;
            cursor -= 1;
        } else {
            if (K == 0) {
                break;
            }
            int prev_cursor = cursor;
            char prev_state = state;
            state = S[cursor];
            while (state == S[cursor] && cursor >= 0) {
                ret += 1;
                cursor -= 1;
            }
            K -= 1;
            state = prev_state;
        }
    }
    if (cursor >= 0) {
        for (int i = cursor; i >= 0; i--) {
            if (S[i] == S[i+1]) {
                ret += 1;
            }
        }
    }
    cout << ret << endl;
    
    return 0;
}

Measured memory_bytes: 512
use text_io::*;
use std::collections::HashMap;
use std::process::exit;

fn main() {
    let n:usize = read!();
    for i in 0..n {
        for j in 0..n {
            if (4*i)+(7*j) == n {
                println!("Yes");
                exit(0);
            }
        }
    }
    println!("No");
}

Measured memory_bytes: 2128
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		StringBuilder builder = new StringBuilder();
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			List<Integer> list = new ArrayList<Integer>();
			for (int i = 1; i < n - 1; i++) {
				int a = i * i % n;
				if (!list.contains(a)) {
					list.add(a);
				}
			}
			int[] num = new int[(n + 1) / 2];
			for (int i = 1; i < list.size(); i++) {
				for (int j = 0; j < i; j++) {
					num[slove(i, j, list, n)]++;
					num[slove(j, i, list, n)]++;
				}
			}
			for (int i = 1; i < num.length; i++) {
				System.out.println(num[i]);
			}

		}
	}

	private static int slove(int i, int j, List<Integer> list, int n) {
		int t = list.get(i) - list.get(j);
		if (t < 0) {
			t += n;
		}
		if (t > (n - 1) / 2) {
			t = n - t;
		}
		return t;
	}
}

Measured memory_bytes: 28740
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int a,b,x;
	scanf("%d %d %d",&a,&b,&x);
	if(x>=a && a+b>=x)	printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  ll maxplus = LLONG_MIN, maxminus = LLONG_MIN;
  ll minplus = LLONG_MAX, minminus = LLONG_MAX;
  for (ll i = 0; i < N; i++) {
    ll x, y; cin >> x >> y;
    maxplus = max(maxplus, x + y);
    minplus = min(minplus, x + y);
    maxminus = max(maxminus, x - y);
    minminus = min(minminus, x - y);
  }
  ll ans = max(maxplus - minplus, maxminus - minminus);
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3652
int w, h;
int map[32][32];

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

int count = 0;

void solve(int x, int y)
{
    int i, nextX, nextY;
    count++;
    map[y][x] = '#';
    for (i = 0; i < 4; i++)
    {
        nextX = x + dx[i];
        nextY = y + dy[i];
        if (0 <= nextX && nextX < w && 0 <= nextY && nextY < h)
        {
            if (map[nextY][nextX] != '#')
                solve(nextX, nextY);
        }
    }
}

int main()
{
    int i, j;
    int x, y;
    while (1)
    {
        scanf("%d %d", &w, &h);
        if (w == 0 && h == 0)
            break;
        for (i = 0; i < h; i++)
        {
            for (j = 0; j < w; j++)
            {
                map[i][j] = getchar();
                if (!(map[i][j] == '.' || map[i][j] == '#' || map[i][j] == '@'))
                {
                    j--;
                    continue;
                }
                if (map[i][j] == '@')
                {
                    x = j;
                    y = i;
                }
            }
        }
        count = 0;
        solve(x, y);
        printf("%d\n", count);
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

// gcd(a,b,c,d,e,f) = gcd(gcd(a,b,c),gcd(d,e,f))

ll solve(){
  ll ans = -1;
  ll N; cin>>N;
  ll a[N]; CINA(a,N);
  
  ll L[N]; L[0] = a[0];
  ll R[N]; R[N-1] = a[N-1];
  REP(i,N-1){
    L[i+1] = gcd( L[i], a[i+1] );
  }
  REPR(i,N-2){
    R[i] = gcd( R[i+1], a[i] );
  }
  REP(i,N){
    ll temp;
    if(i==0){ temp = R[1]; }
    else if(i==N-1){ temp = L[N-2]; }
    else{ temp = gcd(L[i-1],R[i+1]); }
    if(temp>ans){ ans = temp;}
  }
  return ans;
}

int main(){
  cout << solve() <<"\n";
}




Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    long long a[n];
    for(int i=0; i<n; i++) cin >> a[i];
    long long ans = 0;
    for(int i=0; i<n-1; i++){
        if(a[i]>a[i+1]){
            ans += a[i] - a[i+1];
            a[i+1] = a[i];
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, N;
    cin >> H >> N;
    ll total = 0;
    for(int i = 0; i < N; i++)
    {
        int A;
        cin >> A;
        total += A;
    }

    if(total >= H){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


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

int main(){
    char s;
    cin>>s;
    int a = s -'a';
    char t = 'a' + a+1;
    
    
    cout << t << endl;
    
    return 0;
}



Measured memory_bytes: 256
package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)
)

func main() {
	defer writer.Flush()
	var K, S int
	fmt.Fscanf(reader, "%d %d", &K, &S)
	var count int
	for x := 0; x <= K; x++ {
		for y := 0; y <= K; y++ {
			z := S - (x + y)
			if 0 <= z && z <= K {
				count++
			}
		}
	}
	fmt.Fprintf(writer, "%d\n", count)
}


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

int main() {
  int n;
  int min = 1000000001;
  int max = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    if (tmp < min) min = tmp;
    if (tmp > max) max = tmp;
  }
  cout << (max - min) << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
MOD = 10**9+7
ans = 0
acc = 0

for i in range(N):
    ans += A[i]*acc
    ans %= MOD
    acc += A[i]
    acc %= MOD

print(ans)

Measured memory_bytes: 91112
#include <stdio.h>

void bubbleSort(int A[], int N);
void swap(int *a, int *b);

int main(){
  int N;
  int i;
  int A[100];
  int count;

  scanf("%d", &N);
  for(i = 0; i < N; i++){
    scanf("%d", &A[i]);
  }

  bubbleSort(A, N);
  return 0;
}

void bubbleSort(int A[], int N){
  int count = 0;
  int flag = 1;
  int i, j;
  while(flag){
    flag = 0;

    for(j = N-1; j >= 1; j--){
      if (A[j] < A[j-1]){
        swap(&A[j], &A[j-1]);
        flag = 1;
        count++;
      }
    }
  }

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

void swap(int *a, int *b){
  int temp;
  temp = *a;
  *a = *b;
  *b = temp;
}



Measured memory_bytes: 2068
#include <bits/stdc++.h>
#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++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;

int main()
{
  int n;
  cin >> n;
  int a[n];
  int sum = 0;
  rep(i, n){
    cin >> a[i];
    sum += a[i];
  }
  int m;
  cin >> m;
  int b[m], c[m];
  rep(i, m) cin >> b[i] >> c[i];
  
  rep(i, m){
    cout << sum - a[b[i] - 1] + c[i] << endl;
  }
    

  return 0;
}

Measured memory_bytes: 3580