akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N;
  cin >> N;
  ll a[3*N];
  for (int i = 0; i < 3*N; i++) {
    cin >> a[i];
  }
  priority_queue<ll, vector<ll>, greater<ll>> Q1;
  priority_queue<ll, vector<ll>, less<ll>> Q2;
  ll R1[N];
  ll R2[N];
  ll sum1 = 0;
  ll sum2 = 0;
  ll ans = -9999999999999999;
  for (int i = 0; i < N; i++) {
    Q1.push(a[i]);
    Q2.push(a[(2*N)+i]);
    sum1 += a[i];
    sum2 += a[(2*N)+i];
  }
  ll old_sum1 = sum1;
  ll old_sum2 = sum2;
  for (int i = 0; i < N; i++) {
    Q1.push(a[N+i]);
    sum1 += a[N+i];
    sum1 -= Q1.top();
    Q1.pop();
    R1[i] = sum1;
  }
  for (int i = N-1; i >= 0; i--) {
    Q2.push(a[N+i]);
    sum2 += a[N+i];
    sum2 -= Q2.top();
    Q2.pop();
    R2[i] = sum2;
  }
  
  for (int i = 0; i < N-1; i++) {
    ans = max(ans,R1[i] - R2[i+1]);
  }
  ans = max(ans,old_sum1 - R2[0]);
  ans = max(ans,R1[N-1] - old_sum2);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8696
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string ss;
    cin>>ss;
    if(ss.size()==6)
    {
        if((ss[2]==ss[3]) && (ss[4]==ss[5]))
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    else
            cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
/**Hey, What's up?*/

#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<long long>v;
int main()
{
    fastio;
    long long a=0,b=0,c,d,e,f=0,l,g,m,n,k,i,j,t,p,q;
    n=3;
    for(i=0;i<n;i++){
        cin>>a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    if(v[0]==v[1] and v[1]!=v[2]){
        cout<<"Yes\n";
    }
    else if(v[1]==v[2] and v[0]!=v[2]){
        cout<<"Yes\n";
    }
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
//(・ω・)
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, atoi
#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 <iomanip> //setprecision
#include <limits>
#include <sstream> //istringstream
using namespace std;

int main(){
   int a,b;
   cin >> a >> b;
   if((a*b)%2==0){
      cout << "Even" << endl;
   }
   else{
      cout << "Odd" << endl;
   }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int main()
{
    //freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int n=read(),ans=0,uf=100001;
	for(int i=1;i<n;i++)
	{
		int d=read();
		ans+=min(uf,d);uf=d;
	}pr2(ans+uf);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int q;cin>>q;
	for(int i = 0; i < q; i++) {
		string x,y;cin>>x>>y;
		vector<vector<int>> dp(1001,vector<int>(1001,0));
		for(int i = 0; i < x.size(); i++) {
			for(int j = 0; j < y.size(); j++) {
				if (x[i] == y[j]){
					dp[i + 1][j + 1] = max(dp[i][j] + 1,max(dp[i][j + 1],dp[i + 1][j]));
				}
				else{
					dp[i + 1][j + 1] = max(dp[i][j + 1],dp[i + 1][j]);
				}
			}
		}
		cout << dp[x.size()][y.size()] << endl;
	}
	return 0;
}


Measured memory_bytes: 6860
#include <bits/stdc++.h>
int n,l;
char s[100005];
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	l=n;
	for (int i=1;i<n;i++)
		if (s[i]!=s[i+1]) l=std::min(l,std::max(i,n-i));
	printf("%d\n",l); 
}

Measured memory_bytes: 3892
#include<bits/stdc++.h>
typedef long long int   LL;
typedef long double     LD;
#define OR              ||
#define AND             &&
#define nl              '\n'
#define S               string
#define inf             INT_MAX
#define SQR(a)          (a) * (a)
#define GCD(a, b)       __gcd(a, b)
#define pi              2.0*acos(0.0)
#define LCM(a, b)       (a * b) / GCD(a, b)
#define mem(a,b)        memset(a,b,sizeof(a))
#define srtv(v)         sort(v.begin(),v.end())
#define T               int t; cin>>t; while(t--)
#define boost		    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inout           freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
using namespace std;


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

    LL a[n+1];

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(n==2)
    {
        if(a[0]!=a[1])
            cout<<"YES";
        else
            cout<<"NO";
    }

    else
    {

    map<LL,LL> v1;

    for(int i=0;i<n;i++)
    {
        v1[a[i]]++;
    }



    if(v1.size()==n)
        cout<<"YES";
    else
        cout<<"NO";
    }


    return 0;
}

/*

*/




Measured memory_bytes: 14336
#include <stdio.h>
int main()
{
	long long int a, b, k;
	scanf("%lld%lld%lld", &a, &b, &k);
	if(a>=k)
	{
		a -= k;
		k = 0;
	}
	else 
	{
		k -= a;
		a = 0;
	}
	if(k!=0)
	{
		if(b>=k)
		{
			b -= k;
			k = 0;
		}
		else
		{
			k -= b;
			b = 0;
		}
	}
	printf("%lld %lld\n", a, b);
	return 0;
}

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

using namespace std;

int main()
{
   string input;
   int count = 0,  ans = 0;

   cin >> input;

   for(int i = 0; i < input.length(); i++)
   {
      if(input[i] == 'A' || input[i] == 'T' || input[i] == 'G' || input[i] == 'C')
      {
         count++;
      }

      else
      {
         count = 0;
      }
      

      ans = max(ans,count);
   }

   cout << ans;
}

Measured memory_bytes: 3616
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		proconScan proScan = new proconScan(" ");
		long nInteger = proScan.scanInteger1();
		long aInteger;
		long tInteger;
		long aAns=1;
		long tAns=1;
		long aBuf=0;
		long tBuf=0;
		long max;
		for(int i=0;i<nInteger;i++){
			proScan.scan();
			aInteger=Integer.parseInt(proScan.getString()[1]);
			tInteger=Integer.parseInt(proScan.getString()[0]);
			aBuf = aAns/aInteger + (aAns%aInteger==0?0:1);
			tBuf = tAns/tInteger + (tAns%tInteger==0?0:1);
			max=Math.max(aBuf, tBuf);
			aAns=aInteger*max;
			tAns=tInteger*max;
		}
		System.out.println((aAns+tAns));
		proScan.proconEnd();
	}

}


class proconScan {
	private BufferedReader br;
	private String inLine;
	private String[] inString;
	private Integer idx;
	private String splitChar;

	public proconScan() {
		br = new BufferedReader(new InputStreamReader(System.in));
		idx = 0;
		splitChar = " ";
	}

	public proconScan(String split) {
		br = new BufferedReader(new InputStreamReader(System.in));
		idx = 0;
		splitChar = split;
	}

	public void proconEnd() throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		br.close();
	}

	public String scan() throws IOException {
		idx = 0;
		inLine = br.readLine();
		inString = inLine.split(splitChar, 0);
		return inLine;
	}

	public Integer scanInteger1() throws IOException {
		scan();
		return Integer.parseInt(inString[0]);
	}

	public String backLine() {
		return inLine;
	}

	public String nextString() {
		return inString[idx++];
	}

	public String[] getString() {
		return inString;
	}

	public Integer nextInteger() {
		Integer num;
		try {
			num = Integer.parseInt(inString[idx++]);
		} catch (NumberFormatException e) {
			num = null;// TODO: handle exception
		}
		return num;
	}

	public Integer[] getInteger() {
		Integer[] num = new Integer[this.getLen()];

		for (int i = 0; i < this.getLen(); i++) {
			num[i] = Integer.parseInt(inString[i]);
		}

		return num;
	}

	public Float nextFloat() {
		Float num;
		try {
			num = Float.parseFloat(inString[idx++]);
		} catch (NumberFormatException e) {
			num = null;// TODO: handle exception
		}
		return num;
	}

	public Float[] getFloat() {
		Float[] num = new Float[this.getLen()];

		for (int i = 0; i < this.getLen(); i++) {
			num[i] = Float.parseFloat(inString[i]);
		}

		return num;
	}

	public Integer getLen() {
		return inString.length;
	}

	public int[] getInt() {
		int[] num = new int[this.getLen()];

		for (int i = 0; i < this.getLen(); i++) {
			num[i] = Integer.parseInt(inString[i]);
		}

		return num;
	}

}

Measured memory_bytes: 9808
#include <bits/stdc++.h>
using namespace std;
 
#define FOR(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
 
typedef long long int64;
const static int INF = 1 << 28;
typedef pair< int, int > Pi;
typedef pair< int, Pi > Pii;
 
int main()
{
  int w, h;
 
  while(cin >> w >> h, w) {
    vector< Pii > mas[2501];
    Pi goal;
    int count = 0;
 
    for(int i = 0; i < h; i++) {
      for(int j = 0; j < w; j++) {
        string line;
        cin >> line;
 
        if(isdigit(line[0])) {
          mas[atoi(line.c_str())].push_back(Pii(INF, Pi(i, j)));
          count = max(count, atoi(line.c_str()));
        } else if(line[0] == 'S') {
          mas[0].push_back(Pii(0, Pi(i, j)));
        } else if(line[0] == 'G') {
          goal = Pi(i, j);
        }
      }
    }
    mas[count + 1].push_back(Pii(INF, goal));
 
    for(int i = 1; !mas[i].empty(); i++) {
      for(int j = 0; j < mas[i].size(); j++) {
        for(int k = 0; k < mas[i - 1].size(); k++) {
          mas[i][j].first = min(mas[i][j].first, mas[i - 1][k].first + abs(mas[i - 1][k].second.first  - mas[i][j].second.first) + abs(mas[i - 1][k].second.second - mas[i][j].second.second)
          );
        }
      }
    }
    cout << mas[count + 1][0].first << endl;
    
  }
}

Measured memory_bytes: 1352
using System;
using System.Collections.Generic;

namespace aising2020_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var N = CIn.ReadInt();

      var ans = new int[N];

      for (int i = 1; i <= 100; i++)
      {
        for (int j = 1; j <= 100; j++)
        {
          for (int k = 1; k <= 100; k++)
          {
            var a = i * i + j * j + k * k + i * j + j * k + k * i;
            if (a <= N) ans[a - 1]++;
          }
        }
      }

      Console.WriteLine(string.Join('\n', ans));
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


Measured memory_bytes: 27980
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp2
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int[] data = Read(Console.ReadLine());
            string S = Console.ReadLine();
            int N = data[0];
            int K = data[1];

            char a = S[K-1];

            if (a == 'A') Console.WriteLine(ReplaceOneChar(S, K, "a"));
            if (a == 'B') Console.WriteLine(ReplaceOneChar(S, K, "b"));
            if (a == 'C') Console.WriteLine(ReplaceOneChar(S, K, "c"));



        }


        private static string ReplaceOneChar(string S ,int index,string newS)
        {
            string s1 = S.Substring(0, index-1);
            string s2 = S.Substring(index);
            return s1 + newS + s2;
        }

        private static int[] Read(string input)
        {
            string[] inputs = input.Split(' ');
            int num = inputs.Length;
            int[] ints = new int[num];
            for (int i = 0; i < num; i++)
            {
                ints[i] = int.Parse(inputs[i]);
            }
            
            return ints;
        }


    }
}


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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

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

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int H, W, h, w;
    cin >> H >> W >> h >> w;

    cout << (H - h) * (W - w) << endl;
}

signed main(int argc, char *argv[]) {
  solver();
}


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

int comp(const void* p, const void* q) {
    return strcmp((char*)p, (char*)q);
}

int main() {
    int n;
    char s[200000][15] = { 0 };
    int max = 0;
    int temp = 1;

    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%s", s[i]);
    qsort(s, n, sizeof(s[0]), comp);
    for (int i = 0; i < n ; i++) {     
        if (strcmp(s[i],s[i+1])==0)temp++ ;
        else {
            if (max <= temp) max = temp;
            temp = 1;
        }
    }
    temp = 1;
    for (int i = 0; i < n  ; i++) {
        if (strcmp(s[i], s[i + 1]) == 0)temp++;
        else if (temp == max) {
            printf("%s\n", s[i]);
            temp = 1;
        }
        else temp = 1;
    }
    return 0;
}

Measured memory_bytes: 6012
i = list(map(int, input().split()))
HH = i[0]
WW = i[1]
atai = HH*WW
ans = int(atai/2)
if ((HH % 2) * (WW % 2) == 1):
    ans = ans +1
#amari = divmod(atai,2)
#ans = int(atai/2) + amari[1]
#ans = int(atai/2) + (atai % 2)
#print (atai)
#print (int(atai/2))
if ((HH == 1) or (WW == 1)):
    ans = 1
print (ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>

using namespace std;

int fact(int n){
    long int sum=1;
    long int X=(int)pow(10,9)+7;
    for(long int i=1;i<=n;i++){
        sum=(sum*i)%X;
    }
    return (int)sum;
}

int main(){
    long int N,M,a,b;

    cin >> N;
    cin >> M;

    if(N==M){
        a=fact(N);
        b=fact(M);
        cout << (2*a*b)%((int)pow(10,9)+7) << endl;
    }else if((N-M)==1){
        a=fact(M);
        b=fact(N);
        cout << (a*b)%((int)pow(10,9)+7) << endl;
    }else if((M-N)==1){
        a=fact(N);
        b=fact(M);
        cout << (a*b)%((int)pow(10,9)+7) << endl;
    }else{
        cout << "0" << endl;
    }

}

Measured memory_bytes: 888
n,k = map(int,input().split())
h = [int(input()) for _ in range(n)]

#n,k = 7,3
#h = [10,11,12,14,15,20,0]
h.sort()

ans = 10**10
for i in range(n-k+1):
  ans = min(h[i+k-1] - h[i] , ans)

print(ans)




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

int main() {
    using namespace std;
    unsigned long T_1, T_2, A_1, A_2, B_1, B_2;
    cin >> T_1 >> T_2 >> A_1 >> A_2 >> B_1 >> B_2;
    if(A_1 < B_1){
        swap(A_1, B_1);
        swap(A_2, B_2);
    }
    {
        auto t_1 = min(A_1, B_1);
        auto t_2 = min(A_2, B_2);
        A_1 -= t_1;
        A_2 -= t_2;
        B_1 -= t_1;
        B_2 -= t_2;
    }
    A_1 *= T_1;
    A_2 *= T_2;
    B_1 *= T_1;
    B_2 *= T_2;
    auto t_1 = A_1;
    if(A_1 + A_2 > B_1 + B_2)return 0 & puts("0");
    if(A_1 + A_2 == B_1 + B_2)return 0 & puts("infinity");
    auto t_2 = B_1 + B_2 - (A_1 + A_2);
    cout << 2 * ((t_1 - 1) / t_2) + (t_1 % t_2 == 0) + 1 << endl;
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    set<vector<int> > s;
    vector<int> a(3);
    for(int i=0; i<n; i++){
        for(int j=0; j<3; j++){
            cin >> a[j];
        }
        sort(a.begin(), a.end());
        s.insert(a);
    }
    cout << n-s.size() << endl;
    return 0;
}



Measured memory_bytes: 3256
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 2e6 + 6;
const ll MOD = 1e9+7;
 
int parent[N];
 
int gcd(int a, int b) { 
    if (a == 0) 
        return b;  
    return gcd(b%a, a);  
} 
   
int lcm(int a, int b) {  
    return (a*b)/gcd(a,b);  
} 
 
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
 
int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}
 
void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}
 
ll nCr(ll n, ll r) {
    ll res = 1;
    for(ll i=1;i<=r;i++) {
        res = res * (n - r + i) / i;
        // is different from
        // res *= (n -r + i) / i;
    }
    return res;
}
 
int ask(int i, int j) {
    cout << "? " << i + 1 << ' ' << j + 1 << endl;
    int v;
    cin >> v;
    return v;
}

void solve() {
    ll n;
    cin >> n;
    ll res = modpow(10, n, MOD) + modpow(8, n, MOD) - 2LL * modpow(9, n, MOD) + 2LL * MOD;
    res = (res + MOD) % MOD;
    cout << res << endl;
    return;
} 

int main()
{
    IOS
    //int t;
    //cin >> t;
    //while(t--) 
    solve();
    return 0; 
}


Measured memory_bytes: 3648
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	n <- readInt
	[ t, a ] <- readInts
	hs <- readInts
	let
		ts = map ( ( t * 1000 - ) . ( * 6 ) ) hs
		ds = map ( abs . ( a * 1000 - ) ) ts
	print $ snd $ minimum $ zip ds [ 1 .. ]

Measured memory_bytes: 1020
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <bitset>
#include <string>
using namespace std;

typedef long long lint;
typedef vector<lint> vl;
typedef pair<lint,lint> pll;

#define REP(i,n) for(lint i=0; i<n; i++)
#define RPA(i,s,e) for(lint i=s; i<=e; i++)
#define RPD(i,s,e) for(lint i=s; i>=e; i--)
#define PB(a) push_back(a)
#define MP(i,s) make_pair(i,s)
#define SZ(a) (lint)(a).size()
#define ALL(a) (a).begin(), (a).end()
#define PRT(a) cerr << #a << " = " << (a) << endl
#define PRT2(a,b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << endl
#define PRT3(a,b,c) cerr << (a) << ", " << (b) << ", " << (c) << endl

lint n;
vector<string> field;

bool check(lint x, lint y, lint w, lint h) {
	if(x+w > 5 || y+h > 5) return false;

	REP(i,w) {
		REP(j,h) {
			lint xx = x + i;
			lint yy = y + j;
			if(field[yy][xx] == '0') return false;
		}
	}
	return true;
}

void solve() {
	lint ans = 0;
	REP(i,5) REP(j,5) RPA(w,1,5) RPA(h,1,5) {
		if(check(i,j,w,h)) {
			ans = max(ans, w * h);
		}
	}
	cout << ans << endl;
}

void coding() {
	cin >> n;
	REP(t,n) {
		field = vector<string>(5);
		REP(i,5) {
			field[i] = string(5, '0');
			REP(j,5) {
				cin>>field[i][j];
			}
		}
		solve();
	}
}

// #define _LOCAL_TEST

int main() {
#ifdef _LOCAL_TEST
	clock_t startTime = clock();
	freopen("test.dat", "r", stdin);
#endif

	coding();

#ifdef _LOCAL_TEST
	clock_t elapsedTime = clock() - startTime;
	cout << endl;
	cout << (elapsedTime / 1000.0) << " sec elapsed." << endl;
	cout << "This is local test" << endl;
	cout << "Do not forget to comment out _LOCAL_TEST" << endl << endl;
#endif
}

Measured memory_bytes: 1208
class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        if n < r:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

def main():
    N, M, K = map(int, input().split())
    MOD = 10 ** 9 + 7
    comb = Combination(N*M)
    ans = 0
    for i in range(M):
        ans += i * (M - i) * N * N
        ans %= MOD
    
    for i in range(N):
        ans += i * (N - i) * M * M
        ans %= MOD

    ans *= comb(N*M-2,K-2)
    ans %= MOD
    print(ans)



if __name__ == "__main__":
    main()

Measured memory_bytes: 68336
import java.util.*;
class Main{
    static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int N = sc.nextInt();
        int M = sc.nextInt();
        long[] H = new long[N+1];
        int[] A = new int[N+M];
        int[] B = new int[N+M];
        long[] C = new long[N+1];
        long temp = 0;
        for(int i=1;i<=N;i++){
            H[i]=sc.nextLong();
            C[i]=H[i];
        }
        for(int i=0;i<M;i++){
            A[i]=sc.nextInt();
            B[i]=sc.nextInt();
            if(C[A[i]]<C[B[i]])
                H[A[i]]=0;
            if(C[A[i]]>C[B[i]])
                H[B[i]]=0;
            if(C[A[i]]==C[B[i]]){
                H[A[i]]=0;
                H[B[i]]=0;
            }
        }
        for(int i=1;i<=N;i++){
            //System.out.println(H[i]);
            if(H[i]!=0)
                temp++;
        }
        System.out.println(temp);
    }
}

Measured memory_bytes: 63264
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll MOD=1000000007;
 
int main() {
    string s;
    cin >> s;
    bool t=false;
    rep(i,s.size()){
        if (s[i]=='7') t=true;
    }
    if (t) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3640
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		long ans = 1;
		for(int i = 1; i < n+1; i++){
			ans = ans * i % 1000000007;
		}
		System.out.println(ans);
	}
}

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


int main()
{
long long a , b, n ;
cin >> n >> a >> b ;
long long z;
z = n/(a+b);

//if (a==0){cout<<0;return 0;}
if (z==0){
    if (n>a){cout << a; return 0;}
    else cout << n ;return 0 ;
}
long long ans= z*a;
ans+=a;
z = z*a+z*b;
z+=a;
if (z<=n)cout << ans;
else cout << ans-(z-n);
}


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

using namespace std;
using ll = long long;
const int MAXN = 1.01e5;
int cnt[MAXN];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  memset(cnt, 0, sizeof cnt);
  ll sum = 0;
  int n; cin >> n;
  for(int i = 0; i < n; ++i) {
    int x; cin >> x;
    cnt[x]++;
    sum += x;
  }
  int q; cin >> q;
  while(q--) {
    int b, c;
    cin >> b >> c;
    sum += (c - b) * cnt[b];
    cnt[c] += cnt[b];
    cnt[b] = 0;
    cout << sum << '\n';
  }
  return 0;
}


Measured memory_bytes: 4036
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<char,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;


int main(){
    LL n;cin >> n;
    LL a[5];
    for (int i = 0; i < 5; i++) {
        cin >> a[i];
    }
    LL ans = 0;
    for (int i = 0; i < 5; i++) {
        ans = max(ans,(n+a[i]-1)/a[i]+4);
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  SCIN(s);
  CIN(K);

  set< string > d;
  REP(i, s.size()) {
    REP(j, 5) {
      string tmp = s.substr(i, j + 1);
      d.erase(tmp);
      d.insert(tmp);
    }
  }

  // string ans = *(d.begin() + d.size() - K + 1);

  auto itr = d.begin();
  // cout << *(d.begin() + (auto)K - 1) << endl;

  
  REP(i, K - 1) {
    itr++;
    // debug(*itr);
  }
  
  string ans = *itr;

  
  /*
  for (auto itr = d.begin(); itr != d.end() - K + 1; ++itr) {
    ans = *itr;
  }
  */
  

  cout << ans << endl;
  

  return 0;
}




Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  int n;
  while(cin>>n,n!=-1){
    double x=n/2.0;
    while(abs(pow(x,3)-n)>=0.00001*n){
      x=x-(double)(pow(x,3)-n)/(3*pow(x,2));
    }
    printf("%f\n",x);
  }
  return 0;
}



Measured memory_bytes: 3208
import Data.List
import Control.Monad

main :: IO ()
main = do
  n <- readLn
  ws <- map read.words<$> getLine :: IO [Int]
  list <- forM [1..n-1] $ \i -> do
    return  (abs $ (sum (take i ws)) - (sum (drop i ws)))
  print $ minimum list


Measured memory_bytes: 1020
package main

import (
	"fmt"
)

func main() {
	var d, n int
	fmt.Scan(&d, &n)

	if d == 0 {
		if n == 100 {
			n++
		}
		fmt.Println(n)
	} else if d == 1 {
		if n == 100 {
			n++
		}
		fmt.Println(100 * n)
	} else if d == 2 {
		if n == 100 {
			n++
		}
		fmt.Println(10000 * n)
	}
}


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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	int k;
	cin>>k;
	set<string> data;
	for(int len =1; len <= k; ++len){
		for(int i=0; i<s.size(); ++i){
			data.insert(s.substr(i,len));
		}
	}
	for(int i=0; i<k-1; ++i){
		data.erase(data.begin());
	}
	cout<<*data.begin()<<endl;

	return 0;
}


Measured memory_bytes: 1664
n, k = map(int, input().split())
a = list(map(int, input().split()))
now = 1
cnt = 0
loop = 0
cnts = [-1] * n
cnts[now - 1] = cnt
visited = [False] * n
visited[now - 1] = True
li = [now]

while True:
    cnt += 1
    now = a[now - 1]
    li.append(now)

    if cnt == k:
        print(now)
        exit()
    if visited[now - 1]:
        loop = (cnt - cnts[now - 1])
        pre = cnts[now - 1]
        print(li[pre + (k - pre) % loop])
        exit()

    cnts[now - 1] = cnt
    visited[now - 1] = True


Measured memory_bytes: 95452
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <set>
#include <list>
#include <map>
#include <queue>
#include <iterator>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <utility>
#include <functional>
#include <stack>
#include <deque>
#include <sstream>
using namespace std;

#define ll long long
#define ld long double
#define pdd pair<double,double>
#define pll pair<ll, ll>
#define pii pair<int,int>

#define mod 1000000007
#define infinity (ll)1e18+1
#define PI 3.14159265358979

#define MP make_pair
#define SZ size()
#define PB push_back

#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define vpii vector<pii>

#define FOR(i,a,b) for(ll i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(ll i = (b) - 1; i >= (a); --i)
#define REPEAT(i) FOR(counter1234,0,i)
#define ALL(a) a.begin(), a.end()

int f(int a, int b)
{
	return a > b;
}

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

	vll w(n), v(n);
	FOR(i, 0, n)
		cin >> w[i] >> v[i];

	ll best = 0;

	vi w0, w1, w2, w3;
	FOR(i, 0, n)
	{
		if (w[i] - w[0] == 0) w0.push_back(v[i]);
		if (w[i] - w[0] == 1) w1.push_back(v[i]);
		if (w[i] - w[0] == 2) w2.push_back(v[i]);
		if (w[i] - w[0] == 3) w3.push_back(v[i]);
	}
	
	sort(w0.begin(), w0.end(), f);
	sort(w1.begin(), w1.end(), f);
	sort(w2.begin(), w2.end(), f);
	sort(w3.begin(), w3.end(), f);

	
	ll curr = 0;
	FOR(x1, 0, w0.size() + 1)
		FOR(x2, 0, w1.size() + 1)
		FOR(x3, 0, w2.size() + 1)
		FOR(x4, 0, w3.size() + 1)
	{
		if (x1*w[0] + x2*(w[0] + 1) + x3*(w[0] + 2) + x4*(w[0] + 3) <= W)
		{
			curr = 0;
			FOR(i, 0, x1)
				curr += w0[i];
			FOR(i, 0, x2)
				curr += w1[i];
			FOR(i, 0, x3)
				curr += w2[i];
			FOR(i, 0, x4)
				curr += w3[i];

			best = max(best, curr);
		}
	}



	cout << best;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back 
#define mp make_pair
typedef long long ll;



int main(){
	int n; cin>>n;
	map<string,int> anagram;
	ll ans=0;
	for(int i=0;i<n;i++){
		string s; cin>>s;
		sort(all(s));
		ans+=anagram[s];
		anagram[s]++;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 11136
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

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

int main()
{
  long long H;
  scanf("%lld", &H);
  long long W;
  scanf("%lld", &W);
  std::vector<std::string> A(H);
  for (int i = 0; i < H; i++)
  {
    std::cin >> A[i];
  }
  queue<pair<int, int>> q;
  int seen[1001][1001] = {};
  for (int i = 0; i < H; ++i)
  {
    for (int j = 0; j < W; ++j)
    {
      seen[i][j] = INF;
      if (A[i][j] == '#')
      {
        q.emplace(j, i);
        seen[i][j] = 0;
      }
    }
  }
  int ans = 0;
  while (!q.empty())
  {
    auto p = q.front();
    q.pop();
    for (int i = 0; i < 4; ++i)
    {
      int x = p.first, y = p.second;
      int nx = x + dx[i], ny = y + dy[i];
      if (0 <= nx && nx < W && 0 <= ny && ny < H && seen[ny][nx] == INF)
      {
        q.emplace(nx, ny);
        seen[ny][nx] = seen[y][x] + 1;
        ans = seen[ny][nx];
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 13456
def getlist():
	return list(map(int, input().split()))

N, x = getlist()
if x == 1 or x == 2 * N - 1:
	print("No")
else:
	print("Yes")
	L = [i for i in range(1, 2 * N)]
	b = [2 * N - 1, x, 1]
	L.remove(2 * N - 1)
	L.remove(x)
	L.remove(1)
	a = L[:N - 2]
	c = L[N - 2:]
	a.reverse()
	c.reverse()
	ans = a + b + c
	for i in range(2 * N - 1):
		print(ans[i])

Measured memory_bytes: 15684
#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <functional>
#include <cassert>
#include <iomanip>
#include <array>
#include <time.h>
#include <limits.h>
#pragma comment(lib, "winmm.lib")
#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
using namespace std;

vector<int>  A(100001);
vector<int> L(100001, (1 << 30));

void Hoge(){
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif

	int n;
	string str1;

	cin >> n;
	rep(i, n) cin >> A[i];

	L.at(0) = A.at(0);
	int length = 1;
	for (int i = 1; i < n; i++){
		*lower_bound(L.begin(), L.end(), A[i]) = A[i];
	}

	int ans = (int)distance(L.begin(), lower_bound(L.begin(), L.end(), (1 << 30)));
	cout << ans << endl;

}

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

	Hoge();
	return 0;
}

Measured memory_bytes: 3452
#include <bits/stdc++.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int dp[1002][4100];
signed main(){
	int a,b;
	cin>>a>>b;
	f(i,b+1){
		f(j,4100){
			dp[i][j]=INF;
		}
	}
	dp[0][0]=0;
	f(i,b){
		bool bo[12];
		f(j,a)bo[j]=false;
		int c,d;
		cin>>c>>d;
		f(j,d){
			int e;
			cin>>e;
			bo[e-1]=true;
		}
		int x=pow(2,a);
		f(j,x){
			int z=j,y=0;
			dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
			int vz=1;
			f(k,a){
				y+=vz*max((int)bo[k],z%2);
				z/=2;
				vz*=2;
			}
			dp[i+1][y]=min({dp[i+1][y],dp[i][j]+c,dp[i][y]});
		}
	}
	if(dp[b][(int)(pow(2,a))-1]==INF)puts("-1");
	else cout<<dp[b][(int)(pow(2,a))-1]<<endl;
}
 


Measured memory_bytes: 32384
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef vector<int> vi;
typedef vector<vi> vvi;

int main() {FIN

	int i, j, n, m;
	string s, t, r = "";

	cin >> s;
	cin >> t;
	n = s.size(); m = t.size();
	vvi dp(n + 1, vi(m + 1));

	for (i = 1; i <= n; i++) {
		for (j = 1; j <= m; j++) {
			if (s[i - 1] == t[j - 1])
				dp[i][j] = max(dp[i - 1][j - 1] + 1, max(dp[i - 1][j], dp[i][j - 1]));
			else
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
		}
	}

	i = n; j = m;
	while (i > 0 and j > 0) {
		if (dp[i][j] == dp[i - 1][j - 1] + 1 and s[i - 1] == t[j - 1]) {
			r += s[i - 1];
			i--, j--;
		} else {
			if (dp[i - 1][j] == dp[i][j])
				i--;
			else
				j--;
		}
	}

	reverse(r.begin(), r.end());
	cout << r << "\n";

	return 0;
}

Measured memory_bytes: 38592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, K;
    string S;
    cin >> N >> K >> S;
    int l = 0, r = 0;
    int zcnt = 0, ans = 0;
    
    rep(i, N) {
        if (
            ((i == 0) && (S[i] == '0')) ||
            ((i > 0) && (S[i - 1] == '1') && (S[i] == '0'))
        ) {
            zcnt++;
        }
        else if ((i < (N - 1)) && (S[i] == '1') && (S[i + 1] == '0')) {
            if (zcnt == K) {
                r = i;
                ans = max(ans, r - l + 1);
                
                reps(ii, l + 1, r + 1) {
                    if ((S[ii] == '1') && (S[ii - 1] == '0')) {
                        l = ii;
                        zcnt--;
                        break;
                    }
                }
            }
        }
    }
    
    ans = max(ans, N - l);
    cout << ans << endl;
    return 0;
}

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

int main(){
  string s;
  cin>>s;
  for(int i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      cout<<"Bad"<<endl;
      return 0;
    }
  }
  cout<<"Good"<<endl;
  return 0;
}

Measured memory_bytes: 256
/**
DufauX-XuafuD
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define reset(x) memset(x,-1,sizeof(x))
#define CheckBit(a,b) (a&(1ll<<b))
#define SetBit(a,b) a=(a|(1ll<<b))
#define UnSetBit(a,b) a=(a&(~(1ll<<b)))
#define maxx 10000006
#define PI 2*acos(0.0)
const long long INF = 2000000000000000000LL;	// 2e18
const int inf = 0x3f3f3f3f;	// 1061109567
const long double EPS = 1e-9;
//bitset<maxx/2>vis;
//bitset<maxx>pr;
//int mobi[maxx+10];
//vector<ll>prime;
//void sieve(){
//    ll x=maxx/2, y=sqrt(maxx)/2;
//    for(ll i=1;i<=y;i++){
//        if(vis[i]==0){
//            for(ll j=(i*(i+1)*2);j<x;j+=(2*i)+1)
//                vis[j]=1;
//        }
//    }
//    prime.push_back(2);
//    for(ll i=3;i<maxx;i+=2)
//        if(vis[i/2]==0)
//        prime.push_back(i);
//}
//void generate_mobius()
//{
//    for(int i=0;i<maxx;i++)mobi[i]=1;
//    for(int i=2;i<maxx;i++){
//        if(!pr[i]){
//            mobi[i]*=-1;
//            for(int j=i+i;j<maxx;j+=i){
//                pr[j]=1;
//                mobi[j]*=(j%(i*i)?-1:0);
//            }
//        }
//    }
//}
//bool isprime(ll a)
//{
//    if(a==1)return false;
//    if(a==2)return true;
//    if(a%2==0)return false;
//    for(ll i=0;i<prime.size() && prime[i]*prime[i]<=a;i++)
//        if(a%prime[i]==0)return false;
//    return true;
//}
/* Calculate ( a*b ) %c */
inline ll mulmod(ll a, ll b, ll c) {
    ll ret = 0 , cur = a % c ;
    while(b) { if(b%2) ret=(ret+cur)%c; cur=(cur<<1)%c; b=b>>1; }
    return ret%c;
}
//Calculate (b^p)%m || modular inverse: b^-1 = bigmod(b, m-2, m)
inline ll bigmod(ll b, ll p, ll m){
    ll ret = 1, cur = b % m;
    while(p) { if(p&1) ret=(ret*cur)%m; cur=(cur*cur)%m; p=p>>1; }
    return ret;
}
inline ll modulo(ll a,ll b,ll c) { //Same as big mod, use for numbers over 1e10
    ll ret = 1 , cur = a%c ;
    while(b) { if(b%2) ret=mulmod(ret,cur,c); cur=mulmod(cur,cur,c); b=b>>1; }
    return ret%c ;
}
inline ll power(ll b, ll p){
    ll ret = 1, cur = b;
    while(p) { if(p&1) ret=(ret*cur); cur=(cur*cur); p=p>>1; }
    return ret;
}
ll lcm(ll a,ll b)
{
    return (a/__gcd(a,b))*b;
}
ll gcd(ll a,ll b)
{
    return __gcd(a,b);
}
ll arr1[]={1,3,5,7,8,10,12};
ll arr2[]={4,6,9,11};
void Dufaux()
{
    ll n,m;
    cin>>n>>m;
    if(n==2 || m==2){
        cout<<"No"<<endl;
        return;
    }
    if(binary_search(arr1,arr1+7,n)){
        if(binary_search(arr1,arr1+7,m)){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    else{
       if(binary_search(arr2,arr2+4,m)){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
}
int main()
{
    FastIO;
	///sieve();
	///generate_mobius();
	int test=1;
	while(test--){
        Dufaux();
	}
	return 0;
}






Measured memory_bytes: 3564
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
#define pow2(x) ((long long)((long long)1<<x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

signed main(){
	ll K,A,B;
	cin >> K >> A >> B;
	ll DP[3] = {1,2};
	ll i = K-1;
	while(i){
		i--;
		if(DP[0]>=A)DP[2] = max(DP[1]+1,DP[0]+B-A);
		else DP[2] = DP[1]+1;
		DP[0] = DP[1];
		DP[1] = DP[2];
	}
	cout << DP[min(2,K)] << endl;
}

Measured memory_bytes: 888
n=int(input())
d=list(map(int,input().split()))
if d[0] != 0:
    print(0)
    exit()
d.sort()
if d[1] == 0:
    print(0)
    exit()
cnt = 1
pre = 1
ans =1
i = 1
mod = 998244353
while i < n:
    if d[i]-1 != d[i-1]:
        ans = 0
    while i!=n-1 and d[i+1] == d[i]:
        i+=1
        cnt+=1
    ans *= pow(pre,cnt,mod)
    ans %= mod
    pre =cnt
    cnt = 1
    i+=1
print(ans)

Measured memory_bytes: 54816
N,M = map(int, input().split())
L = []
C = []
for i in range(M):
    L.append([int(l) for l in input().split()])
    C.append([int(c) for c in input().split()])
    
dp = [10**8+1 for j in range(2**N)]
dp[0] = 0

for i in range(1, M+1):
    temp = 0
    for k in range(len(C[i-1])):
        temp += 2**(C[i-1][k]-1)
    for j in range(2**N):
        if i == 1:
            if j | temp == temp and j != 0:
                dp[j] = L[i-1][0]

        else:
            dp[temp | j] = min(dp[temp | j], dp[j]+L[i-1][0])
      
if dp[-1] >= 10**8+1:
    print(-1)
else:
    print(dp[-1])

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

int main(){
	string str[100];
	int k = -1;
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		k++;
		for(int i = 0; i < 3; i++){
			if(y1 != y2 && x1 != x2){
				double b, c, d;
				b = (x1-x2)/(-y1+y2);
				c = (-y1*x2+y2*x1)/(-y1+y2);
				d = x3+b*y3;
				if(((c-xp)/b > yp && yp < (d-xp)/b) || ((c-xp)/b < yp && yp > (d-xp)/b)){
					str[k] = "NO";
					continue;
				}
			}
			else if(y1 == y2){
				if((y1 > yp && yp < y3) || (y1 < yp && yp > y3)){
					str[k] = "NO";
					continue;
				}
			}
			else if(x1 == x2){
				if((x1 > xp && xp < x3) || (x1 < xp && xp > x3)){
					str[k] = "NO";
					continue;
				}
			}
			str[k] = "YES";
			swap(x2,x3);
			swap(x2,x1);
			swap(y2,y3);
			swap(y2,y1);
		}
	}
	for(int i = 0; i < k+1; i++){
		cout << str[i] << endl;
	}
}

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

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

    vector<int> a(4);
    for (int i = 0; i < 4; i++) {
        a[i] = int(s[i]);
    }
    sort(a.begin(), a.end());


    if ((a[1] != a[2]) && (a[0] == a[1]) && (a[2] == a[3])) {
        cout << "Yes" << endl;;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256