akhauriyash/Code-Regression huggingface dataset:
x  = int(input())

line  = [int(y) for y in input().split()]
line.sort()

yeet  = 1
solved  = False

if line[0] == 0:
    print(0)
else:
    for i in range(0,x):
        yeet = yeet*line[i]
        if yeet > 10**18:
            solved = True
            print(-1)
            break

    if solved == False:
        print(yeet)

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n,k,q; cin >> n >> k >> q;
  vector<int> a(q); rep(i,q) cin >> a[i];
  vector<int> score(n+1,k);

  rep(i,q)
    score[a[i]]++;

  for(int i = 1;i<=n;i++){
    score[i] -= q;
    if(score[i]<=0) cout << "No" << endl;
    else cout << "Yes" << endl;
  }
  
  /*rep(i,q){
    for(int j = 1;j<=n;j++){
      if(j==a[i]) continue;
      score[j]--;
    }
  }
  for(int i = 1;i<=n;i++){
    if(score[i]<=0) cout << "No" << endl;
    else cout << "Yes" << endl;
  }
  */
  return 0;
}


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

int main()
{
    int n,m;

    cin >> n >> m;
    vector<int> ac(n),wa(n);
    rep(i, m) {
        int p;
        string s;
        cin >> p >> s;
        --p;
        if (s == "AC") {
            if (ac[p] == 0)
                ++ac[p];
        }
        else {
            if (ac[p] == 0)
                ++wa[p];
        }
    }
    int seito = 0;
    int pena = 0;
    rep(i, n) {
        if (ac[i] > 0) {
            ++seito;
            pena += wa[i];
        }
    }

    //結果
    std::cout << seito << " " << pena << endl;
}


Measured memory_bytes: 3956
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
import sys
inf = 10**9+7
mod = 10**9+7

a,b,c,x,y = map(int, input().split())
ans = a*x + b*y
if a < b:
    a,b = b,a
    x,y = y,x
if x > y:
    ans = min(a*x + b*y, 2*c*y + min(2*(x-y)*c, a*abs(x-y)))
else:
    ans = min(a*x + b*y, 2*c*x + min(2*(y-x)*c, b*abs(x-y)))
print(ans)

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

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

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


def main():
    s = S()
    r = inf
    for i in range(len(s)-2):
        t = abs(753-int(s[i:i+3]))
        if r > t:
            r = t

    return r


print(main())


Measured memory_bytes: 7756
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();

    sc.close();

    int count = b - a;
    
    int h = 0;

    for (int i = 1; i <= count; i++) {
      h += i;
    }
    
    System.out.println(h - b);
    
  }

}

Measured memory_bytes: 21588
L = list(map(int, input().split()))
L = sorted(L)
A = L[0]
B = L[1]
C = L[2]
cnt = 0
while A < B-1:
    cnt += 1
    A += 2
if A == B:
    cnt += (C-A)
else:
    cnt += (C-A+1)
print(cnt)

Measured memory_bytes: 38384
import java.util.*;

public class Main{

    public static void main(String args[]){

        // スキャナーの宣言
        Scanner sc = new Scanner(System.in);
        // 整数の入力
		int a = sc.nextInt();
        // スペース区切りの整数の入力
        int b = sc.nextInt();
        int c = sc.nextInt();
        int ans = Math.min(a+b, Math.min(a+c, b+c));

        // 出力
        System.out.println(ans);

    }

}

Measured memory_bytes: 22356
import numpy as np

n,m = map(int,input().split())
arr = np.array([list(map(int,input().split())) for i in range(m)])
arr = arr[ arr[:,1].argsort(), :] #各行の1列目だけみて、行インデックスをソート
A = arr.T[0]
B = arr.T[1]

ans = 0
start,end = 0,0
for a,b in zip(A,B):
    if a < end: continue
    start,end = a,b
    ans += 1

print(ans)




Measured memory_bytes: 37920
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
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);
    }
}
#pragma endregion

int main()
{
    string s;
    cin >> s;
    if (s == "AAA" || s == "BBB")
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int main() {

	int n, k;
	ll x[50], y[50];
	ull ans = INF;

	cin >> n >> k;

	rep(i, n) {
		cin >> x[i] >> y[i];
	}

	rep(a, n) {
		rep(b, n) {
			rep(c, n) {
				rep(d, n) {
					ll lx = min(min(x[a], x[b]), min(x[c], x[d]));
					ll rx = max(max(x[a], x[b]), max(x[c], x[d]));
					ll uy = max(max(y[a], y[b]), max(y[c], y[d]));
					ll by = min(min(y[a], y[b]), min(y[c], y[d]));
					int c = 0;
					if (lx != rx && uy != by) {
						rep(e, n) {
							ll px = x[e], py = y[e];
							if (lx <= px && px <= rx && by <= py && py <= uy) {
								c++;
							}
						}
						if (c >= k) {
							if (ans == INF) {
								ans = (ull)(rx - lx)*(uy - by);
							}
							else {
								ans = min(ans, (ull)(rx - lx)*(uy - by));
							}
						}
					}
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main() {
  int a,b,c;
  int flag = 0;

  cin >> a >> b;

  if(a%2 ==0 || b%2 ==0){
    flag =1;
  }

  if(flag == 1){
    cout << "Even" << endl;
  }else{
    cout << "Odd" << endl;    
  }

}


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

const int N = 1e5 + 10 ;

int n, m ;

int a[N] ;

int sl[N] ;

long long S[N] ;

int FindShortestPath(int foo, int bar) {
	return (foo <= bar) ? bar - foo : bar + m - foo ;  
}

int main(){
	#define NAME "HSG10B" 
	//freopen(NAME".inp", "r", stdin) ; freopen(NAME".out", "w", stdout) ;

	cin >> n >> m ;

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

	long long sum = 0 ;
	
	for (int i = 1; i < n; ++ i) sum += 1ll * FindShortestPath(a[i], a[i + 1]) ;

	for (int i = 1; i < n; ++ i) {
		if (a[i] == a[i + 1]) continue ;
		long long foo = 1ll * FindShortestPath(a[i], a[i + 1]) ;
		if (a[i] < a[i + 1]) {
			foo += -1ll * (a[i + 1] + 1) ;
			sl[a[i] + 1] ++ ; sl[a[i + 1] + 1] -- ;
			S[a[i] + 1] += foo ; S[a[i + 1] + 1] -= foo ;
		}
		else {
			sl[a[i] + 1] ++ ; sl[1] ++ ; sl[a[i + 1] + 1] -- ;
			S[a[i] + 1] += foo - 1ll * (a[i + 1] + m + 1) ;
			S[1] += foo - 1ll * (a[i + 1] + 1) ;
			S[a[i + 1] + 1] -= foo - 1ll * (a[i + 1] + 1) ;
		}
	}	

	long long best = 0 ;

	for (int i = 1; i <= m; ++ i) {
		sl[i] += sl[i - 1] ; S[i] += S[i - 1] ;
		best = max(best, S[i] + 1ll * sl[i] * i) ;
	}

	cout << sum - best << endl ;

	return 0 ;
}

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

int main() {
	long long s,s1,i,j,k,ans=0,cur=0,res=0;

	cin >> s;
	s1=ceil(sqrt(s));
	cur=s1*s1-s;
	if(cur<0){
		s1++;
		cur=s1*s1-s;
	}
	
	for(i=floor(sqrt(cur)); i>=1; i--){
		if(cur%i==0) break;
	}
	if(i!=0){
    	j=cur/i;
	}else{
		j=0;
	}
	printf("%d %d %d %d %d %d",0,0,s1,i,j,s1);
	

}

Measured memory_bytes: 256
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <iostream>
#include <sstream>
#include <random>
#include <cmath>
#include <cstring>
using namespace std;
#define U(v) cerr << #v << ": " << (v) << endl

class timer {
    vector<timer> timers;
    int n = 0;
public:
    double limit = 9.8;
    double t = 0;
    timer() {}
    timer(int size) : timers(size) {}
    bool elapses() const {
        return time() - t > limit;
    }
    void measure() {
        t = time() - t;
        ++n;
    }
    void measure(char id) {
        timers[id].measure();
    }
    void print() {
        if (n % 2)
            measure();
        for (int i = 0; i < 128; ++i) {
            if (timers[i].n)
                cerr << (char)i << ' ' << timers[i].t << 's' << endl;
        }
        cerr << "  " << t << 's' << endl;
    }
    static double time() {
#ifdef LOCAL
        return __rdtsc() / 3.3e9;
#else
        unsigned long long a, d;
        __asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
        return (d << 32 | a) / 2.8e9;
#endif
    }
} timer(128);

class {
    unsigned y = random_device()();
public:
    unsigned next() {
        return y ^= (y ^= (y ^= y << 13) >> 17) << 5;
    }
    int next(int b) {
        return next() % b;
    }
    int next(int a, int b) {
        return next(b - a) + a;
    }
    double nextDouble(double b = 1) {
        return b * next() / 4294967296.0;
    }
    double nextDouble(double a, double b) {
        return nextDouble(b - a) + a;
    }
    int operator() (int b) {
        return next(b);
    }
} rando;

int main() {
    int a, b;
    while (cin >> a >> b) {
        if (a + b == 15)
            cout << '+' << endl;
        else if (a * b == 15)
            cout << '*' << endl;
        else
            cout << 'x' << endl;
    }
    return 0;
}


Measured memory_bytes: 888
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl
#define NL <<"\n"

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "../benri.h"
#else
#define out
#endif
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
const ll MOD=1e9+7; //998244353

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout<<fixed<<setprecision(0);
	ll s;
	cin>>s;
	ll d=1000000000;
	ll a=(s+d-1)/d;
	ll b=1;
	ll c=a*d-s;
	assert(a*d-b*c==s);
	cout<<"0 0 "<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
  return 0;
}


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


int main(){
  string s;
  int count[3] = {};
  cin >> s;
  for(auto ch: s){
++count[ch - 'a'];
  }
  if(count[0] == 1 && count[1] == 1 && count[2] == 1){
cout << "Yes" << endl;
  }else{
cout << "No" << endl; 
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;
#define int long long
signed main() {
    int N;
	cin >> N;
	vector<int> vec(N);
	for(int i = 0;i < N;i++) {
		cin >> vec.at(i);
	}
	vector<int> count(N + 1);
	map<int,int> ma;
	count.at(0) = 0;
	for(int i = 0;i < N;i++) {
		count.at(i + 1) = count.at(i) + vec.at(i);
	}
	for(int i = 0;i < N + 1;i++) {
		ma[count.at(i)]++;
	}
	int answer = 0;
	for(auto x : ma) {
		auto value = x.second;
		answer += value * (value - 1) / 2;
	}
	cout << answer << endl;
}

Measured memory_bytes: 15872
n = int(input())
S = [input() for _ in range(n)]

ans = ''
alph = 'abcdefghijklmnopqrstuvwxyz'
for i, ch in enumerate(alph):
    cnt = 10e9
    for ss in S:
        cnt = min(cnt,ss.count(ch))
    ans += ch*cnt

print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S,T;
  cin >> S >> T;
  int s=S.size();
  bool ans=false;
  for (int i=0;i<s;i++){
    if (S==T){
      ans=true;
      break;
    }
    else {
      char x=S[s-1];
      S.pop_back();
      S=x+S;
    }
  }
  if (ans){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int N;
vector<i64> A;

int main(){
  cin >> N;
  A.resize(N);
  rep(i,0,N - 1){
    cin >> A[i];
  }
  i64 S = 0;
  int r = 0;
  i64 ans = 0;
  for(int l = 0;l < N;l++){
    while(r < N && !(S & A[r])){
      S |= A[r];
      r++;
    }
    ans += r - l;
    S = S & (~A[l]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
#include <iomanip>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
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; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
//template< typename T >
//T mod_pow(T x, T n, const T &p) {
//  T ret = 1;
//  while(n > 0) {
//    if(n & 1) (ret *= x) %= p;
//    (x *= x) %= p;
//    n >>= 1;
//  }
//  return ret;
//}
/////////////////// 
//

#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
#define mp make_pair
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
//
//
//

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  int a,b;
  cin >> a >> b;
  if(a+b==15) pri("+");
  else if(a*b==15) pri("*");
  else pri("x");
  return 0;
}







Measured memory_bytes: 256
#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 <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846


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(); }

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

//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 MT make_tuple
#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())
#define FILL(a, x) memset(a, x, sizeof(a))

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int main() {
	int n, m;
	cin >> n >> m;
	UnionFind uf(n);
	REP(i, m) {
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		x--, y--;
		uf.unionSet(x, y);
	}
	int ret = 0;
	REP(i, n)if (uf.root(i) == i)ret++;
	cout << ret << endl;
	return 0;
}

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

int main() {
	char c;
	cin >> c;
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
    	cout << "vowel" << endl;
    }else{
    	cout << "consonant" << endl;
    }
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        k: usize
    }
    if k == 1 {
        println!("1");
        println!("1");
    } else {
        let n = (k + 3) / 4 * 2;
        println!("{}", n);
        for i in 0..n {
            if i % 2 == 0 {
                print!("{}", i + 1);
                for j in 1..n {
                    print!(" {}", (i + j) % n + 1);
                }
            } else {
                print!("{}", if i + n + 1 > k {i + 1} else {i + n + 1});
                for j in 1..n {
                    let t = (i + j) % n + n + 1;
                    print!(" {}", if t > k {t - n} else {t});
                }
            }
            println!("");
        }
    }
}


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

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using P = pair<int, int>;

template <class T>
bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    } else {
        return false;
    }
}
template <class T>
bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    } else {
        return false;
    }
}

template <class T>
void dump_vec(const vector<T>& v) {
    auto len = v.size();
    rep(i, 0, len) {
        cout << v[i] << (i == (int)len - 1 ? "\n" : " ");
    }
}

struct FastIO {
    FastIO() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} FASTIO;

//---------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------

signed main() {
    string s;
    cin >> s;
    bool ok = s[2] == s[3] && s[4] == s[5];
    cout << (ok ? "Yes" : "No") << "\n";
}


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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> dp(N+1); 

    dp[0] = 0;
    int tmp;
    for(int i = 1; i <= N; i++){
        int min = 100000000;
        tmp = dp[i-1];

        int base6 = 1;
        while(base6*6 <= i){
           base6 *= 6;     
           if(dp[i-base6] < tmp)   
               tmp = dp[i-base6];
        }

        int base9 = 1;
        while(base9*9 <= i){
           base9 *= 9;     
           if(dp[i-base9] < tmp)   
               tmp = dp[i-base9];
        }

        dp[i] = tmp + 1;

    }
    
    cout << dp[N] << endl;

    return 0;
}


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

int main() {
  long long W, H, x, y, multi;
  cin >> W >> H >> x >> y;

  if (x * 2 == W && y * 2 == H)
    multi = 1;
  else
    multi = 0;

  cout << setprecision(6) << fixed << W * H / 2.0 << ' ' << multi << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int x;
    cin >> x;
    cout << (x<1200?"ABC":"ARC") << '\n';

}


Measured memory_bytes: 3588
#include<stdio.h>
#define N 500000
#define INFTY 1000000000

int n;
int cnt=0;
int L[N/2+2], R[N/2+2];

void merge(int A[], int left,int  mid, int right){
    int n1 = mid-left;
    int n2 = right-mid;
    
    int i,j=0;
    //L[0...n1], R[0...n2] を生成
    for (i=0; i<n1; i++){
         L[i]=A[left+i];
    }
    for(i=0; i<n2; i++){
        R[i]=A[mid+i];
    }
    L[n1]=INFTY;
    R[n2]=INFTY;
    i=0;j=0;
    for(int k=left; k<right; k++){
        cnt++;
        if(L[i]<=R[j]){
            A[k]=L[i];
            i++;
        }
        else{
            A[k]=R[j];
            j++;
        }
            }
    
}

void mergeSort(int A[],int left,int right){
    if(left+1 < right){
        int mid=(left + right)/2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
    

}


int main(){
    int A[N];
    scanf("%d",&n);
    for(int i=0; i<n; i++){
        scanf("%d",&A[i]);
    }
    
    int left=0;
    int right=n;
    
    mergeSort(A, left, right);
    
  for(int i=0; i<n; i++){
        if(i) printf(" ");
        printf("%d",A[i]);
   }

    printf("\n%d\n",cnt);
    return 0;
    
}




Measured memory_bytes: 5604
#include <iostream>
#include <vector>
using namespace std;
 
int main(void){
    int N;
    vector<int> a;
 
    cin >> N;
    a.resize(N);
    for (int i=0; i<N; i++) {
        cin >> a[i];
    }
    
    int max=0, min=1000;
    for (int i=0; i<N; i++) {
        if (a[i]<min) min=a[i];
        if (a[i]>max) max=a[i];
    }
    
    cout << max-min << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var b string

	fmt.Scan(&b)

	switch b {
	case "A":
		fmt.Println("T")
	case "T":
		fmt.Println("A")
	case "C":
		fmt.Println("G")
	case "G":
		fmt.Println("C")
	}
}


Measured memory_bytes: 512
//Code is like humor. When you have to explain it, it’s bad.
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#include <bits/stdc++.h>
#define pii pair<int,int>
#define MOD 1000000007
#define int long long
using namespace std;
#define s second
#define f first
int32_t main()
{
    fastio;
    int T,n,m,i,j,k,a,b,c;
    set<string> s;
    string str;
    cin>>n;
    for(i=0;i<n;i++)
    {  
        cin>>str;
        s.insert(str);
    }
    cout<<s.size();
    return 0;
}

Measured memory_bytes: 19196
#include "stdio.h"

int main ()
{
    int a[6],b[6];
    while (scanf("%d%d%d%d%d%d%d%d",&a[1],&a[2],&a[3],&a[4],&b[1],&b[2],&b[3],&b[4])!=EOF)
    {
        int hit=0,blow=0,i,j;
        for (i=1;i<=4;i++)
            if (a[i]==b[i])
                hit++;

        for (i=1;i<=4;i++)
            for(j=1;j<=4;j++)
            {if (a[i]==b[j])
                blow++;
            }

        printf("%d %d\n",hit,blow-hit);

    }
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <time.h>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>

using namespace std;
typedef long long ll;

#define rep(i, n) for (i = 0; i < n; i++)
#define P pair<int, int>

int main()
{
  string T;
  cin >> T;
  string S;
  for (char c : T)
  {
    if (c == '?')
    {
      S.push_back('D');
    }
    else
    {
      S.push_back(c);
    }
  }
  cout << S << endl;
}


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

int main(){
    int a, b;
    cin >> a >> b;
    string A = to_string(a);
    string B = to_string(b);
    string S;
    for(int i=0; i<b; i++){
        S += A;
    }
    string T;
    for(int i=0; i<a; i++){
        T += B;
    }

    if(S <= T){
        cout << S << endl;
    }else{
        cout << T << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#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()
{
    int wight, n;
    int cnt = 0;
    while (cin >> wight, wight)
    {
        cin >> n;
        int v[n + 1], w[n + 1];
        char c;
        for (int i = 1; i <= n; i++)
            cin >> v[i] >> c >> w[i];

        int dp[n + 1][wight + 1];
        rep(i, n + 1) rep(j, wight + 1) dp[i][j] = 0;

        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= wight; j++)
            {
                if (w[i] <= j)
                {
                    dp[i][j] = max(dp[i - 1][j - w[i]] + v[i], dp[i - 1][j]);
                }
                else
                    dp[i][j] = dp[i - 1][j];
            }
        }

        int m = dp[n][wight];
        cnt++;
        cout << "Case " << cnt << ":" << endl;
        OP(m);
        rep(i, wight + 1)
        {
            if (m == dp[n][i])
            {
                OP(i);
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 6936
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        String y = sc.next();
        
        int d = Integer.parseInt(x) / Integer.parseInt(y);
        int r = Integer.parseInt(x) % Integer.parseInt(y);
        double f = Double.parseDouble(x) / Double.parseDouble(y);
        
        System.out.printf("%d" + " " + "%d" + " " + "%.5f", d, r , f);
    }
}


Measured memory_bytes: 26564
#include<iostream>
int main() {
	int N, M, A[1000], C = 0;
	std::cin >> N >> M;
	for (int i = 0; i < N; i++) {
		std::cin >> A[i];
		C += A[i];
	}
	double F = (double)C / (4 * M);
	int Ans = 0;
	for (int i = 0; i < N; i++) {
		if (A[i] >= F)Ans++;
	}
	if (Ans < M)std::cout << "No" << std::endl;
	else std::cout << "Yes" << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

char island[12][12];

void search(int nowy, int nowx)
{
	int dy[] = {0, 1, -1, 0};
	int dx[] = {1, 0, 0, -1};
	int newx, newy;
	int i, j;
	
	island[nowy][nowx] = -1;
	
		for (j = 0; j < 4; j++){
			newy = nowy + dy[j];
			newx = nowx + dx[j];
			if (0 <= newy && newy < 12 && 0 <= newx && newx < 12 && island[newy][newx] == '1'){
				search(newy, newx);
			}
		}
}

int main(void)
{
	int i, j;
	int count;
	
	while (1){
		for (i = 0; i < 12; i++){
			if (scanf("%s", island[i]) == EOF){
				return (0);
			}
		}
		
		count = 0;
		for (i = 0; i < 12; i++){
			for (j = 0; j < 12; j++){
				if (island[i][j] == '1'){
					search(i, j);
					count++;
				}
			}
		}
		
		printf("%d\n", count);
	}
	
}

Measured memory_bytes: 544
//Name: Baseball Simulation
//Level: 1
//Category: やるだけ
//Note:

/**
 * 仕様のとおりに実装する。
 *
 * オーダーは O(E)。
 * ただし、Eはイベントの個数。
 */
#include <iostream>
#include <string>

using namespace std;

bool solve() {
    int out = 0;
    int b1 = 0, b2 = 0, b3 = 0;
    int score = 0;
    while(out < 3) {
        string event;
        cin >> event;
        if(event == "HIT") {
            if(b3) ++score;
            b3 = b2; b2 = b1; b1 = 1;
        } else if(event == "HOMERUN") {
            score += b1+b2+b3+1;
            b1 = b2 = b3 = 0;
        } else if(event == "OUT") {
            ++out;
        }
    }
    cout << score << endl;
    return true;
}

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

    int T;
    cin >> T;
    while(T--) solve();
    return 0;
}

Measured memory_bytes: 1212
object Main extends App {
  val w = readInt
  val n = readInt
  val initList = (1 to w)
  (1 to n)
    .map(_ => readLine.split(",").map(_.toInt - 1))
    .foldLeft(initList: Seq[Int]){ case (acc, Array(x, y)) =>
      val first = acc.take(x)
      val second = acc.slice(x + 1, y)
      val third = acc.drop(y + 1)
      first ++ Seq(acc(y)) ++ second ++ Seq(acc(x)) ++ third
    }
    .foreach(println)
}



Measured memory_bytes: 44072
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	var N int
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d", &N)

	hs := make([]int, N+1)
	for i := 1; i < N+1; i++ {
		scanner.Scan()
		fmt.Sscanf(scanner.Text(), "%d", &hs[i])
	}

	dp := make([]int, N+1)
	dp[1] = 0
	dp[2] = abs(hs[2] - hs[1])
	for i := 3; i < N+1; i++ {
		dp[i] = min(
			dp[i-1]+abs(hs[i]-hs[i-1]),
			dp[i-2]+abs(hs[i]-hs[i-2]),
		)
	}
	fmt.Println(dp[N])
}

func abs(n int) int {
	if n >= 0 {
		return n
	}
	return -n
}

func min(ns ...int) int {
	ret := math.MaxInt64
	for _, n := range ns {
		if n < ret {
			ret = n
		}
	}
	return ret
}


Measured memory_bytes: 5376
#include <iostream>
#include <algorithm>

using namespace std;
long long n;

long long dfs(long long cur, bool ch[3]){
    if(cur > n)return 0;
    long long cnt=0;
    if(ch[0] && ch[1] && ch[2])cnt=1;
    bool bch[]={ch[0],ch[1],ch[2]};
    ch[0]=true;
    cnt += dfs(cur*10+3,ch);
    if(!bch[0])ch[0]=false;
    ch[1]=true;
    cnt += dfs(cur*10+5,ch);
    if(!bch[1])ch[1]=false;
    ch[2]=true;
    cnt += dfs(cur*10+7,ch);
    if(!bch[2])ch[2]=false;
    return cnt;
}
int main(void){
    cin >> n;
    long long cur=0;
    bool ch[3]={};
    cout << dfs(cur,ch) << endl;
    return 0;
}


Measured memory_bytes: 256
// Problem : C - Peaks
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

#define FIO ios_base::sync_with_stdio(0); cin.tie(0);
#define T() int tt; cin >> tt; rep1(qq,1,tt)
#define rep(i,start,lim) for(int i=start;i<lim;i++)
#define rep1(i,start,lim) for(int i=start; i<=lim; ++i)
#define repd(i,start,lim) for(int i=start;i>=lim;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define br cout<<"\n"
#define MOD (1000000007LL)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define eps (1e-6)
#define what_is(x) cerr << #x << " is " << x << "\n";
#define int long long int
#define infll 9e18
#define inf 1e12

#define lnode (2 * node + 1)
#define rnode (2 * node + 2)

using namespace std;

typedef pair<int, int> pii;

const int N = 1 * 1e5 + 2;

int n, m;
int h[N];
vector<int> g[N];

int32_t main(){

  FIO
  //cout << fixed << setprecision(10);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  cin >> n >> m;
  rep1(i,1,n) cin >> h[i];
  rep(i,0,m){
    int u, v;
    cin >> u >> v;
    g[u].pb(v);
    g[v].pb(u);
  }
  int res = 0;
  rep1(i,1,n){
    bool good = 1;
    for(int v : g[i]){
      good &= h[i] > h[v];
    }
    if(good) ++res;
  }
  cout << res << '\n';

	return 0;
}






Measured memory_bytes: 10288
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    public static void Main()
    {
        int k = int.Parse(Console.ReadLine());

        Queue<long> que = new Queue<long>();
        for(int i = 1; i <= 9; i++)
        {
            que.Enqueue(i);
        }

        long temp = 0;
        for(int i = 0; i < k; i++)
        {
            temp = que.Dequeue();
            if (temp % 10 != 0)
            {
                que.Enqueue(10 * temp + (temp % 10) - 1);
            }
            que.Enqueue(10 * temp + (temp % 10));
            if (temp % 10 != 9)
            {
                que.Enqueue(10 * temp + (temp % 10) + 1);
            }
        }
        Console.WriteLine(temp);
    }
}

Measured memory_bytes: 17120
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> 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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const ll mod=998244353;
const ll LINF=1ll<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};

using mint = modint998244353;
vector<vector<mint>> dp(200001, vector<mint> (10, 0));

struct S{
    mint x;
    ll sz;
};

struct F{
    ll d;
};


S e(){
    return {0,0};
}

F id(){
    return {0};
}

S op(S l, S r){
    mint p = 10;
    return {l.x * p.pow(r.sz) + r.x, l.sz + r.sz};
}

S mapping(F f, S x){
    if(f.d == 0) return x;
    return {dp[x.sz][f.d], x.sz};
}

F composition(F f, F node){
    if(f.d == 0) return {node.d};
    return {f.d};
}


int main(){
    int n,q;cin >> n >> q;
    vector<S> a(n);
    for (int i = 0; i < n; i++) {
        a[i] = {1, 1};
    }
    for (ll i = 0; i <= 9; i++) {
        for (int j = 0; j < n; j++) {
            dp[j+1][i] = dp[j][i] * 10 + i;
        }
    }
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(a);
    while(q--){
        int l,r,d;cin >> l >> r >> d;
        l--;
        seg.apply(l, r, {d});
        cout << seg.prod(0, n).x.val() << endl;
    }
}


Measured memory_bytes: 30752
i_str = gets.chomp.to_s
if i_str == "keyence"
  puts "YES"
elsif i_str.length == 7
  puts "NO"
else
  e = i_str.length - 1
  len = i_str.length - 7
  ans = i_str.split("").map(&:to_s)
  if ans[len..e].join == "keyence" || ans[0..6].join == "keyence"
    puts "YES"
  else
    check = false
    7.times do |i|
      str = ans[0..i].join + ans[(i+len+1)..e].join
      if str == "keyence"
        check = true
        break
      end
    end
    if check
      puts "YES"
    else
      puts "NO"
    end
  end
end

Measured memory_bytes: 1788
#include <algorithm>
#include <climits>
#include <cmath>
#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;

int N, M;
vector<int> k;
vector<set<int>> s;
vector<int> p;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  k.resize(M);
  s.resize(M);
  p.resize(M);
  for (int i = 0; i < M; i++) {
    cin >> k[i];
    for (int j = 0; j < k[i]; j++) {
      int si;
      cin >> si;
      si--;
      s[i].insert(si);
    }
  }
  for (int i = 0; i < M; i++) {
    cin >> p[i];
  }

  int ans = 0;
  for (int i = 0; i < (1 << N); i++) {
    vector<int> on(N, 0);
    int b = i;
    for (int j = 0; j < N; j++) {
      if (b % 2 == 1) {
        on[j] = 1;
      }
      b /= 2;
    }

    bool ok = true;
    for (int j = 0; j < M; j++) {
      int num = 0;
      for (int l = 0; l < N; l++) {
        if (on[l] == 0) {
          continue;
        }
        if (s[j].find(l) != s[j].end()) {
          num++;
        }
      }
      if (num % 2 != p[j]) {
        ok = false;
      }
    }

    if (ok) {
      ans++;
    }
  }

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

Measured memory_bytes: 256
N,Y = map(int,input().split())
flg = 0
x = -1
y = -1
z = -1
for i in range(Y//10000+1):
    for j in range(min(N-i,Y//5000)+1):
        k = N-i-j
        if k>=0 and 10000*i+5000*j+k*1000==Y:
            flg = 1
            x = i
            y = j
            z = k
            break
    if flg==1:break
print(x,y,z)
    

Measured memory_bytes: 40684
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    int l,r;
    int mod=2019;
    cin >> l>>r;
    int x=l%mod,y=r%mod;
    if(x==0||y==0||l+mod<=r)cout << 0 << endl;
    else if(y<=x)cout << 0 << endl;
    else{
        vector<vector<int>> lst(2020,vector<int>(2020,100000));
        rep(i,2020)for(int j=i+1;j<2020;j++){
            if(i<x||y<j)lst[i][j]=100000;
            else lst[i][j]=(i*j)%mod;
        }
        int res=100000;
        rep(i,2020)rep(j,2020){
            if(res > lst[i][j]){
                DEBUG{
                    cout << i << "j " << j << endl;
                }
            }
            res = min(res,lst[i][j]);
        }
        cout << res <<endl;
    }
    return 0;
}


Measured memory_bytes: 16256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0047
{
    class Program
    {
        static void Main(string[] args)
        {
            string str;
            Cup c = new Cup();
            while (!((str = Console.ReadLine()) == null))
            {
                string[] line = str.Split(',');
                c.Suffle(line[0], line[1]);
            }
            foreach (var key in c.cup.Keys)
            {
                if (c.cup[key])
                {
                    Console.WriteLine(key);
                }
            }
        }
    }

    class Cup
    {
        public Dictionary<string, bool> cup = new Dictionary<string, bool>()
        {
            { "A",true },
            { "B",false},
            { "C",false},
        };

        public void Suffle(string a, string b)
        {
            bool aValue = cup[a];
            bool bValue = cup[b];
            if (aValue == true || bValue == true)
            {
                cup[a] = bValue;
                cup[b] = aValue;
            }
        }
    }
}



Measured memory_bytes: 15816
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=205;
int n;
int a[MAXN];
int ans;
int main()
{
    cin>>n;
    for(int i=1;i<=2*n;i++) scanf("%d",&a[i]);
    sort(a+1,a+2*n+1);
    for(int i=1;i<=2*n;i+=2) ans+=a[i];
    cout<<ans<<endl;
    return 0;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    long long h[N];
    for(int i=0; i<N; i++) {
        cin >> h[i];
    }
    long long v[N];
    v[N-1] = 0;
    v[N-2] = abs(h[N-1]-h[N-2]);
    for(int i=N-3; i>=0; i--) {
        long long minm = 100000000000000;
        for(int k=1; k<=K; k++) {
            if((i+k) >= N) break;
            if(minm > abs(h[i]-h[i+k]) + v[i+k]) {
                v[i] = abs(h[i]-h[i+k]) + v[i+k];
                minm = abs(h[i]-h[i+k]) + v[i+k];
            }
        }
    }
    cout << v[0];
    return 0;
}


Measured memory_bytes: 1792
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

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

#include <iostream>

using namespace std;

int main()
{
    int a;
    scanf("%d", &a);
    
    if(a<1200)
    {
        printf("ABC");
    }
    
    else if(a>=1200 and a<2800)
    {
        printf("ARC");
    }
    
    else
    {
        printf("AGC");
    }
   
}


Measured memory_bytes: 3712
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)
#define MP(a,b) make_pair(a,b)

#if __has_include("debug.hpp")
#include "debug.hpp"
#else
template<typename T>
void debug(T& obj) {}
#endif

template<typename T>
T in(){
	T val;
	cin >> val;
	return val;
}

template<typename T>
vector<T> inv(ll num) {
	vector<T> val(num);
	rep(i,num) cin >> val[i];
	return val;
}

//----------------------------------------------------------------------
void solve() {

	vector<vector<int>> vec(3, vector<int>(3));
	rep(i,3) rep(j,3) cin >> vec[i][j];
	ll n;
	cin >> n;
	vector<int> b(n);
	rep(i,n) {
		cin >> b[i];
		rep(j,3) rep(k,3) {
			if (vec[j][k]==b[i]) vec[j][k] = 0;
		}
	}

	if ((vec[0][0]==0 && vec[0][1]==0 && vec[0][2]==0) ||
	(vec[1][0]==0 && vec[1][1]==0 && vec[1][2]==0) ||
	(vec[2][0]==0 && vec[2][1]==0 && vec[2][2]==0) ||
	(vec[0][0]==0 && vec[1][0]==0 && vec[2][0]==0) ||
	(vec[0][1]==0 && vec[1][1]==0 && vec[2][1]==0) ||
	(vec[0][2]==0 && vec[1][2]==0 && vec[2][2]==0) ||
	(vec[0][0]==0 && vec[1][1]==0 && vec[2][2]==0) ||
	(vec[0][2]==0 && vec[1][1]==0 && vec[2][0]==0)) {
		cout << "Yes";
	} else {
		cout << "No";
	}



}
//----------------------------------------------------------------------

int main(int argc, char* argv[]) {
	solve();
	return 0;
}


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

struct node
{
    int key;
    node *parent;
    node *left;
    node *right;
};

// 根
node *root;
// 空のポインタを用意することで実装を単純にする
node *NIL;

void insert(int key)
{
    node *z = (node *)malloc(sizeof(node));
    z->key = key;
    z->parent = NIL;
    z->left = NIL;
    z->right = NIL;

    node *y = NIL;
    node *x = root;

    while (x != NIL)
    {
        y = x;
        if (z->key < x->key)
        {
            x = x->left;
        }
        else
        {
            x = x->right;
        }
    }

    z->parent = y;

    if (y == NIL)
    {
        root = z;
    }
    else if (z->key < y->key)
    {
        y->left = z;
    }
    else
    {
        y->right = z;
    }
}

void printPreOrder(node *x)
{
    if (x == NIL)
    {
        return;
    }

    cout << " " << x->key;
    printPreOrder(x->left);
    printPreOrder(x->right);
}

void printInOrder(node *x)
{
    if (x == NIL)
    {
        return;
    }

    printInOrder(x->left);
    cout << " " << x->key;
    printInOrder(x->right);
}

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

    for (int i = 0; i < n; i++)
    {

        string s;
        cin >> s;
        if (s == "insert")
        {
            int key;
            cin >> key;
            insert(key);
        }
        else
        {
            printInOrder(root);
            cout << endl;
            printPreOrder(root);
            cout << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 26508
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, n) for (ll i = n; i >= 0; --i)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define pb push_back
#define ist insert
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> S;
    ll ans = 0;
    rep (i, N) {
        ll s;
        cin >> s;
        ans += s;
        S.pb(s);
    }
    if (ans % 10) {
        cout << ans << endl;
        return 0;
    } else {
        sort(all(S));
        rep (i, N) {
            if (S[i] % 10) {
                cout << ans - S[i] << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define fi first
#define se second


signed main(){
  int n,t=0;
  cin>>n;
  int s=0,MAX=1e9;
  while(n--){
    int a;
    cin>>a;
    if(a%2==0)s+=a;
    else{
      t++;
      s+=a;
      MAX=min(MAX,a);
    }
  }
  if(t%2)s-=MAX;
  cout<<s/2<<endl;
}


Measured memory_bytes: 3096