akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int d;
    cin>>d;
    vector<int> c(26);
    for(int i=0;i<26;i++){
        cin>>c[i];
    }
    vector<vector<int>> s(d,vector<int>(26));
    for(int i=0;i<d;i++){
        for(int j=0;j<26;j++){
            cin>>s[i][j];
        }
    }
    int ans=-2000000000;
    vector<int> cnt(d,0);
    auto score=[&](vector<int>& v){
        int res=0;
        vector<int> last(26,0);
        for(int ii=1;ii<=d;ii++){
            res+=s[ii-1][v[ii-1]];
            last[v[ii-1]]=ii;
            for(int jj=0;jj<26;jj++){
                res-=c[jj]*(ii-last[jj]);
            }
        }
        if(res>ans){
            cnt=v;
            ans=res;
        }
    };
    random_device rnd;
    vector<int> days(d);
    for(int i=0;i<1000;i++){
        for(int j=0;j<d;j++){
            days[j]=rnd()%26;
        }
        score(days);
    }
    for(int i=0;i<d;i++)cout<<cnt[i]+1<<"\n";
    //cout<<ans<<endl;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
#define LL long int

int main(){
    int n;
    cin >> n;
    int ans = 0;

    int b;
    cin >> b;
    ans += b;

    for(int i = 0; i < n - 2; ++i){
        int bb;
        cin >> bb;
        ans += min(b,bb);
        b = bb;
    }

    ans += b;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int ans;
		if(C<=A+B){
			ans=C+B;
		}else{
			int p=C-B-A;
			ans=C+B-p+1;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 22100
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <sstream>
#define INF 0x3f3f3f3f
using namespace std;

typedef long long ll;
const int mod = 1e9 + 7;
const ll maxn = 1000005;
const double pi = acos(-1.0);

char s[10];

int main()
{
    int vis[30];
    memset(vis,0,sizeof(vis));
    for(int i = 0; i < 4; i ++)
    {
        cin >> s[i];
        vis[s[i] - 65] ++;
    }
    int num = 0;
    for(int i = 0; i < 26; i ++)
    {
        if(vis[i] != 0)
            num ++;
    }
    if(num == 2)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
def prm(n)
	a = Array.new(n, true)
	a[0] = false
	(2..n**(0.50)).each{|i|
		if a[i-1] then
			(2..(n/i)).each {|j|
				a[i*j-1] = false
			}
		end
	}
	p a.count(true)
end

while line = gets do
	prm(line.to_i)
end

Measured memory_bytes: 63564
s = str(input())
K = int(input())

s2 = ''.join(sorted(set(list(s))))

l = []

for i in range(len(s2)):
  if len(set(l)) >= K:
    #print(i)
    break
  else:
    for j in range(len(s)):
      if s2[i] == s[j]:
        for k in range(j+1, len(s)+1):
          if k-j > K:
            break
          else:
            l.append(s[j:k])
l = list(set(l))
l.sort()
#print(l)
print(l[K-1])

Measured memory_bytes: 40048
import Control.Monad.State

type Stack a = [a]

main = do
  expr <- getLine
  print $ reversePolish expr

pop :: State (Stack a) a
pop = do
  stack <- get
  put (tail stack)
  return $ head stack

push :: a -> State (Stack a) ()
push x = modify (x:)

reversePolish :: String -> Int
reversePolish exp = evalState (rp' (words exp)) []

rp' = foldr (>>) pop.map (\x -> if x `elem` ["*","+","-"] then op x else push (read x))

op "+" = calc (+)
op "-" = calc (-)
op "*" = calc (*)

calc f = do
  a <- pop
  b <- pop
  push $ b `f` a

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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;
}

struct Edge {
	ll to, rev;
    long double cap;
	Edge(ll _to, long double _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, long double cap, bool revFlag, long double revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


void solve(){
	ll n;
	cin>>n;
	Array a(n);
	REP(i,n) cin>>a[i];
	ll max_a=1010101;
	Array con(max_a,0);
	REP(i,n) con[a[i]]++;
	
	for(int i=1;i<n;i++){
		if(con[a[i]]==0) continue;
		for(ll j=2;a[i]*j<max_a;j++){
			con[a[i]*j]=0;
		}
		if(con[a[i]]>1) con[a[i]] = 0;
	}
	int ans=0;
	REP(i,max_a){
		if(con[i]) ans++;
	}
	cout<<ans<<en;
}

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

	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 12680
/* the logic is pretty simple 
 we are following a simple series in this ques
 n -> 2*floor(n/2) -> 4*floor(n/4) -> 8*floor(n/4).....
 
 the ans=biggest power of 2 which doesnt exceed n;
 */



#include<bits/stdc++.h>
using namespace std;
using ll =long long int ;
int main()
{
  ll n;
  cin>>n;
  
  ll ans=1;
  while(2*ans<=n)
  {
    ans*=2;
  }
  cout<<2*ans-1<<endl;
}


Measured memory_bytes: 3588
fun main() {
  val N = readInt()
  println(N * N * N)
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 34340
#include<iostream>
#include<algorithm>
#include <string>
#include <cstring>
#include<climits>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef long long ll;
vector<pair<int,int>> a[51];
ll d[51];
ll E[51];
vector<int> v2;
bool go(int x, int y, int p) {
	if (x == y) {
		return true;
	}
	for (auto next : a[x]) {
		if (next.first == p)continue;
		if (go(next.first, y, x)) {
			v2.push_back(next.second);
			return true;
		}
	}
	return false;
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0); cout.tie(NULL);	
	int n; cin >> n;
	d[0] = 1;
	d[1] = 2;
	for (int i = 2; i <= 50; i++) {
		d[i] = d[i - 1] * (ll)2;
	}
	for (int i = 0; i < n - 1; i++) {
		int x, y; cin >> x >> y;
		a[x].push_back({ y,i });
		a[y].push_back({ x,i });
	}

	int m; cin >> m;
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		v2.clear();
		go(x, y, -1);
		for (int next : v2) {
			E[i] |= (ll)((ll)1 << next);
		}
	}

	ll ans = d[n - 1];

	for (int i = 1; i < (1 << m); i++) {
		vector<int> tmp;
		for (int j = 0; j < m; j++) {
			if (i & (1 << j)) {
				tmp.push_back(j);
			}
		}
		ll cnt = 0;
		ll sum = 0;
		for (int j = 0; j < tmp.size(); j++) {
			sum |= (ll)E[tmp[j]];
		}

		for (int j = 0; j < n - 1; j++) {
			if (!(sum & (ll)((ll)1 << j))) {
				cnt += 1;
			}
		}

		if (tmp.size() & 1) {
			ans -= d[cnt];
		}
		else {
			ans += d[cnt];
		}
	}

	cout << ans << '\n';

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    long ans = 0;
    for(int i = 1;i <= a;i++){
      if(!(i % 3 == 0 || i % 5 == 0)){
        ans += i;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 35788
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD=1000000007;

int main() {
    string S; cin>>S;
    int count=0;
    for(int i=1;i<S.size();i++){
        if(S[i]!=S[i-1])count++;
    }
    cout<<count;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
//#include <bits/stdc++.h>

using namespace std;

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

    vector<long> values(n+1);
    vector<long> weights(n+1);

    for (int i = 1; i <= n; i++) {
      cin >> weights[i];
      cin >> values[i];
    }

    vector<vector<long> > knapsack(2, vector<long>(W+1, 0));
    int r = 0;
    
    for (int i = 1; i <= n; i++) {
      for (int w = 1; w <= W; w++) {
        if (w >= weights[i]) {
          knapsack[r][w] = knapsack[1-r][w-weights[i]] + values[i];
        }
        knapsack[r][w] = max(knapsack[r][w], knapsack[1-r][w]);
      }
      r = 1 - r;
    }
    cout << knapsack[1-r][W] << endl;
    return 0;
}



Measured memory_bytes: 2560
n = int(input())
fct = [1]*(n+7)
for i in range(2,int(n**(1/2))+7):
    if fct[i]:
        for j in range(2*i,n+1,i):
            fct[j]=0
fct2 = {i:1 for i in range(2,n+1) if fct[i]}
fct3 = [i for i in range(2,n+1) if fct[i]]
for i in range(2,n+1):
    for j in fct3:
        i2 = i
        while i2%j==0:
            fct2[j]+=1
            i2//=j
mod = 10**9+7
ans = 1 
for i in fct2:
    ans*=fct2[i]
    ans%=mod
            
print(ans)



Measured memory_bytes: 3064
using System;
class Program
{
	static void Main(string[] args)
	{
		// 整数の入力
		string l1 = Console.ReadLine();
		string l2 = Console.ReadLine();
		
		int count = 0;
		
		for(int i=0;i<l1.Length;i++){
	    if(l1[i] != l2[i]){
	            count++;
		    }
		}
		
		Console.WriteLine(count);
	}
}

Measured memory_bytes: 27524
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char a[100],b[100];
int main(){
    while(~scanf("%s%s",a,b)){
        int alen=strlen(a);
        int blen=strlen(b);
        if(alen==blen){
            for(int i=0;i<alen;i++){
                printf("%c%c",a[i],b[i]);
            }
            printf("\n");
        }
        if(alen>blen){
            for(int i=0;i<blen;i++){
                printf("%c%c",a[i],b[i]);
            }
            printf("%c\n",a[alen-1]);
        }
        if(alen<blen){
            for(int i=0;i<alen;i++){
                printf("%c%c",a[i],b[i]);
            }
            printf("%c\n",b[blen-1]);
        }
    }
    return 0;
}


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

using namespace std;

int compute(string t) {
    int count = 0;
    for (int i = 1; i < (int)t.size(); ++i) {
        if (t[i] == t[i-1]) {
            ++count;
            ++i;
        }
    }
    return count;
}

bool all_same(string t) {
    for (int i = 1; i < (int)t.size(); ++i) {
        if (t[i] != t[i-1]) {
            return false;
        }
    }
    return true;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    long long k;
    cin >> s >> k;
    if (all_same(s)) {
        cout << (k * s.size())/2 << endl;
    } else {
        long long b = compute(s);
        long long a = compute(s+s)-b;
        cout << a*(k-1) + b << endl;
    }
    return 0;
}


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

int main(void) {
	int n, ans = 0;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	while (1) {
		for (int i = 0; i < n; i++) {
			if (a[i] % 2 == 0) a[i] = a[i] / 2;
			else if (a[i] == 0) {
				cout << ans << endl;
				return 0;
			}
			else {
				cout << ans << endl;
				return 0;
			}
		}
		ans++;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define nl printf("\n")
#define YES printf("YES\n")
#define Yes printf("Yes\n")
#define yes printf("yes\n")
#define NO printf("NO\n")
#define No printf("No\n")
#define no printf("no\n")
using namespace std;
int main(){
    int n,k;scn(n),scn(k);
    int h[n+1],dp[n+1];
    for(int i=1;i<=n;i++) scn(h[i]);
    dp[n]=0;
    dp[n-1]=abs(h[n-1]-h[n]);
    for(int i=n-2;i>0;i--){
        dp[i]=1e9;
        for(int j=i+1;j<=i+k&&j<=n;j++)
        dp[i]=min(dp[j]+abs(h[j]-h[i]),dp[i]);
    }
    printf("%d\n",dp[1]);
}

Measured memory_bytes: 4572
/*
#include<rabbit>;
using blueHulkStress;
using AceOfSpades;
*/
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = (1e-9);
typedef long long ll;
typedef unsigned long long ull;
#define flush fflush(stdout), cout.flush()
#define all(v) ((v).begin()),((v).end())
#define rall(v) ((v).rbegin()),((v).rend())
#define clr(v,line) memset(v,line,sizeof(v))
#define rep(i,n) for(int(i)=0;(i)<(int)(n);(i)++)
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lcm(a,b) (a*(b/__gcd(a,b)))
#define P 1000000007
#define endl '\n'
const int dx[] = {1,-1,0,0,1,-1,1,-1};
const int dy[] = {0,0,1,-1,1,-1,-1,1};
const int dxhorse[] = {-2,-2,-1,-1,1,1,2,2};
const int dyhorse[] = {1,-1,2,-2,2,-2,1,-1};


int main(int argc, char const *argv[])
{

	string a,b,c;cin>>a>>b>>c;
	reverse(all(a));
	reverse(all(b));
	reverse(all(c));
	char nxt = 'a';
	while(1)
	{
		if (nxt == 'a')
		{
			if(a.empty())return cout<<"A",0;
			nxt = a.back();
			a.pop_back();
		}
		if (nxt == 'b')
		{
			if(b.empty())return cout<<"B",0;
			nxt = b.back(), b.pop_back();
		}
		if (nxt == 'c')
		{
			if(c.empty())return cout<<"C",0;
			nxt = c.back(), c.pop_back();
		}
	}
}	

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 650

void calc(int m){
  int n;
  int d[SIZE];
  
  scanf("%d",&n);

  d[0] = 0;
  d[n+1] = 0;
  for(int i=1;i<=n;i++){
    scanf("%d",d+i);
  }

  queue<int> q;
  q.push(0);
  bool can_visit[SIZE] = {};
  can_visit[0] = true;

  
  while(q.size()){
    bool flag = false;
    int st = q.front();
    int visited[SIZE] = {};
    q.pop();
    
    queue<int> q2;
    q2.push(st);

    while(q2.size()){
      int now = q2.front();
      q2.pop();

      if(visited[now]) continue;

      if(now == n+1){
        flag = true;
      }

      visited[now] = true;

      if(can_visit[now] == false){
        can_visit[now] = true;
        q.push(now);
      }

      for(int i=1;i<=m;i++){
        int next = min(n+1,now+i);

        if(d[next] < 0){
          next = max(0,next + d[next]);
        }else{
          next = min(n+1,next + d[next]);
        }
        
        q2.push(next);
      }
    }

    if(flag == false){
      puts("NG");
      return;
    }
  }

  puts("OK");
}
  

int main(){
  int m;

  while(scanf("%d",&m)!=EOF){
    if(m==0) break;
    calc(m);
  }
  
  return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const int N=2e5+10;
int a[N];
int b[N];
char s[N];
char t[N];
ll pre[N];
int cmp1(int a,int b)
{
    return b<a;
}
multiset<int> ss;
map<int,int>mp;
int main()
{

    int n,m,k;
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=m;i++) cin>>b[i];
    pre[0]=0;
    a[0]=0;
    for(int i=1;i<=m;i++) pre[i]=pre[i-1]+b[i];
    ll sum=0;
    int ans=0;
    for(int i=0;i<=n;i++){
        sum+=a[i];
        if(sum>k) break;
        ll s=k-sum;
        int pos=upper_bound(pre+1,pre+1+m,s)-pre-1;
        //cout<<pos<<endl;
        ans=max(ans,i+pos);

    }




    cout<<ans<<endl;
}


Measured memory_bytes: 6736
#include<iostream>
using namespace std;
int main(){
  int day[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  int m,d;
  int ans=0;
  while(cin>>m>>d){
    if(m==0&&d==0) break;
    ans = 0;
    for(int i=0;i<m-1;i++) ans += day[i];
    ans += d;
    switch(ans%7){
    case 0:
    cout << "Wednesday" << endl;
    break;
    case 1:
    cout << "Thursday" << endl;
    break;
    case 2:
    cout << "Friday" << endl;
    break;
    case 3:
    cout << "Saturday" << endl;
    break;
    case 4:
    cout << "Sunday" << endl;
    break;
    case 5:
    cout << "Monday" << endl;
    break;
    case 6:
    cout << "Tuesday" << endl;
    break;
    }
  }
  return 0;
}

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

typedef long long int ll;
const int MAX_N = 2000;
const ll MOD = 1000000007;

ll cnt[MAX_N + 1][MAX_N + 1];
ll frac[MAX_N * 4 + 1], inv[MAX_N * 4 + 1];

ll power(ll a, ll n) {
    ll ans = 1;
    while (n > 0) {
        if (n % 2 == 1)
            ans = ans * a % MOD;
        a = a * a % MOD;
        n /= 2;
    }
    return ans;
}
inline ll binom(int a, int b) {
    return frac[a + b] * inv[a] % MOD * inv[b] % MOD;
}

int main() {
    frac[0] = inv[0] = 1;
    for (int i = 1; i <= 4 * MAX_N; i++)
        frac[i] = frac[i - 1] * i % MOD, inv[i] = inv[i - 1] * power(i, MOD - 2) % MOD;
    for (int i = 0; i <= MAX_N; i++)
        for (int j = 0; j <= MAX_N; j++)
            cnt[i][j] = 0;

    ll ans = 0;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        ans = (ans - binom(2 * a, 2 * b) + MOD) % MOD;
        cnt[a][b]++;
    }
    for (int i = MAX_N; i > 0; i--)
        for (int j = MAX_N; j > 0; j--) {
            ll tmp = binom(2 * i, 2 * j) - (binom(2 * (i - 1), 2 * j) + 2 * binom(2 * i - 1, 2 * j - 1) + binom(2 * i, 2 * (j - 1))) % MOD;
            tmp = (tmp + MOD) % MOD;
            ans = (ans + tmp * cnt[i][j] % MOD * cnt[i][j]) % MOD;
            cnt[i - 1][j] = (cnt[i - 1][j] + cnt[i][j]) % MOD;
            cnt[i][j - 1] = (cnt[i][j - 1] + cnt[i][j]) % MOD;
        }
    ll mycnt = 0;
    for (int i = 1; i <= MAX_N; i++)
        mycnt = (mycnt + cnt[i][0]) % MOD;
    ans = (ans + mycnt * mycnt) % MOD;
    mycnt = 0;
    for (int j = 1; j <= MAX_N; j++)
        mycnt = (mycnt + cnt[0][j]) % MOD;
    ans = (ans + mycnt * mycnt) % MOD;
    for (int i = 1; i <= MAX_N; i++)
        for (int j = 1; j <= MAX_N; j++)
            ans = (ans + cnt[i][0] * cnt[0][j] % MOD * binom(i, j) % MOD * 2) % MOD;
    ans = ans * power(2, MOD - 2) % MOD;
    cout << ans << "\n";
}


Measured memory_bytes: 31616
#include<stdio.h>
#include<stdlib.h>
typedef struct node
{
	int value;
    struct node* prev,* next;
}Node;
Node* head;
void Init()
{
    head=(Node*)malloc(sizeof(Node));
    head->next=head;
    head->prev=head;
}

Node* FindNode(int x)
{
	Node*temp=head->next;
	while(temp!=head&&temp->value!=x)
        temp=temp->next;
    return temp;
}
void Insert(int x)
{
	Node*temp=(Node*)malloc(sizeof(Node));
    temp->value=x;
    head->next->prev=temp;
    temp->next=head->next;
    head->next=temp;
    temp->prev=head;
}

void Delete(Node*temp)
{
	if(temp==head)
        return ;
	temp->next->prev=temp->prev;
	temp->prev->next=temp->next;
    free(temp);
}

void DeleteFirst()
{
    Delete(head->next);
}
void DeleteLast()
{
	Delete(head->prev);
}
void DeleteValue(int x)
{
    Delete(FindNode(x));
}
void PrintList()
{
    Node*temp=head->next;
    int flag=0;
    while(1)
    {
        if(temp==head)
            break;
        else
        {
            if(flag++>0)
                printf(" ");
            printf("%d",temp->value);
            temp=temp->next;
        }
    }
    printf("\n");
}
int main()
{
	int n;
	int i;
	scanf("%d",&n);
	char str[12];
	int x;
	Init();
    /*
	while(n--)
	{
		scanf("%s%d",str,&x);
		if(str[0]=='i'){Insert(x);}
		else if(str[0]=='d'&&str[6]=='F')DeleteFirst();
		else if(str[0]=='d'&&str[6]=='L')DeleteLast();
		else if(str[0]=='d'){Delete(FindNode(x));}
	}
    */

	for(i = 0; i < n; i++) {
        scanf("%s %d", str, &x);
        if (str[0] == 'i') {
            Insert(x);
        }
        else if(str[0] == 'd') {
            if(str[6] == 'F')
                DeleteFirst();
            else if(str[6] == 'L')
                DeleteLast();
            else
                DeleteValue(x);
        }
    }
    /*
    Node* temp=head->next;
    while(temp->next!=head)
    {
        printf("%d ",temp->value);
        temp=temp->next;
    }
    printf("%d\n",temp->value);
    */
    PrintList();
	return 0;
}

Measured memory_bytes: 33948
#include <iostream>
#define ll long long
using namespace std;

ll mod=1000000007, g[55][55], h[55][55];

void mult(int n, ll a[55][55], ll b[55][55]){
	ll c[55][55];
	for(int i=0; i<n; ++i){
		for(int j=0; j<n; ++j){
			c[i][j]=0;
			for(int k=0; k<n; ++k){
				c[i][j]=(c[i][j]+(a[i][k]*b[k][j])%mod)%mod;
			}
		}
	}
	for(int i=0; i<n; ++i){
		for(int j=0; j<n; ++j){
			b[i][j]=c[i][j];
		}
	}
}

int main() {
	int N;
	ll K;
	cin >> N >> K;
	for(int i=0; i<N; ++i){
		for(int j=0; j<N; ++j){
			cin >> g[i][j];
		}
	}
	for(int i=0; i<N; ++i) h[i][i]=1;
	while(K>0){
		if(K&1){
			mult(N, g, h);
		}
		mult(N, g, g);
		K >>= 1;
	}
	ll ans=0;
	for(int i=0; i<N; ++i){
		for(int j=0; j<N; ++j){
			ans=(ans+h[i][j])%mod;
		}
	}
	cout << ans << endl;
	return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll a,b,c;
  cin >> a >> b >> c;

  ll ans;
  if(a%2==0 || b%2==0 || c%2==0)
    ans = 0;
  else
    ans = min(a*b, min(b*c, c*a));

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF INT_MIN 
#define INF INT_MAX 
#define int ll int
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/
//int modInverse(int a, int m) {return power(a, m-2);} //gcd(a,m)=1 
//int root(int x){return x==f[x]?x:f[x]=root(f[x]);}


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{
   string s,s1="",s2="";
   cin>>s;
   int q;
   cin>>q;
   int flag=0;
   for(int i=0;i<q;i++)
   {   int x;
       cin>>x;
       if(x==1)flag^=1;//string temp=s1;s1=s2;s2=temp;}
       else
       {
           int a;cin>>a;
           char ch;cin>>ch;
           if((flag==0&&a==1)||(flag==1&&a==2))s1=ch+s1;
           else s2=s2+ch;
       }
   }
   s=s1+s+s2;
   if(flag==1)reverse(all(s));
   
   
   cout<<s<<endl;
}


return 0;
}





Measured memory_bytes: 1320
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = list(map(int, sys.stdin.readline().split()))
A, B = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(N)]))

A = np.array(A, dtype=int)
B = np.array(B, dtype=int)

ans = B[np.bitwise_or(A, K) == K].sum()
for i in range(1, K.bit_length() + 1):
    if K >> i & 1:
        k = (K - (1 << i)) | ((1 << i) - 1)
        # print(np.binary_repr(K, 10))
        # print(np.binary_repr(k, 10))
        ans = max(ans, B[np.bitwise_or(A, k) == k].sum())
print(ans)


Measured memory_bytes: 69824
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> T gcd(T a, T b){return !b?a:gcd(b,a%b);}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 5050;
int n,mo,xs[N],dp[N];
inline void add(int &x, int y){x=x+y<mo?x+y:x+y-mo;}
int main() {
	read(n);read(mo);
	rep(i,1,n/2+1)rep(j,1,i)xs[j]--;
	rep(i,n-n/2+1,n)rep(j,1,i)xs[j]++;
	rep(i,2,n)xs[i]++;
	rep(i,2,n)assert(xs[i]>=0);
	dp[0]=1;
	rep(t,2,n){
		int p=t&1,q=p^1;//q-->p
		rep(i,0,n-xs[t])add(dp[i+xs[t]],dp[i]);
	}
	int res=0;rep(i,0,n)res=(res+1ll*dp[i]*(n-i))%mo;cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 256
#ifdef LOCAL
    #define _GLIBCXX_DEBUG
    #define __clock__
#else
    #pragma GCC optimize("Ofast")
#endif
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;
using PII = pair<ll, ll>;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())
#define MP make_pair

const ll mod = 1e9 + 7;
const ll inf = 1e18;
const double PI = acos(-1);

// a^b mod p
ll mod_pow(ll a, ll b){
    if(b==0) return 1;
 
    // 肩が奇数
    if(b%2==1){
        return a * mod_pow(a, b-1) % mod;
    }
    else{
        return mod_pow(a*a % mod, b/2) % mod;
    }
}

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

    // input
    ll N; 
    cin >> N;

    VI factorial(N+5, 0);
    factorial[0] = 1;
    factorial[1] = 1;
    FOR(i, 2, N+5){
      factorial[i] = factorial[i-1] * i % mod;
    }

    VI A(N);
    rep(i, N){
      cin >> A[i];
    }

    VI D;
    rep(i, N-1){
      ll d = A[i+1] - A[i];
      D.push_back(d);
    }

    ll sum = 0;
    ll F = factorial[N-1];
    ll a = 0;
    rep(i, N-1){

      // a += F/(i+1); // 割れない (modとってるから)
      a += F * mod_pow(i+1, mod-2); // 割る代わりに逆元
      
      a %= mod;
      sum += D[i] * a % mod;
      sum %= mod;
    }
    p(sum);

    return 0;
}

Measured memory_bytes: 2936
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str="CODEFESTIVAL2016";
    char[] ch=sc.next().toCharArray(),sch=str.toCharArray();
    int f=0;
    for(int i=0;i<ch.length;i++){
      if(ch[i]!=sch[i]){
        f++;
      }
    }
    System.out.println(f);
  }
}

Measured memory_bytes: 21844
N = int(input())
A = [int(input()) for i in range(N)]


sorted_A = list(reversed(sorted(A)))

maxiuam = sorted_A[0]

is_there_tow_maximum = A.count(maxiuam) >= 2
if is_there_tow_maximum:
    answer = (str(maxiuam) + "\n") * N
    print(answer)
    exit()

second = None
for Ai in sorted_A:
    if Ai < maxiuam:
        second = Ai
        break

answer = []
for Ai in A:
    if Ai == maxiuam:
        answer.append(second)
    else:
        answer.append(maxiuam)
answer = "\n".join(map(str, answer))

print(answer)


Measured memory_bytes: 28064
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int k=in.nextInt();
        in.nextLine();
        String s=in.nextLine();
        if(s.length()<=k){
            System.out.println(s);
        }else{
            char ch[]=s.toCharArray();
            for (int i = 0; i < k; i++) {
                System.out.print(ch[i]);
            }
            System.out.println("...");
        }
    }
}

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

using F = double;

#define x first
#define y second
using Point = pair<F, F>;

#define from first
#define to second
using Segment = pair<Point, Point>;

const F INF = 1e6;
const F EPS = 1e-6;

int M, N;
vector<Point> S, P;

vector<Point> rotate(auto point, auto a) {
  for(auto& p: point) p = make_pair(p.x * cos(a) - p.y * sin(a), p.x * sin(a) + p.y * cos(a));
  return point;
}

F norm(auto p) {return p.x * p.x + p.y * p.y;}
F dot(auto a, auto b) {return a.x * b.x + a.y * b.y;}
F cross(auto a, auto b) {return a.x * b.y - a.y * b.x;}
int ccw(auto a, auto b, auto c) {
  b = Point(b.x - a.x, b.y - a.y);
  c = Point(c.x - a.x, c.y - a.y);
  if(cross(b, c) > 0) return 1;
  if(cross(b, c) < 0) return -1;
  if(dot(b, c) < 0) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}
bool intersect(auto s, auto t) {
  return    ccw(s.from, s.to, t.from) * ccw(s.from, s.to, t.to) <= 0
         && ccw(t.from, t.to, s.from) * ccw(t.from, t.to, s.to) <= 0;
}

vector<Segment> uyenimo(auto v) {
  vector<Segment> res;
  for(auto s: v) {
    if(res.empty()) {
      res.emplace_back(s);
    } else {
      if(res.back() == s) res.pop_back();
      else                res.emplace_back(s);
    }
  }
  return res;
}

vector<Segment> shrink() {
  vector<Segment> scratch(P.size());
  for(auto p: P) for(auto dy: {-INF, INF}) scratch.emplace_back(p, Point(p.x, p.y + dy));

  sort(begin(scratch), end(scratch));

  vector<Segment> res;
  for(auto i = 1; i < S.size(); ++i) {
    Segment s(S[i-1], S[i]);
    vector<Segment> add;
    for(auto t: scratch) if(intersect(s, t)) add.emplace_back(t);
    if(s.to.x < s.from.x) reverse(begin(add), end(add));
    res.insert(end(res), begin(add), end(add));
  }

  while(true) {
    auto pre = res.size();
    res = uyenimo(res);
    if(pre == res.size()) break;
  }

  return res;
}

F solve() {
  S = rotate(S, EPS);
  P = rotate(P, EPS);

  auto order = shrink();

  order.insert(begin(order), Segment(S.front(), Point(0, 0)));
  order.emplace_back(S.back(), Point(0, 0));
  vector<F> dp(order.size(), INF);
  dp[0] = 0;
  for(auto i = 0; i < order.size(); ++i) {
    for(auto j = i + 1; j < order.size(); ++j) {
      Segment nex(order[i].from, order[j].from);
      auto ok = true;
      for(auto k = i + 1; ok && k < j; ++k) {
        if(!intersect(nex, order[k])) ok = false;
        if(order[k].from.x == order[k+1].from.x) ok = false;
      }
      if(ok) dp[j] = min(dp[j], dp[i] + hypot(nex.from.x - nex.to.x, nex.from.y - nex.to.y));
    }
  }

  return dp.back();
}

int main() {
  while(cin >> M >> N, M | N) {
    S = vector<Point>(M);
    for(auto& i: S) cin >> i.x >> i.y;
    P = vector<Point>(N);
    for(auto& i: P) cin >> i.x >> i.y;

    cout << setprecision(10) << fixed << solve() << endl;
  }
}

Measured memory_bytes: 3704
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

H,W = map(int,input().split())
C = [[] for i in range(H)]
for i in range(H):
    C[i] = [str(i) for i in input().split()]

for i in range(H):
    c = C[i]
    print("".join(c))
    print("".join(c))


Measured memory_bytes: 5580
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using namespace std;
int main() {
    int n, x;
    cin >> n >> x;
    int l[n+10];
    rep(i, n){
        cin >> l[i];
    }
    int d[n+10];
    int cnt = 1;
    d[0] = 0;
    for (int i = 1; i < n+1; i++){
        d[i] = d[i-1] + l[i-1];
        if(d[i] <= x) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
fn lower_bound<T: std::cmp::Ord>(arr: &Vec<T>, b: T) -> usize {
    let (mut lt, mut ge) = (0, arr.len());
    // lt=-1にすると型強制しなきゃなのでここで確かめる
    if arr[lt] >= b {
        return 0;
    }
    while lt + 1 < ge {
        let m = (lt + ge) / 2;
        if arr[m] < b {
            lt = m;
        } else if arr[m] >= b {
            ge = m;
        }
    }
    ge
}
struct BIT<T> {
    table: Vec<T>,
}
impl<T: std::default::Default + Clone + Copy + std::ops::AddAssign> BIT<T> {
    fn new(n: usize) -> BIT<T> {
        BIT {
            table: vec![T::default(); n + 1],
        }
    }
    // 1..i番目の要素までの和を求める
    fn sum(&self, mut i: i64) -> T {
        let mut sum: T = T::default();
        while i != 0 {
            sum += self.table[i as usize];
            i -= i & -i;
        }
        sum
    }

    fn add(&mut self, mut i: i64, x: T) {
        while (i as usize) < self.table.len() {
            self.table[i as usize] += x;
            i += i & -i;
        }
    }
}

fn main() {
    let n: usize = read();
    let mut bit = BIT::<usize>::new(n);
    let mut ans = 0;

    let a: Vec<usize> = (0..n).map(|_| read::<usize>()).collect();
    let mut sorted_a = a.clone();
    sorted_a.sort();

    for i in 0..n {
        let v: i64 = lower_bound(&sorted_a, a[i]) as i64 + 1;
        ans += i - bit.sum(v);
        bit.add(v, 1);
    }
    println!("{}", ans);
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========



Measured memory_bytes: 11064
#include<bits/stdc++.h>
using namespace std;
int m=1e9+7;
int fun(int a,int b)
{
    if(a==0)
        return b;
    return fun(b%a,a);
}
int gcd(int a,int b,int c)
{
    int result=fun(a,fun(b,c));
    return result;
}
int main()
{

   int  n;
   cin>>n;
   long sum=0;
   for(int i=1;i<=n;i++)
   {
       for(int j=1;j<=n;j++)
       {
           for(int k=1;k<=n;k++)
           {
               sum+=gcd(i,j,k);
               sum=sum%m;
           }
       }
   }
    cout<<sum;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef vector< pii > vii;
 
#define ll          long long
#define ff          first
#define ss          second
#define pb          push_back
#define mkp         make_pair
#define sz          size()
 
#define forf(a,b,c)    for(int i=a;i<=b;i+=c)
#define forr(a,b,c)    for(int i=a;i>=b;i-=c)
#define all(a)      a.begin(),a.end()
#define mem(a,b)    memset(a,b,sizeof(a))
#define pi          2*acos(0.0)
#define End         return 0;
#define nl endl
 
#define scan1(a)    scanf("%d",&a)
#define scan2(a,b)  scanf("%d %d",&a,&b)
#define scan3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define scanl(a)    scanf("%lld",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
 
#define print1(a)    printf("%d",a)
#define print2(a,b)  printf("%d %d",a,b)
#define print3(a,b,c)  printf("%d %d %d",a,b,c)
#define printl(a)    printf("%lld",a)
#define printll(a,b) printf("%lld %lld",a,b)
#define printlll(a,b,c) printf("%lld %lld %lld",a,b,c)
 
#define MAXN        100000007
#define INF 0x3f3f3f3f
bool mark[100005];vi prime;
void seive(ll N){for(int i=2;i<=N;i++){if(mark[i]==false){prime.pb(i);for(int j=i+i;j<N;j+=i)mark[j]=true;}}}
//freopen("input.txt", "r", stdin);
 
int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    ll sum=0;
    vector<string> v;
    for(int i=0;i<n;i++){
        string s; cin>>s;
        v.pb(s);
    }
    for(int i=0;i<n;i++) sort(all(v[i]));
 
    sort(all(v));
 
    ll cnt=1,pos=1;
    for(int i=1;i<n;i++){
        if(v[i]==v[i-1]) cnt++;
        else {
            if(cnt!=1){
                    cnt--;
                sum+=((cnt*cnt+cnt)/2);
            }
            cnt=1;
        }
    }
    if(cnt!=1){
                cnt--;
                sum+=((cnt*cnt+cnt)/2);
            }
            cout<<sum<<endl;
}

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


int main() {
  string g[8];
  for(int i = 0; i < 8; ++i) cin >> g[i];
  for(int k = 0; k < 3; ++k) {
    cout << (k+1)*90 << endl;
    string h[8];
    fill(h, h+8, string(8, ' '));
    for(int i = 0; i < 8; ++i) {
      for(int j = 0; j < 8; ++j) {
        h[i][j] = g[8-j-1][i];
      }
    }
    for(int i = 0; i < 8; ++i) {
      g[i] = h[i];
      cout << g[i] << endl;
    }
  }
}

Measured memory_bytes: 1200
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			Set<Character> set = new HashSet<>();
			for (char c : s) {
				set.add(c);
			}
			System.out.println((set.size() == s.length) ? "yes" : "no");
		}
	}
}


Measured memory_bytes: 22996
S = input()

# 右にどれだけの長さのACGT文字列が含まれているか
c = [0 for _ in range(len(S))]

for i in range(len(S)):
    j = 0 # オフセット
    while i + j < len(S) and S[i+j] in ["A", "C", "G", "T"]:
        c[i] += 1
        j += 1
        
print(max(c))

Measured memory_bytes: 3060
N, x = [int(z) for z in input().split()]
children = [int(z) for z in input().split()]

children.sort()
sum = 0

for i in children:
    sum += i

if sum < x:
    print(N - 1)
#elif sum == x:
#    print(N)
else:
    cnt = 0
    for i in children:
        if x - i < 0:
            break
        else:
            x -= i
            cnt += 1
    print(cnt)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int y = scan.nextInt();
		int z = scan.nextInt();
		scan.close();


		System.out.println(z+" "+x+" "+y);
	}
}


Measured memory_bytes: 39404
# 2つの整数
a, b, c = input().strip().split()
a, b, c = [int(a), int(b), int(c)]

ans = 0

if a == b:
	if b != c:
		ans = 1
else:
	if b == c:
		ans = 1
	elif a == c:
		ans = 1
        
if ans:
	print("Yes")
else:
	print("No")

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

int main() {
	int a[3];
	rep(i, 3)cin >> a[i];
	sort(a, a + 3);
	puts(a[0] + a[1] == a[2] ? "Yes" : "No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
int main() {
  int N, M; cin >> N >> M;
  vvi sw(M, vi(0)); 
  rep(i,M){
    int k; cin >> k;
    rep(j,k){
      int a; cin >> a;
      sw[i].push_back(a);
    }
  }
  vi lt(M);
  rep(i,M){ int a; cin >> a; lt[i]=a;}
    
  int ans =0;
  for (int bit=0; bit<(1<<N); bit++){
    vi jg(M,0);
    for (int i=0; i<N; i++){
      if(bit & (1<<i)) {
        rep(k,M){
          rep(l, (int)sw[k].size()){
            if(i == (sw[k][l]-1) ) jg[k]++;
          }
        } 
      }
    }
    rep(i,M) jg[i] %=2;
    if(lt==jg) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
// #define sort(a) sort(all(a))
using P = pair<int, int>;
using ll = long long;
using ld = long double;
typedef vector<int> vi;
int dx[4] = { 0, 1, 0,-1 };
int dy[4] = { 1, 0,-1, 0 };
const ll MOD = 1000000007;
#define PI 3.14159265358979323846264338327950L


using Graph = vector<vector<int>>;

signed main() {
  int a,b,n;
  cin >> n >> a >> b;
  string s;
  cin >> s;
  bool flag;
  int kcnt = 0; // 海外の学生の中での順位
  int ycnt = 0; // 予選通過人数
  for (int i = 0; i < s.size(); i++) {
    flag = false;
    if(s[i]=='b') kcnt++;
    if(s[i]=='a' && ycnt<a+b) {
      flag = true;
      ycnt++;
    } else if(s[i]=='b' && ycnt<a+b && kcnt<=b) {
      flag = true;
      ycnt++;
    }
    if(flag) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
int main() {
  int n;cin>>n;
  bool ans=false;
  REP(i,26){
    REP(j,16){
      if(4*i+7*j==n){
        ans=true;
        break;
      }
    }
  }
  cout << (ans?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i,N) cin >> a[i];
  int count1 = 0;
  int count4 = 0;
  rep(i,N)
  {
    if(a[i]%2==1)
    {
      count1 ++;
    }
    else if(a[i]%4==0)
    {
      count4 ++;
    }
  }
  if(count4>=count1)
  {
    cout << "Yes" << endl;
  }
  else if(count4+count1==N&&count4>=count1-1)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3752
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int n, m;
vector<int> a;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
  string s;
    cin >> s;
  if(s[2]==s[3]&&s[4]==s[5])yes;
  else no;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

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

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

int main(){
  int n, k;
  cin >> n >> k;
  vector<vector<int>> books(10);
  rep(i,n){
    int a, b;
    cin >> a >> b;
    books[b-1].push_back(a);
  }
  for(int i=9; i>=0; i--){
    if(!books[i].size())
      books.erase(books.begin()+i);
  }
  rep(i,books.size()) sort(books[i].rbegin(), books[i].rend());
  rep(i,books.size()){
    for(int j=1; j<books[i].size(); j++){
      books[i][j] += books[i][j-1];
    }
  }
  rep(i,books.size()){
    for(int j=1; j<books[i].size(); j++){
      books[i][j] += j*(j+1);
    }
  }
  vector<vector<int>> dp(books.size()+1, vector<int>(k+1));
  for(int i=1; i<=books.size(); i++){
    for(int j=1; j<=k; j++){
      rep(l,books[i-1].size()){
        chmax(dp[i][j], dp[i-1][j]);
        if(j-l-1<0)
          continue;
        chmax(dp[i][j], dp[i-1][j-l-1]+books[i-1][l]);
      }
    }
  }
  cout << dp[books.size()][k] << endl;
  return 0;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,AC=0,WA=0,TLE=0,RE=0;
  string work;
  cin >> N;
  for (int i=0; i<N; i++){
    cin >> work;
  if (work == "AC"){
    AC++;
  }
  else if (work == "WA"){
  	WA++;
  }
  else if (work == "TLE"){
    TLE++;
  }
  else if (work == "RE"){
    RE++;
  }
  } 
  cout << "AC x " << AC << endl;
  cout << "WA x " << WA << endl;
  cout << "TLE x " << TLE << endl;
  cout << "RE x " << RE << endl;
}

Measured memory_bytes: 3604
#include<iostream>
#include<cstdlib>
#include<algorithm>

using namespace std;

int main(){
    long long a[3],b[3];
    long ans[4];
    for(int i=0;i<4;i++)ans[i] = 0;
    for(int i=0;i<3;i++)cin >> a[i] >> b[i];

    for(int i=0;i<3;i++){
        if(a[i]==1 || b[i]==1)ans[0]++;
        if(a[i]==2 || b[i]==2)ans[1]++;
        if(a[i]==3 || b[i]==3)ans[2]++;
        if(a[i]==4 || b[i]==4)ans[3]++;
    }
    sort(ans, ans+4);

    if(ans[0]==ans[1] && ans[2]==ans[3])cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256