akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScan in = new MyScan(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, MyScan in, PrintWriter out) {
            int n = in.nextInt();
            int[] data = new int[n];
            for (int s = 0; s < n; s++) {
                data[s] = in.nextInt() - s - 1;
            }
            Util.sort(data);

            int m = data[n / 2];
            long res = 0;
            for (int s : data) {
                res += Math.abs(s - m);
            }

            out.println(res);
        }

    }

    static class Util {
        public static void sort(int[] data) {
            Integer[] v = new Integer[data.length];
            for (int s = 0; s < data.length; s++) {
                v[s] = data[s];
            }
            Arrays.sort(v);

            for (int s = 0; s < data.length; s++) {
                data[s] = v[s];
            }
        }

    }

    static class MyScan {
        private final InputStream in;
        private byte[] inbuf = new byte[1024];
        public int lenbuf = 0;
        public int ptrbuf = 0;

        public MyScan(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (lenbuf == -1) throw new InputMismatchException();
            if (ptrbuf >= lenbuf) {
                ptrbuf = 0;
                try {
                    lenbuf = in.read(inbuf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (lenbuf <= 0) return -1;
            }
            return inbuf[ptrbuf++];
        }

        public int nextInt() {
            int num = 0, b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = num * 10 + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

    }
}



Measured memory_bytes: 26760
N,M = map(int,input().split())
A = [];B = []
for i in range(N):
  temp = str(input())
  temp = list(temp)
  A.append(temp)
for i in range(M):
  temp = str(input())
  temp = list(temp)
  B.append(temp)
#print(A,B)
for i in range(N-M+1): #0~N-M
  for j in range(N-M+1): 
    Flag = True
    for p in range(M):
      for q in range(M):
        #print(i+p,j+q,p,q)
        if A[i+p][j+q] != B[p][q]:
          Flag = False
    if Flag:
      print("Yes")
      exit()
print("No")

Measured memory_bytes: 9160
#include <iostream>
#include <vector>

int main()
{
    long long n, k;
    std::cin >> n >> k;

    std::vector<int> a(n);
    const long long mod = 1000000007;

    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }

    long long p = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i; j < n; j++) {
            if (a[i] > a[j]) {
                p++;
                p %= mod;
            }
        }
    }
    long long q = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[i] > a[j]) {
                q++;
                q %= mod;
            }
        }
    }

    long long ans = p * k % mod;

    long long q_ans = k * (k - 1) / 2 % mod;
    q_ans *= q;
    q_ans %= mod;
    ans += q_ans;
    ans %= mod;
    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include <stdio.h>
t[101],a,i,M;
int main(void){
    for(;~scanf("%d",&a);){
        t[a]++;
        if(M<t[a]){
            M=t[a];
        }
    }
    for(;++i%99;){
        M-t[i]?:printf("%d\n",i);
    }
}

Measured memory_bytes: 1724
N,K=map(int,input().split(' '))
A=list(map(lambda x:int(x)-1,input().split(' ')))
roop=[0]
flg = [0 for i in range(N)]
flg[0]=1
n = A[0]
for i in range(2,N+1):
    if flg[n]==0:
        roop.append(n)
        flg[n] = i
        n = A[n]
    else:
        end=i
        break
if K <len(roop):
    print(roop[K]+1)
else:
    K-=flg[n]-1
    K%=(end-flg[n])
    roop=roop[flg[n]-1:end]
    print(roop[K]+1)

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

int main(){
    long long T1, T2;
    scanf("%lld%lld", &T1, &T2);

    long long A1, A2, B1, B2;
    scanf("%lld%lld%lld%lld", &A1, &A2, &B1, &B2);

    assert(A1 != B1 && A2 != B2);

    long long distDiff1 = (A1-B1)*T1;
    long long distDiff2 = (A2-B2)*T2;

    if(distDiff1 == -distDiff2){
        printf("infinity");
        return 0;
    }

    if(distDiff1 > 0 && distDiff2 > 0){
        printf("0");
        return 0;
    }else if(distDiff1 < 0 && distDiff2 < 0){
        printf("0");
        return 0;
    }

    if(distDiff1 > 0 && distDiff2 < 0){
        distDiff1 = -distDiff1; distDiff2 = -distDiff2; // assume that distDiff1 < 0 && distDiff2 > 0
        // same thing happens when signs are flipped
    }
    long long totalDist = distDiff1+distDiff2;
    //printf("debug: %lld %lld %lld\n", distDiff1, distDiff2, totalDist);
    if(totalDist < 0){
        printf("0");
        return 0;
    }

    long long temp1 = (-distDiff1)/totalDist;
    long long rem = (-distDiff1)%totalDist;
    if(rem == 0){
        printf("%lld", temp1*2);
        return 0;
    }else{
        printf("%lld", temp1*2+1);
        return 0;
    }

    return 0;
}


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

template<class T> void chmax(T &a, T b) {
    if (a < b) a = b;
}

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> weight(N), value(N);
    for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];

    vector<vector<long long>> dp(N+1, vector<long long>(W+1, 0));
    for (int i = 0; i < N; ++i) {
        for (int w = 0; w <= W; ++w) {
            chmax(dp[i+1][w], dp[i][w]);
            if (w + weight[i] <= W) {
                chmax(dp[i+1][w + weight[i]], dp[i][w] + value[i]);
            }
        }
    }
    cout << dp[N][W] << endl;
}


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

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

  vector<ll> p(n);
  for (ll i = 0; i < n; i++) {
    cin >> p[i];
  }
  
  double sum = 0;
  for (ll i = 0; i < k; i++) {
    sum += (p[i] + 1.0) / 2;
  }

  double maxsum = sum;
  for (ll i = 0; i < n - k; i++) {
    sum = sum - (p[i] + 1.0) / 2 + (p[i + k] + 1.0) / 2;
    if (maxsum < sum) maxsum = sum;
  }

  printf("%.8f\n", maxsum);
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
using namespace std;
int main()
{     long long n,a,b;
      cin>>n>>a>>b;
	  long long sum;
	  sum=(n-2)*(b-a)+1;
	  if(sum<=0)cout<<0<<endl;
	    else cout<<sum<<endl;
	  return 0;
}

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

int main()
{
    string s;
    int y1, x1, y2, x2;

    while( cin >> s )
    {
        if( s == "#" )
            break;

        cin >> y1 >> x1 >> y2 >> x2;

        y1--; x1--; y2--; x2--;
        int h = 1, w = 0;
        for( int i = 0; i < s.size(); i++ )
        {
            if( s[i] == '/' )
                h++;
            if( h < 2 && s[i] == 'b' )
                w++;
            else if( h < 2 )
                w += ( s[i] - '0' );
        }

        int a = 0, b = 0;
        string t[h][w];
        for( int i = 0; i < s.size(); i++ )
        {
            if( s[i] == '/' )
            {
                a++;
                b = 0;
                continue;
            }
            if( s[i] == 'b' )
            {
                t[a][b] = 'b';
                b++;
            }
            else
                while( s[i] != '0' )
                {
                    t[a][b] = '.';
                    b++;
                    s[i]--;
                }
        }

        string temp = t[y1][x1];
        t[y1][x1] = t[y2][x2];
        t[y2][x2] = temp;

        string res = "";
        char num = '0';
        for( int i = 0; i < h; i++ )
        {
            for( int j = 0; j < w; j++ )
            {
                if( num == '0' && t[i][j] == "b" )
                    res += "b";
                else if( num != '0' && t[i][j] == "b" )
                {
                    res += num;
                    res += "b";
                    num = '0';
                }
                else
                    num++;
            }
            if( num != '0' )
            {
                res += num;
                num = '0';
            }
            res += "/";
        }
        cout << res.substr( 0, res.size() - 1 ) << endl;
    }
    return 0;
}


Measured memory_bytes: 3136
mass = input()
s1 = int(mass[0])
s2 = int(mass[1])
s3 = int(mass[2])
c = 0
if s1 == 1:
  c += 1
if s2 == 1:
  c += 1
if s3 == 1:
  c += 1
print(c)

Measured memory_bytes: 9052
N = int(input())
D = {}
for _ in range(N):
    s = input()
    r = ''.join(sorted([c for c in s]))
    if r in D:
        D[r] += 1
    else:
        D[r] = 1
ans = 0
for v in D.values():
    ans += v*(v-1)//2
print(ans)


Measured memory_bytes: 17888
a,b=map(int,input().split())

#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

print(lcm(a,b))

Measured memory_bytes: 9144
N = int(input())
s = input()
t = input()

if s == t:
    print(N)
    exit(0)

for i in range(N):
    #print(s[i:], t[:N-i])
    if s[i:] == t[:N-i]:
        print(N*2-(N-i))
        exit(0)
print(N*2)

Measured memory_bytes: 3060
//
// Created on 2020/03/28.
//

//#include <bits/stdc++.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    string ans;
    string s;
    cin>>s;


    if(s[2] == s[3] && s[4] == s[5]){
        ans = "Yes";
    }else{
        ans = "No";
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<math.h>
#include <bits/stdc++.h>
using namespace std;


int main(){
    int n,k;
    cin>>n>>k;
    vector<int> p;
    int x;
    for(int i=0;i<n;i++){
        cin>>x;
        p.push_back(x);
    }
    int sum=0;
    for(int i=0;i<k;i++){
        int min=10000000;
        int ind=10000000;
        for(int j=0;j<p.size();j++){
            if(min>p[j]){
                min=p[j];
                ind=j;
            }
        }
        p.erase(p.begin()+ind);
        sum+=min;

    }
    cout<<sum<<endl;
    return 0;

}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n, k; std::cin >> n >> k;
  vi a(n); rep(i, n) std::cin >> a[i];
  n--, k--;
  std::cout << (n + (k - 1)) / k << "\n";
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
int INF = numeric_limits<int>::max() / 2;
using ll = long long;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	ll ans = 0;
	vector<int> a(n);
	for(int i = 0; i< n; i++){cin >> a[i]; ans += a[i];}
	cout << ans - n << endl;
	return 0;
}

Measured memory_bytes: 256
using System;

namespace Dice
{
    class Program
    {
        private static bool Eql(string[] x, string[] y)
        {
            var g = true;
            for (int o = 0; o < x.Length; o++)
              if (x[o] != y[o]) g = false;
            return g;
        }

        private static bool Check(string[] x, string[] y)
        {
            if (Eql(x, y)) return true;
            for (int p = 0; p < 2; p++)
            {
                for(int q = 0; q < 4; q++)
                {
                    var a = x[0]; var b = x[1]; var c = x[2];
                    var d = x[3]; var e = x[4]; var f = x[5];
                    x = p == 0 ? new string[] { e, a, c, d, f, b } :
                                 new string[] { d, b, a, f, e, c };
                    if (Eql(x, y)) return true;
                    var h = x;
                    for(int r = 0; r < 4; r++)
                    {
                        var i = h[0]; var j = h[1]; var k = h[2];
                        var l = h[3]; var m = h[4]; var n = h[5];
                        h = new string[] { i, k, m, j, l, n };
                        if (Eql(h, y)) return true;
                    }
                }
            }
            return false;
        }

        static void Main()
        {
            int s = int.Parse(Console.ReadLine());
            var t = new string[s][];
            for(int u = 0; u < s; u++)
                t[u] = Console.ReadLine().Split(' ');
            for (int v = 0; v < s; v++)
                for (int w = v + 1; w < s; w++)
                    if (Check(t[v], t[w]))
                    {
                        Console.WriteLine("No");
                        return;
                    }
            Console.WriteLine("Yes");
        }
    }
}

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

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 * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, m;
  cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  int cnt = 0;
  fi(0, n) {
    string s;
    cin >> s;
    fj(0, m) {
      if(s[j] == '#')
        cnt++;
    }
  }
  if(cnt == n + m - 1)
    cout << "Possible\n";
  else
    cout << "Impossible\n";
  // cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()

const int MOD = 1e9+7;

signed main() {
    std::ios_base::sync_with_stdio(0); 
    std::cin.tie(0);
	int n,k;
	std::cin >> n >> k;
	std::vector<int> a(n);
	rep(i,n) std::cin >> a[i];
	std::vector<int> b = a;
	std::sort(all(b));
	// std::lower_bound(all(b),x)-b.begin()

	int count = 0;
	for(int i:b) {
		int x = k*(k-1)/2%MOD;
		count += x*(std::lower_bound(all(b),i)-b.begin());
		count%=MOD;
	}

	rep(i,n) rep(j,n) {
		if(i<j&&a[i]>a[j]) {
			count += k;
			count%=MOD;
		}
	}

	print(count);


	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())


def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
print(len(str(Base_10_to_n(N, K))))

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)turn idx;
#define deg_to_rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad_to_deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)

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

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

typedef pair<int, int> P;

int main() {
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int> (n-1));
  rep(i, 0, n) {
    rep(j, 0, n-1) {
      cin >> a[i][j];
      a[i][j]--; // 選手番号を0スタートに調整
    }

    reverse(All(a[i])); // 先頭の削除が遅いので逆順にしとく
  }

  vector<P> q; // que

  // main関数内でも関数定義できる
  auto check = [&](int i) { // 選手iが試合できるかをcheckしてできる場合queに入れる
    if (a[i].size() == 0) return; // 対戦できない
    int j = a[i].back(); // vectorの末尾の要素を取得（iの次の対戦相手

    if (a[j].size() == 0) return; // 相手jと対戦できない
    if (a[j].back() == i) { // 対戦相手jの次の対戦相手が自分（i）の場合
      P p(i, j);
      // 重複をなくす（p.firstの方が小さいようにする）後の(1)より
      if (p.second < p.first) swap(p.first, p.second);
      q.pb(p);
    }
  };

  rep(i, 0, n) {
    check(i);
  }

  int day = 0;
  while (q.size() > 0) {
    day++;
    sort(All(q));
    q.erase(unique(All(q)), q.end()); // 重複を削除(1)
    vector<P> prevQ;
    swap(prevQ, q); // vectorのswapは高速（定数計算量とみることができる）
    for (P p: prevQ) { // 試合を消化
      int i = p.first, j = p.second;
      a[i].pop_back();
      a[j].pop_back();
    }
    for (P p: prevQ) { // 試合を消化した後に次にできる試合をcheck
      int i = p.first, j = p.second;
      check(i);
      check(j);
    }

    // prevQ, qは高々試合数O(N^2)しかない!
  }

  rep(i, 0, n) {
    if (a[i].size() != 0) {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << day << endl;
  return 0;
};


Measured memory_bytes: 4224
#ABC122B
def main():
    import sys
    S = sys.stdin.readline().rstrip()
    #print(S)
    L = ['A', 'C', 'G', 'T']
    cnt, ans = 0, 0
    for s in S:
        if s in L:
            cnt+=1
        else:
            if ans < cnt:
                ans = cnt
            #print(ans)
            cnt=0
    else:
        if ans < cnt:
            ans = cnt
    print(ans)


if __name__=='__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
vector<int> abc(3, 0);
int main() {
    for(int i = 0; i < 3; ++i) {
        cin >> abc.at(i);
    }

    int cnt = 0;

    while(1) {
        sort(abc.begin(), abc.end());
        if(abc.at(0) == abc.at(2)) break;
        if(abc.at(0) < abc.at(2) && abc.at(1) < abc.at(2)) {
            abc.at(0)++; abc.at(1)++;
            cnt++;
        }else {
            abc.at(0) += 2;
            cnt++;
        }
    }

    cout << cnt << endl;
}

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

int main(void){
  int a,b,c,sum,x,y,z;
  cin >> a >> b >> c;
  x = abs(a-b);
  y = abs(a-c);
  z = abs(b-c);
  sum = x+y+z;
  cout << sum-max(x,max(y,z)) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
#include <numeric>
using namespace std;

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

int N, M;
vector<int> e[5002];
int in[5002];

vector<int> L;
bool visited[5002];

void visit(int id) {
  if (visited[id]) return;
  visited[id] = true;
  rep(i,e[id].size()) {
    visit(e[id][i]);
  }
  L.push_back(id);
}

int main() {
  while (cin >> N >> M) {
    memset(in, 0, sizeof in);
    rep(i,N) e[i].clear();
    
    rep(i,M) {
      int x, y;
      cin >> x >> y;
      --x; --y;
      e[y].push_back(x);
      in[x]++;
    }
    
    L.clear();
    memset(visited, 0, sizeof visited);
    
    rep(i,N) visit(i);

    rep(i,N) printf("%d\n", L[i]+1);

    bool multi = false;
    rep(i,N-1) {
      int cur = L[i], nxt = L[i+1];
      if (find(e[nxt].begin(), e[nxt].end(), cur) == e[nxt].end()) {
        multi = true;
      }
    }
    printf("%d\n", multi);
  }
  return 0;
}

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

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

Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            double a = in.nextInt(), b = in.nextInt(), x = in.nextInt();
            double h = x / (a * a);
            double ans = 0;
            if (h >= b / 2) {
                double p = (2 * x) / (a * a) - b;
                ans = Math.PI / 2 - Math.atan(a / (b - p));
            } else {
                double p = (2 * a * h) / (b * b);
                ans = Math.PI / 2 - Math.atan(p);
            }
            out.printLine(Math.toDegrees(ans));
        }

    }

    static class OutputWriter {
        PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tokenizer = null;

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(in.readLine());
                }
                return tokenizer.nextToken();
            } catch (IOException e) {
                return null;
            }
        }

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

    }
}



Measured memory_bytes: 22740
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        if (500 * k >= x) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 21844
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>

using namespace std;

int main(void)
{
    int a,b;
    cin >>a >>b;

    int diff = abs(a-b);
    if(diff % 2){
        printf("IMPOSSIBLE\n");
    }else{
        int less = min(a, b);
        int large = max(a, b);
        printf("%d\n", less + (large - less) / 2);
    }
    return 0;
}

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

int main()
{
    int n,m;
    cin >> n >> m;
    int height[n+1];
    for (int q = 1; q <= n; q++)
    {
        cin >> height[q];
    }
    vector<bool> good(n+1, true);
    for (int q = 0; q < m; q++)
    {
        int a,b;
        cin >> a >> b;
        if (height[a] == height[b])
        {
            good[a] = false;
            good[b] = false;
            continue;
        }
        if (height[a] < height[b])
        {
            good[a] = false;
        }
        else
        {
            good[b] = false;
        }
    }
    int tot = 0;
    for (int q = 1; q <= n; q++)
    {
        if (good[q])
        {
            tot++;
        }
    }
    cout << tot;
}


Measured memory_bytes: 4012
def solve():
    n = int(input())
    x = [0 for _ in range(n)]
    y = [0 for _ in range(n)]
    h = [0 for _ in range(n)]
    for i in range(n):
        x[i], y[i], h[i] = map(int, input().split())
        if h[i]:
            xn, yn, hn = x[i], y[i], h[i]

    for cx in range(101):
        for cy in range(101):
            H = hn + abs(xn - cx) + abs(yn - cy)
            if all(h[i] == max(H - abs(x[i] - cx) - abs(y[i] - cy), 0) for i in range(n)):
                print(cx, cy, H)


if __name__ == '__main__':
    solve()


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

        using namespace std;

        typedef long long ll;
        const ll N = 1e6+5;
        const ll MOD = 1000000007;
        #define all(x) x.begin(),x.end()
        #define pii pair<ll,ll>
        #define pis pair<ll,string>
        #define F first
        #define S second
        #define LCM(a,b) ((a*b)/__gcd(a,b))
        #define inf 1e15
        #define test ll cse;cin>>cse;for(ll _i=1;_i<=cse;_i++)
        #define PI 3.14159265
        #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
        const double EPS = 1E-9;
        typedef vector< vector<double> > matrix;
        typedef vector<int> vi;


ll modexp(ll x, ll n){
    ll res = 1LL;
    while(n > 0){
        if(n&1) res = (res * x) % MOD;
        x = (x * x) % MOD;
        n >>= 1;
    }
    return res;
}

int main(){

    fast;
    ll n;
    cin >> n;

    if(n < 2) cout << 0 << "\n";
    else {
        ll A = modexp(10, n) % MOD;
        ll B = modexp(9, n) % MOD;
        ll C = modexp(8, n) % MOD;

        cout << (A - B - B + C + MOD + MOD) % MOD << "\n";
    }

    return 0;
}


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

int main(){
  cout << fixed << setprecision(12);

  double  r;
  cin>>r;

  double PI = acos(-1);
  double area = r * r * PI;
  double cir = (r + r) * PI;
  cout<<area<<" "<<cir<<endl;

  return 0;
}



Measured memory_bytes: 3260
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    string s;
    int i, ans=0;

    cin >> s;

    for(i=0; i<6; i++){
        if(s[i] == '1'){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

max_value = sum((p_i + 1) / 2 for p_i in p[:k])
cur = max_value
for i in range(k, n):
    cur += ((p[i] + 1) / 2 - (p[i-k] + 1) / 2)
    max_value = max(max_value, cur)
print(max_value)


Measured memory_bytes: 25060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <math.h>

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

typedef int long long ill;
typedef int long il;

using namespace std;

#define N 100
#define L 100
int n, l;

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

    cin >> n >> l;
    vector<string> s;
    REP(i, n)
    {
        cin >> ss;
        s.push_back(ss);
    }
    sort(s.begin(), s.end());
    REP(i, n)
    {
        cout << s[i];
    }
    cout << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args){
    	
    	try {
    		InputStreamReader isr = new InputStreamReader(System.in);
    		BufferedReader br = new BufferedReader(isr);
    		String buf = br.readLine();
    		StringTokenizer st=new StringTokenizer(buf," ");
    		int a = Integer.parseInt(st.nextToken());
    		int b = Integer.parseInt(st.nextToken());
    		int c = Integer.parseInt(st.nextToken());
    		int x;
    		if(a > b){
    			x=b;
    			b=a;
    			a=x;
    		}
    		if(b > c){
    			x=c;
    			c=b;
    			b=x;
    		}
    		if(a > b){
    			x=b;
    			b=a;
    			a=x;
    		}
    		System.out.println(a+" "+b+" "+c);
    	} catch(IOException e) {
		    System.err.println(e);
		}
    }
}

Measured memory_bytes: 17044
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*約数の個数(x含む)*/ll divi(ll x){ll i,ans=0;rep(i,2,x+1){if(x%i==0){ans++;}}return ans;}
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
llfor;ll ans=0;///////////////////////////////////////////
ll x,y,n;
bool path[2010][2010];
int main(){
 sc(n);sc(x);sc(y);
 rep(i,0,n+1){rep(j,0,n+1){path[i][j]=0;}}
 rep(i,1,n+1){path[i+1][i]=1;path[i][i+1]=1;}
 path[x][y]=true;path[y][x]=true;
 ll ans[n+1]={0};
 
 ll a,b;
 rep(a,1,n+1){
  rep(b,a+1,n+1){
   //printf("-----%lld %lld %lld\n",a,b,search(a,b));
   ans[min(b-a, 1+abs(a-x)+abs(b-y))]++;
  }
 }
  
 rep(i,1,n)pr(ans[i]);


return 0;}

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

int main() {
    int64_t N, b;
    cin >> N;
    vector<int64_t> A(N), a(2);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    sort(A.begin(),A.end());
    reverse(A.begin(),A.end());
    for (int i = 0; i < N - 1; i++) {
        if (A.at(i) == A.at(i + 1) && A.at(i)){
            a.at(b) = A.at(i);
            i++;
            b++;
        }
        if (b == 2){
            break;
        }
    }
    cout << a.at(0) * a.at(1) << endl;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
    string s;
    cin >> s;
    if(s == "SUN") cout << "7" << endl;
    else if(s == "MON") cout << "6" << endl;
    else if(s == "TUE") cout << "5" << endl;
    else if(s == "WED") cout << "4" << endl;
    else if(s == "THU") cout << "3" << endl;
    else if(s == "FRI") cout << "2" << endl;
    else if(s == "SAT") cout << "1" << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int x = sc.nextInt();
		final int n = sc.nextInt();
		int result = 110;
		int[] arr = new int[110];
		if(n != 0) {
			for(int i = 0; i < n; i++) {
				int tmp = sc.nextInt();
				arr[tmp] = tmp;
			}
			int minAbs = 110;
			for(int i = 0; i <= 101; i++) {
				int abs = Math.abs(x - i);
				if(arr[i] == 0 && abs < minAbs) {
					minAbs = abs;
					result = i;
				}
			}
		} else {
			result = x;
		}
		System.out.println(result);
	}

}


Measured memory_bytes: 35932
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,m;
    cin>>n>>m;
    int line[100][100]={{}};//０〜９９の１００マス計算
    for(int s=0;s<n;s++)
    {
        for(int t=0;t<m;t++)
        {
            cin>>line[s][t];
        }
    }
    int tate[100][1]={{}};
    for(int u=0;u<m;u++)
    {
        cin>>tate[u][0];
    }
    for(int v=0;v<n;v++)
    {
        int S1={};
        for(int w=0;w<m;w++)
        {
            S1+=line[v][w]*tate[w][0];
        }
        cout<<S1<<endl;
    }
}


Measured memory_bytes: 3144
// ----------------------------------------------------------
#if 0
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
#else
#include <bits/stdc++.h>
#endif

using namespace std;

typedef long long LL;
typedef unsigned int UI;
typedef long double LD;

const LL MOD = (LL)1000000007;
const LL LL_INF = (LL)1 << 62;
const int INT_INF = (int)1 << 30;

#define rSort(a) 		sort(a.rbegin(),a.rend())
#define Sort(a) 		sort(a.begin(),a.end())
#define Reverse(a) 		reverse(a.begin(),a.end())
#define Sum(a)  		accumulate(a.begin(), a.end(), 0)
#define REP(i, n) 		for(UI i = 0;i < n;i++)
#define REPR(i, n) 		for(UI i = n;i >= 0;i--)
#define FOR(i, m, n) 	for(UI i = m;i < n;i++)
#define pb(i) 			push_back(i)
#define SWAP(x,y) 		((x!=y)&&(x^=y,y^=x,x^=y))



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

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

	LL n, q;
	LL wrk;
	LL ans = 0;
	set<LL> S;
	vector<LL> T;

	cin >> n;

	REP(i, n) {
		cin >> wrk;
		S.insert(wrk);
	}

	cin >> q;

	REP(i, q) {
		cin >> wrk;
		T.push_back(wrk);
	}


	REP(j,q){
		set<LL>::iterator it = S.find(T[j]);
		if (it != S.end()) {
			ans++;
		}
	}

    cout << ans <<endl;

	return 0;
}


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

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define all(a) (a).begin(), (a).end()

int main() {
	int n;
	cin >> n;
	cout << (int)pow(n, 3) << endl;

	return 0;
}


Measured memory_bytes: 3268
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int h = sc.nextInt();
    int w = sc.nextInt();

    boolean[][] blocked = new boolean[h][w];

    for (int i = 0; i < h; i++) {
      String s = sc.next();
      for(int j = 0; j < w; j++) {
        if (s.charAt(j) == '#') blocked[i][j] = true;
      }
    }


    int[][] vertConnected = new int[h][w];
    int[][] hrznConnected = new int[h][w];
    // count continuous non-blocked
    for (int i = 0; i < h; i++) {
      int start = 0;
      while (start < w) {
        if (blocked[i][start]) {
          start++;
          continue;
        }
        int end = start + 1;
        while (end < w && !blocked[i][end]) end++;
        for (int j = start; j < end; j++) {
          vertConnected[i][j] = Math.max(vertConnected[i][j], end - start);
        }
        start = end + 1;
      }
    }

    // count continuous non-blocked
    for (int j = 0; j < w; j++) {
      int start = 0;
      while (start < h) {
        if (blocked[start][j]) {
          start++;
          continue;
        }
        int end = start + 1;
        while (end < h && !blocked[end][j]) end++;
        for (int i = start; i < end; i++) {
          hrznConnected[i][j] = Math.max(hrznConnected[i][j], end - start);
        }
        start = end + 1;
      }
    }
    int max = Integer.MIN_VALUE;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        max = Math.max(max, (vertConnected[i][j] + hrznConnected[i][j]) - 1);
      }
    }
    os.println(max);
  }
}

Measured memory_bytes: 84944
list=input().split(" ")
T_phy=int(list[0])
T_atk=int(list[1])
A_phy=int(list[2])
A_atk=int(list[3])

T_defeat_turn=int(T_phy/A_atk)
if T_phy%A_atk!=0:
    T_defeat_turn+=1
A_defeat_turn=int(A_phy/T_atk)
if A_phy%T_atk!=0:
    A_defeat_turn+=1

if A_defeat_turn>T_defeat_turn:
    print("No")
else:
    print("Yes")

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

int main() {
  int n,m;
  cin>>n>>m;
  vector<int>ans(n);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    ans[a-1]++;
    ans[b-1]++;
  }
  for(int i=0;i<n;i++) cout<<ans[i]<<endl;
}


Measured memory_bytes: 256
import numpy as np
n, m = map(int, input().split())
road = [0]*n
a = [0]*m
a = np.array(a)
b = [0]*m
b = np.array(b)
for i in range(m):
  x, y = input().split()
  a[i] = (int(x))
  b[i] = (int(y))
for i in range(m):
  road[int(a[i]) - 1] += 1
  road[int(b[i]) - 1] += 1
for i in road:
    print(i)

Measured memory_bytes: 14444
N = int(input())
Llist = list(map(int, input().split(' ')))

Llist = sorted(Llist)

outnum = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if Llist[i]!=Llist[j] and Llist[j]!=Llist[k]:
                if Llist[i]+Llist[j] > Llist[k]:
                    outnum += 1

print(outnum)

Measured memory_bytes: 9188
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;


int main(){
  string S;
  cin >> S;
  int a=S.size();
  int count[a];
  int ans=0;
  int ans2=0;
  for(int i=0;i<a+1;i++){
    count[i]=0;
  }

  for(int i=0;i<a;i++){
    if(S[i]=='A' || S[i]=='C' || S[i]=='G' || S[i]=='T'){
      count[i]=1;
    }
    else{
      count[i]=0;
    }
  }
  for(int i=0;i<a;i++){
    if(count[i]==1){
      ans++;
    }
    if(count[i]==0){
      ans2 = max(ans , ans2);
      ans=0;
    }
  }
  ans2 = max(ans,ans2);
  cout << ans2 << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include "queue"
#include <deque>
#include <stack>
#include <numeric>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <cassert>
#include <unordered_map>
#include <regex>
#include <stdio.h>
#include <fstream>
using namespace std;
#define ll long long int
const int N = 2000210;
#define lson l,mid,rt<<1
#define eps 1e-9
#define rson mid+1,r,rt<<1|1
#define mem(a,b) memset(a,b,sizeof(a))
#define getchar_unlocked getchar
#define mod 1000000007
//if ( a > b || a > j || b < i ) {
//return ( ( sum ) { 0, 0 } );
//if ( a >= i && b <= j ) {
//return tree[ node ]
//ll bin1(ll val){
//    //finding the smallest element equal to or larger than this val
//    ll lo=1,hi=n;
//    while(lo<=hi){
//        if(lo==hi)break;
//        if(lo+1==hi){
//            if(Q[lo].v==val)break;
//            else if(Q[lo].v<val){lo=hi; break;}
//            break;
//        }
//        ll mid=(lo+hi)>>2;
//        if(Q[mid].v<val){
//            lo=mid+1;
//        }
//        else{
//            hi=mid;
//        }
//    }
//    if(Q[lo].v<val)lo++;
//    return lo;
//}
//ll BIN(ll val){
//    //finding the largest element equal to or smaller than this val
//    ll lo=1,hi=n;
//    while(lo<=hi){
//        if(lo==hi)break;
//        if(lo+1==hi){
//            if(Q[lo].v==val)break;
//            else if(Q[lo].v>val){lo=hi; break;}
//            break;
//        }
//        ll mid=(lo+hi)>>2;
//        if(Q[mid].v>val){
//            hi=mid;
//        }
//        else{
//            lo=mid+1;
//        }
//    }
//    if(Q[lo].v>val)lo--;
//    return lo;
//}
inline int scan(){
    char c = getchar_unlocked();
    int x = 0;
    while(c<'0'||c>'9'){
        c=getchar_unlocked();
    }
    while(c>='0'&&c<='9'){
        x=(x<<1)+(x<<3)+c-'0';
        c=getchar_unlocked();
    }
    return x;
}
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
inline ll gcd(ll a, ll b){ ll t; while (b){ a = a%b; t = a; a = b; b = t; }return a; }
int main(){
    ll a,b,c; cin >> a >> b >> c;
    map< ll , ll > m;
    m[a] ++;
    m[b] ++;
    m[c] ++;
    if( m[5] == 2 && m[7] == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
//raja1999
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16)a; cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);
vector< int> vec;
vector< vi> adj(100005);
int vis[100005],vis1[100005],p[100005];
int dfs(int x){
	int i;
	vis[x]=1;
	vec.pb(x);
	vis1[p[x]]=1;
	rep(i,adj[x].size()){
		if(vis[adj[x][i]]==0){
			dfs(adj[x][i]);
		}
	}
}
int main(){
	std::ios::sync_with_stdio(false);
	int n,m,i,j,x,y,c=0;
	cin>>n>>m;
	rep(i,n){
		cin>>p[i];
		p[i]--;
	}	
	rep(i,m){
		cin>>x>>y;
		x--;
		y--;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	rep(i,n){
		if(vis[i]==0){
			dfs(i);
			rep(j,vec.size()){
				if(vis1[vec[j]]==1){
					c++;
				}
			}
			rep(j,vec.size()){
				vis1[p[vec[j]]]=0;
			}
			//cout<<"hi"<<endl;
			vec.clear();
		}
	}
	cout<<c<<endl;
} 
	

Measured memory_bytes: 9596