akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main() {
	int N;
	string S;
	cin >> N >> S;
	map<char, int> L;
	map<char, int> R;
	for (int i = 0; i < N; i++) L[S[i]]++;
	int now = 0, MAX = 0;
	for (int i = N - 1; i >= 0; i--) {
		L[S[i]]--;
		R[S[i]]++;
		if (L[S[i]] > 0 && R[S[i]] == 1) now++;
		if (L[S[i]] == 0 && R[S[i]] > 1) now--;
		MAX = max(MAX, now);
	}
	cout << MAX << endl;
}

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

int main(){
    string a, b;
    cin >> a >> b;
    if(a.size() > b.size()){
        b = string(a.size() - b.size(), '0') + b;
    }
    else{
        a = string(b.size() - a.size(), '0') + a;
    }

    if(a > b) puts("GREATER");
    else if(a < b) puts("LESS");
    else puts("EQUAL");
}

Measured memory_bytes: 3600
#include <algorithm>
#include <utility>
#include <iostream>
using namespace std;
int N, M;
pair<int,int> PD[10010];
int main() {
 while (cin >> N >> M && N) {
  int d, p;
  for (int i=0; i<N; ++i) {
   cin >> d >> p;
   PD[i] = make_pair(p, d);
  }
  sort(PD, PD+N);
  reverse(PD, PD+N);
  int ans = 0;
  for (int i=0; i<N; ++i) {
   if (M >= PD[i].second) { M-= PD[i].second; }
   else { ans += PD[i].first * (PD[i].second - M); M=0; }
  }
  cout << ans << endl;
 }
}


Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int ans[n+10]={};
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      for(int k=1;k<=n;k++){
	int num=(i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(k*i);
	if(num>n) break;
	else{
	  ans[num]++;
	}
      }
    }
  }
  rep(i,n){
    cout<<ans[i+1]<<endl;
  }
  

  return 0;
}


Measured memory_bytes: 3608
# solution

data=int(input())
array=[''.join(sorted(input())) for i in range(data)]
sets={}
count=0
for i in range(data):
    if array[i] not in sets:
        sets[array[i]]=1
    else:
        sets[array[i]]+=1
        count+=sets[array[i]]-1
print(count)

Measured memory_bytes: 19504
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
    int N;cin>>N;
    string S=to_string(N);
    int a=0;
    REP(i,S.size()){
        a+=S[i]-'0';
    }
    if(N%a==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
int main(){
  ll n,ans;
  cin>>n;
  ans = -n;
  vll a(n);
  for (ll i=0;i<n;i++) {
    cin>>a[i];
    ans += a[i];
  }
  cout << ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<array>

int main(){
  	std::string s,t;
  	std::array<int, 26> sm, tm;
  	int sc=0, tc=0;
  	sm.fill(-1);
  	tm.fill(-1);
  	std::cin >> s >> t;
  	bool ans=true;
  	for(int i=0;i<s.size();i++){
      	int se,te;
      	if(sm.at(s.at(i)-'a')==-1){
          	se = sc;
          	sm.at(s.at(i)-'a') = sc;
          	sc++;
        }else{
          	se = sm.at(s.at(i)-'a');
        }
      	if(tm.at(t.at(i)-'a')==-1){
          	te = tc;
          	tm.at(t.at(i)-'a') = tc;
          	tc++;
        }else{
          	te = tm.at(t.at(i)-'a');
        }
      	if(se!=te){
          	ans=false;
          	break;
        }
    }
  	if(ans){
      	std::cout << "Yes\n";
    }else{
      	std::cout << "No\n";
    }
  	return 0;
}

Measured memory_bytes: 3464
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Atcoder
{
    class aaaa
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int A = int.Parse(Console.ReadLine());

            int amari = N % 500;
            
            if ( amari <= A ){
                Console.WriteLine("Yes");
            }else{
                Console.WriteLine("No");
            }

        }
    }
}

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

int main() {
  int n,sum=0;
  cin >> n;
  vector<int> v(n);
  for(int i=0; i<n; i++) {
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  for(int i=n-2; i>=0; i--) {
    sum+=v[i+1]-v[i];
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_set>
# include <unordered_map>
using namespace std;

long long n;
long long ans;

void check(long long x) {
    long long y = n / x;
    --x;
    if (x > y) ans += x;
    return;
}

int main(int argc, const char * argv[]) {
#ifdef __APPLE__
    freopen("/Users/danya.smelskiy/Documents/Danya/Resources/input.txt","r",stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    for (long long i = 1; i * i <= n; ++i) if (n % i == 0) {
        check(i);
        if (n / i != i) check(n / i);
    }
    cout << ans << '\n';
}



Measured memory_bytes: 256
n = gets.to_i
rates = Hash.new(0)
arr = gets.split.map(&:to_i)
arr.each do |ar|
  if ar < 400
    rates[:gray] += 1
  elsif ar < 800
    rates[:brown] += 1
  elsif ar < 1200
    rates[:green] += 1
  elsif ar < 1600
    rates[:skyblue] += 1
  elsif ar < 2000
    rates[:blue] += 1
  elsif ar < 2400
    rates[:yellow] += 1
  elsif ar < 2800
    rates[:orange] += 1
  elsif ar < 3200
    rates[:red] += 1
  else
    rates[:other] += 1
  end
end
if rates[:other] > 0
  max =  (rates.size - 1) + rates[:other]
  # レート３２００以上者のみの場合は最低１色
  min = rates.size > 1 ? rates.size - 1 : 1
else
  max = min = rates.size
end

puts "#{min} #{max}"


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define int long long 
using namespace std;
signed main(){
  int a,b,cun=0;
  cin>>a>>b;
  if(a<0 && b>=0){
	cout<<"Zero\n";
  }else if(a>0 && b>0){
    cout<<"Positive\n";
  }else if(a>=0 && b>0){
    cout<<"Zero\n";
  }else{
    for(int i=a;i<=b;i++){
      cun++;
    }
    if(cun%2==0){
      cout<<"Positive\n";
    }else{
      cout<<"Negative\n";
    }
  }
  return(0);
}

Measured memory_bytes: 256
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())

ans = 0
for i in range(1,N+1):
    if len(str(i)) % 2 == 1:
        ans += 1

print(ans)


Measured memory_bytes: 2940
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
void solve(){
	ll k ;
	cin>> k ;
	string s;
	cin>> s ;
	ll n = s.length();
	if(n<=k)cout<<s<<endl;
	else{
		for(ll i=0;i<k ;i++)cout<<s[i];
		cout<<"..."<<endl;
	}


}
int main(){
	//mahakal(),fast;
	ll t=1,tc=1 ;
	// cin>> t;
	while(t--)solve();

	return 0;
}

Measured memory_bytes: 3612
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      int[] a = new int[3];

      for (int i=0;i<3;i++ ) {
        a[i]=sc.nextInt();
      }

      Arrays.sort(a);

      System.out.println(a[0]+a[1]);

  }
}


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

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define pf push_front
#define pb push_back
#define FST first
#define SEC second
#define sz(obj) ((int)(obj).size())

const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

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

  long long int n, x;
  
  cin >> n >> x;
  cout << 3 * (n - __gcd(n, x)) << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <vector>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <fstream>
#include <math.h>

using namespace std;

int main(void)
{
	int n;
	uint64_t k;
	cin >> n >> k;
	map<int, uint64_t>d;
	for (int i = 0; i < n; i++) {
		int a;
		uint64_t b;
		cin >> a >> b;
		d[a] += b;
	}
	uint64_t i = 0;
	for (const auto& v : d) {
		i += (uint64_t)v.second;
		if (i >= k) {
			cout << v.first << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 4224
using System;
using System.Linq;
using System.Collections.Generic;


namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            int n = sc.intarr[0];
            int[] a = sc.intarr;
            int[] b = sc.intarr;

            long monster_all_count = 0;

            for (int i = 0; i <= n; i++)
            {
                monster_all_count += a[i];
            }


            //int remain_brave = 0;
            //int remain_monster = 0;

            for(int i=0; i<n; i++)
            {
                int brave = b[i];

                if(brave > a[i])
                {
                    a[i + 1] -= (brave - a[i]);
                    if(a[i + 1] < 0)
                    {
                        a[i + 1] = 0;
                    }
                    a[i] = 0;
                }
                else
                {
                    a[i] -= brave;
                }
            }

            long after_monster = 0;
            for(int i = 0; i <= n; i++)
            {
                after_monster += a[i];
            }

            wr.wri(monster_all_count - after_monster);
        }


    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


Measured memory_bytes: 36188
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0; return gcd(a, b, x, y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 700;

int n, m, y[N], c[2];
bool e[N][N];
bitset<N+1> b;
void dfs(int a, int z){
  y[a] = z;
  c[z-1]++;
  FOR(i, 0, n){
    if(a == i || e[a][i]) continue;
    if(y[i] == z){
      cout << -1 << endl;
      exit(0);
    }
    if(!y[i]) dfs(i, 3-z);
  }
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  FOR(i, 0, m){
    int s, t;
    cin >> s >> t;
    s--; t--;
    e[s][t] = true;
    e[t][s] = true;
  }
  b[0] = 1;
  FOR(i, 0, n){
    if(y[i]) continue;
    c[0] = 0;
    c[1] = 0;
    dfs(i, 1);
    b = (b<<c[0])|(b<<c[1]);
  }
  int ans = iinf;
  FOR(i, 0, n+1)if(b[i]) mins(ans, i*(i-1)/2 + (n-i)*(n-i-1)/2);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 768
import java.util.*;

public class Main {
	public static void main(String[] args) {
		int N = 3;
		Scanner sc = new Scanner(System.in);
		int[] As = new int[N];
		As[0] = sc.nextInt();
		As[1] = sc.nextInt();
		As[2] = sc.nextInt();

		int minCost = Integer.MAX_VALUE;

		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				for (int k = 0; k < N; k++) {
					if ( i != j && j != k && k != i ) {
						int cost = 0;
						cost += 0;
						cost += Math.abs(As[i] - As[j]);
						cost += Math.abs(As[j] - As[k]);

//					System.out.println(i +","+ j + "," + k + "," + cost);
//
						if (cost < minCost) {
							minCost = cost;
						}
//
					}
				}
			}
		}

		System.out.println(minCost);
	}
}

Measured memory_bytes: 22740
//ABC 158 C
#include <bits/stdc++.h>
using namespace std;

int main(){
	int x, a, b;
	cin >> a >> b;
	
	for (x=1; x<=10000/8; x++){
		if ( floor(x*0.08)==a && floor(x*0.1)==b){
			cout << x;
			return 0;
		}
	}
	
	cout << -1;
	return 0;
}

Measured memory_bytes: 256
// BROWNIE TK

#include <bits/stdc++.h>

typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#define pb push_back
#define popb pop_back
#define pf push_front
#define popf pop_front
#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en
#define le length()
#define mp make_pair
#define mt make_tuple
#define F first
#define S second

#define forz(i, n) for (int i = 0; i < n; i++)
#define bui(i, m, n) for (int i = m; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)
#define mui(i, m, n) for (int i = n - 1; i >= m; i--)
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

using namespace std;

/*STD fucntions*/
lli power(lli x,lli y,lli p)
{
	lli res=1;
	x=x%p;
	while(y>0)
	{
		if(y&1)
			res=(res*x)%p;
		//y must be even now
		y=y>>1; //y=y/2
		x=(x*x)%p;
	}
	return res;
}
lli gcd(lli a, lli b)
{
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
lli lcm(lli a, lli b)
{ return a * b / gcd(a, b); }
lli modi(lli a,lli m)
{
// fermat little thm where m is prime
return power(a,m-2,m);
}
/*CODE BEGINS*/
int main()
{
 kira;
 lli n,w;
 cin>>n>>w;
 lli dp[n+1][w+1];
 lli wt[n],val[n];
 forz(i,n)
 {
   cin>>wt[i]>>val[i];
 }
 for(int i=0;i<=n;i++)
 {
   forz(j,w+1)
   {
     if(i==0||j==0)dp[i][j]=0;
     else if(wt[i-1]<=j)
     {
       dp[i][j]=max(val[i-1]+dp[i-1][j-wt[i-1]],dp[i-1][j]);
     }
     else dp[i][j]=dp[i-1][j];
   }
 }
 cout<<dp[n][w];
 return 0;
}


Measured memory_bytes: 79232
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    String s = sc.next();
    sc.close();
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < n; i++) {
      if (i == k - 1) sb.append(Character.toLowerCase(s.charAt(i)));
      else sb.append(s.charAt(i));
    }
    System.out.println(sb.toString());
  }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define MOD 1000000007
#define pb push_back
using namespace std;
const int nmax=112;

int a,b,flg,cnt[5];

int main()
{
    for(int i=1;i<=4;++i){
        cnt[i]=0;
    }
    flg=0;
    for(int i=0;i<3;++i){
        cin>>a>>b;
        ++cnt[a];
        ++cnt[b];
    }
    for(int i=1;i<=4;++i){
        if(cnt[i]==0 || cnt[i]==3)
            flg=1;
    }
    if(flg==0)
    {
       cout<<"YES"<<endl;
    }
    else
    {
         cout<<"NO"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int main()
{
    int dp[210][2],T[210],strP[210][2],n,m,maxT,minT,P;
    scanf("%d%d",&n,&m);
    for(int i = 0; i < n; i++)
    {
        scanf("%d",&T[i]);
        strP[i][0] = 0;
        strP[i][1] = 100;
    }
    for(int i = 0; i < m; i++)
    {
        scanf("%d%d%d",&minT,&maxT,&P);
        for(int j = 0; j < n; j++)
        {
            if(minT <= T[j] && T[j] <= maxT)
            {
                strP[j][0] = max(strP[j][0],P);
                strP[j][1] = min(strP[j][1],P);
            }
        }
    }
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < 2; j++)
        {
            if(i == 0)dp[i][j] = 0;
            else
            {
                dp[i][j] = max(
                    dp[i - 1][j] + abs(strP[i - 1][j] - strP[i][j]),
                    dp[i - 1][(j + 1) % 2] + abs(strP[i - 1][(j + 1) % 2] - strP[i][j])
                );
            }
        }
    }
    /*for(int i = 0; i < 2; i++)
    {
        for(int j = 0; j < n; j++)
        {
            printf("%2d ",dp[j][i]);
        }
        printf("\n");
    }*/
    printf("%d\n",max(dp[n - 1][0],dp[n - 1][1]));
}

Measured memory_bytes: 2624
import java.io.*;

class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));

			String[] line = br.readLine().split(" ");
			int W = Integer.parseInt(line[0]);
			int H = Integer.parseInt(line[1]);
			int x = Integer.parseInt(line[2]);
			int y = Integer.parseInt(line[3]);
			int r = Integer.parseInt(line[4]);

			boolean X = false;
			boolean Y = false;

			if(r <= x && x <= W - r) {
				X = true;
			}
			if(r <= y && y <= H - r) {
				Y = true;
			}
			if(X && Y) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
	}
}

Measured memory_bytes: 24320
#include<bits/stdc++.h>
using namespace std ;
int main()
{
   long long n,a,b,t,i,s;
   cin>>n>>a>>b;
   if(n==a+b)
        cout<<a<<endl;
        else if (a==0)
            cout<<'0';
   else if(n!=a+b)
   {
        i=n/(a+b);
      s=n%(a+b);
      if(s<=a)
        cout<<i*a+s<<endl;
      else if (s>a)
        cout<<i*a+a<<endl;
   }

   return 0;
}


Measured memory_bytes: 256
# AGC026c
ans = 0


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # map(int, input().split())

    n = int(input())
    s = input()[:-1]
    sLatter = s[n:][::-1]

    d = dict()

    def dfs1(i, sR, sB):
        if i == n:
            if not (sR, sB[::-1]) in d:
                d[(sR, sB[::-1])] = 0
            d[(sR, sB[::-1])] += 1
            return
        dfs1(i + 1, sR + s[i], sB)
        dfs1(i + 1, sR, sB + s[i])

    dfs1(0, '', '')
    # print(d)

    def dfs2(i, sR, sB):
        if i == n:
            if (sR, sB[::-1]) in d:
                global ans
                ans += d[(sR, sB[::-1])]
            return
        dfs2(i + 1, sR + sLatter[i], sB)
        dfs2(i + 1, sR, sB + sLatter[i])

    dfs2(0, '', '')
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 66376
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<ll> vc;
typedef unordered_map<ll,ll> umap;
#define pb emplace_back
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
const ll mod = 1e9+7;

int main(){
	ll n, a[3005], dp[3005][3005]={0};
	cin >> n;
	rep(i,0,n-1) cin >> a[i];
	rep(i,1,n){
		rep(j,0,n-i){
			if(i == 1){
				if(n%2 == 0) dp[j][j] = -a[j];
				else dp[j][j] = a[j];
			} else {
				if((n-i)%2 == 0) dp[j][j+i-1] = max(dp[j+1][j+i-1]+a[j], dp[j][j+i-2]+a[j+i-1]);
				else dp[j][j+i-1] = min(dp[j+1][j+i-1]-a[j], dp[j][j+i-2]-a[j+i-1]);
			}
		}
	}
	cout << dp[0][n-1] << endl;
    return 0;
}


Measured memory_bytes: 70784
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>

#define mod 1000000007
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;

int X[] = {-1, 0, 1, 1, 1, 0, -1, -1};
int Y[] = {1, 1, 1, 0, -1, -1, -1, 0};

void solve() {
    string s;
    cin >> s;

    for(int i = 0; i < s.size(); i++){
        if(i%2 == 0){
            cout << s[i];
        }
    }
    cout << endl;
}

int main(){
    solve();
    return 0;
}

Measured memory_bytes: 512
# include<stdio.h>
int main()
{
	int i,n,m,num=0,ans;
	scanf("%d%d",&n,&m);
	if(n>=m)
	{
		ans=m;
		for(i=1;i<=n;i++)
		{
			num=num+ans;
			ans=ans*10;
		}
	}
	else
	{
		ans=n;
		for(i=1;i<=m;i++)
		{
			num=num+ans;
			ans=ans*10;
		}
	}
	printf("%d\n",num);
	return 0;
}


		


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
const int MOD = 1e9+7,MAX = 1e5;

int main()
{
   int n;
   cin >> n;
   vector<int> p(n);
   rep(i,n)
   cin >> p[i];
   int ans = 0;
   rep(i,n)
   {
      if(p[i]==i+1)
      {
         ans++;
         i++;
      }
   }
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
using pqueg = priority_queue<int, vector<int>, greater<int>>;
using pquel = priority_queue<int, vector<int>, less<int>>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
int lcm(int a, int b){
  return a / __gcd(a, b) * b;
}
int r_int(int a, int b){
  return rand() % b + a;
}
const lint mod=1e9+7;



int main()
{
  string s, t;
  cin >> s >> t;
  int a, b;
  cin >> a >> b;
  string u;
  cin >> u;

  s == u ? --a : --b;
  cout << a << " " << b << "\n";
  return 0;
}


Measured memory_bytes: 256
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

/// Performs prime factorization in O(√x) time.
pub fn factorize(mut x: i64) -> BTreeMap<i64, i64> {
    let mut ms = BTreeMap::new();
    let r = (x as f64).sqrt() as i64 + 1;

    for p in 2..r as i64 {
        let mut m = 0;

        while x >= p && x % p == 0 {
            x /= p;
            m += 1;
        }

        if m > 0 {
            ms.insert(p, m);
        }
    }

    // `x` can have a prime factor larger than √x at most one.
    if x > 1 {
        ms.insert(x, 1);
    }

    ms
}

fn main() {
    let (N, P) = read!(i64, i64);

    let f = factorize(P);
    let mut x = 1_i64;
    for (p, m) in f.into_iter() {
        let d = m / N;
        for _ in 0..d {
            x *= p;
        }
    }
    println!("{}", x)
}


Measured memory_bytes: 4352
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
using namespace std;
typedef long long ll;
const int maxn = 200005;
const int maxm = 26;

string s;
int n,nxt[maxn][maxm],pre[maxn][maxm];
int f[maxn][maxm];

int main() {
  //freopen("in.cpp","r",stdin);
  memset(nxt,-1,sizeof(nxt));
  memset(pre,-1,sizeof(pre));
  memset(f,-1,sizeof(f));
  cin>>s;
  s=" " + s;
  n=s.size();
  for(int i=n-2; i>=0; i--) {
    for(int j=0; j<maxm; j++)nxt[i][j]=nxt[i+1][j];
    nxt[i][s[i+1]-'a']=i+1;
  }
  for(int i=2; i<=n; i++) {
    for(int j=0; j<maxm; j++)pre[i][j]=pre[i-1][j];
    pre[i][s[i-1]-'a']=i-1;
  }
  for(int i=0;i<maxm;i++){
    f[1][i]=pre[n][i];
    if(f[1][i]==-1){
      cout<<char(i+'a')<<endl;
      return 0;
    }
  }
  int len,st=-1;
  for(int i=2;i<=n;i++){
    int mi=n+1;
    for(int j=0;j<maxm;j++)mi=min(mi,f[i-1][j]);
    for(int j=0;j<maxm;j++){
      if(pre[mi][j]==-1){
        st=j;
        len=i;
        break;
      } else {
        f[i][j]=pre[mi][j];
      }
    }
    if(st!=-1)break;
  }
  int pos=nxt[0][st];
  string ret(len, ' ');
  ret[0]=st+'a';
  for(int i=1;i<len;i++){
    if(pos==-1){
      ret[i]='a';
      continue;
    }
    for(int j=0;j<maxm;j++)
    if(f[len-i][j]<=pos){
      ret[i]=j+'a';
      pos=nxt[pos][j];
      break;
    }
  }
  cout<<ret<<endl;
  return 0;
}



Measured memory_bytes: 61700
#include<bits/stdc++.h>
using namespace std;
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long int ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef std::vector<ll> vll;
typedef std::vector<vi > vvi;
typedef std::vector<vll > vvll;
typedef std::pair<int,int> ii;
typedef std::pair< ll, ll > lp;
typedef std::vector<ii> vii;
typedef std::vector<vii > vvii;

#define pb push_back 
#define PB pop_back
#define pf push_front
#define PF pop_front
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define in1(a,n) F(i,1,n)cin>>a[i]
#define ff first
#define ss second
#define F(i,a,b) for (ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define rep(i,n) F(i,0,n-1)
#define clr clear
#define rz resize
#define sqr(a) ((a) * (a))
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define len(s) (s).length()

int main(int argc, char const *argv[])
{
	crap;
	ll n,m;
	cin>>n>>m;

	if (m%n==0)
	{
		cout<<(m/n);
		return 0;
	}
	ll g=1;
	/*if (m&1)
	{
		for (;g<=m;g+=2)
		{
			if (m%g==0)
				continue;
			else
				break;
		}

		g-=2;

		cout<<g;
	}
	else
	{
		g=2;
		for (;g<=m;g+=2)
		{
			if (m%g==0)
				continue;
			else
				break;
		}

		g-=2;

		cout<<g;

	}*/

	set<int> f;

	F(i,1,sqrt(m))
	{
		if (m%i==0)
		{
			f.insert(i);
			f.insert(m/i);
		}
	}

	ll tos=m/n;
	for(set<int>::iterator it=f.begin();it!=f.end();it++)
     {
          if(*it>tos)
          {
             it--;
             cout<<*it;
             return 0;
          }
          if(*it==tos)
          {
             cout<<*it;
             return 0;
          }
     }

	return 0;
}

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


int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a==b && a!=c){
    cout << "Yes" << endl;
  }else if(a==c && a!=b){
    cout << "Yes" << endl;
  }else if(b==c && b!=a){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <queue>
#include <utility>
#include <numeric>
#include <cmath>
#include <bitset>
#include <stack>
#include <algorithm>
#define llc (long long)
#define pm %1000000007
#define ldc (long double)
using namespace std;

int n;
vector <vector <int> > al;
vector <int> p, ppc;
stack <int> per;
queue <int> tsed;
//bitset <100000> aa;
stack <int> aa;
int root;
struct edge{
	int from, to;
};
vector <edge> edgeList;
bool eq(edge a, edge b){
	return a.from==b.from&&a.to==b.to;
}
bool comp(edge a, edge b){
	if(a.from<b.from)return true;
	if(a.from==b.from)return a.to<b.to;
	return false;
}
bool exist(int x, int y){
	edge sf;
	sf.from=x;
	sf.to=y;
	int po=(edgeList.size()+1)>>1, mo=(po+1)>>1;
	for(int i = 1;i <= 4*edgeList.size();i <<= 1){
		if(eq(edgeList[po],sf))return true;
		if(!comp(edgeList[po],sf)){
			po-=mo;
			if(po<0)po=0;
		}else{
			po+=mo;
			if(po>=edgeList.size())po=edgeList.size()-1;
		}
		mo=(mo+1)/2;
	}
	return false;
}
int main(){
	int m;cin>>n>>m;m+=n-1;
	edgeList.resize(m);
	al.resize(n);
	ppc.resize(n);
	p.resize(n,-1);
	int f, t;
	for(int i = 0;i < m;i ++){
		cin>>f>>t;f--;t--;
		edgeList[i].from=f;
		edgeList[i].to=t;
		al[f].push_back(t);
		ppc[t]++;
	}
	sort(edgeList.begin(), edgeList.end(), comp);
	for(int i = 0;i < n;i ++){
		sort(al[i].begin(), al[i].end());
	}
	for(int i = 0;i < n;i ++){
		if(ppc[i]==0){
			per.push(i);
			break;
		}
	}
	while(!per.empty()){
		tsed.push(root=per.top());
		per.pop();
		for(int i = 0;i < al[root].size();i ++){
			ppc[al[root][i]]--;
			if(ppc[al[root][i]]==0){
				per.push(al[root][i]);
			}
		}
	}
	ppc[tsed.front()]=0;
	aa.push(tsed.front());
	tsed.pop();
	while(!tsed.empty()){
		while(!exist(aa.top(),tsed.front())){
			aa.pop();
		}
		ppc[tsed.front()]=aa.top()+1;
		aa.push(tsed.front());
		tsed.pop();
	}
	for(int i = 0;i < n;i ++){
		printf("%d\n", ppc[i]);
	}
}

Measured memory_bytes: 8320
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

int w[302];
int memo[302][302];

int dfs(int l, int r){
    if(r - l <= 1) return 0;
    if(r - l == 2) {
        if(abs(w[l] - w[l+1]) <= 1) return 2;
        else return 0;
    }
    if(memo[l][r] != -1) return memo[l][r];

    int ret = dfs(l+1, r);
    for(int i=l+1;i<r;i+=2){
        if(abs(w[l] - w[i]) <= 1){
            int res = dfs(l+1, i);
            if(res == i - l - 1){
                ret = max(ret, 2 + res + dfs(i+1, r));
            }
        }
    }

    memo[l][r] = ret;
    return ret;
}

int main(){
    while(true){
        int n;
        cin >> n;
        if(n == 0) break;

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

        memset(memo, -1, sizeof(memo));
        cout << dfs(0, n) << endl;
    }
    return 0;
}

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

template <typename T>
bool isPrime(T x) {
    if(x==1) return false;
    for(T i = 2; i*i <= x; ++i) {
        if(x%i==0) return false;
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> v(100010, 0), s(100010);
    s[0]=0;
    REPP(i,v.size()) {
        if(i%2==1 && isPrime(i) && isPrime((i+1)/2)) ++v[i];
        s[i] = s[i-1]+v[i];
    }
    int q; cin >> q;
    int ans;
    REP(i,q) {
        int l,r; cin >> l >> r;
        ans = s[r]-s[l-1];
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 1408
def check_primal(num):
    '''素数だったら0を、違ったら1を返す'''
    for mod in range(2, int(num**0.5+1)):
        if num % mod == 0:
            return 1
    return 0


x = int(input())

for i in range(x, 100004):
    if check_primal(i) == 0:
        print(i)
        break


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

int main()
{
    int A, B, C, X;
    cin >> A;
    cin >> B;
    cin >> C;
    cin >> X;
    int ans = 0;
    for (int i = 0; i <= A; ++i){
        for (int j = 0; j <= B; ++j){
            for (int k = 0; k <= C; ++k){
                if (500 * i + 100 * j + 50 * k == X) ++ans;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

N, M, L = map(int, raw_input().split())
a = []
b = []
for n in range(N):
	a.append(map(int, raw_input().split()))
for m in range(M):
	b.append(map(int, raw_input().split()))

c = [[0 for l in xrange(L)] for n in xrange(N)]

for n in xrange(N):
	for l in xrange(L):
		for m in xrange(M):
			c[n][l] += a[n][m] * b[m][l]

for n in xrange(N):
	for l in xrange(L-1):
		sys.stdout.write(str(c[n][l])+" ")
	print c[n][L-1]

Measured memory_bytes: 7076
a, b = map(int, input().split())
v = ['' for i in range(a)]
for i in range(a):
    v[i] = input()
for i in range(a):
    k = a - i - 1
    x = 0
    for j in range(b):
        if v[k][j] == '#':
            x = 1
    if x == 0:
        v.pop(k)



for i in range(b):
    k = b - i - 1
    x = 0
    for j in range(len(v)):
        if v[j][k] == '#':
            x = 1
    if x == 0:
        for j in range(len(v)):
            v[j] = v[j][:k] + v[j][k+1:]
            
for i in v:
    print(i)


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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	
	int sq[n];
	for(int i = 0; i < n; i++){
		cin >> sq[i];
	}
	map<int, int>ms;
	for(int i = 0; i < n; i++){
		ms[i + 1] = sq[i];
	}
	int cnt = 0;
	for(auto x : ms){
		if(x.first%2 != 0 && x.second%2 != 0){
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

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

/* exchange */
#define chmin(a, b) (a) = min((ll)(a), (ll)(b))
#define chmax(a, b) (a) = max((ll)(a), (ll)(b))

/* output */
#define I(x) cin >> x;
#define D(x) cerr << (x) << " ";
#define BR cerr << "\n";
#define P(x) cout << (x) << endl;
#define FIX cout << fixed << setprecision(10);

/* const */
const int ARRAY = 200005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 998244353;

ll N, M, K;
ll ret = 0;
vl table(ARRAY, 0);

ll fact[ARRAY];
ll inv_fact[ARRAY];
ll inv[ARRAY];

void combiInit() {
  fact[0] = fact[1] = 1;
  inv_fact[0] = inv_fact[1] = 1;
  inv[1] = 1;
  FOR(i, 2, ARRAY) {
    fact[i] = fact[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    inv_fact[i] = inv_fact[i-1] * inv[i] % MOD;
  }
}

ll combi(ll n, ll r) {
  if (n < r) return 0;
  if (n < 0 || r < 0) return 0;
  return fact[n] * (inv_fact[r] * inv_fact[n-r] % MOD) % MOD;
}

int main(void){
  
  I(N);
  I(M);
  I(K);
  

  combiInit();
  FOR(i, 1, N+1) {
    if (i == 1) table[1] = M;
    else table[i] = table[i-1] * (M-1);
    table[i] %= MOD;
    if (N - i <= K) {
      ret += (table[i] * combi(N-1, i-1)) % MOD;
      ret %= MOD;
    }
  }

  P(ret);

}


Measured memory_bytes: 9572
let () = Scanf.scanf "%s\n%d" @@ fun s k ->
  let s = Array.init (String.length s) (String.get s) in
  let a = Array.init 2 @@ fun i ->
    snd @@
    Array.fold_left (fun (c, (n, b)) c' ->
      (c', if b = 1 || c <> c' then (n, 0) else (n + 1, 1)))
    (s.(Array.length s - 1), (0, i)) s in
  Printf.printf "%d\n" @@
  if snd a.(1) = 1
  then k * fst a.(1)
  else if snd a.(0) = 0
  then fst a.(1) + (k - 1) * fst a.(0)
  else (k / 2) * (fst a.(0) + fst a.(1)) + (k mod 2) * fst a.(1)




Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n, m;
	cin>>n>>m;
	vector<int> div;
	for(int i=1; i*i<=m; i++){
		if(m%i==0){
			div.push_back(i);
			if(i*i<m) div.push_back(m/i);
		}
	}
	sort(div.begin(), div.end(), greater<int>());
	for(int i=0; i<div.size(); i++){
		int d=div[i];
		if(m/d>=n){
			cout<<d<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    long long sum=0;
    int a;
    int max = -1000000;
    int min = 1000000;
    for (int i=1 ; i<=n ;i++){cin >> a;
        if(a>=max){max=a;}
        if (a<=min){min=a;}
        sum=sum+a;
    }
    cout <<min<< " "<<max<<" "<<sum<<endl;
        
    return 0;}


Measured memory_bytes: 3108
test = input()

ans = 0

for i in range(len(test)+1):
    bubun = test[i:]
    if set(list(bubun)) <= {'A','C','G','T'}:
        ans = max(ans,len(bubun))

for i in range(len(test)+1):
    for j in range(len(test)+1):
        bubun = test[i:-j+1]
        if set(list(bubun)) <= {'A','C','G','T'}:
            ans = max(ans,len(bubun))



print(ans)

Measured memory_bytes: 3064
/**************************************
* AUTHOR : SHAKIL MOSHARROF 202014048 *
* NICK : xBCC [2013-2019] C/N:1819    *
* INSTITUTION : MIST CSE 20           *
***************************************/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<float.h>
#define PI 3.14
int main() 
{
	int a;
	scanf("%d",&a);

	printf("%d\n",(a+a*a+a*a*a) );

return 0;
}
/*******************************
* 
*A.c
*
*
*
*
********************************/

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

 
int main()
{
    int a;
    int b;
      int b0;
      int b1;
      int b2;
  int keta = 1;
    int i;
    int rot;
   int kai;
//    long long int Y, Ytemp;
//    int i,j;
//    int N_cnt=0;
//    int en10=0;
//    int en5=0;
//    int en1=0;
  
 // 整数の入力
    scanf("%d %d", &a, &b);
 // printf("%d\n",N);
    
    b2=(b/100) %10;
    b1=(b/10) %10;
    b0=b %10;
    if(0!=b2) keta=3;
    else if(0!=b1) keta=2;
      
  
//    printf("%d\n",b2);
//   printf("%d\n",b1);
//  printf("%d\n",b0);
// printf("%d\n",keta);

  rot = (a * ((int)pow(10,keta)) +b);
//  printf("%d\n",rot);
  kai= pow((int)sqrt(rot), 2);
  if(rot == kai)
  printf("Yes\n");
  else 
  printf("No\n");
    
/*    for(i=0;i<N;i++){
    Y= Ytemp - (10000 * i);
    N = Ntemp -i;
    en10 = i;
      for(j=0;j<(N-i);j++){
        
      
      }
        else{
          break;
        }
    }
  

    printf("%d %d %d %d %d\n",en10, en5, en1, N, Y);
    if(0!=Y){
      en10 = -1;
      en5 = -1;
      en1 = -1;
    }
  
    if(0 == ((a*b) % 2))    
    printf("Even\n");
    else 
    printf("Odd\n");
*/
return 0;
}


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

int main()
{
    long X;
    cin >> X;

    long happiness = 0;
    happiness = (X / 500)*1000;
    happiness = happiness + ((X % 500) / 5) * 5;

    cout << happiness;
}


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

int main(){
    string S;
    int N;
    cin >> S;
    N =S.size();
    char c =S[N-1];
    if(c == 's'){
        S = S + "es";
    }
    else{
        S = S + "s";
    }
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define fr first
#define se second
#define pb push_back
using namespace std;
ll ans , n , cnt ,a  , b , mn = 1e9;

string s , s1;
int type = 0;
int main(){
    ios_base::sync_with_stdio( false );
        ll T;
       cin >> n;
       ll arr[n + 1];
       for( int i = 1;i <= n;i ++ )
        cin >> arr[i];
       for( int i = 1;i <= n;i ++ ){
        if( arr[i] <= mn )
            mn = min( mn , arr[i] ),cnt ++;
       } 
       cout << cnt <<  endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const long long maxn=1e5+5;
const long long inf=0x3f3f3f3f;
long long sum[maxn],val[maxn],a[maxn];
long long work(long long dig,long long pos,long long n)
{
	if(sum[pos]*9<n)
		return 0;
	if(sum[pos]*(-9)>n)
		return 0;
	if(pos==(dig+1)/2)
		return n==0;
	long long ans=0;
	for(long long dif=-9;dif<=9;dif++)
	{
		if(dig-1-pos==pos&&dif)
			continue;
		long long way=0;
		for(long long j=(pos==0);j<=9;j++)
		{
			long long i=j+dif;
			if(i>=0&&i<=9)
				way++;
		}
		if(way)
			ans+=way*work(dig,pos+1,n-dif*val[pos]);
	}
	return ans;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    long long n;
    cin>>n;
    a[0]=1;
    for(long long i=1;i<=20;i++)
    	a[i]=a[i-1]*10;
    long long ans=0;
    for(long long dig=1;dig<=18;dig++)
	{
		long long half=(dig+1)/2;
		memset(sum,0,sizeof(sum));
		memset(val,0,sizeof(val));
		for(long long j=half-1;j>=0;j--)
		{
			sum[j]+=sum[j+1];
			val[j]=a[dig-1-j]-a[j];
			sum[j]+=val[j];
		}
		ans+=work(dig,0,n);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 5152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll tmp1,tmp2,tmp3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}

int main(){
  ll x;
  cin >> x;
  tmp1 = x / 100;
  tmp2 = x % 100;
  bool can;
  if(tmp1 * 5 >= tmp2){
    can = true;
  }else{
    can = false;
  }
  if(can){
    cout << "1" << endl;
  }else{
    cout << "0" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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 rfor(i,a,b) for(ll (i) = (a); (i) > (b); --(i))
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;
#define all(x) (x).begin(),(x).end()

ll gcd(ll a,ll 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;
    return t;
}

uint64_t combinations(uint64_t n, uint64_t k) {
    uint64_t r = 1;
    for (uint64_t d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}

int main()
{
    ll n,ans = 0,cnt = 1;
    cin >> n;
    vector<string> s(n + 1);
    s[n] = "zzzzzzzzzzz";
    rep0(i, n){
        cin >> s[i];
        sort(all(s[i]));
    }
    sort(all(s));
    rep0(i, n){
        if(s[i] == s[i + 1]) ++cnt;
        else if(cnt != 1){
          ans += combinations(cnt, 2); 
          cnt = 1;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7296
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<ll> v(n);
    rep(i,n) cin >> v[i];
    sort(v.begin(),v.end());
    int id2 = 0;
    rep(i,n-1){
        if( abs(v[i] - v[n-1]/2) <=  abs(v[id2] - v[n-1]/2)) id2 = i;
    }
    cout << v[n-1] << " " << v[id2] << endl;
    return 0;
}

Measured memory_bytes: 4060
l, r = gets.split.map(&:to_i)

if l + 2019 < r
  p 0
  exit
end

min = 2018

(l..r-1).each do |i|
  (i+1..r).each do |j|
    a = i * j % 2019
    min = a if a < min
  end
end

p min

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 7;

int n, a[N], b[N];
void out() {
    cout << "Yes\n";
    for (int i = 0; i < n; ++i)
        cout << b[i] << " ";
    exit(0);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int i = 0; i < n; ++i)
        cin >> b[i];
    reverse(b, b + n);
    int bad = -1;
    for (int i = 0; i < n; ++i) {
        if (a[i] == b[i])
            bad = b[i];
    }
    vector<int> arr;
    for (int i = 0; i < n; ++i) {
        if (a[i] != bad && b[i] != bad)
            arr.push_back(i);
    }
    int pos = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] == b[i]) {
            if (pos == arr.size()) {
                cout << "No\n";
                return 0;
            }
            swap(b[arr[pos++]], b[i]);
        }
    }
    out();
    return 0;
}


Measured memory_bytes: 8444