akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N, A;
  cin >> N >> A;
  vl X(N);
  vvl DP = VVL(N + 1, 5101, 0);
  REP(i, N) {
    cin >> X[i];
    X[i] = X[i] - A + 50;
  }
  DP[0][0] = 1;
  REP(i, N) {
    auto DPC = DP;
    REP(k, N) {
      REP(j, 5100) {
        if (j < X[i])
          continue;
        DP[k + 1][j] += DPC[k][j - X[i]];
      }
    }
  }
  ll ans = 0;
  FOR(i, 1, N + 1) {
    ans += DP[i][i * 50];
    // cout << i << "," << DP[i][i * 50] << endl;
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
  int n;
  cin >> n;
  int m=(n+1)/2;
  double ans=(double)m/n;
  printf("%.10f", ans);
}


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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
    T r;
    while (a)
        r = b, b = a, a = r % a;
    return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repe(i, n) for (ll i = 0; i <= (n); i++)
#define repd(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<ll> vl;
#define ERASE(x) x.erase(unique(ALL(x)), x.end()); // erase same elements
#define VEC(type, c, n)     \
    std::vector<type> c(n); \
    for (auto &i : c)       \
        std::cin >> i;

// input
#define INIT                          \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define VAR(type, ...) \
    type __VA_ARGS__;  \
    MACRO_VAR_Scan(__VA_ARGS__);
template <typename T>
void MACRO_VAR_Scan(T &t)
{
    std::cin >> t;
}
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First &first, Rest &... rest)
{
    std::cin >> first;
    MACRO_VAR_Scan(rest...);
}

// output
template <typename T>
void MACRO_OUT(const T t) { std::cout << t; }

#define OUT(...) MACRO_OUT(__VA_ARGS__);
#define SP std::cout << " ";
#define TAB std::cout << "\t";
#define BR std::cout << "\n";
#define ENDL std::cout << std::endl;

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define yes() printf("yes\n")
#define no() printf("no\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
    cout << a;
    ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
    cout << a << ' ';
}

double ans = 0;
bool check = 0;
bool boo = 0;
string s, t;
int N = 3;
vector<int> v(N);
ll a, b, c, d, n, k, m = 1000000;
ll minn = INF, maxx = 0;
int x = 0, y = 0;
int sum;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// cout << (conditon ? (result:  == 1 ): (==0)) << endl; <- output result of if
// long long 型が表せる値の上限はおよそ 9 × 10＾18 です．
int main()
{
    INIT;
    cin >> n;
    rep(i, n)
    {
        cin >> a;
        minn = min(a, minn);
        maxx = max(a, maxx);
    }
    pr(abs(maxx - minn));

    return 0;
}


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

int main()
{
    int N, M;
    cin >> N >> M;
    int p[M];
    string S[M];
    for (int i = 0; i < M; i++) cin >> p[i] >> S[i];

    bool isOK[N + 1] = {false};
    int arrWA[N + 1] = {0};
    for (int i = 0; i < M; i++) {
        if (isOK[p[i]]) continue;
        if (S[i] == "AC") {
            isOK[p[i]] = true;
        }
        else {
            arrWA[p[i]]++;
        }
    }

    int countAC = 0;
    int countWA = 0;
    for (int i = 1; i < N + 1; i++) {
        if (isOK[i]) {
            countAC++;
            countWA += arrWA[i];
        }
    }

    cout << countAC << " " << countWA << endl;
    return 0;
}

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

int main(){
  string S;
  char c1,c2,c3,c4;
  bool flag = false;
  cin >> S;
  c1 = S[0];c2=S[1];c3=S[2];c4=S[3];

  if(c1==c2 && c3==c4 && c1!=c3) flag=true;
  else if(c1==c3 && c2==c4 && c1!=c2) flag=true;
  else if(c1==c4 && c2==c3 && c1!=c2) flag=true;
  if(flag==true) cout <<"Yes" << endl;
  else cout << "No" << endl;

}




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

int m;
long long d, c, D = 0, T = 0;

int main () {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> m;
  for (int i = 0; i < m; ++i) {
    cin >> d >> c;
    D += c;
    T += (d * c);
  }
  cout << (D - 1 + ((T - 1) / 9)) << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

bool check(int a, int b) {
	return a > b;

}

int main() {
	llint n, m;
	cin >> n >> m;
	vpllint a(n);
	rep(i, n) {
		cin >> a[i].first >> a[i].second;
	}
	sort(a.begin(), a.end());
	int cnt = 0;
	llint ans = 0;
	rep(i, n) {
		if (a[i].second + cnt <= m) {
			ans += a[i].first*a[i].second;
			cnt += a[i].second;
		}
		else {
			ans += a[i].first*(m - cnt);
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <functional>

using namespace std;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

int W,H,res;
string board[30];

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

void dfs(int y, int x){
  int i;

  res++;
  board[y][x] = '#';
  rep(i,4){
    int my = y + dy[i];
    int mx = x + dx[i];
    if(0 <= my && my < H && 0 <= mx && mx < W && board[my][mx] == '.') dfs(my,mx);
  }
}

int main(){
  int i,j;

  while(1){
    scanf("%d %d",&W,&H);
    if(W == 0 && H == 0) break;

    rep(i,H) cin >> board[i];

    res = 0;
    rep(i,H) rep(j,W) if(board[i][j] == '@') dfs(i,j);
    printf("%d\n",res);
  }

  return 0;
}

Measured memory_bytes: 0
N = int(input())
A = list(map(int, input().split()))

count = 0
for i in range(N):
    if A[i] < 0:
        count += 1

ans = 0
MIN = 10 ** 9
if count % 2:
    for i in range(N):
        ans += abs(A[i])
        MIN = min(abs(A[i]), MIN)
    ans = ans - 2 * MIN
else:
    for i in range(N):
        ans += abs(A[i])

print(ans)

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

int main() {
	// your code goes here
	int a,b;
	char op;
	  
	   while( 1 ){
	   	cin>>a>>op>>b;
	  if( op=='+' ){
	  cout<<a+b<<endl;}
	  if( op=='-'){
	 cout<<a-b<<endl;}
	  if( op=='*'){
	  cout<<a*b<<endl;}
	  if( op=='/' ){
	  cout<<a/b<<endl;}
	  if( op=='?' ){ break;
	  }
	  
	  
	  }
	   
	
	  
	return 0;
}

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

int main(){
  int h,w; cin>>h>>w;
  vector<vector<char>>A(h,vector<char>(w));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>A.at(i).at(j);
    }
  }
  vector<int>H;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
    	if(A.at(i).at(j)=='#'){
          H.push_back(i);
        }
    }
  }
  sort(H.begin(),H.end());
  H.erase(unique(H.begin(),H.end()),H.end());
  vector<vector<char>>B(H.size(),vector<char>(w));
  for(int i=0;i<H.size();i++){
    for(int j=0;j<w;j++){
      B.at(i).at(j)=A.at(H[i]).at(j);
    }
  }
  vector<int>W;
  for(int i=0;i<H.size();i++){
    for(int j=0;j<w;j++){
    	if(B.at(i).at(j)=='#'){
          W.push_back(j);
        }
    }
  }
  sort(W.begin(),W.end());
  W.erase(unique(W.begin(),W.end()),W.end());
  
  vector<vector<char>>C(H.size(),vector<char>(W.size()));
  for(int i=0;i<H.size();i++){
    for(int j=0;j<W.size();j++){
      C.at(i).at(j)=B.at(i).at(W[j]);
    }
  }
  for(int i=0;i<H.size();i++){
    for(int j=0;j<W.size();j++){
      cout<<C.at(i).at(j);
    }
    cout<<endl;
  }
}

Measured memory_bytes: 384
while 1:
	n = input()
	if n == 0:break
	D = range(1,7)
	ans = 1
	for i in range(n):
		c = raw_input()[0]
		if   c == "N": S = [1,5,2,3,0,4]
		elif c == "S": S = [4,0,2,3,5,1]
		elif c == "E": S = [3,1,0,5,4,2]
		elif c == "W": S = [2,1,5,0,4,3]
		elif c == "R": S = [0,2,4,1,3,5]
		elif c == "L": S = [0,3,1,4,2,5]
		D = [D[s] for s in S]
		ans += D[0]
	print ans

Measured memory_bytes: 4380
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  long S=0;
  cin >> N;
  
  for (int i = 1; i < N+1 ; i++) {
    if(i%3!=0&&i%5!=0){
      S += i;
    }
  }
    cout << S << endl;
}

Measured memory_bytes: 3648
#include "bits/stdc++.h"

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

typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef pair<P, P> PPP;

const ll MOD = 1e9 + 7;
const ll INF = 9e18;
const double DINF = 5e14;
const double eps = 1e-10;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second

int a, b, c, n;
string s, t;

int main() {
	cin >> a >> b;
	cout << a * b - (a + b - 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
int main() {
  int c1,c5,c10,c50,c100,c500;
  scanf("%d %d %d %d %d %d",&c1,&c5,&c10,&c50,&c100,&c500);
  int sum = c1*1 + c5*5 + c10*10 + c50*50 + c100*100 + c500*500;
  if(sum >= 1000) printf("1\n");
  else printf("0\n");
}

Measured memory_bytes: 1012
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tokenizer = new StringTokenizer(input.readLine());
        int [] a  = new int[3];
        for (int i = 0; i < 3; i++) {
            a[i] = Integer.parseInt(tokenizer.nextToken());
        }
        Arrays.sort(a);
        System.out.println((a[2]*10 + a[1] + a[0]));
    }
}


Measured memory_bytes: 20692
#include <stdio.h>

int main(void){
    int cnt,num;
    int min = 1000000;
    int max = -1000000;
    long int sum = 0;
    
    scanf( "%d" , &cnt );
    
    for( int i = 0; i < cnt ; i++ ){
        scanf("%d" , &num );
        if( num < min ) min = num;
        if( num > max ) max = num;
        sum += num;
    }
    printf( "%d %d %ld\n" , min , max , sum );
}


Measured memory_bytes: 2108
def main():
    *x, = map(int, input().split())
    print(x.index(0) + 1)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


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

#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define EPS (1e-7)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;

int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1e9+7;
const int INF=INT_MAX/2;
const int MAX=1e9;

int main(){
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	int sl=(int)s.size();
	int tl=(int)t.size();
	int same=0;
	for(int i=0;i<min(sl,tl);i++){
		bool ok=true;
		for(int j=0;j<=i;j++){
			if(s[sl-1-(i-j)]!=t[j]){
				ok=false;
				break;
			}
		}
		if(ok){
			same=i+1;
		}
	}
	cout<<sl+tl-same<<endl;
	return 0;
}


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

int main() {
  int n,m;
    cin >> n >> m;
    int ans = 0;
    if (n == 1 && m == 1){
        ans = 0;
    }else{
        int h = 1;
        int h2 = 1;
        rep(i,2) h*=(n-i);
        rep(i,2) h2*=(m-i);
        ans = h/2 + h2/2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP2_6_C
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = ReadInt();
            int[] line = ReadIntAr();
            Comparer comparer;

            int q = ReadInt();
            for (int i = 0 ; i < q ; i++)
            {
                int k = ReadInt();
                comparer = new Comparer(line,k);
                Console.WriteLine(BinarySearch(0, n-1, comparer));
            }
        }

        class Comparer : IComparer<int>
        {
            private int[] array;
            private int k;

            public Comparer(int[] array,int k)
            {
                this.array = array;
                this.k = k;
            }

            public int Compare(int x, int y)
            {
                return array[x].CompareTo(k);
            }
        }

        /// <summary>
        /// 二分探索
        /// -始点から終点までの整数列の中から、比較関数を満たす値を二分探索する
        /// 値が見つからない場合は、条件を満たす最小の数を返す
        /// </summary>
        /// <param name="left">始点</param>
        /// <param name="right">終点</param>
        /// <param name="comparer">比較関数</param>
        /// <returns></returns>
        public static int BinarySearch(int left, int right, IComparer<int> comparer)
        {

            int lo = left;
            int hi = right;
            while (lo <= hi)
            {
                int i = GetMedian(lo, hi);
                int c = comparer.Compare(i, 0);//yはダミーとして0固定
                if (c < 0) lo = i + 1;
                else hi = i - 1;
            }
            return lo;
        }
        private static int GetMedian(int low, int hi) { return low + ((hi - low) >> 1); }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }

}



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

struct Point{ int y,x; };

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

int main(void){
    int Y, X, K;
    cin >> Y >> X >> K;
    int sx,sy, gx,gy;
    cin >> sy >> sx >> gy >> gx;
    sx--,sy--,gx--,gy--;
    vector<string> s(Y);
    rep(y,Y) cin >> s[y];

    vector<vector<int>> dp(Y, vector<int>(X, INF));
    dp[sy][sx] = 0;
    queue<Point> qu;
    qu.push({sy,sx});
    while(qu.size()) {
        Point p = qu.front(); qu.pop();
        rep(dir,4){
            rep1(k,K){
                int ny = p.y + dy[dir]*k;
                int nx = p.x + dx[dir]*k;
                if (ny < 0 || nx < 0 || ny >= Y || nx >= X) break;
                if (s[ny][nx] == '@') break;
                if (dp[ny][nx] <= dp[p.y][p.x]) break;
                if (dp[ny][nx] > dp[p.y][p.x] + 1) {
                    dp[ny][nx] = dp[p.y][p.x] + 1;
                    qu.push({ny,nx});
                }
            }
        }
    }
    cout << ((dp[gy][gx] == INF) ? -1 : dp[gy][gx]) << endl;
    return 0;
}


Measured memory_bytes: 12152
import sys
readline = sys.stdin.readline

N, W = map(int, readline().split())
a = [(v, w) for _ in [None]*N for v, w in (map(int, readline().split()),)]

dp = [[0]*(W+1) for _ in [None]*(N+1)]
dp[0][0] = 0

weight = {0}
for i in range(N):
    item_value, item_weight = a[i]
    for w in weight.copy():
        dp[i+1][w] = dp[i+1][w] if dp[i+1][w] > dp[i][w] else dp[i][w]
        nvalue = dp[i][w] + item_value
        if w+item_weight <= W:
            dp[i+1][w+item_weight] = nvalue if nvalue > dp[i+1][w+item_weight] else dp[i+1][w+item_weight]
            weight.add(w+item_weight)

print(max(dp[N]))

Measured memory_bytes: 25096
def m_div(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

a,b = map(int, input().split())
lis = list(set(m_div(a)) & set(m_div(b)))
lis.sort()

anslis=[]

for num in lis[1:]:
    prime=True
    for p in anslis:
        if num % p == 0:
            prime=False
    if prime:
        anslis.append(num)
print(len(anslis)+1)

Measured memory_bytes: 40432
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n;
void dfs(ll num, bool seven, bool five, bool three, int& res){
    if(num > n)return;
    
    if(seven and five and three)res++;
    dfs(num*10+7, 1, five, three, res);
    dfs(num*10+5, seven, 1, three, res);
    dfs(num*10+3, seven, five, 1, res);
}

int main(){
   cin >> n;
   int res = 0;
   dfs(0, 0, 0, 0, res);
   cout << res << ln;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;
int r, D, x;
int p;

signed main(void) {
    cin >> r >> D >> x;
    rep(i,10){
        x = r*x - D;
        cout << x << endl;
    }

    return 0;
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REPE(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void chmax(T& a, T b) { if(a > b) a = b; }
template<class T> void chmin(T& a, T b) { if(a < b) b = a; }
typedef long long ll;

int main() {
    int n; cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            int tmp = abs(v[i] - v[j]);
            ans = max(ans, tmp);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

# ITP1_7_C

y,x=map(int,input().split())

M=list()
for i in range(y):
    R=list(map(int,input().split()))
    M.append(R)

for m in M:
    m.append(sum(m))

T=list()
for k in range(x+1):
    sum=0
    for j in range(y):
        sum+=M[j][k]
        
    # print(sum)
    T.append(sum)

M.append(T)
    
# print(M)

for s in range(y+1):
    print(" ".join(list(map(str,M[s]))))


Measured memory_bytes: 5704
a,b=map(int,input().split())
s=input()
y=0
#c=[0,1,2,3,4,5,6,7,8,9]
for i in range(a):
    if s[i] not in ["0","1","2","3","4","5","6","7","8","9"]:
        y+=1
if s[a]!="-":
    y+=1
for i in range(a+1,a+b+1):
    if s[i] not in ["0","1","2","3","4","5","6","7","8","9"]:
        y+=1
#print(y)
if y==0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
import java.math.BigDecimal

fun main(args: Array<String>) {
    abc089c()
}

fun abc089c() {
    val n = readLine()!!.toInt()
    val initials = (1..n).map { readLine()!![0] }

    val march = Array(5) { BigDecimal(0) }

    march[0] = BigDecimal(initials.count { it == 'M' })
    march[1] = BigDecimal(initials.count { it == 'A' })
    march[2] = BigDecimal(initials.count { it == 'R' })
    march[3] = BigDecimal(initials.count { it == 'C' })
    march[4] = BigDecimal(initials.count { it == 'H' })

    val patterns = (0..4).map { i ->
        (i + 1..4).map { j ->
            (j + 1..4).map { k ->
                march[i] * march[j] * march[k]
            }
        }.flatten()
    }.flatten()

    val answer = patterns.fold(BigDecimal.ZERO, BigDecimal::add)

    println(answer)
}


Measured memory_bytes: 37560
"""
// Author : snape_here - Susanta Mukherjee
     
 """
 
from __future__ import division, print_function
 
import os,sys
from io import BytesIO, IOBase
 
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
 
 
def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().split())
def li(): return list(mi())
 
 
def read():
    sys.stdin = open('input.txt', 'r')  
    sys.stdout = open('output.txt', 'w') 
 
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

def lcm(a , b):
    return (a*b)//gcd(a,b)

mod=1000000007

import math

import bisect

abc="abcdefghijklmnopqrstuvwxyz"

def main():

    s,w=mi()
    if w>=s:
        print("unsafe")
    else:
        print("safe")

# region fastio

 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()
 
 
if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
 
input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# endregion
 
 
if __name__ == "__main__":
    #read()
    main()

Measured memory_bytes: 63696
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int main() {
    
    ll n; cin >> n;
    cout << n << ":";
    for (ll nn = n, i = 2; i*i <= nn; i++) {
        while (n % i == 0) {
            cout << " " << i;
            n /= i;
        }
    }
    if (n > 1) {
        cout << " " << n;
    }
    cout << endl;
    
}


Measured memory_bytes: 3112
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
#include<cmath>
#include <numeric>
#include<iomanip>
#include <cstdint>

using namespace std;

int counter(int x) {
	if (x == 0) {
		return 0;
	}
	else {
		return counter(x >> 1) + (x & 1);
	}
}

int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	vector<vector<pair<int, int>>>v(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		for (int j = 0; j < a[i]; j++) {
			int x, y;
			cin >> x >> y;
			x--;
			v[i].emplace_back(x, y);
			//cout << v[i][0].second << endl;
		}
	}
	int ans = 0;
	for (int bits = 0; bits < (1 << n); bits++) {
		bool ok = true;
		for (int i = 0; i < n; i++) {
			if (!(bits & (1 << i))) {
				continue;
			}
			else {
				for (int j = 0; j < a[i]; j++) {
					if (((bits >> v[i][j].first) & 1) != v[i][j].second) {
						ok = false;
					}
				}
			}
		}
		if (ok) {
			ans = max(ans, counter(bits));
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	int t;
	Set<D> block, point;
	int[] dx = {-1, 0, 0, 1, 1, -1};
	int[] dy = {0, -1, 1, 0, 1, -1};
	Queue<D> queue = new LinkedList<D>();

	class D implements Comparable<D>{
		int x, y, k;

		D(int x, int y, int k) {
			this.x = x;
			this.y = y;
			this.k = k;
		}

		public int compareTo(D o) {
			if (this.x != o.x) {
				return this.x - o.x;
			}
			return this.y - o.y;
		}

		public String toString() {
			return "(" + x + ", " + y + ")";
		}
	}
	
	

	void bfs(int x, int y, int k) {
		if (t < k) {
			return;
		}
		D d = new D(x, y, k);
		if (point.contains(d)) {
			return ;
		}
		if (block.contains(d)) {
			return;
		}
		point.add(d);

		for (int i = 0; i < 6; i++) {
			int nx = x + dx[i];
			int ny = y + dy[i];
			queue.add(new D(nx, ny, k + 1));
		}

		while (!queue.isEmpty()) {
			D nd = queue.poll();
			bfs(nd.x, nd.y, nd.k);
		}
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		while (true) {
			t = sc.nextInt();
			int n = sc.nextInt();
			if ((t | n) == 0) {
				break;
			}
			block = new TreeSet<D>();
			point = new TreeSet<D>();
			for (int i = 0; i < n; i++) {
				int x = sc.nextInt();
				int y = sc.nextInt();
				block.add(new D(x, y, 0));
			}
			int ax = sc.nextInt();
			int ay = sc.nextInt();

			bfs(ax, ay, 0);
			System.out.println(point.size());
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int n, x, t;
    cin>> n>> x>> t;

    cout << (( n+x-1)/ x) * t<< '\n';

    return 0;
}




Measured memory_bytes: 3632
package main

import (
	"fmt"
	"strings"
)

func main() {
	var str string
	fmt.Scanln(&str)
	if len(str) == strings.Count(str, str[:1]) {
		//fmt.Println("case0")
		fmt.Println(0)
		return
	}
	if len(str) == 1 {
		//fmt.Println("case1")
		fmt.Println(0)
		return
	}
	if len(str) == 2 {
		if len(str) == strings.Compare(str[:1], Reverse(str[1:2])) {
			//fmt.Println("case2")
			fmt.Println(0)
		} else {
			//fmt.Println("case3")
			fmt.Println(1)
			return
		}
	}
	count := 0
	m := len(str) / 2
	switch len(str) % 2 {
	case 1:
		//fmt.Println("case4")
		left := str[:m]
		right := Reverse(str[m+1:])
		if strings.Compare(left, right) == 0 {
			fmt.Println(0)
		} else {
			j := 0
			for i := 0; i < len(left); i++ {
				if string(left[i]) == string(right[j]) {
					j++
					continue
				}
				//fmt.Println(left[i], right[j])
				count++
				j++
			}
			fmt.Println(count)
			return
		}
	case 0:
		//fmt.Println("case5")
		left := str[:m]
		right := Reverse(str[m:])
		if strings.Compare(left, right) == 0 {
			fmt.Println(0)
		} else {
			j := 0
			for i := 0; i < len(left); i++ {
				if string(left[i]) == string(right[j]) {
					j++
					continue
				}
				//fmt.Println(string(left[i]), string(right[j]))
				count++
				j++
			}
			fmt.Println(count)
			return
		}
	}
}

func Reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}


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

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


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

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



ll mod = 1e9+7;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<ll> a(n);
    ll ans = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        ans += a[i];
        ans %= mod;
    }
    ans *= (n-1);
    ans %= mod;


    for(int i = 60; i >= 0; i--){
        ll cnt = 0;
        for(int j = 0; j < n; j++){
            if((a[j] >> i) & 1) cnt++;
        }
        ll num = cnt * (cnt-1) / 2;
        num %= mod;
        ll sum = (1LL<<i);
        sum %= mod;
        sum *= num;
        sum %= mod;
        sum *= 2;
        sum %= mod;
        sum = mod - sum;
        ans += sum;
        ans %= mod;
    }


    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 2560
use std::io;
fn read_line() -> String {
    let mut line = String::new();

    io::stdin().read_line(&mut line)
        .expect("Failed to read line");
    return line;
}
fn to_i(s: &str) -> i32 {
    return s.trim().parse()
        .expect("Please type a number!");
}
fn gcd(a: i32, b: i32) -> i32 {
    let mut m = a;
    let mut n = b;
    if a<b {
        m = b;
        n = a;
    }

    if n == 0 {
        return m;
    }
    return gcd(n, m%n);
}
fn main() {
    /*
    println!("{:?}", gcd(2,3));
    println!("{:?}", gcd(2,4));
    println!("{:?}", gcd(1071,1029));
    */
    
    let line = read_line();
    let ab: Vec<&str> = line.split(' ').collect();

    let N: i32 = to_i(ab[0]);
    let X: i32 = to_i(ab[1]);
    
    let line2 = read_line();
    let l2 = line2.trim();
    //println!("l2:{:?}", l2);
    let items: Vec<&str> = l2.split(' ').collect();
    //println!("items:{:?}", items);

    let mut xx: Vec<i32> = Vec::new();
    xx.push(X);
    for item in items {
        xx.push(to_i(item));
    }
    xx.sort();

    //println!("{:?}", xx);
    let mut result = 1;
    for i in 1..xx.len() {
        let v0 = xx[(i-1) as usize];
        let v1 = xx[i as usize];
        let dv = v1-v0;
        //println!(" {} {:?}", i, dv);
        if (i==1) {
            result = dv;
        } else {
            result = gcd(result, dv);
        }
    }
    print!("{}", result);
}   

Measured memory_bytes: 8444
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    
    int max = Math.max(c, Math.max(a, b));
    
    if(a+b+c-max == max) {
    	System.out.println("Yes");
    }else {
    	System.out.println("No");
    }
}
}

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;

  int cnt[3] = {};
  for (int i = 0; i < N; i++) {
    int P;
    cin >> P;
    if (P <= A) cnt[0]++;
    else if (P <= B) cnt[1]++;
    else cnt[2]++;
  }

  cout << min(min(cnt[0], cnt[1]), cnt[2]) << endl;
}

Measured memory_bytes: 256
#if 0

#endif

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int N;
int gx, gy;
int p;
int T[15+10][15+10];
int FL[15+10][15+10];
int FU[15+10][15+10];

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    for (int x = 0; x < 15+10; x++) {
      for (int y = 0; y < 15+10; y++) {
        T[x][y] = (x == 0 && y == 0); FL[x][y] = (x != 0); FU[x][y] = (y != 0);
      }
    }
    cin >> gx >> gy >> p;
    int x1, y1, x2, y2;
    for (int j = 0; j < p; j++) {
      cin >> x1 >> y1 >> x2 >> y2;
      if (x1 == x2)
        FU[max(x1, x2)][max(y1, y2)] = false;
      if (y1 == y2)
        FL[max(x1, x2)][max(y1, y2)] = false;
    }
    for (int x = 0; x <= gx; x++) {
      for (int y = 0; y <= gy; y++) {
        if (!(x == 0 && y == 0)) {
          T[x][y] = (FL[x][y] ? T[x-1][y] : 0) + (FU[x][y] ? T[x][y-1] : 0);
        }
      }
    }
    cout << (T[gx][gy] ? to_string(T[gx][gy]) : "Miserable Hokusai!") << endl;
  }
}



Measured memory_bytes: 3112
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <climits>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

// n, sum_w
// dp[i][sum_w] : i番目（0-index）で
ll dp[101][100001] = {0};

int main() {

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

  int N, W;
  cin >> N >> W;
  vector<ll> w(N), v(N);
  for (int i = 0; i < N; ++i) {
    cin >> w[i] >> v[i];
  }

  // DP
  for (int i = 0; i < N; ++i) {
    for (int sum_w = 0; sum_w <= W; ++sum_w) {
      // i 番目の品物を選ぶ場合
      if (sum_w - w[i] >= 0) {
        dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - w[i]] + v[i]);
      }
      // i 番目の品物を選ばない場合
      dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w]);
    }
  }

  cout << dp[N][W];
  return 0;
}

Measured memory_bytes: 78336
inp = [input() for i in range(2)]
uu = int(float(inp[0]))
K = int(uu)
A,B = inp[1].split()
A,B = int(float(A)),int(float(B))
c,bbb = 0,0
if 1<= A <= B <= 1000 and 1<= K <= 1000:
  for h in range(A,B,1):
    c = h % K
    if c == 0:
      bbb += 1
  if bbb > 0:
    print('OK')
  elif K == 1:
    print('OK')
  elif K ==A or K ==B:
    print('OK')
  elif A % K == 0 or B % K == 0:
    print('OK')
  else:
    print('NG')

Measured memory_bytes: 9168
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;

int main() {

    int a, b, x;
    cin >> a >> b >> x;
    
    if (a+b >= x && a <= x)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
        

}

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

int main(){
    ll n,k,q;
    cin >> n >> k >> q;
    vector<ll> a(q);
    vector<ll> p(n);
    rep(i,q){
        cin >> a[i];
    }
    rep(i,n){
        p[i] = k;
    }
    rep(i,q){
        ll& x = a.at(i);
        p[x-1]++;
    }
    rep(i,n){
        p[i] -= q;
    }
    rep(i,n){
        if(p[i] > 0){
            cout << "Yes" << endl;
        }
        if(p[i] <= 0){
            cout << "No" << endl;
        }
    }
}

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

using namespace std;

char s[100005];

int main() {
    scanf("%s", s);

    int l = strlen(s);

    int res = 0;
    int cur = 0;

    for (int i = 0; i < l; i++) {
        if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') cur++;
        else cur = 0;
        res = max(res, cur);
    }

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



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

int main(){

    int A, B, C, K;
    cin >> A >> B >> C >> K;

    if(K<=A){
        cout << K << endl;
    }
    else if(A<=K&&K<=A+B){
        cout << A << endl;
    }
    else if(A+B<=K){
        cout << 2*A + B -K << endl;
    }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;

int main() {
  int n, need;
  cin >> n >> need;
  vector<ll> x(n), y(n);
  rep(i, n) {
    cin >> x[i] >> y[i];
  }
  ll ans = LLONG_MAX;
  rep(i, n) {
    rep(j, n) {
      rep(k, n) {
        rep(s, n) {
          ll l = x[i];
          ll r = x[j];
          ll u = y[k];
          ll d = y[s];
          int cnt = 0;
          rep(kk, n) {
            if(l <= x[kk] && x[kk] <= r && d <= y[kk] && y[kk] <= u) cnt++;
          }
          if(cnt >= need) ans = min(ans, abs(r - l) * abs(u - d));
        }
      }
    }
  }
  cout << ans << endl;

}

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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr ll mod = static_cast<ll>(1e9 + 7);

std::string s;
int main() {
	std::cin >> s;

	bool check = false;
	for (int i = 0, end = s.size() - 1; i < end; i++)
		if (s[i] == s[i + 1])
			check = true;

	if (check)
		std::cout << "Bad" << std::endl;
	else
		std::cout << "Good" << std::endl;
	return 0;
}


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

int main() {
    int A, B;
    cin >> A >> B;

    int ans = 0;
    if (A > B) {
        ans += A;
        A--;
    } else {
        ans += B;
        B--;
    }

    ans += max(A, B);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
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<<" ";
    }
    return s;
}

// 2 dimentional vector
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;
}

bool is_prime(ll x) {
    for(ll i=2; i*i<=x; i++) {
        if (x % i == 0) {
            return false;
        }
    }
    return true;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    cin>>x;
    ll ans=x;
    for(ll i=x; i<100004; i++) {
        if (is_prime(i) == true) {
            ans = i;
            break;
        }
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
//Reference: editorial (#5640467)
#include<bits/stdc++.h>
//macros
using namespace std;
typedef long long ll;
typedef pair<int, int > Pii;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
#define pb push_back
#define rs resize 
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define repll(i, a, b) for(ll i=(a); i<(b); i++)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define COUT(a) cout << a << endl
#define ALL(a) (a).begin(),(a).end()
const long long int mod = 1e9 + 7;
Vi k(0); 
Vi P(0);
vector<vector<int> > S;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false); 
    int N,M;
    cin >> N >> M;
    k.rs(M);P.rs(M);S.rs(M);

    rep(i,0,M){
        cin >> k[i];
        S[i].rs(k[i]);
        rep(j,0,k[i]){
            cin >> S[i][j];
            S[i][j]--;
        }
    }
    rep(i,0,M) cin >> P[i];
    
    int ans=0;
    rep(i,0,(1<<N)){//2^N個の状態の列挙
        bool all_light = true;
        rep(j,0,M){//M個のライトの状態の確認
            int each_light=0;//j番目のlightに繋がったswitch onの総数
            for(auto id : S[j]){
                //iとのANDを取ることで、2^N通りの部分集合を試すことが出来る
                if((i>>id) & 1) each_light++;
            }
            each_light%=2;
            if(each_light!=P[j]) all_light=false;
        }
        if(all_light) ans++;
    }
    COUT(ans);
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
  
   input = input.split("\n");
  var n= parseInt(input[0], 10);
 
   var tmp = input[1].split(" ");
     var c = [];
for (var i = 0; i <n ; i++){
  var r= parseInt(tmp[i], 10);
 
  c[i] = r;}
  
// console.log(a);
 
  c.sort((a, b) => a - b);
 
//a.sort();
//console.log(a);
 

 var t = c[0];
  for ( i = 0;i < n-1 ;i++){var t = (t+ c[i+1])/2;
     }
  
  console.log(t);
                          
 
  
}
 
  
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  

Measured memory_bytes: 21064
n=int(input())
a=n//1.08
from math import floor as f
p=[a,a-1,a+1,a-2,a+2]
c=[]
for i in p:
    if f(i*1.08)==n:
         c.append(i)
if len(c)==0:
    print(":(")
else:
    print(int(c[0]))

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#include <bitset>
#include <iomanip>
#include <map>
#include <queue>
#include <numeric>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define reps(i,s,e) for(int i=s; i<(int)e; i++)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Graph = vector<vector<T>>;

const int INT_BIG = ~(1<<28);

void printFixedDouble(double d, int fix) {
    cout << std::fixed;
    cout << std::setprecision(fix) << d << endl;
}

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

    ll yen = 100;
    int n = 0;
    while (yen < X) {
        yen *= 1.01;
        n++;
    }

    cout << n << endl;
}

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

using namespace std;
#define ll long long
#define M 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);

int main() {
	int n;
	cin>>n;
	long ans=n*n*n;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  string s;
  cin>>s;
  if(s[k-1]=='A')	s[k-1]='a';
  if(s[k-1]=='B')	s[k-1]='b';
  if(s[k-1]=='C')	s[k-1]='c';
  cout<<s<<endl;
  return 0;
}
  


Measured memory_bytes: 256