akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */


string solve(){
    ll A,B,C,K; cin >> A >> B >> C >> K;
    
    if(K%2){
        return to_string(B-A);
    }else{
        return to_string(A-B);
    }
    return "Unfair";
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}


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

int main(){
	string s[] = {"Sunny", "Cloudy", "Rainy" ,};
	string sin;
	cin >> sin;
	for(int i = 0; i < 3; i++){
		if(s[i] == sin && i != 2){
			cout << s[i + 1] << endl;
			return 0;
		}else if(i == 2){
			cout << s[0] << endl;
			return 0;
			}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main() {
    int N; cin >> N;
  	ll ans = 0;
	for(int i=1; i<N; i++) ans += i;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
n = int(input())

import sys
import math

_max = int(math.sqrt(n) + 1)

for i in range(_max, 1, -1):
    if n % i == 0:
        a = n // i
        b = i
        print((a-1) + (b-1))
        sys.exit(0)

print(n - 1)


Measured memory_bytes: 40044
N = gets.to_i
p = gets.split.map(&:to_i)
cnt = 0
for i in 1...(N - 1)
  cnt += 1 if (p[i-1] < p[i] && p[i] < p[i+1]) || (p[i-1] > p[i] && p[i] > p[i+1])
end
puts cnt

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

int main()
{
    char s;
    cin >> s;
    if((s=='a')||(s=='e')||(s=='i')||(s=='o')||(s=='u')){
        cout << "vowel" << endl;
    }else {
        cout << "consonant"<< endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
//     int t;
//     cin>>t;
// while(t--){
  string s;
  cin>>s;
  int counta=0;
  int countb=0;
  for(int i=0;i<s.size();i++)
  {
    if(s[i]=='A')
      counta++;
    if(s[i]=='B')
      countb++;
    }
  if(counta==3 or countb==3)
    cout<<"No"<<endl;
  else 
    cout<<"Yes"<<endl;
// }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(x) x.begin(), x.end()
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
T ceil(T a, T b) { return a / b + !!(a % b); }

ll n, m, k;
vector<ll> a, b, s1, s2;
map<ll,ll>mp;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> m >> k;
    a.resize(n);
    b.resize(m);
    s1.resize(n + 1);
    s2.resize(m + 1);
    rep(i, n)
    {
        cin >> a[i];
        s1[i + 1] = s1[i] + a[i];
    }
    rep(i, m)
    {
        cin >> b[i];
        s2[i+1]=s2[i]+b[i];
    }
    ll ans = 0;
    rep(i,n+1)
    {
        ll cur=k-s1[i];
        if(cur>=0){
        ll cur2=upper_bound(all(s2),cur)-s2.begin()-1;
        ans=max(ans,i+cur2);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9532
#include<stdio.h>
#include <string.h>
#include <math.h>


int main() {
	int n;
	int result = 0;

	scanf("%d", &n);

	for (int i = 0; i < n; i++)
	{
		int a;
		scanf("%d", &a);

		if (((i + 1) % 2) != 0 && (a % 2) != 0) {
			result++;
		}
	}

	printf("%d\n", result);

	return 0;
}

Measured memory_bytes: 2104
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<set>
using namespace std;

int k;
string str;
set<string> s;

int main(){
	cin>>str>>k;
	for(int i=0;i<str.length();++i)
		for(int j=1;j<=k&&i+j<=str.length();++j)
			s.insert(string(str,i,j));
	set<string>::iterator p=s.begin();
	while(--k)
		++p;
	cout<<*p<<endl;
	return 0;
}

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

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

using namespace std;
using ll = long long;

int main() {
    int n;
    cin >> n;
    vector<pair<ll, int>> p(n);
    rep(i, n) {
        cin >> p[i].first;
        p[i].second = i;
    }

    sort(p.begin(), p.end());
    reverse(p.begin(), p.end());

    set<ll> bigger;
    bigger.insert(-1);
    bigger.insert(-2);
    bigger.insert(n);
    bigger.insert(n+1);

    ll ans = 0;

    rep(i, n) {
        ll q = p[i].first;
        int idx = p[i].second;

        auto r_idx = *bigger.lower_bound(idx);
        auto r_idx2 = *bigger.upper_bound(r_idx);
        auto l_idx = *(--bigger.lower_bound(idx));
        auto l_idx2 = *(--bigger.lower_bound(l_idx));
        // cout << q << " " << idx << endl;
        // cout << l_idx2 << " " << l_idx << " " << r_idx << " " << r_idx2 << endl;
        // cout << endl;

        if (l_idx != -1) {
            ans += (l_idx-l_idx2)*(r_idx-idx)*q;
        }
        if (r_idx != n ) {
            ans += (idx-l_idx)*(r_idx2-r_idx)*q;
        }
        bigger.insert(idx);
    }

    cout << ans << endl;
}

Measured memory_bytes: 9576
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int[] a = new int[] {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};
        System.out.println(a[k - 1]);
    }

}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define F first
#define S second
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define p_b push_back
#define all(c)              c.begin(), c.end()
using namespace std;
typedef long long ll; //printf("%lld ", ll); to out put long
typedef pair <int , int> pii;
typedef pair <ll , ll> pll;
const double eps = 1e-6;
const int MAXN = 1e6 + 5;
const ll MOD = 1e9 + 7;
bool ODD(ll O) {return (O % 2 != 0);}
ll gcd(ll a, ll b) {return __gcd(a , b);}
ll lcm(ll a, ll b) {return a * b / gcd(a , b);}
int dx[] = {1, 0, -1 ,0 , -1 , 0};
int dy[] = {0, 1, 0, -1 , -1 , 0};
ll power (ll x, ll y) {
    if(y == 0) return 1;
    if(ODD(y)) return x * power(x , y / 2) * power(x , y / 2);
    return power(x , y / 2) * power(x , y / 2);
}
/*------ never give up --------*/

int main () {
    int t = 1;
    //cin >> t;
    while(t--) {
        ll a, b, c ,d;
        cin >> a >> b >> c >> d;
        ll n = b - a + 1ll;
        n -= (b / c) - ((a - 1) / c);
        n -= (b / d) - ((a - 1) / d);
        n += (b / lcm(c , d)) - ((a - 1) / lcm(c , d));
        cout << n;
    }
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#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 showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    ll n;
    cin >> n;

    vector<ll> num;
    ll name = n;

    vector<ll> min26_len;
    min26_len.push_back(1);
    ll min26 = 26;
    ll len = 1;
    while(1){
        name -= min26;
        min26_len.push_back(min26);
        if (name <= 0) break;
        min26 *= 26;
        len++;
    }
    //cout << len << endl;

    min26 = 1;
    name = n;
    for (int i = 0; i < len; i++)
    {
        name -= min26;
        min26 *= 26;
    }
    
    //cout << name << endl;
    for (int i = len; i > 0; i--)
    {
        char tans = name/min26_len[i-1];
        name %= min26_len[i-1];
        char c = tans + 'a';
        cout << c ; 
    }
    cout << endl;


}



Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(void){
    long long int H,W;

    cin >> W >> H;
    if(H <2 || W < 2){
        cout << "1" << endl;
        return 0;
    }
    cout <<  (H*W+1)/2 << endl;
    return 0;
    
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)
YES = "YES"  # type: str
NO = "NO"  # type: str
def solve(A: int, B: int, C: int):
    ret = NO
    if min(A, B, C) == 5 and max(A, B, C) == 7 and sum([A, B, C]) == 17:
        ret = YES
    print(ret)
    return
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)
if __name__ == '__main__':
    main()


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

const int maxn = 100010;
char str[maxn];
int dp[maxn];

int main() {
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int len, qn;
  scanf("%d%d\n", &len, &qn);
  scanf("%s", str);
  for (int i = 0; i < len - 1; ++i)
    if (strncmp(str + i, "AC", 2) == 0) dp[i + 1] = 1;
  for (int i = 1; i < len; ++i) dp[i] = dp[i] + dp[i - 1];
//  for (int i = 0; i < len; ++i) cout << dp[i] << ' ';
//  cout << endl;
  while (qn--) {
    int l, r;
    scanf("%d%d", &l, &r);
    --l; --r;
    cout << dp[r] - dp[l] << endl;
  }
  return 0;
}



Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
  string s;
  cin>>s;
  ll a[20],b,c;
  int n=s.length();
  a[0]=1;
  for(int i=1;i<n;i++){
    a[0]*=10;
  }
  a[1]=a[0]/10;
  for(int i=2;i<n;i++){
    a[i]=a[i-1]/5;
  }
  for(int i=0;i<n;i++){
    b=s[i]-'0';
    for(int j=i;j<n;j++){
      c+=(a[j]*b);
    }
    a[i+1]+=(a[i]/10);
  }
  cout<<c<<endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
list_aaa = [input().split() for i in range(N)]

cnt =0

for i in range(N):
    if list_aaa[i][1] =="JPY":
        cnt += int(list_aaa[i][0])
    elif list_aaa[i][1] =="BTC":
        cnt += float(list_aaa[i][0])*380000.0
print(cnt)

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

using namespace std;

int main() {
    int X;
    long long ans = 0;

    scanf("%d", &X);
    ans += ((long long)X / 500) * 1000;
    X %= 500;
    ans += ((long long)X / 5) * 5;
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
a,b = map(int,input().split())
s = input()
flag = 0
for i in range(a+b+1):
    if i < a or i > a :
        if s[i] == "-": flag = 1
        """if ord(s[i]) < 48 or ord(s[i]) > 57:
            flag = 1"""
    elif s[i] != "-":
        flag = 1
print("Yes" if flag == 0 else "No")

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	long H = sc.nextLong();
    	long W = sc.nextLong();
    	sc.close();
    	if(Math.min(H, W) == 1){
    		System.out.println(1);
    		return;
    	}
    	System.out.println((long)Math.ceil(H * W / 2.0));
    }

}

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

void fnInput(vector<int>& rvnCard)
{
  int nCardSiz;
  cin >> nCardSiz;

  rvnCard.resize(nCardSiz);
  for (int i = 0; i < nCardSiz; i++)
    cin >> rvnCard[i];

  sort(begin(rvnCard), end(rvnCard), greater<int>() );
}

int fnGameExec(const vector<int>& cnrvnCard)
{
  int nAlicePnt = 0, nBobPnt = 0;

  for (int i = 0; i < cnrvnCard.size(); i++)
  {
    if (i % 2 == 0)
      nAlicePnt += cnrvnCard[i];
    else
      nBobPnt  += cnrvnCard[i];
  }

  return (nAlicePnt - nBobPnt);
}

int main()
{
  vector<int> vnCard;
  fnInput(vnCard);
  cout << fnGameExec(vnCard) << endl;

  return 0;
}

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

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back

template<typename A, typename B> inline char SMAX(A &a, const B &b) {return a < b ? a = b , 1 : 0;}
template<typename A, typename B> inline char SMIN(A &a, const B &b) {return b < a ? a = b , 1 : 0;}

typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii;

template<typename I>
inline void read(I &x) {
	int f = 0, c;
	while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
	x = c & 15;
	while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
	f ? x = -x : 0;
}

const int N = 1e5 + 7;

int n, m, w[N], ans;
struct Edge{int x, y, z;} g[N];

int fa[N], num[N];
ll sum[N];
inline int Find(int x) {return fa[x] == x ? x : fa[x] = Find(fa[x]);}
inline void Union(int x, int y) {
	fa[y = Find(y)] = x = Find(x);
	num[x] += num[y], num[y] = 0;
	sum[x] += sum[y], sum[y] = 0;
}

int main() {
	#ifdef hzhkk
	freopen("hkk.in", "r", stdin);
	#endif
	read(n), read(m);
	for (int i = 1; i <= n; ++i) read(w[i]), fa[i] = i, sum[i] = w[i];
	for (int i = 1; i <= m; ++i) read(g[i].x), read(g[i].y), read(g[i].z);
	std::sort(g + 1, g + m +1, [](const Edge &a, const Edge &b){return a.z < b.z;});
	for (int i = 1; i <= m; ++i) {
		int x = Find(g[i].x), y = Find(g[i].y), z = g[i].z;
		if (Find(x) != Find(y)) Union(x, y);
		++num[x];
		if (sum[x] >= z) ans += num[x], num[x] = 0;
	}
	printf("%d\n", m - ans);
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long  a, b, k;
    long long ans;
    cin >> a >> b >> k;
    if(k>a) {
        ans = k-a;
        a = 0;
        if(ans>b) {
            b = 0;
        }else {
            b = b-ans;
        }
    } else {
        a =a-k;
    }
    cout << a << " " << b << endl;
}

Measured memory_bytes: 256
// D - String Equivalence
// DFS version
#include <bits/stdc++.h>
using namespace std;

int N;

void dfs(string pre, char cmax){
	if(pre.size() >= N) cout<< pre <<endl;
	else{
		for(char c='a'; c<cmax; ++c) dfs(pre + c, cmax);
		dfs(pre + cmax, cmax + 1);
	}
}

int main(){
	cin>>N;
	dfs("", 'a');
}

Measured memory_bytes: 1536
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<string>
#include<cstdlib>
#include<list>
using namespace std;

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

int main()
{
	int n,m;
	int i,j,k;
	static int a[1500001];
	while(1){
		cin >> n >> m;
		if(n==0 && m ==0) break;
		
		for(i=0;i<1500001;i++) a[i]=0;
		int h[1501],w[1501];
		h[0]=0;
		for(i=1;i<=n;i++){
			cin >> h[i];
			h[i]+=h[i-1];
		}
		w[0]=0;
		for(i=1;i<=m;i++){
			cin >> w[i];
			w[i]+=w[i-1];
		}
		
		for(i=0;i<=n;i++){
			for(j=0;j<i;j++){
				a[h[i]-h[j]]++;
			}
		}
		
		int c=0;
		for(i=0;i<=m;i++){
			for(j=0;j<i;j++){
				c+= a[w[i]-w[j]];
			}
		}
//		for(i=0;i<50;i++) cout << i << "   " << a[i] << endl;
		cout << c << endl;
		
	}
	return 0;	
}

Measured memory_bytes: 6736
/*================================================================
*   Copyright (C) 2019 Sangfor Ltd. All rights reserved.
*
*   创 建 者： badcw
*   创建日期： 2019/12/29
*
================================================================*/
#include <bits/stdc++.h>

#define ll long long
using namespace std;

const int maxn = 1e5+50;
const int mod = 1e9+7;
ll qp(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

template <class T>
inline bool scan(T& ret) {
    char c;
    int sgn;
    if (c = getchar(), c == EOF) return 0; // EOF
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    sgn = (c == '-') ? -1 : 1;
    ret = (c == '-') ? 0 : (c - '0');
    while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
    ret *= sgn;
    return 1;
}

//template <class T>
//inline void out(T x) {
//    if (x > 9) out(x / 10);
//    putchar(x % 10 + '0');
//}

bool isprime(int x) {
    for (ll i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}

int main(int argc, char* argv[]) {
    int x;
    scanf("%d", &x);
    while (!isprime(x)) x ++;
    printf("%d\n", x);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
  int N; cin >> N;
  ll A[N];
  rep(i,N){int x; cin >> x; A[i]=x-i-1;}
  sort(A,A+N);
  ll a={N%2==0 ? (A[N/2]+A[N/2-1])/2 : A[N/2]};
  ll ans=0;
  rep(i,N){
    ans+=abs(A[i]-a);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<ll> a(n + 1);
	vector<ll> b(n);
	rep(i, n + 1) cin >> a[i];
	rep(i, n) cin >> b[i];
	ll ans = 0;
	rep(i, n) {
		ans += min(b[i], a[i]);
		b[i] = max(0ll, b[i] - a[i]);
		if (b[i] > 0) {
			ans += min(a[i + 1], b[i]);
			a[i + 1] = max(0ll, a[i + 1] - b[i]);
		}
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#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__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll A, B, C, X, Y; cin >> A >> B >> C >> X >> Y;
    ll ans = linf;
    rep(i, max(X, Y)+1) {
        ll x = max(0LL, X - i);
        ll y = max(0LL, Y - i);
        chmin(ans, x * A + y * B + i * 2 * C);
    }
    cout << ans << endl;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define mod 1000000000
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
ll power(ll a,int n){
  if(n==0)
    return 1;
  if((n%2)==0)
    return power(a*a,n/2);
  else
    return a*power(a*a,n/2);    
}

int main(){
FASTIO
ll n,m;
cin>>n>>m;
vector<ll> a(m);
ll s=0;
for(int i=0;i<m;i++){
  cin>>a[i];
  s+=a[i];
}
ll ans=n-s;
if((n-s)<0){
  ans=-1;
}
cout<<ans;
return 0;
}


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

typedef long long ll;

int main() {
  int H,W; cin >> H >> W;
  string s[9],t[9];
  for ( int i = 0; i < H; i++ ) cin >> s[i];
  for ( int i = 0; i < H; i++ ) {
    t[i] = s[i];
  }
  bool f = true;
  int i = 0,j = 0;
  s[i][j] = '.';
  while(1) {
    if (  j-1 >= 0 && s[i][j-1] == '#' ) {
      f = false;
      break;
    } else if ( i-1 >= 0 && s[i-1][j] == '#' ) {
      f = false;
      break;      
    } else if (i+1 < H && s[i+1][j] == '#' ) {
      s[i][j] = '.';      
      i++;
    } else if (j+1 < W && s[i][j+1] == '#' ) {
      s[i][j] = '.';            
      j++;
    } else {
      f = false;
      break;
    }
    
    if ( i == H-1 && j == W-1 ) break;
  }
  i = 0,j = 0;
  t[i][j] = '.';
  while(1) {
    if (  j-1 >= 0 && t[i][j-1] == '#' ) {
      f = false;
      break;
    } else if ( i-1 >= 0 && t[i-1][j] == '#' ) {
      f = false;
      break;      
    } else if ( j+1 < W && t[i][j+1] == '#') {
      t[i][j] = '.';      
      j++;
    } else if ( i+1 < H && t[i+1][j] == '#') {
      t[i][j] = '.';            
      i++;
    } else {
      f = false;
      break;
    }
    
    if ( i == H-1 && j == W-1 ) {
      if ( s[i-1][j] == '#' || s[i][j-1] == '#' ) {
	f = false;
	break;
      } else {
	break;
      }
    }
  }  

  if (f) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
  return 0;
}


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

int main(){
  int X;
  cin >> X;
  if(X >= 2000) {
    cout << 1;
    return 0;
  }

  int c[7] = {0};
  int result = 0;

  while(true){
    c[0] += 1;
    int x = 0;

    for(int i=0; i<6; i++){
      if(c[i] == 20){
        c[i+1] += 1;
        c[i] = 0;
      }
      x += (100+i)*c[i];
    }

    if(c[6] == 1){
      break;
    }

    else if (X == x){
      result = 1;
      break;
    }
  }

  cout << result << endl;
  return 0;
}


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

bool check(vector<int> &A, vector<int> &B) {
    int N = A.size();
    for (int i = 0; i < N; ++i) {
        if (A.at(i) != B.at(i)) {
            return false;
        }
    }
    return true;
}

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

    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        A.at(i) = i + 1;
    }
    vector<int> P(N), Q(N);
    for (auto &x : P) cin >> x;
    for (auto &x : Q) cin >> x;

    int pnt = 0;
    int a = INT_MAX, b = INT_MAX;
    do {
        if (check(A, P)) a = pnt;
        if (check(A, Q)) b = pnt;
        if (a != INT_MAX && b != INT_MAX) {
            cout << abs(a - b) << endl;
            exit(0);
        }
        pnt++;
    } while (next_permutation(A.begin(), A.end()));

    return 0;
}

Measured memory_bytes: 256
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;


int main() {
	int n;
	string s;
	int k;
	cin >> n >> s >> k;
	char s2;
	s2 = s.at(k - 1);
	for (int i = 0; i < n; i++) {
		if (s.at(i) == s2) cout << s2;
		else cout << "*";
	}
	cout << endl;

}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    String T = sc.nextLine();
    int ans = 0;
    for(int i = 0; i < 3; i++){
      if(S.charAt(i) == T.charAt(i)){
        ans++;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23636
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //b
  int n;
  cin >> n;
  vector<long long> l(n);
  for (auto& x : l) cin >> x;
  int ans = 0;
  for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) for (int k = j + 1; k < n; k++) {
    if (l[i] != l[j] && l[j] != l[k] && l[k] != l[i]) {
      vector<long long> a = {l[i], l[j], l[k]};
      sort(a.begin(), a.end());
      if (a[2] < a[0] + a[1]) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3644
/* 実装例　Atcoder Beginers Contest 174-F Range Set query */
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n,q; cin >> n >> q;
    int sq=sqrt(n);
    vector<int> c(n);
    rep(i,n){
        cin >> c[i];
        c[i]--;
    }
    vector<int> l(q),r(q);
    rep(i,q){
        cin >> l[i] >> r[i];
        l[i]--;
    }
    
    vector<int> qu(q);
    rep(i,q) qu[i]=i;
    sort(ALL(qu),[&](int i,int j){if(l[i]/sq!=l[j]/sq) return l[i]<l[j]; else return r[i]<r[j];});

    vector<int> ans(q);
    vector<int> cnt(n,0);
    int nl=0,nr=0;
    int res=0;
    auto add=[&](int i){if(cnt[c[i]]++==0) res++;};
    auto del=[&](int i){if(--cnt[c[i]]==0) res--;};
    for(int i:qu){
        while(nl> l[i]) add(--nl);
        while(nl< l[i]) del(nl++);
        while(nr< r[i]) add(nr++);
        while(nr> r[i]) del(--nr);
        /* ここから結果 */
        ans[i]=res;
    }
    rep(i,q) cout << ans[i] << "\n";
}


Measured memory_bytes: 15484
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<memory>
#include<cmath>
#include<stack>

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back
#define DEBUG false

using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll LINF=1LL<<60,lmod=1e9+7;
const int MAX_N=100005;
vector<ll> fact;

void init(ll N){
  fact.resize(N+1);
  fact[0]=1;
  rep(i,N)  fact[i+1]=((i+1)*fact[i])%mod;
}

ll pow(ll a,ll b){
  // aのb乗を求める
  ll res = 1;
  while(b){
    if(b%2) res=(res*a)%mod;
    a=(a*a)%mod;
    b>>=1;
  }
  return res;
}

ll imod(ll n){
  // nのmodの逆元を求める
  ll P=mod;
  return pow(n,P-2);
}

ll comb_mod(ll n,ll k){
  if(n<k) return 0;
  //nまで埋めた階乗テーブルを渡す
  return (fact[n] * imod(fact[k]) % mod) * imod(fact[n-k]) % mod ;
  //nCk % mod を返す
}

int main(){
  int N;
  cin >> N ;
  int a[N+2];
  fill(a,a+N+2,-1);
  int right,left;
  rep(i,N+1){
    int b;
    scanf("%d",&b);
    if(a[b]==-1) a[b]=i+1;
    else{
      left = a[b]-1;
      right = N-i;
    }
  }
  init(N+3);
  REP(i,1,N+2){
    ll ans = comb_mod(N+1,i) - comb_mod(left+right,i-1);
    while(ans<0) ans += lmod;
    ans %= lmod;
    printf("%lld\n",ans);
  }
  return 0;
}


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

int main() {
	int a, b;
	cin >> a >> b;
	if((a <= 9 && a >= 1) && (b <= 9 && b >= 1)) {
		cout << a * b << endl;
	} else {
		cout << "-1\n";
	}
	return 0;
}

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

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

int main(){
  int N,M;
  cin>>N>>M;
  vector<pair<long,long>> vec(N);
  rep(i,N) cin>>vec.at(i).first>>vec.at(i).second;
  sort(vec.begin(),vec.end());
  long ans=0;
  rep(i,N){
    if(vec.at(i).second<=M){
      M-=vec.at(i).second;
      ans+=vec.at(i).first*vec.at(i).second;
    }
    else{
      ans+=(long)M*vec.at(i).first;
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>

void call(int n){
	int i = 1;
	while (1){
		int x = i;
		if (x % 3 == 0){
			printf(" %d", i);
			if (++i > n) break;
			continue;
		}
		while (1){
			if (x % 10 == 3){
				printf(" %d", i);
				break;
			}
			x /= 10;
			if (x == 0) break;
		}
		if (++i > n) break;
	}
	printf("\n");
}
int main(void) {
	int n;
	scanf("%d",&n);
	call(n);
	return 0;
}

Measured memory_bytes: 600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC125 {
	class ABC125_C {
		static void Main(string[] args) {
			var N = int.Parse(Console.ReadLine());
			var A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			var L = new int[N + 1];
			var R = new int[N + 1];
			var M = new int[N];

			L[0] = 0;
			R[N] = 0;
			for (int i = 0; i < N; i++) {
				L[i + 1] = GCD(L[i], A[i]);
			}
			for (int i = N; i > 0; i--) {
				R[i - 1] = GCD(R[i], A[i - 1]);
			}
			for (int i = 0; i < N; i++) {
				M[i] = GCD(L[i], R[i + 1]);
			}
			Console.WriteLine(M.Max());
		}

		private static int GCD(int a, int b) {
			if (a == 0) { return b; }
			if (b == 0) { return a; }
			var large = a > b ? a : b;
			var small = a > b ? b : a;
			var remain = large % small;

			if(remain == 0) {
				return small;
			}
			return GCD(remain, small);
		}
	}
}


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

int main() {
    double r;
    cin >> r;
    double pi = 3.14159265;

    double ans = 2.0 * pi * r;

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


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

int max(int a,int b){
	if(b>a)return b;
	return a;
}

int p[10][10];
int cp[10][10];
int flag[10][10];
int h,w,c;

struct data{
	int x,y;
};

struct data que[5000000];
int f,t;
void push(int xx,int yy){
	que[t].x=xx;
	que[t].y=yy;
	t++;
}

struct data pop(){
	return que[f++];
}

int sx[4]={0,1,0,-1};
int sy[4]={1,0,-1,0};
int col[7],res;

int bfs(int cc){
	memset(flag,0,sizeof(flag));
	f=0,t=0;
	push(1,1);
	flag[1][1]=1;
	while(f!=t){
		struct data q=pop();
		int i;
		for(i=0;i<4;i++){
			int nx=sx[i]+q.x,ny=sy[i]+q.y;
			if(flag[nx][ny]==0){
				if(cp[q.x][q.y]==cp[nx][ny]){
					flag[nx][ny]=1;
					push(nx,ny);
				}
			}
		}
	}
	int cnt=0;
	int i,j;
	for(i=1;i<=h;i++){
		for(j=1;j<=w;j++){
			if(flag[j][i]==1)cp[j][i]=cc;
			cnt+=flag[j][i];
		}
	}
	return cnt;
}
int d[6];
void dfs(int x){
	if(x<4){
		for(d[x]=1;d[x]<=6;d[x]++){
			col[x]=d[x];
			dfs(x+1);
		}
	}else{
		col[4]=c;
		int i,j;
		for(i=1;i<=h;i++){
			for(j=1;j<=w;j++){
				cp[j][i]=p[j][i];
			}
		}
		for(i=0;i<5;i++){
			bfs(col[i]);
		}
		res=max(res,bfs(7));
	}
}

int main(void){
	while(1){
		scanf("%d %d %d",&h,&w,&c);
		if(h+w+c==0)break;
		res=0;
		memset(p,0,sizeof(p));
		int a,b;
		for(a=1;a<=h;a++){
			for(b=1;b<=w;b++){
				scanf("%d",&p[b][a]);
			}
		}
		dfs(0);
		printf("%d\n",res);
	}
	return 0;
}

Measured memory_bytes: 1036
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int days = 0;
        
        for(int i=0; i<m; i++){
        	days += scan.nextInt();
        } 
           
        if (n>=days) {
			System.out.println(n-days);
		} else {
			System.out.println(-1);
		}
	    scan.close();	
    }
}

Measured memory_bytes: 46240
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long int n,m;
    cin >> n >> m;
    if(n > m/2){
        cout << m/2;
    }else{
        cout << n + (m-2*n)/4;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
using namespace std;
int main()
{
    long long n, a, a_min = LLONG_MAX;
    cin >> n;
    for(int i = 0; i < 5; i++){
        cin >> a;
        a_min = (a_min > a ? a : a_min);
    }
    cout << n / a_min + (n % a_min != 0) + 4 << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
ll const INF = 1LL << 60;

int main() {
    char C;
    cin >> C;

    char ans = C + 1;
    cout << ans << endl;
    return 0;
}

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

int main(){
   ll n, k;
   cin >> n >> k;
   n = n%k;
   if(n > k/2){
      n = k - n;
   }
   cout << n;
   return 0;  
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>
#include <cmath>

int main(void){
    int s;
    std::cin >> s;
    int counter = 0;
    int sum;
    while(s > 0){
        sum = s%10;
        if(sum == 1){
            counter++;
        }
        s = s/10;
    }

    std::cout << counter;
    return 0;
    

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
using namespace std;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define mod 1000000007
#define PI 3.1415926535897932384626433
#define se second
#define fi first
#define pb push_back
#define T true
#define F false
#define endl "\n"
typedef char ch;
typedef bool boll;
typedef string st;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef set < string > sst;
typedef set < long long > sl;
typedef queue < long long > que;
typedef vector < long long > vec;
typedef map < long long, long long > mll;
typedef pair < long long, long long > pll;
typedef vector < pair < long long, long long > > vpl;
typedef pair < long long, unsigned long long > pul;

int main()
{
    long long x,y=100;
    cin >> x;
    /*float yrs = (log(x)-log(100))/log(1.01);
    int n = (yrs==(int)yrs)?yrs:yrs+1;
    cout << n;*/
    int yrs=0;
    while(y<x){
        yrs++;
        y=1.01*y;
    }
    cout << yrs;
}



Measured memory_bytes: 3640
#include <stdio.h>

int main()
{
  char s[27];
  scanf("%s",&s);
  int i;
  i = 0;
  int j;
  while (s[i])
  {
    j = i + 1;
    while (s[j])
    {
      if (s[i] == s[j])
      {
        printf("no");
        return (0);
      }
      j++;
    }
    i++;
  }
  printf("yes");
}

Measured memory_bytes: 128
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let a: Vec<i64> = (0..n).map(|_| read()).collect();

    let sum = a.iter().sum::<i64>();
    let mut araiguma = sum - a[0];
    let mut sunuke = a[0];
    let mut min = (araiguma - sunuke).abs();

    for i in 1..n - 1 {
        sunuke += a[i];
        araiguma -= a[i];
        min = std::cmp::min(min, (araiguma - sunuke).abs());
    }

    println!("{}", min);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 6396
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    int count,count2;
    int win=0;
    int n;
    int r=0,b=0,w;
    int maxval=99999,maxnum=0,sum=0;
    int l[105];
    char s[1050];
    
    scanf("%s",s);
    scanf("%d",&w);

    for(count=0;s[count]!='\0';count++){
        if(count==0||count%w==0){printf("%c",s[count]);}
    }
    return 0;
}
 
int min(int a,int b){
    int ans;
    if(a>b){return b;}
    else {return a;}
}
 
int max(int a,int b){
    int ans;
    if(a>b){return a;}
    else {return b;}
}


Measured memory_bytes: 128
n = int(input())

def aho(i):
    ans = ""
    if i % 3 == 0:
        ans += (" " + str(i))
    elif "3" in str(i):
        ans += (" " + str(i))
    return ans

for i in range(1, n+1):
    print(aho(i), end="")
print()


Measured memory_bytes: 6144
n, k = map(int, input().split())
x = [int(i) for i in input().split()]

x.append(0)
x = sorted(x)
check = []
for i in range(n-k+1):
    a = abs(x[i])
    b = abs(x[i+k])
    check.append(max(a,b) + min(a,b) * 2)
print(min(check))

Measured memory_bytes: 14252
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>

using namespace std;

int main() {
    string s;

    cin >> s;
    int first = s.find_first_of('A');
    int last  = s.find_last_of('Z');

    int num = last - first + 1;

    cout << num << endl;

    return 0;
}

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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            string[] input = Console.ReadLine().Split(" ");
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            int hour = int.Parse(input[2]);
            int minute = int.Parse(input[3]);

            double theta_A = ((2 * Math.PI / 12) * hour) + ((Math.PI / 360) * minute);
            double theta_B = ((2 * Math.PI / 60) * minute);
            double theta = Math.Abs(theta_A - theta_B);
            if (theta > Math.PI) theta = 2 * Math.PI - theta;

            double distance = Math.Sqrt(a * a + b * b - 2 * a * b * Math.Cos(theta));
            Console.WriteLine(distance);
        }
    }
}

Measured memory_bytes: 27856
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long  ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define rep0(i,n) for(int i=0;i<n;i++)
#define per0(i,n) for(int i=n;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
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; }
 

void solve() {
    string S; cin >> S;
    int temp = 0;
    int ans = 0;
    int acgt[4] = {'A', 'C', 'G', 'T'};
    int* l_acgt;

    rep(i,0,S.size()){
        l_acgt = find(begin(acgt), end(acgt), S[i]);
        if(l_acgt != end(acgt)){
            temp += 1;
            chmax(ans, temp);
        }
        else{
            chmax(ans, temp);
            temp = 0;
        }
    }
    cout << ans;
}

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

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
long long n,m,k,ans=0,a,b,c,d;
string s,t;
int main(){
  cin >> a >> b >> c >> d;
  if(abs(a-c)<=d){
    cout << "Yes" << endl;
  }else if(abs(a-b)<=d and abs(b-c)<=d){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
    while b: a, b = b, a % b
    return a
def isPrimeMR(n):
    d = n - 1
    d = d // (d & -d)
    L = [2]
    for a in L:
        t = d
        y = pow(a, t, n)
        if y == 1: continue
        while y != n - 1:
            y = (y * y) % n
            if y == 1 or t == n - 1: return 0
            t <<= 1
    return 1
def findFactorRho(n):
    m = 1 << n.bit_length() // 8
    for c in range(1, 99):
        f = lambda x: (x * x + c) % n
        y, r, q, g = 2, 1, 1, 1
        while g == 1:
            x = y
            for i in range(r):
                y = f(y)
            k = 0
            while k < r and g == 1:
                ys = y
                for i in range(min(m, r - k)):
                    y = f(y)
                    q = q * abs(x - y) % n
                g = gcd(q, n)
                k += m
            r <<= 1
        if g == n:
            g = 1
            while g == 1:
                ys = f(ys)
                g = gcd(abs(x - ys), n)
        if g < n:
            if isPrimeMR(g): return g
            elif isPrimeMR(n // g): return n // g
            return findFactorRho(g)
def primeFactor(n):
    i = 2
    ret = {}
    rhoFlg = 0
    while i*i <= n:
        k = 0
        while n % i == 0:
            n //= i
            k += 1
        if k: ret[i] = k
        i += 1 + i % 2
        if i == 101 and n >= 2 ** 20:
            while n > 1:
                if isPrimeMR(n):
                    ret[n], n = 1, 1
                else:
                    rhoFlg = 1
                    j = findFactorRho(n)
                    k = 0
                    while n % j == 0:
                        n //= j
                        k += 1
                    ret[j] = k

    if n > 1: ret[n] = 1
    if rhoFlg: ret = {x: ret[x] for x in sorted(ret)}
    return ret
memo=set()
n=input()
g=0
l=list(map(int,input().split()))
for i in l:
    g=gcd(i,g)
if g!=1:print('not coprime');exit()

for i in l:
    for p in primeFactor(i):
        if p in memo:print("setwise coprime");exit()
        memo.add(p)
print("pairwise coprime")

Measured memory_bytes: 197392
#include <iostream>
#include <string>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	int n, ans = 0;
	cin >> n;
	int s[n];
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		ans += s[i];
	}
	sort(s, s + n);
	if (ans % 10 == 0){
        for (int i = 0; i < n; i++){
            if (s[i] % 10 != 0){
                ans -= s[i];
                cout << ans << endl;
                return 0;
            }
        }
    }else{
        cout << ans << endl;
        return 0;
    }
	cout << 0 << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <utility>
#include <queue>
#include <bitset>
#include <math.h>
#include <numeric>
#include <stack>

using namespace std;
 
#define rep(i,m,n) for(int i=m;i<(int)(n);i++)
#define endl '\n'
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  int res=0;
  vector<int> l(n);
  rep(i,0,n)cin>>l[i];
  sort(l.begin(),l.end());
  rep(i,0,n){
    int k=i;
    rep(j,i+1,n){
      while(k<n&&l[k]<l[i]+l[j])k++;
      res+=k-(j+1);
    }
  }
  cout<<res<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#include<tuple>
#include<stack>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tpl;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 100005

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

bool used[30];

int main() {

	int N, M, C;
	cin >> N >> M >> C;

	vector<int> num(ARRAY_MAX);
	vector<int> cnt(ARRAY_MAX, 0);

	for (int i = 1; i <= C; i++)
	{
		cin >> num[i];
	}

	priority_queue<pii> que;

	for (int i = 0; i < N; i++)
	{
		int color, value;
		cin >> color >> value;
		que.push(pii(value, color));
	}

	int sum = 0;
	int ans = 0;

	while (sum < M && que.size())
	{
		int color = que.top().second;//色
		int value = que.top().first;//価値
		que.pop();
		if (cnt[color] < num[color])
		{
			cnt[color]++;
			sum++;
			ans += value;
		}
		
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4656
#include <iostream>
#define int long long
using namespace std;

int32_t main() {
	long long n, p, ans = 1;
	cin >> n >> p;
	for (int i = 2; i * i <= p; i++) {
		int x = 0;
		while (p % i == 0) {
			p /= i;
			x++;
		}
		for (int j = 0; j < x / n; j++) {
			ans *= i;
		}
	}
	if (n == 1) {
		ans *= p;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

a,b,c=map(int,input().split())
k=int(input())

for i in range(k):
    if a<b:
        c*=2
    else:
        b*=2
# print(a,b,c)
if a<b and b<c:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 68284
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace program
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int l = int.Parse(input[1]);
            string[] letter = new string[n];

            for(int i = 0;i < n;i++)
            {
                letter[i] = Console.ReadLine();
            }

            var query = letter
                .OrderBy(x => x)
                .ToList();

            string result = "";
            for(int j = 0;j < n; j++)
            {
                result += query[j];
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 14048
n = int(input())
a = [0] + [int(input()) for _ in range(n)]

visited = [0]*(n+1)
visited[1] = 1
cur = 1
ans = 0
while True:
    cur = a[cur]
    ans += 1
    visited[cur] += 1
    if visited[cur] > 1:
        print(-1)
        break
    elif cur == 2:
        print(ans)
        break

Measured memory_bytes: 7852
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
void hex(LL n){
  if(n/16) hex(n/16);
  LL las=n%16;
  if(las<10) cout << char(las+'0');
  else cout << char(las-10+'a');
}
LL solve(void){
  vector<string> ins(9);
  REP(i,9) cin >> ins[i];
  vector<int> cs(9,0);
  REP(i,9){
    REP(k,ins[i].size()){
      int j=ins[i].size()-1-k;
      if('0'<=ins[i][j] && ins[i][j]<='9') ins[i][j]-='0';
      else {
	ins[i][j]=ins[i][j]-'a'+10;
      }
      REP(l,4) if(ins[i][j]&(1<<l)) cs[i]=(cs[i]|(1<<(l+k*4)));
      
    }
  }
  LL answer=0;
  int carry=0;
  REP(i,32){
    int pari=0;
    REP(j,8) if(cs[j]&(1<<i)) ++pari;
    if(carry&(1<<i)) ++pari;
    if(((cs[8]>>i)&1)!=(pari&1)){
      if(carry&(1<<i)) pari-=2;
      pari=8-pari;
      answer+=(1ll<<i);
    }
    carry+=((pari/2)<<(i+1));
  }
  return answer;
};

int main(void)
{
  int n;
  cin >> n;
  REP(i,n){
    hex(solve());
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3020