akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import static java.lang.Math.*;
import java.io.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		PrintWriter pr = new PrintWriter(System.out);
		while(sc.hasNextDouble()){
			double a=sc.nextDouble();
			double temp=a;
			for(int i =0;i<4;i++){
				a*=2;
				temp+=a;
				a/=3;
				temp+=a;
			}
			a*=2;
			temp+=a;
			pr.println("" +temp);
		}
		pr.flush();
	}

}

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

template <typename T>
struct edge {
    ll src, to;
    T cost;

    edge(ll to, T cost) : src(-1), to(to), cost(cost) {}

    edge(ll src, ll to, T cost) : src(src), to(to), cost(cost) {}

    edge &operator=(const ll &x) {
        to = x;
        return *this;
    }

    operator ll() const { return to; }
};

template <typename T>
using Edges = vector<edge<T>>;
template <typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<ll>>;
template <typename T>
using Matrix = vector<vector<T>>;

template <typename T>
vector<T> dijkstra(WeightedGraph<T> &g, ll s) {
    const auto INF = numeric_limits<T>::max();
    vector<T> dist(g.size(), INF);

    using Pi = pair<T, ll>;
    priority_queue<Pi, vector<Pi>, greater<Pi>> que;
    dist[s] = 0;
    que.emplace(dist[s], s);
    while (!que.empty()) {
        T cost;
        ll idx;
        tie(cost, idx) = que.top();
        que.pop();
        if (dist[idx] < cost) continue;
        for (auto &e : g[idx]) {
            auto next_cost = cost + e.cost;
            if (dist[e.to] <= next_cost) continue;
            dist[e.to] = next_cost;
            que.emplace(dist[e.to], e.to);
        }
    }
    return dist;
}

int main() {
    ll N;
    cin >> N;
    WeightedGraph<ll> g(N);
    for (ll i = 1; i < N; i++) {
        ll a, b, c;
        cin >> a >> b >> c;
        g[a - 1].emplace_back(b - 1, c);
        g[b - 1].emplace_back(a - 1, c);
    }
    ll Q, K;
    cin >> Q >> K;
    vector<ll> ans;
    vector<ll> v = dijkstra(g, K - 1);
    for (ll i = 0; i < Q; i++) {
        ll x, y;
        cin >> x >> y;
        ans.push_back(v[x - 1] + v[y - 1]);
    }
    for (auto &i : ans) {
        cout << i << endl;
    }
}

Measured memory_bytes: 12976
#include <bits/stdc++.h>
#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 irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(V, v) for (auto &&V : v)
#define all(x) (x).begin(), (x).end()
const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
using lint = long long;

using namespace std;

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

  int a, p;
  cin >> a >> p;
  cout << (3 * a + p) / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
int MOD=1000000007;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    lint N;
    cin >> N;
    lint ans=0;
    for(int i=1;i<=sqrt(N);i++){
        lint n=N-i;
        if(n%i!=0) continue;
        lint div=n/i;
        if(div<=i) continue;
        ans+=div;
    }
    cout << ans << endl;
}

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

using namespace std;
int m,n;
const double EPS = 1e-11;


double width(vector<pair<int,int> > polygon,double x){
    vector<double> w;
    for(int i=0;i<polygon.size();i++){
        pair<int,int> p=polygon[i];
        pair<int,int> q=polygon[(i+1)%polygon.size()];
        if(abs(p.first-x)<EPS){
            w.push_back(1.0*p.second);
        }
        else if( (p.first<x && x<q.first)|| (p.first>x && x>q.first)){
            int x0=p.first;
            int y0=p.second;
            int x1=q.first;
            int y1=q.second;
            w.push_back(y0+1.0*(y1-y0)*(x-x0)/(x1-x0));
        }
    }
    assert(w.size()>0);
    sort(w.begin(), w.end());
    return w[w.size()-1] - w[0];
}

double volume(vector<pair<int,int> >Pxy,vector<pair<int,int> >Pxz,vector<int> X){
    double total=0.0;
    int xmin = max((*min_element(Pxy.begin(), Pxy.end())).first,
                   (*min_element(Pxz.begin(), Pxz.end())).first);
    int xmax = min((*max_element(Pxy.begin(), Pxy.end())).first,
                   (*max_element(Pxz.begin(), Pxz.end())).first);
    sort(X.begin(), X.end());
    for(int i=0;i<X.size()-1;i++){
        int a=X[i];
        int b=X[i+1];
        if(!(xmin <= a && a <= xmax &&xmin <= b && b<= xmax) ){
            continue;
        }
        double m=(a+b)/2.0;
        double va = width(Pxy, a)*width(Pxz, a);
        double vb = width(Pxy, b)*width(Pxz, b);
        double vm = width(Pxy, m)*width(Pxz, m);
        double area=((b-a)/6.0)*(va + 4.0*vm + vb);
        total+=area;
    }
    return total;
}
int main(){
    while(cin>>m>>n&&m!=0){
        vector<pair<int,int> > Pxy,Pxz;
        pair<int,int> tem;
        vector<int> X;
        for(int i=0;i<m;i++){
            cin>>tem.first>>tem.second;
            Pxy.push_back(tem);
            X.push_back(tem.first);
        }
        for(int j=0;j<n;j++){
            cin>>tem.first>>tem.second;
            Pxz.push_back(tem);
            X.push_back(tem.first);
        }
        cout << fixed << volume(Pxy, Pxz, X) << endl;
    }
}




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

int n;
void dfs(string s, char mx) {
    if ((int)s.length() == n) {
        printf("%s\n", s.c_str());
    } else {
        for (char c = 'a'; c <= mx; c++) {
            dfs(s + c, ((c == mx) ? (char)(mx + 1) : mx));
        }
    }
}
int main(void) {
    cin >> n;
    dfs("", 'a');
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    double sum = 0;
    for (int i = 0; i < n; i++)
    {
        double x;
        string u;
        cin >> x >> u;
        if (u == "JPY")
        {
            sum += x;
        }
        else
        {
            sum += (x * 380000.0);
        }
    }
    cout << setprecision(11) << sum << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{

long long int ans=0,j,i,n,a[200009];
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];

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

for(j=i+1;j<n;j++)
{
  ans+=a[i]*a[j];

}


}

cout<<ans;
return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <numeric>
#include <functional>
#include <cstdlib>
#include <regex>
#include <list>
#include <cstring>
#include <math.h>

int main(){
	int n;
	std::cin >> n;
	if(1<=n &&n<=9){
		std::cout << n << std::endl;
	}
	else if (n >= 10 && n <= 99) {
		std::cout << 9 << std::endl;
	}
	else if (n >= 100 && n <= 999) {
		std::cout << 9 + (n - 99) << std::endl;
	}
	else if (n >= 1000 && n <= 9999) {
		std::cout << 909 << std::endl;
	}
	else if (n >= 10000 && n <= 99999) {
		std::cout << 909 + (n - 9999) << std::endl;
	}
	else {
		std::cout << 90909 << std::endl;
	}
	return 0;
}

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

signed main()
{
  int S, K;
  int i, j;
  int ans = 0;
  cin >> K >> S;

  for (i = 0; i <= K; i++){
    for (j = 0; j <= K; j++){
      int t = S - (i + j);
      if (t >= 0 and t <= K){
        ans++;
      }
    }
  }

  cout << ans << endl;

  return (0);
}

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

using namespace std;

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

  int q, h, s, d;
  int64_t n;
  cin >> q >> h >> s >> d >> n;

  s = min(min(q * 4, h * 2), s);
  int64_t ans = min(n * s, (n / 2) * d + (n - (n / 2) * 2) * s);

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 3644
#include <iostream>

using namespace std;

int main(){
  int a, b, c;
  int v1, v2, v3;
  cin >> a >> b >> c;
  if (a <= b) {
    if (b <= c) {
      cout << a + b << endl;
    } else {
      cout << a + c << endl;
    }
  } else {
    if (a <= c) {
      cout << a + b << endl;
    } else {
      cout << b + c << endl;
    }
  }
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
while (x->left != NIL){
x = x->left;
return x;
}
}

Node treeMaximum(Node x){
while (x->right != NIL){
x = x->right;
return x;
}
}

Node treeSearch(Node x, int k){
if(x == NIL||k == x->key) return x;
else if(k < x->key) return treeSearch(x->left, k);
else return treeSearch(x->right, k);
}



void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if(y == NIL) root = z;
  else{
    if(z->key < y->key) y->left = z;
    else y->right = z;
  }
}

void inorder(Node u){
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u == NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if (com[0] == 'f' ){
      scanf ("%d", &x );
      Node t = treeSearch (root, x );
      if ( t != NIL ) printf ("yes\n" );
      else printf ("no\n" );
    }
  }

  return 0;
}



Measured memory_bytes: 20440
#include <bits/stdc++.h>
using namespace std; 
  
typedef long long int ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pll> vll; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
typedef priority_queue <ll> pqb;
typedef priority_queue <ll, vector<ll>, greater<ll>> pqs;
double EPS = 1e-9; 
long long INF = 1000000000000000005ll; 
double PI = acos(-1); 
#define M 1000000007ll
#define D 998244353ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound  
#define SQR(x) ((LL)(x) * (x)) 
#define RESET(a, b) memset(a, b, sizeof(a))
#define GCD(a,b) __gcd(a,b)
#define setbits(x)   __builtin_popcountll(x)
#define zerobits(x)  __builtin_ctzll(x) 
#define ps(x,y)  fixed<<setprecision(y)<<x
#define endl '\n'
#define ff first 
#define ss second 
#define mp make_pair  
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define SIZE(v) (int)v.size() 
#define SORT(v) sort(ALL(v)) 
#define REVERSE(v) reverse(ALL(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
  
inline string IntToString(ll a) 
{ 
    char x[100]; 
    sprintf(x, "%lld", a); 
    string s = x; 
    return s; 
} 
  
inline ll StringToInt(string a) 
{ 
    char x[100]; 
    ll res; 
    strcpy(x, a.c_str()); 
    sscanf(x, "%lld", &res); 
    return res; 
} 
  
 
inline string uppercase(string s) 
{ 
    int n = SIZE(s); 
    for(ll i=0;i<n;i++) 
    if (s[i] >= 'a' && s[i] <= 'z') 
        s[i] = s[i] - 'a' + 'A'; 
    return s; 
} 
  
inline string lowercase(string s) 
{ 
    int n = SIZE(s); 
    for(ll i=0;i<n;i++) 
    if (s[i] >= 'A' && s[i] <= 'Z') 
        s[i] = s[i] - 'A' + 'a'; 
    return s; 
}
 
bool cmp(pll a,pll b)
{
  ll as=a.ff-a.ss;
  ll bs=b.ff-b.ss;
    return (as>bs);
}
 
ll dx[]={-1,0,1,0};
ll dy[]={0,1,0,-1};
 
vl v[200005];
vector <bool> vis(200005);

int main() {
    FAST
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll mod;
    cin>>mod;
    ll val=7%mod;
    for(ll i=1;i<1e8;i++){
    	if(val==0){
    		cout<<i<<endl;
    		return 0;
    	}
    	val=(val*10+7)%mod;
    }
    cout<<-1<<endl;
    return 0; 
}

Measured memory_bytes: 8328
def main():
    n = int(input())
    A = list(map(int,input().split()))
    q = int(input())
    m = list(map(int,input().split()))

    sum_list = []
    back = []
    #bit全探索
    for i in range(1,2**n):
        for j in range(n):
            if ( (i>>j)&1 ):
                back.append(A[j])

        #print(back)

        sum = 0
        for k in back:
            sum += k

        sum_list.append(sum)

        back = []

    for h in range(q):
        if m[h] in sum_list:
            print('yes')
        else:
            print('no')

main()



Measured memory_bytes: 43080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll,ll> pii;
typedef vector<pii> vpii;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define US unordered_set
#define ALL(a) (a).begin(),(a).end()
const ll INF = (1ll << 60);

int main() {
  ll N,K; cin>>N>>K;
  vi A(N); REP(i,N) cin>>A[i];
  UM<ll,ll> cnt; REP(i,N) cnt[A[i]]++;
  vi v; for(auto p:cnt) v.PB(p.second);
  ll a=v.size();
  sort(ALL(v));
  ll ans=0;
  REP(i,a-K) ans+=v[i];
  cout<<ans<<endl;

}


Measured memory_bytes: 13128
from bisect import bisect_right
A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(A)] + [INF]
t = [-INF] + [int(input()) for i in range(B)] + [INF]
for q in range(Q):
	x = int(input())
	b, d = bisect_right(s, x), bisect_right(t, x)
	res = INF
	for S in [s[b - 1], s[b]]:
		for T in [t[d - 1], t[d]]:
			d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
			res = min(res, d1, d2)
	print(res)

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

bool is_triangle(int a, int b, int c) {
  // a <= b <= c
  if (a == b || b == c) {
    return false;
  } 
  if (a + b > c) {
    return true;
  } 
  return false;
}

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  sort(L.begin(), L.end());
  
  int ans = 0;
  for (int i = 2; i < N; i++) {
    for (int j = 1; j < i; j++) {
      for (int k = 0; k < j; k++) {
        if (is_triangle(L[k], L[j], L[i])) {
          ans++;
        }
      }
    }
  }
  cout << ans;
}


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

int main(){
    int k,n;
    cin>>k>>n;
    int a[200005],maxx=0;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++){
        if(i!=n)maxx=max(maxx,a[i+1]-a[i]);
        else maxx=max(maxx,a[1]+k-a[i]);
    }
    //cout<<maxx<<endl;
    printf("%d",k-maxx);
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
    long long int n,t,m=1000000000,q=0;
    cin>>n>>t;

    vector<int>a(1000000);
    vector<int>b(1000000);
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    for(int i=0;i<n;i++){
        if(b[i]<=t){
            if(a[i]<m){
                m=a[i];
            }
        }
    }
    if(m>1000000){
                cout<<"TLE"<<endl;
            }
            else{
                cout<<m<<endl;
            }
    
    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef vector<unsigned int>vec;
typedef vector<vec> mat;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int M,d;
    cin >> M >> d;
    int ans = 0;
    for(int m=1;m<=M;m++){
        for(int j=1;j<=d;j++){
            int d10 = j / 10;
            int d1 = j % 10;
            //if(m==4 && j == 22) cout << d1 << " " << d10 << endl;
            if(d1 >= 2 && d10 >= 2 && d1 * d10 == m) ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <utility>
#include <cstring>
#include <cstdio>
#include <vector>
#define MOD 1000000007
#define pb push_back
#define mp std::make_pair
std::vector<std::pair<int, int> > pos[305]; 
int dp[2][3][305][305]; 
inline void upd(int &x, int y)
{
	x += y; 
	if (x >= MOD)
		x -= MOD; 
}
inline bool chk(int x, int y, int z)
{
	for (auto it : pos[x])
	{
		if ((y >= it.first) + (z >= it.first) + 1 != it.second)
			return false; 
	}
	return true; 
}
int main()
{
	// freopen("ARC074-E.in", "r", stdin); 
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++)
	{
		int l, r, x; 
		scanf("%d%d%d", &l, &r, &x); 
		pos[r].pb(mp(l, x)); 
		if (r == 1 && x != 1)
		{
			puts("0"); 
			return 0; 
		}
	}
	dp[1][0][0][0] = dp[1][1][0][0] = dp[1][2][0][0] = 1; 
	for (int i = 1; i < n; i++)
	{
		memset(dp[i & 1 ^ 1], 0, sizeof(dp[i & 1 ^ 1])); 
		for (int j = 0; j < 3; j++)
		{
			for (int x = 0; x < i; x++)
			{
				for (int y = 0; y < i; y++)
				{
					if (!chk(i, x, y))
						continue; 
					for (int k = 0; k < 3; k++)
					{
						int arr[3] = {}; 
						arr[j] = i; 
						arr[!j] = x;
						arr[2 - (j == 2)] = y; 
						arr[k] = i + 1; 
						upd(dp[i & 1 ^ 1][k][arr[!k]][arr[2 - (k == 2)]], dp[i & 1][j][x][y]);
					}
				}
			}
		}
	}
	int ans = 0; 
	for (int j = 0; j < 3; j++)
	{
		for (int x = 0; x < n; x++)
		{
			for (int y = 0; y < n; y++)
			{
				if (chk(n, x, y))
					upd(ans, dp[n & 1][j][x][y]); 
			}
		}
	}
	printf("%d\n", ans);
	return 0; 
}


Measured memory_bytes: 2560
import sys
import math
from operator import itemgetter

n,m = map(int, input().split())
city = [0] * m
dict = {}

for i in range(m):
    p,y = map(int, input().split())
    city[i] = [i,p,y,0]
    dict.setdefault(p,1)
city = sorted(city,key=itemgetter(2))

for j in range(m):
    city[j][3] = format(city[j][1],'06') + format(dict[city[j][1]],'06')
    dict[city[j][1]] = dict[city[j][1]] + 1

city = sorted(city,key=itemgetter(0))

for k in range(m):
    print(city[k][3])



Measured memory_bytes: 40520
N=int(input())
h=list(map(int, input().split()))

for i in range(1,N):
    if h[-i]+1==h[-(i+1)]:
        h[-(i+1)]-=1
    
    elif h[-i]>=h[-(i+1)]:
        pass
    
    else:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 14396
#include<iostream>


int main(){
 int a, b;
 std::cin >> a >> b;
 
 if (a < b) std::cout<< "a < b" << "\n";
 else if (a > b) std::cout << "a > b" << "\n";
 else std::cout<< "a == b" << "\n";

 return 0;
}

Measured memory_bytes: 3096
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

struct BIT {
    int n;
    vector<int> bit; // 1-indexd

    BIT(int sz) {
        bit.resize(sz + 1);
        n = sz;
    }

    int sum(int i) {
        int s = 0;
        while (i > 0) {
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }

    void add(int i, int x) {
        while (i <= n) {
            bit[i] += x;
            i += i & -i;
        }
    }
};

class EGuruguru {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int n, m;
        cin >> n >> m;
        vector<int> a(n);
        REP(i, n) cin >> a[i];

        map<int, int> cnt;
        BIT bit(m + 1);
        FOR(i, 1, n - 1) {
            int d;
            if (a[i] > a[i - 1]) {
                d = a[i] - a[i - 1];
                bit.add(a[i - 1] + 1, 1);
                bit.add(a[i], -1);
            } else {
                d = m - a[i - 1] + a[i];
                bit.add(a[i - 1] + 1, 1);
                bit.add(1, 1);
                bit.add(a[i], -1);
            }
            cnt[a[i]] += d - 1;
        }

        int cur = 0;
        FOR(i, 1, n - 1) {
            if (a[i] > a[i-1]) {
                cur += a[i] - a[i-1];
            } else {
                cur += a[i];
            }
        }

        int res = INF;
        FOR(x, 1, m) {
            cur -= bit.sum(x);
            cur += cnt[x];
            res = min(res, cur);
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    EGuruguru solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 8064
d = {"WWo": "S",
     "WSo": "W",
     "SWo": "W",
     "SSo": "S",
     "WWx": "W",
     "WSx": "S",
     "SWx": "S",
     "SSx": "W",
    }

combo = ["SS","SW","WS","WW"]

N = int(input())
z = input()

matched = False
txt = []
for c in combo:
  keep = c[0]
  left = c
  txt = []
  for i in range(N):
    txt.append(left[1])
    new_ch = d[left+z[i]]
    left = left[1] + new_ch
  if left == c:
    matched = True
    break

if matched:
  print(*txt,sep="")
else:
  print("-1")

Measured memory_bytes: 11240
N=int(input())
A=[0]
a=list(map(int,input().split()))
a.append(0)
A.extend(a)

res=0

for i in range(1,N+2):
    res+=abs(A[i-1]-A[i])

for i in range(1,N+1):
    print(res+abs(A[i-1]-A[i+1])-(abs(A[i]-A[i-1])+abs(A[i]-A[i+1])))

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

using namespace std;

const int N = 100005;
vector <pair<int,int>> aa;

int main()
{
  int n;
  scanf("%d", &n);
  
  for (int i = 0; i < n; ++i) {
    int x; scanf("%d", &x);
    aa.push_back({x, i});
  }
  
  sort(aa.begin(), aa.end());
  
  int res = 0;
  
  for (int i = 0; i < n; ++i) {
    res += abs(i - aa[i].second) % 2;
  }
  
  assert(res % 2 == 0);
  printf("%d\n", res / 2);
  
  return(0);
}

Measured memory_bytes: 1400
using System;
public class Hello
{
    public static void Main ()
    {
        while(true)
        {
            string[] str = Console.ReadLine().Split( );
            int H = int.Parse(str[0]);
            int W = int.Parse(str[1]);
            if(H == 0 && W == 0)break;
            
            for(int i = 0;i < H;i++){
                
                for(int j = 0;j < W;j++){
                    Console.Write("#");
                }
                Console.Write("\n");
            }
            Console.Write("\n");
        }
        
        return ;
        
    }
}



Measured memory_bytes: 15956
#include<iostream>
int main(void){
  int k, c, s;
  for(s = 0; ;s = 0){
    std::cin >> k;
    if(!k) break;
    for(int i = 0;i < k * (k - 1) / 2; i++){
      std::cin >> c; s += c;
    }
    std::cout << s / (k - 1) << std::endl;
  }
}


Measured memory_bytes: 1160
// Problem : B - Crane and Turtle
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
using namespace std;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;

int x,y;

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
	cin>>x>>y;
	bool ok=0;
	for(int i=0;i<=x;++i){
		if(i*2+(x-i)*4==y){
			ok=1;
			break;
		}
	}
    if(ok) cout<<"Yes";
    else cout<<"No";


    return 0;
}


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

int main()
{
  double n, a, b ;
  cin >> n >> a >> b ;
  
  if(a<=b/n){
    cout << a*n <<endl ;
  }
  else{
    cout << b << endl ;
  }
    return 0 ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int N=100;
int mark[N];
int main()
{
    for (int i=1;i<=9;i++)
    for (int j=1;j<=9;j++)
    mark[i*j]=1;
    int x;
    scanf("%d",&x);
    if (mark[x]) printf("Yes\n");
    else printf("No\n");
    // getchar();getchar();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, n) for(ll i=0;i<n;i++)
#define r(i, n) for(ll i=n-1;i>=0;i--)
#define forr(i, x, y) for(ll i=x;i<y;i++)
int main()
{
    ll a,b,c;
    cin>>a>>b;
    cout<<6-a-b<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#include<functional>

using namespace std;
using  ull = unsigned long long int;

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


int main() {

	int n;
	cin >> n;
	vector<ull>num(n);
	rep(i, 0, n)cin >> num[i];

	sort(num.begin(), num.end());
	vector<ull>era = num;
	
	std::sort(era.begin(), era.end());
	era.erase(unique(era.begin(), era.end()), era.end());

	vector<ull>cnt(era.size(), 0);
	ull sum = 0;
	int j = 0;
	rep(i, 0, cnt.size()) {
		while (j<num.size() && era[i] == num[j]) {
			cnt[i]++;
			j++;
		}
		if(cnt[i]%2!=0 && cnt[i]>0)sum++;
	}

	cout << sum << endl;




	return 0;
}

Measured memory_bytes: 2560
while True:
    H,W = (int(x) for x in input().split())
    if H == 0 and W == 0:
        break
    
    print("#" * W)
    for i in range(1, H - 1):
        print("#",end="")
        print("." * (W - 2),end="")
        print("#")
    print("#" * W)
    print("")



Measured memory_bytes: 5640
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

// ans[x] := x が答えになるような組の個数
vector<int> ans(5000000);
const int bound = 150;

int main(){
	int n; cin >> n;
	for( int x = 1; x <= bound; ++x ){
		for( int y = 1; y <= bound; ++y ){
			for( int z = 1; z <= bound; ++z ){
				++ans[x*x+y*y+z*z+x*y+y*z+z*x];
			}
		}
	}
	for( int i = 1; i <= n; ++i ){
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 22548
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

typedef struct Edge{
    int to;
    int num;
} Edge;

// DFS
vector<vector<Edge>> G;
vector<int> col;

void dfs(int v,int p,int e){
    int tmp = 0;
    for(auto nv : G[v]){
        if(nv.to == p)continue;
        tmp++;
        if(e == tmp)tmp++;
        int id = nv.num;
        col[id] = tmp;
        dfs(nv.to,v,tmp);
    }
}

int main() {
    int N;cin >> N;
    G.resize(N);
    col.resize(N-1);
    rep(i,N-1){
        int a,b;cin >> a >> b;
        a--;b--;
        G[a].push_back((Edge){b,i});
        G[b].push_back((Edge){a,i});
    }

    dfs(0,-1,0);

    int ans = 0;
    rep(i,N){
        int tmp = G[i].size();
        ans = max(ans,tmp);
    }

    cout << ans << endl;
    rep(i,N-1){
        cout << col[i] << endl;
    }
}

Measured memory_bytes: 7424
#include <iostream>
#include <vector>
#include <algorithm>

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

inline int min(int x, int y) {return x < y ? x : y;}
inline long min(long x, long y) {return x < y ? x : y;}
inline int max(int x, int y) {return x > y ? x : y;}
inline long max(long x, long y) {return x > y ? x : y;}

inline void swap(int &a, int &b) {
    int tmp = a;
    a = b;
    b = tmp;
}

inline int euclid(int a, int b) {
    if (a > b) swap(a, b);
    int r = a % b;
    while (r > 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

using namespace std;

signed main() {
    int N;
    cin >> N;
    vector<int> h(N);
    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }

    int ctr = 0;
    while(1) {
        int l = 0;
        for (l = 0; l < N; l++) {
            if (h[l] > 0) break;
        }
        if (l == N) break;

        while(l < N) {
            if (h[l] <= 0) break;
            --h[l];
            ++l;
        }
        ++ctr;
    }
    cout << ctr << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int P, Q, R;
		P = sc.nextInt();
		Q = sc.nextInt();
		R = sc.nextInt();

		System.out.println(Math.min(P + Q, Math.min(Q + R, R + P)));
	}
}

Measured memory_bytes: 21844
N, X = map(int,input().split())
L = list(map(int,input().split()))
D = [0]*(N+1); D[0] = 0;
cnt = 1
for i in range(1, N+1):
  D[i] = D[i-1] + L[i-1]
  if D[i] > X:
    print(cnt)
    exit()
  cnt += 1
print(cnt)

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

int main() {
    int n, k;
    cin>>n>>k;
    int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }    
    long long int dp[n+1][k+1];
    memset(dp, 0, sizeof(dp));
    for(int i=0; i<=n; i++)
        dp[i][0]=1;
    
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=k; j++)
        {
            dp[i][j] = (dp[i-1][j]%MAX + dp[i][j-1]%MAX )%MAX;
            if(j>a[i-1])
            {
                dp[i][j]= (dp[i][j]%MAX- dp[i-1][max(j-a[i-1]-1, 0)]%MAX + MAX)%MAX;
            }
        }
    }
    cout<<dp[n][k]%MAX<<endl;
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, K;
  cin >> N >> K;
  vector<int> data(N);
  for (int i = 0; i < N; i++) {
    cin >> data.at(i);
  }
  int ans = 0, count =0;
  while (count < N) {
    if (count == 0) {
      count += K;
    } else{
      count += K - 1;
    }
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <deque>
#include <numeric>
#include <sstream>
#include <iomanip>
#define ALL(X) X.begin(), X.end()
using lint = long long;
template <typename T>
void print_container(std::vector<T> vec)
{
    for (auto iter = vec.begin(); iter != vec.end(); ++iter)
    {
        std::cout << *iter << " ";
    }
    std::cout << std::endl;
}

int main()
{
    lint h, w;
    scanf("%lld", &h);
    scanf("%lld", &w);

    std::vector<lint> alpha(26, 0);
    std::vector<std::string> mat(h);
    std::string s;

    for (int i = 0; i < h; ++i)
    {
        std::cin >> s;

        mat[i] = s;
    }

    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            alpha[lint(char(mat[i][j]) - 'a')]++;
        }
    }

    lint four, two, one;

    if (h % 2 == 1 && w % 2 == 1)
    {
        one = 1;
        two = (h - 1) / 2 + (w - 1) / 2;
        four = (h * w - two * 2 - 1) / 4;
    }
    else if (h % 2 == 1 && w % 2 == 0)
    {
        one = 0;
        two = w / 2;
        four = (h - 1) * w / 4;
    }
    else if (h % 2 == 0 && w % 2 == 1)
    {
        one = 0;
        two = h / 2;
        four = (w - 1) * h / 4;
    }
    else
    {
        one = 0;
        two = 0;
        four = h * w / 4;
    }

    for (int i = 0; i < 26; ++i)
    {
        lint rem = alpha[i];
        if (rem == 0)
            continue;

        while (rem >= 4 && four >= 1)
        {
            rem -= 4;
            four--;
        }
        while (rem >= 2 && two >= 1)
        {
            rem -= 2;
            two--;
        }
        if (rem % 2 != 0)
        {
            one--;
        }
    }

    if (four == 0 && two == 0 && one == 0)
    {
        std::cout << "Yes"
                  << "\n";
    }
    else
    {
        std::cout << "No"
                  << "\n";
    }

    return 0;
}


Measured memory_bytes: 3192
str = input()
n = int(input())

for i in range(n):
    args = input().split()
    command = args[0]
    s = int(args[1])
    e = int(args[2])
    if command == 'print':
        print(str[s:e + 1])
    if command == 'reverse':
        str = str[0:s] + str[s:e + 1][::-1] + str[e + 1:]
    if command == 'replace':
        str = str[0:s] + args[3] + str[e + 1:]

Measured memory_bytes: 7672
/*
 * N 個のマスに区切られた細長い紙切れの上でゲームを行います。マスには 1 から N までの番号が順に付けられています。
 * 
 * アリスの駒はマス A に、ボリスの駒は別のマス B に置かれています。
 * 
 * 二人にはターンが交互に訪れます。アリスが先手です。 ターンが回ってきたプレイヤーは、自分の駒を現在のマス X から左隣のマス X−1 か右隣のマス X+1 のどちらかに動かさなければなりません。 
 * ただし、駒を紙切れの外に出したり、相手の駒と同じマスに動かしてはいけません。 また、駒の移動は一ターンに一度だけ行わなければなりません。
 * 
 * 駒を動かせなくなった人が負けで、相手の勝ちとなります。
 * 
 * 二人とも、勝ちたいと思っています。二人とも最適にプレイするとき、どちらが勝つでしょうか？
 */

import java.util.*;
	public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            //入力
            Integer.parseInt(sc.next());
            int a = Integer.parseInt(sc.next());
            int b = Integer.parseInt(sc.next());
            
            //出力
            if((a-b)%2 == 0){
            	System.out.println("Alice");
            }else{
            	System.out.println("Borys");
            }
            sc.close();
        }
    }
	

Measured memory_bytes: 21972
lst_input = list(map(int, input().split()))
n, m, l = lst_input[0], lst_input[1], lst_input[2]

matrix_A = []
matrix_B = []
matrix_C = [[0 for i in range (l)] for j in range(n)]

for i in range(n):
    lst_A = list(map(int, input().split()))
    matrix_A.append(lst_A)

for i in range(m):
    lst_B = list(map(int, input().split()))
    matrix_B.append(lst_B)

for i in range(n):
    for j in range(l):
        for k in range(m):
            matrix_C[i][j] = matrix_C[i][j] + matrix_A[i][k] * matrix_B[k][j]

for i in matrix_C:
    for j, k in enumerate(i):
        if j == l - 1:
            print(k)
        else:
            print(k, end= " ")


Measured memory_bytes: 7072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define out(a) cout<<fixed<<setprecision((a))

vector<ll> enum_div(int n){//yakusu
	vector<ll> ret;
	for(ll i=1 ; i*i<=n ; ++i){
			if(n%i == 0){
				ret.push_back(i);
				if(i*i!=n)ret.push_back(n/i);
			}
	}
	return ret;
}

int main(){
	ll n;
	cin >> n;
	vector<ll> a(n+1);
	vector<ll> cnt(n+1,0);
	vector<ll> ans;
	FOR(i,1,n+1)cin>>a[i];


	FORR(i,1,n+1){
		if(a[i]==1 && cnt[i]%2==0){
			ans.push_back(i);
			for(auto x:enum_div(i)){
				cnt[x]++;
			}
		}else if(a[i]==0 && cnt[i]%2==1){
			ans.push_back(i);
			for(auto x:enum_div(i)){
				cnt[x]++;
			}
		}
	}
	cout << ans.size() << endl;
	bool s = false;
	for(auto x:ans){
		if(s)cout << ' ';
		s = true;
		cout << x;
	}
	cout << endl;
}

Measured memory_bytes: 4980
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdint>
using namespace std;
using i64 = int64_t;

int main(void){
    i64 x, d = 100;
    cin >> x;
    int cnt = 0;
    while(d < x){
        d = (i64)(d+d/100);
        cnt++;
    }
    cout << cnt << '\n';
    return 0;
}

Measured memory_bytes: 3632
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
ll C, K;
const int maxN = 1e5 + 10;
ll t[maxN];
int n;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    cin >> n >> C >> K;
    for (int i = 1; i <= n; i++) {
        cin >> t[i];
    }
    sort(t + 1, t + n + 1);
    int cnt = 0;
    ll lst = -1e18;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (lst < t[i] || cnt == C) {
            ans++;
            cnt = 1;
            lst = t[i] + K;
        }
        else {
            cnt++;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using vi = vector<int>;
using vv = vector<vi>;
int main(){
    int n;cin >> n;
    if(n<1200)
      cout<<"ABC"<<endl;
    else if(n<2800)
      cout<<"ARC"<<endl;
    else
      cout<<"AGC"<<endl;
  return 0;
}


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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

bool isok(char c) {
    return c == 'A' || c == 'G' || c == 'C' || c == 'T';
}

void solve() {
    string s;
    cin >> s;
    int N = s.size();
    int ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= N - i; j++) {
            string ss = s.substr(i, j);
            bool ok = true;
            for (int k = 0; k < ss.size(); k++) {
                if (!isok(ss[k])) {
                    ok = false;
                }
            }
            if (ok) {
                int k = ss.size();
                ans = max(ans, k);
            }
        }
    }
    cout << ans << endl;
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Measured memory_bytes: 256
N = int(input())
a = input().strip()
ind = 0
hist = [a]
for _ in range(N-1):
    b = input().strip()
    if b in hist or a[-1]!=b[0]:
        ind = 1
        break
    hist.append(b)
    a = b
if ind==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
n=int(input())
q=[input().split()+[i]for i in range(n)]
for i in range(n):
    q[i][1]=int(q[i][1])
p=sorted(sorted( q ,key=lambda x:x[1],reverse=1),key=lambda x:x[0])
for s,t,r in p:
    print(r+1)


Measured memory_bytes: 3060
import math
a, b, c, d = list(map(int, input().split()))

a_div_c = (a-1) // c
a_div_d = (a-1) // d
a_div_cd = (a-1) // (c * d // math.gcd(c, d))
b_div_c = b // c
b_div_d = b // d
b_div_cd = b // (c * d // math.gcd(c, d))

y = b - (b_div_c + b_div_d - b_div_cd)
x = (a - 1) - (a_div_c + a_div_d - a_div_cd)

print(y-x)




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

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

int main(){
    int n;
    cin >> n;
    string str;
    cin >> str;
    int count = 1;
    char prec = str.at(0);

    for(int i = 1;i<str.length();i++){
        if(prec != str.at(i)){
            count++;
            prec = str.at(i);
        }
    }

    cout << count;

    return 0;
}

Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    map<string, int> cnt;
    for(int i=0; i<n; ++i){
        string s;
        cin >> s;
        ++ cnt[s];
    }

    for(const string& s : {"AC", "WA", "TLE", "RE"})
        cout << s << " x " << cnt[s] << endl;

    return 0;
}


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

    int main(){
        
        int a,b,k=1,c=0;
    
        cin>> a>>b ;

        while(a/k){
            k*=b;
            c++;
        }
        cout<< c<<"\n";
       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 REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  int d, n;
  cin >> d >> n;
  if(n == 100) n++;
  int ans = pow(100, d) * n;
  cout << ans << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include <string.h>
#include<stdio.h>
#include <vector>
#include <math.h>


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


int main() {
	long long int N, M, K, t = 0;
	cin >> N >> M >> K;
	vector<ll> A(N),as(N+1);
	vector<ll> B(M),bs(M+1);
	rep(i, N) {
		cin >> A[i];
		as[0] = 0;
	    as[i+1] = as[i] + A[i];
	}
	rep(i, M) {
		cin >> B[i];
		bs[0] = 0;
		bs[i+1] = bs[i] + B[i];
	}
	long long int min, b,max,bsu,ans = 0;
	
	rep(i, N + 1) {
		if (as[i] > K)break;
		b = K - as[i];
		min = 0, max = M;
		

		bsu = (min + max) / 2;
		if (max - min == 1) {
			if (bs[max] == b)bsu = max;
			else bsu = min;
			//break;
		}
		while(max - min != 1){
			bsu = (min + max) / 2;
			if (b > bs[M]) {
				bsu = M;
				break;
			}
			if (bs[min] <= b && b<= bs[bsu]) {
				max = bsu;
			}
			else if(bs[bsu] < b && b <=bs[max]){
				min = bsu;
			}
			if (max - min == 1) {
				if (bs[max] == b)bsu = max;
				else bsu = min;
				//break;
			}
			
		}
		if(i+bsu > ans) ans = i + bsu;
	}

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 9216
#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(){
    int n;
    cin >> n;
    set<string> s;
    rep(i,n){
        string c;
        cin >> c;
        s.insert(c);
    }
    cout << s.size() << endl;

    return 0;
}


Measured memory_bytes: 19160
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  string s;
  cin >> s;
  if(s[0]=='R'&&s[1]=='R'&&s[2]=='R') pr(3);
  else if(s[0]=='R'&&s[1]=='R'||s[1]=='R'&&s[2]=='R') pr(2);
  else if(s[0]=='R'||s[1]=='R'||s[2]=='R') pr(1);
  else pr(0);
}

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


Measured memory_bytes: 3608
N, M = gets.split.map &:to_i
Xs = gets.split.map(&:to_i).sort

Xs_diffs = [*0...(M-1)].map{|i| (Xs[i] - Xs[i + 1]).abs }.sort

p Xs_diffs.take([M - N, 0].max).inject(0, :+)


Measured memory_bytes: 12784