akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int n,d,cnt=0;
  cin >> n >> d;
  int ans=2*d+1;
  if(n%ans!=0)cnt=1;
  cout << n/ans+cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
inline string read_s(){string s="";char c=getchar();while(c<'!'||c>'~'){c=getchar();}while(c>='!'&&c<='~'){s+=c;c=getchar();}return s;}
void Main(){
    int A = read(), B = read();
    if (A <= 5) printf("%d\n", 0);
    else {
        if (A <= 12) B /= 2;
        printf("%d\n", B);
    }
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;	cin >> n;
  vector<int> x(n);
  for(int i=0;i<n;i++){
    cin >> x.at(i);
  }
  
  int ans=2000000;
  for(int i=1;i<=100;i++){
    int cost=0;
    for(int xi:x){
      cost+=(xi-i)*(xi-i);
    }
    ans=min(ans,cost);
  }
  cout << ans;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <sstream>
#include <set>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
#define rei(n) for(int i=0;i<(int)n;i++)
#define rel(n) for(int l=0;l<(int)n;l++)
#define all(s) s.begin(),s.end()
#define INT_MAX 2147483647
#define debug(x) cout<<#x<<": "<<x<<endl;
#define PI 2*acos(0,0)
#define pb push_back
#define inin(x) int x; cin>>x;
#define ll long long
#define pb push_back

typedef pair<int, int> pii;
typedef pair<int, pii> pipii;

struct Calendar
{
	long long year;
	long long month;
	long long day;
	long long dat[2][13];
	Calendar(long long y, long long m, long long d)
	{
		year = y;
		month = m;
		day = d;
		dat[0][0] = dat[1][0] = 0;
		dat[0][1] = dat[1][1] = 31;
		dat[0][2] = dat[1][2] = 28;
		dat[0][3] = dat[1][3] = 31;
		dat[0][4] = dat[1][4] = 30;
		dat[0][5] = dat[1][5] = 31;
		dat[0][6] = dat[1][6] = 30;
		dat[0][7] = dat[1][7] = 31;
		dat[0][8] = dat[1][8] = 31;
		dat[0][9] = dat[1][9] = 30;
		dat[0][10] = dat[1][10] = 31;
		dat[0][11] = dat[1][11] = 30;
		dat[0][12] = dat[1][12] = 31;
		dat[1][2] = 29;
	}
	int uruu()
	{
		if (year % 4 == 0)
		{
			if (year % 400 != 0 && year % 100 == 0)
			{
				return 0;
			}
			else
			{
				return 1;
			}
		}
		return 0;
	}
	int uruu(long long y)
	{
		if (y % 4 == 0)
		{
			if (y % 400 != 0 && y % 100 == 0)
			{
				return 0;
			}
			else
			{
				return 1;
			}
		}
		return 0;
	}
	long long pday(long long d)
	{
		day += d;
		for (;; month++)
		{
			if (month >= 13)
			{
				year++;
				month = 1;
			}

			if (dat[uruu()][month] < day)
			{
				day -= dat[uruu()][month];
			}
			else
			{
				break;
			}
		}
		pmonth(0);
		return d;
	}
	long long pmonth(long long m)
	{
		month += m;
		for (;; year++)
		{
			if (month > 12)
			{
				month -= 12;
			}
			else
			{
				break;
			}
		}
		return m;
	}
	long long pyear(long long y)
	{
		year += y;
		return y;
	}
	long long dif(Calendar c)
	{
		long long ans = 0;
		Calendar a(year, month, day);
		ans -= a.day;
		ans += c.day;
		a.day = 0;
		c.day = 0;
		for (; a.month >= 1; a.month--)
		{
			ans -= dat[a.uruu()][a.month - 1];
		}
		for (; c.month >= 1; c.month--)
		{
			ans += dat[c.uruu()][c.month - 1];
		}
		for (; a.year != c.year; a.year++)
		{
			ans += 365;
			if (a.uruu())ans++;
		}
		return ans;
	}


};


int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int x = a + b + c + d;
	cout << x / 60 << endl;
	cout << x % 60 << endl;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

struct UnionFind
{
	vector<int> parent;
	vector<int> rank;

	UnionFind(int N) :parent(N, 0), rank(N, 0)
	{
		rep(i, 0, N)parent[i] = i;
	}

	int find(int x)
	{
		if (parent[x] == x)return x;
		else return parent[x] = find(parent[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (x == y)return;

		if (rank[x] < rank[y])parent[x] = y;
		else{
			parent[y] = x;
			if (rank[x] == rank[y])rank[x]++;
		}
	}

	bool same(int x, int y)
	{
		return find(x) == find(y);
	}
};

int N,M;
int S[100010];
bool checked[100010];
vector<pii> G[100010];
vector<int> ANS;

void dfs(int idx)
{
	checked[idx]=true;
	for(auto e:G[idx])
	{
		if(checked[e.first])continue;
		dfs(e.first);
		if(S[e.first]==1)
		{
			S[e.first]^=1;
			S[idx]^=1;
			ANS.push_back(e.second);
		}
	}
}

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

	cin>>N>>M;
	vector<int> A(N+1),B(N+1),C(N+1);

	rep(i,0,N)
	{
		cin>>A[i]>>B[i];
		C[i]=A[i];
	}

	A[N]=C[N]=INF;
	B[N]=0;

	sort(all(C));

	rep(i,0,N)
	{
		int x=lower_bound(all(C),A[i])-C.begin();
		S[x]=B[i];
	}

	rrep(i,1,N+1)
	{
		S[i]^=S[i-1];
	}

	UnionFind uf(N+1);
	int l,r;
	rep(i,0,M)
	{
		cin>>l>>r;
		int s=lower_bound(all(C),l)-C.begin();
		int t=lower_bound(all(C),r+1)-C.begin();
		if(!uf.same(s,t))
		{
			uf.unite(s,t);
			G[s].push_back(mp(t,i));
			G[t].push_back(mp(s,i));
		}
	}

	rep(i,0,N+1)
	{
		if(!checked[i])
		{
			dfs(i);
		}
		if(S[i]==1)
		{
			cout<<-1<<endl;
			return 0;
		}
	}

	sort(all(ANS));
	cout<<SZ(ANS)<<endl;
	for(auto v:ANS)
	{
		cout<<v+1<<" ";
	}
	cout<<endl;
	
	return 0;
}

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

using namespace std;
using vi = vector<int>;

const int NMAX = 1e5 + 11;

int  n, m, mem[NMAX];
bool vis[NMAX];
vi   g[NMAX];

int dp(int u)
{
    int ans = 0;
    if (vis[u])
        return mem[u];

    vis[u] = true;
    for (auto v : g[u])
        ans = max(dp(v) + 1, ans);

    return (mem[u] = ans);
}

int main(void)
{
    int u, v, ans;
    cin >> n >> m;

    for (int i = 0; i < m; ++i)
    {
        cin >> u >> v;
        g[u].push_back(v);
    }

    ans = 0;
    for (int i = 0; i <= n; ++i)
        ans = max(ans, dp(i));

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


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

int main() {
    string S;
    long long K;
    cin >> S >> K;
    for (long long i=0; i<K; i++) {
        if (S.at(i)!='1') {
            cout << S.at(i);
            return 0;
        }
    }
    cout << "1\n";
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
    int n, m; cin >> n >> m;
    ll cnt = 1;
    for (int i = 0; i < m; i++) cnt *= 2;
    ll ans = ( 1900 * m + 100 * (n - m) ) * cnt;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int L;
    cin >> L;
    int V = 0;
    int pow2 = 1;
    vector<int> table;
    table.emplace_back(pow2);
    while(pow2 <= L){
        pow2 <<= 1;
        table.emplace_back(pow2);
        ++V;
    }
    table.emplace_back(pow2 << 1);
    vector<tuple<int, int, int>> es;
    for(int i = 0; i + 1 < V; ++i){
        es.emplace_back(i, i + 1, 0);
    }
    int cur = 1;
    for(int i = V - 2; i >= 0; --i){
        es.emplace_back(i, i + 1, cur);
        cur <<= 1;
    }
    L -= (pow2 >> 1);
    while(L > 0){
        int p = lower_bound(table.begin(), table.end(), L) - table.begin();
        if(table[p] > L)    --p;
        es.emplace_back(0, V - p - 1, cur);
        cur += table[p];
        L -= table[p];
    }
    cout << V << ' ' << es.size() << '\n';
    for(auto t : es){
        cout << get<0>(t) + 1 << ' ' << get<1>(t) + 1 << ' ' << get<2>(t) << '\n';
    }
}

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


int main(){
    ll N;
    cin >> N;
    vector<pair <ll,ll>> d(N);
    for(int i = 0; i < N; i++){
        cin >> d[i].first;
        d[i].second = i + 1;
    }

    sort(d.begin() ,d.end());

    for(int i = 0; i < N; i++){
        cout << d[i].second <<" ";
    }
    cout << "\n";
}

Measured memory_bytes: 2432
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 998244353 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }
vll fac(2,1),inv(2,1),finv(2,1) ;

int main(){
	ll a,b,c,d ;
	cin >> a >> b >> c >> d ;
	vvll dp(c+1,vll(d+1,0)) ;
	dp.at(a).at(b) = 1 ;
	queue<ll> q ;
	q.push(a) ; q.push(b) ;
	while(!q.empty()){
		ll h = q.front() ; q.pop() ;
		ll w = q.front() ; q.pop() ;
		if(h+1<=c&&dp.at(h+1).at(w)==0){
			ll next = dp.at(h).at(w)*w%mod ;
			next += dp.at(h+1).at(w-1)*(h+1)%mod ;
			next %= mod ;
			if(w-1>=0){
				next += mod-dp.at(h).at(w-1)*h%mod*(w-1)%mod ;
			}
			dp.at(h+1).at(w) = next%mod ;
			q.push(h+1) ; q.push(w) ;
		}
		if(w+1<=d&&dp.at(h).at(w+1)==0){
			ll next = dp.at(h).at(w)*h%mod ;
			next += dp.at(h-1).at(w+1)*(w+1)%mod ;
			next %= mod ;
			if(h-1>=0){
				next += mod-dp.at(h-1).at(w)*(h-1)%mod*w%mod ;
			}
			dp.at(h).at(w+1) = next%mod ;
			q.push(h) ; q.push(w+1) ;
		}
	}
	cout << dp.at(c).at(d) << endl ;
	// for(int i=0;i<=c;i++){
		// for(int j=0;j<d;j++){
			// cout << dp.at(i).at(j) << " " ;
		// }
		// cout << endl ;
	// }
}

Measured memory_bytes: 73924
#include <iostream>

using namespace std;

int main()
{
   int i, h, m, s;     
   cin >> i;
   h = i / 3600;
   m = i / 60 % 60;
   s = i % 60;
   cout << h << ":" << m << ":" << s <<endl;
   return 0;
}


Measured memory_bytes: 3048
object Main {
  def main(args: Array[String]): Unit = {
    val intSec = io.StdIn.readLine().toInt
    val _h = intSec/(60*60)
    val _m = (intSec%(60*60))/(60)
    val _s = intSec%(60)
    println(_h + ":" + _m + ":" + _s)
  }
}

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

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if(a+b+c >= 22) {
        printf("bust\n");
        return 0;
    }
    else {
        printf("win\n");
        return 0;
    }
}

Measured memory_bytes: 128
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
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(void){

    int N;
    cin >> N;
    int P[N];
    REP(i,N) cin >> P[i];
    int idx[N];
    REP(i,N) idx[P[i]-1] = i+1;

    set<int> s;
    ll ans = 0;
    for(int x=N; x>0; x--){
        ll c;
        int i = idx[x-1];
        s.insert(i);
        int l[2] = {0,0}, r[2] = {N+1,N+1};
        auto itr = s.find(i);
        REP(j,2){
            if(itr == s.begin()) break;
            itr--;
            l[j] = *itr;
        }
        itr = s.find(i);
        REP(j,2){
            itr++;
            if(itr == s.end()) break;
            r[j] = *itr;
        }
        c = (ll)(i-l[0])*(r[1]-r[0]) + (ll)(r[0]-i)*(l[0]-l[1]);
        ans += c*x;
    }

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

Measured memory_bytes: 5760
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    ll l, r;
    cin >> l >> r;
    if(r - l + 1 >= 2019){
        cout << 0 << endl;
        return 0;
    }

    ll res = 2020;
    for(ll i = l; i < r; ++i){
        for(ll j = i+1; j <= r; ++j){
            if(i == j)  continue;
            ll hoge = i * j % 2019;
            chmin(res, hoge);
        }
    }
    cout << res << endl;
}

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */

  struct node *se=nil->next;
  while(se!=nil&&se->key != key){
    se=se->next;
  }
  return se;
}


void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
  if(t==nil)return;
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);

}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  /* your code */
  deleteNode(nil->prev);
}

void delete(int key){
  /* your code */
  deleteNode(listSearch(key));
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  /*

   your code

  */
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;

}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d",com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++;
      }
      size--;
    }
  }

  printList();
  return 0;
}



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

int a,b;

int main() {
	cin>>a>>b;
	if(a>0)cout<<"Positive";
	else if(a==0||(a<0&&b>0))cout<<"Zero"<<endl;
	else if((abs(b)-abs(a))%2!=0)cout<<"Positive"<<endl;
	else cout<<"Negative"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
using namespace std;

template<class T>
void in(vector<T>& V) {
	for (auto itr = V.begin(); itr != V.end(); itr++)cin >> *itr;
	return;
}

template<class T>
void out(vector<T>& V) {
	for (T& itr : V)cout << itr << endl;
	return;
}

//重みなしのグラフのクラス
class graph {
public:
	int N;
	vector<set<int>>* E;
	graph(int);
	graph();
	void construct(int);
	~graph();
	void addEdge(int, int);
	void removeEdge(int, int);
	bool isConnected(int, int);
};

graph::graph(int n) {
	construct(n);
}

graph::graph() {
	N = 0;
}

graph::~graph() {
	delete E;
}

void graph::construct(int n) {
	N = n;
	E = new vector<set<int>>;
	E->resize(N);
}

void graph::addEdge(int a, int b) {
	E->at(a).insert(b);
}

void graph::removeEdge(int a, int b) {
	auto itr = E->at(a).find(b);
	if (itr != E->at(a).end())E->at(a).erase(itr);
}

bool graph::isConnected(int a, int b) {
	return (E->at(a).find(b) != E->at(a).end());
}

void topologicalVisit(graph& g0, int n, vector<char>& check, stack<int>& q, bool& flag) {
	if (check.at(n) == 1) {
		flag = true;
		return;
	}
	if (check.at(n) == 0) {
		check.at(n) = 1;
		for (auto itr = g0.E->at(n).begin(); itr != g0.E->at(n).end(); itr++) {
			topologicalVisit(g0, *itr, check, q, flag);
			if (flag)return;
		}
		check[n] = 2;
		q.push(n);
	}
}

//与えられたグラフにトポロジカル順序?をつけたい
//(i->j => n(i) < n(j))
//グラフ、結果保存用空vector 木か木じゃないか返す
bool topologicalSort(graph& g0, vector<int>& deck) {
	vector<char>* check = new vector<char>;   //初期->0 一時的->1 恒久的-> 2
	check->resize(g0.N);
	for (int i = 0; i < g0.N; i++)check->at(i) = 0;

	stack<int>* qans = new stack<int>;
	bool cflag = false;
	for (int i = 0; i < g0.N; i++) {
		if (check->at(i) != 0)continue;
		topologicalVisit(g0, i, *check, *qans, cflag);
	}
	if (cflag)return false;
	while (!qans->empty()) {
		deck.push_back(qans->top());
		qans->pop();
	}
	delete qans;
	delete check;
	return true;
}

int N, M;

int main() {
	cin >> N >> M;
	graph G(N);
	graph Ginv(N);
	for (int m = 0; m < M; m++) {
		int x, y;
		cin >> x >> y;
		G.addEdge(--x, --y);
		Ginv.addEdge(y, x);
	}
	vector<int> topres;
	topologicalSort(G, topres);
	vector<int> DP;
	DP.resize(N, 0);
	for (int cur : topres) {
		for (int c : Ginv.E->at(cur)) {
			DP[cur] = max(DP[cur], DP[c] + 1);
		}
	}
	int ans = 0;
	for (int n = 0; n < N; n++)ans = max(ans, DP[n]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 23480
import java.util.*;

public class Main{
	static int search(int[] l,int key){
		int left = 0 ;
		int right = l.length;
		int mid ;
		
		while(left < right){
			mid = (left + right) / 2 ;
			if(l[mid] == key){
				return mid;
			}
			else if(l[mid] < key){
				left = mid +1 ;
			}
			else if(key < l[mid]){
				right = mid;
			}
		}
		return -1 ;
	}

	public static void main(String[] args){
	    Scanner scanner = new Scanner(System.in);

	    int n = scanner.nextInt();
	    int[] l = new int[n];
	    for(int i = 0; i < n; i++){
				l[i]=scanner.nextInt();
			}

	    int q = scanner.nextInt();
	    int sum = 0;

	    for(int i = 0; i < q; i++){
	        if(search(l, scanner.nextInt() ) >= 0){
						sum++;
					}
	    }

	    System.out.println(sum);
	}
}



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

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


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

	if (A > 0 && A < 10 && B > 0 && B < 10){
		cout << A*B << endl;
	}
	else{
		cout << "-1" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <set>
#define isPowerOfTwo(S) (!(S & (S - 1)))
#define ll long long
#define ull unsigned long long
#define MAXN 1000000007
#define INF 1e12
using namespace std;
typedef pair<int,int> pi;
typedef pair<pi,int> trip;
typedef pair<ll int,ll int> pli;
typedef vector<int> vi;
typedef vector<ll int> vli;
typedef vector<vi> vvi;
string getString(char x)
{
    string s(1, x);

    return s;
}
int highestPowerof2(ll int n)
{if(n==0)
    return 0;
   int p = (int)log2(n);
   //cout<<p<<"highest"<<endl;
   return p;
}


int main()
{ios::sync_with_stdio(0);
	cin.tie(0);
    int test=1;
    //int cas=
    //cin>>test;
    while(test--)
    {
       int d,t,s;cin>>d>>t>>s;
       if(t*s>=d)
        cout<<"Yes"<<endl;
       else
        cout<<"No"<<endl;

    }

}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

ll DP[300000][13];

ll solve(string S){
    ll sum = 0;
    int tm[6] = {1,10,9,12,3,4};
    vector<int> mis;

    rep(i,sz(S)){
        if(S[i] == '?') mis.pb(tm[(sz(S)-i-1)%6]);
        else sum += (S[i]-'0')*tm[(sz(S)-i-1)%6], sum %= 13;
    }

    if(sz(mis)==0) return sum % 13 == 5;

    rep(i,10) DP[1][(mis[0]*i)%13]++;

    repi(i,2,sz(mis)) rep(j,13){
        DP[i][j] = DP[i-1][j];
        rep1(k,9){
            DP[i][j] += DP[i-1][((j-k*mis[i-1])%13+13)%13] %MOD;
        }
        DP[i][j] %= MOD;
    }

    return DP[sz(mis)][(5+13-sum)%13]%MOD;
}


int main(){
    string S; cin >> S;
    pr(solve(S));
    return 0;
}

Measured memory_bytes: 11208
E=list(map(str,input().split()))
S=[]

for e in E:
    try:
        S.append(int(e))
    except ValueError:
        if e=='+':
            S[-2]=S[-2]+S[-1]
            S.pop(-1)
        elif e=='-':
            S[-2]=S[-2]-S[-1]
            S.pop(-1)
        elif e=='*':
            S[-2]=S[-2]*S[-1]
            S.pop(-1)
print(*S)


Measured memory_bytes: 5604
/* ITP1_5_A:Print a Rectangle */

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

int main(void){
	int W, H, i, j;

	while(1) {
		scanf("%d %d", &W, &H);
		if(!W && !H) {
			break;
		}else {
			i = W;
			while(i--) {
				j = H;
				while(j--) {
					printf("#");
				}
				putchar('\n');
			}
			putchar('\n');
		}
	}

	return 0;
}


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

int main(){
  string S;
  cin >> S;
  if(S.at(2)==S.at(3) && S.at(4)==S.at(5)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll minm;
ll dp[100001];
int fn(ll a[],ll n)
{
    if(n==0)
    {
        dp[0] = min(minm,dp[0]);
        return dp[0];
    }
    if(dp[n] != -1)
    {
        return dp[n];
    }
    else if(n>=2)
    {
       ll x = abs(a[n]-a[n-1]);
       ll y = abs(a[n]-a[n-2]);
       return dp[n] = min(x+fn(a,n-1),y+fn(a,n-2));
    }
    else
    {
        ll x = abs(a[n]-a[n-1]);
       return dp[n] = x + fn(a,n-1); 
    }
    return 0;
}
int main()
{
    ll i,n;
    cin>>n;
    ll a[n];
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }
    memset(dp,-1,sizeof(dp));
    dp[0] = INT_MAX;
    fn(a,n-1);
    cout<<dp[n-1]<<"\n";
    return 0;
}

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

#define  int        long long int
 #define    sp(x)                 setprecision(x)
#define    bp(x)           __builtin_popcount(x)
 #define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int power(int x, int y, int p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0)  
    {     
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res; 
}

int32_t main()
{
    fast
    int n,m,k,ans=0;
    cin>>n>>m>>k;
    int a[n+1],b[m+1];
    f(i,1,n)
        cin>>a[i];
    a[0]=b[0]=0;
    f(i,1,m)
        cin>>b[i];
    f(i,2,n)
        a[i]+=a[i-1];
    f(i,2,m)
        b[i]+=b[i-1];
    f(i,0,n)
    {
        int l=0,r=m,c=0;
        if(a[i]>k)
            continue;
        while(l<=r)
        {
            int mid=(l+r)>>1;
            if(a[i]+b[mid]<=k)
            {
                c=mid;
                l=mid+1;
            }
            else
                r=mid-1;
        }
        ans=max(ans,i+c);
    }
    cout<<ans;
}

Measured memory_bytes: 6764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
#pragma GCC optimize("O2")
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
#define mod             1e9+7
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
const int MAXN = 2e5+ 10;
const ll inf = 1e18;

int intlog(double base, double x) {
    return (int)(log(x) / log(base));
}
int32_t main() {
    fio
    string s;
    cin >> s;
    int x = 0;
    for(auto c : s) x+=c-'0';
    cout << (x%9?"No":"Yes");


}






Measured memory_bytes: 3780
a,b=map(int,input().split())
c=[a]*b
d=[b]*a
for i in range(1):
  if c[i]>d[i]:
    e=str(b)*a
    print(e)
  elif c[i]==d[i]:
    if len(c)>len(d):
      z=str(a)*b
        
      print(z)
    else:
      s=str(b)*a
      print(s)
  else:
    g=str(a)*b
    print(g)


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

vector<int>E[100];
vector<ll>recpath(100);
map<pair<int, int>,int>mp;
ll po(ll a,int n){
	ll ret = 1;
	for (int i = 0; i < n; i++)ret *= a;
	return ret;
}

ll modpow(ll a, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a;
		a = a * a;
		n >>= 1;
	}
	return res;
}

void dfs(int now,int go,int pa,ll path,int num){
	if (now == go) {
		recpath[num] = path;
		return;
	}
	fore(x, E[now]) {
		if (x != pa) {
			path += 1LL << mp[{min(now,x),max(now,x)}];
			dfs(x, go, now, path, num);
			path -= 1LL << mp[{min(now,x),max(now,x)}];
		}
	}
	return;
}
ll cnt(ll n) {
	ll ret = 0;
	while (n > 0) {
		ret += n % 2LL;
		n /= 2LL;
	}
	return ret;
}
vector<ll>dp;

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

	int N;
	cin >> N;
	for (int i = 0; i < N-1; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		E[a].pb(b);
		E[b].pb(a);
		mp[{min(a,b),max(a,b)}] = i;
	}


	int M;
	cin >> M;
	for (int i = 0; i < M; i++) {
		int u, v;
		cin >> u >> v;
		u--, v--;
		dfs(u, v, -1, 0, i);
	}


	dp.resize(1 << M);
	for (int i = 1; i < (1 << M); i++) {
		int rec;
		for (int j = 0; j < M; j++) {
			if ((i >> j) & 1) {
				rec = j;
				break;
			}
		}
		dp[i] = (dp[i - (1 << rec)]|recpath[rec]);
	}


	ll ans = po(2, N - 1);
	ll sub = 0;
	for (int i = 1; i < (1 << M); i++) {
		int bitcnt = 0;
		for (int j = 0; j < M; j++)bitcnt += ((i >> j) & 1);
		ll mul = (bitcnt % 2 == 0) ? -1 : 1;
		sub += mul * modpow(2,N-1-cnt(dp[i]));
	}
	ans -= sub;
	puts(ans);


	return 0;
}

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

const long double PI = 3.14159265358979323846264338327950L;

int main(){
	int a, b, h, m;
  	cin >> a >> b >> h >> m;
  
  	long double rad = PI * 2 * ((long double)h/12.0 + 
		((long double)m / 60.0) / 12.0 - (long double)m / 60.0);
  
	long double rsq = (long double)(a*a + b*b) - (long double)(2*a*b) * cosl(rad);
  	
	printf("%20.20Lf\n", sqrtl(rsq));
}

Measured memory_bytes: 4144
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
#define INF 10000000000
#define PI 3.141592653589793

int main() {
	int n, m, ans = 0;
	cin >> n >> m;
	vector<int> h(n);
	vector<int> a(m);
	vector<int> b(m);
	vector<vector<int>> table(n, vector<int>(0));
	vector<bool> check(n, false);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		table[a[i]-1].push_back(b[i]-1);
		table[b[i]-1].push_back(a[i]-1);
	}

	for (int i = 0; i < n; i++) {
		if (!check[i]) {
			for (int j = 0; j < table[i].size(); j++) {
				if (h[i] <= h[table[i][j]]) {
					check[i] = true;
					break;
				}
				check[table[i][j]] = true;
			}
			if (!check[i]) ans++;
		}
	}

	cout << ans;
	return 0;
}

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

using namespace std;
typedef long long ll;

int main()
{
	ll n=0,buf=0;
	cin >> n;
	vector <ll> mt(n,0);
	vector <ll> a(n, 0);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		if (i % 2 == 0) buf += a[i];
		else buf -= a[i];
	}
	mt[n - 1] = buf;
	mt[0] = 2 * a[0] - mt[n - 1];
	for (int i = 1; i < n-1; i++) mt[i] = 2 * a[i] - mt[i-1];
	cout << mt[n-1] << ' ';
	for (int i = 0; i < n-1; i++) cout << mt[i] << ' ';
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int>sushi(3, 0);
  for (int i = 0; i < N; i ++) {
    int a;
    cin >> a;
    a --;
    sushi[a] ++;
  }
  double dp[303][303][303];
  for (int k = 0; k <= sushi[2]; k ++) {
    for (int j = 0; j <= N - k; j ++) {
      for (int i = 0; i <= N - j - k; i ++) {
        int al = i + j + k;
        if (!al) {
          dp[i][j][k] = (double)0;
          continue;
        }
        dp[i][j][k] = (double) N / al;
        if (i > 0) {
          dp[i][j][k] += (double) dp[i - 1][j][k] * i / al;
        }
        if (j > 0) {
          dp[i][j][k] += (double) dp[i + 1][j - 1][k] * j / al;
        }
        if (k > 0) {
          dp[i][j][k] += (double) dp[i][j + 1][k - 1] * k / al;
        }
      }
    }
  }
  cout << setprecision(10) << dp[sushi[0]][sushi[1]][sushi[2]] <<
    endl;
}


Measured memory_bytes: 217216
#include <bits/stdc++.h>
#define ull unsigned long long int
#define ll long long
#define int long long
#define ld long double
#define endl '\n'
const int mod= 1e9+7;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define trace(x) cerr << #x << " is " << x << endl;
#define all(x) x.begin(),x.end()
#define reset(x,val) memset(x,val,sizeof(x))
#define flush fflush(stdout)
#define sz(a) a.size()
#define pii pair<int,int>
using namespace std;
const int N=100005;
int dp[N],h[N];
int32_t main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>h[i];
    dp[1]=0;
    dp[2]=abs(h[2]-h[1]);
    for(int i=3;i<=n;i++)
    {
     dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]) , dp[i-2]+abs(h[i]-h[i-2])); 
    }
    cout<<dp[n]<<endl;
    return 0;
}



Measured memory_bytes: 1792
A,B,C = map(int, input().split())
flag = False
K = int(input())
for i in range (K+1):
    for t in range (K+1):
        for u  in range(K+1):
            if i + t + u == K:
                if B * (2**t) > A * (2**i) and C * (2**u) > B * (2**t):
                    flag = True
if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll k; cin>>k;
    ll cnt=0;
    queue<ll> que;
    for(ll i=1; i<10; i++) que.push(i);
    while(true){
        ll x=que.front();
        que.pop();
        cnt++;
        if(cnt==k){
            cout<<x<<endl;
            return 0;
        }
        if(x%10>0) que.push(x*10+(x%10)-1);
        que.push(x*10+(x%10));
        if(x%10<9) que.push(x*10+(x%10)+1);
    }
    return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""050-c"""

import sys
import pprint
import re

import itertools
pp = pprint.PrettyPrinter(indent=2)

mod = 1000000007

def main():
    """Main function."""
    N = int(input())
    as_ = sorted(list(map(int, input().split(' '))), reverse=True)

    checker = N - 1
    if N % 2 != 0:
        if as_[-1] != 0:
            print(0)
            sys.exit(0)
        else:
            N = N - 1

    for i in range(0, N, 2):
        if as_[i] != checker or as_[i + 1] != checker:
            print(0)
            sys.exit(0)
        checker = checker - 2

    print(pow(2, N // 2, mod))

if __name__ == '__main__':
    sys.exit(main())

Measured memory_bytes: 14452
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 200005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

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

    cin>>x;

    if(x >= 30)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 3644
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            string s = ReadLine();
            string[] ls = {"A","C","G","T"};
            int ans = 0;
            int now = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (ls.Contains(s[i].ToString()))
                {
                    now++;
                }
                else
                {
                    now = 0;
                }
                if (ans < now)
                {
                    ans = now;
                }
            }
            WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13268
(defun main ()
  (let* ((n (read))
         (m (read))
         (s (make-array `(,n) :element-type 'character :initial-element #\0))
         (c (make-array `(,(1+ n)) :initial-element nil)))
    (if (/= n 1) (setf (aref s 0) #\1))
    (loop 
          :for i :from 1 :to m
          :do (let ((x (read))
                    (y (read)))
                (when (and (aref c x) (/= (aref c x) y))
                  (format t "-1~%")
                  (return-from main))
                (setf (aref c x) y)
                (setf (aref s (1- x)) (code-char (+ y 48)))
                (when (and (/= n 1) (= x 1) (= y 0))
                  (format t "-1~%")
                  (return-from main))))
    (format t "~A~%" s)))
(main)


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

#define N_MAX 100

class Point {
public:
  double x, y;
  Point(double x=0, double y=0) : x(x), y(y) {}
  Point operator + (Point p) { return Point(x + p.x, y + p.y); }
  Point operator - (Point p) { return Point(x - p.x, y - p.y); }
};
typedef Point Vector;

class Segment {
public:
  Point p1, p2;
  Segment(Point p1, Point p2) {
    this->p1 = p1;
    this->p2 = p2;
  }
};

typedef Segment Line;

class Circle {
public:
  Point o;
  double r;
};


double norm(Vector a) { return a.x*a.x + a.y*a.y; }
double abs(Vector a) { return sqrt(norm(a)); }
double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }

double getDistanceSP(Segment s, Point p) {
  if(dot(s.p2 - s.p1, p - s.p1) < 0) return abs(p - s.p1);
  if(dot(s.p1 - s.p2, p - s.p2) < 0) return abs(p - s.p2);
  return fabs(cross(s.p2 - s.p1, p - s.p1)) / abs(s.p2 - s.p1);
}

bool isInCircle(Circle c, Point p) {
  return c.r - abs(c.o - p) > 0;
}

vector<Circle> w(N_MAX);
Point t, s;


void solve() {
  {
    vector<Circle>::iterator it = w.begin();
    while(it != w.end()) {
      bool tic, sic;
      tic = isInCircle(*it, t);
      sic = isInCircle(*it, s);
      if(tic && sic) {
	it = w.erase(it);
      } else if(tic || sic) {
	cout << "Safe" << endl;
	return;
      } else {
	it++;
      }
    }
  }

  Segment u(t, s);
  for(int i = 0; i < w.size(); ++i) {
    if(w[i].r - getDistanceSP(u, w[i].o) >= 0) {
      cout << "Safe" << endl;
      return;
    }
  }
  cout << "Danger" << endl;
}

main() {
  int n;
  while((cin >> n) && n) {
    vector<Circle> v;
    for(int i = 0; i < n; ++i) {
      Circle c;
      cin >> c.o.x >> c.o.y >> c.r;
      v.push_back(c);
    }
    int m;
    cin >> m;
    for(int i = 0; i < m; ++i) {
      w = v;
      cin >> t.x >> t.y >> s.x >> s.y;
      solve();
    }
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

ll INF=1000000007;

int main(){
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll x[26];

    rep(i,26){
        x[i]=1;
        rep(j,s.size()){
            if(s[j] == 'a' + i) x[i]++;
        }
    }

    ll ans=1;
    rep(i,26){
        ans *= x[i];
      ans %= INF;
    }
    cout << ans-1 << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
 
int main()
{
 int ans[4][3][10] = {0}, b, f, r, v, i, n;
 
 scanf("%d\n", &n);
 for(i = 0; i < n; i++)
 {
     scanf("%d %d %d %d\n", &b, &f, &r, &v);
     ans[b - 1][f - 1][r - 1] += v;
 }
 
 for(b = 0; b < 4; b++)
 {
     for(f = 0; f < 3; f++)
     {
         for(r = 0; r < 10; r++)
         {
             printf(" %d", ans[b][f][r]);
         }
         printf("\n");
     }
     if(b < 3) printf("####################\n");
 }
 
 return 0;
}


Measured memory_bytes: 2048
import java.util.*;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        // 宣言
        Scanner sc = new Scanner(System.in);
        StringBuffer sb = new StringBuffer();
        ArrayList<String> strs = new ArrayList<>();
        
        int index = 0;
        // 入力値取得
        int n = sc.nextInt();
        String colInfo = sc.next();
        
        // 文字数 > 1の場合は比較処理をする
        if(colInfo.length() > 1){
            for(int i=0;i<n-1;i = index){
                for(int j=index;j<n-1;j++){
                    if(colInfo.charAt(i) != colInfo.charAt(j+1)){
                        break;
                    }
                    ++index;
                }
                ++index;
                strs.add(colInfo.substring(i,index));
            }
            if(colInfo.charAt(n-1) != colInfo.charAt(n-2)){
                strs.add(colInfo.substring(index,colInfo.length()));            
            }
            System.out.println(strs.size());
        }else{
            System.out.println(1);
        }
    }
}


Measured memory_bytes: 27544
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}
//---------------------------------------------------
signed main() {
	int k, x;
	cin >> k >> x;
	for (int i = x - k + 1; i <= x + k - 1; i++) {
		cout << i << ssp(i, x + k);
	}

}

Measured memory_bytes: 256