akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

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

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n, m;
    cin >> n >> m;
    if(n <= 5) cout << "0\n";
    else if(n <= 12) cout << m/2 << "\n";
    else cout << m << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define PAI 3.141592

int main()
{
	double hos,x=0.0,y=0.0;
	double rad[2]={90.0};

	while(1)
	{
		scanf("%lf,%lf",&hos,rad+1);
		if(hos==0.0 && rad[1]==0.0)
			break;
		x+=hos*cos(rad[0]*PAI/180.0);
		y+=hos*sin(rad[0]*PAI/180.0);
		rad[0]-=rad[1];
				
	}

	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

Measured memory_bytes: 632
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

void OutputError(std::string s) {
  cerr << "\033[93m" << s << "\033[m" << endl;
  return;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  std::string s;
  cin >> s;
  int g = 0, p = 0;
  std::string result;
  for (int i = 0; i < s.size(); i++) {
    if (i % 2 == 0) {
      result.push_back('g');
    } else {
      result.push_back('p');
    }
  }
  int score = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == result[i]) {
      score += 0;
    } else if (s[i] == 'g') {
      score++;
    } else {
      score--;
    }
  }
  cout << score << endl;

  return 0;
}


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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	vector<int>day[100010];
	for(int i=0;i<n;i++){
		int a,b;
		cin >> a >> b;
		day[a].push_back(b);
	}
	int ans = 0;
	multiset<int,greater<int> >st;
	for(int i=1;i<=m;i++){
		for(auto it:day[i]){
			st.insert(it);
		}
		if(!st.empty()){
			auto it = st.begin();
			ans += *it;
			st.erase(it);
		}
	}
	cout << ans <<"\n";
}


Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define INF9 1000000000 //10^9
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pii=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vb=vector<bool>;
ll n,m,k,l,ans;
vll a,b;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);

    cin >> n >> l;
    ll total = 0;
    ll eat = 100000;
    rep(i,n) {
        total += l+i;
        // cout << eat << endl;
        if(abs(eat) > abs(l+i)) eat = l+i;
    }
 
    cout << (total-eat) << endl;
    return 0;
}

Measured memory_bytes: 256
/* basic header */
#include <bits/stdc++.h>
/* define */
#define ll long long
#define dou double
#define pb emplace_back
#define mp make_pair
#define sot(a,b) sort(a+1,a+1+b)
#define rep1(i,a,b) for(int i=a;i<=b;++i)
#define rep0(i,a,b) for(int i=a;i<b;++i)
#define eps 1e-8
#define int_inf 0x3f3f3f3f
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lson (curpos<<1)
#define rson (curpos<<1|1)
/* namespace */
using namespace std;
/* header end */

struct CombineSmall {
    int m;
    vector<vector<int>> F;
    CombineSmall(int n, int m): m(m), F(n) {
        for (int i = 1; i < n; i++) F[i].resize(i + 1);
    }
    int com(int n, int k) {
        return !k ? 1 : k > n ? 0 : k + k > n ? com(n, n - k) : F.at(n)[k] ? F[n][k] : F[n][k] = (com(n - 1, k) + com(n - 1, k - 1)) % m;
    }
};

int main() {
    int p; scanf("%d", &p);
    vector<int>b(p);
    CombineSmall cb(p, p);
    for (int i = 0; i < p; i++) {
        int ai; scanf("%d", &ai);
        if (!ai) continue;
        vector<int> pa(p); pa[0] = 1;
        for (int j = 1; j < p; j++) pa[j] = (ll)pa[j - 1] * i % p;
        b[0] = (b[0] + 1) % p;
        for (int j = 0; j < p; j++) {
            int cof = (ll)cb.com(p - 1, j) * pa[p - 1 - j] % p;
            if (~(p - 1 - j) & 1) cof = p - cof;
            b[j] = (b[j] + cof) % p;
        }
    }
    for (int i = 0; i < p; i++) printf("%d%c", b[i], i == p - 1 ? '\n' : ' ');
    return 0;
}

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

using namespace std;

#define INF 1000000000

struct Edge {
	int to, cap, cost, rev;
};

vector< vector<Edge> > G;

void addEdge(int from, int to, int cap, int cost) {
	G[from].push_back({to, cap, cost, (int)G[to].size()});
	G[to].push_back({from, 0, -cost, (int)G[from].size()-1});
}

typedef pair<int, int> P;

int prevV[2100], prevE[2100];
int dist[2100];
int h[2100];
int flow(int s, int t, int f) {
	int res = 0;
	int V = G.size();
	while (f > 0) {
		fill(&dist[0], &dist[0]+2100, INF);
		dist[s] = 0;
		priority_queue<P, vector<P>, greater<P> > Q; Q.push({0, s});
		while ( !Q.empty() ) {
			P p = Q.top(); Q.pop();
			int i = p.second;
			for (int j = 0; j < G[i].size(); ++j) {
				Edge& e = G[i][j];
				if (e.cap > 0 && dist[i]+e.cost+h[i]-h[e.to] < dist[e.to]) {
					dist[e.to] = dist[i]+e.cost+h[i]-h[e.to];
					prevV[e.to] = i;
					prevE[e.to] = j;

					Q.push({dist[e.to], e.to});
				}
			}
		}

		for (int i = 0; i < V; ++i) h[i] += dist[i];

		int d = f;
		for (int v = t; v != s; v = prevV[v]) {
			d = min(d, G[prevV[v]][prevE[v]].cap);
		}
		f -= d;
		res += d * h[t];
		for (int v = t; v != s; v = prevV[v]) {
			Edge& e = G[prevV[v]][prevE[v]];
			e.cap -= d;
			G[e.to][e.rev].cap += d;
		}
	}
	return res;
}

int main() {
	int N, M, L;
	while ( cin >> N >> M >> L, N || M || L ) {
		int m[100][100]; fill(&m[0][0], &m[0][0]+100*100, INF);
		for (int i = 0; i < N; ++i) {
			m[i][i] = 0;
		}
		for (int i = 0; i < M; ++i) {
			int u, v, d; cin >> u >> v >> d;
			m[u][v] = m[v][u] = d;
		}
		for (int k = 0; k < N; ++k) {
			for (int i = 0; i < N; ++i) {
				for (int j = 0; j < N; ++j) {
					m[i][j] = min(m[i][j], m[i][k] + m[k][j]);
				}
			}
		}

		int s = 2*L+1, t = s+1;
		G.clear(); G.resize(t+1);

		vector<int> p(L), time(L);
		for (int i = 0; i < L; ++i) {
			cin >> p[i] >> time[i];
		}
		for (int i = 0; i < L; ++i) {
			for (int j = 0; j < L; ++j) {
				if (i != j && time[i] + m[p[i]][p[j]] <= time[j]) {
					addEdge(L+i, j, 1, 0);
				}
			}
		}
		for (int i = 0; i < L; ++i) {
			addEdge(s, i, 1, 0);
			addEdge(L+i, t, 1, 0);
			addEdge(i, L+i, 1, -1);
		}

		int r = 0;
		fill(&h[0], &h[0]+2100, 0);
		for (int f = 1; f <= L; ++f) {
			r += flow(s, t, 1);
			if (r == -L) {
				cout << f << endl;
				break;
			}
		}
	}
}

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

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i=0; i<N; i++) cin >> a.at(i);
    int now = 0;
    for (int i=0; i<N; i++){
        now = a.at(now)-1;
        if (now == 1){
            cout << i+1 << endl;
            return 0;
        }
    }

    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll mod=1e9+7;
const ll inf=1ll<<60;

/* shift only*/

int main(){

    // 入力スタンダード（複数指定）
    int n;
    cin >> n;

    ll ai;
    ll rui = 0;
    ll minval = inf;    
    for(int i=0; i<n; i++){
        cin >> ai;
        while(ai %2 == 0){
            ai = ai/2;
            rui++;
        }
        if(minval > rui){
            minval =  rui;
        }
        rui = 0;
    }
    cout << minval << endl;
    return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
data = [list(map(int,input().split())) for i in range(M)]

A = [[] for i in range(3)]

for i in range(M):
    if data[i][0] == 1 and data[i][1] == 0 and N != 1:
        print(-1)
        exit()
    else:
        A[data[i][0]-1].append(data[i][1])

for i in range(N):
    A[i] = set(A[i])
    if len(A[i]) > 1:
        print(-1)
        exit()

B = []
for i in range(N):
    if len(A[i]) == 1:
        for s in A[i]:
            if i == 0 and s == 0 and N != 1:
                B.append(1)
            else:
                B.append(s)
    else:
        if i == 0 and N != 1:
            B.append(1)
        else:
            B.append(0)

ans = str(B[0])
for i in range(1,N):
    ans += str(B[i])

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

using ll=long long;

int main() {
  int X; cin >>X;
  string ans="No";
  if (X>=30) ans="Yes";
  cout <<ans <<endl;
  return 0;
}


Measured memory_bytes: 3636
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int DX[] = {0, 1, 0, -1};
const int DY[] = {-1, 0, 1, 0};


//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
    int N, s;
    int sum = 0;
    cin >> N;
    VI A(N);
    REP(i, N) {
        cin >> s;
        sum += s;
    }

    cout << (sum % 2 == 0 ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>

int N, B[200005];

int main() {
  std::cin >> N;
  int S = 0;
  for (int i = 0; i < N; ++i) {
    std::cin >> B[i];
    S ^= B[i];
  }

  for (int i = 0; i < N; ++i)
    std::cout << (S ^ B[i]) << " ";
  std::cout << "\n";

  return 0;
}


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

int main(void) {
  int x;
  cin >> x;
  if (400 <= x && 600 > x) {
    cout << 8 << endl;
  } else if (600 <= x && 800 > x) {
    cout << 7 << endl;
  } else if (800 <= x && 1000 > x) {
    cout << 6 << endl;
  } else if (1000 <= x && 1200 > x) {
    cout << 5 << endl;
  } else if (1200 <= x && 1400 > x) {
    cout << 4 << endl;
  } else if (1400 <= x && 1600 > x) {
    cout << 3 << endl;
  } else if (1600 <= x && 1800 > x) {
    cout << 2 << endl;
  } else if (1800 <= x && 2000 > x) {
    cout << 1 << endl;
  }
  
}

Measured memory_bytes: 3612
#include<stdio.h>

int main(void){
  int n,max,min,tmp,i,j;
  int s[5];

  for(;;){
    scanf("%d",&n);
    if(n==0)
      break;

    max=0;
    min=500;
    for(i=0;i<n;i++){
      tmp=0;
      for(j=0;j<5;j++){
	scanf("%d",&s[j]);
	tmp+=s[j];
      }
      if(tmp>max)
	max=tmp;
      if(tmp<min)
	min=tmp;
    }
    printf("%d %d\n",max,min);
  }
  return 0;
}

Measured memory_bytes: 0
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.ByteString.Char8 as B
import qualified Data.Maybe as Maybe
import qualified Data.Char as Char
import Debug.Trace
import Control.Monad

main :: IO ()
main = do
    input <- runParser parseInput <$> B.getContents
    print $ solve input

data Input = Input Int Int [Int]

parseInput :: Parser Input
parseInput = do
    k <- parseInt
    n <- parseInt
    a <- replicateM n parseInt
    return $ Input k n a

solve :: Input -> Int
solve (Input k n a) =
    let
        d1 = (k - maximum a) + minimum a
        d2 = maximum (differences a)
    in
        k - max d1 d2

differences :: [Int] -> [Int]
differences []         = []
differences [_]        = []
differences (x1:x2:xs) = (x2-x1) : differences (x2:xs)

-------------------------------------------------------------------------------

newtype Parser a =
    Parser (B.ByteString -> (a, B.ByteString))

instance Functor Parser where
    fmap f (Parser parser) =
        Parser $ \input ->
            let (v, remainder) = parser input in
                (f v, remainder)

instance Applicative Parser where
    pure v =
        Parser $ \input ->
            (v, input)

    (Parser parser1) <*> (Parser parser2) =
        Parser $ \input ->
            let
                (f, remainder1) = parser1 input
                (v, remainder2) = parser2 remainder1
            in
                (f v, remainder2)

instance Monad Parser where
    return = pure

    (Parser parser1) >>= f =
        Parser $ \input ->
            let
                (v, remainder) = parser1 input
                Parser parser2 = f v
            in
                parser2 remainder

consumeSpace :: Parser ()
consumeSpace =
    Parser $ \input ->
        ((), B.dropWhile Char.isSpace input)

lexeme :: Parser a -> Parser a
lexeme parser =
    consumeSpace *> parser

parseInt_ :: Parser Int
parseInt_ =
    Parser $ \input ->
        Maybe.fromJust (B.readInt input)

parseInt :: Parser Int
parseInt =
    lexeme parseInt_

parseChar :: Parser Char
parseChar =
    Parser $ \input ->
        Maybe.fromJust (B.uncons input)

runParser :: Parser a -> B.ByteString -> a
runParser (Parser parser) input =
    fst $ parser input

-------------------------------------------------------------------------------


Measured memory_bytes: 15740
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    s=STR()
    cnt=[0]*2019
    cnt[0]=1
    temp=0
    keta=1
    ans=0
    for i in s[::-1]:
        temp=(temp+int(i)*keta)%2019
        keta=(keta*10)%2019
        cnt[temp]+=1
    for i in cnt:
        ans+=(i*(i-1))//2
    print(ans)
    
    
if __name__ == '__main__':
    do()

Measured memory_bytes: 9304
#C
X=int(input())
while True:
    a=1
#素数判定
    for i in range(1,int(X**0.5)+1):
        if i ==1:
            continue
        elif a*i==0:
            break
        elif X%i==0:
            a=0
    if a==0:
        X=X+1
    else:
        print(X)
        break
    

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

template<typename T>
istream& operator >> (istream& istr, vector<T>& v){
    for(T& x: v) istr >> x;
    return istr;
}

template<typename T, typename U>
istream& operator >> (istream& istr, pair<T,U>& p){
    istr >> p.first >> p.second;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& v){
    if(!v.empty()){
        ostr << v.front();
        for(auto itr = ++v.begin(); itr != v.end(); itr++)
            // ostr << *itr;
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    // ostr << p.first << p.second;
    // ostr << p.first << ", " << p.second;
    ostr << "(" << p.first << ", " << p.second << ")";
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& vv){
    if(!vv.empty()){
        ostr << vv.front();
        for(auto itr = ++vv.begin(); itr != vv.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& vp){
    if(!vp.empty()){
        ostr << vp.front();
        for(auto itr = ++vp.begin(); itr != vp.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<double> vd;
// vll v(n); v[i]=x;
typedef vector<vll> vvll;
typedef vector<vc> vvc;
typedef vector<vd> vvd;
// vvll v(m,vll(n)); v[i][j]=x;
typedef pair<ll,ll> pll;
typedef pair<double,double> pd;
typedef vector<pll> vpll;
typedef vector<pd> vpd;
// vpll v(n); v[i]=make_pair(x,y); v[i].first/second;
// v.front() : v[0]
// v.back()  : v[v.size()-1]

#define PI 3.1415926535897932
#define EPS 1e-12
#define INF ((ll)1e+12)
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<=(b); i++)
#define FORR(i,a,b) for(ll i=(b); i>=(a); i--)
#define fix(x) cout << fixed << setprecision(x)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()

template<typename T> T sum(vector<T>& v){return accumulate(all(v), (T)0);}
template<typename T> inline void sort(vector<T>& v){sort(all(v));}
template<typename T> inline void rsort(vector<T>& v){sort(all(v), greater<T>());}
template<typename T> inline void chmin(T& a, T b){if(a>b) a=b;}
template<typename T> inline void chmax(T& a, T b){if(a<b) a=b;}

int main(){
    ll n, k, ans = 0;
    cin >> n >> k;

    vll a(n);
    REP(i,k){
        ll d;
        cin >> d;
        vll ai(d);
        cin >> ai;
        REP(j,d) a[ai[j]-1]++;
    }
    REP(i,n){
        if(a[i]==0) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#define vll vector<ll>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
using namespace std;

int main() {
  ll n, INF = 2000000000000000000, ans = -INF;std::cin >> n;
  vll a(n);re(i, n) std::cin >> a[i];
  vvl dp = VV(n/2+1, 3, -INF, ll);
  for(int i=1;i<=n/2;i++){
    for(int j=0;j<3;j++){
      if((i-1)*2+j>=n) continue;
      ll num = a[(i-1)*2 + j];
      for(int k=0;k<=j;k++) dp[i][j] = max({dp[i][j], dp[i-1][k] + num, (i==1?num:-INF)});
    }
  }
  for(int i=0;i<3;i++) ans = max(ans, dp[n/2][i]);
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 10016
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdlib>
#include <cmath>
#define MAX 1000000000000000000LL

using namespace std;
int main(){
    int w,a,b;
    cin>>w>>a>>b;
    if(b>=a){
        if(a+w>=b)cout<<0<<endl;
        else cout<<b-a-w<<endl;
    }
    else{
        if(b+w>=a)cout<<0<<endl;
        else cout<<a-b-w<<endl;
    }
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define found(m,x) ((m).find(x)!=(m).end())
#define uset unordered_set
#define umap unordered_map
#define db(x) cerr << #x << " == " << x << ";\n";
#define a(x) x.begin(),x.end()
#define input(v,n) for(int i=0;i<n;i++)cin>>v[i]
typedef vector<int> vi;
typedef pair<int,int> pi;

const int nax = 1e5+7;
const int mod = 1e9+7; //1e9+2667
const int inf = numeric_limits<int> :: max();
// ===================== MANASH =================== //

int n,m;

void test() {

	cin >> n;
	vector<pair<int,int>> arr;
	for(int i = 0; i < n; i++) {
		int a;
		cin >> a;
		arr.push_back({a,i+1});
	}
	sort(a(arr));

	for( auto p : arr ) {
		cout << p.second << ' ';
	}
}


signed main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);

	#ifdef LOCAL
	freopen("input.txt","r",stdin);
	cout<<"Time Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec.\n";
	#endif

	int T = 1;
	//cin >> T;
	while(T--) {
		test();
		cout << "\n";
	}
	return 0;

}

Measured memory_bytes: 1780
#include<bits/stdc++.h>
using namespace std;
vector<int> sum;
vector<int> arr;
// mid -> 次数
//   i -> 一次几个
bool ok(int mid,int i){
	int id = lower_bound(arr.begin(),arr.end(),mid) - arr.begin();
    int left = id-1<0 ? 0: sum[id-1];
	int ct = arr.size() - id;
    ct += left/mid;
	if(ct>=i){
		return true;
	}
	return false;
}

void solve(int i){
	int l = 0;
	int r = arr.size()/i;
    
	while(l < r){
        //cout<<l<<" "<<r<<endl;
		if(r == l+1){
			if(ok(r,i)){
				l = r;
				break;
			}else{
              	r = l;
                break;
            }
		}

		int mid = (r+l)/2;
		if(ok(mid,i)){
			l = mid;
		}else{
			r = mid - 1;
		}
	}

	cout<<l<<endl;
	return ;
}

int main(){
	int n;cin>>n;
	arr = vector<int>(n);
	for(int i=0;i<n;++i){
		int curr;cin>>curr;
		arr[curr-1]++;
	}
	sort(arr.begin(),arr.end());
	sum = arr;
	for(int i=1;i<n;++i){
		sum[i] += sum[i-1];
	}
  //for(auto i:arr)cout<<i<<" ";cout<<endl;
  //for(auto i:sum)cout<<i<<" ";cout<<endl;
	for(int i=1;i<=n;++i){
		solve(i);
	}
	return 0;
}

Measured memory_bytes: 3328
#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;
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); (i)++)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) (x.begin(), x.end())

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int a, b;
    cin >> a >> b;
    if(a & 1 && b & 1) Yes();
    else No();
    
}

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

#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define LL long long

using namespace std;


const int maxn = 200005;
LL A[maxn];
LL sum[maxn];
LL xors[maxn];
int N;

LL get_sum(int l,int r){
    if(l){
        return sum[r] - sum[l-1];
    }
    else return sum[r];
}

LL get_xor(int l,int r){
    if(l){
        return xors[r]^xors[l-1];
    }
    else return xors[r];
}

int main()
{
    scanf("%d",&N);
    _for(i,0,N){
        scanf("%lld",&A[i]);
        if(i){
            sum[i] = A[i] + sum[i-1];
            xors[i] = A[i] ^ xors[i-1];
        }
        else{
            sum[i] = A[i];
            xors[i] = A[i];
        }
    }
    LL val = 0;

    int pl = 0;
    int pr = 0;
    while(pl < N){
        while(pr < N){
            if(get_xor(pl,pr) != get_sum(pl,pr)) break;
            pr++;
        }
        val += pr-pl;
        pl++;
    }


    printf("%lld\n",val);


    return 0;
}


Measured memory_bytes: 4992
//////////////////////
        	//******************//
			//**  OM THUMMAR  **//
			//**  DA-IICT     **//
			//**  201901070   **//
			//**  I'D=Aom2608 **//
			//******************//
			/////////////////////

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<long long,long long> > vpll;


#define PI 3.141592653589793
#define MOD 1000000007



int main()
{
	IOS;
	ll n,k;
	cin>>n>>k;
	map<ll,ll>  m;
	ll count=0;
	for(ll i=0;i<k;i++)
	{
		ll d;
		cin>>d;
		for(ll j=0;j<d;j++)
		{
			ll p;
			cin>>p;
			m[p]++;
		}
	}
	for(ll i=1;i<=n;i++)
	{
		if(m[i]==0)
		{
			count++;
		}
	}
	cout<<count;
}





Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
typedef long long ll;
using namespace std;

int main() {
    ll N, K; cin >> N >> K;
    map<ll, ll> mp;
    for (int i = 0; i<N; i++) {
        ll a, b; cin >> a >> b;
        mp[a] += b;
    }
    
    for(auto it : mp) {
        K -= it.second;
        if (K <= 0) {
            cout << it.first << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 4224
//by Top1
#include <bits/stdc++.h>
          
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
      
const int inf = (1e18) + 1;
const int mod = 479001599;
const int maxn = 5e5 + 111;
        
using namespace std;          

int n, a[maxn];

void solve(){                 
	cin >> n;           

	if (n % 2 == 1){
		cout << 0;
		return;
	}

	int x = 10, ans = 0, k = 5;

	for (int i = 1; i <= 24; i++){
		ans += n / x + n / (k * 10) - n / (x * 10);
		x *= 10;
		k *= 5;
	}

    cout << ans;                                                                             
}                              
      
main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

    boost;
    
    int q = 1;
 
    //cin >> q;
    
    while (q--){
        solve();
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
#define MOD 1000000007
long long n;
void solve()
{
    long long i,j,a[n+1],b[n+1],ans=0;
    for (i=1;i<=n;i++)
    {
        cin>>a[i];
        a[i]%=MOD;
    }
    a[0]=0;
    sort(a+1,a+n+1);
    for (i=0;i<=n;i++)
        b[i]=a[i];
    for (i=2;i<=n;i++)
        b[i]=(b[i-1]+b[i])%MOD;
    for (i=1;i<n;i++)
        ans=((ans+((MOD+b[n]-b[i])%MOD)*a[i])%MOD)%MOD;
    cout<<ans<<endl;
}
int main()
{
    while(cin>>n)
        solve();
}

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

int main() {
  
  double a,b,x;
  cin >> a >> b >> x;

  cout << fixed << setprecision(10);
  
  if(x <= a*a*b/2) {
    cout << atan(a*b*b/(2*x))*180/M_PI << endl;
  }else {
    cout << atan(2*(b-x/(a*a))/a)*180/M_PI << endl;
  }
  
}


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

int a[110];

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

	int n;
	cin >> n;

	for(int i = 0; i < n; ++i){
		cin >> a[i];
		cout << a[i];
		if(i != n - 1)
			cout << " ";
		else
			cout << endl;
	}

	for(int i = 1; i < n; ++i){
		int v = a[i];
		int j = i - 1;
		while(j >= 0 && a[j] > v){
			a[j + 1] = a[j];
			--j;
		}
		a[j + 1] = v;

		for(int k = 0; k < n; ++k){
			cout << a[k];
			if(k != n - 1)
				cout << " ";
			else
				cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1192
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll roundd(ll x,ll n){
  if(x>n){return x%n;}
  else if(x<0){return x%n+n;}
  else return x;
}

int main(){
  ll n;string s,t;cin>>n>>s>>t;
  vb d(0);
  rep(i,0,n){
    if(s[i]==t[i]){d.push_back(1);}
    else{d.push_back(0);i++;}
  }
  ll ans;
  if(d[0]){ans=3;}
  else{ans=6;}
  rep(i,0,d.size()-1){
    if(d[i+1]&&d[i]){ans*=2;}
    else if(!d[i+1]&&d[i]){ans*=2;}
    else if(!d[i+1]&&!d[i]){ans*=3;}
    ans%=MOD;
  }
  cout<<ans<<endl;
}



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

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << '\n'; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) std::cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << '\n';
}

int main() {
    Int l, r;
    cin >> l >> r;
    Int res = INF;
    for (Int i = l; i <= min(l + 2019, r); i++) {
        for (Int j = i + 1; j <= min(l + 2019, r); j++) {
            Int x = i % 2019;
            Int y = j % 2019;
            res = min(res, x * y % 2019);
        }
    }
    print(res);
    return 0;
}


Measured memory_bytes: 3672
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <deque>
#include <string.h>
#include <math.h>

using namespace std;

#define PI 4.0*atan(1.0)
#define epsilon 0.000000001
#define INF 1000000000000000000
#define MOD 1000000007

int N, fennecReach, snukeReach, fennecCount = 0, snukeCount = 0;
vector<int> adjacency [100010], pathy;
bool killAll = false, fennecTurn = true;

void recurse(int curr, int prevy){
    if(curr == N){
        pathy.push_back(N); killAll = true;
        return;
    }
    for(int nexty : adjacency[curr]){
        if(nexty == prevy) continue;
        pathy.push_back(curr);
        recurse(nexty, curr);
        if(killAll) return;
        pathy.pop_back();
    }
}

void countFennec(int curr, int prevy){
    fennecCount++;
    for(int nexty : adjacency[curr]){
        if(nexty == prevy || nexty == snukeReach) continue;
        countFennec(nexty, curr);
    }
}

void countSnuke(int curr, int prevy){
    snukeCount++;
    for(int nexty : adjacency[curr]){
        if(nexty == prevy || nexty == fennecReach) continue;
        countSnuke(nexty, curr);
    }
}

int main(){
    //freopen("necklace.in", "r", stdin); freopen("necklace.out", "w", stdout);
    scanf("%d", &N);
    for(int i = 0; i < N-1; i++){
        int a, b; scanf("%d %d", &a, &b);
        adjacency[a].push_back(b); adjacency[b].push_back(a);
    }
    recurse(1, 0); fennecReach = 0; snukeReach = pathy.size()-1;
    while(true){
        if(fennecTurn){
            if(fennecReach+1 == snukeReach) break;
            fennecReach++;
        }
        else{
            if(snukeReach-1 == fennecReach) break;
            snukeReach--;
        }
        fennecTurn = !fennecTurn;
        //cout << fennecReach << " " << snukeReach << endl;
    }
    fennecReach = pathy[fennecReach]; snukeReach = pathy[snukeReach];
    countFennec(1, 0); countSnuke(N, 0);
    if(fennecCount > snukeCount) printf("Fennec\n");
    else printf("Snuke\n");
    return 0;
}


Measured memory_bytes: 12536
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;

int main(int argc, const char * argv[]) {
     
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int l, r; cin >> l >> r;
    
    int lm = l % 2019;
    set<int> st;
    st.insert(lm);
    int cnt = 1;
    while (cnt < 2019 && cnt < r - l + 1) {
        lm++; lm %= 2019;
        st.insert(lm);
        cnt++;
    }
    
    int ans = 2020;
    
    for (int i : st) {
        for (int j : st) {
            if (i == j) continue;
            int temp_ans = i * j % 2019;
            ans = min(ans, temp_ans);
        }
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<vector>
#include<queue>
using namespace std;
const int INF = 1000000000;
typedef pair<int, int> P;
struct edge { int to, cost; };

int n, k, i1, i2, i3, i4;

vector<edge> G[100];
priority_queue<P, vector<P>, greater<P> > que;
int d[100][100];
int nowNum;
bool recheck = true;
bool checked[100];

void dijkstra() {
  for (int i = 0; i < n; i++) d[nowNum][i] = INF;
  d[nowNum][nowNum] = 0;
  que.push(P(0, nowNum));
  while (!que.empty()) {
    P q = que.top(); que.pop();
    int cost = q.first, from = q.second;
    if (d[nowNum][from] < cost) continue;
    for (int i = 0; i < G[from].size(); i++) {
      edge e = G[from][i];
      int newCost = cost + e.cost, newTo = e.to;
      if (d[nowNum][newTo] > newCost) {
        d[nowNum][newTo] = newCost;
        que.push(P(newCost, newTo));
      }
    }
  }
}

int main() {
  while (1) {
    scanf("%d%d", &n, &k);
    if (n == 0) break;
    for (int i = 0; i < k; i++) {
      scanf("%d", &i1);
      if (i1 == 1) {
        scanf("%d%d%d", &i2, &i3, &i4);
        i2--; i3--;
        recheck = true;
        edge e1, e2;
        e1.to = i3, e2.to = i2, e1.cost = e2.cost = i4;
        G[i2].push_back(e1);
        G[i3].push_back(e2);
      } else {
        scanf("%d%d", &i2, &i3);
        i2--; i3--;
        if (recheck) {
          for (int i = 0; i < n; i++) checked[i] = false;
        }
        recheck = false;
        if (checked[i2]) {
          printf("%d\n", d[i2][i3]);
        } else if (checked[i3]) {
          printf("%d\n", d[i3][i2]);
        } else {
          nowNum = i2;
          dijkstra();
          if (d[i2][i3] == INF) d[i2][i3] = -1;
          printf("%d\n", d[i2][i3]);
        }
      }
    }
    for (int i = 0; i < n; i++) G[i].clear();
  }
}



Measured memory_bytes: 2672
N, M = gets.split.map(&:to_i)
MOD = (1E9 + 7).to_i

class Integer
  def !
    (2 .. self).inject(1){|p, i| p * i % MOD}
  end
end

n, m = [N, M].minmax
puts case m
     when n + 1; (n.! * m.!) % MOD
     when n; (n.! * m.! * 2) % MOD
     else; 0
end

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

int main(){
    
    vector<string> vec{"AC","WA","TLE","RE"};
    vector<ll> counts(4);
    ll n;
    cin >> n;
    for(ll i=0; i<n; ++i){
        string si;
        cin >> si;
        for(int j=0; j<4; ++j){
            if(equal(si.begin(),si.end(),vec[j].begin())){
                counts[j]++;
            }
        }        
    
    }
    for(int i=0; i<4; ++i){
    for(auto ch:vec[i] ){
        cout << ch;
    }
    cout << " " << "x " << counts[i] << '\n';
    }


	return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <math.h>
 
int main(void) {
    int n;
    double x[2], y[2], r[2];
    double d;
    int i;
 
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%lf %lf %lf %lf %lf %lf", &x[0], &y[0], &r[0], &x[1], &y[1], &r[1]);
        d = sqrt( (x[1]-x[0])*(x[1]-x[0]) + (y[1]-y[0])*(y[1]-y[0]) );
        if (d > r[0]+r[1])
            printf("0\n");
        else if (d < r[0]-r[1])
            printf("2\n");
        else if (d < r[1]-r[0])
            printf("-2\n");
        else
            printf("1\n");
    }
    return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int main(){
	
	int X,Y;
	cin>>X>>Y;
	
	if(X%Y==0){
		cout<<-1<<endl;
	}
	else{
		cout<<X<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int x[100]={0},y[100]={0};
	long long h[100]={0};
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>x[i]>>y[i]>>h[i];
	if(n==1)
	{
		cout<<x[0]<<" "<<y[0]<<" "<<h[0];
		return 0;
	}
	int cx,cy;
	long long H,temp;
	for(int cx=0;cx<=100;cx++)
	{
		for(int cy=0;cy<=100;cy++)
		{
			for(int i=0;i<n;i++)
			{
				if(h[i]==0)
					continue;
				else
				{
					H=h[i]+((x[i]-cx)>0?x[i]-cx:cx-x[i])+((y[i]-cy)>0?y[i]-cy:cy-y[i]);
					break;
				}
			}
			for(int i=0;i<n;i++)
			{
				temp=H-((x[i]-cx)>0?x[i]-cx:cx-x[i])-((y[i]-cy)>0?y[i]-cy:cy-y[i]);
				if(temp<0)
					temp=0;
				if(h[i]!=temp)
					break;
				if(i==n-1)
				{
					cout<<cx<<" "<<cy<<" "<<H;
					return 0;
				}
			}
		}
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>

int main() {
 int n,a=0;
 scanf("%d",&n);
 for(int i=1;i<=n;i++)if((int)log10(i)%2==0)a++;
 printf("%d\n",a);
 return 0;

}


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

using namespace std;

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{

    while (1)
    {
        int n;
        double m, a = 0, ans, sum = 0;
        cin >> n;
        if (n == 0)
            break;

        vector<int> s(n);
        rep(i, n) cin >> s[i];

        rep(i, n) sum += s[i];
        m = sum / n;

        rep(i, n) a += pow(s[i] - m, 2) / n;

        ans = sqrt(a);
        cout << fixed << setprecision(6) << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3296
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] arg) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int k = Integer.parseInt(scan.next());
        scan.nextLine();
        List<Integer> hList = Arrays.stream(scan.nextLine().split(" "))
                .map(Integer::parseInt).sorted((x, y) -> y - x).collect(Collectors.toList());

        long count = 0;
        for(int i=0; i<hList.size(); i++) {
            if(k > 0) {
                k--;
                continue;
            }
            count += hList.get(i);
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 79616
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int n,fig,x,y;
bool used[16][16];
int mas[16][16];

bool check(){
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)
      if(!used[i][j]) return true;
  }
  return false;
}

void Over_R(); void Over_L(); void Over_U();

void Over_R(){
  x = 0;
  while(used[y][x]){
    y++; x--;
    if(x < 0) Over_L();
    if(y >= n) Over_U();
  }
}

void Over_L(){
  x = n-1;
  while(used[y][x]){
    y++; x--;
    if(x < 0) Over_L();
    if(y >= n) Over_U();
  }
}

void Over_U(){
  y = 0;
  while(used[y][x]){
    y++; x--;
    if(x < 0) Over_L();
    if(y >= n) Over_U();
  } 
}

int main(){
  while(cin >> n,n){
    memset(used,false,sizeof(used));
    fig = 2;
    x = n/2; y = n/2 + 1;
    mas[y][x] = 1; used[y][x] = true;
    while(check()){
      x++; y++;
      if(x >= n) Over_R();
      if(y >= n) Over_U();
      while(used[y][x]){
	x--; y++;
	if(x < 0) Over_L();
	if(y >= n) Over_U();
      }
      mas[y][x] = fig;
      fig++; used[y][x] = true;
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++) printf("%4d",mas[i][j]);
      cout << endl;
    }
  }
}

Measured memory_bytes: 1192
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    string a, b;
    cin >> a >> b;

    if (a.size() > b.size()) {
        cout << "GREATER" << endl;
    } else if (a.size() < b.size()) {
        cout << "LESS" << endl;
    } else {
        if (a > b) {
            cout << "GREATER" << endl;
        } else if (a < b) {
            cout << "LESS" << endl;
        } else {
            cout << "EQUAL" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>
#include <list>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
//#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))
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; }

using namespace std;

int main(void)
{
    int K; cin >> K;
    int A, B; cin >> A >> B;
    bool flag = false; 
    rep(i, 1, B / K + 1) {
        if (A <= K * i && K * i <= B) {
            flag = true;
            break;
        }
    }
   
    cout << (flag ? "OK" : "NG") << endl;


    return 0;
}


Measured memory_bytes: 3632
import java.util.*;
public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();
        int n = s.length();
        int count=0;

        if(s.charAt(0) != 'A') {
            System.out.println("WA");
            return;
        }

        if(Character.isUpperCase(s.charAt(1))) {
            System.out.println("WA");
            return;
        }

        if(Character.isUpperCase(s.charAt(n-1))) {
            System.out.println("WA");
            return;
        }


        for(int i = 2;i < n-1;i++){
           // System.out.println(s.charAt(i));
            if(Character.isUpperCase(s.charAt(i))) {
                if (s.charAt(i) == 'C')
                    count++;
                else {
                    System.out.println("WA");
                    return;
                }
            }

        }

        System.out.println(count==1?"AC":"WA");


    }
}

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

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

    int n, m;
    long long total_votes = 0;
    vector<int> a(1000);
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        total_votes += a[i];
    }
    double bar = total_votes/(4.0*m);
    sort(a.rbegin(), a.rend());
    for (int i = 0; i < m; i++) {
        if (a[i] < bar) {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
  
using namespace std;

int main() {
	int n;
	cin >> n;
	int t [ n + 1 ], x [ n + 1 ], y [ n + 1 ];
	t [ 0 ] = 0; x [ 0 ] = 0; y [ 0 ] = 0;
	REP1(i,n+1) {
		cin >> t [ i ] >> x [ i ] >> y [ i ];
	}
	
	REP(i,n) {
		int k = t [ i+1 ] - t [ i ];
		int d = abs ( x [ i ] - x [ i+1 ] ) + abs ( y [ i ] - y [ i+1 ] );
		if ( d > k || k%2 != d%2 ) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;	
}

Measured memory_bytes: 1408
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    a, b = i_map()

    print(a*b)
            
if __name__ == '__main__':
    main()


Measured memory_bytes: 68356
// AtCoder Beginner Contest 148 D.cpp

#include <iostream>

using namespace std;

int main()
{
	int n, a, ct = 1, an = 0;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a == ct) {
			ct++;
		}
		else {
			an++;
		}
	}

	if (n == an)
		an = -1;

	cout << an << endl;
}

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

#include <fstream>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <iomanip>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

#define gap                        ' '
#define EPS                        1e-9
#define P_INF                      2e9+17
#define N_INF                     -2e9-17
#define MOD                        1000000007
#define PI                         2*acos(0.0)
#define All(x)                     x.begin(),x.end()
#define Mem(Name, type)            memset(Name, type, sizeof(Name))

template<typename T>
T GCD(T a, T b) { return a ? GCD(b % a, a) : b; }

template<typename T>
T LCM(T a, T b) { return (a * b) / GCD(a, b); }

template<typename T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &v) {
    for (auto ob : v) os << ob << " ";
    return os;
}

template<typename T, typename S>
std::ostream &operator<<(std::ostream &os, const std::map<T, S> &v) {
    for (auto ob : v) os << ob.first << " : " << ob.second << std::endl;
    return os;
}

using ld = double;
using ll = long long int;
using ul = unsigned long long int;
using namespace std;

class CStep {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n;
        in >> n;
        int a[n];
        for (int i = 0; i < n; ++i) {
            in >> a[i];
        }
        ll sum = 0;
        int now = a[0];
        for (int i = 0; i < n; ++i) {
            if (a[i] - now < 0) {
                sum += now - a[i];
            } else {
                now = a[i];
            }
        }
        out << sum << endl;
    }
};


int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    CStep solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 4432