akhauriyash/Code-Regression huggingface dataset:
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

int main(void){
	ll n, m;
	cin >> n >> m;
	Vec x(n);
	rep(i, n) cin >> x[i];
	sort(all(x));

	Vec rr(m), r(m);
	rep(i, n) rr[x[i]%m]++;
	Vec ss(m), s(m);
	rep(i, n-1){
		if(x[i] ==  x[i+1]){
			ss[x[i]%m]++;
			i++;
		}
	}

	ll maxi = 0, ans = 0, c;
	r = rr, s = ss;
	repn(i, m/2){
		if(i*2 == m) continue;
		c = min(r[i], r[m-i]);
		ans += c;
		r[i] -= c;
		r[m-i] -= c;
	}
	c = r[0]/2;
	ans += c;
	r[0] -= c*2;
	if(m%2 == 0){
		c = r[m/2]/2;
		ans += c;
		r[m/2] -= c*2;
	}
	rep(i, m){
		c = min(r[i]/2, s[i]);
		ans += c;
		r[i] -= c*2;
	}
	chmax(maxi, ans);

	/*
	ans = 0;
	r = rr, s = ss;
	repn(i, m/2){
		if(i*2 == m) continue;
		c = min(s[i], s[m-i]);
		ans += c*2;
		s[i] -= c*2;
		s[m-i] -= c*2;
	}
	repn(i, m/2){
		if(i*2 == m) continue;
		c = min(r[i], r[m-i]);
		ans += c;
		r[i] -= c;
		r[m-i] -= c;
	}
	c = r[0]/2;
	ans += c;
	r[0] -= c*2;
	if(m%2 == 0){
		c = r[m/2]/2;
		ans += c;
		r[m/2] -= c*2;
	}
	rep(i, m){
		c = min(r[i]/2, s[i]);
		ans += c;
		r[i] -= c*2;
	}
	chmax(maxi, ans);
	*/
	co(maxi);

	return 0;
}


Measured memory_bytes: 4224
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define IO std::ios::sync_with_stdio(false)
#define int long long
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (int i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define pb push_back
#define pii pair <int, int>
#define mp(a, b) make_pair(a, b)
#define INF 0x3f3f3f3f
inline int read() {
    int x = 0, neg = 1; char op = getchar();
    while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); }
    while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); }
    return neg * x;
}
inline void print(int x) {
    if (x < 0) { putchar('-'); x = -x; }
    if (x >= 10) print(x / 10);
    putchar(x % 10 + '0');
}
const int maxn = 1e5 + 10;
int x,y,A,B,C;
int p[maxn],q[maxn],r[maxn];
signed main() {
    IO;
    cin >> x >> y >> A >> B >> C;
    rep(i, 1, A) cin >> p[i];
    rep(i, 1, B) cin >> q[i];
    rep(i, 1, C) cin >> r[i];
    sort(p + 1, p + 1 + A, greater<>());
    sort(q + 1, q + 1 + B, greater<>());
    sort(r + 1, r + 1 + C, greater<>());
    priority_queue<int, vector<int>, greater<>> pq;
    int ans = 0;
    rep(i, 1, x)pq.push(p[i]);
    rep(i, 1, y) pq.push(q[i]);
    rep(i, 1, C) {
        if (r[i] > pq.top()) {
            pq.pop();
            pq.push(r[i]);
        } else break;
    }
    while (!pq.empty()) {
        ans += pq.top();
        pq.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4852
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {
			// M-SOL_2020_C
			Scanner sc = new Scanner(System.in);

			int N = sc.nextInt();
			int K = sc.nextInt();
			Long A[] = new Long[N];

			for(int i=0; i<K; i++) {
				A[i] = sc.nextLong();
			}

			for(int i=K; i<N; i++) {
				A[i] = sc.nextLong();
				if(A[i-K] < A[i]) {
		    		System.out.println("Yes");
				} else {
		    		System.out.println("No");
				}
			}

    	    // Scannerクラスのインスタンスをクローズ
    		sc.close();
    	}
    }

Measured memory_bytes: 65564
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {

    string S,T;
    cin >> S >> T;
    map<char,char> mp;
    string out = "Yes";
    rep(i,S.length()){
        if(mp.count(S[i])){
            if(mp[S[i]]!=T[i]){
                out = "No";
                break;
            }
        }else{
            mp.emplace(S[i],T[i]);
        }
    }
    mp.clear();
    rep(i,T.length()){
        if(mp.count(T[i])){
            if(mp[T[i]]!=S[i]){
                out = "No";
                break;
            }
        }else{
            mp.emplace(T[i],S[i]);
        }
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 3864
#include <stdio.h>
#include <stdlib.h>

int main(void){
	
	char a[10];

	int i;
	int c=0;
	scanf("%s", a);

	for (i = 0; a[i] != '\0'; i++){
		c += a[i]-'0';
	}
	int b = atoi(a);
	if (b % c == 0)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 128
def main():
    K = int(input())
    used = [1,2,3,4,5,6,7,8,9]
    ans = used
    k = 9
    now = 0
    add = [-1,0,1]
    while True:
        if k >= K :
            break
        else:
            keep = []
            for i in used:
                if (i % 10 == 0 ) :
                    keep.append(i * 10 + 0)
                    keep.append(i * 10 + 1)
                    continue
                if (i % 10 == 9):
                    keep.append(i * 10 + 8)
                    keep.append(i * 10 + 9)
                    continue
                p = (i % 10)
                for j in range(3):
                    keep.append(i * 10 + p + add[j])
            k += len(keep)
            ans += keep
            used = keep
    print(ans[K-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 12992
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int N,T,a[100000];
map<int,int> ia;
int main(){
	cin>>N>>T;
	rep(i,N) cin>>a[i],ia[a[i]]=i;
	int d=0,mn=a[0];
	rep(i,N){
		chmax(d,a[i]-mn);
		chmin(mn,a[i]);
	}
	int c=0;
	rep(i,N){
		int m=a[i]+d;
		if(ia.count(m)){
			if(ia[m]>i) c++;
		}
	}
	cout<<c<<endl;
}


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

int main(){
    int n,d;
    cin>>n>>d;
    int ans=0;
    for(int i=0;i<n;i++){
        int x; int y;
        cin>>x>>y;
        ll temp=pow(x,2)+pow(y,2);
        long double tempa=sqrt(temp);
        if(tempa<=d)ans+=1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3648
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val n = sc.nextInt
  val as = List.fill(n)(sc.nextInt)

  val sum = as.sum
  val mean =
    if (sum < 0) (sum * 10 / n - 5) / 10
    else (sum * 10 / n + 5) / 10

  def d(n: Int): Int = n * n

  val ans = as.fold(0) { (acc, next) => acc + d(next - mean) }

  println(ans)
}


Measured memory_bytes: 27456
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check(int n) {
    for(int i=2;i*i<=n;++i) {
        if(n%i==0)
        return false;
    }
    return true;
}


// bool cmp(pair<int,int>p,pair<int,int>q) {
//     // return p.first>q.first;//descending by first
//     // return p.first<q.first;//ascending by first
//     // return p.second>q.second;//descending by second
//     return p.second<q.second;//ascending by second
// }

bool cmp(int p,int q) {
    return p>q;//descending
    // return p<q;//ascending
}


int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }

    return 0;
}
int clue() {

    int n;
    cin>>n;
    int c=(n+1)/2;

    double cc=c/(n*1.0);
    cout<<fixed<<setprecision(6)<<cc<<endl;
    
    // ()?cout<<"Yes"<<endl:cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main(){
  int n;
  cin >> n;
  map <string,int> mp;
  REP(i,n){
    string s;
    cin >> s;
    mp[s]++;
  }

  int m;
  cin >> m;
  REP(i,m){
    string s;
    cin >> s;
    mp[s]--;
  }

  int maxs = 0;
  for(auto x: mp){
    maxs = max(x.second, maxs);
  }

  cout << maxs << endl;


  return 0;
}

Measured memory_bytes: 3604
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type Abbreviation ---------- */
using ll = long long;

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */
template <typename T>
T gcd(T a, T b) {
    if (a > b) return gcd(b, a);
    return a == 0 ? b : gcd(b % a, a);
}

template <typename T, typename U>
T mypow(T b, U n) {
    if (n == 0) return 1;
    if (n == 1) return b /* % MOD */;
    if (n % 2 == 0) {
        return mypow(b * b /* % MOD */, n / 2);
    } else {
        return mypow(b, n - 1) * b /* % MOD */;
    }
}

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

int main() {
    ll N, K;
    cin >> N >> K;

    ll ret = 0;

    if (K == 0) {
        cout << N * N << endl;
        return 0;
    }

    for (ll b = K + 1; b <= N; b++) {
        ret += (N / b) * ((b - 1) - (K - 1));
        ret += N % b >= K ? N % b - (K - 1) : 0;
    }

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define PI 3.14159265358979323846
#define vll vector<long long>
using namespace std;
using ll = long long;
using ld = long double;

class UnionFind {
private:
  ll n;
  vll P;
  void setN(ll N);
  void init();

public:
  UnionFind(ll N);
  ll root(ll x);
  void unite(ll x, ll y);
  bool same(ll x, ll y);
};

// コンストラクタ
UnionFind::UnionFind(ll N) {
  setN(N);
  init();
}

// nを変更
void UnionFind::setN(ll N) { n = N; }

// Union-Find Treeを初期化する
void UnionFind::init() {
  P.clear();
  rep(i, n) { P.push_back(i); }
}

// 根の値を返す
ll UnionFind::root(ll x) {
  if (P[x] == x) { return x; }
  return (P[x] = root(P[x])); // パス圧縮しつつ返す
}

// 木を結合する（rankはとりあえず無視）
void UnionFind::unite(ll x, ll y) { P[root(x)] = root(y); }

// xとyが同じ集合にあるか判別
bool UnionFind::same(ll x, ll y) {
  if (root(x) == root(y)) {
    return true;
  } else {
    return false;
  }
}

// ----本問について----
// 問題：Marked Ancestor
// 問題文URL：https://onlinejudge.u-aizu.ac.jp/problems/2170
// 所要時間：
// 学んだこと：
// ------------------

// ----ここから本問のソースコード----

// グローバル変数（入力）
ll n, q, P[100010];
vector<pair<char, ll>> ope;

// 入力
void input() {
  for (ll i = 1; i < n; i++) {
    ll p;
    cin >> p;
    P[i] = p - 1; // 親を入力
  }
  ope.clear();
  rep(i, q) {
    char c;
    cin >> c;
    ll v;
    cin >> v;
    ope.push_back(make_pair(c, v - 1)); // 操作を入力
  }
}

void solve() {
  // isPaintedを初期化
  vll isPainted(n);
  isPainted[0] = 1;
  rep(i, n - 1) { isPainted[i] = 0; }

  // とりあえず塗る
  rep(i, ope.size()) {
    char c = ope[i].first;
    ll v = ope[i].second;
    if (c == 'M') {
      if (isPainted[v] == 0) {
        isPainted[v] = 1;
      } else {
        ope.erase(ope.begin()+i); // 複数の同じ「M v」は最初の以外除外しておく．
        i--;
      }
    }
  }
  q = ope.size();

  // UnionFind登場、塗られてるやつを根としてグループを形成する．
  UnionFind u(n);
  rep(i, n) {
    if (isPainted[i] == 0) {
      u.unite(i, P[i]); // 塗られてない奴は親と結合する
    }
  }

  // opeを後ろから処理する
  reverse(ope.begin(), ope.end());
  ll ans = 0;
  rep(i, q) {
    ll v = ope[i].second;
    if (ope[i].first == 'Q') {
      ans += u.root(v) + 1; // グループの長がmarked ancestor
    } else {
      u.unite(v, P[v]); // グループ統合
    }
  }
  cout << ans << endl;
}

int main() {
  while (cin >> n >> q && n > 0) {
    input();
    solve();
  }
  return 0;
}



Measured memory_bytes: 7792
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    public struct Pair { public int x, y; public Pair(int x, int y) { this.x = x; this.y = y; } }
    public static void Solve()
    {
        int N = NextInt();
        long[] A = LineLong();

        long X = A.Sum();
        for (int i = 1; i < N; i += 2) X -= 2 * A[i];
        long y = X / 2;
        for (int i = 0; i < N; i++)
        {
            Console.Write(y * 2 + " ");
            y = A[i] - y;
        }
        Console.WriteLine();
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 30292
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int) n;i++)
#define rep1(i,m,n) for(int i=(int) m;i<(int) n;i++)
#define fix(n) cout << fixed << setprecision((int)n)

void absll(ll &x) {
    if(x>=0) return ;
    else x=-x; return;
}

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

const ll INF = 1LL << 60;

ll N;

//DPテーブル
vector<ll> dp(100010);

int main() {
    cin >> N;
    ll sum=0;
    rep1(i,1,N+1) if(i%3!=0 && i%5!=0) sum+=i;
    cout << sum <<endl; 
}

Measured memory_bytes: 3864
// 0189
#include <iostream>
#include <vector>
#include <queue>
#define  N    10000000
using namespace std;

int main(){
	while(1){
		int n, a, b, c, num=0, min=N, m=0;
		int town[10][10], dis[10][10], total[10] = {0};

		cin>>n;
		if(n == 0)
			break;

		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				town[i][j] = N;
				if(i == j)
					dis[i][j] = 0;
				else
					dis[i][j] = N;
			}
		}

		for(int i=0;i<n;i++){
			cin>>a>>b>>c;
			town[a][b] = c;
			town[b][a] = c;

			if(num < a)
				num = a;
			if(num < b)
				num = b;
		}

		for(int i=0;i<=num;i++){
			queue<int> ver;
			ver.push(i);
			while(!ver.empty()){
				int x = ver.front();
				for(int j=0;j<=num;j++){
					if(dis[i][j] > dis[i][x] + town[x][j]){
						dis[i][j] = dis[i][x] + town[x][j];
						ver.push(j);
					}
				}
				ver.pop();
			}
		}

		for(int i=0;i<=num;i++){
			for(int j=0;j<=num;j++)
				total[i] += dis[i][j];

			if(total[i] < min){
				min = total[i];
				m = i;
			}
		}

		cout<<m<<" "<<total[m]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1204
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#include<sstream>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define dump(a) cerr << #a << "=" << (a) << endl
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

bool graph[101][101];

int main() {
	int N;	
	int id,node_size,neighber;
	cin >> N;

	rep(y,N) {
		rep(x,N) {
			graph[y][x] = 0;
		}
	}

	rep(i,N) {
		cin >> id >> node_size;
		rep(j,node_size) {
			cin >> neighber;
			graph[id][neighber] = 1;	
		}
	}

	REP(y,1,N+1) {
		REP(x,1,N+1) {
			cout << graph[y][x];
			if (x != N) {
				cout << " ";
			}
		}
		cout << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1168
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := readInt()
	m := make(map[int]map[int]int)
	for i := 1; i <= n; i++ {
		m[i] = make(map[int]int)
		a := readInt()
		for j := 0; j < a; j++ {
			x, y := readInt(), readInt()
			m[i][x] = y
		}
	}

	ans := 0
	for i := 1; i < 1<<uint(n+1); i++ {
		cnt := 0
	L:
		for j := 1; j <= n; j++ {
			if b := 1 << uint(j); i&b == b {
				cnt++
				for x, y := range m[j] {
					if b := 1 << uint(x); i&b/b != y {
						cnt = 0
						break L
					}
				}
			}
		}
		ans = max(ans, cnt)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <iostream>
#include <string>

using namespace std;
int main (){
    int apper[27]={};
    string s;
    cin >> s;
    int n;
    for (int i = 0; i < s.size(); i++){
        n=s[i]-'a';
        apper[n]=1;
    }
    for (int i = 0; i < 26; i++){
        if(apper[i]==0){
            cout << char('a'+i) << "\n";
            break;
        }
        if(i==25) cout << "None\n";
    }
}

Measured memory_bytes: 512
#include<iostream>

using namespace std;

int main(){
    string s; cin >> s;
    int posa, posz;

    for(int i = 0; i < s.length(); ++i){
        if(s[i] == 'A'){
            posa = i;
            break;
        }
    }

    for(int i = s.length() - 1; i >= 0; --i){
        if(s[i] == 'Z'){
            posz = i;
            break;
        }
    }

    cout << posz - posa + 1 << endl;
}

Measured memory_bytes: 640
N = int(input())
G = [[] for _ in range(N)]
visited = [0]*N
visited[0],visited[N-1] = 1,1
visited_all = [1]*N
for i in range(N-1):
    a,b = map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
nextA,nextB = G[0],G[N-1]
scoreA,scoreB = 1,1
while visited != visited_all:
    l = []
    for a in nextA:
        if visited[a] == 0:
            visited[a] = 1
            scoreA += 1
            for x in G[a]:
                l.append(x)
    nextA = l
    l = []
    for b in nextB:
        if visited[b] == 0:
            visited[b] = 1
            scoreB += 1
            for x in G[b]:
                l.append(x)
    nextB = l
print("Fennec" if scoreA > scoreB else "Snuke")


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

int main() {
  int N,W;
  cin >> N >> W;
  vector<ll> w(N);
  vector<ll> v(N);
  rep(i,N){
      cin >> w[i];
      cin >> v[i];
  }
vector<vector<ll>> dp(N+1, vector<ll>(W+1));
/*dp[i+1][j]=i番目までの品物から重さの総和がj以下になるように
選んだ時の価値の総和の最大値
*/
for(int i  =0;i<N;i++){
    for(int j = 0;j<=W;j++){
        if(j<w[i]) dp[i+1][j] = dp[i][j];
        else dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]] + v[i]);
    }
}
cout << dp[N][W] << endl;

}

Measured memory_bytes: 80256
#include <stdio.h>
#include <math.h>
int main(){
  int x;
  int n=0;
  scanf("%d",&x);
  for(int i=0;i<x;i++){
    int judge_num = x-i;
    for(int j=2;j<10;j++){
      if((int)pow(ceil(pow(judge_num,(double)1/j)),j)==judge_num){ 
        printf("%d",judge_num);
        return 0;
      }
    }
  }
}

Measured memory_bytes: 384
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String s = saori.nextHayami();
		String t = saori.nextHayami();
		String ans = t + s;
		System.out.println(ans);
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21204
#pragma GCC optimize("O3")
#pragma GCC optimize("O1")
#pragma GCC optimize("O2")
#pragma GCC optimize("Os")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(ll i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
using namespace std;
bool sortbysec(const pair<pair<int,int>,int> &a, const pair<pair<int,int>,int> &b)
{
    return (a.first.second<b.first.second);
}
bool sortbysecll(const pll &a, const pll &b)
{
    return (a.second<b.second);
}
ll modinv(ll x, ll y, ll modulo)
{
    return ((x%modulo)*(P(y,modulo-2LL,modulo)%modulo))%modulo;
}
void vok()
{
    FAST
    FO
    FI
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt","r",stdin);
    //     freopen("output.txt","w",stdout);
    // #endif
}
int main()
{
    vok();
    ll n;
    IN n;
    ll sum=0;
    loop(i,1,n+1)
    {
        if(i%3!=0 && i%5!=0)
        {
            sum+=i;
        }
    }
    OUT sum;
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define dalao main
#define ll long long
#define debug(x) {cerr<<#x<<" = "<<(x)<<endl;}
using namespace std;
map<string,int>m;
string s;
int dalao()
{
    ios::sync_with_stdio(false);
    int w;
    cin>>w;
    while(w--)
    {
        cin>>s;
        m[s]++;
    }
    cout<<"AC x "<<m["AC"]<<endl;
    cout<<"WA x "<<m["WA"]<<endl;
    cout<<"TLE x "<<m["TLE"]<<endl;
    cout<<"RE x "<<m["RE"]<<endl;
    return 0;
}


Measured memory_bytes: 3656
#include<algorithm>
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvld;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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

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

    int N, W;
    cin >> N >> W;

    vi w(N), v(N);
    rep(i, N) cin >> w[i] >> v[i];

    vvll dp(N + 1, vll(W + 1));

    rep(i, N)
    {
        reple(j, 0, W)
        {
            chmax(dp[i + 1][j], dp[i][j]);

            if (j - w[i] >= 0) chmax(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
        }
    }

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

    return 0;
}

Measured memory_bytes: 83128
<?php


fscanf(STDIN, "%d", $n);

$array = explode(" ",trim(fgets(STDIN)));

$last = 100000;
$ans = [];
foreach($array as $value){
    $ans[] = min($last, $value);
    $last = $value;
}

$ans[] = $last;

echo array_sum($ans);

Measured memory_bytes: 4728
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_D&lang=jp

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    a, b, c = map(int, input().split())
    divisor = 0

    for i in range(a, b+1):
        if c % i == 0:
            divisor += 1
    print(divisor)


if __name__ == '__main__':
    main(sys.argv[1:])
    

Measured memory_bytes: 7780
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
fact = math.factorial
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

N = i()
c = s()
num = c.count('R')
print(c[:num].count('W'))

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

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> c(N);
  vector<int> t(N);
  int m, M, a = 0;
  for(int i = 0; i < N; i++) {
    cin >> c.at(i) >> t.at(i);
  }
  for(int i = 0; i < N; i++) {
    if(i == 0) {
      m = t.at(i);
    }
    else {
      m = min(t.at(i),m);
    }
  }
  if(m > T) {
    cout << "TLE" << endl;
  }
  else {
    for(int i = 0; i < N; i++) {
      if(t.at(i) <= T) {
        if(a == 0) {
          M = c.at(i);
          a++;
        } 
        else {
          M = min(c.at(i),M);
        }
      }
    }
    cout << M << endl;
  }
}


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

int main() {
    int N;
    string S;
    cin >> N >> S;
    vector<int> R;
    vector<int> G;
    
    rep(i,S.size()) {
        if (S.at(i) == 'R') {
            R.push_back(i);
        } else if (S.at(i) == 'G') {
            G.push_back(i);
        }
    }
    long ans = R.size() * G.size() * (N - R.size() - G.size());
    rep(i,R.size()) {
        rep(j,G.size()) {
            int pos_min = 2 * min(R.at(i), G.at(j)) - max(R.at(i), G.at(j));
            int pos_max = 2 * max(R.at(i), G.at(j)) - min(R.at(i), G.at(j));
            int pos_middle = (R.at(i) + G.at(j)) / 2;
            if (pos_min >= 0 && S.at(pos_min) == 'B') --ans;
            if (pos_max < S.size() && S.at(pos_max) == 'B') --ans;
            if ((R.at(i) + G.at(j)) % 2 == 0 && S.at(pos_middle) == 'B') --ans;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3552
N=int(input())
task=[tuple(map(int,input().split())) for i in range(N)]
task.sort(key=lambda x:x[1])
now=0
flag=True
for a,b in task:
    now+=a
    if now>b:
        flag=False
        break
if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 31824
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef unordered_map<char, vector<int>> umv;

string s, t;
int n;
umv u;

int main() {
    cin >> s >> t;
    n = s.size();
    rep(i, n) u[s[i]].push_back(i+1);
    ll ans = 0;
    int i = 0;
    for (char x : t) {
        if (!u.count(x)) {
            cout << -1 << endl;
            return 0;
        }
        auto itr = upper_bound(u[x].begin(), u[x].end(), i);
        if (itr == u[x].end()) {
            ans += n;
            i = u[x][0];
        }
        else i = *itr;
    }
    ans += i;
    cout << ans << endl;
}


Measured memory_bytes: 1216
//file_name:ABC44_C.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int n,x;
    scanf("%d%d",&n,&x);
    int a[n] = {};
    rep(i,n){
        scanf("%d",&a[i]);
    }
    sort(a,a+n);


    ll ans = 0;

    ll dp[n+1][n+1][2501];
    rep(i,n+1){
        rep(j,n+1){
            rep(k,2501){
                dp[i][j][k] = 0;
                if(j==0&&k==0){
                    dp[i][j][k] = 1;
                }else if(i>0){
                    dp[i][j][k] = dp[i-1][j][k];
                    if(k>=a[i-1]){
                        dp[i][j][k] += dp[i-1][j-1][k-a[i-1]];
                    }
                }
            }
        }
    }

    srep(j,1,n+1){
        rep(k,2501){
            if(j*x==k){
                ans += dp[n][j][k];
            }
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 51072
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll H, W;
    cin >> H >> W;
    vector<string> c(H);
    for (ll i = 0; i < H; i++) {
        cin >> c[i];
    }

    pair<ll, ll> s, g;
    s = { 0, 0 };
    g = { H-1, W-1 };
    
    vector<vector<ll>> cost(H, vector<ll>(W, INT_MAX));
    struct Element {
        ll cost, x, y;
        bool operator<(const Element& rhs) const {
            return cost > rhs.cost;
        }
    };

    priority_queue<Element> pq;
    
    if(c[0][0]=='#'){
        cost[s.first][s.second] = 1;
        pq.push({ 1, s.second, s.first });

    }else{
        cost[s.first][s.second] = 0;
        pq.push({ 0, s.second, s.first });

    }
    
    auto isOK = [&](ll x, ll y) {
        return (0 <= x && x < W && 0 <= y && y < H);
    };

    ll dx[2] = {0, 1};
    ll dy[2] = {1, 0};

    
    while (!pq.empty()) {
        auto t = pq.top();
        pq.pop();

        for (ll i = 0; i < 2; i++) {
            ll nx = t.x + dx[i];
            ll ny = t.y + dy[i];
            if (!isOK(nx, ny)) {
                continue;
            }
            ll nc; //= t.cost + (c[ny][nx] == '.' ? 0 : 1);
            if(c[t.y][t.x] == '.' && c[ny][nx] == '#') nc = t.cost + 1;
            else if(c[t.y][t.x] == '#' && c[ny][nx] == '#'){
                if(t.y == ny|| t.x == nx) nc = t.cost;
                else nc = t.cost + 1;
            }
            else{
              nc = t.cost;
            }

            if (nc < cost[ny][nx]) {
                cost[ny][nx] = nc;
                pq.push({ nc, nx, ny });
            }
        }
    }
    
    cout << (cost[g.first][g.second]) << endl;

    // for (ll i = 0; i < H; i++)
    // {
    //   for (ll j = 0; j < W; j++)
    //   {
    //     cout << cost[i][j];
    //   }
    //   cout << endl;
    // }
    
}

Measured memory_bytes: 384
using System;

namespace AOJ0026
{
    class Program
    {
        static void Main(string[] args)
        {
            string input;
            int[,] plain = new int[14, 14];

            while (true)
            {
                input = Console.ReadLine();
                
                if (string.IsNullOrEmpty(input) == true)
                {
                    break;
                }

                string[] num = input.Split(',');
                int x = int.Parse(num[0]);
                int y = int.Parse(num[1]);
                int size = int.Parse(num[2]);

                switch (size)
                {
                    case 1:
                                                plain[x + 2, y + 1]++;
                        plain[x + 1, y + 2]++;  plain[x + 2, y + 2]++;  plain[x + 3, y + 2]++;
                                                plain[x + 2, y + 3]++;
                        break;

                    case 2:
                        plain[x + 1, y + 1]++; plain[x + 2, y + 1]++; plain[x + 3, y + 1]++;
                        plain[x + 1, y + 2]++; plain[x + 2, y + 2]++; plain[x + 3, y + 2]++;
                        plain[x + 1, y + 3]++; plain[x + 2, y + 3]++; plain[x + 3, y + 3]++;
                        break;

                    case 3:
                                                                  plain[x + 2, y]++;
                                           plain[x + 1, y + 1]++; plain[x + 2, y + 1]++; plain[x + 3, y + 1]++;
                        plain[x, y + 2]++; plain[x + 1, y + 2]++; plain[x + 2, y + 2]++; plain[x + 3, y + 2]++; plain[x + 4, y + 2]++;
                                           plain[x + 1, y + 3]++; plain[x + 2, y + 3]++; plain[x + 3, y + 3]++;
                                                                  plain[x + 2, y + 4]++;
                        break;
                }
            }

            int count = 0;
            int highest = 0;

            for (int i = 2; i < 12; i++)
            {
                for (int j = 2; j < 12; j++)
                {
                    if (plain[i,j] == 0)
                    {
                        count++;
                    } else if (plain[i,j] > highest)
                    {
                        highest = plain[i, j];
                    }
                }
            }

            Console.WriteLine(count);
            Console.WriteLine(highest);
        }
    }
}

Measured memory_bytes: 9040
#include <bits/stdc++.h>
#define pb push_back
#define vt vector
#define ll long long
using namespace std;

const int INF = 1e9 +5;
const ll LLINF = 1e18 +5;

int i4[4] = {1,0,-1,0};
int j4[4] = {0,1,0,-1};


void solve()
{
	int n;
	cin >>n;
    vt<pair<int,pair<int,int>>> v;
    for(int i = 0;i < n;i++)
    {
        int a,b,c;
        cin >> a >> b >> c;
        v.push_back({a,{b,c}});
    }
    sort(v.begin(),v.end());
    int lastX = 0, lastY =0, lastTime = 0;
    for(int i = 0; i < n;i++)
    {
        auto cur = v[i];
        int curTime = cur.first;
        int curX = cur.second.first;
        int curY = cur.second.second;
        int dist = abs(lastX-curX) + abs(lastY-curY);
        int timeDif = curTime - lastTime;
        if(timeDif < dist || timeDif%2!=dist%2)
        {
            cout << "No" << endl;
            return;
        }
        lastX = curX;
        lastY = curY;
        lastTime = curTime;
    }
        cout << "Yes" << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();

  return 0;
}


Measured memory_bytes: 4872
#include <cstdio>
#include <iostream>

using namespace std;

int m, n, A[20] = {0};

int solve(int sum,int i) {
	if (sum == m) return true;
	if (i == n) return false;
	return solve(sum, i + 1) || solve(sum + A[i], i + 1);


}

int main() {

	int q, ans;

	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> A[i];
	}

	cin >> q;

	for (int i = 0;i < q;i++) {
		cin >> m;
		ans = solve(0,0);
			if (ans != 0) {
				cout << "yes" << endl;
			}
			else cout << "no" << endl;
	}

		return 0;
}

Measured memory_bytes: 3084
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    p = list(map(int, input().split()))
    ans = 0
    for i in range(1, n-1):
        if sorted([p[i-1], p[i], p[i+1]])[1] == p[i]:
            ans += 1
    print(ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 9192
using System;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;
using System.Linq;

class Project
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        int n;
        int a = 0;
        if(N % 1000 == 0)
        {
            Console.WriteLine(0);
        }
        else
        {
            Console.WriteLine("{0}", 1000 - (N % 1000));
        }
    } 
}

Measured memory_bytes: 27544
// clang-format off

#include <bits/stdc++.h>

#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))

#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))

#define INF 1000000000
#define INFLL 1000000000000000000LL
#define MOD 1000000007
#define PI acos(-1)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>

using namespace std;

// clang-format on

main {
  int n, k;
  cin >> n >> k;
  vc d(k);
  rep(i, k) cin >> d[i];
  for (bool f = true; f; n++) {
    string s = to_string(n);
    f = false;
    rep(i, s.size()) f |= find(all(d), s[i]) != d.end();
  }
  n--;
  cout << n << endl;
  bye;
}


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

const ll MOD = ll(1e9+7);


// ll pow(ll x, ll n) {
//     ll ret = 1;
//     while (n > 0) {
//         if (n & 1) ret = ret * x % MOD;  // n の最下位bitが 1 ならば x^(2^i) をかける
//         x = x * x % MOD;
//         n >>= 1;  // n を1bit 左にずらす
//     }
//     return ret;
// }
ll powmod(ll x,ll y){
    ll res=1;
    for(ll i=0;i<y;i++){
        res=res*x%MOD;
    }
    return res;
}
int main(){
    ll n;
    cin>>n;
    ll ans=powmod(10,n)-powmod(9,n)-powmod(9,n)+powmod(8,n);
    ans%=MOD;
    ans=(ans+MOD)%MOD;
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MAX 2000005
#define MOD 1000000007
#define MOD2 998244353
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define vi vector<ll>
#define vp vector<pii>
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

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


int main(){
    IOS

    string s;
    cin>>s;
    sort(all(s));
    if(s[0]==s[1] && s[2]==s[3] && s[1]!=s[2]){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }

    cerr<<"Time: "<<1.0/CLOCKS_PER_SEC<<" ms"<<endl;
    return 0;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<random>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
typedef vector<vt>vvt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"


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

	int l,r,d;
	cin>>l>>r>>d;
	cout<<r/d-(l-1)/d<<endl;

}


Measured memory_bytes: 3600