akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    int n = s.size() + 1;
    vi a(n, 0);
    
    rep(i, n-1) {
        if (s[i] == '<') {
            chmax(a[i+1], a[i]+1);
        }
    }
    for (int i = n-2; i >= 0; --i) {
        if (s[i] == '>') {
            chmax(a[i], a[i+1]+1);
        }
    }
    
    ll ans = accumulate(a.begin(), a.end(), 0LL);
    cout << ans << endl; 
}

Measured memory_bytes: 2844
A, B, K = map(int, input().split())

# t = -(-K // 2)
# a = K // 2

# result1 = A-t
# result2 = B-a

# if result1 < 0 :
#   result1 = 0
# if result2 < 0 :
#   result2 = 0

# print(result1, result2)

if A < K :
  K = K - A
  A = 0
else :
  A = A - K
  K = 0

if B < K :
  B = 0
else :
  B = B - K

print(A,B)

Measured memory_bytes: 3060
#include<bits/stdc++.h>					
using namespace std;	
int main()	
{		string s;
cin>>s;
int ns =0;
for(int i =0;i+i<s.size();i++){
	if(s[i]!=s[s.size()-1-i]){
		ns++;
	}
}			
cout<<ns;											
	return 0; 									
 } 

Measured memory_bytes: 256
// Add compile option "-std=c++11" for C++11 compile.

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

// Macro
#define rep(i, N) for(int i=0; i<(int)N; i++)
#define rrep(i, N) for(int i=(int)N-1; i>=0; i--)

// Type
template <typename T> using P = pair<T, T>;
using ll = long long;
using ull = unsigned long long;

// Constants
const ll INF = 1e18;
const ll MOD = 1000000007;

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

  if(A == B) cout << 2 * A << endl;
  else cout << max(A, B) + max(A, B) - 1 << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
#define MN 20005
#define inf 500000000
#define lowbit(x) (x&(-x))
int n,p[MN],a[MN],b[MN];
int t[MN],l[MN],r[MN];
int G(int x){int res=0;for(;x;x-=lowbit(x))res+=t[x];return res;}
void C(int x){for(;x<=MN;x+=lowbit(x))t[x]++;}
int main(){
	n=read();
	for(int i=1;i<=n;i++) p[i]=read();
	for(int i=1;i<=n;i++) a[i]=i*(inf/n);
	for(int i=1;i<=n;i++) b[i]=inf-a[i];
	for(int i=1;i<=n;i++) b[p[i]]+=i;
	for(int i=1;i<=n;i++) printf("%d ",a[i]);puts("");
	for(int i=1;i<=n;i++) printf("%d ",b[i]);
	return 0;
}

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

int getS(int x) {
  if(x == 1) return 0;
  int sum = 1;
  int i;
  for(i = 2; i*i < x; ++i) {
    if(x % i == 0) sum += i + x/i;
  }
  if(i*i == x) sum += i;
  return sum;
}

int main() {
  int N;
  while(cin >> N && N) {
    int S = getS(N);
    if(N == S) {
      cout << "perfect number" << endl;
    } else if(N > S) {
      cout << "deficient number" << endl;
    } else if(N < S) {
      cout << "abundant number" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1156
import collections
a, b = map(int, input().split())
c, d = map(int, input().split())
e, f = map(int, input().split())
arr = [a,b,c,d,e,f]
A = collections.Counter(arr).most_common()

if len(A) == 4:
    if A[0][1] == 2 and A[1][1] == 2 and A[2][1] == 1 and A[3][1] == 1:
        print('YES')
    else:
        print('NO')
else:
    print('NO')

Measured memory_bytes: 3316
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
 
int main(){
  int N;
  cin >> N;
  LL A[N],B[N];
  LL ans=0;
  LL tmp=0;
  REP(i,N) cin >> A[i] >> B[i];
  for(int i=N-1;i>=0;--i){
    A[i]+=tmp;
    if((A[i])%B[i]!=0){
      ans+=B[i]-A[i]%B[i];
      tmp+=B[i]-A[i]%B[i];
    }
  }
  cout << ans;
  }

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

using namespace std;

#define ll long long

struct Barrier {
	double x;
	double y;
	double r;
};

double Distance(Barrier b1, Barrier b2) {
	double d = sqrt((b1.x - b2.x) * (b1.x - b2.x) + (b1.y - b2.y) * (b1.y - b2.y)) - b1.r - b2.r;
	return d > 0 ? d : 0;
}

template <typename T>
vector<T> dijkstra(int s, vector<vector<pair<int, T> > > & G) {
	const T INF = numeric_limits<T>::max();
	using P = pair<T, int>;
	int n = G.size();
	vector<T> d(n, INF);
	vector<int> b(n, -1);
	priority_queue<P, vector<P>, greater<P> > q;
	d[s] = 0;
	q.emplace(d[s], s);
	while (!q.empty()) {
		P p = q.top(); q.pop();
		int v = p.second;
		if (d[v]<p.first) continue;
		for (auto& e : G[v]) {
			int u = e.first;
			T c = e.second;
			if (d[u]>d[v] + c) {
				d[u] = d[v] + c;
				b[u] = v;
				q.emplace(d[u], u);
			}
		}
	}
	return d;
}

int main() {
	double xs, ys, xt, yt;
	int n;
	cin >> xs >> ys >> xt >> yt;
	cin >> n;
	vector<Barrier> node(n + 2);
	node[0].x = xs;
	node[0].y = ys;
	node[0].r = 0;
	for (int i = 1; i <= n; i++) {
		cin >> node[i].x >> node[i].y >> node[i].r;
	}
	node[n + 1].x = xt;
	node[n + 1].y = yt;
	node[n + 1].r = 0;

	vector<vector<pair<int, double>>> G(n + 2);
	for (int i = 0; i <= n + 1; i++) {
		for (int j = 0; j <= n + 1; j++) {
			double d = Distance(node[i],node[j]);
			G[i].emplace_back(j,d);
			G[j].emplace_back(i,d);
		}
	}

	cout << setprecision(10) << dijkstra(0,G)[n + 1] << endl;

	return 0;
}


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

#ifdef DEBUG
#define deb(...) cerr __VA_ARGS__
#else
#define deb(...)
#endif
using namespace std;

int main()
{
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	
	vector<int> a(n+1);
	
	for(int i=1; i <= n; ++i)
	{
		int x;
		cin >> x;
		a[x] = i;
	}
	
	for(int i=1; i <= n; ++i)
		cout << a[i] << " ";
}


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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	int n;
	cin >> n;
	int countOdd = 0;
	FOR(i,0,n){
		int a;
		cin >> a;
		if(a % 2 == 1)countOdd++;
	}
	YES(countOdd % 2 == 0);
	return 0;
}


Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

def func(arr):
    if len(arr) == 0:
        return 0
    tmp = min(arr)
    arr = [i - tmp for i in arr]
    n_arr = []
    strt = 0
    flag = False
    for i in range(len(arr)):
        if arr[i] == 0 and flag:
            n_arr.append(arr[strt:i])
            flag = False
        if arr[i] != 0 and not flag:
            flag = True
            strt = i
    if flag:
        n_arr.append(arr[strt:])
    s = tmp
    for i in n_arr:
        s += func(i)
    return s

n = INT()
h = LIST()
ans = func(h)
print(ans)

Measured memory_bytes: 61932
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
#include <iomanip>
// #include <regex> //正規表現
using namespace std;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007ll
#define INF 1000000000
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
// グリッドグラフの移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int N, W; cin >> N >> W ;
VI w(N), v(N); rep(i, 0, N) cin >> w[i] >> v[i];

int maxv = *max_element(ALL(v));
// dp[i][j] = i 番目まで，j 以上の価値にするときの，重さの最小値．
vector<vector<int64_t>> dp(N+1, vector<int64_t>(N * maxv + 1, INF));
dp[0][0] = 0;

rep(i, 1, N+1){
    rep(j, 0, N * maxv + 1){
        if (j >= v[i-1]){
            dp[i][j] = min(dp[i-1][j], dp[i-1][j - v[i-1]] + w[i-1]);
        }
        else 
            dp[i][j] = dp[i-1][j];
    }
}

int ans = 0;
rep(i, 0, N * maxv + 1){
    if (dp[N][i] <= W) ans = max(ans, i);
}

cout << ans << "\n";
}

// 境界，出力文字列 チェック



Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,cnt = 0;
  cin >> N;
  int bubble[N];
  for(int i=0;i<N;i++){
    cin >> bubble[i];
  }
  
  double flag = true;
  while(flag){
    flag = false;
    for(int j=N-1;j>=1;j--){
      if(bubble[j] < bubble[j-1]){
	swap(bubble[j],bubble[j-1]);
	cnt++;
	flag = 1;
      }
    }
  }
  for(int i=0;i<N;i++){
    if(i!= N-1){
    cout << bubble[i] << " ";
    }
    else{
      cout << bubble[i] << endl;
    }
  }
  cout << cnt << endl;
}
      

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds; 
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define trace(x)  cerr << #x << ": " << x << endl;
typedef long long ll;
typedef long double ld;
//const ll MOD = 1e9+7;
void __print(ll x) {cerr << x;}
void __print(ld x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

int main()
{
	fast;
	double d,s,t;cin>>d>>t>>s;
	double z=(1.0*d)/s;
	if(t>=z)cout<<"Yes";
	else cout<<"No";
}

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

int main(){
  int h, w;
  cin >> h >> w;
  vector<vector<char>> v(h+2, vector<char>(w+2, '#'));
  for(int i = 1; i <= h; i++){
    for(int j = 1; j <= w; j++){
      cin >> v[i][j];
    }
  }
  for(int i = 0; i < h+2; i++){
    for(int j = 0; j < w+2; j++){
      cout << v[i][j];
    }
    cout << endl;
  }
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define out(S) cout<<(S)<<endl;
#define ShowAll(collection) for(auto i:collection){out(i);}
#define beginend(v) v.begin(),v.end()

using pii=pair<int,int>;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vvc=vector<vector<char>>;
using ti3=tuple<int,int,int>;
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }

// x=>ABC
string encode(const string s,const char x){
  string rt="";
  for(auto c:s){
    if(c==x) rt+="ABC";
    else rt += c;
  }
  return rt;
}

// ABC=>x
string decode(string s,char x){
  auto n=s.size();
  string rt="";
  
  for(int i=0;i<n;++i){
    if(i+2<n&&s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
      rt+=x;
      i+=2;
    }else rt+=s[i];
  }
  
  return rt;
}

bool check(const string& s){
  int cnt[3]{0};
  for(auto c:s) cnt[c-'A']++;

  return (cnt[0]>0&&cnt[1]>0&&cnt[2]>0);
}

bool solve(){
  string S;
  cin >> S;

  while(1){
    if(!check(S))break;
    if(S=="ABC") return true;

    char item='k';
    for(auto c='A';c<='C';c++){
      if(S==encode(decode(S,c),c)){
        item=c;
      }
    }
    if(item=='k') break;
    S=decode(S,item);
  }
  return false;
}

int main(){
  cout << (solve()?"Yes":"No") << endl;
}



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

int main() {
	int a, b, c;
	cin >> a >> b >> c;

	int max, mid, min;
	if (a > b) {
		max = a;
		mid = b;
		if (c > a) {
			max = c;
			mid = a;
			min = b;
		} else if (c > b) {
			mid = c;
			min = b;
		} else {
			min = c;
		}
	}
	else if (b > a) {
		max = b;
		mid = a;
		if (c > b) {
			max = c;
			mid = b;
			min = a;
		} else if (c > a) {
			mid = c;
			min = a;
		} else {
			min = c;
		}
	}

	cout << min << " " << mid << " " << max << endl;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  
  double hour = 30 * h + 0.5 * m;
  double minute = 6 * m;
  
  double dif = max(hour, minute) - min(hour, minute);
  double ans2 = pow(a, 2) + pow(b, 2) - 2 * a * b * cos(dif / 180.0 * pi);
  printf("%.10f\n", pow(ans2, 0.5));
  
  return 0;
}


Measured memory_bytes: 4296
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using pll = pair<long long, long long>;
const long long INF = 1<<29;

const int MOD = 1000000007;
long long ruizyou(long long m,long long n){
  if(m == 0)return 0;
  if(m == 1)return 1;
  long long ans = 1;
  long long tmp = m;
  for(int i=0;i<=30;i++){
    if(n & (1<<i)){
      ans *= tmp;
      ans %= MOD;
    }
    tmp *= tmp;
    tmp %= MOD;
  }
  return ans;
}
long long kaizyou(long long x){
  if(x == 0)return 1;
  return x * kaizyou(x-1) % MOD;
}
long long comb(long long x,long long y){
  long long bunsi = kaizyou(x);
  long long bunbo = kaizyou(x-y) * kaizyou(y) % MOD;
  return bunsi * ruizyou((int)bunbo,MOD-2) % MOD;
}
struct unionfind{
  vector<int> par;
  vector<int> hukasa;
  unionfind(int n){
    par = vector<int>(n);
    hukasa = vector<int>(n,0);
    for(int i=0;i<n;i++){
      par.at(i) = i;
    }
  }
  int root(int x){
    if(par.at(x) == x)return x;
    return root(par.at(x));
  }
  void unite(int x,int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry)return;
    if(hukasa.at(rx) >= hukasa.at(ry)){
      par.at(ry) = rx;
      hukasa.at(rx) = max(hukasa.at(ry) + 1,hukasa.at(rx));
    }
    else{
      par.at(rx) = ry;
    }
  }
  bool same(int x,int y){
    return root(x) == root(y);
  }
};
int ctoi(char a){
  return a - '0';
}
long long gcd(long long a,long long b){
  long long c = max(a,b);
  long long d = min(a,b);
  if(d % c == 0)return c;
  return gcd(c,d%c);
}
long long lcm(long long a,long long b){
  return a * b / gcd(a,b);
}
int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0;i<n;i++)cin >> a.at(i);
  int maxa = a.at(0);
  for(int i=1;i<n;i++){
    maxa = max(maxa,a.at(i));
  }
  int x = 1,y = maxa;
  while(y != x){
    int z = (x + y)/2;
    vector<int> b(n);
    for(int i=0;i<n;i++){
      b.at(i) = a.at(i) / z - (a.at(i) % z == 0);
    }
    long long count = 0;
    for(int i=0;i<n;i++)count += b.at(i);
    if(count <= k){
      y = z;
    }
    else x = z + 1;
  }
  cout << x << endl;
}

Measured memory_bytes: 4696
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//
//#include <immintrin.h>
//#include <emmintrin.h>

#include <bits/stdc++.h>
//#pragma GCC optimize("O2")
#define vi vector<int>
#define pii pair<int, int >
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define LL long long
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define all2(x,n) (x+1), (x+1+n)
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define mt make_tuple
#define eb emplace_back
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define contain(S,X) (((S)&o(X))!=0)
#define containL(S,X) (((S)&oL(X))!=0)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=998244353;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;
inline int getplc(int x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}
LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
	LL res=1;
	for(;b;b>>=1,a=a*a%_MOD){
		if(b&1)res=res*a%_MOD;
	}
	return res;
}
// Smax
//int Smax() { return -INF; }
template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) { return max(a, Smax(args...)); }
// Smin
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) { return min(a, Smin(args...)); }
template <typename T>
// erro
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); errl(_it, args); }

void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	errl(++it, args...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl;}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << "=" << a << " # ";
	err(++it, args...);
}
void Solve();
int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
//    freopen("o1.txt","w",stdout);
#endif
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	Solve();
	return 0;
}

//////////////////////////////////////////////////////////////////


void Solve(){
  int x;
  cin>>x;
  if(x>=30)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

int64_t MOD = 1000000007;
int64_t MAX = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int N;
    cin >> N;
    vector<int> list(N);
    vector<bool> baisu(10000001);
    map<int, int> hist;

    for (int i = 0; i < N; i++)
    {
        int tmp;
        cin >> tmp;
        list[i] = tmp;
        hist[tmp]++;
    }

    for (auto x : hist)
    {
        int p = x.first, q = 2;
        while (p * q <= 1000000)
        {
            baisu[p * q] = true;
            q++;
        }
    }
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int tmp = list[i];
        if (hist[tmp] == 1 && baisu[tmp] == false)
            ans++;
    }
    cout << ans;
}

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

int main()
{
        long long N, K;
        long long a, b;
        cin >> N >> K;

        a = N - K * (N / K);
        b = -(a - K);

        if(a >= b)
        {
                cout << b << endl;
        }
        else
        {
                cout << a << endl;
        }

        return 0;
}


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

const int kN = 1000000 + 5;
const int MOD = (int)1e9 + 7;
int Inv[kN], Finv[kN], F[kN], n, m, k;
int pascal[kN];

int binom(int a, int b)
{
    if (b < 0 || b > a) return 0;
    return F[a] * 1LL * Finv[b] % MOD * Finv[a - b] % MOD;
}

inline void add(int &a, int b)
{
    a += b;
    if (a >= MOD) a -= MOD;
}

int power(int a, int b, int p)
{
    int ret = 1;
    for ( ; b; b >>= 1, a = a * 1LL * a % MOD)
        if (b & 1)
            ret = ret * 1LL * a % MOD;
    return ret;
}

int main()
{
    Inv[1] = 1;
    for (int i = 2; i < kN; ++ i)
        Inv[i] = (MOD - MOD / i) * 1LL * Inv[MOD % i] % MOD;
    F[0] = Finv[0] = 1;
    for (int i = 1; i < kN; ++ i) {
        F[i] = F[i - 1] * 1LL * i % MOD;
        Finv[i] = Finv[i - 1] * 1LL * Inv[i] % MOD;
    }
    scanf("%d%d%d", &n, &m, &k);
    pascal[0] = 1;
    for (int i = 1; i <= m + k; ++ i) {
        pascal[i] = (pascal[i - 1] << 1) % MOD;
        if (i >= m + 1) add(pascal[i], MOD - binom(i - 1, m));
        if (i >= k + 1) add(pascal[i], MOD - binom(i - 1, i - (k + 1)));
    }
    int result = 0;
    int t = n + m + k;
    for (int i = n; i <= t; ++ i) {
        add(result, binom(i - 1, n - 1) * 1LL * power(3, t - i, MOD) % MOD * pascal[i - n] % MOD);
    }
    printf("%d\n", result);
}


Measured memory_bytes: 15744
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(pair<int,int>a, pair<int,int>b) {
	if (a.first == b.first) {
		return a.second > b.second;
	}
	else {
		return a.first < b.first;
	}
}

int main() {
	llint n;
	cin >> n;
	vllint a(n), b(n);
	rep(i, n) {
		cin >> a[i] >> b[i];
	}
	rep(i, n) {
		a[i] = a[i] % b[i];
	}
	llint cnt = 0;
	drep(i, n) {
		a[i] += cnt;
		a[i] %= b[i];
		if (a[i] == 0)a[i] = b[i];
		cnt += b[i] - a[i];
	}
	cout << cnt << endl;
}

Measured memory_bytes: 1792
import java.io.*;
import java.util.*;

public class Main implements Runnable {
	public static void main (String[] args) {new Thread(null, new Main(), "_cf", 1 << 28).start();}

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("");

		int a = fs.nextInt();
		int b = fs.nextInt();
		if((a+b)%2 == 1) out.println("IMPOSSIBLE");
		else out.println((a+b)/2);
		
		out.close();
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) {
			try {
				in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
			}
			catch (Exception e) {
				in = new BufferedInputStream(System.in, BS);
			}
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
		
		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}
		
	}

}

Measured memory_bytes: 25428
#include<bits/stdc++.h>
using namespace std;
 
typedef    long long          ll;
typedef    vector<long long>    vi; 
typedef    vector<vi>         vvi; 
typedef    pair<long,long>      ii; 
#define    sz(a)              long((a).size()) 
#define    pb                 push_back 
#define    mp                   make_pair
#define    all(c)             (c).begin(),(c).end() 
#define    tr(c,i)            for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++) 
#define    present(c,x)       ((c).find(x) != (c).end()) 
#define    cpresent(c,x)      (find(all(c),x) != (c).end())  
#define    input(v,n)           for(ll i = 0 ; i<n ; i++) cin>>v[i]
#define    output(v,n)          for(ll i = 0 ; i<n ; i++) cout<<v[i]<<" "


ll dp[102][100002];
ll mod = 1e9+7;

 
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  ll n, k,i,j;
  cin>>n>>k;
  vi a(n);

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

  dp[0][0]=1;

  for(i=1;i<=n;i++)
  {

    
      for(j=1;j<=k;j++)
       { dp[i-1][j]+=dp[i-1][j-1];dp[i-1][j]%=mod;}
    
    for(j=0;j<=k;j++)
    {

      dp[i][j]=dp[i-1][j]-((j-a[i-1]-1>=0)?(dp[i-1][max(j-a[i-1]-1,0LL)]):0);
      dp[i][j]+=mod;
      dp[i][j]%=mod;

      //cout<<dp[i][j]<<" ";
    }

    //cout<<"\n";
    




  }


  cout<<dp[n][k]<<"\n";

  return 0;
}


Measured memory_bytes: 79232
n, k = map(int, input().split())
a_l = list(map(int, input().split()))
           
import sys
import numpy as np

def g():
    m_l = np.array([0]*(n+1))

    r = 0
    for a in a_l:
        if m_l[a] == 0: r += 1
        m_l[a] += 1

    if r <= k:
        print(0)
        sys.exit(0)

    mn = 0
    while True:
        ma = np.ma.masked_equal(m_l, 0, copy=False)
        a = np.where(m_l == ma.min())[0]

        for i in a:
            mn += m_l[i]
            r -= 1
            m_l[i] = 0

            if r <= k: return mn
        
print(g())


Measured memory_bytes: 25860
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
typedef long long ll;

int a[100010];
int b[100010];
int main()
{
    int n;
    ll cnt = 0;
    cin >> n;
    REP(i, n + 1)
        cin >> a[i];
    REP(i, n)
        cin >> b[i];

    int j = 0;
    for (int i = 0; i < n; i++)
    {
        if(a[i]<=b[i]){
            cnt += a[i];
            b[i] -= a[i];
            a[i] = 0;
            if (a[i+1] <= b[i])
            {
                cnt += a[i+1];
                b[i] -= a[i+1];
                a[i+1] = 0;
            }
            else
            {
                cnt += b[i];
                a[i+1] -= b[i];
                b[i] = 0;
            }
        }
        else{
            cnt += b[i];
            a[i] -= b[i];
            b[i] = 0;
             if(a[i]<=b[i]){
            cnt += a[i];
            b[i] -= a[i];
            a[i] = 0;
             
            if (a[i+1] <= b[i])
            {
                cnt += a[i+1];
                b[i] -= a[i+1];
                a[i+1] = 0;
            }
            else
            {
                cnt += b[i];
                a[i + 1] -= b[i];
                b[i] = 0;
            }
        }
    }
    }
   /*   for (int i = 0; i < n+1; i++)
    {
        cerr << a[i] << endl;
    }

    for (int i = 0; i < n; i++)
    {
        cerr << b[i] << endl;
    }
    cerr << cnt << endl;
    for (int i = 0; i < n; i++)
    {
        if(i!=n-1 && b[i]>0){
            if(a[i+1]>=b[i]){
            cnt += b[i];
            a[i + 1] -= b[i];
            }
            else if (a[i+1]>0){
                cnt += a[i + 1];
                a[i + 1] = 0;
            }
        }
        //cerr << cnt << endl;
        if (i == n - 1)
        {
            cnt += min(b[i], a[i] + a[i + 1] );
            //cerr << min(b[i], a[i] + a[i + 1]) << endl;
        }
    }*/
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
  string s ;
  cin >> s ;
  
  int ans = 7 ;
  
  if(s=="SAT"){
   ans = 1 ;
  }else if(s=="MON"){
       ans = 6 ;
  }else if(s=="TUE"){
       ans = 5 ;
   }else if(s=="WED"){
       ans = 4 ;
  }else if(s=="THU"){
       ans = 3 ;
  }else if(s=="FRI"){
       ans = 2 ;
  }else{
    ans = 7 ;
}
  cout << ans << endl ;     
  return 0;
}


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


int main(void){
    int N; cin >> N;
    string S; cin >> S;
    int ans = 0;
    for (int i = 0; i < N-2; i++)
    {
        if(S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;

#define MOD 998244353


ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}
  
  

int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    ll same = 0;
    if(a == b)same++;
    if(a == c)same++;
    if (b == c)same++;
    
    if(same == 1)puts("Yes");
    else puts("No");
    return 0;
}
    
    



Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
const int p = 1e9+7;
const int N = 1500010;
int fac[N], inv[N], pwr[N];
inline int qp(int x, int y) {
	int res = 1;
	for(; y; y >>= 1, x = (ll)x*x%p) if(y&1) res = (ll)res*x%p;
	return res;
}
inline void init(int n) {
	fac[0] = pwr[0] = 1;
	for(int i = 1; i <= n; i ++ ) fac[i] = (ll)i*fac[i-1]%p, pwr[i] = pwr[i-1]*(ll)3%p;
	inv[n] = qp(fac[n], p-2);
	for(int i = n; i >= 1; i -- ) inv[i-1] = (ll)i*inv[i]%p;
}
inline ll c(int n, int m) {
	if(n < m) return 0;
	return (ll)fac[n]*inv[m]%p*inv[n-m]%p;
}
int main() {
	int A, B, C; scanf("%d%d%d", &A, &B, &C);
	init(A+B+C); A -- ;
	if(C < B) swap(B, C);
	ll now = 1, ans = 0;
	for(int i = 0; i <= B+C; i ++ ) {
		ans = (ans+c(A+i, A)*pwr[B+C-i]%p*now)%p;
		if(i < B) now = now*2%p;
		else if(i < C) now = (now*2-c(i, B))%p;
		else now = (now*2-c(i, B)-c(i, C))%p;
	}
	printf("%lld\n", (ans+p)%p);
	getchar(), getchar();
}


Measured memory_bytes: 16640
#include <iostream>

using namespace std;

int main(int argc, const char *argv[]) {
  int count = 0;
  int max = 0;
  string S;
  cin >> S;

  for (int i = 0; i < S.length(); i++) {
    for (int j = i; i < S.length(); j++) {
      if (S[j] == 'A' || S[j] == 'C' || S[j] == 'G' || S[j] == 'T') {
        count++;
      } else {
        break;
      }
    }
    if(count > max){
      max = count;
    }
    count = 0;
  }
  cout << max << endl;

  return 0;
}


Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    def group_count(self):
        return len(self.roots())
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N, M, K = map(int, input().split())
uf = UnionFind(N)
cnt = [0]*(N+1)
cnt2 = [[] for _ in range(N+1)]
ans = [0]*N
for i in range(M):
    A, B = map(int, input().split())
    uf.union(A-1,B-1)
    cnt[A] += 1
    cnt[B] += 1
for i in range(K):
    C, D = map(int, input().split())
    cnt2[D].append(C)
    cnt2[C].append(D)
for i in range(N):
    tmp = 0
    for k in cnt2[i+1]:
        if uf.same(k-1,i):
            tmp += 1
    ans[i] = uf.size(i)-1-cnt[i+1]-tmp
print(*ans)

Measured memory_bytes: 113696
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  ll H,W;
  cin >> H >> W;

    //横方向に分割
  ll min_1 = 1e10;
  for(ll h = 1;h <= H-1;h++){
    ll s11 = W * h;
    ll s12 = W * ((H-h)/2);
    ll s13 = W * (H - h) - s12;
    min_1 = min(min_1,max({s11,s12,s13}) - min({s11,s12,s13}));

    ll s21 = W * h;
    ll s22 = (H - h)*(W - W/2);
    ll s23 = (H - h)*W - s22;

    min_1 = min(min_1,max({s21,s22,s23}) - min({s21,s22,s23}));
  }

  ll min_2 = 1e10;
  for(ll w = 1;w <= W-1;w++){
    ll t11 = H * w;
    ll t12 = H * ((W - w)/2);
    ll t13 = H * (W - w) - t12;

    min_2 = min(min_2,max({t11,t12,t13}) - min({t11,t12,t13}));

    ll t21 = H * w;
    ll t22 = (H - H/2)*(W-w);
    ll t23 = H * (W - w) - t22;

    min_2 = min(min_2,max({t21,t22,t23}) - min({t21,t22,t23}));
  }

  cout << min(min_1,min_2) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
   long x;
   cin>>x;
   long ans;
   if(x<=6) {cout<<1;}
   else if(x<=11) {cout<<2;}
   else {
       ans=(x/11)*2;
       if(x%11<=6&&x%11>0) {ans++;}
       if(x%11<=10&&x%11>6) {ans+=2;}
       cout<<ans;
   }
   
   return 0;
}


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

int main() {
	// your code goes here
	string s;
	cin>>s;
	int start=0,end=0,i=0,max_len=0;
	while(end<s.size()){
		if(s[end]=='A' || s[end]=='G' || s[end]=='T' || s[end]=='C'){
			start=end;
			//end++;
			while(end<s.size() && (s[end]=='A' || s[end]=='G' || s[end]=='T' || s[end]=='C')){
			//start=end;
			//max_len=max(max_len,end-start+1);
				end++;
			}
			max_len=max(max_len,end-start);
		}
		else{
			end++;
		}
	}
	//max_len=max(max_len,end-start+1);
	cout<<max_len;
	return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

string S[105];
ll x[2] = {0, 1};
ll y[2] = {1, 0};
ll M[105][105];

struct Data {
    pll g;
    ll cost;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H, W;
    cin >> H >> W;
    REP(i, H) {
        cin >> S[i];
    }

    REP(i, H) {
        REP(j, W) {
            M[i][j] = INF;
        }
    }

    ll c = 0;
    if (S[0][0] == '#')
        c++;
    priority_queue<Data, vector<Data>, function<bool(Data, Data)>> q([](Data a, Data b) { return a.cost > b.cost; });
    q.push(Data{pll(0, 0), c});
    while (!q.empty()) {
        Data t = q.top();
        q.pop();
        REP(i, 2) {
            ll nx = t.g.first + x[i], ny = t.g.second + y[i];
            if (nx >= H || ny >= W)
                continue;
            ll cost = t.cost;
            if (S[t.g.first][t.g.second] != S[nx][ny] && S[nx][ny] == '#')
                cost++;
            if (M[nx][ny] <= cost)
                continue;
            M[nx][ny] = cost;
            q.push(Data{pll(nx, ny), cost});
        }
    }

    cout << M[H - 1][W - 1] << endl;

    return 0;
}

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


int main() {

	int N;
	cin>>N;
	
	string S;
	cin>>S;
	
	vector<int> d(2*N,1);
	if(S[0]=='W')d[0]=0;
	for(int i=1;i<2*N;i++){
		if(S[i]==S[i-1])d[i]=0;
		else d[i]=1;
	}
	
	int ans = 1;
	int l = 0;
	
	for(int i=0;i<2*N;i++){
		if(d[i]==0){
			ans = mod(ans * l);
			l--;
			if(i!=2*N-1)d[i+1]^=1;
		}
		else{
			l++;
		}
	}
	
	if(l!=0){
		cout<<0<<endl;
		return 0;
	}
	
	for(int i=1;i<=N;i++){
		ans = mod(ans * i);
	}
	
	cout<<ans<<endl;
	

    return 0;


}


Measured memory_bytes: 1412
$a = <>;
$in = <>;
@b = split/ /,$in;
@b = sort {$a <=> $b} @b;
$kati = $b[0];

for(my $i = 1; $i < $a; $i++){
	$kati = ($kati + $b[$i])/2;
}
print $kati;


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

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)

#define nl '\n'
#define ioi exit(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int,int> pii;
typedef pair<int,int> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

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

string conv(int a){
	stringstream ss;
	ss << a;
	string str = ss.str();
	return str;
}


string conv(char a){
	stringstream ss;
	ss << a;
	string str = ss.str();
	return str;
}

int conv(string a){
    stringstream geek(a); 
    int x = 0; 
    geek >> x;   
	return x;
}


int n, A, B, C;
int v[10];
int dfs(int i, int a, int b, int c){
	
	if(i == n+1)
		return min(a,min(b,c)) > 0 ? abs(A- a) + abs(B-b) + abs(C-c) - 30: inf;
	int s1 = dfs(i + 1, a, b , c);
	int s2 = dfs(i + 1, a + v[i], b, c) + 10;
	int s3 = dfs(i + 1, a , b + v[i], c) + 10;
	int s4 = dfs(i + 1, a , b, c + v[i]) + 10;
	return min(min(s1,s2),min(s3,s4));
}

int main(){
	cin>> n >> A >> B >> C;
	rep(i,1,n)
		cin>> v[i];
	cout<< dfs(1,0,0,0);
	return 0;
}


Measured memory_bytes: 256
#![allow(unused)]

use std::{cell, cmp, collections, fmt, ops};

use cell::{Cell, RefCell};
use cmp::Ordering::{Equal, Greater, Less};
use collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use fmt::{Debug, Display};

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

#[cfg(feature = "debug")]
macro_rules! dbg {
    ($($args: tt)*) => { eprint!($($args)*) };
}

#[cfg(feature = "debug")]
macro_rules! dbgln {
    ($($args: tt)*) => { eprintln!($($args)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! dbg {
    ($($args:tt)*) => {};
}

#[cfg(not(feature = "debug"))]
macro_rules! dbgln {
    ($($args:tt)*) => {};
}

mod num {
    //
}

macro_rules! vmin {
    ($x: expr, $y: expr) => { cmp::min($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::min($x, vmin!($($args),*)) };
}

macro_rules! vmax {
    ($x: expr, $y: expr) => { cmp::max($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::max($x, vmax!($($args),*)) };
}

mod bits {
    pub fn is_high(bits: u64, pos: u64) -> bool {
        bits & (1 << pos) != 0
    }
}

fn main() {
    input!(n: usize, k: usize);

    if n % k == 0 {
        println!("0");
    } else {
        println!("1");
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        //
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int H,W,K;cin >> H >> W >> K;
  vector<vector<char> > cake(W,vector<char>(H));
  vector<int> w_count(W);
  vector<int> h_count(H);
  rep(y,H)rep(x,W){
    cin >> cake[x][y];
    if(cake[x][y] == '#'){
      ++w_count[x];
      ++h_count[y];
    }
  }
  bool fin = false;
  int num = 1;
  vector<vector<int> > ans(W,vector<int>(H,0));
  rep(y,H){
    if(h_count[y] == 0) continue;
    rep(x,W){
      if(fin && h_count[y] != 0){
        ++num;
        fin = false;
      }
      if(cake[x][y] == '#'){
        --h_count[y];
        fin = true;
      }
      ans[x][y] = num;
    }
  }
  fin = false;
  while(!fin){
    fin = true;
    rep(y,H-1){
      rep(x,W) if(ans[x][y] == 0) ans[x][y] = ans[x][y+1];
    }
    perr(y,1,H){
      rep(x,W) if(ans[x][y] == 0) ans[x][y] = ans[x][y-1];
    }
    rep(y,H) rep(x,W) if(ans[x][y] == 0) fin = false;
  }
  rep(y,H){
    rep(x,W)cout << ans[x][y] SPF;
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 1280