akhauriyash/Code-Regression huggingface dataset:
b = input()
l = len(b)
ans = []
kotae = 1
c = []
for i in range(l):
  if b[i]=="A" or b[i]=="T" or b[i]=="G" or b[i]=="C":
    ans.append(i)
l2 = len(ans)
if l2==1:
  c.append(1)
for i in range(l2-1):
  if (ans[i+1]-ans[i])==1 and i==l2-2:
    kotae+=1
    c.append(kotae)
  elif (ans[i+1]-ans[i])==1:
    kotae+=1
  else:
    c.append(kotae)
    kotae=1
if ans==[]:
  print(0)
else:print(max(c))

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <set>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 10000000000
#define MAX 100000
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll, ll> P;

ll gcd(ll a, ll b) {
    if(b==0) return a;
    return gcd(b, a%b);
}

mat mul(mat &A, mat &B) {
    ll i, j, k;
    mat C(A.size(), vec(B[0].size()));
    for(i=0; i<A.size(); i++) {
        for(k=0; k<B.size(); k++) {
            for(j=0; j<B[0].size(); j++) {
                C[i][j]^=A[i][k] & B[k][j];
            }
        }
    }
    
    return C;
}

mat pow(mat A, ll n) {
    mat B(A.size(), vec(A.size()));
    for(ll i=0; i<A.size(); i++) {
        B[i][i]=-1;
    }
    while(n>0) {
        if(n&1) B=mul(B, A);
        A=mul(A, A);
        n>>=1;
    }
    
    return B;
}

int main(void) {
    ll n;
    string s;
    cin >> n >> s;
    ll i, j;
    ll ans=0;
    map<pair<string, string>, ll> cnt;
    for(i=0; i<1<<n; i++) {
        string a, b;
        for(j=0; j<n; j++) {
            if(1&i>>j) a+=s[j];
            else b+=s[j];
        }
        cnt[{a, b}]++;
    }
    
    for(i=0; i<1<<n; i++) {
        string a, b;
        for(j=0; j<n; j++) {
            if(1&i>>j) a=s[j+n]+a;
            else b=s[j+n]+b;
        }
        ans+=cnt[{b, a}];
    }
    
    cout << ans << endl;
}


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

int main(void){
   long long X,Y;
   cin>>X>>Y;
   int ans=0;
   while(1){
      ans++;
      X=X*2;
      if(X>Y) break;
   }
   cout<<ans<<endl;
   return 0;
}



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

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

using namespace std;

struct team {
	int id;
	int time;
	int accept;
	int wrong[10];
};

bool operator<( const team &a, const team &b )
{
	if(a.accept > b.accept) return true;
	else if(a.accept < b.accept) return false;
	else {
		if(a.time < b.time) return true;
		else if(a.time > b.time) return false;
		else {
			if(a.id < b.id) return true;
			else return false;
		}
	}
	return false;
}

int main( void )
{
	int t, p, r;
	team T[50];
	while(cin >> t >> p >> r, t | p | r) {
		rep(i, t) {
			T[i].id = i+1;
			T[i].time = 0;
			T[i].accept = 0;
			rep(j, p) T[i].wrong[j] = 0;
		}
		rep(i, r) {
			int id, no, tm;
			string msg;
			cin >> id >> no >> tm >> msg;
			--id; --no;
			if(msg[0] == 'W')
				++T[id].wrong[no];
			else { // msg[0] == 'C'
				T[id].time += (tm + T[id].wrong[no]*1200);
				++T[id].accept;
			}
		}
		sort(T, T+t);
		rep(i, t)
			cout << T[i].id << ' ' << T[i].accept << ' ' << T[i].time << endl;
	}
	return 0;
}

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

using namespace std;

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


int main(){

	while(1){

		int n,p;
		cin >> n >> p;
		if(n == 0 && p == 0){
			break;
		}

		vector<int> h(n,0);

		int wan = p;
		int t = 0;

		while(1){
			if(wan > 0){
				h[t%n]++;
				wan--;
				if(wan == 0 && h[t%n] == p){
					cout << t%n << endl;
					break;
				}
			}
			else{
				wan = h[t%n];
				h[t%n] = 0;
			}
			t++;
		}
	}

	return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <vector>
#include <fstream>
using namespace std;
struct edg
{
    int a,b,c;
};
vector<edg> edges;
int l,i,lg,k,pond[30],cate,p,msk;
int main()
{
    //freopen("data.in","r",stdin);
    cin>>l;
    while((1<<lg)<=l)
        lg++;
    lg--;
    if((1<<lg)==l)
    {
        cate=lg+1;
        for(i=1;i<=lg;i++)
     {
        edges.push_back({i,i+1,(1<<(lg-i))});
        edges.push_back({i,i+1,0});
     }
    }
    else
    {
        cate=lg+1;
        for(i=1;i<=lg;i++)
      {
        edges.push_back({i,i+1,(1<<(lg-i))});
        edges.push_back({i,i+1,0});
        pond[i]=(1<<(lg-i));
      }
      msk=(1<<lg);
      for(i=lg-1;i>=0;i--)
         if(((1<<i)&l))
      {
         k=(l&msk);
         p=2;
         while(pond[p]>=(1<<i))
            p++;
         edges.push_back({1,p,k});
         msk+=(1<<i);
      }
      //edges.push_back({1,lg+1,0});
    }
    cout<<cate<<' '<<edges.size()<<'\n';
    for(int i=0;i<edges.size();i++)
        cout<<edges[i].a<<' '<<edges[i].b<<' '<<edges[i].c<<'\n';
    return 0;
}


Measured memory_bytes: 256
n, m, q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(q)]
a = [1]*n 

def func(a):
    if a[-1] != m: 
        a[-1] += 1 
        return a
    else: 
        d = n - 1
        while d > 0 and a[d] == m:
            d = d - 1 
        if d < 0:
            return a
        else: 
            a[d] += 1
            for x in range(d,n): 
                a[x] = a[d]
            return a
            
ans = 0
a[-1] = 0
while sum(a) != n*m:
    func(a)
    di = 0
    for i in range(q): 
        if a[abcd[i][1]-1] - a[abcd[i][0]-1] == abcd[i][2]: 
            di += abcd[i][3] 
    ans = max(ans, di) 
print(ans)

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll = long long;
using R = long double;
const R EPS = 1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max(x, 0.0L));}

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

// Problem Specific Parameter:

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

	vector<int> num(13, 0);

	num[0]++;
	rep(i, n) {
		int d;
		cin >> d;
		num[d]++;
	}

	int ans = 0;

	bool zero = false;

	if(num[0] >= 2) zero = true;
	rep(i,1,12) if(num[i] >= 3) zero = true;
	if(num[12] >= 2) zero = true;

	if(zero){
		puts("0");
		return 0;
	}

	rep(mask, 1 << 24) {
		bool valid = true;


		rep(i, 13) {
			int cnt = 0;
			if ((mask & (1 << i)) != 0) cnt++;
			if (1 <= i and i <= 11 and (mask & (1 << (24 - i))) != 0) cnt++;

			if (cnt != num[i]) valid = false;
		}

		if (valid == false) continue;

		int cur = 110;
		rep(i,24)rep(j,24){
			if(i == j) continue;
			if((mask &(1<<i))==0) continue;
			if((mask &(1<<j))==0) continue;
			const int tmp = abs(i-j);
			chmin(cur,min(tmp,24-tmp));
		}

		/*
		using T = bitset<24>;
		cerr << T(mask) << endl;
		cerr << cur << endl;
		*/
		chmax(ans,cur);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
//package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
public class Main {
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] Args){
        FastReader scan=new FastReader();
        int t=1;
//        t=scan.nextInt();
        while(t-->0){
            int k=scan.nextInt();
            int a=scan.nextInt();
            int b=scan.nextInt();
            boolean ans=false;
            for(int i=a;i<=b;i++){
                if(i%k==0){
                    ans=true;
                }
            }
            if(ans){
                out.println("OK");
            }else{
                out.println("NG");
            }
        }
        out.flush();
        out.close();
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}


Measured memory_bytes: 32928
N,A = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]
X = max(x+[A])
#%%
dp = [[[-1]*(N*X+1) for _ in range(N+1)] for _ in range(N+1)]

def rep(j,k,s):
    if(dp[j][k][s]==-1):
        if(s==j==k==0):
            dp[j][k][s] = 1
        elif(j>=1 and s<x[j-1]):
            dp[j][k][s] = rep(j-1,k,s)
        elif(j>=1 and k>=1 and s>=x[j-1]):
            dp[j][k][s] = rep(j-1,k,s) + rep(j-1,k-1,s-x[j-1])
        else:
            dp[j][k][s] = 0
    return dp[j][k][s]

ans = 0
for k in range(1,N+1):
    ans += rep(N,k,k*A)
print(ans)


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

int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  
  int ans = 0;
  rep(i, n-2) {
    if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') {
      ans += 1;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
s = list(map(int,list(input().replace("o","1").replace("x","0"))))
for bit in range(4):
  ani = [None]*n
  ani[0] = bit%2
  ani[1] = bit//2
  for i in range(1,n-1):
    ani[i+1] = ani[i-1]^ani[i]^s[i]
  if ani[0] == ani[n-2]^ani[n-1]^s[n-1] and ani[1] == ani[-1]^ani[0]^s[0]:
    print("".join(list(map(str,ani))).replace("0","W").replace("1","S"))
    break
else:
  print(-1)

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

typedef struct node {
  int key;
  struct node *p , *r , *l;
} Node;

Node *root, *NIL;

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

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->l = NIL;
  z->r = NIL;

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

void inorder(Node *u) {
  if(u == NIL) return;
  inorder(u->l);
  printf(" %d", u->key);
  inorder(u->r);
}

void preorder(Node *u) {
  if(u == NIL) return;
  printf(" %d", u->key);
  preorder(u->l);
  preorder(u->r);
}

int main() {
  int n, i , x;
  char com[6];

  scanf("%d",&n);

  for(i = 0; i < n; i++) {
    scanf("%s\n", com);
    if(strcmp(com, "insert") == 0) {
      scanf("%d",&x);
      insert(x);
    } else if(strcmp(com, "print") == 0) {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}

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

#include<vector>
#include<algorithm>
#include<cmath>
#include<limits>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i = 0;i < (n); ++i)

int main() {
	int n;
	cin >> n;
	int chack = 0;
	rep(i, 9) {
		if (n % (i + 1) == 0 && n /(i+1) < 10) {
			cout << "Yes" << endl;
			chack = 1;
			break;
		}
	}
	if (chack == 0)cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	string s;
  cin>>s;
  int n=s.size();
  bool dame=0;
  for(int i=0; i<n-1; i++){
    if(s[i]!=s[i+1]){
      dame=1;
      break;
    }
  }
  if(!dame){
    cout<<0<<endl;
    return 0;
  }
  int ans=n-1;
  for(int k=0; k<26; k++){
    bool ok=0;
    for(int i=0; i<n; i++){
      if(s[i]=='a'+k){
        ok=1; break;
      }
    }
    if(!ok) continue;
    string s1=s;
    for(int i=0; i<n-1; i++){
      string t;
      for(int j=0; j<n-1-i; j++){
        if(s1[j+1]=='a'+k){
          t+=s1[j+1];
        }else{
          t+=s1[j];
        }
      }
      s1=t;
      dame=0;
      for(int j=0; j<n-2-i; j++){
        if(s1[j]!=s1[j+1]){
          dame=1;
          break;
        }
      }
      if(!dame){
        ans=min(ans, i+1);
        break;
      }
    }
  }
  cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int i,n,w,a,b,t;
  int data[30];
  char c;

  scanf("%d",&w);
  scanf("%d",&n);
  for (i=0;i<w;i++){
    data[i]=i+1;
  }
  for (i=0;i<n;i++){
    scanf("%d",&a);
    scanf("%c",&c);
    scanf("%d",&b);
    t=data[a-1];
    data[a-1]=data[b-1];
    data[b-1]=t;
  }
  for (i=0;i<w;i++){
    printf("%d\n",data[i]);
  }
  return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		int sum = l * n;
		int[] aji = new int[n];
		for(int i = 0 ; i < n ; i++) {
			sum += i;
			aji[i] = l + i;
		}
		int min = Integer.MAX_VALUE / 2;
		int aji2 = 0;
		for(int i = 0 ; i < n ; i++) {
			int apple_pie = sum - aji[i];
			int sa = Math.abs(sum - apple_pie);
			if(min > sa) {
				aji2 = apple_pie;
				min = sa;
			}
		}

		sc.close();
		System.out.println(aji2);

	}
}



Measured memory_bytes: 35680
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    a,b,c = map(int,input().split())
    print(c,a,b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5880
import Data.Functor
import Control.Monad

main::IO ()
main=
  do
    n <- read <$> getLine::IO Int
    numList <- replicateM n (read <$> getLine)::IO [Int]
    let output=length . filter isPrime $ numList
    print output

isPrime::Integral a=>a->Bool
isPrime n=isPrime' n 2
  where
    isPrime' a x
      |floor (sqrt (fromIntegral a)) < x =True
      |otherwise =
        case a `mod` x of
          0->False
          _->isPrime' a (x+1)

Measured memory_bytes: 9320
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  int count=0;
  int ans=0;

  vector<int> K(N);
  vector<vector<int> > A(N,vector<int>(M));

  for(int i=0;i<N;i++){
      cin>>K.at(i);
      for(int j=0;j<K.at(i);j++){
          cin >>A.at(i).at(j);
      }
  }
   for(int i=0;i<K.at(0);i++){
       for(int j=0;j<N;j++){
           for(int k=0;k<K.at(j);k++){
               if(A.at(0).at(i)==A.at(j).at(k))
               count++;
           }
       }
    if(count==N)
    ans++;
    count=0;
   }
 cout<<ans<<endl;
  }
  

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

int main() {
    int n;
    cin >> n;
    vector<int> data(n);
    long long sum = 0;
    for (int i = 0; i < n; i++){
        cin >> data.at(i);
    }
    for (int i = 0; i < n-1; i++){
        if(data.at(i) > data.at(i+1)){
            sum += data.at(i) - data.at(i+1);
            data.at(i+1) +=data.at(i) - data.at(i+1);
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 4044
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = sum(b)

for i in range(n-1):
  if a[i+1] - a[i] == 1:
    ans += c[a[i]-1]
    
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#define INF 1e9
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;
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; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}

template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
  s << vv[i] << endl;
  }
  return s;
}

int N,M;
vector<ll> A;

signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> N >> M;
  A.resize(N);
  rep(i,N){
    cin >> A[i];
  }

  map<ll,ll>nums;
  ll sum = 0;
  nums[sum]++;
  rep(i,N){
    sum += A[i];
    nums[sum % M]++;
  }
  ll ret = 0;
  for(auto it : nums){
    ret += it.second * (it.second - 1 ) / 2;
  }
  cout << ret << endl;

  return 0;
}


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

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	cin >> N;

	int asum = 0;
	int bsum = 0;

	vector<int> a( N+1 );
	vector<int> b( N+1 );
	for( int i = 1; i <= N; ++i ) { cin >> a[i]; }
	for( int i = 1; i <= N; ++i ) {
		cin >> b[i];
		bsum += b[i];
	}

	int result = 0;
	for( int i = 1; i <= N; ++i ) {
		asum += a[i];
		bsum -= b[i-1];

		if( asum + bsum > result ) {
			result = asum + bsum;
		}
	}

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main(){

	int n,a,b;

	cin>>n>>a>>b;

	cout<<min(a,b)<<" ";

	if(n>=a+b)cout<<"0"<<endl;
	if(n<a+b)cout<<a+b-n<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = II()
    s = S()
    t = S()
    for i in range(n):
        if s[i:] == t[: n - i]:
            print(n + i)
            return
    print(2 * n)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 38512
using System;

namespace _0208
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int n = int.Parse(Console.ReadLine());
                if (n == 0)
                {
                    break;
                }
                string s = Convert.ToString((n), 8);
                s = s.Replace("7", "9");
                s = s.Replace("6", "8");
                s = s.Replace("5", "7");
                s = s.Replace("4", "5");
                Console.WriteLine(s);
            }
        }
    }
}

Measured memory_bytes: 8916
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n,x,y;
    cin>>n>>x>>y;
    x --;y --;
    vector<int> d(0);
    int dist;
    rep(i,n-1)REP(j,i+1,n){
        dist=min(j-i,abs(x-i)+1+abs(y-j));
        d.emplace_back(dist);
    }
    map<int,int> a;
    rep(i,d.size()) a[d[i]] ++;
    REP(i,1,n) cout<<a[i]<<'\n';
}

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

namespace ABC066A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, d;

            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);

            d = a + b;

            if (d > a+c) d = a+c;
            if (d > b+c) d = b+c;


            Console.WriteLine(d);

            Console.ReadKey();

        }
    }
}



Measured memory_bytes: 11092
using namespace std;
    #include <iostream>
    #include <bits/stdc++.h>
     
    int main() {
      int a,b,c,d;
      cin>>a>>b>>c>>d;
      
      if (abs(a-c)<=d || (abs(a-b)<= d && abs(b-c)<=d)){
        cout << "Yes" << endl;
        return 0;
      }
      cout << "No" << endl;
     
      return 0;
    }

Measured memory_bytes: 256
from fractions import*
n,k = map(int,input().split())
an = [int(i) for i in input().split()]
g = an[0]
for i in an[1:]:
  g = gcd(g,i)
if k > max(an) or k%g > 0:
  print('IMPOSSIBLE')
else:
  print('POSSIBLE')

Measured memory_bytes: 16280
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

void solve(string S) {
  int i;
  for (i = S.size()/2-1; i;--i) {
    if(S.substr(0,i) == S.substr(i,i)) break;
  }
  cout << i*2 << endl;
}

int main() {
  string S;
  cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a==b){
    printf("%d",a*2);
  }else if(a>b){
    printf("%d",2*a-1);
  }else{
    printf("%d",2*b-1);
  }
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;i++)
const ll INF=1e18;
const int inf=2e9;
const ll MOD=1000000007;

int main(){
    ll a,b,c;cin>>a>>b>>c;
    if(c>a){
        c-=a;
        a-=a;
        b-=c;
    }
    else a-=c;
    b=max(b,(ll)0);
    cout<<a<<" "<<b<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll h, w, a, b;
string s;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> h >> w >> a >> b;
	rep(i, 1, h){
		rep(j, 1, w){
			if((i <= b && j <= a) || (i > b && j > a)){
				cout << 0;
			}
			else{
				cout << 1;
			}
		}
		cout << endl;
	}
	return 0;
}

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

template<typename T>
struct BIT {
    int n;
    vector<T> dat;

    BIT(int n=0){
        initialize(n);
    }

    void initialize(int nin){
        n = nin;
        dat.resize(n, 0);
    }

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

    T sum_between(int i, int j){
        return sum(j) - sum(i-1);
    }

    void plus(int i, T x){
        while(i < n){
            dat[i] += x;
            i |= i+1;
        }
    }

    // a[0]+...+a[ret] >= x
    int lower_bound(T x){
        int ret = -1;
        int k = 1;
        while(2*k <= n) k <<= 1;
        for( ;k>0; k>>=1){
            if(ret+k < n && dat[ret+k] < x){
                x -= dat[ret+k];
                ret += k;
            }
        }
        return ret + 1;
    }
};

int main() {
    int N, K, P[100000];
    cin >> N >> K;
    for(int i=0; i<N; i++) cin >> P[i];

    bool ok = true;
    if(K == N){
        for(int i=0; i<N; i++) if((N+P[(i+1)%N]-P[i])%N != 1) ok = false;
    }else{
        int64_t s = 0;
        BIT<int> bit(N+1);
        for(int i=0; i<N; i++){
            s += bit.sum_between(P[i], N);
            bit.plus(P[i], 1);
        }
        ok = !(K%2) || !(s%2);
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

int main(void)
{
    int n, k;
    cin >> n >> k;

    vector<long long> x(n);
    for (int i = 0; i < n;i++)
        cin >> x.at(i);
    long long l;
    long long r;
    long long sum1,sum2,ans = 1234567890123;
    for (int i = 0; i < n - k+1;i++){
        sum1 = 0;
        sum2 = 0;
        l = x.at(i);
        r = x.at(i + k-1);
        sum1 = abs(l)+abs(r-l);
        sum2 = abs(r) + abs(l - r);
        ans = min(ans, sum1);
        ans = min(ans, sum2);
    }
    cout << ans << endl;


}

Measured memory_bytes: 1024
#include<iostream>
#include<fstream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<typeinfo>
using namespace std;

const int MAX = 1000000;

int n, k;
int rank[MAX+1];
int preRank[MAX+1];

bool comp(int x, int y){
    if(rank[x] == rank[y]){
        int xx = (x + k <= n ? rank[x+k] : -1);
        int yy = (y + k <= n ? rank[y+k] : -1);
        return xx < yy;
    }else{
        return rank[x] < rank[y];
    }
}

vector<int> makeSA(string &T){
    n = T.size();
    vector<int> SA(n+1);

    for (int i=0;i<n+1;i++){
        SA[i] = i;
        rank[i] = (i<n) ? (int)T[i] : -1;
    }

    for (k=1;k<n+1;k*=2){
        sort(SA.begin(), SA.begin()+n+1, comp);
        preRank[SA[0]] = 0;
        for (int j=1;j<n+1;j++){
            preRank[SA[j]] = preRank[SA[j-1]] + (comp(SA[j-1], SA[j]) ? 1 : 0);
        }
        for (int j=0;j<n+1;j++){
            rank[j] = preRank[j];
        }
    }
    return SA;
}

bool searchSA(string &T, string &Pat, vector<int> &SA){
    int l = -1;
    int r = T.size();
    while(r-l>1){
        int c = (l+r)/2;
        if(T.compare(SA[c], Pat.length(), Pat) < 0){
            l = c;
        }else{
            r = c;
        }
    }
    return T.compare(SA[r], Pat.length(), Pat) == 0;
}

int main(){
    string T;
    cin >> T;
    vector<int> SA = makeSA(T);
    int Q;
    cin >> Q;
    string Pat;
    for (int i=0;i<Q;i++){
        cin >> Pat;
        cout << searchSA(T, Pat, SA) << endl;
    }

    /*
    for (int i=0;i<SA.size();i++){
        cout << SA[i] << endl;
    }
    */
    return 0;
}

Measured memory_bytes: 15868
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n):
    res = [None] * n
    for i in range(n):
        res[i] = II()
    return res
def LIR(n):
    res = [None] * n
    for i in range(n):
        res[i] = LI()
    return res
def FR(n):
    res = [None] * n
    for i in range(n):
        res[i] = IF()
    return res
def LIR(n):
    res = [None] * n
    for i in range(n):
        res[i] = IF()
    return res
def LIR_(n):
    res = [None] * n
    for i in range(n):
        res[i] = LI_()
    return res
def SR(n):
    res = [None] * n
    for i in range(n):
        res[i] = S()
    return res
def LSR(n):
    res = [None] * n
    for i in range(n):
        res[i] = LS()
    return res
mod = 1000000007
inf = float('INF')

#solve
def solve():
    a = S()
    if "A" <= a <= "Z":
        print("A")
    else:
        print("a")
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 67348
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
int dp[1000001],Odp[1000001];
int Tn[200],OTn[200]; 
int n = 1000000;

int main(){
    int count = 0;  //pollocks numberの生成
    for(int i = 1;i < 200;i++){
        Tn[i-1] = i * (i + 1) * (i + 2) / 6;
        if(Tn[i-1] % 2 == 1){
            OTn[count] = Tn[i-1];
            count++;
        }
    }

    //個数の初期化
    for(int j = 0;j <= n;j++){
        dp[j] = j;
        Odp[j] = j;
    }
    
    for(int i = 0;i < 200;i++){
        for(int j = OTn[i];j <= n;j++){    //奇数正四面体数の個数の最小値
            if(j >= OTn[i])
                Odp[j] = min(Odp[j],Odp[j-OTn[i]] + 1);
        }
        for(int j = Tn[i];j <= 1000000;j++){    //正四面体数の個数の最小値
            if(j >= Tn[i])
                dp[j] = min(dp[j],dp[j-Tn[i]] + 1);
        }
    }

    //入出力
    while(cin >> n,n)
        cout << dp[n] << ' ' <<  Odp[n] << endl;


    return 0;
}


Measured memory_bytes: 10828
n,m = map(int,input().split())
if n%2:
    for i in range(1,m+1):
        print(i,n-i+1)
else:
    for i in range(1,m+1):
        if n-2*i+1>n//2:
            print(i,n-i+1)
        else:
            print(i,n-i)


Measured memory_bytes: 75360
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define eb emplace_back
#define f first
#define s second
#define sz(x) (ll)x.size()
#define lnt(s) (ll)s.length()
#define mt(cnt) cnt.empty()
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> osSet;

using pll = pair<ll, ll>;
using pl = pair<ll, pll>;
using tll = tuple<ll, ll, ll>;

const ll maxN = 1e5;
const ll INF = 1e17;
const ll MOD = 1e9 + 7;

ll xs[] = {-1, 1, 0, 0, -1, 1, 1, -1};
ll ys[] = {0, 0, -1, 1, -1, 1, -1, 1};

ll segtree[maxN << 2];
ll lazy[maxN << 2];
ll A[maxN];

inline ll left(ll x){
	return x << 1;
}

inline ll right(ll x){
	return (x<<1) + 1;
}

ll func(ll x){
	return (x*(x+1))/2;
}

ll _pow(ll b, ll p){
	if(p == 0) return 1;
	if(p == 1) return b;
	ll exB = b*b;
	if(p&1) return b*_pow(exB, p/2);
	return _pow(exB, p/2);
}

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	ll n, k;
	cin >> n;
	set<ll> stl;
	while(n--){
		cin >> k;
		stl.insert(k);
	}
	cout << sz(stl);
	return 0;
}

Measured memory_bytes: 3524
def floor_sum(n, m, a, b):
    """
    Σ(i=0 -> N-1) floor((A * i + B) / M)
    """
    result = 0
    if a >= m:
        result += (n - 1) * n * (a // m) // 2
        a %= m
    if b >= m:
        result += n * (b // m)
        b %= m

    y_max = (a * n + b) // m
    x_max = y_max * m - b
    if y_max == 0:
        return result
    result += (n - (x_max + a - 1) // a) * y_max
    result += floor_sum(y_max, a, m, (a - x_max % a) % a)
    return result


T = int(input())

for i in range(T):
    N, M, A, B = map(int, input().split())
    print(floor_sum(N, M, A, B))


Measured memory_bytes: 75944
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> E;
const LL MOD = 1000000007LL;
LL A[100000];
int main() {
	int K;
	cin >> K;
	for (int i = 0; i < K; i++) cin >> A[i];
	LL l = 2, r = 2;
	for (int i = K - 1; i >= 0; i--) {
		l = ((l + A[i] - 1) / A[i])*A[i];
		r = (r / A[i])*A[i] + (A[i] - 1);
		if (l > r) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << l << " " << r << endl;
}

Measured memory_bytes: 1024
import math
a, b, x = map(int, input().split())
full = a * a * b
if x > full / 2:
    x = full - x
    tan_x = 2.0 * x / (a*a) / a
    print(math.atan(tan_x) / math.pi * 180.0)
else:
    tan_x = 2.0 * x / (a*b) / b
    print(90-math.atan(tan_x) / math.pi * 180.0)


Measured memory_bytes: 9328
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
signed main(){
    int n;cin>>n;
    int time=0;
    int nx=0,ny=0;
    rep(i,0,n){
        int t,x,y;cin>>t>>x>>y;
        int tt=t-time,xx=abs(x-nx),yy=abs(y-ny);
        if(tt<xx+yy){
            cout<<"No"<<endl;
            return 0;
        }
        else if((tt-xx-yy)%2==1){
            cout<<"No"<<endl;
            return 0;
        }
        time=t,nx=x,ny=y;
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
MOD = 10 ** 9 + 7

# dp[i] := gcdがiになるようなものの通り数
dp = [0] * (K + 1)
for k in reversed(range(1, K + 1)):
    cnt = pow(K // k, N, MOD)
    for i in range(2, K + 1):
        if i * k > K:
            break
        cnt -= dp[i * k]
    dp[k] = cnt

ans = 0
for k, cnt in enumerate(dp):
    ans += k * cnt
    ans %= MOD
print(ans % MOD)


Measured memory_bytes: 74600
import copy

n, k = map(int, input().split())
p = list(map(int, input().split()))

s = sum(p[:k])
smax = copy.deepcopy(s)
for i in range(n-k):
    s += p[i+k] - p[i]
    smax = max(smax, s)

print((smax+k)/2)


Measured memory_bytes: 33188
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <set>
#include <queue>
#include <stdbool.h>

#define LL long long
#define inf 0x3f3f3f3f
using namespace std;
const int MAXN=1e3+5;

int r;

int main()
{
    scanf("%d",&r);
    int are = 3*r*r;
    printf("%d\n",are);
    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
ans="APPROVED"

for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            ans="APPROVED"
        else:
            ans="DENIED"
            break
    else:
        continue
        
print(ans)


Measured memory_bytes: 2940
N, M, X, Y = gets.split.map(&:to_i)
x = gets.split.map(&:to_i)
y = gets.split.map(&:to_i)

max_x = (x + [X]).max
min_y = (y + [Y]).min

if max_x < min_y
  puts 'No War'
else
  puts 'War'
end


Measured memory_bytes: 1788
N, Q = map(int, input().split())
S = input()
cnt = [0]*(N+1)
for i in range(N):
    cnt[i+1] = cnt[i] + (1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(cnt[r-1] - cnt[l-1])


Measured memory_bytes: 13212
#include <cstdio>

using namespace std;

char map[8][8];

void check(void);

int main()
{
	while (scanf(" %c", &map[0][0]) != EOF){
		for (int i = 1; i < 8; i++){
			scanf(" %c", &map[0][i]);
		}
		
		for (int i = 1; i < 8; i++){
			for (int j = 0; j < 8; j++){
				scanf(" %c", &map[i][j]);
			}
		}
		
		check();
	}
	
	return (0);
}

void check(void)
{
	for (int i = 0; i < 8; i++){
		for (int j = 0; j < 8; j++){
			if (map[i][j] == '1'){
				if (map[i][j + 1] == '1' && map[i + 1][j] == '1' && map[i + 1][j + 1] == '1'){
					puts("A");
				}
				else if (map[i + 1][j] == '1' && map[i + 2][j] == '1' && map[i + 3][j] == '1'){
					puts("B");
				}
				else if (map[i][j + 1] == '1' && map[i][j + 2] == '1' && map[i][j + 3] == '1'){
					puts("C");
				}
				else if (map[i + 1][j] == '1' && map[i + 1][j - 1] == '1' && map[i + 2][j - 1] == '1'){
					puts("D");
				}
				else if (map[i][j + 1] == '1' && map[i + 1][j + 1] == '1' && map[i + 1][j + 2] == '1'){
					puts("E");
				}
				else if (map[i + 1][j] == '1' && map[i + 1][j + 1] == '1' && map[i + 2][j + 1] == '1'){
					puts("F");
				}
				else if (map[i][j + 1] == '1' && map[i + 1][j] == '1' && map[i + 1][j - 1] == '1'){
					puts("G");
				}
			}
		}
	}
}

Measured memory_bytes: 948
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1000000000;

int main()
{
   int n,m;
   cin >> n >> m;
   vector<int> s(m);
   vector<char> c(m);
   rep(i,m)
   {
      cin>> s[i] >> c[i];
      s[i]--;
   }
   int roop = 1;
   rep(i,n)
   {
      roop*=10;
   }
   if(n==1)
   {
      string S = to_string(0);
      bool isans = true;
      rep(j,m)
      {
         if(S[s[j]]!=c[j])
         {
            isans = false;
         }
      }
      if(isans)
      {
         cout<<S<<endl;
         return 0;
      }
   }
   for(int i = roop/10;i < roop;i++)
   {
      string S = to_string(i);
      bool isans = true;
      rep(j,m)
      {
         if(S[s[j]]!=c[j])
         {
            isans = false;
         }
      }
      if(isans)
      {
         cout<<S<<endl;
         return 0;
      }
   }
   
   cout<<-1<<endl;
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
using namespace std;
#define max_n 100
#define INF 100000000



int main()
{
    char a[max_n],b[max_n],c[max_n];
    scanf("%s",a);
    scanf("%s",b);
    scanf("%s",c);
    char check='a';
    int aj=0,bj=0,cj=0;
    size_t ai=strlen(a);
    size_t bi=strlen(b);
    size_t ci=strlen(c);
    for(int i=0;i<300;i++){
        
        if(check=='a'){
            if(ai==0){
                cout<<"A"<<endl;
                break;
            }
            check=a[aj];
            aj++;
            ai--;
        }else if(check=='b'){
            if(bi==0){
                cout<<"B"<<endl;
                break;
            }
            check=b[bj];
            bj++;
            bi--;
        }else{
            if(ci==0){
                cout<<"C"<<endl;
                break;
            }
            check=c[cj];
            cj++;
            ci--;
        }
    }
    return 0;
}

Measured memory_bytes: 256
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin >> a >> b;
  if(a>=13) {
    cout << b << endl;
  }
  else if(a>=6) {
    cout << b/2 << endl;
  }
  else {
    cout << 0 << endl;
  }
}

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

int main() {
  vector<int> vec(3);
  for (int i = 0; i < 3; i++) cin >> vec.at(i);
  sort(vec.begin(), vec.end());
  cout << vec.at(0) << " " << vec.at(1) << " " << vec.at(2) << endl;
}


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

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

struct UnionFind {
  // 子は親のID,親は-サイズ
  vector<int> d;
  UnionFind(int n) : d(n, -1) {}
  int root(int x) {
    if (d[x] < 0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y); }
  int size(int x) { return -d[root(x)]; }
};

int main() {
  ll n, m, ans = 0, a, b;
  cin >> n >> m;
  UnionFind uf(n);
  rep(i, m) {
    cin >> a >> b;
    a--, b--;
    uf.unite(a, b);
  }

  rep(i, n) ans = max(ans, (ll)uf.size(i));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4032
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(void)
{
  LL n;
  cin >> n;
  vector<LL> f;
  FOR(i,1,1048576) {
    if(i*i>n) break;
    if(i*i == n) f.push_back(i);
    if(n%i == 0) {
      f.push_back(i);
      f.push_back(n/i);
    }
  }
  LL answer = 0;
  for(auto x:f) {
    --x;
    if(x==0) continue;
    if(n/x == n%x) answer += x;
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;



int main () {
	int x;
	cin >> x;
	x = x < 0 ? -x : x;
	int n = 1;
	int ans = 0;
	while (ans < x) {
		ans += n;
		n ++;
	}
	cout << n-1 << endl;
	
	return 0;
}


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

long long gcd(long long a, long long b) {
	if (a < b)
		swap(a, b);
	if (a % b == 0) {
		return b;
	} else {
		return gcd(b, a % b);
	}
}

long long lcm(long long a, long long b) {
	return a * b / gcd(a, b);
}

int main() {
	int A, B;
	cin >> A >> B;
	cout << lcm(A, B) << endl;
	return 0;
}


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

using namespace std;
int main()
{
    int n;
    cin >> n;

    int d = 0;
    int nn = n;
    while (nn > 0)
    {
        nn /= 10;
        d++;
    }

    int cnt = 0;
    for (int i = 0; i < d / 2; i++)
    {
        int f = 9;
        for (int j = 0; j < 2 * i; j++)
        {
            f *= 10;
        }
        cnt += f;
    }

    if (d % 2 == 1)
    {
        int f = 1;
        for (int i = 0; i < d - 1; i++)
        {
            f *= 10;
        }
        cnt += n - f + 1;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define rep(i,a,b) for(uint32 i = (a); i < (b); ++i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define ALL(x) (x).begin(),(x).end()
#define C(x) std::cout << #x << " : " << x << std::endl
#define scanf scanf_s

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;



int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::string s;
	std::cin >> s;
	s[3] = '8';
	std::cout << s << "\n";
	return 0;
}

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

int main(void){
	int m, i, j, k, l, h, len, aft_len;
	char str[201], *first, *last, str_first[200], str_last[200];
	first = str;
	last = str;
	
	do{
		scanf("%s\n", str);
		if(str[0] == '-'){
			break;
		}
		len = strlen(str);
		scanf("%d\n", &m);
		for(i = 0; i < m; i++){
			scanf("%d\n", &h);
			last += h;
			aft_len = len-h;
			strncpy(str_first, first, h);
			strncpy(str_last, last, aft_len);
			for(j = 0; j < aft_len; j++){
				str[j] = str_last[j];
			}
			for(k = aft_len, l = 0; k < len; k++, l++){
				str[k] = str_first[l];
			}
			last = str;
		}
		printf("%s\n", str);
	}while (1);
	return 0;
}



Measured memory_bytes: 2064
#include <stdio.h>
#include <string.h>

int main() {
    char S[1000], T[1000];
    int num, ans, i, j;
    ans = 0;
    
    scanf("%s", S);
    scanf("%s", T);

    int s = strlen(S);
    int t = strlen(T);

    for(i=0; i <= s-t; i++) {
        num = 0;
        for(j=0; j < t; j++) {
            if(S[i+j] == T[j]) num++;
        }

        if(num > ans) ans = num;
    }

    printf("%d\n", t - ans);
    return 0;
}

Measured memory_bytes: 1712
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

struct group {
	int id;
	int num;
	int time;
};

int cansit(const vector<int>&seats, int num) {
	for (int i = 0; i <= 17 - num; ++i) {
		bool ok = true;
		for (int j = i; j < i + num; ++j) {
			if (seats[j] != -1) {
				ok = false;
			}
		}
		if (ok)return i;
	}
	return -1;
}
void dosit(vector<int>&seats, int num, int place,int leavetime) {
	for (int i = place; i < place + num; ++i) {
		seats[i] = leavetime;
	}
}

int main() {
	int N;
	while (cin >> N) {
		queue<group>waiting;
		vector<int>seats(17,-1);
		vector<int>anss(100);
		for (int t = 0; (t<=1000||!waiting.empty()); ++t) {
			for (int i = 0; i < 17; ++i) {
				if (t == seats[i])seats[i] = -1;
			}
			if (!(t % 5)) {
				const int id = t / 5;
				if (id < 100) {

					const int num = id % 5 == 1 ? 5 : 2;
					const int time = 17 * (id % 2) + 3 * (id % 3) + 19;
					waiting.push(group{ id,num,time });
				}
			}
			while (!waiting.empty()) {
				group atop(waiting.front());
				int place = cansit(seats, atop.num);
				if (place != -1) {
					dosit(seats, atop.num, place,atop.time+t);
					anss[atop.id] = t - atop.id * 5;
					waiting.pop();
				}
				else {
					break;
				}
			}
		}

		cout << anss[N] << endl;
	}
	return 0;
}

Measured memory_bytes: 2980
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int main()
{
	int res = 0, a;
	scanf("%d", &a);

	int t = 1;
	for (int i = 1; i <= 3; ++i)
	{
		t *= a;
		res += t;
	}

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

	return 0;
}

Measured memory_bytes: 3820
n = int(input())
p = list(map(int, input().split()))

for i in range(n):
    for j in range(i, n):
        p_c = p.copy()
        p_c[i], p_c[j] = p_c[j], p_c[i]
        if p_c == sorted(p_c):
            print('YES')
            exit()
print('NO')

Measured memory_bytes: 3060