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

using namespace std;
using ll = long long;

int main() {
    chrono::system_clock::time_point start;
    start = chrono::system_clock::now();

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

    const int INF = 1000000000;

    int d;
    cin >> d;
    vector<int> c(26);
    vector<vector<int>> s(d, vector<int>(26));
    for(int i = 0; i < 26; ++i) cin >> c[i];
    for(int j = 0; j < d; ++j)
        for(int i = 0; i < 26; ++i) cin >> s[j][i];

    int m;
    vector<int> t(d);
    vector<vector<int>> blank(d, vector<int>(26, 1));
    for(int j = 0; j < d; ++j) {
        for(int i = 0; i < 26; ++i) 
            if(j != 0) blank[j][i] = blank[j - 1][i] + 1;
        m = - INF;
        for(int i = 0; i < 26; ++i) {
            if(s[j][i] + c[i] * blank[j][i] > m) {
                t[j] = i;
                m = s[j][i] + c[i] * blank[j][i];
            }
        }
        blank[j][t[j]] = 0;
    }

    int d_, q, dt, diff = 0, m2;
    vector<int> t_ = t;
    vector<vector<int>> blank_ = blank;
    srand((unsigned int)time(NULL));
    while(chrono::duration_cast<chrono::seconds>(chrono::system_clock::now() - start).count() < 0.2) {
        d_ = rand() % d;
        m2 = - INF;
        for(int i = 0; i < 26; ++i) {
            if(s[d_][i] > m2) {
                m2 = s[d_][i];
                q = i;
            }
        }
        // q = rand() % 26;

        diff = 0;

        diff -= s[d_][t_[d_]];
        diff += s[d_][q];

        if(d_ != 0) blank_[d_][t_[d_]] = blank_[d_ - 1][t_[d_]] + 1;
        else blank_[d_][t_[d_]] = 1;
        diff -= c[t_[d_]] * blank_[d_][t_[d_]];
        dt = d_ + 1;
        while(t_[dt] != t_[d_] && dt < d) {
            diff += c[t_[d_]] * blank_[dt][t_[d_]];
            blank_[dt][t_[d_]] = blank_[dt - 1][t_[d_]] + 1;
            diff -= c[t_[d_]] * blank_[dt][t_[d_]];
            dt++;
        }

        diff += c[q] * blank_[d_][q];
        blank_[d_][q] = 0;
        dt = d_ + 1;
        while(t_[dt] != q && dt < d) {
            diff += c[q] * blank_[dt][q];
            blank_[dt][q] = blank_[dt - 1][q] + 1;
            diff -= c[q] * blank_[dt][q];
            dt++;
        }

        t_[d_] = q;

        // printf("%d\n", diff);

        if(diff > 0) {
            t = t_;
            blank = blank_;
        } else {
            t_ = t;
            blank_ = blank;
        }
    }

    for(int j = 0; j < d; ++j) {
        printf("%d\n", t[j] + 1);
    }

    return 0;
}

Measured memory_bytes: 3912
"use strict"

function main(input) {

    input = input.split('')
    for (let i = input.length - 2; i > 0; i--) {
        if (i % 2 == 0) {
            let a = input.slice(0, i / 2).join('')
            let b = input.slice(i / 2, i).join('')
            // console.log(a, b)
            if (a == b) {
                console.log(i)
                return
            }
        }

    }

}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <stdio.h>

void sort_print (int x, int y) {
    if (x < y) {
        printf("%d %d\n", x, y);
    } else {
        printf("%d %d\n", y, x);
    }
}

void process() {
    int x, y;

    do {
        scanf("%d %d", &x, &y);
	if (x == 0 && y == 0) break;
	sort_print(x, y);
    } while (x != 0 || y != 0);
}

int main(void) {

    process();

    return 0;
}


Measured memory_bytes: 2028
N,Y = map(int,input().split())

Y /= 1000

x=int(Y//10)
y= int((Y % 10) // 5)
z=int((Y % 10) % 5)

flag = False

if x+y+z > N:
  print(-1,-1,-1)
  
elif x + y + z == N:
  print(x , y , z)
  
else:
  for i in range (N):
    for j in range(N-i):
      if 10*i+5*j+(N-i-j)==Y:
        print(i,j,N-i-j)
        flag=True
        break
    if flag:
      break
  if flag==False:
    print(-1,-1,-1)
  

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<cmath>
#include<stack>
#include <algorithm>
#include <functional>
//#include<stdlib.h>
using namespace std;
int main() {
	string s; bool t=false;
	cin >> s;
	for (int a = 0; a < 3; a++) { if (s[a] == s[a + 1]) { t = true; break; } }
	if (t) { s = "Bad"; }
	else { s = "Good"; }
	cout << s;
	return 0;
}

Measured memory_bytes: 888
#include <iostream>

using namespace std;

class Dice {
    public:
    int face[6];
    Dice() {}
    void rotateX () {
        rotate(0, 1, 5, 4);
    }
    void rotateY () {
        rotate(0, 2, 5, 3);
    }
    void rotateZ () {
        rotate(0, 1, 5, 4);
    }
    void rotate (int a, int b, int c, int d) {
        int t = face[a];
        face[a] = face[b];
        face[b] = face[c];
        face[c] = face[d];
        face[d] = t;
    }
    void move (char c) {
        if (c == 'E') for (int i = 0; i < 3; i++) rotateY();
        if (c == 'W') rotateY();
        if (c == 'N') rotateX();
        if (c == 'S') for (int i = 0; i < 3; i++) rotateX();
    }
};

int main () {
    Dice d;
    string com;
    
    for (int i = 0; i < 6; i++) cin >> d.face[i];
    cin >> com;

    for (int i = 0; i < com.size(); i++) d.move(com[i]);

    cout << d.face[0] << endl;
}


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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int ans = 0;
  for (int i = 1; i < N+1; i++) {
    int num = i;
    int sum = 0;
    while (num != 0) {
      sum += num % 10;
      num /= 10;
    }
    if (A <= sum && sum <= B) {
      ans += i;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Main implements Closeable {

  private InputReader in = new InputReader(System.in);
  private PrintWriter out = new PrintWriter(System.out);

  public void solve() {
    int n = in.ni();
    int[] h = new int[n + 1];
    for (int i = 1; i <= n; i++) {
      h[i] = in.ni();
    }
    long result = 0;
    Map<Integer, Long> back = new HashMap<>();
    for (int i = 1; i <= n; i++) {
      int score = h[i] - i;
      long same = back.getOrDefault(score, 0L);
      result += same;
      back.put(-(i + h[i]), back.getOrDefault(-(i + h[i]), 0L) + 1);
    }

    Map<Integer, Long> front = new HashMap<>();
    for (int i = n; i >= 1; i--) {
      int score = h[i] + i;
      long same = front.getOrDefault(score, 0L);
      result += same;
      front.put(i - h[i], front.getOrDefault(i - h[i], 0L) + 1);
    }
    out.println(result >> 1);
  }

  @Override
  public void close() throws IOException {
    in.close();
    out.close();
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

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

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

    public long nl() {
      return Long.parseLong(next());
    }

    public void close() throws IOException {
      reader.close();
    }
  }

  public static void main(String[] args) throws IOException {
    try (Main instance = new Main()) {
      instance.solve();
    }
  }
}


Measured memory_bytes: 73844
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
void dfs(int x, Graph& G, vector<bool> visited,V& dist, int now) {
	visited[x] = true;
	chmin(dist[x], now);
	for (auto c : G[x]) {
		if (!visited[c] || dist[c] > now + 1) {
			dfs(c, G, visited, dist, now + 1);
		}
	}
}
int main() {
	int n;
	cin >> n;
	int x, y;
	cin >> x >> y;
	Graph G(n);
	rep(i, n - 1) {
		G[i].push_back(i + 1);
		G[i + 1].push_back(i);
	}
	x--; y--;
	G[x].push_back(y);
	V counter(n+20, 0);
	rep(i, n) {
		V dist(n, n);
		vector<bool> visited(n, false);
		dfs(i, G, visited,dist, 0);
		for (int j = i; j < n; j++) {
			if (dist[j] == n) continue;
			counter[dist[j]]++;
		}
	}
	for (int i = 1; i < n; i++) cout << counter[i] << endl;
	return 0;
}

Measured memory_bytes: 1344
#include <iostream>

using namespace std;

int main()
{
long long x;
long long input;
long long min;
long long max;
long long a;
cin >> x;
cin >> a;
min=a;
max=a;
long long sum=a;
for(int i=2;i<=x;i++)
{cin >> input;
sum=sum+input;
if(input<=min)
{min=input;}
else if(input>=max)
{max=input;}
}
cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3116
#include <iostream>
#include <math.h>
#include<iomanip>
#include <string>
using namespace std;

int main() {
    cout << fixed << setprecision(8);
    for (int n; cin >> n, n;) {
        int s[1000], sum = 0;
        for (int i = 0; i < n; i++) {
            cin >> s[i];
            sum += s[i];
        }
        double m = (double)sum / n;
        double a = 0;
        for (int i = 0; i < n; i++) {
            a += (s[i] - m)*(s[i] - m);
        }
        a /= n;
        a = sqrt(a);
        cout << a << endl;
    }
    return 0;
}

Measured memory_bytes: 3260
#include <iostream>
using namespace std;
int main(){
    int n;
    int b[110];
    cin >> n;
    long long ans = 0;
    for(int i=0;i<n-1;i++) cin >> b[i];
    for(int i=0;i<n-2;i++){
        ans += min(b[i],b[i+1]);
    }
    ans += b[0] + b[n-2];
    cout << ans << endl;
    return 0;
}

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

int n,d,res;
double ans;
int a[15][15];

bool check(int x, int y)
{
    int sum = 0;
    for(int k = 0; k < d; k++)
    {
        sum += abs(a[x][k]-a[y][k])*abs(a[x][k]-a[y][k]);
    }
    ans = sqrt(sum);
    int t = (int)ans;
    if(t == ans)
        return true;
    else
        return false;
}

int main()
{
    scanf("%d %d",&n,&d);
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < d; j++)
            scanf("%d",&a[i][j]);
    }
    res = 0;
    for(int i = 0; i < n; i++)
    {
        for(int j = i+1; j < n; j++)
        {
            if(check(i,j))
                res++;
        }
    }
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 256
/* Stability */
#include<stdio.h>
int A[37];
char C[37];
int n;
void BubbleSort();
void SelectionSort();
int IsStable(char *, int *);
main(){
  char g;
  int i;
  
  scanf("%d%*d",&n);     /* This n is length of array.*/
  if(n<1||n>36)return 0; /* Constraints: 1<= n <= 36 */
  for(i=1;i<=n;i++){
    scanf("%c%d%*c",&C[i],&A[i]);
  }
  BubbleSort();
  SelectionSort();
  return 0;
}

void BubbleSort(){
  int i,j,temp1;
  char c[37], temp2;
  int a[37];

  for(i=1;i<=n;i++){
    a[i]=A[i];
    c[i]=C[i];
  }

  for(i=1;i<=n;i++){
    for(j=n;j>i;j--){
      if(a[j]<a[j-1]){
	temp1=a[j];
	a[j]=a[j-1];
	a[j-1]=temp1;
	temp2=c[j];
	c[j]=c[j-1];
	c[j-1]=temp2;
      }
    }
  }
  for(i=1;i<n;i++){
    printf("%c%d ",c[i],a[i]);
  }
  printf("%c%d\n",c[i],a[i]);
  IsStable(c,a);
}


void  SelectionSort(){
  int i,j,temp1,mini;
  char c[37], temp2;
  int a[37];
  
  for(i=1;i<=n;i++){
    a[i]=A[i];
    c[i]=C[i];
  }

  for(i=1;i<=n;i++){
    mini=i;
    for(j=i;j<=n;j++){
      if(a[j]<a[mini])mini=j;
    }
    temp1=a[i];
    a[i]=a[mini];
    a[mini]=temp1;
    temp2=c[i];
    c[i]=c[mini];
    c[mini]=temp2;
  }
  for(i=1;i<n;i++){
    printf("%c%d ",c[i],a[i]);
  }
  printf("%c%d\n",c[i],a[i]);
  IsStable(c,a);
}

int IsStable(char *sC, int *sA){
  int i,j,temp1,temp2;
  char c[37];
  int a[37];

  for(i=1;i<=n;i++){
    a[i]=sA[i];
    c[i]=sC[i];
  }
  for(i=1;i<n;){
    if(a[i]==a[i+1]){
      for(j=1;j<=n;j++){
	if(a[i]==A[j]&&c[i]==C[j])temp1=j;
	if(a[i+1]==A[j]&&c[i+1]==C[j])temp2=j;
      }
      if(temp1>temp2){
	printf("Not stable\n");
	return 0;
      }
      i++;
    }
    else i++;
  }
  if(i==n){
    printf("Stable\n"); 
    return 0;
  }
}
      

Measured memory_bytes: 0
import math

a, b, h, m = map(int, input().split(' '))

min_angle = 2 * math.pi * m / 60
hour_angle = 2 *math.pi * (h / 12 + m / 720)

min_pos = (math.cos(min_angle) * b, math.sin(min_angle) * b)
hour_pos = (math.cos(hour_angle) * a, math.sin(hour_angle) * a)

print(math.sqrt((min_pos[0] - hour_pos[0]) ** 2 + (min_pos[1] - hour_pos[1]) ** 2))


Measured memory_bytes: 9516
#include <bits/stdc++.h>
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
#define _all(arg) begin(arg),end(arg)

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

using namespace std;

int main(void){
	int n; cin >> n;
	vector<string> u(n);
	rep(i,n) cin >> u[i];
	int m; cin >> m;
	bool opened = false;
	rep(i,m) {
		string t; cin >> t;
		if(find(u.begin(), u.end(), t) != u.end()) {
			opened ^= true;
			if(opened) {
				cout << "Opened by " << t << endl;
			}
			else {
				cout << "Closed by " << t << endl;
			}
		}
		else {
			cout << "Unknown " << t << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3184
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int N  =scan.nextInt();
        int K = scan.nextInt();
        int Q = scan.nextInt();
        int[] A = new int[N];
        int[] B = new int[N];
        for(int i=0;i<N;++i){
            A[i]=scan.nextInt();
            B[i]=A[i];
        }
        Arrays.sort(B);
        int ans = 1000000001;
        PriorityQueue<Integer> que = new PriorityQueue<>();
        for(int i=0;i<N;++i){
            if(i+Q-1>=N || B[i+Q-1]-B[i]>=ans)continue;
            int left=-1, right=ans;
            while(right-left>1){
                int center=(right+left)/2;
                int cnt=0;
                que.clear();
                for(int j=0;j<N;++j){
                    if(A[j]<B[i])que.clear();
                    else{
                        que.add(A[j]);
                        if(que.size()>=K){
                            if(que.poll()-B[i]<=center)++cnt;
                            if(cnt>=Q){
                                break;
                            }
                        }
                    }
                }
                if(cnt>=Q)right=center;
                else left=center;
            }
            ans = Math.min(ans, right);
        }
        System.out.println(ans);


    }
}

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

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int n;
  cin >> n;
  vector<int> cnt(n+1,0);
  ll ans = 0;
  rep(i,n) {
    ll a;
    cin >> a;
    if (a >= n+1) ans++;
    else cnt[a]++;
  }
  rep(i,n+1) {
    if (cnt[i] < i) ans += cnt[i];
    else if (cnt[i] > i) ans += cnt[i] - i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>

using namespace std;

int m, d;
int cnt;

int main()
{
    scanf("%d%d", &m, &d);
    for(int i = 1; i <= m; i++)
    {
        for(int j = 1; j <= d; j++)
        {
            if(j % 10 < 2) continue;
            if(j / 10 < 2) continue;
            if((j % 10) * (j / 10) == i) cnt++;
        }
    }
    printf("%d", cnt);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int N,Y;
int main(){
    cin>>N>>Y;
    int y=Y/1000;
    for(int i=N;i>=0;i--){
        if(y<10*i)continue;
        int A=y-10*i;
        for(int j=N-i;j>=0;j--){
            if(A<5*j)continue;
            int B=A-5*j;
            int k=N-i-j;
            if(B==k){                                               
                cout<<i<<' '<<j<<' '<<k<<"\n";
                return 0;
                        
            }   
        }   
    }   
    cout<<"-1"<<' '<<"-1"<<' '<<"-1"<<"\n";
    return 0; 
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>

int main()
{
    int n, m, l;
    std::cin >> n >> m >> l;

    int a[n][m] = {};
    int b[m][l] = {};

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

    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < l; ++j) {
            std::cin >> b[i][j];
        }
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < l; ++j) {
            long c = 0;
            for (int k = 0; k < m; ++k) {
                c += a[i][k] * b[k][j];
            }
            std::cout << c;
            if (j != (l - 1)) {
                std::cout << " ";
            }
        }
        std::cout << std::endl;
    }


    return 0;
}


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

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

int main(){
    string s,t;
    cin >> s >> t;
    for (int i=0;i<s.length();++i){
        if(s[i]!=t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

int main(){
    string str;
    cin >> str;
    if (str == "ABC") cout << "ARC";
    else cout << "ABC";
    return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#include <set>
#include <string>
#include <map>

using namespace std;

int main() {
  
  set<char> st ;
  string s ;
  cin>>s ;
  for (char c = 'a'; c <='z'; c++)
  {    
    st.insert(c) ;
  } 

  for (int i=0 ; i<s.size(); i++)
  {    
    st.erase(s[i]) ;
  } 

  if(st.empty()){
    cout << "None" << endl ;
  }else{
    /*for (set<char>::iterator it = st.begin(); it!=st.end(); it++)
    {
        cout << *it ;
    }
    */
    auto it = st.begin() ;
    cout << *it << endl ;
}

 return 0 ;

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
// sort(a.begin(), a.end(), std::greater<int>());

/*
std::vector<std::string> split(const std::string &input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter))
    {
        result.push_back(field);
    }
    return result;
}
*/

int main()
{

    int a,b;
    cin>>a>>b;
    int ans=0;
    ans=b;
    rep(i,a-1){
        ans*=(b-1);
    }
    cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 256
n,a=map(int,input().split())
l=list(map(int,input().split()))
for i in range(n):
    l[i]-=a
u=[0]*(3001)
d=[0]*(3001)
ul=[]
dl=[]
z=0
for i in l:
    if i==0:
        z+=1
    elif i<0:
        dl.append(-i)
    else:
        ul.append(i)
        
for i in ul:
    for j in range(3000,-1,-1):
        if u[j]>0 or j==0:
            u[j+i]+=max(1,u[j])
for i in dl:
    for j in range(3000,-1,-1):
        if d[j]>0 or j==0:
            d[j+i]+=max(1,d[j])
ans=0
for i in range(3001):
    ans+=u[i]*d[i]
if ans==0 and z==0:
    print(0)
elif z==0:
    print(ans)
elif ans==0:
    print(2**z-1)
else:
    print((1+ans)*(2**z)-1)


Measured memory_bytes: 39792
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int K;
    cin >> K;

    vector<int> lens(K + 1, -1);

    long long x = 0;
    int res = -1;
    int len = 0;
    while (true) {
        x = (x * 10 + 7) % K;
        ++len;
        if (x == 0) {
            res = len;
            break;
        }
        if (lens[x] > 0) {
            res = -1;
            break;
        }
        lens[x] = len;
    }

    cout << res << '\n';


    return 0;
}

Measured memory_bytes: 7152
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N;
	in >> N;
	std::vector<LL>A(N + 1), B(N);
	rep(i, N + 1) in >> A[i];
	rep(i, N) in >> B[i];

	LL ans = 0;
	rep(i, N)
	{
		LL res1 = std::min(A[i], B[i]);
		ans += res1;
		B[i] -= res1;
		LL res2 = std::min(A[i + 1], B[i]);
		ans += res2;
		A[i + 1] -= res2;
	}

	out << ans << std::endl;
}


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

int judge(char a, char b, char c) {
    if (a == b && b == c) {
        return 0;
    }
    else if (a == b || b == c || c == a) {
        return 1;
    }
    else {
        return 2;
    }
}

int main(){

    int N;
    string A, B, C;
    cin >> N >> A >> B >> C;

    int sum = 0;
    for (int i = 0; i < N; i++) {
        sum += judge(A[i], B[i], C[i]);
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
typedef stack<ll> ST;
typedef queue<ll> QUE;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

struct Seg{
    vec dat;
    //要素数
    int n;

    Seg(int n_){
        n=1;
        while(n<n_)n*=2;
        dat.resize(2*n);

        for(int i=0;i<2*n-1;i++)
            dat[i]=INF;
    }

    //k番目の値をaに変更
    void update(int k,ll a){
        k+=n-1;
        dat[k]=a;
        while(k>0){
            k=(k-1)/2;
            dat[k]=min(dat[2*k+1],dat[2*k+2]);
        }
    }

    //[a,b)の最小値を求める
    //kは節点の番号、[l,r)はその区間
    ll query(int a,int b,int k,int l,int r){
        if(r<=a || b<=l)return INF;
        if(a<=l && r<=b)return dat[k];
        else{
            ll vl=query(a,b,2*k+1,l,(l+r)/2);
            ll vr=query(a,b,2*k+2,(l+r)/2,r);
            return min(vl,vr);
        }
    }
};

int main(){
    int N; ll x;
    scanf("%d %lld",&N,&x);
    vec a;
    a.resize(N);
    Seg seg(2*N);
    rep(i,N){
        scanf("%lld",&a[i]);
        seg.update(i,a[i]);
        seg.update(i+N,a[i]);
    }
    ll ans=INF;
    rep(i,N){
        ll rev=i*x;
        rep(k,N){
            rev+=seg.query(k+N-i,k+N+1,0,0,seg.n);
        }
        ans=min(ans,rev);
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 384
/*
 *      ┌─┐       ┌─┐ + +
 *   ┌──┘ ┴───────┘ ┴──┐++
 *   │                 │
 *   │       ───       │++ + + +
 *   ███████───███████ │+
 *   │                 │+
 *   │       ─┴─       │
 *   │                 │
 *   └───┐         ┌───┘
 *       │         │
 *       │         │   + +
 *       │         │       Code is far away from bug with the animal protecting
 *       │         └──────────────┐
 *       │                        │
 *       │                        ├─┐
 *       │                        ┌─┘
 *       │                        │
 *       └─┐  ┐  ┌───────┬──┐  ┌──┘  + + + +
 *         │ ─┤ ─┤       │ ─┤ ─┤
 *         └──┴──┘       └──┴──┘  + + + +
 *                神兽保佑
 *               代码无BUG!
 */

#include<bits/stdc++.h>
using namespace std;
class IN{
public:
    template<typename T>
    IN& operator >>(T &x){read(x);return *this;}
    IN& operator >>(double &x){scanf("%lf",&x);return *this;}
    IN& operator >>(char *s){scanf("%s",s);return *this;}
    IN& operator >>(char &c){c=getchar();return *this;}
private:
    template<typename T>
    void read(T &x){
        T f=1;int c=getchar();x=0;
        while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
        while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
        x*=f;
    }
}in;
class NL{}nl;
class BK{}bk;
class OUT{
public:
    template<typename T>
    OUT& operator <<(T x){write(x);return *this;}
    OUT& operator <<(const char *s){printf("%s",s);return *this;}
    OUT& operator <<(char c){putchar(c);return *this;}
    OUT& operator <<(BK x){putchar(' ');return *this;}
    OUT& operator <<(NL x){putchar('\n');return *this;}
private:
    template<typename T>
    void write(T x){
        if(x<0)putchar('-'),x=-x;
        if(x>=10)write(x/10);
        putchar(x%10+48);
    }
}out;

#define pb(x) push_back(x)
#define fi first
#define se second
#define rep(i,a,n) for(int i=a;i<=n;++i)
#define per(i,n,a) for(int i=n;i>=a;--i)
#define mem(a,x) memset(a,x,sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;
/*****************************************************************************************************/
ll Pow(ll a,ll b,ll mod){ll res=1;a%=mod;while(b){if(b&1)(res*=a)%=mod;(a*=a)%=mod;b>>=1;}return res%mod;}
ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}//p为素数,a<p
ll C(ll n,ll m,ll p){ll res=1;for(ll i=1,j=n-m+1;i<=m;++i,++j){res=res*inv(i,p)%p*j%p;}return res;}
/*****************************************************************************************************/
/*ll ask(int x){ll res=0;while(x)res+=c[x],x-=x&-x;return res;}
void add(ll v,int x){while(x<=n)c[x]+=v,x+=x&-x;}*/
const int p=1e9+7;
const int N=2e5+10;
int ans[N];

int main(){
    rep(x,1,100)
        rep(y,1,100)
            rep(z,1,100){
                int t=x*x+y*y+z*z+x*y+y*z+z*x;
                if(t<=10000)++ans[t];
            }
                
    int n;
    in>>n;
    rep(i,1,n)
    out<<ans[i]<<nl;
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int32_t main(){
	int n;
	string s;
	cin>>n>>s;
	int r=0,g=0,b=0;
	for(int i=0;i<s.length();i++){
		switch(s[i]){
			case 'R':
				r++;
				break;
			case 'G':
				g++;
				break;
			case 'B':
				b++;
				break;
		}
	}
	int ans = 0;
	for(int i=1;i<=n;i++){
		for(int j=0;j+i+i<n;j++){
			//cout<<j<<' '<<i<<'\n';
			if(s[j]!=s[j+i] && s[j]!=s[j+i+i] && s[j+i]!=s[j+i+i]){
				ans++;
			}
		}
	}
	//cout<<ans<<'\n';
	cout<<r*g*b-ans;
}


Measured memory_bytes: 3636
N,x = map(int,input().split())
donuts = 0
donuts_min = 999999
counta = 0

for i in range(N):
  donuts = int(input())
  x -= donuts
  counta += 1
  if donuts_min >= donuts:
  	donuts_min = donuts
  else:
    pass
  
countb = x // donuts_min
print(counta + countb)


Measured memory_bytes: 9040
def main():
    import sys

    def I():
        return int(sys.stdin.readline().rstrip())

    def LI():
        return list(map(int, sys.stdin.readline().rstrip().split()))  # 空白あり

    N = I()
    A = [[0] * (N + 1)] + [[0] + LI() for _ in range(N)]

    ans = (sum(sum(A[i]) for i in range(N + 1))) // 2
    minus = 0

    # A[i][j]が実現可能か、必要かを判定していく
    for i in range(1, N):
        for j in range(i + 1, N + 1):
            for k in range(1, N + 1):
                if k == i or k == j:
                    continue
                else:
                    if A[i][j] > A[i][k] + A[k][j]:  # A[i][j]が実現できない
                        print(-1)
                        exit()
                    elif A[i][j] == A[i][k] + A[k][j]:  # A[i][j]は無駄
                        minus += A[i][j]
                        break

    print(ans - minus)

if __name__ == '__main__':
    main()

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

int main() {
  std::string S;
  int w;
  std::cin >> S >> w;
  std::string ans;
  ans.reserve((S.length() + w - 1) / w);
  for (int i = 0; i < S.length(); i += w) {
    ans += S[i];
  }
  std::cout << ans << std::endl;
  return EXIT_SUCCESS;
}


Measured memory_bytes: 256
#include <stdio.h>


 
int n, k, w[100010];

int a(int P);

 
int main(){
  int i,l=0,h =1000100000,m;
  scanf("%d%d",&n,&k);
 
  for( i=0; i<n; i++){
    scanf("%d",&w[i]);
   
  }
 
 
  while(l+1 < h){
     m = (l+h)/2;
    if(a(m)){
      h = m;
    }
    else{
      l = m;
    }
 
  }
  printf("%d\n", h);
 
}

int a(int P){
  int x = 0, y = 1,i,j;
  for( j=0; j<n; j++){
    if(w[j] > P){
      return 0;
    }
    else{
      if(x+w[j] <= P){
    x += w[j];
      }
      else{
    y++;
    x = w[j];
      }
    }
  }
  if(y<=k) return 1;
  else return 0;
}



Measured memory_bytes: 2212
s = int(input())

ar = []
ar.append(s)
flag = 0
count = 0

while flag == 0:
	count = count +1
	if s % 2 == 0:
		s = s//2
	else:
		s = 3* s +1
	if s in ar:
		flag = 1
	else:
		ar.append(s)
#		print(s)

print(count+1)

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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using v = vector<T>;
template <class T>
using vv = v<v<T>>;
#define ALL(c) (c).begin(), (c).end()

int main()
{
    int D, T,S;
    cin >> D >> T >> S;
    if((double)D/S<=T){
        cout << "Yes" << endl;
    }else
    {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int main()
{
	int i,n,a=0,s=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		for(int j=1;j<=i;j++)
		{
			if(i%j==0&&i&1) a++;
		}
		if(a==8) s++;
		a=0;
	}
	cout<<s<<endl;
	return 0;
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

long gcd(long a, long b)
{
    if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    
    return b ? gcd(b, a % b) : a;
}

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

int main(int argc, const char * argv[]) {
    // source code
    long a, b;
    cin >> a >> b;
    cout << lcm( a, b) << endl;
    
    return 0;
}


Measured memory_bytes: 256
<?php
error_reporting(0);
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (strlen($l)==0) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->A = $a;
    $fi++;
    continue;
  }
  if ($fi > 0) {
    $a = explode(" ",$l);
    $key->X[] = $a;
  }
}
if ($key->A[1]=='+') {
  printf("%d\n",$key->A[0]+$key->A[2]);
}
else {
  printf("%d\n",$key->A[0]-$key->A[2]);
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
#include <ctime>
#include <sstream>
#define weewoo ios::sync_with_stdio(false);cin.tie(0)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ld long double
#define ll long long
#define se second
#define fi first
#define ctoi(x) x-'0'
#define pi (acos(-1))
#define llputin(a,n) for(int i=0;i<n;i++){ll x;cin >> x;a.push_back(x);}
#define iputin(a,n) for(int i=0;i<n;i++){int x;cin >> x;a.push_back(x);}

#define MOD ((ll) 1e9 + (ll) 7)
using namespace std;

ll pw(ll x,ll a){
    if(a==0)
        return 1;
    ll t = pw(x,a/2);
    if(a%2==0)
        return (t*t);
    else
        return (t*t*x);
}

bool prime(int x)
{
    if(x < 2) return false;
        for(int i=2; i<= sqrt(x); i++) {
            if ((x%i) == 0) return false;
        }
    return true;
}

vector<pii>s;
vector<int>a;

int main()
{
    weewoo;
    ll n,a;
    cin >> a >> n;
    for(int i=0;i<n;i++){
        ll x;cin >> x;
        a-=x;
    }
    if(a<=0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using bint = boost::multiprecision::cpp_int;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N-1) cin >> A[i];
    vector<int> J(N);
    rep(i,N-1) J[A[i] - 1]++;
    rep(i,N) cout << J[i] << endl;
    return 0;
}


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

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

    bool F[n] = {};
    F[0] = true;
    int B[n];
    fill(B, B + n, 1);
    
    for(int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;
        x--; y--;
        if(B[x] > 1 and F[x]) F[y] = true;
        else if(B[x] == 1 and F[x]){
            F[x] = false;
            F[y] = true;
        }else if(B[x] > 1 and !(F[x]));
        else if(B[x] == 1 and !(F[x]));
        B[x]--;
        B[y]++;
    }
    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(F[i]) cnt++;
    }
    cout << cnt << endl;

    return 0;
}

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

int main(){
    
    int N;
    int sum = 0;
    cin >> N;
    vector<int> d(N);
    
    for(int i = 0; i < N; i++) cin >> d[i];
    
    for(int i = 0; i < N; i++){
        for(int j = i+1; j < N; j++){
            sum += d[i]*d[j];
        }
    }        
    
    cout << sum << endl;
    
}

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

#define rep(s, e) for(int i(s); i < e; ++i)

bool isPrime(int);

int main() {
    int n(0);
    int number_of_prime(0);
    cin >> n;
    rep(0, n) {
        int x(0);
        cin >> x;
        if(isPrime(x)) {
            ++number_of_prime;
        }
    }
    cout << number_of_prime << "\n";
    return 0;
}

bool isPrime(int x) {
    if(x == 2|| x == 3)
        return true;

    if(x % 2 == 0) {
        return false;
    }

    for(int i(3); i < sqrt(x)+1; ++i) {
        if(x % i == 0)
            return false;
    }
    return true;
}


Measured memory_bytes: 3116
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
int main(){
  ll n,T;
  cin>>n>>T;
  vector<ll>t(n);
  rep(i,n)cin>>t[i];
  vector<ll> dt(n-1);
  rep(i,n-1)dt[i]=t[i+1]-t[i];
  ll ans=T;
  for(int i=0;i<n-1;i++)ans+=min(T,dt[i]);
  cout<<ans<<endl;
}

Measured memory_bytes: 3328
nmax=10**5+1
n=int(input())
a=list(map(int,input().split()))

if n<=1:
    print(n)
else:
    c=[0]*nmax

    for i in range(n):
        c[a[i]]=c[a[i]]+1
        
    sum3=c[0]+c[1]+c[2]
    sum3max=sum3
    for i in range(1,nmax-2):
        sum3=c[i]+c[i+1]+c[i+2]
        sum3max=max(sum3max,sum3)
    print(sum3max)
    

Measured memory_bytes: 13964
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nm = readln.split.to!(int[]);
    auto N = nm[0];
    auto M = nm[1];

    int[][] AS;
    AS.length = N;
    foreach (ref A; AS) {
        A = readln.split.to!(int[]).map!"a-1".array;
    }

    auto ii = new int[](N);
    auto ms = new bool[](M);
    int r = int.max;
    foreach (_; 0..M) {
        auto cnt = new int[](M);
        foreach (i, ref j; ii) {
            while (ms[AS[i][j]]) {
                ++j;
            }
            ++cnt[AS[i][j]];
        }
        int jj, max_c;
        foreach (j, c; cnt) if (c > max_c) {
            max_c = c;
            jj = j.to!int;
        }
        r = min(r, max_c);
        ms[jj] = true;
    }
    writeln(r);
}

Measured memory_bytes: 5500
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int inf=0x3f3f3f3f;
void solve(int n,int* x,int* y,int* z,int a,int b){
    int dp[444][444];
    memset(dp,0x3f,sizeof(dp));
    dp[0][0]=0;
    for(int i=0;i<n;i++){
        for(int j=400;j>=x[i];j--){
            for(int k=400;k>=y[i];k--){
                if(dp[j-x[i]][k-y[i]]!=inf){
                    dp[j][k]=min(dp[j][k],dp[j-x[i]][k-y[i]]+z[i]);
                }
            }
        }
    }
    int ans=inf;
    for(int i=1;a*i<=400&&b*i<=400;i++){
        ans=min(ans,dp[a*i][b*i]);
    }
    printf("%d\n",ans==inf?-1:ans);
}

int main(){
    int n,a,b;
    while(cin>>n>>a>>b){
        int x[40],y[40],z[40];
        for(int i=0;i<n;i++)
            cin>>x[i]>>y[i]>>z[i];
        solve(n,x,y,z,a,b);
    }
    return 0;
}


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

using namespace std;

const unsigned long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % MOD;
       base = base * base % MOD;
    }
    return tot;
}

int arr[12], bon[12];
long long dp[12][1002];

int main(){

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int d;
    long long g; cin >> d >> g;

    for(int i = 1; i <= d; ++i)
        cin >> arr[i] >> bon[i];

    // dp[i] will contain the max score for i problems

    for(int i = 1; i <= d; ++i){
        for(int use = 0; use <= arr[i]; ++use){
            for(int bef = 1001; bef >= use; --bef){
                dp[i][bef] = max(dp[i][bef], 100 * i * use + (use == arr[i] ? bon[i] : 0) + dp[i - 1][bef - use]);
            }
        }
    }

    for(int i = 0; i <= 1001; ++i){
        if(dp[d][i] >= g){
            cout << i << "\n";
            return 0;
        }
    }

    return 0;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int N;
char S[300][300];

bool solve(int a, int b) {
    for(int i=0; i<N; ++i) {
        for(int j=0; j<i; ++j) {
            if(S[(a + i) % N][(b + j) % N] != S[(a + j) % N][(b + i) % N]) {
                return false;
            }
        }
    }
    return true;
}

int main() {
    cin >> N;
    for(int i=0; i<N; ++i) {
        for(int j=0; j<N; ++j) {
            cin >> S[i][j];
        }
    }

    int res = 0;
    for(int j=0; j<N; ++j) {
        if(solve(0,j)) res += N;
    }
    cout << res << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include <queue>

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

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;

int main()
{
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int score = 0;
    for(int i = 0; i < n-1; i++){
        if(s[i] == s[i+1]) score++; //幸福な人数
    }
    int ans = 0;
    ans = min(score + 2*k, n-1);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

n = int(input())
zoro = []
for _ in range(n):
    a, b = map(int, input().split())
    if a == b:
        zoro.append(1)
    else:
        zoro.append(0)

for z1, z2, z3 in zip(zoro, zoro[1:], zoro[2:]):
    if z1 + z2 + z3 == 3:
        print("Yes")
        exit()
print("No")

Measured memory_bytes: 61768
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
int main() {
	ll N; cin >> N;
	ll a[N + 100];
	for (ll i = 0; i < N; i++)
		cin >> a[i];
	map<ll, ll>mp;
	vector<ll>v;
	for (ll i = 0; i<N; i++) {
		mp[a[i]]++;
		if (mp[a[i]] >= 2)
		{
			v.push_back(a[i]);
			mp[a[i]] = 0;
		}
	}
	ll ans = 0;
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	if (v.size() >= 2)ans = v[0] * v[1];
	cout << ans << endl;
}


Measured memory_bytes: 7296
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a,b,c;
    cin>>a>>b>>c;
    
    int ans;
    if(a==b) ans=c;
    if(c==b) ans=a;
    if(a==c) ans=b;
    cout1(ans)
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

// PMAMP :)
// INL , IIWOIL

int main()
{
    jaldi
    string s;
    cin>>s;
    for(char c:s) cout<<'x';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll h, w;std::cin >> h >> w;
  vector<string> s(h);
  vll num(26, 0);
  re(i, h) {
    std::cin >> s[i];
    re(j, w) num[s[i][j] - 'a']++;
  }
  bool flag = true;
  if(h%2==0&&w%2==0) {re(i, 26) if(num[i]%4!=0) flag = false;}
  else if(h%2==1&&w%2==0){
    ll amari = 0, odd=0;
    re(i, 26) {
      if(num[i]%2==1) odd++;
      amari+=num[i]%4;
    }
    if(odd>=2||amari>w) flag = false;
  }else if(h%2==0&&w%2==1){
    ll amari = 0, odd=0;
    re(i, 26) {
      if(num[i]%2==1) odd++;
      amari+=num[i]%4;
    }
    if(odd>=2||amari>h) flag = false;
  }else{
    ll amari = 0, odd=0;
    re(i, 26) {
      if(num[i]%2==1) odd++;
      amari+=num[i]%4;
    }
    if(odd>=2||amari>(h+w-1)) flag = false;
  }
  std::cout << (flag?"Yes":"No") << '\n';
  return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#define int long 
using namespace std;

signed main() {
	int N;
	cin >> N;
	vector<int> vec(N);
	for(int i = 0;i < N;i++) {
		cin >> vec.at(i);
	}
	int count = 0;
	for(int i = 0;i < N;i++) {
		count += vec.at(i);
	}
	count = count / 2;
	for(int i = 1;i < N;i += 2) {
		count = count - vec.at(i);
	}
	cout << count * 2 << " ";
	for(int i = 0;i < N - 1;i++) {
		count = vec.at(i) - count;
		cout << count * 2 << " ";
	}
  	cout << endl;
}

Measured memory_bytes: 2048
#!/usr/bin/env python3
import sys

f = [1]
for i in range(1, 51):
    f.append(f[-1] * i)

def comb(n, k):
    a = f[n]
    b = f[n-k]
    c = f[k]
    bc = b * c
    return a // bc

def solve(N: int, A: int, B: int, v: "List[int]"):
    v = sorted(v, reverse=True)
    print("%.6f" % (sum(v[:A])/A))

    if v[0] != v[A]:
        ret = comb(v.count(v[A-1]), v[:A].count(v[A-1]))
        print(ret)
    else:
        s = 0
        X = v.count(v[0])
        for i in range(A, B+1):
            s += comb(X, i)
        print(s)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    v = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B, v)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064