akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;
using namespace std;

struct SCC{
    vector<vector<int> > g,rg;
    vector<int> vs,cmp,used;
    SCC(int v):g(v),rg(v),cmp(v,-1),used(v,0){}
    
    void add_edge(int src,int dst){
        g[src].pb(dst);
        rg[dst].pb(src);
    }
    void dfs(int v){
        used[v]=true;
        rep(i,g[v].size()){
            if(!used[g[v][i]]) dfs(g[v][i]);
        }
        vs.pb(v);
    }
    void rdfs(int v,int k){
        used[v]=true;
        cmp[v]=k;
        rep(i,rg[v].size()){
            if(!used[rg[v][i]]) rdfs(rg[v][i],k);
        }
    }
    int scc(){
        fill(used.begin(),used.end(),0);
        vs.clear();
        rep(i,used.size()){
            if(!used[i]) dfs(i);
        }
        fill(used.begin(),used.end(),0);
        int k=0;
        for(int i=vs.size()-1;i>=0;--i){
            if(!used[vs[i]]) rdfs(vs[i],k++);
        }
        return k;
    }
};

int main(){
    int v,e;
    cin>>v>>e;
    SCC scc(v);
    int s,t;
    rep(i,e){
        cin>>s>>t;
        scc.add_edge(s,t);
    }
    scc.scc();
    int q,u,v2;
    cin>>q;
    rep(i,q){
        cin>>u>>v2;
        if(scc.cmp[u]==scc.cmp[v2]) cout<<1<<endl;
        else cout<<0<<endl;
    }
    return 0;
}

Measured memory_bytes: 4448
#include <boost/algorithm/string/join.hpp>
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;
using namespace boost;

typedef int64_t INT;

struct Point{
    INT x, y, h;
};

void Resolve(istream &is, ostream &os) {
    INT N;
    is >> N;
    vector<Point> points;
    Point fp;
    for(int i=0;i < N;i++)
    {
        INT x,y,h;
        is >> x >> y >> h;
        points.push_back(Point{x, y, h});
        if(h != 0)
        {
            fp.x = x;
            fp.y = y;
            fp.h = h;
        }
    }
    Point center{0,0,-1};
    for(int x=0;x <= 100;x++)
    {
        for(int y=0;y <= 100;y++)
        {
            INT h = fp.h + abs(fp.x-x) + abs(fp.y-y);
            bool cont = false;
            for(int n=0;n < N;n++)
            {
                auto p = points[n];
                auto calcH = h - abs(p.x-x)-abs(p.y-y);
                calcH = max(calcH, 0L);
                if(calcH != p.h)
                {
                    cont = true;
                    continue;
                }
            }
            if(cont)
                continue;
            center.x = x;
            center.y = y;
            center.h = h;
        }
    }
    auto x = center.x;
    auto y = center.y;
    auto h = center.h;
    os << x << " " << y << " " << h;
}

#if !TEST
int main() { cin.tie(0); ios::sync_with_stdio(false); Resolve(cin, cout); cout.flush(); return 0;}
#endif


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

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

const ll MOD = 1e9 + 7;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second



int main() {
	int n = 0, S = 0, w = 0, e = 0;
	string s;
	cin >> s;
	for (int i = 0;i < s.size();i++) {
		if (s[i] == 'N')n++;
		else if (s[i] == 'S')S++;
		else if (s[i] == 'W')w++;
		else e++;
	}
	if (n == 0 && S != 0 || S == 0 && n != 0 || w == 0 && e != 0 || w != 0 && e == 0)cout << "No" << endl;
	else cout << "Yes" << endl;
	}


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

#define lint long long


int main(){
    int H, W, N; cin >> H >> W >> N;
    vector<int> a(N);
    for(int i = 0; i < N; ++i){
        cin >> a[i];
    }
    vector<vector<int>> ans(H);
    
    int X = 0, Y = 0;
    
    for(int i = 0; i < N; ++i){
        while(true){
            int b = W - X;
            if(b >= a[i]){
                for(int j = 0; j < a[i]; ++j){
                    ans[Y].push_back(i + 1);
                }
                X += a[i];
                break;
            } else {
                for(int j = 0; j < b; ++j){
                    ans[Y].push_back(i + 1);
                }
                a[i] -= b;
                X = 0; Y++;
            }
        }
        
    }
    
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j){
            if(i % 2 == 0){
                cout << ans[i][j] << " ";
            } else {
                cout << ans[i][W - 1 - j] << " ";
            }
        }
        cout << endl;
    }
    
}


Measured memory_bytes: 384
#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++)
typedef long long ll;

int main(){
	string S;
	cin >> S;
	
	bool ok = true;
	rep(i,S.size()){
		if(i%2==0){
			if(S[i] == 'L'){
				ok = false;
			}
		} else{
			if(S[i] == 'R'){
				ok = false;
			}
		}
	}
	
	if(ok){
		cout << "Yes" << endl;
	} else{
		cout << "No" << endl;
	}
	
	
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fup(i,a,b) for(int i=a;i<=b;++i)
#define fdw(i,a,b) for(int i=a;i>=b;--i)
#define sync ios::sync_with_stdio(false);cin.tie(0)
#define cl(a) memset(a,0,sizeof(a))
#define gcd __gcd
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
//ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//ll ksm(ll a,ll b,ll mod){ll ans=1;a%=mod;for(;b;b>>=1){if(b&1) ans=ans*a%mod;a=a*a%mod;}return ans;}
//ll oula(ll n){ ll res=n;for(ll i=2;i*i<=n;i++){if(n%i==0){ res=res-res/i;while(n%i==0) n/=i;}}if(n>1) res=res-res/n;return res;}
//bool MRT(ll x){if(x==2)return true;fup(i,1,30){ll now=rand()%(x-2)+2;if(ksm(now,x-1,x)!=1)return false;}return true;}
//void shai(int n)fup(i,2,n){if(isprime[i]){v.push_back(i);for(int j=2*i;j<=10000;j+=i)isprime[j]=0;}}//"埃氏筛筛选素数"
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const int N = 1e5 + 10 ;
set<int >se;
int main()
{
    sync;
    int n;
    cin>>n;
    fup(i,1,n)
    {
        int x;
        cin>>x;
        se.insert(x);
    }
    if(se.size()==n)
        cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=105;
int ans[maxn][maxn];
int a[maxn*maxn];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h,w,n;
    cin>>h>>w>>n;
    for(int i=1;i<=n;++i)
        cin>>a[i];
    int tot=0;
    int f=1;
    for(int i=1;i<=n&&a[i];++i){
        while(a[i]){
            ans[tot/w][tot%w]=i;
//            cout<<"*"<<ans[tot/w][tot%w]<<endl;
            a[i]--;
//            cout<<tot/w<<" "<<tot%w<<endl;
//            cout<<a[i]<<" "<<tot<<" "<<i<<endl;
            if((((tot+1)%w==0&&(((tot+1)/w)&1))||(tot%w==0&&((tot/w)&1)))&&tot){
                tot+=w;
                f*=-1;
            }
            else tot+=f;
        }
    }
    for(int i=0;i<h;++i){
        for(int j=0;j<w;++j){
            cout<<ans[i][j]<<" ";
        }
        cout<<endl;
    }

}
/*
*/

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

using namespace std;
#define ll long long int

int main()
{
    ll t;
    t = 1;
    //cin t;
    while (t--)
    {
        ll n, m;
        cin >> n >> m;
        int i = 1;
        int j = n;
        if (n % 2 != 0)
        {
            while (m--)
                cout << i++ << " " << j-- << endl;
        }
        else
        {
            int count[n + 1] = {0};
            int current = 1;
            int x = n / 2;
            int s = 1;
            int s1 = x + 1;
            for (int i = x - 1; i >= 1; i--)
            {
                if (m == 0)
                    break;
                if (i % 2 == 0)
                {
                    cout << s << " " << s + i << endl;
                    s++;
                }
                else
                {
                    cout << s1 << " " << s1 + i << endl;
                    s1++;
                }

                m--;
            }
            // cout << i << " " << --j << endl;
        }
    }
}


Measured memory_bytes: 3888
#include<iostream>
#include <algorithm>
#include <stdlib.h>
using namespace std;

int main(void) {
	long long int n, a, b, m, l;
	bool flag = true;
	cin >> n >> a >> b;
	m = n / (a + b);
	m *= a;
	l = n % (a + b);
	if (l > a)l = a;
	cout << m + l << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int fact(int n)
{
    int x = 1; // 0! = 1

    for (int i = 1; i <= n; ++i)
        x *= i;

    return x;
}

int main(){
    int n;cin>>n;
    double x[n],y[n];rep(i,n)cin>>x[i]>>y[i];
    double d[n][n];
    double ans = 0.0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            d[i][j]=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
            d[j][i]=d[i][j];
        }
    }
    vector<int>v;
    rep(i,n)v.push_back(i);
    do{
        double dist=0.0;
        rep(i,n-1){
            dist+=d[v[i]][v[i+1]];
        }
        ans += dist;
    }while(next_permutation(v.begin(),v.end()));
    ans/=(double)fact(n);
    printf("%.12f\n", ans);
}



Measured memory_bytes: 256
/*
СТРОИМ СТЕНУ РАБОТЯГИ!
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
const ll INF = (ll)1e18;
ll calc(int x, int y)
{
	if (x <= y) return y - x;
	return INF;
}
int main()
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	ll x, y;
	cin >> x >> y;
	ll res = INF;
	res = min(res, calc(x, y));
	res = min(res, calc(-x, y) + 1);
	res = min(res, calc(x, -y) + 1);
	res = min(res, calc(-x, -y) + 2);
	cout << res << endl;
}


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

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef complex<ld> PT;
#define F first
#define S second

inline int in(){int x, y; y = scanf("%d", &x); return x; }

const int N = -1;

istream& operator>> (istream& is, complex<ld>& p){
	ld val;
	is >> val;
	p.real(val);
	is >> val;
	p.imag(val);
	return is;
}

PT proj(PT a, PT b, PT c){
	b -= a, c -= a;
	return a + b*real(c/b);
}

int main(){
	PT a, b;
	cin >> a >> b;
	cout << setprecision(10) << fixed;
	for (int i = in(); i; i--){
		PT p;
		cin >> p;
		PT img = proj(a, b, p);
		cout << img.real() << ' ' << img.imag() << '\n';
	}
	return 0;
}


Measured memory_bytes: 3344
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define Mod 998244353
#define pi 3.14159265358979323846
#define endl '\n'
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;

int main()
{
    int l,r,d;
    cin>>l>>r>>d;
    cout<<r/d-(l-1)/d<<endl;
    return 0;
}


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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

string rot(string s) {
  string r = "";
  rep (i, s.size()) {
    char c = s[i] < 'a' ? s[i]
           : s[i] == 'z' ? 'a' : char(s[i]+1);
    r += c;
  }
  return r;
}

bool ok(string s) {
  int a = s.find("the");
  int b = s.find("this");
  int c = s.find("that");
  return a != string::npos || b != string::npos || c != string::npos;
}

int main() {

  string s;
  while (getline(cin, s)) {
    while (!ok(s)) s = rot(s);
    cout << (s) << endl;
  }

  return 0;
}

Measured memory_bytes: 1192
#include <cstdio>

using namespace std;

int main() {
    int n, a, t = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) scanf("%d", &a), t ^= a;
    printf("%s\n", t ? "No" : "Yes");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

vector<pair<int,int>> d = {{-1,0}, {1,0}, {0,-1}, {0,1}};

int bfs(int i, int j, const vector<string>& vs){
    int h = vs.size();
    int w = vs[0].size();
    vector<vector<int>> dist(h, vector<int>(w, -1));
    dist[i][j] = 0;
    int ans = 0;
    queue<pair<int, int>> q;
    q.push({i,j});
    while(!q.empty()){
        auto n = q.front();
        q.pop();
        ans = max(ans, dist[n.first][n.second]);
        for(auto e:d){
            int x = n.first + e.first;
            int y = n.second + e.second;
            if(x < 0 || x >= h || y < 0 || y >= w) continue;
            if(vs[x][y] == '#') continue;
            if(dist[x][y] >= 0) continue;
            q.push({x,y});
            dist[x][y] = dist[n.first][n.second] + 1;
        }
    }
    //cout << ans << " ";
    return ans;
}

int main()
{
    int h,w;
    cin >> h >> w;
    vector<string> vs(h);
    for(int i=0; i<h; i++) cin >> vs[i];
    int ans = 0;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(vs[i][j] == '#') continue;
            ans = max(ans, bfs(i,j,vs));
        }
    }
    cout << ans << endl;
    return 0;
}

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

void solve(long long A, long long B, long long C)
{
    long long n = 0;
    if (A * C <= B)
        cout << C << endl;
    else if (A > B)
        cout << 0 << endl;
    else if (A == B)
        cout << 1 << endl;
    else
    {
        for (long long i = 1; i <= C; i++)
        {
            if (i * A > B)
            {
                n = i - 1;
                break;
            }
            else if (i * A == B)
            {
                n = i;
                break;
            }
        }
        cout << n << endl;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 3692
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <deque>

#define INF 100000000
#define MOD 1000000007

#define ll long long

using namespace std;

int main() {
	int n; cin >> n;
	vector<string> s(n);
	for (int i = 0; i<n; i++) cin >> s[i];
	vector<int> marchnum(5, 0);
	for (int i = 0; i<n; i++) {
		if (s[i].front() == 'M') marchnum[0]++;
		if (s[i].front() == 'A') marchnum[1]++;
		if (s[i].front() == 'R') marchnum[2]++;
		if (s[i].front() == 'C') marchnum[3]++;
		if (s[i].front() == 'H') marchnum[4]++;
	}
	long long ans = 0;
	for (int i = 0; i<3; i++) {
		for (int j = i + 1; j<4; j++) {
			long long temp = 0;
			for (int k = j + 1; k<5; k++) temp += marchnum[k];
			ans += marchnum[i] * marchnum[j] * temp;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main()
{
    INIT;
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i,n) cin >> a.at(i);
    double bunbo_sum = 0;
    REP(i,n){
        bunbo_sum += (1.0 / a.at(i));
    }
    double ans = 1 / bunbo_sum;
    cout << fixed << setprecision(5) << ans << endl;
    return 0;
}

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

int main() {
	int a, b;
	char op;

	while (1) {
		scanf("%d %c %d", &a, &op, &b);
		if (op == '?') break;
		if (op == '+') {
			printf("%d\n", a + b);
		}
		else if (op == '-') {
			printf("%d\n", a - b);
		}
		else if (op == '/') {
			printf("%d\n", a / b);
		}
		else if (op == '*') {
			printf("%d\n", a * b);
		}
	}

	return 0;

}


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

int main() {
  
  int A,B,C;
  cin >>A >>B >>C;
  int D = B/A;
  if(B/A<=C){
    cout << B/A;
  }
  else if(B/A>C){
    cout <<C;
  }


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ONE_DIGIT(x) 0 < x && x < 10
using namespace std;

int main() {
  int N;
  cin >> N;
  for(int i = 1; i < 10; i++) {
    if (ONE_DIGIT(N/i) && (N/i)*i == N) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
	int A,B,H,M;
	cin>>A>>B>>H>>M;
	double hd,md;
	hd=H*30+M*0.5;
	md=M*6;
	double a=fabs(hd-md);
	if(a>180){
		a=360-a;
	}
	double C;
	C=sqrt(A*A+B*B-2*A*B*cos(a*acos(-1.0)/180));
	cout<<fixed<<setprecision(20)<<C<<endl;
	return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main()
{
  ifstream fIn("input.txt");
  if (fIn.is_open())
    cin.rdbuf(fIn.rdbuf());

  int N;
  string S;
  cin >> N >> S;
  map<string, int> map;
  map["A"] = 0;
  map["B"] = 1;
  map["C"] = 2;
  map["D"] = 3;
  map["E"] = 4;
  map["F"] = 5;
  map["G"] = 6;
  map["H"] = 7;
  map["I"] = 8;
  map["J"] = 9;
  map["K"] = 10;
  map["L"] = 11;
  map["M"] = 12;
  map["N"] = 13;
  map["O"] = 14;
  map["P"] = 15;
  map["Q"] = 16;
  map["R"] = 17;
  map["S"] = 18;
  map["T"] = 19;
  map["U"] = 20;
  map["V"] = 21;
  map["W"] = 22;
  map["X"] = 23;
  map["Y"] = 24;
  map["Z"] = 25;
  string result = "";
  string word = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
  for(int i = 0; i < S.length(); ++i){
    string s = S.substr(i,1);
    int idx = map[s] + N;
    result += word[idx];
  }
    cout << result << endl;
}


Measured memory_bytes: 256
package main

import "fmt"

func min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func max(a int, b int) int {
	if a < b {
		return b
	}
	return a
}

func main() {
	var a, b, c, x, y int
	fmt.Scan(&a, &b, &c, &x, &y)

	result := 0
	maxC := max(x, y) * 2
	for i := 0; i <= maxC; i++ {
		if i == 0 {
			result = a*(x-i/2) + b*(y-i/2) + c*i
		} else {
			if i%2 == 0 {
				tmp := max(0, a*(x-i/2)) + max(0, b*(y-i/2)) + c*i
				result = min(tmp, result)
			}
		}
	}
	fmt.Println(result)
}


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

int main(){
    
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int X=c-a,Y=d-b;
    string S,T,U,V;
    for(int i=0;i<X;i++){
        S+='R';
        U+='L';
    }
    for(int i=0;i<Y;i++){
        T+='U';
        V+='D';
    }
    cout<<S<<T<<U<<V;
    cout<<'D'<<S<<'R'<<T<<'U'<<'L';
    cout<<'U'<<U<<'L'<<V<<'D'<<'R'<<endl;
}


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

class retroactive_uf {
	vector<int> data;
	vector<pair<int, int>> hist;
public:
	retroactive_uf(int n) : data(n, -1) {}
	int find(int a) const {
		return data[a] < 0 ? a : find(data[a]);
	}
	bool same(int a, int b) const {
		return find(a) == find(b);
	}
	void unite(int a, int b) {
		a = find(a);
		b = find(b);
		if (a == b) return;
		if (-data[a] > -data[b]) swap(a, b);
		hist.emplace_back(b, data[b]);
		data[b] = data[a] + data[b];
		hist.emplace_back(a, data[a]);
		data[a] = b;
	}
	int size(int a) const {
		return -data[find(a)];
	}
	int get_version() const {
		return hist.size();
	}
	void rollback(int ver) {
		assert(0 <= ver && ver <= (int)hist.size());
		int cnt = hist.size() - ver;
		while (cnt--) {
			data[hist.back().first] = hist.back().second;
			hist.pop_back();
		}
	}
};

class dynamic_connectivity {
	using pii = pair<int, int>;
	const int v, n;
	vector<vector<pii>> data;
	vector<pii> q;
	int size(int x) {
		int res = 1;
		while (res < x) res <<= 1;
		return res;
	}
	void sub(int node, vector<int>& res, retroactive_uf& uuf) {
		int ver = uuf.get_version();
		for (auto& p : data[node]) uuf.unite(p.first, p.second);
		if (node >= n) {
			if (q[node - n] != pii(-1, -1)) {
				res.push_back(uuf.same(q[node - n].first, q[node - n].second));
			}
		}
		else {
			sub(node << 1, res, uuf);
			sub((node << 1) | 1, res, uuf);
		}
		uuf.rollback(ver);
	}
public:
	dynamic_connectivity(int v_, int n_) : v(v_), n(size(n_)), data(n * 2), q(n, pii(-1, -1)) {}
	void add_edge(int l, int r, int u, int val) {
		l += n, r += n;
		while (l < r) {
			if (l & 1) data[l++].emplace_back(u, val);
			if (r & 1) data[--r].emplace_back(u, val);
			l >>= 1, r >>= 1;
		}
	}
	void add_query(int p, int u, int val) {
		q[p].first = u;
		q[p].second = val;
	}
	vector<int> calc() {
		vector<int> res;
		retroactive_uf uuf(v);
		sub(1, res, uuf);
		return res;
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector<int> t(k), u(k), v(k);
	for (int i = 0; i < k; i++) {
		cin >> t[i] >> u[i] >> v[i];
	}
	map<pii, int> last;
	dynamic_connectivity dc(n, k);
	for (int i = 0; i < k; i++) {
		if (t[i] == 1) {
			last[pii(u[i], v[i])] = i;
		}
		else if (t[i] == 2) {
			dc.add_edge(last[pii(u[i], v[i])], i, u[i], v[i]);
			last.erase(pii(u[i], v[i]));
		}
		else {
			dc.add_query(i, u[i], v[i]);
		}
	}
	for (auto pp : last) {
		dc.add_edge(pp.second, k, pp.first.first, pp.first.second);
	}
	for (auto ans : dc.calc()) {
		puts(ans ? "YES" : "NO");
	}
	return 0;
}



Measured memory_bytes: 13340
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define float long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define endl '\n'
#define pii pair<int, int>
#define tii tuple<int, int, int>
#define min3(a,b,c) min(a, min(b, c))
#define max3(a,b,c) max(a, max(b, c))
#define all(x) x.begin(), x.end()
#define fill(a,b) memset(a, b, sizeof(a))
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define mex 2005
int dp[mex][mex];

signed main()
{
 
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int n; cin>>n;
    for(int i=3;i<=n;i++) dp[i][1]=i-1; 
    for(int i=0;i<3;i++) dp[i][1]=1;
    int ans=1;
	if(n<=2) ans=0;
    for(int j=2;j<=n;j++){
    	if(j*3>n) break;
    	for(int i=3*j;i<=n;i++){
    		dp[i][j]=(dp[i-3][j-1]-dp[3*(j-1)-1][j-1]+mod)%mod;
    	}
    	ans=(ans+dp[n][j])%mod;
    	for(int i=1;i<=n;i++) dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;
    }
	cout<<ans<<endl;

}

Measured memory_bytes: 21992
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int x,y,sum,i;
	scanf("%d %d",&x,&y);
	sum=x+y;
	for(i=1;i<x;i++)	{
		if((i*y)%x==0)	sum--;
	}
	printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 2748
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define rep(i,j,k) for(int i=j;i<k;i++)
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
int main(){
  LL a,b;
  cin >> a >> b;
  LL c,d;
  c = max(a,b);
  d = min(a,b);
  if((c- d) % 2 == 1){
    cout << "IMPOSSIBLE" << endl;
    return 0 ;
  }

  cout << d + ((c-d)/2) << endl;
	return 0;
}


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

int main()
{
    int X;
    cin >> X;
    int hantei = 0;

    while (1)
    {
        for (int i = 2; i <= X/2; i++)
        {
            if (X%i == 0)
            {
                X++;
                hantei = 1;
                break;
            }
        }

        if (hantei == 1)
        {
            hantei = 0;
        }

        else
        {
            break;
        }
    }
    
    cout << X;
    
}


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

int n,a;
int c[3];
long long ans;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    ans=1;
    while(n--){
        cin>>a;
        int cur=0;
        for(int i=0;i<3;i++){
            if(a==c[i]){
                cur++;
            }
        }
        ans=ans*cur%1000000007;
        for(int i=0;i<3;i++){
            if(a==c[i]){
                c[i]++;
                break;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}

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

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;

    int maxCount = 0;
    rep(i, N) {  // pos
        int count = 0;
        for (char c = 'a'; c <= 'z'; c++) {
            bool left = false, right = false;
            for (int j = 0; j < i; j++) {
                if (S.at(j) == c) left = true;
            }
            for (int j = i; j < N; j++) {
                if (S.at(j) == c) right = true;
            }
            if (left && right) count++;
        }
        maxCount = max(maxCount, count);
    }

    cout << maxCount << endl;

    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
ll rui(ll abc,ll bed){
	//aのb乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
} 
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll ans;
ll a,b,c,d,e,h,w;
 
ll x[500005],y[500005],z[500005];
char s[500005];
int main(){
    cin>>s;
	n=strlen(s);
	for(i=2;i<n-1;i++){
		if(s[i]=='C'){
			b++;			
		}
	}
	if(b==1)a++;
	if(s[0]=='A')a++;
	for(i=0;i<n;i++){
		if(s[i]>='A' && s[i]<='Z')c++;
	}
	if(c==2)a++;
	if(a==3){
		p("AC");
	}else{
		p("WA");
	}
	return 0;
}

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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new MyInputStream(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(MyInputStream cin)
        {
            WriteLine(cin.ReadIntArray(3).OrderBy(x => x).Take(2).Sum());
        }
    }

    public class MyInputStream
    {
        private readonly System.IO.TextReader _stream;
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(System.IO.TextReader s, char separator = ' ')
        {
            this.separator = separator;
            this._stream = s;
            inputStream = new Queue<string>();
        }
        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return _stream.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}



Measured memory_bytes: 11476
#include <iostream>
#include <string>

std::string S;

int main() {
    std::cin >> S;
    if ((S.find("A") == std::string::npos) or (S.find("B") == std::string::npos)) {
        std::cout << "No";
    } else {
        std::cout << "Yes";
    }
}

Measured memory_bytes: 3644
# ARC081c
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    from collections import Counter
    import heapq

    n = int(input())

    def fun(i):
        return -int(i)

    a = list(map(fun, input().split()))
    heapq.heapify(a)

    b = []
    heapq.heapify(b)
    ln = 0
    cou = 0
    mn = 0
    while(len(a) > 0):
        i = -heapq.heappop(a)
        # print(i)
        if ln != i:
            ln = i
            cou = 0
        cou += 1
        if cou > 1:
            heapq.heappush(b, -i)
            cou = 0
    try:
        print(heapq.heappop(b)*heapq.heappop(b))
    except:
        print(0)


if __name__ == '__main__':
    main()


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

int main(){
    int n;
    int a,b,c;
    
    scanf(" %d",&n);
    
    for(int i=0;i<n;i++){
        scanf(" %d %d %d",&a,&b,&c);
        if(a*a==b*b+c*c||c*c==b*b+a*a||b*b==a*a+c*c){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3148
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

ll dp[100010];

int main() {
    ll N;
    cin >> N;
    ll h[N];
    REP(i, 0, N) {
        cin >> h[i];
    }
    fill(dp, dp + 100010, inf);
    dp[0] = 0;
    REP(i, 0, N - 1) {
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
        if (i <= N - 3) {
            dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
        }
    }
    ll ans = dp[N - 1];
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i, N) cin >> a[i];

  sort(all(a), greater<int>());
  int A = 0;
  int B = 0;

  rep(i, N) {
    if (i % 2 == 0)
      A += a[i];
    else
      B += a[i];
  }
  cout << A - B << endl;
}

Measured memory_bytes: 256
n, x, y = gets.split.map(&:to_i)
d_dict = {}
i = 1
while i < n + 1 do
    d_dict[i] = 0
    i += 1
end

for i in 1..(n-1) do
    for j in (i + 1)..(n) do
        if j <= x or y <= i
            d_dict[j - i] += 1
        elsif i <= x and j <= y 
            d_dict[[j - i, x - i + y - j + 1].min] += 1
        elsif i <= x and j > y
            d_dict[x - i + j - y + 1] += 1
        elsif x < i and j < y
            d_dict[[j - i, i - x + y - j + 1].min] += 1
        elsif x < i and j >= y
            d_dict[[j - i, i - x + j - y + 1].min] += 1
        end
    end
end

for i in 1..(n - 1) do
    p d_dict[i]
end

Measured memory_bytes: 2300
#include "bits/stdc++.h"
//#include<iostream>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define fr(i , a , b) for(int  i = a ; i <= b ; i++)
#define all(v) v.begin() , v.end()
#define mod  1000000007
#define N 300005
#define mod1 1000000007
#define mod2 1000000009
#define bitcnt __builtin_popcount
#define PI acos(-1)
//#define endl "\n" 
#define mid  (s+e)/2
#define MAX 10000007
//const int inf = (int)1e18 + 10;;
int dp[102][100005] ;
int w[102] , val[102];
signed main(){
  fast;
  
  //freopen("input.txt" , "r" , stdin);
  //freopen("output.txt" , "w" , stdout);
  

    int n  , k ,  ans = 0;
    cin >> n  >> k;
    for(int i = 1 ; i <= n ; i++)
          cin >> w[i] >> val[i];

    for(int i = 0 ; i <=100000 ; i++)  dp[0][i] = mod;
    for(int i = 0 ; i <= 100 ; i++)    dp[i][0] = 0;  

     for(int i = 1 ; i<= n ; i++){
         for(int j = 0 ; j <= 100000 ; j++){
               dp[i][j] = dp[i-1][j];
               if(j - val[i] >= 0 && dp[i-1][j - val[i]] != mod){
                     if(j - val[i] == 0)
                      dp[i][j] = min(dp[i-1][j] , w[i]);
                    else
                      dp[i][j] = min(dp[i-1][j] , dp[i-1][j - val[i]] + w[i]);
               }
         }
     }

    for(int i = 1 ; i <=100000 ; i++)
        if(dp[n][i] <= k) ans = max(ans , i);
    
   cout << ans << endl;

 }

Measured memory_bytes: 79232
-- AtCoder My Practice
-- author: Leonardone @ NEETSDKASU
 
-- 解説読後
-- http://agc004.contest.atcoder.jp/data/agc/004/editorial.pdf

import qualified Data.ByteString.Char8 as C
import Data.Array (listArray, accumArray, (!))
 
main = print . solve .map red . C.words =<< C.getContents
    where
        red x = case C.readInteger x of Just v -> fst v

solve (n:x:a) = ans where
    sm = sum a
    ans = f n sm a x
    f 1 r _ _ = r
    f c r ar xx = f (c - 1) r2 ar2 (xx + x) where
        ar2 = zipWith min a $ [last ar] ++ ar
        r2 = min r (xx + sum ar2)


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

l = []
for i in range(n):
    if c[i][1] <= t:
        l.append(c[i][0])
if l == []:
    print("TLE")
else:
    print(min(l))

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

#define pi 3.1415926535
#define ll long long
#define mod 1000000007



int main() {
	ll n, k;
	ll i, j;
	ll min = 0, max = 0;
    ll min_sum=0,max_sum=0;
	ll sum = 0;
	ll st[200010] = { 0 };
	cin >> n >> k;
	for (i = 0; i < k; i++) {
		min += i;
		max += n - i;

	}
    sum += (max - min + 1);
	for (i = k + 1; i <= n + 1; i++) {
		min = min + i - 1;
		max = max + n - i + 1;
        sum += max - min + 1;
		if (sum > mod)sum %= mod;
	}
	cout << sum;
	return 0;

}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int m,n,count=0,total=0;
	cin>>m>>n;
	int a[m];
    double val;
	for(int i=0;i<m;i++)
	{
		cin>>a[i];
        total+=a[i];
	}
   
	sort(a,a+m);
    val=(1/(4*(float)n))*(float)total;
    
    for(int i=m-1;i>(m-1)-n;i--)
    {
if(a[i]>=val)
count++;
    }
    if(count==n)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    	
}

Measured memory_bytes: 256
import collections
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N = int(input())
        S = input().rstrip()

        w_cnt = 0
        e_cnt = 0
        w = collections.deque()
        e = collections.deque()
        for i in range(N):
            if S[i] == 'W':
                w_cnt += 1
            w.append(w_cnt)

            if S[-1 * (i + 1)] == 'E':
                e_cnt += 1
            e.appendleft(e_cnt)
        w.appendleft(0)
        e.append(0)
        w.pop()
        e.popleft()

        ans = N
        for _ in range(N):
            ans = min(ans, w.popleft() + e.popleft())
        print(ans)


# Run main
if __name__ == '__main__':
    AtCoder().main()


Measured memory_bytes: 52188
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll, ll>
#define PP pair<P,P>
using namespace std;

int main(){
    string s; cin >> s;
    int ans=0;
    int tmp=0;
    rep(i,s.length()){
        if(s[i] == 'A' || s[i]=='T' || s[i]=='C' || s[i]=='G') tmp++;
        else{
            ans=max(tmp,ans);
            tmp=0;
        }
    }
    if(tmp) ans=max(ans,tmp);
    cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
#include <sstream>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<ctime>
#include<cmath>
#include<map>
#include<unordered_map>
#include<stack>
#include<random>
#include<queue>
#include<list>
#include<math.h>
#include<bitset>
#include<fstream>
using namespace std;
#define ll long long int
#define ld long double
#define key pair<ld,ld>
#define ii pair<int,int>
#define si set<int>
#define vii vector<pair<int,int> >
#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define vvi vector<vector<int> >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define nu 100001
#define mul(x,y) ((ll)(x)*(y))%mod
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define forn(i, n) for (int i = 0; i < int(n); i++)
#include<fstream>
const ll INF=9223372036854775807;
const ll mod=1000000007;
int  MOD(int  a, int  b)
{
    if(a>b)
        return a-b;
    else
        return b-a;
}
ll  max3(ll  a,ll  b, ll  c)
{
    return max(c,max(a,b));
}
ll min3(ll  a,ll  b,ll  c)
{
    return min(a,min(b,c));
}
ll  power(ll  x,ll  y,ll mod1)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x)%mod1;
        y = y>>1;
        x = (x*x)%mod1;
    }
    return res;
}
ll logg(ll  a)
{
    ll  x=0;
    while(a>1)
    {
        x++;
        a/=2;
    }
    return x;
}
ll  gcd(ll  a,ll   b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
ll abso(ll x)
{
    if(x<0)
    {
        return -x;
    }
    return x;
}
ll ceiling (ll  a,ll  b)
{
    if(a%b==0)
    {
        return a/b;
    }
    else
    {
        return a/b+1;
    }
}
ll modinv(ll x,ll p)
{
    return power(x,p-2,p);
}
int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<max((ll)0,c-(a-b));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];
deque<int> q;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int i,n,k,j;
	cin >> n;
	n *= 3;
	fo(i, n) cin >> a[i];
	sort(a, a+n);
	fo(i, n) q.push_back(a[i]);
	ll ans = 0;
	while(!q.empty()){
		q.pop_back();
		q.pop_front();
		int cur = q.back();
		ans += cur;
		q.pop_back();
	}
	cout << ans << endl;

	return 0;
} 

int mpow(int base, int exp) {
	base %= mod;
	int result = 1;
	while (exp > 0) {
	if (exp & 1) result = ((ll)result * base) % mod;
	base = ((ll)base * base) % mod;
	exp >>= 1;
	}
	return result;
}

void ipgraph(int m){
	int i, u, v;
	fo(i, m){
		cin>>u>>v; 
		u++, v++;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 9728
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val x = sc.nextInt()

  println(abc160a(x))
}

private fun abc160a(x: Int): Int {
  var ans = 0

  val v500 = x / 500
  val v5 = (x - 500 * v500) / 5

  ans += v500 * 1000
  ans += v5 * 5

  return ans
}


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

using namespace std;

#define first ff
#define second ss

const int INF = 1e9 + 7;

int main() {
#ifdef LOCAL
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#else
    // freopen("levenshtein.in", "r", stdin);
    // freopen("levenshtein.out", "w", stdout);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

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

    int ans = INF;

    for (int i = 0; i <= 100; i++) {
        int sum = 0;
        for (int y : x) {
            sum += (i - y) * (i - y);
        }
        ans = min(ans, sum);
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
/*
 * c.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

typedef vector<int> vi;

struct Node {
  int key;
  struct Node *p, *l, *r;
  Node(): p(NULL), l(NULL), r(NULL) {}
  Node(int _k): key(_k), p(NULL), l(NULL), r(NULL) {}
};

/* global variables */

/* subroutines */

void insert(Node *(&root), Node *z) {
  Node *y = NULL, *x = root;

  while (x != NULL) {
    y = x;
    if (z->key < x->key) x = x->l;
    else x = x->r;
  }
  z->p = y;
  
  if (y == NULL) root = z;
  else if (z->key < y->key) y->l = z;
  else y->r = z;
}

Node *find(Node *root, int key) {
  Node *x = root;

  while (x != NULL) {
    if (key == x->key) return x;
    x = (key < x->key) ? x->l : x->r;
  }
  return NULL;
}

void del_rec(Node *z) {
  int cn = 0;
  if (z->l != NULL) cn |= 1;
  if (z->r != NULL) cn |= 2;
  
  if (cn == 0) {
    Node *p = z->p;
    if (p != NULL) {
      if (p->l == z) p->l = NULL;
      else p->r = NULL;
    }
  }
  else if (cn < 3) {
    Node *p = z->p, *c = (cn == 1) ? z->l : z->r;
    if (p != NULL) {
      if (p->l == z) p->l = c;
      else p->r = c;
    }
    c->p = p;
  }
  else {
    Node *y = z->r;
    while (y->l != NULL) y = y->l;
    z->key = y->key;
    del_rec(y);
  }
}

void do_delete(Node *root, int key) {
  Node *z = find(root, key);
  if (z != NULL) del_rec(z);
}

void inorder(Node *nd, vi &v) {
  if (nd != NULL) {
    inorder(nd->l, v);
    v.push_back(nd->key);
    inorder(nd->r, v);
  }
}

void preorder(Node *nd, vi &v) {
  if (nd != NULL) {
    v.push_back(nd->key);
    preorder(nd->l, v);
    preorder(nd->r, v);
  }
}

void print_vec(vi &v) {
  for (int i = 0; i < v.size(); i++) printf(" %d", v[i]);
  putchar('\n');
}

/* main */

int main() {
  Node *root = NULL;

  int m;
  cin >> m;

  while (m--) {
    string op;
    cin >> op;

    if (op[0] == 'i') {
      int key;
      cin >> key;
      insert(root, new Node(key));
    }
    else if (op[0] == 'f') {
      int key;
      cin >> key;
      cout << (find(root, key) != NULL ? "yes" : "no") << endl;
    }
    else if (op[0] == 'd') {
      int key;
      cin >> key;
      do_delete(root, key);
    }
    else {
      vi v;

      v.clear();
      inorder(root, v);
      print_vec(v);

      v.clear();
      preorder(root, v);
      print_vec(v);
    }
  }
  return 0;
}

Measured memory_bytes: 21892
# ABC165d


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    def dump(*args):
        sys.stderr.write(str(args))

    n, m, q = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(q)]

    b = []

    def create():
        if len(b) >= n:
            t = eval()
            return t
        an = 0
        s = b[-1] if len(b) > 0 else 1
        for j in range(s, m + 1):
            b.append(j)
            an = max(an, create())
            b.pop()
        return an

    def eval():
        ans = 0

        for l in a:
            if b[l[1]-1] - b[l[0]-1] == l[2]:
                ans += l[3]
        #print(b, ans)
        return ans

    print(create())


if __name__ == '__main__':
    main()


Measured memory_bytes: 9216