akhauriyash/Code-Regression huggingface dataset:
N,K = map(int,input().split())
c = [0]*N
ans = 0
for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for j in A:
        c[j-1] += 1

for x in c:
    if x == 0:
        ans += 1
print(ans)

Measured memory_bytes: 9132
import sys
input = sys.stdin.readline
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

C = sorted(list(Counter(A).values()), reverse=True)
L = len(C)
B = []

num = C[0]
for i, c in enumerate(C):
    for _ in range(num-c):
        B.append(i)
    num = c
for _ in range(num):
    B.append(L)

ans = [N]
for n in range(2, N+1):
    if n > L:
        ans.append(0)
        continue
    count = 0
    stack = []
    for b in B:
        tmp = b
        while stack:
            if tmp >= n:
                last = stack.pop()
                tmp = tmp + last - n
                count += 1
            else:
                break
        count += tmp//n
        stack.append(tmp%n)
    ans.append(count)

print(*ans, sep='\n')

Measured memory_bytes: 38448
void main() {
	auto ip = readAs!(int[]), N = ip[0], X = ip[1];
	auto x = readAs!(int[]).map!(i => i - X).map!(i => i.abs);
	auto c = x[0];
	foreach(i; x[1..$]) {
		c = gcd(i, c);
	}
	c.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 4348
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000009
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;



int main()
{
int n,k;
cin>>n>>k;
vector<int> v(10,0);
for(int index = 0 ; index <k;index++)
{
    int c;
    cin>>c;
    v[c]++;
}
vector<int> ans;
int next =1;
while(1)
{
    int a= n;
    next = 1;
    while(a)
    {
        if(v[a%10])
        {
            next = 0;
            break;
        }
        a/=10;
    }
    if(next)
    {
        cout<<n<<endl;
        return 0;
    }
    n++;
}

 return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
 
//#include <unistd.h>
//#include <iostream>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int 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 REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
	fio();
	int n;
	cin >> n;
	map<string, int> mp;
	int ma = 0;
	rep (i, n) {
		string s;
		cin >> s;
		mp[s]++;
		chmax(ma, mp[s]);
	}

	for (auto itr = mp.begin(); itr != mp.end(); itr++) {
		if (itr->second == ma) {
			cout << itr->first << endl;
		}
	}
}

Measured memory_bytes: 23936
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

int gcd(int x, int y){
	if(y==0) return x;
	else return gcd(y, x%y);
}

int lcm(int x,int y){
	return x*y / gcd(x,y);
}

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

    int x;
    cin >> x;
    int z = lcm(x,360);
    cout << z/x <<endl;


	return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);

    ll x,y;
    cin>>x>>y;
    if(abs(x-y)<=1)
        cout<<"Brown"<<endl;
    else
        cout<<"Alice"<<endl;

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
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;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

vvll xedges(100005), yedges(100005);
V<bool> xvisited(100005, false), yvisited(100005, false);

vll dfs(ll i, ll xy) {
  if (xy == 0) xvisited[i] = true;
  else yvisited[i] = true;
  ll xc=(xy+1)%2, yc=xy%2, ec=0;
  if (xy == 0){  // x
    ec += xedges[i].size();
    REP(to, xedges[i].size()) {
      if (!yvisited[xedges[i][to]]) {
        vll p = dfs(xedges[i][to], (xy+1)%2);
        xc += p[0], yc += p[1], ec += p[2];
      }
    }
  } else {  // y
    ec += yedges[i].size();
    REP(to, yedges[i].size()) {
      if (!xvisited[yedges[i][to]]) {
        vll p = dfs(yedges[i][to], (xy+1)%2);
        xc += p[0], yc += p[1], ec += p[2];
      }
    }
  }
  vll ans(3); ans[0] = xc; ans[1] = yc; ans[2] = ec;
  return ans;
}

int main() {
  ll n; cin >> n;
  REP(i, n) {
    ll x, y; cin >> x >> y;
    xedges[x].push_back(y);
    yedges[y].push_back(x);
  }
  ll ans = 0;
  rep(i, 1, 100001) {
    if(!xvisited[i] && xedges[i].size()!=0) {
      auto p = dfs(i, 0);
      ans += p[0] * p[1] - p[2]/2;
    } else if (!yvisited[i] && yedges[i].size()!=0) {
      auto p = dfs(i, 1);
      ans += p[0] * p[1] - p[2]/2;
    }
  }
  cout << ans << endl;
  return 0;
}


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

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

int main(){
  int H,W;
  cin >> H >> W;
  char data[H][W];
  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      cin >> data[i][j];
    }
  }

  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      if(data[i][j] != '#')continue;
      bool flag = true;
      for(int k = 0 ; k < 4 ; k++){
	int nx,ny;
	nx = j + dx[k];
	ny = i + dy[k];
	if(!(0 <= nx && nx < W && 0 <= ny && ny < H))continue;
	if(data[ny][nx] == '#')flag = false;
      }
      if(flag){
	cout << "No" << endl;
	return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

vector<int> process(vector<int> b){
    vector<int> res;
    int l = b.size();
    rep(i, 0, b.size()){
        if(b[i] == 1) continue;
        res.push_back(b[i] - 1);
    }
    res.push_back(l);
    return res;
}

bool check(vector<int> b){
    int l = b.size();
    rep(i, 0, l){
        if(b[i] != i + 1) return false;
    }
    return true;
}

signed main(){
    int n;
    while(cin >> n, n){
        vi b(n);
        int sum = 0;
        rep(i, 0, n){
            cin >> b[i];
            sum = 0;
        }
        int cnt = 0;
        rep(i, 0, 10010){
            if(i > 10000){
                cnt = -1;
                break;
            }
            if(check(b)){
                cnt = i;
                break;
            }
            vector<int> tmp = process(b);
            b = tmp;
        }
        cout << cnt << endl;
    }
}

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

using namespace std;

int main(){
  char x[200];
  char roma[7]={'I','V','X','L','C','D','M'};
  int arabia[7]={1,5,10,50,100,500,1000};
  int a,b,ans,ls;
  string s;
  while(cin>>s){
    ans=a=0;
    ls=s.size();
    for(int i=ls-1;i>-1;i--){
      for(int j=0;j<7;j++){
	if(s[i]==roma[j])b=arabia[j];
      }
      if(b>=a){ans+=b;a=b;}
      if(b<a)ans-=b;
    }
    cout<<ans<<endl;
    
  }
}

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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (int i = j; i < (n); i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1e9;

int main(){

  int n;cin>>n;
  int h[n+10];rep(i,0,n)cin>>h[i];

  ll count=0;
  while(1){
    bool e=true;
    rep(i,0,n){
      if(h[i]!=0){h[i]--;e=false;}
      else {
        if(!e){count++;e=true;}
        else continue;
      }
    }
    if(!e)count++;
    if(*max_element(h,h+n)==0)break;
  }

  out(count);


  return 0;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

char c[MAXN];

void solve(){
	int n;
	scanf("%s", &c[0]);
	n = strlen(c);
	int ans = 1, last = 1;
	for(int i = 1; i < n; ) {
		if (last == 1 && c[i] == c[i - 1]) {
			if (i < n - 1) {
				ans++;
			}
			i += 2;
			last = 2;
		} else {
			ans++;
			i++;
			last = 1;
		}
	}
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

#define ll long long
#define ld long double
#define ii pair<int ,int >
#define S second
#define F first
#define PI 3.1415926535897932384626
#define SPEED std::ios_base::sync_with_stdio(false);



int main(){
    SPEED
    int n , l;
    cin>>n>>l;
    vector<string> v(n);
    for(string &s : v)
        cin>>s;
    sort(v.begin(),v.end());
    for(auto x : v)cout<<x;

}


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

int main() {
    ll n;
    std::cin >> n;
    
    vector<vector<ll>> c(10,vector<ll>(10,0));
    
    for (int i = 1; i <= n; i++) {
        string s = to_string(i);
        c[s[0]-'0'][s[s.size()-1]-'0']++;
    }
    ll res = 0;
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            res += c[i][j] * c[j][i];
        }
    }
    
    std::cout << res << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;

bool add(vector<ll>& v,ll x) {
    for(auto e:v){
        chmin(x,x^e);
    }
    if(x){
        v.push_back(x);
        return 1;
    }
    return 0;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int Q;
    cin>>Q;
    while(Q--){
        int N;cin>>N;
        vector<ll> A(N),v;
        for(int i=0;i<N;i++) cin>>A[i];
        string S;cin>>S;
        
        bool ans=false;
        
        for(int i=N-1;i>=0;i--){
            if(S[i]=='0'){
                add(v,A[i]);
            }else{
                if(add(v,A[i])) ans=1;
            }
        }
        
        if(ans) cout<<1<<"\n";
        else cout<<0<<"\n";
    }
}



Measured memory_bytes: 3508
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval<newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  string S;
  cin >> S;
  int a=0; int b=0; int i=0;
  for(char c : S){
    if(i%2==0){
      if(c=='0') b++;
      if(c=='1') a++;
    } else {
      if(c=='0') a++;
      if(c=='1') b++;
    }
    i++;
  }
  cout << min(a,b) << endl;
  return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

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

    if(N > 81) {
        cout << "No" << endl;
        return 0;
    }

    int flag = 0;
    for(int i = 1; i < 10; i++) {
        for(int j = 1; j < 10; j++) {
            if(i * j == N) {
                flag = 1;
                break;
            }
        }
    }

    if(flag == 1) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。
int main () {
    int A , B , C;
    cin >> A >> B >> C;
    int total = A + B;
    if(total >= C){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

int main() {
	int n,ex=0; cin>>n; 
	int a[n];
	for(int i=0;i<n;i++) {
		cin>>a[i];
		if(a[i]!=i+1) ex++;
	}
	if(ex==0 || ex==2) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string s;
	cin >> s;
	bool a = 0;
	int n = s.length();
	if (n == 2 && s[0] == s[1]) {
		cout << 1 << " " << 2;
		a = 1;
	}
  
	if (a == 0)
	for (int i = 0; i < n - 2; i++) {
		if (s[i] == s[i + 1] || s[i] == s[i + 2]) {
			cout << i + 1 << " " << i + 3;
			a = 1;
			break;
		}
	}
	
	if (a == 0) {
		if (s[n - 2] == s[n - 1]) cout << n - 2 << " " << n;
		else cout << -1 << " " << -1;
	}
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s;
    int a = 0, b = 0;
    cin >> s;
    for (int i = 0; i < s.length(); i++) {
        if (i % 2) {
            if (s[i] == '0') a++;
            else b++;
        } else {
            if (s[i] == '1') a++;
            else b++;
        }
    }
    cout << min(a, b);
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll cnt[2222];
int l[2222];

int main(void){
	int n,i,j,s,t;
	ll ans = 0ll;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> l[i];
		++cnt[l[i]];
	}
	for(i=0; i<2222; ++i){
		cnt[i] += cnt[i-1];
	}
	for(i=0; i<n; ++i){
		for(j=0; j<i; ++j){
			s = l[i]+l[j];
			t = abs(l[i]-l[j]);
			ans += cnt[s-1]-cnt[t];
			if(t<l[i]&&l[i]<s){
				--ans;
			}
			if(t<l[j]&&l[j]<s){
				--ans;
			}
		}
	}
	ans /= 3;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>

int main()
{
	long long a = 0, b = 0, c = 0, d = 0, e = 0, min = 0, ma = 0, ans = 0, count = 0;
	bool okada = true;
	bool whiteyoko = false, whitetate = false;
	char grid[100][100];
	using namespace std;
	int answer[100][100] = {};
	cin >> a ;

//for(int i=0;i<a;i++){}

	if (a % 2 == 0) {
		cout << a / 2 * a / 2<<endl;
	}
	else {
		cout <<((a/2)+1)*(a/2)<<endl;
	}
	}



Measured memory_bytes: 256
#include <stdio.h>

int main (void){

	int a,b;
	char op;

	while(1){
		scanf("%d %c %d",&a,&op,&b);
		if(op == '+'){
			printf("%d\n",a+b);
		}
		if(op == '-'){
			printf("%d\n",a-b);
		}
		if(op == '*'){
			printf("%d\n",a*b);
		}
		if(op == '/'){
			printf("%d\n",a/b);
		}
		if(op == '?'){break;}
	}

	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, x;
  cin >> n >> x;
  vector<int> l(n);
  int sum = 0;
  int res = 0;
  rep(i, n) {
    int temp;
    cin >> temp;
    sum += temp;
    res += sum <= x;
  }
  cout << res +1<< endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <queue>

#define H_MAX 1000
#define W_MAX 1000
#define N_MAX 9
#define NEST 'S'
#define BLANK '.'
#define BLOCK 'X'
#define START '1'
#define INF -1

using namespace std;

typedef pair<int, int> P;

char map[H_MAX][W_MAX];
int root[H_MAX][W_MAX];
int w, h, n, sx, sy;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

/*void show_root(void) {
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) printf("%2d,", root[i][j]);
		printf("\n");
	}
	printf("\n");
}*/

int cheese(char goal) {
	//printf("%c\n", goal);
	queue<P> que;
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			root[i][j] = INF;
		}
	}
	que.push(P(sx, sy));
	root[sx][sy] = 0;
	
	while( que.size() ) {
		P p = que.front(); que.pop();
		if(map[p.first][p.second] == goal) {
			sx = p.first;
			sy = p.second;
			//printf("%d, %d\n", sx, sy);
			break;
		}
		for(int i = 0; i < 4; i++) {
			int nx = p.first + dx[i], ny = p.second + dy[i];
			//printf("nx = %d, ny = %d\n", nx, ny);
			if(0 <= nx && nx < h && 0 <= ny && ny < w && map[nx][ny] != BLOCK && root[nx][ny] == INF) {
				que.push(P(nx, ny));
				root[nx][ny] = root[p.first][p.second] + 1;
				//show_root();
			}
		}
	}
	return root[sx][sy];
}

int main(void) {
	scanf("%d %d %d", &h, &w, &n);
	for(int i = 0; i < h; i++) {
		scanf("%s", &map[i]);
		for(int j = 0; j < w; j++) {
			if(map[i][j] == NEST) sx = i, sy = j;
		}
	}
	
	int time = 0;
	for(int i = 0; i < n; i++) {
		time += cheese(START + (char)i);
		//show_root();
	}
    
	printf("%d\n", time);
	
	return 0;
}

Measured memory_bytes: 5932
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <set>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>
#include <list>
#include <map>

#define rep(i,p,n) for(int i=(int)p;i<(int)n;i++)
#define repp(i,p,n) for(int i=(int)p;i>=(int)n;i--)
#define Sort(x) sort(x.begin(),x.end());
#define ll long long 
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi <vector<vector<vector<int>>> 
#define vc vector<char> 
#define vvc vector<vector<char>>
#define vvvc vector<vector<vector<char>>> 

using namespace std;

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

	}

	int count = 0;
	int button = 1;
	while (count <= n) {
		count++;
		if (v[button - 1] == 2) {
			cout << count << endl;
			return 0;
		}
		button = v[button - 1];
		
	}

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


Measured memory_bytes: 640
import java.util.StringTokenizer;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
public class Main {
	static double ans = 0;
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer str = new StringTokenizer(bfr.readLine());
		
		int N = Integer.parseInt(str.nextToken());
		int[] x = new int[N+1];
		int[] y = new int[N+1];
		double cnt=1;
		for (int i=2; i<=N; i++) {
			cnt*=i;
		}
		
		for (int i=1; i<=N; i++) {
			str = new StringTokenizer(bfr.readLine());
			x[i] = Integer.valueOf(str.nextToken());
			y[i] = Integer.valueOf(str.nextToken());
		}
		
		int[] list = new int[N];
		
		dfs(list, 0, N, x, y);
		
		ans/=cnt;
		System.out.println(ans);
		
	}
	public static void dfs(int[] list, int i, int N, int[] x, int[] y) {
		if (i==list.length) {
			for (int j=0; j<list.length-1; j++) {
				
				ans+=Math.sqrt(Math.pow(x[list[j]]-x[list[j+1]], 2) + Math.pow(y[list[j]]-y[list[j+1]], 2));
			}
			
		}
		else {
			for(int j=1; j<=N; j++) {
				if(isPossible(list, j, i)) {
					list[i] = j;
					dfs(list, i+1, N, x, y);
				}
			}
		}
	}
	
	public static boolean isPossible(int[] list, int find, int check) {
		for (int i=0; i<check; i++) {
			if (list[i]==find) {
				return false;
			}
		}
		return true;
	}
}

Measured memory_bytes: 23720
#define _USE_MATH_DEFINES
#define llint long long
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int n, k;
int ans;

int main() {
    cin >> n >> k;
    /* for (p = 1; p <= n; p++) {
        int a;
        cin >> a;
        if (a == 1) break;
    }*/

    ans = (n - 1) / (k - 1);
    if ((n - 1) % (k - 1) != 0) ans++;
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//#include "stdafx.h"
#include <stdio.h>
#include <math.h>
#include <string.h>

int main()
{
	int n,la1,la2,lb1,lb2,judge=0,i=1,j;
	char a1[110],a2[110],b1[110],b2[110],temp[110],sum[110];
	int s,bit;
	scanf("%d",&n);
	while (i<=n)
	{
		scanf("%s",a1);
		scanf("%s",a2);
		la1=strlen(a1);
		la2=strlen(a2);
		if (la1>=la2){
			 strcpy(b1,a1);strcpy(b2,a2);lb1=la1;lb2=la2;}
		else
			{strcpy(b2,a1);strcpy(b1,a2);lb2=la1;lb1=la2;}
		if (lb1<=80)
		{
			bit=0;
			for (j=0;j<lb2;j++)
			{
				s = bit+b2[lb2-1-j]+b1[lb1-1-j]-2*'0';
				if (s<10)
					{temp[j]=s+'0';
					bit=0;}
				else
					{bit=1;
					temp[j]=s-10+'0';}
			}
			for (j=lb2;j<=lb1;j++)
			{
				if (j<lb1){
					s=bit+b1[lb1-1-j]-'0';
					if (s<10)
					{temp[j]=s+'0';
					bit=0;}
					else
					{bit=1;
					temp[j]=s-10+'0';}}
				else if (bit==0&&j==lb1)
					temp[j]='\0';
				else
				{
					temp[j]='1';
					temp[j+1]='\0';
				}
			}
			if (strlen(temp)>80)
				printf("overflow\n");
			else{
				for (j=0;j<strlen(temp);j++)
				{
					sum[j]=temp[strlen(temp)-1-j];
				}
				sum[strlen(temp)]=temp[strlen(temp)];
				printf("%s\n",sum);}
		}
		else
			printf("overflow\n");
		i++;
	}
	return 0;
}

Measured memory_bytes: 592
S, K = input().split()
K = int(K)
MOD = 998244353

L = []
o = "0"
z = "1"

if S[0] == o:
  L.append(0)
  cnt = 0
else:
  cnt = 1

for i in range(1, len(S)):
  if S[i] == o:
    L.append(cnt)
    cnt = 0
  else:
    cnt += 1
if cnt != 0:
  L.append(cnt)

N = len(L) 
s = sum(L)
M = min(s, K) + 1
DP = [[[0] * M for _ in range(M)] for _ in range(N)]

s -= L[0]
for i in range(min(s, K) + 1):
  DP[0][0][i] = 1

for i in range(1, N):
  s -= L[i]
  t = min(K, s) + 1
  for j in range(M):
    c = 0
    for k in range(M):
      c = (c + DP[i - 1][j][k]) % MOD
      if k - t >= 0:
        c -= DP[i - 1][j][k - t]
        if c < 0: c += MOD
      DP[i][j][k] = c
  t = min(K, L[i])
  for k in range(M):
    c = 0
    for j in range(k + 1):
      DP[i][j][k] = (DP[i][j][k] + c) % MOD
      c = (c + DP[i - 1][j][k]) % MOD
      if j - t >= 0:
        c -= DP[i - 1][j - t][k]
        if c < 0: c += MOD

ans = 0
for i in range(M):
  ans = (ans + DP[-1][i][i]) % MOD

print(ans)


Measured memory_bytes: 102496
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;

ll ncr(ll n, ll r){
  ll num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

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

  int N; cin >> N;

  map<int,int> hash;
  vector<int> A(N);
  rep(i, N) {
    cin >> A[i];
    hash[A[i]]++;
  }

  ll total = 0;
  for(auto h : hash) {
    total += ncr(h.second, 2);
  }

  rep(i, N) {
    cout << total - hash[A[i]] + 1 << endl;
  }
}


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

string s;

int main()
{
	cin >> s;
	string S, T;
	S = T = "";
	int ans = 0;
	for (int i = 0; i < s.size(); ++i)
	{
		S += s[i];
		if (S != T)
		{
			++ans;
			T = S;
			S = "";
		}
	}
	cout << ans << endl;
	return 0;
}

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


int main(){
ll N;
double ans=0;
cin>>N;
vector<double> x(N);
vector<string> u(N);
for(ll i=0;i<N;i++){
  cin>>x[i];
  cin>>u[i];
}

for(ll i=0;i<N;i++){
if(u[i][0]=='J'&&u[i][1]=='P'&&u[i][2]=='Y'){
  ans+=x[i];
}
else{
  ans+=x[i]*380000.0;
}

}

printf("%f",ans);
}


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

int n, g[maxn];
int edgeSize=0;
int dep[maxn];
int nxt[maxn<< 1], to[maxn << 1];
int size[maxn];
bool vis[maxn];

int tem=1;
bool dfs(int x){
	size[x] = 1;
	if(x == n) vis[x] = true;
	for(int p = g[x]; p; p = nxt[p])
		if(!dep[to[p]]){
			dep[to[p]] = dep[x] + 1;
			if(dfs(to[p])) vis[x] = true;
			size[x] += size[to[p]];
		}
	if(vis[x]) return true;
	else return false;
}
inline void addEdge(int u, int v){
	nxt[++ edgeSize] = g[u];
	tem=1;
	to[g[u] = edgeSize] = v;
}
int u,v;
int main(){
	cin>>n;
	for(int i = 1; i < n; ++ i){
		cin>>u>>v;
		addEdge(u, v);
		addEdge(v, u);
	} 
	dep[1] = 1;
	dfs(1);
	for(int i = 1; i <= n; ++ i)
		if(vis[i] && dep[i] == (dep[n] + 1) / 2 + 1){
			if(size[i]>=n-size[i]) 
				cout<<"Snuke"<<endl;
				else cout<<"Fennec"<<endl;
					return 0;
		}
	return 0;
}

Measured memory_bytes: 6144
#include<iostream>
using namespace std;
int main()
{
	char a[10];
	cin>>a;
	int x,y;
	x=(a[0]-'0')*10+a[1]-'0';
	y=(a[2]-'0')*10+a[3]-'0';
	if(x>=1&&x<=12&&y>=1&&y<=12)
	 cout<<"AMBIGUOUS"<<endl;
	else if(x>=1&&x<=12)
	 cout<<"MMYY"<<endl;
	else if(y>=1&&y<=12)
	 cout<<"YYMM"<<endl;
	else
	 cout<<"NA"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

const ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
int compare(string a, string b) {
	int i;
	for (i = 0; i < a[i] != '\0'; i++) {
		if (b[i] == '\0')
			return -1;
		else if (a[i] < b[i])
			return 1;
		else if (a[i] > b[i])
			return -1;
	}
	if (b[i] != '\0')
		return 1;
	else
		return 0;
}
int main() {
	ll s, c, ans;
	cin >> s >> c;
	ans = min(s, c / 2);
	s -= ans;
	c -= ans * 2;
	ans += c / 4;
	cout << ans << endl;
}

Measured memory_bytes: 4992
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int c[][] = new int[10][10];
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                c[i][j] = sc.nextInt();
            }
        }
        int a[][] = new int[h][w];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                a[i][j] = sc.nextInt();
            }
        }
        for (int t = 0; t < 10; t++) {
            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 10; j++) {
                    int min = c[i][j];
                    for (int k = 0; k < 10; k++) {
                        int cost = c[i][k] + c[k][j];
                        min = Math.min(min, cost);
                    }
                    c[i][j] = min;
                }
            }
        }
        long ans = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (a[i][j] == -1) {
                    continue;
                }
                ans += c[a[i][j]][1];
            }
        }
        System.out.println(ans);

        sc.close();
    }
}


Measured memory_bytes: 48784
# -*- coding: utf-8 -*-

import sys
import os
import math
import re
import random

tableA = {
    "A": "00000",
    "B": "00001",
    "C": "00010",
    "D": "00011",
    "E": "00100",
    "F": "00101",
    "G": "00110",
    "H": "00111",
    "I": "01000",
    "J": "01001",
    "K": "01010",
    "L": "01011",
    "M": "01100",
    "N": "01101",
    "O": "01110",
    "P": "01111",
    "Q": "10000",
    "R": "10001",
    "S": "10010",
    "T": "10011",
    "U": "10100",
    "V": "10101",
    "W": "10110",
    "X": "10111",
    "Y": "11000",
    "Z": "11001",
    " ": "11010",
    ".": "11011",
    ",": "11100",
    "-": "11101",
    "'": "11110",
    "?": "11111"}

tableB = {
    "101": " ",
    "000000": "'",
    "000011": ",",
    "10010001": "-",
    "010001": ".",
    "000001": "?",
    "100101": "A",
    "10011010": "B",
    "0101": "C",
    "0001": "D",
    "110": "E",
    "01001": "F",
    "10011011": "G",
    "010000": "H",
    "0111": "I",
    "10011000": "J",
    "0110": "K",
    "00100": "L",
    "10011001": "M",
    "10011110": "N",
    "00101": "O",
    "111": "P",
    "10011111": "Q",
    "1000": "R",
    "00110": "S",
    "00111": "T",
    "10011100": "U",
    "10011101": "V",
    "000010": "W",
    "10010010": "X",
    "10010011": "Y",
    "10010000": "Z"}

def my_solve(s):
    lst = []
    for c in s:
        lst.append(tableA[c])
    s = ''.join(lst)

    tmp, ans = '', ''
    for c in s:
        tmp += c
        if tmp in tableB:
            ans += tableB[tmp]
            tmp = ''
    return ans

while True:
    try:
        s = input()
    except:
        break

    print(my_solve(s))

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

using namespace std;

int main(void) {
	int max;
	cin >> max;
	
	int a[3];
	for(int i=0; i<max; i++) {
		cin >> a[0] >> a[1] >> a[2];
		sort(a, a+3);
		if(a[0]*a[0]+a[1]*a[1] == a[2]*a[2]) { cout << "YES" << endl; }
		else { cout << "NO" << endl; }
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;

int main(void) {
    
    string S;
    cin >> S;
    
    string answer = "Good";
    for (int i=0; i<4; i++){
        if (S[i] ==S[i+1]){ answer = "Bad";break;}
    }
    cout << answer <<endl;
    return 0;
}
    

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

int main()
{
    int N, x;
    vector<int> a;
    int ai;
    cin >> N >> x;
    for(int i=0;i<N;i++){
        cin >> ai;
        a.push_back(ai);
    }
    sort(a.begin(), a.end());
    int res = x;
    int nChild = 0;
    for(int i=0;i<N;i++){
        if(res >= a.at(i)){
            if(i==N-1 && res!=a.at(i)) break;
            res -= a.at(i);
            nChild++;
        }else{
            break;
        }
    }

    cout << nChild << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N;
  cin>>N;
  vector<Int> A(N);
  cin>>A;

  __int128_t ans = 1;
  Int INF = 1;
  for(Int i=0;i<18;i++) INF *= 10;
  for(__int128_t a:A){
    ans *= a;
    Min(ans, (__int128_t)INF + 10);
  }

  if(ans > INF){
    cout<<-1<<endl;
    return 0;
  }

  Int t = ans;
  cout<<t<<endl;

  return 0;
}


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


long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;


int main(){
long long N,K,Q;
cin>>N>>K>>Q;
long long A[N]={};
for(long long i=0;i<Q;i++){
    long long a;
    cin>>a;
    a--;
    A[a]++;
}

for(long long i=0;i<N;i++){
    if(K+A[i]-Q<=0){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }
}
 return 0;
}

Measured memory_bytes: 1408
import sys

def resolve():
    lines = sys.stdin.readlines()

    n, m, k = tuple(map(int, lines[0].strip().split(' ')))
    A = list(map(int, lines[1].strip().split(' ')))
    B = list(map(int, lines[2].strip().split(' ')))

    a = [0]
    b = [0]

    for i in range(n):
        a.append(a[i] + A[i])
    for i in range(m):
        b.append(b[i] + B[i])

    res = 0
    j = m
    for i in range(n+1):
        if a[i] > k:
            break
        while a[i] + b[j] > k:
            j -= 1
        res = max(res, i+j)
    print(res)

resolve()

Measured memory_bytes: 139836
a, b, c, k = map(int, input().split())

total = 0
if(a < k):
    total = a
    k = k - a
    if(b < k):
        k = k - b
        if(c < k):
            total += c * -1
        else:
            total += k * -1
    else:
        pass
else:
    total = k

print(total)

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

int main(){
	int sum;
	while(cin >> sum){
		int number, info[100005], ans;
		cin >> number;
		for(int i = 0; i < number; i++){
			cin >> info[i];
		}
	
			for(int i = 0; i < number + 1; i++){
				if(!i){
					ans = info[i] - 1;
				}else if(i == number){
					ans = max(ans, sum - info[i - 1]);
				}else{
					int a = (info[i] - info[i - 1]) / 2;
					ans = max(ans, a);
				}	
			}		
			cout << ans << endl;
	}
}

Measured memory_bytes: 1304
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    for n in range(1, 10):
        t = N / n
        if 1<=t<=9 and t.is_integer():
            print('Yes')
            exit()
    else:
        print('No')
        exit()


if __name__ == '__main__':
    main()


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

int main(){
  int n,ans[10],w[10],l[10];
  string t[10];
  bool use[10];

  for(;;){
    cin >> n;
    if(!n)break;

    for(int i=0;i<n;i++){
      cin >> t[i];
      w[i] = l[i] = 0;
      use[i] = false;

      int tmp;
      for(int j=1;j<n;j++){
	cin >>tmp;
	if(tmp==0)w[i]++;
	if(tmp==1)l[i]++;
      }
    }

    for(int i=0;i<n;i++){
      int num = -1;
      for(int j=0;j<n;j++){
	if(!use[j]){
	  if(num<0)num = j;
	  else{
	    if(w[j]>w[num])num = j;
	    else if(w[j]==w[num] && l[j]<l[num])num = j;
	  }
	}
      }
      ans[i] = num;
      use[num] = true;
    }

    for(int i=0;i<n;i++)cout << t[ans[i]] << endl;
  }
}

Measured memory_bytes: 0
A,B,C,D,E,F = map(int, input().split())
A = 100 * A
B = 100 * B

counter = []

cnta = 1
cntb = 0
while (cnta * A) <= F:
  while (cnta * A + cntb * B) <= F:
    counter.append([cnta, cntb])
    cntb += 1
  cnta += 1
  cntb = 0

water = []
for c in counter:
  water.append(c[0] * A + c[1] * B)
water = list(set(water))

def sugar(water,C,D,E,F):
  sugar = []
  limit = water / 100 * E
  cntc = 0
  cntd = 0
  while cntc * C <= limit and cntc * C + water <= F:
    while cntc * C + cntd * D <= limit and cntc * C + cntd * D + water <= F:
      sugar.append(cntc * C + cntd * D)
      cntd += 1
    cntc += 1
    cntd = 0
  return max(sugar)

maxconc = [0,0,-1]
for w in water:
  s = sugar(w,C,D,E,F)
  conc = s/(w+s)
  if conc > maxconc[2]:
    maxconc = [w+s, s, conc]

print(" ".join(map(str, maxconc[0:2])))

Measured memory_bytes: 5228
#include<bits/stdc++.h>
        using namespace std;
        long long m=1000000007;
     
        #define boost ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        #define MAX(a,b) ((a)>(b)?(a):(b))
        #define MIN(a,b) ((a)<(b)?(a):(b))
        #define pb  push_back
        #define p2  second
        #define p1  first
        typedef long long ll;
        typedef long double ld; 
        long long M=1e9+7;			
        #define deb_(x)       cerr<< #x <<" : "<< x << endl;
        #define deb(A,N)    cerr <<" :[";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
        #define deb2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}																				
        #define rep(n) for(int i=0;i<n;i++)																		
        #define range(a,b) for(int i=a;i<=b;i++)																	
        #define loop(i,n) for(int i=0;i<n;i++)
    	void code();
     
        int main()
        {   
        	boost;
           ll t=1;
           // cin>>t;
           while(t--){
           	code();
           }
         
           return 0;
        }
     
       
        void code(){
        	ll n;
        	cin>>n;
        	ll A[n],B[n],C[n];
        	rep(n){
        		cin>>A[i]>>B[i]>>C[i];
        	}
        		ll dp1[n],dp2[n],dp3[n];
        	dp1[0]=A[0];
        	dp2[0]=B[0];
        	dp3[0]=C[0];
        
        	range(1,n-1){
        		dp1[i]=A[i]+MAX(dp2[i-1],dp3[i-1]);
        		dp2[i]=B[i]+MAX(dp1[i-1],dp3[i-1]);
        		dp3[i]=C[i]+MAX(dp1[i-1],dp2[i-1]);
        	}
        	cout<<MAX(dp3[n-1],MAX(dp2[n-1],dp1[n-1]))<<endl;

       	
        }

Measured memory_bytes: 4992
def number():
    return int(input())


def space():
    return list(map(int, input().split()))


N = number()
ABC = [space() for _ in range(N)]
dp = [[0] * 3 for _ in range(N+1)]

for i in range(1, N+1):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + ABC[i-1][0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + ABC[i-1][1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + ABC[i-1][2]
print(max(dp[-1]))


Measured memory_bytes: 74584