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>;
vector<vector<int> > calcNext(const string &S) {
    int n = (int)S.size();
    vector<vector<int> > res(n+1, vector<int>(10, n));
    for (int i = n-1; i >= 0; --i) {
        for (int j = 0; j < 10; ++j) res[i][j] = res[i+1][j];
        res[i][S[i]-'0'] = i;
    }
    return res;
}
void add(long long &a, long long b) {
    a += b;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string S;
    cin >> N >> S;
    vector<vector<int>> next = calcNext(S);
    vector<vector<ll>> dp(N+1, vector<ll>(4));
    dp[0][0] = 1;
    for (int i = 0; i < N; ++i) {
        for(int k = 0;k <= 2; k++){
            for (int j = 0; j < 10; ++j) {
                if (next[i][j] >= N) continue;
                add(dp[next[i][j] + 1][k+1], dp[i][k]);
            }
        }
    }
    ll res = 0;
    rep(i, N+1){
        add(res, dp[i][3]);
    }
    cout << res << endl;
}






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

using namespace std;

int n;
int c;
int d[30][30];
int g[500][500];
int iw[3][30];

int main(){
    cin >> n >> c;
    for (int i = 0; i < c; ++i) {
        for (int j = 0; j < c; ++j) {
            cin >> d[i][j];
        }
    }

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

    for (int k = 0; k < 3; ++k) {
        for (int cc = 0; cc < c; ++cc) {
            iw[k][cc] = 0;
            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < n; ++j) {
                    if ((i + j) % 3 == k) {
                        iw[k][cc] += d[g[i][j]][cc];
                    }
                }
            }
            //cout << k << ", " << cc + 1 <<":"<<iw[k][cc] << endl;
        }
    }

    int ans = 1000 * n * n + 10;
    for (int c1 = 0; c1 < c; ++c1) {
        for (int c2 = 0; c2 < c; ++c2) {
            for (int c3 = 0; c3 < c; ++c3) {
                //cout << c1 << c2 << c3 <<endl;
                if (c1 == c2 || c2 == c3 || c3 == c1) continue;
                ans = min(ans, iw[0][c1] + iw[1][c2] + iw[2][c3]);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1912
N = int(input())
X = list(map(int, input().split()))

X_s = sorted(X)

median = [X_s[N//2-1], X_s[N//2]]


for i in range(N):
    if X[i] <= X_s[N//2-1]:
        print(X_s[N//2])
    else:
        print(X_s[N//2-1])


Measured memory_bytes: 25620
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
double dp[3001][3001];
double p[3001];
double dpf(int n,int i)
{
       if (dp[n][i]!=2 ) {return dp[n][i];                                   }
  else if (n==0        ) {return dp[n][i]=1;                                 }
  else if (i==0        ) {return dp[n][i]=0;                                 }
  else if (i>=n        ) {return dp[n][i]=(1-p[i])*dpf(n,i-1)+p[i]*(dpf(n-1,i-1));   }
  else                   {return dp[n][i]=0;                                 }
  return 0;
}
int main()
{  ios_base::sync_with_stdio(false); cin.tie(NULL);
   memset(dp,-1,sizeof(dp));
   int n;cin>>n;
   for(int i=0;i<=n;i++)
   {
     for(int j=0;j<=n;j++) { dp[i][j]=2; }
   }
   double su=0;
   for(int i=1;i<=n;i++)           { cin>>p[i];    }
   for(int num=n/2+1;num<=n;num++) { su+=dpf(num,n); }
   cout<<fixed<<setprecision(10)<<dp[n/2+1][n];
   return 0;
}


Measured memory_bytes: 70784
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  int n;
  cin>>n;
  int k;
  cin>>k;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  int dp[k+1];
  for(int i=0;i<=k;i++)
  {
    dp[i]=0;
  }

  for(int i=1;i<=k;i++)
  {
    for(int j=0;j<n;j++)
    {
      if(i-a[j]>=0&&dp[i-a[j]]==0)
      {
        dp[i]=1;
        break;
      }
      else if(i-a[j]<=0)
        dp[i]=0;
    }
  //  cout<<dp[i];
  }
  if(dp[k]==1)
    cout<<"First"<<endl;
  else
    cout<<"Second"<<endl;
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

ull lcm(ull a,ull b){
  return a/gcd(a,b)*b;
}

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

  ull N,M;
  cin>>N>>M;
  vector<ull>a(N);
  for(int i=0;i<N;i++)cin>>a[i];
  for(int i=0;i<N;i++)a[i]/=2;
  ull L=1;
  for(auto it:a)L=lcm(L,it);
  bool ng=false;
  for(auto it:a)if((L/it)%2==0)ng=true;
  if(ng){
    cout<<0<<endl;
    return 0;
  }
  ll Max=*max_element(rng(a));
  ull ans=M/L;
  if(ans%2)ans++;
  ans/=2;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;

const int N = 1e6+7;
int dp[N],n,c,w[N],v[N],ans,s,INF;

int32_t main()
{
	fast;

	cin>>n>>c;
	for(int i=1;i<=n;i++)
		cin>>w[i]>>v[i], s+=v[i], INF+=w[i];
	for(int i=0;i<=s;i++)
		dp[i] = INF;
	dp[0] = 0;
	for(int i=1;i<=n;i++)
		for(int j=s;j>=0;j--)
			if(j>=v[i])
				dp[j] = min(dp[j],dp[j-v[i]]+w[i]);
	for(int i=0;i<=s;i++)
		if(dp[i]<=c)
			ans = i;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 6400
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def dfs(m, N):
    if N == 0:
        yield []
    else:
        for i in range(0, m+2):
            for solution in dfs(max(m, i), N-1):
                yield [i]+solution

def solve():
    '''
    a
    '''
    N = read_int()
    alphabets = 'abcdefghij'
    for solution in dfs(-1, N):
        print(''.join(alphabets[i] for i in solution))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 84200
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define LOCAL 1

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n"
#define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ 
#else
#define dbg(...) 1;
#define dbg1(...) 1;
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
constexpr ll R=2e5+69, INF=2e9+6969;

int qq;

int main()
{
	scanf("%d", &qq);
	puts(qq>=30 ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 3772
import java.util.Scanner;

public class Main {
    static Scanner input = new Scanner(System.in);
    public static void main(String[] args) {
        int[] before = new int[51];
        int[] temp = new int[51];
        while(input.hasNext()) {
            int n = input.nextInt(), r = input.nextInt();
            if(n == 0 && r == 0)
                break;
            for(int i = n, j = 1; i >= 1 && j <= n; i--, j++) {      //Initialize
                before[j] = i;
            }
            for(int i = 1; i <= r; i++) {
                int p = input.nextInt(), c = input.nextInt();
                for(int j = 1; j <= p - 1; j++) {
                    temp[j] = before[j];
                }
                for(int k = p; k <= p + c - 1; k++) {
                    before[k - p + 1] = before[k];
                }
                for(int j = c + 1, k = 1; j <= p + c - 1 && k <= p - 1; j++, k++) {
                    before[j] = temp[k];
                }
            }
            System.out.println(before[1]);
        }
    }
}



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

int main() {
 
    vector<int> a ={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int b;

    cin >> b;

    cout << a[b-1] <<endl;

}


Measured memory_bytes: 256
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]

cnt = 0
flg = False
for i in range(n):
    if d[i][0] == d[i][1]: # ゾロ目だったらカウントを進める
        cnt += 1
    else: # ゾロ目じゃなかったらカウントを0に戻す
        cnt = 0
    if cnt >= 3:
        flg = True
        break

if flg:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9124
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<random>
#include<math.h>
#include<limits.h>
#include<iterator>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define ll long long
#define vl vector<ll> 
#define vvl vector<vector<ll> > 
#define vb vector<bool> 
#define vvb vector<vector<bool> > 
#define INF 1123456789012345
using namespace std;

int main(){
	ll entry = 0;
	ll exit = 0;
	ll root_entry = 0;
	ll mae = 0;
	ll usiro = 0;
	ll n; cin >> n;
	string s; cin >> s;
	rep(i, n){
		if (s[i] == '(') entry++;
		else exit++;
		if (exit > entry){
			mae++;
			entry++;
		}
	}rep(i, mae) cout << '(';
	cout << s;
	if (exit < entry) rep(i, entry-exit) cout << ')';
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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

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

template<class T> inline auto __lcm(T& a, T& b) 
{ return a * b / __gcd(a, b); }

template<typename T> void remove(std::vector<T>& vector, unsigned int index)
{ vector.erase(vector.begin() + index); }


int main() {

  int N;  cin >> N;

  int org = N / 1.08;
  
  if (org * 1.08 == N) print(org);
  else if (int((org + 1) * 1.08) == N) print(org+1);
  else print(":(");
  

  return 0;
}


Measured memory_bytes: 256
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "PP.hpp"
#define deb(x...) cerr << "[" << #x << "] = " << x << "\n";
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

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

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

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

int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if(max({a, b, c, d, e}) - min({a, b, c, d, e}) <= k)puts("Yay!");
	else puts(":(");
	return 0;
}



Measured memory_bytes: 256
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

if __name__ == '__main__':
    i = 0
    N = int(input())
    a = []
    for j in range(N):
        a.append(int(input()))
        if(is_prime(a[j])) == True:
            i += 1
    print(i)

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(10);

}

class union_find {
public:
	union_find(int n)
		: par_(n, -1)
	{}
	void init(int n) {
		par_.assign(n, -1);
	}

	int root(int x) {
		return par_[x] < 0 ? x : par_[x] = root(par_[x]);
	}

	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) {
			return false;
		}
		else {
			if (par_[x] < par_[y]) {
				par_[x] += par_[y];
				par_[y] = x;
			}
			else {
				par_[y] += par_[x];
				par_[x] = y;
			}
			return true;
		}
	}

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

	int size(int x) {
		return -par_[root(x)];
	}

private:
	std::vector<int> par_;
};

signed main() {
	ll n, m, a, b;

	cin >> n >> m;

	vector<pair<ll, ll>> v(m, make_pair(0, 0));
	vector<ll> ans(m, 0);
	union_find uf(n);

	REP(i, m) {
		cin >> a >> b;
		v[i] = make_pair(a - 1, b - 1);
	}

	ans[m - 1] = n * (n - 1) / 2;

	RREP(i, m - 1) {
		if (uf.same(v[i + 1].first, v[i + 1].second)) {
			ans[i] = ans[i + 1];
		}
		else {
			ans[i] = ans[i + 1] - uf.size(v[i + 1].first) * uf.size(v[i + 1].second);
			uf.unite(v[i + 1].first, v[i + 1].second);
		}
	}

	REP(i, m) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int v[n];
  for(int i=0;i<n;i++)
  {
    cin>>v[i];
  }
  if(n==1)
  {
    cout<<v[0];
    return 0;
  }
  sort(v,v+n);
  float avg=0.0;
  avg=(float)(v[0]+v[1])/2;
  for(int i=2;i<n;i++)
  {
    avg=(avg+(float)v[i])/2;
  }
  cout<<avg;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
A2 = list(filter(lambda x: x%2==0, A))
count = 0

for i in range(len(A2)):
    while A2[i]%2 == 0:
        A2[i] /= 2
        count += 1
    

print(count)

Measured memory_bytes: 4524
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < int > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vll vector < ll >
# define pii pair < int , int >
//# pragma GCC target ("sse4")
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n,m,k;
    fi>>n>>m>>k;
    static int f[1 << 20];
    auto pow = [&](auto a,auto b,auto mod)
    {
        int ans = 1;
        while (b)
        {
            if (b&1) ans = (1ll * ans * a) % mod;
            a = (1ll * a * a) % mod;
            b /= 2;
        }
        return ans;
    };
    const int mod = 1e9 + 7;
    static int c[1 << 20];
    const int N = 1e6;
    f[0] = c[0] = 1;
    for (int i = 1;i <= N;++i)
        f[i] = (1ll * f[i-1] * i) % mod;
    c[N] = pow(f[N],mod - 2,mod);
    for (int i = N - 1;i;--i)
        c[i] = (1ll * (i + 1) * c[i + 1]) % mod;
    auto C = [&](auto n,auto k)
    {
        if (!(0 <= k && k <= n)) return 0;
        auto ans = f[n];
        ans = (1ll * ans * c[k]) % mod;
        ans = (1ll * ans * c[n - k]) % mod;
        return ans;
    };
    int cnt = 1;
    int ans = 0;
    for (int i = 0;i <= m + k;++i)
    {
        ans = (ans + (1ll * cnt *  C(i + n - 1,n - 1) % mod) * pow(3,m + k - i,mod)) % mod;
        (cnt <<= 1) %= mod;
        cnt = (1ll * cnt + mod - C(i,m)) % mod;
        cnt = (1ll * cnt + mod - C(i,k)) % mod;
    }
    fo << ans << '\n';
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}

Measured memory_bytes: 8192
#include<stdio.h>
#include<math.h>

static const int N = 10000;
int isprime(int x);

int main(){
  int n, i, count = 0;
  int A[N];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
     scanf("%d", &A[i]);
     if(isprime(A[i]) > 0)
        count++;
  }
  printf("%d\n",count);
  return 0;
}

int isprime(int x){
  int i = 3;
  if(x == 2)
    return 1;
  if(x < 2 || x % 2 == 0)
    return 0;

  while(i <= sqrt(x)){
    if(x % i == 0)
      return 0;
    i += 2;
  }
  return 1;
}



Measured memory_bytes: 2072
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int N = in.nextInt(), M = in.nextInt();
        int[] l = new int[N + 1], r = new int[N + 1];
        for (int i = 1; i < N + 1; i++) {
            l[i] = in.nextInt();// 1 <= l <= r <= M
            r[i] = in.nextInt();
        }

        @SuppressWarnings("unchecked")
        List<Integer>[] nBySpan = new List[M + 1];
        for (int i = 0; i < M + 1; i++) {
            nBySpan[i] = new ArrayList<>();
        }
        for (int n = 1; n < N + 1; n++) {
            int s = r[n] - l[n] + 1;
            nBySpan[s].add(n);
        }

        int accum = 0;
        for (int i = 1; i < M + 1; i++) {
            accum += nBySpan[i].size();
        }

        Fenwick F = new Fenwick(M);
        for (int d = 1; d < M + 1; d++) {

            accum -= nBySpan[d].size();
            int sum = accum;
            for (int i : nBySpan[d]) {
                F.add(l[i], 1);
                F.add(r[i] + 1, -1);
            }
            for (int e = d; e < M + 1; e += d) {
                sum += F.accum(e);
            }
            System.out.println(sum);
        }
    }
}

class Fenwick {
    private final long[] fenwick;

    public Fenwick(int n) {
        fenwick = new long[n + 1];
    }

    public long accum(int i) {
        long sum = 0;
        for (; i >= 0; i = (i & (i + 1)) - 1) {
            sum += fenwick[i];
        }
        return sum;
    }

    public long sum(int begin, int end) {
        return accum(end) - accum(begin - 1);
    }

    public void add(int i, long a) {
        for (; i < fenwick.length; i = i | i + 1) {
            fenwick[i] += a;
        }
    }

    @Override
    public String toString() {
        int N = fenwick.length;
        long[] raw = new long[N];
        long[] acc = new long[N];
        for (int i = 1; i < N; i++) {
            acc[i] = accum(i);
            raw[i] = acc[i] - acc[i - 1];
        }
        StringBuilder s = new StringBuilder();
        s.append("Fenwick [\n");
        s.append(" fenwick=" + Arrays.toString(fenwick) + "\n");
        s.append(" accum  =" + Arrays.toString(acc) + "\n");
        s.append(" raw    =" + Arrays.toString(raw) + "\n]");
        return s.toString();
    }
}

Measured memory_bytes: 143004
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int ans = 0;
            string[] s = Console.ReadLine().Split(' ');

            int A = int.Parse(s[0]);
            int B = int.Parse(s[1]);
            int T = int.Parse(s[2]);

            ans = (T / A) * B;


            Console.WriteLine(ans.ToString());
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<pr> vp;
typedef vector<vp> vpp;
typedef vector<vector<ll> > graph;
#define pb push_back
#define mp make_pair
#define endl '\n'
void set_val(vector<ll>& v, ll val){for(ll i=0;i<v.size();i++) v[i]=val;}

ll mod = pow(10,9) + 7;
ll modulo = 998244353;
double pi = 3.141592653589793238;
ll i_mov[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
ll j_mov[8] = {1, 1, 1, 0, -1, -1, -1, 0};


ll power(ll a, ll n)
{
    if(n==0)
    return 1;
    ll temp = power(a,n/2);
    if(n%2==0)
    return (temp*temp)%mod;
    return (((temp*temp)%mod)*a)%mod;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout<<fixed;
    cout<<setprecision(10);
    ll k, x;
    cin>>k>>x;
    if(500*k >= x)
    cout<<"Yes";
    else
    cout<<"No";
    
    
} 

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
#include<numeric>
#include<stack>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 9e18;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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やllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  int N;
  cin >> N;
  map<string,int> mp;
  for(int i=0; i<N; i++){
    string S;
    cin >> S;
    mp[S]++;
  }
  int ma = 0;
  for(auto m : mp){
    chmax(ma,m.second);
  }
  vector<string> ss;
  for(auto m: mp){
    if(m.second == ma){
      ss.push_back(m.first);
    }
  }
  sort(ss.begin(),ss.end());
  for(auto sss: ss){
    cout << sss << endl;
  }
  return 0;
}


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

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

template <typename T> struct BIT {
  int n;
  vector<T> d;
  BIT(int n = 0) : n(n), d(n + 1) {}

  void add(int i, T x = 1) {
    for (i++; i <= n; i += i & -i) {
      d[i] += x;
    }
  }

  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i & -i) {
      x += d[i];
    }
    return x;
  }

  T sum(int l, int r) { return sum(r - 1) - sum(l - 1); }
};

int main() {
  int n, q;
  cin >> n >> q;
  int a[n];
  rep(i, n) cin >> a[i];
  vector<int> pi(n + 1, -1);
  vector<vector<int>> ps(n);
  rep(i, n) {
    int l = pi[a[i]];
    if (l != -1) ps[l].push_back(i);
    pi[a[i]] = i;
  }

  vector<vector<P>> qs(n);
  rep(qi, q) {
    int l, r;
    cin >> l >> r;
    --l, --r;
    qs[l].push_back({r, qi});
  }

  vector<int> ans(q);
  BIT<int> d(n);
  for (int x = n - 1; x >= 0; --x) {
    for (int y : ps[x]) d.add(y, 1);
    for (auto query : qs[x]) {
      int r = query.first, i = query.second;
      ans[i] = (r - x + 1) - d.sum(r);
    }
  }

  rep(i, q) cout << ans[i] << endl;
  return 0;
}


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

int main() {
    string s;
    cin >> s;
    for (int i=0; i<4; i++)
        printf("%c", s[i]);
    printf(" ");
    for (int i=4; i<12; i++)
        printf("%c", s[i]);
    puts("");
    return 0;
}


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

int main(void) {
    string S;
    int Q;

    cin >> S;
    cin >> Q;

    bool rev = true;
    for (int i=0; i<Q; i++) {
        int T;
        cin >> T;
        if (T == 2) {
            int F;
            string C;
            bool in = true; /* true:前, false:後ろ. */
            cin >> F;
            cin >> C;
            if (F == 1) {
                /* 反転状態なら後ろ挿入. */
                if (rev != true) in = false;
            } else {
                /* 反転状態なら前挿入. */
                if (rev == true) in = false;
            }
            /* 挿入. */
            if (in == true) S.insert(0,C);
            else S.push_back(C[0]);
        } else {
            if (rev == true) rev = false;
            else rev = true;
        }
    }
    if (rev == false) reverse(S.begin(), S.end());

    cout << S << endl;

    return 0;
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9) + 7;
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n){
        t *= i;
        t %= mod;
    }
    return t;
}

ll power(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = power(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = 1;
    for(ll i = 0; i < b; i++) {
        ans *= (a - i);
        ans /= (i + 1);
        ans %= mod;
    }
    return ans;
}

int main(){
    ll n,cnt = 0,m = 0;
    cin >> n;
    vector<ll> a(n),b(n);
    priority_queue<ll> d;
    rep0(i, n)cin >> a[i];
    rep0(i, n)cin >> b[i];
    rep0(i, n){
        if(a[i] < b[i]){
            m += b[i] - a[i];
            ++cnt;
        }else if(a[i] > b[i])d.push(a[i] - b[i]);
    }
    while (!d.empty() && m > 0) {
        m -= d.top();
        d.pop();
        ++cnt;
    }
    pf(m <= 0? cnt:-1);
    return 0;
}


Measured memory_bytes: 2428
# python 3.4.3
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# library
# -------------------------------------------------------------



# -------------------------------------------------------------
# main
# -------------------------------------------------------------
from collections import deque
import heapq

N,K = map(int,input().split())
V = list(map(int,input().split()))

ans = 0

maxPop = min(N,K)
# 左popする回数
for li in range(maxPop+1):
    # 右popする回数
    for ri in range(maxPop+1-li):
        # 初期化
        D = deque(V)
        jew = [] # 手持ちの宝石

        # pushの最大値
        maxPush = K - (ri+li)
        # 左popする
        for i in range(li):
            jew.append(D.popleft())
        # 右popする
        for i in range(ri):
            jew.append(D.pop())
        # 価値順にソート
        jew.sort()
        # push最大値の回数まで、負の価値の宝石をpushする（手持ちの価値を0にする）
        for i in range(min(maxPush, len(jew))):
            if jew[i] < 0:
                jew[i] = 0
        # 合計
        ans = max(ans,sum(jew))

print(ans)

Measured memory_bytes: 3316
def judge(S):
    if S == "SUN":
        print(7)
    if S == "MON":
        print(6)
    if S == "TUE":
        print(5)
    if S == "WED":
        print(4)
    if S == "THU":
        print(3)
    if S == "FRI":
        print(2)
    if S == "SAT":
        print(1)

S = input()
judge(S)


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<string>
using namespace std;
int main()
{
	string str;
	cin >> str;
	if (str[2] == str[3] && str[4] == str[5])cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	// Code for A - One out of Three
	var A, B, C int
	fmt.Scanf("%d %d %d", &A, &B, &C)
	if A == B {
		fmt.Println(C)
	} else if B == C {
		fmt.Println(A)
	} else {
		fmt.Println(B)
	}
}


Measured memory_bytes: 1832
#include <bits/stdc++.h>
using namespace std;
#define x_ real()
#define y_ imag()
#define cross(a, b) (conj(a)*(b)).imag()
#define dot(a, b) (conj(a)*(b)).real()
#define PI acos(-1)
#define F first
#define S second
#define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL)
#define fileIO freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef complex<ld> point;
typedef tuple<int, int, int> line;
typedef vector<point> polygon;
typedef pair<double, double> pd;
//pair<int, int> dirs[] = { {1, 2}, {-1, 2}, {2, 1}, {2, -1}, {-2, 1}, {-2, -1}, {1, -2}, {-1, -2} };
const ll mod = 1e9 + 7;
const ll N = 2e5 + 7;


int main() {
	fastIO;
	ll n;
	cin >> n;
	int b[n-1];
	for (int i = 0; i < n-1; i++)
		cin >> b[i];

	int ans = 0;
	for (int i = 0; i < n-1; i++) {
		if (i) {
			ans += min(b[i-1], b[i]);
		}
		else {
			ans += b[i];
		}
	}
	ans += b[n-2];
	cout << ans;

}



Measured memory_bytes: 256
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

t=get_nsp
N=t.size
N.times do|i|
    if t[i]=="?"
        t[i]="D"
    end
end
puts t.join("")

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

const int mod = 1e9 + 7;

void add_self (int & a, int b) {
	a += b;
	if (a >= mod) a -= mod;
}

int mul (int a, int b) {
	return (int) (((ll) a * b) % mod);
}

int power (int a, int k) {
	int ans = 1;
	while (k >= 1) {
		if (k & 1) ans = mul (ans, a);
		a = mul (a, a);
		k >>= 1;
	}
	return ans;
}

int inverse (int a) {
	return power (a, mod - 2);
}

int main() {
	char c;
	cin >> c;
	cout << (char)(c + 1) << endl;
	return 0;
}



Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

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

    int n, m;
    cin >> n >> m;

    vector<int> a(n);
    rep(i, n) cin >> a[i];

    vector<int> s(m + 2);
    rep(i, n - 1){
        if(a[i] < a[i+1]){
            s[a[i]+1] += 1;
            s[a[i+1]] += -1;
            continue;
        }
        s[0] += 1;
        s[a[i+1]] += -1;
        s[a[i]+1] += 1;
        s[m+1] += -1;
    }
    rep(i, m){
        s[i+1] += s[i];
    }

    vector<vector<int>> x(m+1, vector<int>());
    rep(i, n-1){
        x[a[i+1]].push_back(a[i]);
    }

    int ans = 0;
    rep(i, n-1){
        int tmp1 = (a[i+1] + m - a[i]) % m;
        int tmp2 = 1 + (a[i+1] + m - 1) % m;
        ans += min(tmp1, tmp2);
    }

    int now = ans;
    for(int i = 1; i < m; i++){
        for(int j : x[i]){
            now += (i + m - j) % m - 1;
        }
        now -= s[i];
        ans = min(ans, now);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6528
//Achen
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<cstdio>
#include<queue>
#include<cmath>
#include<set>
#include<map>
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Rep(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long LL; 
typedef double db;
using namespace std;
const int N=1e5+7;
int n,s,x[N];
LL ans,p[N];

template<typename T> void read(T &x) {
    char ch=getchar(); x=0; T f=1;
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') f=-1,ch=getchar();
    for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0'; x*=f;
}

LL solve(int l,int r) {
	LL rs=0; int ls=-1;
	while(l<=r) {
		if(x[l]<=s&&x[r]<=s) return rs+(s-x[l]);
		if(x[l]>=s&&x[r]>=s) return rs+(x[r]-s);
		if(p[l]>=p[r]) {
			if(ls!=1) rs+=x[r]-x[l];
			p[l]+=p[r],r--; ls=1;
		}
		else {
			if(ls!=0) rs+=x[r]-x[l];
			p[r]+=p[l],l++; ls=0;
		}
	}
	return rs;
}

//#define DEBUG
int main() {
#ifdef DEBUG
	freopen("1.in","r",stdin);
	//freopen(".out","w",stdout);
#endif
	read(n); read(s);
	For(i,1,n) {
		read(x[i]); read(p[i]);
	}
	printf("%lld\n",solve(1,n));
    return 0;
}

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

int c[4] = {10, 50, 100, 500};

void solve(int n){
	int a[4] = {};
	for(int i=0; i<4; ++i)
		cin >> a[i];
	int sum = 0;
	for(int i=0; i<4; ++i)
		sum += a[i] * c[i];
	int r[4] = {};
	int tmp = sum - n;
	for(int i=3; i>=0; --i){
		r[i] = tmp / c[i];
		tmp -= c[i] * r[i];
	}
	for(int i=0; i<4; ++i)
		if(a[i] - r[i] > 0)
			cout << c[i] << " " << a[i] - r[i] << "\n";
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	bool f = false;
	while(1){
		int n;
		cin >> n;
		if(n == 0) return 0;
		if(f) cout << "\n";
		f = true;
		solve(n);
	}
}


Measured memory_bytes: 3092
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define ALL(obj) (obj).begin(),(obj).end()

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template<class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl;exit(0);}else return;}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	string s; cin >> s;
	int K; cin >> K;
	set<string> st;
	REP(i,s.size())	REP(j,6)st.insert(s.substr(i, j));
	for (auto u : st) {
		if (K == 0) {
			cout << u << endl;
			break;
		}
		K--;
	}
}



Measured memory_bytes: 1664
#include <iostream>
using namespace std;
int main()
{
	int a;
	double b;
	cin>>a>>b;
	if (a>=13)  cout<<b*1.0<<endl;
	else if (a>=6&&a<=12)  cout<<b/2.0<<endl;
	else cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int N,M;
    int sum=0;

    scanf("%d%d",&N,&M);

    sum=N+M;

    if(sum>=10){

        printf("error\n",N-M);
    }
    else
        printf("%d\n",N+M);

    return 0;

}


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

using LL = long long;

const int N = 81, OFF = 80 * 80 * 2 + 10, S = 2 * OFF + 10;
int wt[N][N];
bool poss[N][N][S];

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

	int h, w; cin >> h >> w;
	for (int d: {1, -1}) {
		for (int i = 1; i <= h; ++i) {
			for (int j = 1; j <= w; ++j) {
				int x; cin >> x;
				wt[i][j] += d * x;
			}
		}
	}

	poss[0][1][OFF] = poss[1][0][OFF] = true;
	for (int i = 1; i <= h; ++i) {
		for (int j = 1; j <= w; ++j) {
			for (int d: {1, -1}) {
				int cur = d * wt[i][j];
				for (int s = -OFF; s <= OFF; ++s) {
					if (s + cur <= OFF && s + cur >= -OFF) {
						if (poss[i - 1][j][s + OFF] || poss[i][j - 1][s + OFF]) {
							poss[i][j][s + cur + OFF] = true;
						}
					}
				}
			}
		}
	}

	for (int s = 0; s <= OFF; ++s) {
		if (poss[h][w][s + OFF] || poss[h][w][-s + OFF]) {
			cout << s << endl;
			return 0;
		}
	}
	assert(false);

	return 0;
}


Measured memory_bytes: 162432
from heapq import heappush,heappop
n,k = map(int,input().split())
kind_value = [[] for _ in range((n+1))]
for i in range(n):
    t,d = map(int,input().split())
    kind_value[t].append(d)
for li in kind_value:
    li.sort()
first_type = [(li[-1],i)for i,li in enumerate(kind_value) if li]
first_type.sort(reverse = True)
kind = 0
value_type1 = 0
second_type = []
second_type_sum = 0
second_type_cnt = 0

answer = 0
for v,i in first_type:
    kind += 1
    if kind > k:
        break
    value_type1 += v
    for d in kind_value[i][:-1]:
        heappush(second_type,d)
        second_type_sum += d
        second_type_cnt += 1
    while second_type_cnt > k-kind:
        d = heappop(second_type)
        second_type_cnt -= 1
        second_type_sum -= d
    value = kind*kind + value_type1 + second_type_sum
    if answer < value:
        answer = value

print(answer)

Measured memory_bytes: 73120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int 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(){
    string s; cin>>s;
    int n=s.size();
    string t;
    int cnt=0;
    rep(i,n){
        if(s.at(i)!='x') t+=s.at(i);
        else cnt++;
    }
    bool possible=true;
    int m=t.size();
    rep(i,m/2){
        if(t.at(i)!=t.at(m-1-i)) possible=false;
    }
    if(possible){
        int left=0,right=n-1;
        int ans=0;
        while(left<right){
            if(s.at(left)==s.at(right)){left++; right--;}
            else if(s.at(left)=='x'){ans++; left++;}
            else{ans++; right--;}
        }
        cout<<ans<<endl;
    }else{
        cout<<-1<<endl;
    }
}

Measured memory_bytes: 640
import heapq

n = int(input())
A = [int(x) for x in input().split()]
A_rev = [-x for x in A[::-1]]

def get_sum_list(A):
  h = []
  result = []
  current_sum = 0
  for i,a in enumerate(A[:2*n]):
    heapq.heappush(h,a)
    current_sum += a
    if i >= n:
      m = heapq.heappop(h)
      current_sum -= m
    if i >= n-1:
      result.append(current_sum)
  return result

from_left = get_sum_list(A)
from_right = get_sum_list(A_rev)

ans = -10**18
for i in range(n+1):
  score = from_left[i] + from_right[n-i]
  if ans < score:
    ans = score
    
print(ans)


Measured memory_bytes: 38776
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <tuple>

#define rep(i,n) for(ll i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

using Graph = vector<vector<ll>>;
//	std::cout<<std::fixed<<std::setprecision(10);

int main() {
	string S;
	cin >> S;
	int ans = 0;
	int tmp = 0;
	rep(i, S.size()) {
		if(S[i]=='A' ||S[i]=='C' ||S[i]=='G' ||S[i]=='T') {
			tmp++;
		} else {
			ans = max(ans, tmp);
			tmp = 0;
		}
	}
	ans = max(ans, tmp);

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

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#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>
#include <fstream>
#include <complex>
#include <math.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> PII;
typedef pair<long, long> PLL;
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(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const LL INF = 1e18;

int g[]={1,2,4,8,16,32,64,128,256,512};

int main(){
	int m;
	sort(g,g+10,greater<int>());
	while(cin>>m){
		vector<int>res;
		REP(i,10){
			if(m>=g[i]){
				m%=g[i];
				res.PB(g[i]);
			}
		}
		SORT(res);
		REP(i,SZ(res)){
			cout<<res[i];
			if(i!=SZ(res)-1)cout<<" ";
		}
		cout<<endl;
	}
	return 0;
}
/*

*/

Measured memory_bytes: 1216
import sys
n=int(input())
s=list(input())
m=10**9+7
if s[0]=='W' or s[2*n-1]=='W':
  print(0)
  sys.exit()
side=[]
l=['L','R']
for i in range(2*n):
  if i==0:
    side.append('L')
  else:
    if s[i-1]==s[i]:
      side.append(l[(l.index(side[i-1])+1)%2])
    else:
      side.append(l[l.index(side[i-1])])
ctL=0;ctR=0;ans=1
for i in range(2*n):
  if side[i]=='L':
    ctL+=1
  else:
    ans=ans*(ctL-ctR)
    ans%=m
    ctR+=1
if ctL!=ctR:
  print(0)
  sys.exit()
for i in range(1,n+1):
  ans*=i
  ans%=m
print(ans)

Measured memory_bytes: 6564
/* template.cpp [[[ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)s)
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)s)
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int INF = 1e9 + 10;
const ll INF_LL = 1e18 + 10;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
/* ]]] */

int n, m;
string s[50];

int main(){
  cin >> n >> m;
  rep(i, n) cin >> s[i];
  int mn = INF;
  rep(i, 1, n) rep(j, i + 1, n){
    int c = 0;
    rep(x, 0, i) rep(y, m) c += s[x][y] != 'W';
    rep(x, i, j) rep(y, m) c += s[x][y] != 'B';
    rep(x, j, n) rep(y, m) c += s[x][y] != 'R';
    chmin(mn, c);
  }
  cout << mn << endl;
}

Measured memory_bytes: 3144
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var panels []int
	var a, b, c int
	_, err := fmt.Scanf("%d %d %d", &a, &b, &c)
	if err != nil {
		fmt.Println(err)
	}

	panels = append(panels, a)
	panels = append(panels, b)
	panels = append(panels, c)

	for i := 0; i < len(panels); i++ {
		max := i
		for j := i + 1; j < len(panels); j++ {
			if panels[max] < panels[j] {
				max = j
			}
		}
		if i != max {
			tmp := panels[max]
			panels[max] = panels[i]
			panels[i] = tmp
		}
	}

	d := strconv.Itoa(panels[0])
	e := strconv.Itoa(panels[1])
	f, _ := strconv.Atoi(d + e)
	sum := f + panels[2]
	fmt.Println(sum)
}


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

int main(){
  int n;
  cin >> n;
  if(n%10 == 3) cout << "bon" << endl;
  else if(n%10 == 0||n%10 == 1||n%10 == 6||n%10 == 8) cout << "pon" << endl;
  else cout << "hon" << endl;
}

Measured memory_bytes: 3624
#include<stdio.h>

int main(void)
{
  int n,i,ans=0;
  scanf("%d",&n);
  for(i=0;;i++)
    {
      if(n >= i * i)
	{
	  ans = i * i;
	}
      else
	{
	  break;
	}
    }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 128
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T1=input()
T2=T1.replace('r', str(P)+' ').replace('s',str(R)+' ').replace('p',str(S)+' ')[:-1]
T2=list(map(int, T2.split()))
for i in range(N):
  if i >=K and T1[i]==T1[i-K] and T2[i-K] != 0:T2[i]=0
print(sum(T2))

Measured memory_bytes: 21240
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
#define MOD 1000000007;

using namespace std;
using namespace __gnu_pbds;
//typedef tree<TYPE, null_type, less<TYPE>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//typedef tree<TYPE, null_type, less_equal<TYPE>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;

int n, u, v, cld[100001], bef[100001], dst[100001];
vector<int> adj[100001];

int prelim(int vtx, int pre, int aok){
	bef[vtx] = pre;
	dst[vtx] = aok++;
	int mx = 0;
	for(auto i : adj[vtx])
		if(i != pre) mx = max(mx, prelim(i, vtx, aok));
	cld[vtx] = mx;
	return mx + 1;
}

int trav(int vtx, int cnt){
	if(dst[bef[vtx]] > cnt + 1) return trav(bef[vtx], cnt + 1);
	else return cld[vtx] + cnt + (cnt + 1 == dst[bef[vtx]]);
}

int main(){
	//IO("input.txt", "output.txt");
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> u >> v;
	for(int i = 0; i < n - 1; i++){
		int a, b;
		cin >> a >> b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	prelim(v, 0, 0);
	cout << trav(u, 0) << "\n";
 	return 0;
}

Measured memory_bytes: 13312
#include <stdio.h>
int main(){
  long int N,fizz,buzz,fizzbuzz,sum;
  scanf("%ld",&N);
  fizz=N/3;
  buzz=N/5;
  fizzbuzz=N/15;
  sum=N*(N+1)/2-fizz*(6+3*(fizz-1))/2-buzz*(10+5*(buzz-1))/2+fizzbuzz*(30+15*(fizzbuzz-1))/2;
  printf("%ld",sum);
  return 0;
}

Measured memory_bytes: 1736